ComfyUI Node

LLM Min-P

The modern filter that quietly replaced a lot of top-k fiddling

By asaddi·Created 2 years ago·Updated 17 days ago· 7
LLM Min-P
  • previous
  • llm_sampler
min_p0.05

LLM Min-P is the relative of top-p that the local-LLM crowd has mostly moved to. Top-p cuts off the tail at a fixed cumulative mass, which means it can slice deeper when one token is dominant and hardly at all when the distribution is flat. Min-p flips the logic: any token whose probability is below min_p times the top token's probability gets thrown out. It's a proportional cutoff, so it adapts to how confident the model is at each step instead of applying a fixed rule. That's why it feels better-behaved than top-k in practice - it keeps the model flexible when it's genuinely unsure, and tight when it's confident.

How it fits the chain

YALLM's samplers are chain links, and this is one of them. Set min_p, wire it after a previous sampler's llm_sampler output if you have one, and feed the result to the pack's LLM Chat node. The node appends ("min_p", value) to an ordered list that goes to the provider as the samplers array - and on llama.cpp, the order you chain these is the order they apply. So if you want min-p running before top-k, chain it first.

The honest caveat, straight from the pack README and visible in the source: min-p is not in the official OpenAI API spec. It travels in extra_body, the pack's catch-all for provider-specific parameters. llama.cpp and its derivatives (ollama, LM Studio) speak the extended dialect and honor it; arbitrary hosted OpenAI-compatible endpoints may just ignore the field. For anything llama.cpp-based, though, this is arguably the most useful sampler in the pack - a modern default that a lot of local users keep on permanently.

The inputs and output

  • min_p - a float from 0 to 1, default 0.05. 0.05 means a token only survives if it's at least 5% as likely as the current top token. Lower = more filtering (toward 0 you keep almost everything); higher values like 0.10.2 cut harder toward determinism.
  • previous (optional) - the llm_sampler output of an earlier sampler node.
  • Output: llm_sampler, into LLM Chat.

Installing it

Same pack, same install - Manager searching "ComfyUI-YALLM-node", or:

cd ComfyUI/custom_nodes
git clone https://github.com/asaddi/ComfyUI-YALLM-node
cd ComfyUI-YALLM-node
pip install -r requirements.txt

Restart, find it under YALLM/samplers.

Gotchas

Don't combine min-p with top-p at aggressive settings - they're both doing relative trimming and together they can collapse the model into repetitive text. Pick one. And if you're testing against a hosted provider and min-p appears to do nothing, check whether that provider honors nonstandard samplers before assuming the node is broken. When it does work, the 0.05 default is a genuinely good place to start; you'll mostly be nudging between 0.02 and 0.2, and the effect is far more noticeable than a tenth of a temperature point.

CategoryYALLM/samplers

Inputs (2)

NameTypeDefaultDescription
min_pFLOAT0.050–1
previousoptLLMSAMPLER

Outputs (1)

NameTypeDescription
llm_samplerLLMSAMPLER