When Context Returns: Toward Robust Internalization in On-Policy Distillation

Xun Wang, Ruishuo Chen, Zhuoran Li, Yu Chen, Longbo HuangarXiv 2026

TL;DR

On-policy distillation (OPD) allows large language models to internalize privileged context—like system prompts or reasoning hints—so that it is no longer needed at inference time. However, this paper uncovers a counterintuitive flaw: reintroducing the original context to the distilled model often degrades its performance. To fix this, the authors introduce No-Context Anchoring (NCA), a lightweight regularizer that enforces context invariance, ensuring the model remains stable and robust whether the context is present or absent.

What Problem Does This Paper Address?

When deploying Large Language Models (LLMs), we often augment inputs with "privileged context"—such as detailed system prompts, chain-of-thought instructions, or game-state descriptions—to maximize performance. However, keeping these prompts at inference time increases latency, raises serving costs, and risks exposing sensitive instructions to users.

To bypass this, researchers use on-policy distillation (OPD) to train a context-free "student" model to replicate the behavior of a context-conditioned "teacher" model. The goal is to bake the context's benefits directly into the model's weights.

Intuitively, if a student has truly internalized a textbook, allowing them to look at the textbook during an exam shouldn't make them perform worse. Yet, the authors discovered a striking and pervasive phenomenon they call context-induced degradation: reintroducing the original privileged context to a distilled student model frequently tanks its accuracy, flipping previously correct answers to incorrect ones.

Standard OPD creates an optimization asymmetry: it forces the context-free student to match the teacher, but leaves the student's behavior with context completely unconstrained.

Context-induced degradation concept and NCA performance

Methods

To address this asymmetry, the authors formalize a novel objective called view-robust internalization risk, which demands both privileged fidelity (matching the teacher) and context invariance (consistency across context-free and context-conditioned views).

Directly optimizing both views against a teacher can cause them to diverge if the teacher's distribution is multi-modal. To solve this reliably, the authors propose No-Context Anchoring (NCA), a simple yet effective consistency regularizer:

  1. Establish an Anchor: It takes the student's own context-free output distribution as the target.
  2. Freeze Gradients: It applies a stop-gradient operator (sg[·]) to this context-free anchor so that the model's baseline performance doesn't get corrupted or dragged down during joint optimization.
  3. Align the Views: It forces the student's context-conditioned output to align with the context-free anchor using forward KL divergence.

Mathematically, the regularizer is expressed as: $$L_{\text{NCA}} \triangleq \text{KL}(\text{sg}[g_\theta(\cdot | x)] \parallel g_\theta(\cdot | x, c))$$

Because it reuses the on-policy sequences already generated during standard distillation, NCA is highly efficient, requiring only one additional forward pass per training step.

Datasets

The authors validated NCA across 14 distinct configurations using several established datasets spanning three core domains:

  • System-Prompt QA: MedMCQA (medical multiple-choice questions) and a combined Safety dataset (merging TweetEval, HateCheck, and ETHOS for harmful-content classification).
  • Text Games: Sokoban (spatial reasoning) and FrozenLake (navigation) environments from the TextArena benchmark.
  • Mathematical Reasoning: DAPO-Math-17K, evaluated using extended autoregressive trajectories in the model's "thinking" mode.
  • Generalization: USPTO-50k (chemical reaction type prediction) was used to test performance when the privileged context varies dynamically per input rather than remaining fixed.

Key Insights and Ideas

  • The Three Regimes of Context Interaction: The paper maps out how models behave when context returns, identifying three distinct states: Regime A (context acts as a harmful perturbation), Regime B (context remains a helpful scaffold due to incomplete internalization), and Regime C (robust context invariance). Alarmingly, standard OPD lands in the harmful Regime A more than half the time.
The three regimes of context interaction
  • Why Dual-Matching Fails: Simply trying to force both student views to match the teacher independently (DualOPD) fails under approximate optimization. Because LLM target distributions are often multi-modal, the two views can easily latch onto completely different modes of the teacher, causing severe internal representation divergence.
  • Locking the Hidden States: Mechanistic analysis shows that in standard OPD, the model's internal representations diverge wildly between context-free and context-conditioned inputs starting around the middle layers. NCA acts as an internal anchor, keeping layer-wise hidden-state cosine similarity above 0.997 across the entire network.
  • Redirection over Expansion: Parameter-level analysis reveals that NCA doesn't increase the effective dimensionality or complexity of the weight updates. Instead, it naturally redirects existing update capacity in the shallow-to-middle layers toward context-invariant solutions.

Key Results

  • Broad Harm Reduction: Across 14 configurations, NCA successfully reduced context harm in 12 settings, yielding an average 7.2 percentage-point reduction in harm and a 5.3 percentage-point gain in both-view success.
  • Mitigating Late-Stage Divergence: As training progresses under standard OPD, the accuracy gap between the two views typically widens. NCA successfully keeps the context-free and context-conditioned accuracies tightly coupled.
  • Cross-Domain Preservation: When training a model on MedMCQA, standard OPD caused severe performance degradation on an out-of-domain Safety task. NCA acted as an effective regularizer, preserving out-of-domain capabilities much better than the baseline.

Limitations and Future Work

  • Suboptimality in Scaffold Regimes: NCA always anchors the context-conditioned view to the context-free view. In tasks where internalization is fundamentally incomplete (Regime B) and the context is still highly beneficial, this rigid anchoring can pull down the context-conditioned performance. The authors note that dynamically adapting the anchor strength based on the model's level of internalization is a crucial next step.
  • Compute-Bounded Analysis: Due to high computational costs, all training runs were conducted using a single seed, and the deep mechanistic analysis was restricted to a single model-task pairing (Qwen3-4B on Sokoban).
  • Scope of Paradigm: The formulation is currently tailored to token-level on-policy distillation for LLMs and may require structural modifications to generalize to other distillation frameworks or modalities.

Summary updated

BibTeX
@misc{wang2026when,
  author = {Xun Wang and Ruishuo Chen and Zhuoran Li and Yu Chen and Longbo Huang},
  title = {{When Context Returns: Toward Robust Internalization in On-Policy Distillation}},
  year = {2026},
  eprint = {2606.11627},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2606.11627},
}
Figure