TL;DR
Traditional test-time adaptation for Large Language Models (LLMs) minimizes output entropy to boost model confidence, but models can often be confidently wrong. This paper introduces TASCO, a framework that optimizes a continuous input prefix for both high confidence and local stability under perturbations. By steering frozen LLMs toward robust, stable reasoning states, TASCO significantly improves both accuracy and token efficiency across complex math and science benchmarks.
What Problem Does This Paper Address?
Test-time adaptation (TTA) has become a popular, lightweight strategy to improve LLM performance on downstream tasks without the massive computational cost of full post-training or fine-tuning. A common approach is to minimize predictive entropy—essentially forcing the model to become more confident in its outputs.
However, LLMs are notoriously poorly calibrated on complex reasoning tasks. They can confidently hallucinate incorrect steps and charge down wrong paths with high certainty. Pure entropy minimization cannot distinguish between reliable, well-founded confidence and fragile, spurious overconfidence.
The authors observe a key distinction: high-confidence reasoning is much more likely to be correct if that confidence remains stable under local perturbations. Confidently wrong answers, by contrast, tend to sit on sharp, fragile peaks in the representation space.
Methods
The authors propose TASCO (Test-Time Adaptation via Stability-Aware Confidence Optimization). TASCO keeps the underlying LLM frozen and optimizes a lightweight, task-level continuous prefix vector prepended to the input prompt embeddings.
To operationalize local stability, they introduce two alternative perturbation strategies:
- Random Perturbation (TASCO-RP): At each optimization step, the framework draws $K$ random Gaussian noise vectors and adds them to the prefix. The model decodes trajectories under these perturbed prefixes, and the objective penalizes the variance of the resulting trajectory-level confidences. This promotes distributional stability.
- Sharpness-Aware Perturbation (TASCO-SAP): Inspired by Sharpness-Aware Minimization (SAM) in standard neural network training, this variant calculates a single gradient-guided perturbation along the most sensitive direction in the prefix space. It minimizes the confidence loss at this worst-case local point, targeting worst-case directional sensitivity while saving the computational overhead of multiple decoding rollouts.
Datasets
The framework was evaluated across six demanding reasoning benchmarks spanning high-school to graduate-level problems:
- Mathematics: MATH-500, AMC23, AIME24, and AIME25.
- Science/STEM: Minerva Math (undergraduate-level STEM problems) and GPQA Diamond (graduate-level questions written by domain experts).
The experiments validated TASCO across both general instruction-tuned models (Qwen2.5-Math, LLaMA3.1-Instruct) and specialized reasoning models (DeepSeek-R1-Distill-Qwen).
Key Insights and Ideas
- Stability as a Proxy for Truth: Local neighborhood stability in the embedding space serves as an effective, label-free proxy for correctness. If minor tweaks to the prompt prefix cause the model's confidence to fluctuate wildly, the underlying reasoning chain is likely fragile and incorrect.
- The "Flat Minima" Parallel: The work successfully translates the concept of "flat minima" (which correlates with good generalization in weight space) into the space of continuous prompt tuning/steering vectors at inference time.
- Conciseness via Stability: Optimizing for stability naturally discourages the model from entering repetitive or rambling reasoning loops. Stable states inherently favor concise, direct logical paths.
Key Results
- Significant Accuracy Gains: On Qwen2.5-Math-7B, TASCO improved average accuracy by up to 17.2 percentage points over Zero-Shot Chain-of-Thought (CoT), outperforming standard confidence-only optimization methods by 4.8 percentage points.
- Boosts to Reasoning-Agnostic and Reasoning-Enhanced Models: Even when applied to models already fine-tuned for heavy deliberation (like DeepSeek-R1-Distill-Qwen-7B), TASCO provided an average accuracy boost of 6.0 percentage points.
- Improved Token Efficiency: TASCO-RP and TASCO-SAP reduced average generation lengths by 28.1% and 24.0% respectively compared to standard CoT. It achieves higher accuracy while generating fewer tokens.
- Cross-Distribution Generalization: Prefixes optimized on one source dataset (e.g., MATH-500) successfully transferred to out-of-domain target datasets (e.g., GPQA) without re-optimization, consistently outperforming the baseline.
Limitations and Future Work
- Computational Overhead during Optimization: The Random Perturbation (RP) variant requires generating $K$ independent decoding rollouts per optimization step, which increases test-time compute costs (though the SAP variant significantly mitigates this).
- Static Token Assumption in SAP: To keep gradients tractable, the Sharpness-Aware Perturbation variant fixes the decoded token trajectory during its inner maximization step. This means it might miss discrete "trajectory-switching" behaviors that the more expensive random sampling captures.
- Hyperparameter Tuning: Performance depends on selecting appropriate values for the perturbation radius ($\rho$) or Gaussian scale ($\sigma$), though sensitivity analyses indicate the method is robust across a reasonably broad range of scales.
Summary updated