Nodes/comfyui_LLM_party/Extra Model Parameters
ComfyUI Node

Extra Model Parameters

The sampling knobs an LLM node doesn't expose directly

By heshengtao·Created 2 years ago·Updated 7 days ago· 2,321
Extra Model Parameters
    • extra_parameters
    json_outfalse
    n1
    stop
    presence_penalty0.0
    frequency_penalty0.0
    repetition_penalty1.0
    min_length0
    logprobsfalse
    echofalse
    best_of1
    user
    top_p1.0
    top_k50
    seed42

    Most of this pack's LLM nodes keep their main interface simple - a prompt, a model name, credentials. But the actual chat completion APIs underneath support a much longer list of generation parameters, and rather than cluttering every LLM node with a dozen extra widgets nobody usually touches, this pack bundles them into their own node. Extra Model Parameters builds a dictionary of API sampling settings and hands it off as a single output, so an LLM node's input list stays short until you actually need to reach for fine control.

    The ones that actually matter for a beginner

    There are fourteen fields here, which is a lot, but most of them are legacy holdovers from the older text-completion API era (logprobs, echo, best_of - these largely don't apply to modern chat-completion endpoints and exist mostly for compatibility with older or non-chat-style backends). The handful worth actually understanding:

    top_p (0-1, default 1) and top_k (default 50) both control how much the model narrows its choice of next token - top_p by cumulative probability mass, top_k by a fixed count of top candidates. Lower either one and output gets more focused and predictable; raise them and you get more varied, sometimes more surprising output. presence_penalty and frequency_penalty (both 0-1, step 0.1) discourage repetition, in slightly different ways - presence penalty nudges the model away from any token it's already used at all, frequency penalty scales with how often it's used a token, so cranking frequency penalty is the stronger lever against a model that gets stuck repeating the same phrase. repetition_penalty (default 1, meaning off) is a separate, related repetition control some backends support alongside or instead of the two above. seed (default 42) is the one to know if you want reproducible output - same prompt, same seed, same model, same result (support for this varies by provider; not every API respects a seed the same way). stop lets you specify a string that ends generation early once the model produces it - handy for cutting off output right after a structured answer instead of letting the model ramble past it. n controls how many separate completions to request in one call, and json_out toggles whether the response should be requested in JSON mode where the backend supports it.

    min_length and user round out the set - min_length for a floor on output length where supported, user for passing an end-user identifier through to providers that use it for abuse monitoring (OpenAI does this).

    Output is a single extra_parameters value of type DICT, which wires into the optional extra-parameters input on this pack's main LLM/API nodes.

    Where it fits

    Leave this node out entirely and your LLM nodes just use provider defaults - which is fine for most use. Reach for it when you need something specific: forcing deterministic output with seed for reproducible testing, dialing down repetition when a model's getting stuck in a loop, or setting a stop sequence so a structured-output prompt doesn't run past the JSON object you actually wanted.

    Installing it

    Ships with the full pack:

    • ComfyUI Manager: search "comfyui_LLM_party", install, restart ComfyUI.
    • Manual: cd ComfyUI/custom_nodes && git clone https://github.com/heshengtao/comfyui_LLM_party, then pip install -r requirements.txt inside your ComfyUI Python environment, restart.

    Common issues

    Not every parameter here is honored by every provider - this node builds a generic dictionary shaped like OpenAI's completions API, but a relay or a different provider behind your base_url may silently ignore fields it doesn't understand rather than erroring, so don't assume a parameter is working just because you didn't get an error. If seed doesn't seem to be producing reproducible output, that's the most likely explanation: check whether the specific backend you're hitting actually supports deterministic seeding before assuming your workflow is doing something wrong.

    If output repetition is still a problem after raising frequency_penalty and presence_penalty, the fix is more often in the prompt than in these dials - penalties nudge token selection, they don't fix a fundamentally repetitive instruction or a model that's simply not well-suited to the task at hand.

    Category大模型派对(llm_party)/模型加载器(model loader)

    Inputs (14)

    NameTypeDefaultDescription
    json_outBOOLEANfalse
    nINT1
    stopSTRING
    presence_penaltyFLOAT0.00–1
    frequency_penaltyFLOAT0.00–1
    repetition_penaltyFLOAT1.00–1
    min_lengthINT0
    logprobsBOOLEANfalse
    echoBOOLEANfalse
    best_ofINT1
    userSTRING
    top_pFLOAT1.00–1
    top_kINT50
    seedINT42

    Outputs (1)

    NameTypeDescription
    extra_parametersDICT