26/29
Part 6 of 6 · What interviewers ask nextLearn and do

Min-p cuts at a share of the top token

A newer filter, min-p, sets its cut from the top token's probability.

probs = row.softmax(dim=-1)
cut = 0.1 * probs.max()
print(round(cut.item(), 4))
print([w for w, q in zip(words, probs[0]) if q >= cut])
0.0605
['mat', 'floor', 'sofa']

Here the bars are the model's own probabilities, and the line is the cutoff.

Min-p on three promptsInteractive
Hover a bar
KeptFiltered out
Tokens kept
3 of 6
Cutoff
0.0605
Top token
0.67
Entropy
1.20 bits

Min-p keeps every token whose probability is at least pbasep_{\text{base}} times the top token's:

keep x  ⟺  P(x)≥pbase⋅max⁡vP(v)\text{keep } x \iff P(x) \ge p_{\text{base}} \cdot \max_v P(v)

P(x)P(x) is token xx's probability, max⁡vP(v)\max_v P(v) is the top token's, and pbasep_{\text{base}} is the base you pick. A sure model raises the cutoff, and an unsure one lowers it. Switch the prompts above: the line always sits at a tenth of the top bar, so the sure prompt keeps 1 token and the torn one keeps all 6.

  • Nguyen et al. proposed it, and tested pbasep_{\text{base}} of 0.05 and 0.1.
  • Hugging Face and vLLM both expose it as min_p, and they don't even agree on where it goes. Hugging Face applies it after top-p, vLLM before top-k and top-p.
  • Know the mechanism, and don't oversell it. A 2025 re-analysis by Schaeffer et al. found that the original evidence "fails to support claims that min-p improves quality, diversity, or a trade-off between quality and diversity."

In the editor, rows holds the scores for two prompts, and keep_min_p(logits, base) already has the probabilities. Set cut: base times each row's top probability, as a (B, 1) column. Return the logits with -inf wherever a token's probability is below its row's cut.