Nodes/XB_ToolBox/XB-llama - ⚙️ 推理参数
ComfyUI Node

XB-llama - ⚙️ 推理参数

The sampling knobs for your local LLM, tuned for storyboards

By wjluoxiao·Created 5 months ago·Updated 6 days ago· 302
XB-llama - ⚙️ 推理参数
    • parameters
    max_tokens6144
    top_k40
    top_p0.90
    min_p0.05
    typical_p1.00
    temperature0.60
    repeat_penalty1.12
    frequency_penalty0.00
    present_penalty0.00
    mirostat_mode0
    mirostat_eta0.10
    mirostat_tau5.00
    state_uid-1

    If you've ever stared at a llama.cpp config and wondered what min_p does, this node is where that rubber meets the road. XB_llamaParameters bundles the sampling parameters for the XB-llama inference nodes into one tidy LLAMACPPARAMS wire - you set it once, wire it into XB_llamaInstruct (or XB_llamaStoryboardInstruct), and forget it.

    The clever bit is that the defaults aren't arbitrary - they're tuned for the pack's actual use case, which is generating structured, format-strict storyboard and prompt output, not freeform chat. The tooltips spell the reasoning out: temperature 0.60 to keep [SHOT_START] framing intact and cut hallucinations, top_k 40 paired with that temperature for "format rigor with vocabulary variety," repeat_penalty 1.12 to stop multi-shot camera descriptions from going in circles, and max_tokens 6144 so a 6–8 shot script doesn't get truncated mid-generation. These are sensible defaults that a beginner should mostly leave alone - this is the "the author already did the tuning" node.

    The inputs you actually touch

    There are fifteen knobs, and you'll realistically touch three:

    • max_tokens (6144) - the output ceiling. Raise it if long storyboards keep cutting off; lower it for quick single-shot responses.
    • temperature (0.6) - the creativity dial. 0.6 keeps structure tight. If you want more varied, less rigid output, nudge it up toward 0.8–1.0 and accept the format slips.
    • state_uid (-1) - pairs with the save_states feature on the instruct nodes: −1 keys the saved conversation state to the node's own unique ID; set a specific number to share state across nodes or address it from XB_llamaCleanStates.

    The rest - top_p, min_p, typical_p, repeat_penalty, frequency/present penalties, mirostat_mode/eta/tau - are standard llama.cpp fare. The defaults are fine; they exist so you can tune, not so you have to.

    Output

    A single LLAMACPPARAMS wire that plugs into the parameters input of the instruct nodes. It's just a dictionary of kwargs that gets forwarded to create_chat_completion - nothing executes at this node, no model needed. You can even leave the node unplugged entirely and the instruct nodes run on their own built-in defaults.

    Installing it

    Part of XB_ToolBox - ComfyUI Manager (XB_ToolBox) or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/WJLUOXIAO/XB_ToolBox.git
    

    restart, done. This node is pure parameter plumbing, so it has zero dependencies - but note that the instruct nodes it feeds do need llama-cpp-python installed (see the XB_llamaModelLoader article for that install).

    One thing worth knowing

    The defaults are tuned for the storyboard format, which means if you use these nodes for something else - general chat, creative writing, freeform prompt enhancement - you may want to loosen them up: bump temperature toward 0.8, drop repeat_penalty closer to 1.05. The [SHOT_START]-tight defaults are a feature when you're generating machine-parseable output and a mild cage when you're not. Also, if your model supports Mirostat, the node exposes it but leaves it off (mode 0); llama.cpp's Mirostat can be great for stable format adherence, but it interacts with temperature in ways that aren't always obvious, so the author's default of off is the safe start.

    CategoryXB-llama

    Inputs (13)

    NameTypeDefaultDescription
    max_tokensINT61440–8192生成 Token 上限 6144 确保 6-8 镜分镜脚本不会截断
    top_kINT400–1000词汇库检索范围 40 配合 0.60 温度,兼顾格式严谨与词汇多样
    top_pFLOAT0.900–1
    min_pFLOAT0.050–1
    typical_pFLOAT1.000–1
    temperatureFLOAT0.600–2温度 0.60 确保 [SHOT_START] 格式严谨,减少幻觉
    repeat_penaltyFLOAT1.120–10重复惩罚 1.12 避免多镜分镜运镜描述句式复读
    frequency_penaltyFLOAT0.000–1
    present_penaltyFLOAT0.000–2
    mirostat_modeINT00–2
    mirostat_etaFLOAT0.100–1
    mirostat_tauFLOAT5.000–10
    state_uidINT-1-1–999999使用特定 ID 保存对话状态 (-1 = 使用节点 unique_id)

    Outputs (1)

    NameTypeDescription
    parametersLLAMACPPARAMS