Beam Search as Test-Time Self-Distillation via Counterfactual Contexts
On the map: Knowledge distillation → On-policy and self-distillation for LLMs
Abstract (arXiv)
Self-Distillation Fine-Tuning (SDFT) enables a language model to act as its own teacher: by conditioning on a demonstration, the model produces an implicit reward via pointwise mutual information, which guides on-policy learning without external supervision. However, SDFT operates at training time: it requires gradient updates and access to expert demonstrations, making it inapplicable at inference. We propose test-time self-distillation, a decoding-time method that extracts a steering signal from the self-distillation framework without any parameter updates, reward models, or training data. Our key insight is that counterfactual contexts, i.e. fixed textual templates that hypothetically prime the model for excellent versus poor reasoning, can substitute for the demonstration. The log-odds ratio of a candidate answer under these two counterfactual conditions defines a new reward signal. We derive the optimal KL-regularized policy under this reward, which takes the form of a Gibbs reweighting of the base distribution. Crucially, this reweighting is global: it cannot be decomposed into independent per-token operations without ignoring future trajectory quality. We therefore approximate the target distribution via beam search. Experiments on mathematical reasoning (MATH500), code generation (HumanEval), and graduate-level science QA (GPQA) across multiple model scales show that test-time self-distillation improves over standard sampling, low temperature, beam search and power sampling baselines on average, demonstrating that the self-distillation principle can be operationalized at inference time.
Key facts. No citing papers in the map yet (data through 14 Oct 2026). Placed in On-policy and self-distillation for LLMs, one of 12 directions in Knowledge distillation. Builds on 29 of its 34 references that are in the map. First posted on arXiv 29 Sep 2026.
Builds on
29 of 34 references.
Closest ancestors · 2
Same direction, newest first
- 2026Reinforcement Learning via Self-Distillation28 Jan
- 2026Self-Distillation Enables Continual Learning27 Jan
Other references · 27
- 2015Distilling the Knowledge in a Neural Networkcited by 10,324
- 2024DeepSeekMath: Pushing the Limits of Mathematical Reasoning in Open Language Modelscited by 9,379
- 2021Evaluating Large Language Models Trained on Codecited by 8,320
- 2023Direct Preference Optimization: Your Language Model is Secretly a Reward Modelcited by 8,065
- 2022Self-Consistency Improves Chain of Thought Reasoning in Language Modelscited by 5,708
- 2018Soft Actor-Critic: Off-Policy Maximum Entropy Deep Reinforcement Learning with a Stochastic Actorcited by 4,885
- 2023Let's Verify Step by Stepcited by 3,789
- 2023Self-Refine: Iterative Refinement with Self-Feedbackcited by 3,442
- 2023Tree of Thoughts: Deliberate Problem Solving with Large Language Modelscited by 3,211
- 2023GPQA: A Graduate-Level Google-Proof Q&A Benchmarkcited by 2,879
- 2022Contrastive Decoding: Open-ended Text Generation as Optimizationcited by 609
- 2023DoLa: Decoding by Contrasting Layers Improves Factuality in Large Language Modelscited by 376
15 more
- 2023Trusting Your Evidence: Hallucinate Less with Context-aware Decodingcited by 327
- 2025Deep Think with Confidencecited by 205
- 2024From Decoding to Meta-Generation: Inference-time Algorithms for Large Language Modelscited by 137
- 2022RL with KL penalties is better viewed as Bayesian inferencecited by 135
- 2025Confidence Improves Self-Consistency in LLMscited by 113
- 2024ARGS: Alignment as Reward-Guided Searchcited by 103
- 2025Reasoning with Sampling: Your Base Model is Smarter Than You Thinkcited by 89
- 2024TreeBoN: Enhancing Inference-Time Alignment with Speculative Tree-Search and Best-of-N Samplingcited by 61
- 2026Scalable Power Sampling: Unlocking Efficient, Training-Free Reasoning for LLMs via Distribution Sharpeningcited by 31
- 2024Improving Factuality in Large Language Models via Decoding-Time Hallucinatory and Truthful Comparatorscited by 19
- 2025On Almost Surely Safe Alignment of Large Language Models at Inference-Timecited by 14
- 2024Distilling Morphology-Conditioned Hypernetworks for Efficient Universal Morphology Controlcited by 11
- 2024Explaining and Improving Contrastive Decoding by Extrapolating the Probabilities of a Huge and Hypothetical LMcited by 11
- 2026Thinking by Subtraction: Confidence-Driven Contrastive Decoding for LLM Reasoningcited by 6
- 2026The Model Knows, the Decoder Finds: Future Value Guided Particle Power Samplingcited by 6
Built on by
Not cited yet.
Similar, not cited
Close in wording, no citation either way
- 2026Why Does Feedback-Augmented Self-Distillation Fail to Improve Retrieval-Interleaved Search Agents?
- 2025Counterfactual Self-Questioning for Stable Policy Optimization in Language Models
- 2026Activation-Conditioned Self-Distillation
- 2026Train Ahead, Distill Back: Bootstrapping On-Policy Self-Distillation for Large Language Models
- 2026The Role of Feedback Alignment in Self-Distillation
- 2026SAPD: Step-Aligned Privileged Distillation
- 2026Search-E1: Self-Distillation Drives Self-Evolution in Search-Augmented Reasoning
- 2026Unmasking On-Policy Distillation: Where It Helps, Where It Hurts, and Why