New Tool Radar

AI Concepts

How to Set a Min-P Threshold So Only Near-Best Tokens Can Be Sampled

Set min-p to a small value such as 0.05 so a token must be at least that close to the best token to be sampled.

Schematic with three steps: Set min_p to a small value; Test on a confident continuation; Test on an uncertain continuation.

Min-p sets a minimum token probability, scaled by the probability of the most likely token: a token is only kept if its probability is at least min_p times the probability of the best token. It must be a value between 0 and 1, and typical values are in the 0.01 to 0.2 range, which is comparably selective to setting top_p in the 0.99 to 0.8 range. Min-p adapts to the distribution: when the best token is very confident, the threshold is strict, and when the distribution is flat, it relaxes, which is why it is often more predictable than a fixed top-p.

What you need

  • A generation call where you control the sampling parameters
  • A test prompt with both confident and uncertain continuations
  • A note of the min-p value you will try, for example 0.05

Step 1: Set min_p to a small value

Set min_p to 0.05 as a starting point, inside the typical 0.01 to 0.2 range. A value of 0.2 is strict and a value of 0.01 is loose.

Step 2: Test on a confident continuation

Run a prompt where the next token is obvious, such as a common phrase, and confirm the sampler keeps only the best token or two. The threshold scales with the best token, so a confident distribution stays tight.

Step 3: Test on an uncertain continuation

Run a prompt where many continuations are plausible and confirm the sampler keeps a wider pool. If the pool is still too tight, lower min_p; if it is too loose, raise it.

Worked example: synthetic min-p check at two values

The table below is a synthetic example. It shows the expected result of setting min-p; no text was generated.

min-p Confident prompt pool Uncertain prompt pool
0.01 2 tokens About 40 tokens
0.05 1 token About 15 tokens
0.20 1 token 3 tokens
Decision 0.05 chosen Tight when confident, open when not

Expected result (UNTESTED). min-p 0.05 keeps 1 token on the confident prompt and about 15 on the uncertain one, adapting to the distribution. This check was not run live; the table shows the expected result for the synthetic example.

Limits

  • Min-p must be between 0 and 1; a value outside that range is invalid.
  • Min-p scales with the best token, so its effect changes with the distribution, unlike a fixed top-k count.
  • Not every API exposes min-p; check your stack before relying on it.
  • Min-p and top-p filter the same distribution, so combining them can make the pool smaller than either alone.

Sources

See all