Implement the locally typical filter from Meister et al. 2022.
Signature: def typical_sample_filter(probs: np.ndarray, mass: float) -> np.ndarray
H = -sum(p * log(p)) (use a small epsilon to avoid log(0))|−log(p_i) − H| — how far its surprisal is from the average surprisalmassReturn the new probability vector.
Math
Asked at
Test Results