Masked Distillation: Internalizing the Chain-of-Thought in Language Models

Durgesh Kalwar, Vardhan Palod, Subbarao Kambhampati

TL;DR

Researchers have developed "Masked Distillation," a method to shrink the massive "thinking" traces of Large Reasoning Models (LRMs) by training models to internalize reasoning into their internal weights. The study finds that while models can sometimes jump straight to an answer, providing a tiny "scaffold" of intermediate steps allows a smaller model to match a giant teacher's performance while using significantly fewer tokens.

What Problem Does This Paper Address?

The current "state of the art" in AI reasoning involves models like OpenAI’s o1 or DeepSeek-R1, which generate long, explicit "Chain-of-Thought" (CoT) traces before giving an answer. While effective, this "thinking out loud" is incredibly expensive. These traces dominate latency, consume massive amounts of memory (KV-cache), and drive up serving costs.

Interestingly, previous research has shown that the correctness of these intermediate steps isn't always causally linked to the final answer, and the length of the trace doesn't necessarily reflect the problem's complexity. This paper asks: Can we move this computation from the output tokens into the model's parameters? In other words, can we train a model to "think" internally and just give us the answer (or a much shorter version of the reasoning)?

Methods

The authors introduce Masked Distillation, a framework where a "student" model learns from a "teacher" model that is allowed to use full CoT.

  • The Core Mechanism: During training, the teacher is conditioned on the question and its own reasoning trace to provide feedback. The student, however, is only conditioned on the question. The student is then trained to match the teacher’s probability distribution for the final solution tokens using an on-policy reverse-KL divergence loss.
  • The $\alpha$-suffix Scaffold: Recognizing that jumping straight to an answer is hard, the authors introduced a "scaffold" parameter ($\alpha$). At $\alpha=0$, the student must internalize everything and emit only the answer. At $\alpha=0.3$, the student internalizes the first 70% of the reasoning and is trained to generate the final 30% of the trace before the answer.
  • Two Settings: They tested self-distillation (a model teaching a "non-thinking" version of itself) and dual-model distillation (a large reasoning model teaching a much smaller, efficient student).

Datasets

The researchers evaluated their framework on two primary reasoning domains:

  1. GSM8K: Grade-school math word problems (In-Distribution).
  2. Countdown: A number-puzzle search task where models must combine numbers using arithmetic to reach a target (In-Distribution).
  3. Out-of-Distribution (OOD) Splits: To test generalization, they used MATH-500 and AIME-25 (harder math) and variants of Countdown with different target ranges and increased search depths (e.g., using 5 or 6 numbers instead of 3 or 4).

Key Insights and Ideas

  • Internalization is Task-Dependent: The ability to skip the "thinking" tokens depends on how much the model already knows about the task. On GSM8K, the model could internalize reasoning well because the base model likely saw similar math during pretraining. On Countdown—a task less likely to be in the pretraining data—full internalization failed.
  • The "Aha" Moment for Scaffolding: You don't need the whole chain of thought to get the right answer. Providing a small "suffix" scaffold (the last 30% of the reasoning) acted as a bridge, allowing the model to recover nearly all the performance of the full-thinking teacher.
  • Reverse-KL vs. SFT: The study found that standard Supervised Fine-Tuning (SFT) is poor at exploiting these scaffolds. Using on-policy reverse-KL distillation was crucial for the student to actually learn how to use the partial reasoning traces effectively.
  • Efficiency Gains: The "internalized" models aren't just faster; they are more token-efficient. They can match teacher-level accuracy while emitting roughly 1.3x to 6.5x fewer tokens.

Key Results

  • GSM8K (Self-Distillation): The fully masked student ($\alpha=0$) reached 76.0% accuracy (up from a 61.0% baseline) while using 6.5x fewer tokens than the teacher.
  • Countdown (Self-Distillation): Full internalization was weak (41.7%), but adding a small scaffold ($\alpha=0.3$) caused accuracy to jump to 86.2%, essentially matching the teacher’s 87.3% but with significantly lower inference cost.
  • Generalization: In OOD math tasks (AIME-25), the $\alpha=0.7$ variant actually performed better than the teacher model while remaining more efficient.
  • Dual-Model Success: Even a tiny 0.5B parameter student could be coached by a 1.7B teacher to significantly improve its direct-answer accuracy on math problems.

Limitations and Future Work

The authors acknowledge a few areas for further exploration:

  • Training Cost: While inference is cheaper, the "distillation" process itself requires generating many teacher rollouts, which is computationally expensive.
  • Fixed Data Budget: All variants were trained on the same amount of data; the authors suggest that "masked" variants might benefit from more supervision since their per-question signal is sparser.
  • Source of Reasoning: The framework is currently teacher-based, but the authors want to see if this "masking" recipe works when the reasoning signal comes from environment feedback (like a code interpreter or math verifier) instead of another LLM.

Summary updated

BibTeX
@inproceedings{kalwar2026masked,
  author = {Durgesh Kalwar and Vardhan Palod and Subbarao Kambhampati},
  title = {{Masked Distillation: Internalizing the Chain-of-Thought in Language Models}},
  booktitle = {FoGen @ ICML},
  year = {2026},
  url = {https://openreview.net/forum?id=Zt36ZCqZWU},
}
Figure