Nodes/ComfyUI-Llama/Call LLM Advanced
ComfyUI Node

Call LLM Advanced

Sampling sliders, penalties, and mirostat — for when Basic isn't enough

By HairlessPrimate·Created 3 years ago·Updated 2 years ago· 71
Call LLM Advanced
  • LLM
  • STRING
prompt
suffix
max_response_tokens16
temperature0.80
top_p0.95
min_p0.05
typical_p1.00
echofalse
frequency_penalty0.00
presence_penalty0.00
repeat_penalty1.10
top_k40
seed-1
tfs_z1.00
mirostat_mode0
mirostat_tau5.00
mirostat_eta0.10

Call LLM Basic is fine until you need to steer the output. This is the steering wheel. Call LLM Advanced takes the same LLM plus prompt and returns the same STRING, but between them it exposes the full sampling toolset from llama.cpp - the same parameters llama.cpp's CLI and llama-cpp-python's create_completion accept. If you've ever tuned a local model, these names will be familiar; if not, here's the short version.

The inputs that matter

The core sampling trio, same as any local-LLM setup:

  • temperature (0.8) - raw creativity dial.
  • top_p (0.95) - nucleus sampling: only sample from tokens whose combined probability hits this threshold.
  • top_k (40) - hard cap on candidate tokens per step. Between these three, temperature is the one you'll actually turn; top_p/top_k mostly sit at defaults.

Then the penalties, which are where you fix "the model won't shut up about the thing it likes":

  • repeat_penalty (1.1) - punishes token repetition. Raise toward 1.2–1.3 if output loops or stutters.
  • frequency_penalty (0) and presence_penalty (0) - OpenAI-style penalties that scale with how often a token has appeared, or whether it's appeared at all.

And the interesting niche stuff:

  • min_p (0.05) - floor relative to the top token's probability; a cleaner modern alternative to top_k that a lot of people prefer.
  • typical_p (1) - "typical sampling"; leave at 1 unless you're specifically experimenting.
  • tfs_z (1) - tail-free sampling, another niche filter. 1 disables it.
  • mirostat_mode / mirostat_tau / mirostat_eta - llama.cpp's adaptive sampling that adjusts temperature as it goes. Mode 0 (default) is off; 2 enables the actual Mirostat, with tau (5) as the target surprise and eta (0.1) as the learning rate. Worth a try if you want hands-off quality.
  • echo (false) - whether to include your prompt in the returned string. Usually leave off.
  • suffix - a string appended after the generation, for the rare "complete the text then add this" cases.
  • seed (-1) - set it for reproducibility.

One output: STRING, the generated text. Same as Basic, same invisible-text trap - wire it into ShowText from ComfyUI-Custom-Scripts to actually see it.

What's disabled here

The README's known-issues list matters for this node specifically: stream, logprobs, stop, stopping_criteria, logits_processor, logits_bias, and grammar are all disabled. So no streaming output, no custom grammar (like GBNF), no stopping sequences. If you came here from a llama.cpp background expecting grammar=, that's the one real gap - you can't constrain output to JSON or a format without it. Plan your prompts around that.

Installing and troubleshooting

Standard pack install - Manager search "ComfyUI-Llama", or:

cd ComfyUI/custom_nodes
git clone https://github.com/daniel-lewis-ab/ComfyUI-Llama

with pip install llama-cpp-python for manual setups, GGUF models in ComfyUI/custom_nodes/ComfyUI-Llama/models, restart, then Ctrl+F5 to hard-refresh. Everything lives under the LLM menu.

One gotcha that bites new Advanced users: if the model starts repeating itself, everyone's first instinct is to crank repeat_penalty to 2.0. That over-corrects and makes output wooden. Move it in small steps (1.1 → 1.15 → 1.2) and watch the console - the pack's error handling is openly not mature, so the terminal is where failures actually show up. And remember the pack's no-loopback limitation: no known way to feed the model's own output back in for a dialogue. It's a one-shot generator, not a chatbot - use it that way and it works great.

CategoryLLM

Inputs (18)

NameTypeDefaultDescription
LLMLLM
promptSTRING
suffixoptSTRING
max_response_tokensoptINT16
temperatureoptFLOAT0.800–1
top_poptFLOAT0.95
min_poptFLOAT0.05
typical_poptFLOAT1.00
echooptBOOLEANfalse
frequency_penaltyoptFLOAT0.00
presence_penaltyoptFLOAT0.00
repeat_penaltyoptFLOAT1.10
top_koptINT40
seedoptINT-1
tfs_zoptFLOAT1.00
mirostat_modeoptINT0
mirostat_tauoptFLOAT5.00
mirostat_etaoptFLOAT0.10

Outputs (1)

NameTypeDescription
STRINGSTRING