XB-llama - ⚙️ 推理参数
The sampling knobs for your local LLM, tuned for storyboards
- parameters
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_statesfeature 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 fromXB_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.
Inputs (13)
| Name | Type | Default | Description |
|---|---|---|---|
| max_tokens | INT | 61440–8192 | 生成 Token 上限 6144 确保 6-8 镜分镜脚本不会截断 |
| top_k | INT | 400–1000 | 词汇库检索范围 40 配合 0.60 温度,兼顾格式严谨与词汇多样 |
| top_p | FLOAT | 0.900–1 | — |
| min_p | FLOAT | 0.050–1 | — |
| typical_p | FLOAT | 1.000–1 | — |
| temperature | FLOAT | 0.600–2 | 温度 0.60 确保 [SHOT_START] 格式严谨,减少幻觉 |
| repeat_penalty | FLOAT | 1.120–10 | 重复惩罚 1.12 避免多镜分镜运镜描述句式复读 |
| frequency_penalty | FLOAT | 0.000–1 | — |
| present_penalty | FLOAT | 0.000–2 | — |
| mirostat_mode | INT | 00–2 | — |
| mirostat_eta | FLOAT | 0.100–1 | — |
| mirostat_tau | FLOAT | 5.000–10 | — |
| state_uid | INT | -1-1–999999 | 使用特定 ID 保存对话状态 (-1 = 使用节点 unique_id) |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| parameters | LLAMACPPARAMS | — |