Abstract
Large language models (LLMs) typically employ greedy decoding or low-temperature sampling for reasoning tasks, reflecting a perceived trade-off between diversity and accuracy. We challenge this convention by introducing top-nsigma, a novel sampling method that operates directly on pre-softmax logits by leveraging a statistical threshold. Our key insight is that logits naturally separate into a Gaussian-distributed noisy region and a distinct informative region, enabling efficient token filtering without complex probability manipulations. Unlike existing methods (e.g., top-p, min-p) that inadvertently include more noise tokens at higher temperatures, top-nsigma maintains a stable sampling space regardless of temperature scaling. We also provide a theoretical analysis of top-nsigma to better understand its behavior. The extensive experimental results across four reasoning-focused datasets demonstrate that our method not only outperforms existing sampling approaches but also surpasses greedy decoding, while maintaining consistent performance even at high temperatures.
Community
We extensively studied the output of LLMs -- not probabilities but logits -- a gaussian noise emerges! Based on this finding we present our top-$n\sigma$ algorithm which improves the generation quality a lot. Its integration is super easy, only requiring two lines of pytorch code:
threshold = logits.max(dim=-1,keepdim=True).values - n*logits.std(dim=-1, keepdim=True)
logits[logits<threshold] = float('-inf')
This is an automated message from the Librarian Bot. I found the following papers similar to this paper.
The following papers were recommended by the Semantic Scholar API
- Adaptive Decoding via Latent Preference Optimization (2024)
- Quasi-random Multi-Sample Inference for Large Language Models (2024)
- SLED: Self Logits Evolution Decoding for Improving Factuality in Large Language Models (2024)
- AdaEDL: Early Draft Stopping for Speculative Decoding of Large Language Models via an Entropy-based Lower Bound on Token Acceptance Probability (2024)
- Dynamic-Width Speculative Beam Decoding for Efficient LLM Inference (2024)
Please give a thumbs up to this comment if you found it helpful!
If you want recommendations for any Paper on Hugging Face checkout this Space
You can directly ask Librarian Bot for paper recommendations by tagging it in a comment:
@librarian-bot
recommend
Showing that performance can be significantly improved (and the argument over temperature mostly ended) by standardizing the logits is huge. There's a bias against "post-training" research that needs to be eliminated from the AI community.
Models citing this paper 0
No model linking this paper
Datasets citing this paper 0
No dataset linking this paper
Spaces citing this paper 0
No Space linking this paper