TL;DR
This paper introduces top-nσ, a novel sampling method for Large Language Models (LLMs) that operates directly on pre-softmax logits. By identifying a statistical threshold, top-nσ effectively separates "informative" tokens from "noisy" ones, leading to improved reasoning accuracy and stable performance across varying temperatures, outperforming traditional methods like greedy decoding.
What Problem Does This Paper Address?
Large Language Models (LLMs) are powerful tools, but generating high-quality text for reasoning-intensive tasks remains a challenge. Standard sampling methods like greedy decoding (which picks the most probable token) or low-temperature sampling (which slightly diversifies choices) often present a trade-off: greedy decoding is accurate but lacks diversity, while low-temperature sampling can introduce noise and reduce reasoning fidelity. Existing methods struggle to effectively filter out irrelevant "noisy" tokens, especially at higher temperatures, leading to a degradation in performance. This paper aims to bridge this gap by proposing a sampling strategy that can robustly maintain accuracy and diversity, even under challenging conditions.
Methods
The core innovation is the top-nσ sampling method, which operates directly on the raw, pre-softmax logits of the LLM. The authors observe that these logits naturally fall into two distinct regions: a "noisy region" that follows a Gaussian distribution (representing less important or random tokens) and an "informative region" containing a smaller set of high-value tokens.
top-nσ leverages this observation by calculating a statistical threshold based on the mean and standard deviation ($\sigma$) of the logits. Specifically, it identifies tokens whose logits are within a certain range of the maximum logit, scaled by $\eta$ and $\sigma$. This approach avoids complex probability manipulations and directly filters out tokens from the noisy region. A key advantage is its temperature invariance: the set of selected tokens remains the same regardless of the temperature setting, allowing temperature to solely control the exploration within the selected informative tokens. This contrasts with methods like top-p and min-p, where the selected token set changes with temperature.
Datasets
The paper evaluates top-nσ on four reasoning-focused question-answering datasets:
- AQUA: Elementary school math problems.
- MATH: A more challenging math dataset.
- GSM8K: Grade school math problems.
- GPQA: Graduate-level Google-proof Q&A benchmark.
These datasets are transformed into open-ended generation tasks for evaluation.
Key Insights and Ideas
- Logits Hold the Key: The paper argues that focusing on pre-softmax logits, rather than probabilities, offers a more direct path to understanding and improving sampling.
- Two-Region Logit Distribution: The discovery that logits naturally separate into a Gaussian "noisy" region and an "informative" region is central. This provides a principled way to filter tokens.
- Temperature Invariance is Crucial:
top-nσ's ability to maintain a stable set of candidate tokens across different temperatures is a significant advantage, allowing for more controlled exploration. - Reversing Outlier Detection: Instead of treating the minority "informative" tokens as outliers from the majority "noisy" distribution, the authors propose viewing the noisy tokens as outliers from a hypothetical uniform distribution of informative tokens. This counter-intuitive perspective unlocks the
top-nσapproach.
Key Results
- Superior Performance:
top-nσconsistently outperforms existing sampling methods (top-p, top-k, min-p) and even greedy decoding across all tested reasoning datasets. - Robustness at High Temperatures: While other methods degrade significantly at higher temperatures,
top-nσmaintains robust performance, achieving accuracies like 25.00% on GPQA and 74.61% on GSM8K at T=3.0, where standard sampling and top-p fail. - Optimal Temperature Around 1.5: Interestingly, the experiments suggest that for
top-nσ, slightly higher temperatures (around 1.5) can yield optimal performance, challenging the conventional wisdom of using very low temperatures for reasoning tasks. - Efficient Computation: The method operates directly on logits, avoiding costly sorting or extra softmax transformations, making it computationally efficient.
Limitations and Future Work
- Hyperparameter Tuning: While
n=1.0is found to be effective in practice, it is still a hyperparameter that needs to be set. The paper suggests theoretical bounds forn(0 to 3.46) and recommends values greater than 0.5. - Model Struggles on GPQA: The GPQA dataset proved challenging, with even majority voting barely improving over single-sample performance, suggesting the model itself struggles with this particular benchmark.
- Future Work: The authors suggest that their insights into the distinct separation of noisy and informative regions in logit space could lead to improvements in model architecture and training procedures. Leveraging these statistical properties during training is a promising future direction.
Summary updated