Skip to content

fix: apply min-p filtering on softmax probabilities - #1010

Open
Chessing234 wants to merge 1 commit into
state-spaces:mainfrom
Chessing234:fix/min-p-sampling-probs
Open

fix: apply min-p filtering on softmax probabilities#1010
Chessing234 wants to merge 1 commit into
state-spaces:mainfrom
Chessing234:fix/min-p-sampling-probs

Conversation

@Chessing234

Copy link
Copy Markdown
Contributor

Summary

  • Min-p was comparing raw logits to a threshold and taking logits[..., 0] as max probability, which is incorrect.
  • Filter after softmax (and temperature) using min_p * max_prob, matching Hugging Face MinPLogitsWarper.
  • Also fix nearby docstring typos (efficienly / none top-*).

Test plan

  • sample(..., top_k=0, min_p=0.1) masks low-probability tokens relative to the top softmax mass
  • min_p=0 / greedy (top_k=1) paths unchanged

Made with Cursor

Compare tokens to min_p * max_prob after softmax (and temperature),
matching Hugging Face MinPLogitsWarper instead of raw logits / vocab[0].
@Chessing234
Chessing234 force-pushed the fix/min-p-sampling-probs branch from 692dc2d to db448f6 Compare August 5, 2026 10:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant