Implement the min-p truncation filter for next-token sampling.
Signature: def min_p_filter(probs: np.ndarray, min_p: float) -> np.ndarray
threshold = min_p * probs.max()Assume probs is already a valid distribution (non-negative, sums to 1).
Math
Asked at
import numpy as np
def min_p_filter(...):
pass
Premium problem
Free accounts include problems #1–20. Upgrade to unlock the editor, hidden test cases, and reference solutions for every problem.
Already premium?