LLM Sampler Settings
The four knobs that decide how your Llama talks
- llm_sampler
If you loaded a workflow from this pack and spotted a little node labeled "LLM Sampler Settings" dangling off your LlamaVision Chat, you might wonder if you need it. Short answer: no, it's optional, and the pack is nicer than most here - skip it entirely and the model runs on its own defaults (temperature 0.6, top-p 0.9, straight from the model's generation_config.json). This node exists for when you want to override those defaults, and it's the only knob the pack gives you.
The inputs (all four matter, but one dominates)
- temperature (default 0.6) - the big one. Lower (toward 0) makes output more deterministic and repetitive; higher makes it more varied and chatty. For captioning, 0.2–0.4 is the sweet spot. For brainstorming about an image, crank it.
- top_p (default 0.9) - nucleus sampling: keep sampling from the smallest set of tokens whose combined probability clears this threshold. 0.9 is a sensible default; most people leave it alone.
- min_p (default 0) - the modern tail-trimmer. Tokens whose probability falls below
min_p × (top token probability)get dropped. 0 disables it. If you want cleaner, less meandering output, 0.05 is a good starting point. - top_k (default 0) - keep only the top K tokens at each step. 0 disables it. Easy to overdo; a small nonzero value makes output rigid fast.
How it works
Refreshingly simple under the hood. The node builds a small list of (name, value) pairs in a fixed order - top_k, then top_p, then min_p, then temperature, which the author notes is llama.cpp's default sampling order - and hands that bundle to LlamaVision Chat as the llm_sampler input. Values that are "off" (top_k 0, top_p 1.0, min_p 0) get skipped, so you never pass a no-op by accident. Chat then forwards the list as generation kwargs to the model's generate().
When it's worth wiring up
The one time I'd actually reach for it is dataset captioning, where consistency beats creativity. Drop temperature to ~0.2, pin the seed in LlamaVision Chat, and you get repeatable captions you can diff against. For casual chatting with your renders, leave it out - the defaults are the defaults for a reason. And the community's debugging rule applies here too: change one thing at a time.
The catches
There's no max-tokens control here (the chat node hardcodes 2048), and the sampler settings only affect text generation, not the image. The output only does anything if it's actually connected to LlamaVision Chat's llm_sampler input - an orphaned LLM Sampler Settings node is decorative. And one honest note: the sampling order is fixed, so you can't reorder steps even if you have opinions about it.
Installation
It ships with the pack, so:
cd ComfyUI/custom_nodes
git clone https://github.com/asaddi/YALLM-LlamaVision
pip install -r YALLM-LlamaVision/requirements.txt
Or ComfyUI Manager → search "YALLM-LlamaVision". The requirements pull in transformers>=4.46, accelerate, bitsandbytes, and pydantic, and will upgrade your transformers if needed - worth knowing if other nodes in your setup are sensitive to that.
Troubleshooting
- Changing the sliders does nothing → check the node is actually wired into LlamaVision Chat. An unconnected sampler is a no-op.
- Output got weird after "fixing" the settings → you probably set top_k to a small nonzero value or min_p too high. Reset to defaults (0.6 / 0 / 0.9 / 0) and move one knob at a time.
Inputs (4)
| Name | Type | Default | Description |
|---|---|---|---|
| temperature | FLOAT | 0.60 | — |
| min_p | FLOAT | 0.000–1 | — |
| top_p | FLOAT | 0.900–1 | — |
| top_k | INT | 0 | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| llm_sampler | LLMSAMPLER | — |