Yi HeinYi Hein

Privileged Windows: Post-Training Attention-Boosted Persistent Token Memory for Large Language Models

Yi Hein Chai

2026-11-22

Abstract. Standard autoregressive language models treat all tokens inside their context window symmetrically and discard ephemeral context between tasks. We investigate Privileged Window Post-Training (PW-PT), a lightweight mechanism that introduces a fixed-budget discrete token slot (Kmax⁡≤32K_{\max} \le 32 tokens) separate from the normal conversation context, persists it across tasks, lets the model overwrite or keep it at will (<pw_write> / <pw_keep/>), and adds a positive attention logit boost (+β+\beta) to queries attending to privileged-window keys only during post-training. Using decoupled GRPO—assigning future-task transfer reward and zero KL regularization (λKL,pw=0\lambda_{\text{KL,pw}} = 0) to privileged-window content tokens—we test whether models distill generalizable, potentially non-English symbolic knowledge into the window while filtering task-specific distractors. Across 27 A100-80GB runs on Qwen2.5-3B and 7B spanning two benchmarks and a 7-condition causal battery controlling for attention-sink/register confounds, we find: (1) Episodic rule transfer (RuleTransfer-Bench): self-edited windows reach 38.8%38.8\% vs. 3.7%3.7\% No-PW and 1.3–5.0%1.3\text{--}5.0\% Random-PW (p<10−12p < 10^{-12}), compress prose ∼6×\sim 6\times while stripping distractors, and beat human Oracle windows across all five 3B arms (p≤0.017p \le 0.017); on explicit named rules β=0\beta = 0 matches β>0\beta > 0 up to 3.2k tokens, with +β+\beta helping most under tight budgets (Kmax⁡=18K_{\max} = 18: +5.6+5.6 pp; OOD 12%→5%12\% \to 5\% when disabled). (2) Real-world multi-task transfer (RealMultiTask-Bench, 3 seeds ×\times 320 test tasks): zero-KL models spontaneously invent compact non-English codes (SymbVerifLKNTLKTrd, SOLVEUNIDIST, perf|prove|ltt|...|eqtn|stats, and <M><L><C><V><K><N> at 7B). Adding +β+\beta creates asymmetric causal coupling (penalizing random/shuffled tokens by up to −21.6-21.6 pp un-gated and −6.7-6.7 pp ID gated) and cuts 3-seed variance 5×5\times (±0.7%\pm 0.7\% vs. ±3.5%\pm 3.5\%); at 7B, upper-layer boosting attains the highest overall (37.8%37.8\% vs. 36.2%36.2\%) and unseen OOD (41.2%41.2\% vs. 37.5%37.5\%) accuracy, whereas across 960 pooled 3B evaluations, a 32-token static window yields only modest mean lift over LoRA GRPO (24.7%24.7\% vs. 24.5%24.5\%). (3) Failure modes: we diagnose 7B cold-start keep-collapse, high-β\beta edit lock-in, and un-gated pollution, yielding concrete design rules for self-editing attention-privileged memory.

Introduction

Large language models (LLMs) solve tasks within an ephemeral context window that resets between problems (Vaswani et al., 2017). While external agentic memory systems persist natural-language notes across tasks (Packer et al., 2023; Shinn et al., 2023; Suzgun et al., 2025), they inject retrieved text as ordinary context tokens that compete for softmax attention against long, noisy task prompts (Liu et al., 2024) and keep model weights frozen. Conversely, parameter-efficient soft-prompt and context-compression methods optimize continuous latent prefixes via gradient descent (Li & Liang, 2021; Lester et al., 2021; Mu et al., 2023; Chevalier et al., 2023), but do not let the model dynamically edit discrete cross-task symbols at will during inference or post-training.

In this paper, we formulate and rigorously test an alternative hypothesis: Privileged Window Post-Training (PW-PT). We give a pretrained LLM a dedicated, compact discrete token buffer of at most Kmax⁡K_{\max} tokens (e.g., 18–3218\text{--}32 tokens) distinct from the normal task context, persist its token IDs across tasks, allow the model to overwrite or retain it at will, and inject an additive attention logit boost +β+\beta from normal task/reasoning queries to privileged-window keys exclusively during post-training. Crucially, we remove the KL divergence penalty on tokens generated inside the privileged window (λKL,pw=0\lambda_{\text{KL,pw}} = 0), freeing the model to evolve arbitrary compressed or non-English conceptual symbols whenever doing so improves downstream cross-task performance.

Figure 1. Overview of Privileged Window Post-Training (PW-PT). A fixed-budget discrete token slot () sits after the unboosted position-0 attention sink and persists across tasks. During post-training, normal context and generation queries receive an additive logit bias toward PW keys. Decoupled GRPO trains reasoning tokens via immediate task reward and PW-edit tokens via future transfer reward with zero KL penalty on PW content, enabling emergent symbolic compression.
Figure 1. Overview of Privileged Window Post-Training (PW-PT). A fixed-budget discrete token slot (K≤Kmax⁡K \le K_{\max}) sits after the unboosted position-0 attention sink and persists across tasks. During post-training, normal context and generation queries receive an additive logit bias +β+\beta toward PW keys. Decoupled GRPO trains reasoning tokens via immediate task reward and PW-edit tokens via future transfer reward with zero KL penalty on PW content, enabling emergent symbolic compression.

Why might a post-training attention boost +β+\beta create a useful inductive bias? Because softmax reweighting makes +β+\beta a double-edged selection pressure: every query in every subsequent task is forced to allocate substantial probability mass to the privileged window. If the window holds generalizable, cross-task abstractions, every task benefits; if it holds narrow, task-specific clutter or noise, the forced boost actively distracts future tasks.

Testing this idea honestly requires isolating several confounds that easily produce false positives in LLM memory studies: (i) attention-sink / register-token confounds (Xiao et al., 2024; Darcet et al., 2024; Sun et al., 2024), where extra prefix tokens help purely as computation sinks regardless of semantic content; (ii) weight memorization, where RL updates memorize a fixed benchmark into weights rather than relying on persistent memory; and (iii) attribution of the attention boost, where gains might stem from persistent text memory alone (β=0\beta = 0) rather than the post-training boost (β>0\beta > 0). We therefore organize our two-stage evaluation around four falsifiable questions:

  • RQ1 (Content Causality): Can a pretrained LLM adapt to a post-training-only boost +β+\beta while preserving BOS sinks and KV-cache exactness, and learn via RL to store genuine cross-task knowledge rather than register-token noise?
  • RQ2 (Boost vs. β=0\beta = 0): In which regimes does +β+\beta outperform an identical self-edited window with β=0\beta = 0 or standard RL without a window?
  • RQ3 (Symbolic Emergence): Does removing KL regularization on PW content under tight token caps induce non-English or compressed symbolic representations?
  • RQ4 (Scale & Failure Modes): What optimization bottlenecks arise across 3B vs. 7B scales and layerwise boost placements?

Across 27 A100-80GB runs (10 pilot/Stage 1/Stage 2 v1 runs plus a 17-run multi-seed + 7B suite), we deliver rigorous, nuanced answers to all four questions.

Related Work

Soft Prompts, Context Compression, and Memory Tokens. Prefix-Tuning (Li & Liang, 2021) and Prompt Tuning (Lester et al., 2021) prepend continuous task-specific vectors optimized via backpropagation with frozen LM weights. Memory Transformers (Burtsev et al., 2020), Recurrent Memory Transformers (Bulatov et al., 2022), Gist Tokens (Mu et al., 2023), and AutoCompressors (Chevalier et al., 2023) train models via language modeling or instruction tuning to compress context segments into continuous summary vectors or cached KV states, following earlier differentiable memory architectures (Graves et al., 2014). Unlike these methods, PW-PT stores discrete vocabulary tokens edited at will by the model across tasks via reinforcement learning, and introduces a post-training attention logit boost without modifying pretraining.

Attention Steering, Sinks, and Auxiliary Workspace Tokens. PASTA (Zhang et al., 2024) applies inference-time attention reweighting on selected heads to emphasize user-highlighted spans without weight updates or cross-task persistence. StreamingLLM (Xiao et al., 2024) and Sun et al. (2024) demonstrate that pretrained LLMs place massive attention onto initial tokens (“attention sinks”); similarly, register tokens (Darcet et al., 2024) and pause tokens (Goyal et al., 2024) provide auxiliary compute workspace. Because boosted prefix tokens could inadvertently act as free registers, we explicitly protect position 0 from boosting and introduce a length- and boost-matched Random-PW causal control in every evaluation. Long-context degradation and attention dilution motivate our distraction-scaling stress test (Liu et al., 2024).

Agentic Self-Editing Memory and RL Post-Training. MemGPT (Packer et al., 2023), Reflexion (Shinn et al., 2023), and Dynamic Cheatsheet (Suzgun et al., 2025) equip LLMs with persistent natural-language memory updated across tasks at inference time, without modifying attention mechanics or co-training the model’s weights. On the optimization side, Group Relative Policy Optimization (GRPO) (Shao et al., 2024; DeepSeek-AI, 2025) enables critic-free RL post-training of reasoning models (Qwen Team, 2024) over objective verifiers (Cobbe et al., 2021) with parameter-efficient LoRA adapters (Hu et al., 2022). PW-PT bridges these lines by jointly RL-training discrete memory editing and attention-boosted memory utilization end-to-end.

Method: Privileged Window Post-Training (PW-PT)

Sequence Layout and Post-Training Attention Boost

Let w=(w1,…,wK)∈VKw = (w_1, \dots, w_K) \in \mathcal{V}^K denote the discrete token IDs currently stored in the Privileged Window, hard-capped at K≤Kmax⁡K \le K_{\max}. For any task prompt xx and generated response yy, we form the sequence (Eq. 1):

s=hopen⏟unboosted sink  ∥  w1…wK⏟boosted PW keys Ipw  ∥  hclose⏟unboosted  ∥  x  ∥  y⏟normal context & CoT Itasks = \underbrace{h_{\text{open}}}_{\text{unboosted sink}} \;\Vert\; \underbrace{w_1 \dots w_K}_{\text{boosted PW keys }\mathcal{I}_{\text{pw}}} \;\Vert\; \underbrace{h_{\text{close}}}_{\text{unboosted}} \;\Vert\; \underbrace{x \;\Vert\; y}_{\text{normal context \& CoT }\mathcal{I}_{\text{task}}}

where hopenh_{\text{open}} begins with the model’s pretrained position-0 chat delimiter (<|im_start|>system\n<privileged_window>\n) and hcloseh_{\text{close}} closes the slot (\n</privileged_window>\n) before the system/user messages.[Preliminary diagnostics (Appendix A) showed that prepending a novel <|im_start|>memory role before <|im_start|>system caused zero-shot Qwen2.5 to ignore the block, whereas keeping <|im_start|>system at position 0 preserved both attention sinks and immediate readability while boosting strictly the raw PW content tokens Ipw\mathcal{I}_{\text{pw}}.]

In each targeted transformer layer l∈[lstart,L)l \in [l_{\text{start}}, L) and attention head h∈{1,…,H}h \in \{1,\dots,H\}, we modify scaled dot-product attention (SDPA) purely through an additive logit bias Bi,j(l,h)B^{(l,h)}_{i,j} added onto the standard causal mask Mi,j∈{0,−∞}M_{i,j} \in \{0, -\infty\} (Eq. 2):

Attn(l,h)(Q,K,V)=softmax ⁣(QK⊤dk+M+B(l,h))V,Bi,j(l,h)={βl,hif i∈Itask,  j∈Ipw,  Mi,j=0,0otherwise.\mathrm{Attn}^{(l,h)}(Q, K, V) = \mathrm{softmax}\!\left(\frac{Q K^\top}{\sqrt{d_k}} + M + B^{(l,h)}\right) V, \qquad B^{(l,h)}_{i,j} = \begin{cases} \beta_{l,h} & \text{if } i \in \mathcal{I}_{\text{task}},\; j \in \mathcal{I}_{\text{pw}},\; M_{i,j} = 0, \\ 0 & \text{otherwise.} \end{cases}

Notice three structural safeguards in Eq. (2): (i) position 0 (hopenh_{\text{open}}) is never boosted, preserving pretrained attention sinks; (ii) PW tokens attending to each other (i,j∈Ipwi,j \in \mathcal{I}_{\text{pw}}) are unboosted, keeping PW internal encoding well-conditioned; and (iii) padding/future causal entries (Mi,j=−∞M_{i,j} = -\infty) are strictly untouched. We study three parameterizations of βl,h\beta_{l,h}: fixed uniform (βl,h≡β\beta_{l,h} \equiv \beta across all layers), fixed upper-layer (βl,h=β\beta_{l,h} = \beta for l≥⌊L/2⌋l \ge \lfloor L/2 \rfloor and 00 below), and unconstrained learnable per-head (βl,h∈R\beta_{l,h} \in \mathbb{R} optimized jointly with LoRA parameters via exact SDPA backward gradients).

Exact KV-Cache and Gradient-Checkpointing Consistency. On-policy RL generates rollouts with left-padded KV caching (use_cache=True) and computes policy log-probabilities via a full forward pass (use_cache=False) with gradient checkpointing. By indexing ii via absolute cache_position and storing per-example Ipw\mathcal{I}_{\text{pw}} masks and Itask\mathcal{I}_{\text{task}} start offsets inside a context manager wrapping both forward() and backward(), our implementation guarantees exact equivalence between cached decoding and full-sequence log-probabilities (verified to max⁡∣Δlogit∣=4.2×10−4\max|\Delta \text{logit}| = 4.2 \times 10^{-4} in FP32 on Qwen2.5-3B, matching vanilla β=0\beta = 0's 4.5×10−44.5 \times 10^{-4}; Appendix A).

Verbatim Token-ID Editing and Decoupled GRPO

On every editable turn, the model generates reasoning, a final answer inside <answer>...</answer>, and a memory directive: either <pw_keep/> (retaining wt=wt−1w_t = w_{t-1}) or <pw_write>...</pw_write>. Rather than decoding and re-tokenizing the text—which corrupts non-English subwords or unusual BPE combinations—we slice the exact generated token IDs strictly inside the <pw_write> span (handling boundary BPE tokens that straddle > or </) and truncate to Kmax⁡K_{\max} tokens to form wtw_t.

Each generated response yy partitions cleanly into three disjoint token-index masks: task-solving tokens Mtask\mathcal{M}_{\text{task}} (reasoning + <answer>), memory-directive tokens Medit\mathcal{M}_{\text{edit}} (<pw_keep/> or <pw_write>...</pw_write>), and the interior content subset Mpw⊆Medit\mathcal{M}_{\text{pw}} \subseteq \mathcal{M}_{\text{edit}} strictly inside <pw_write>...</pw_write>. For a group of GG rollouts facing the identical task/world, we compute decoupled group-normalized advantages (Eq. 3):

Atask(g)=Rtask(g)−μtaskσtask+ϵ,Apw(g)=Rfuture(g)−μfutureσfuture+ϵA^{(g)}_{\text{task}} = \frac{R^{(g)}_{\text{task}} - \mu_{\text{task}}}{\sigma_{\text{task}} + \epsilon}, \qquad A^{(g)}_{\text{pw}} = \frac{R^{(g)}_{\text{future}} - \mu_{\text{future}}}{\sigma_{\text{future}} + \epsilon}

where Rtask(g)R^{(g)}_{\text{task}} is immediate task accuracy (plus a small format bonus) and Rfuture(g)R^{(g)}_{\text{future}} is strictly downstream performance on future unseen tasks using the resulting persisted window wt(g)w_t^{(g)}. We minimize the decoupled on-policy GRPO objective (Eq. 4):

L(θ,β)=1∑g,i1∑g=1G∑i=1∣y(g)∣[−Ai(g)log⁡πθ,β(yi(g)∣s<i(g))+λi KLk3 ⁣(πθ,β ∥ πref)i]\mathcal{L}(\theta, \beta) = \frac{1}{\sum_{g,i} 1} \sum_{g=1}^G \sum_{i=1}^{|y^{(g)}|} \left[ -A^{(g)}_i \log \pi_{\theta,\beta}(y^{(g)}_i \mid s^{(g)}_{<i}) + \lambda_i \, \mathrm{KL}_{k_3}\!\left(\pi_{\theta,\beta} \,\Vert\, \pi_{\text{ref}}\right)_i \right]

where Ai(g)=Apw(g)A^{(g)}_i = A^{(g)}_{\text{pw}} if i∈Mediti \in \mathcal{M}_{\text{edit}} else Atask(g)A^{(g)}_{\text{task}}, KLk3\mathrm{KL}_{k_3} is Schulman’s non-negative k3k_3 KL estimator against the adapter-disabled reference model at initial β0\beta_0, and critically (Eq. 5):

λi={0if i∈Mpw(unconstrained symbolic emergence),λtaskotherwise.\lambda_i = \begin{cases} 0 & \text{if } i \in \mathcal{M}_{\text{pw}} \quad (\text{unconstrained symbolic emergence}), \\ \lambda_{\text{task}} & \text{otherwise.} \end{cases}

Setting λi=0\lambda_i = 0 on Mpw\mathcal{M}_{\text{pw}} ensures zero fluency penalty against non-English or compressed symbolic codes inside the privileged window, while λtask∈{0.01,0.015}\lambda_{\text{task}} \in \{0.01, 0.015\} keeps normal reasoning coherent.

Figure 2. Stage 0 Calibration & Layerwise Learned Boost. (a) On Qwen2.5-1.5B, mean attention mass directed from task queries to PW keys rises smoothly from () to () and (), while next-token KL perturbation stays modest ( nats) in the operating band. (b) In Stage 1 (Qwen2.5-3B, 36 layers), unconstrained learnable per-head initialized at drifts down across early/middle syntactic layers () and up across upper reasoning layers ().
Figure 2. Stage 0 Calibration & Layerwise Learned Boost. (a) On Qwen2.5-1.5B, mean attention mass directed from task queries to PW keys rises smoothly from 3.7%3.7\% (β=0\beta = 0) to 13.5%13.5\% (β=2.0\beta = 2.0) and 62.0%62.0\% (β=6.0\beta = 6.0), while next-token KL perturbation stays modest (0.420.42 nats) in the β∈[1.5,3.0]\beta \in [1.5, 3.0] operating band. (b) In Stage 1 (Qwen2.5-3B, 36 layers), unconstrained learnable per-head βl,h\beta_{l,h} initialized at 1.5001.500 drifts down across early/middle syntactic layers (L1–L21L_1\text{--}L_{21}) and up across upper reasoning layers (L24–L35L_{24}\text{--}L_{35}).

Stage 1: Episodic Multi-Task Rule Transfer (RuleTransfer-Bench)

Benchmark Design and Causal Controls

To test RQ1–RQ3 without any possibility of weight memorization, we build RuleTransfer-Bench: each episode procedurally samples a brand-new world WeW_e with three orthogonal small-integer latent rules using randomized nonce operator names (24 binary names, 24 unary names): (1) a binary operator op1(a,b)\mathrm{op}_1(a,b) (linear, max⁡\max-shift, or ∣Δ∣|\Delta|-shift), (2) a unary conditional operator op2(x)\mathrm{op}_2(x) (parity or threshold branch), and (3) a global output convention post(z)\mathrm{post}(z) applied to final results. Verbose prose definitions require ∼65–85\sim 65\text{--}85 tokens—far exceeding our tight window caps (Kmax⁡=28K_{\max} = 28 and Kmax⁡=18K_{\max} = 18).

Each episode consists of 4 sequential observation turns (where the model sees only its persisted PW and the current noisy task prompt, never prior turns) followed by 4 held-out transfer tasks with zero rule definitions in the prompt buried inside noisy operational logs:

  • Obs 1–3: Sequentially introduce Rules 1, 2, and 3 amid decoy ticket logs; Obs 2–3 require combining the new rule with earlier rules stored only in PW.
  • Obs 4 (Trap Turn): Introduces no new global rule—only a tempting one-time local rush fee. Blindly overwriting PW destroys stored rules; the optimal action is <pw_keep/>.
  • Transfer T1–T4: T1 tests Rule 1; T2 tests Rule 2; T3 tests full composition post(op2(op1(a,b)))\mathrm{post}(\mathrm{op}_2(\mathrm{op}_1(a,b))); T4 is an unseen OOD format testing reverse-order composition post(op1(op2(a),b))\mathrm{post}(\mathrm{op}_1(\mathrm{op}_2(a), b)).

We train six arms on Qwen2.5-3B-Instruct (up to 100 GRPO steps, B=3B = 3 worlds ×\times G=6G = 6 rollouts/step, LoRA r=32r = 32, λtask=0.01\lambda_{\text{task}} = 0.01, λpw=0\lambda_{\text{pw}} = 0) and two scale-check arms on Qwen2.5-7B-Instruct (60 steps): No-PW (floor), PW β=0\beta = 0 (key no-boost ablation), PW β=2.0\beta = 2.0, PW β=3.5\beta = 3.5, PW Learn βl,h\beta_{l,h} (init 1.51.5, unconstrained), and PW β=2.0,Kmax⁡=18\beta = 2.0, K_{\max} = 18 (extreme compression). Every best checkpoint undergoes a 7-condition causal battery on 40 brand-new unseen test worlds (n=160n = 160 transfer tasks).

Stage 1 Results

Table 1. Stage 1 Causal Evaluation on 40 Unseen Test Worlds (n=160n = 160 transfer tasks). Every trained checkpoint is evaluated under seven zero-training interventions. Two-sided zz-test pp-values compare Learned PW vs. Random PW and vs. hand-crafted compact Oracle PW. 3B arms trained 100 steps (except β=3.5\beta = 3.5: 89 steps, K=18K = 18: 78 steps due to 3h container cap); 7B trained 60 steps. Significance vs. Learned PW (n=160n = 160): ∗p<0.02^{*}p < 0.02, †p<0.005^{\dagger}p < 0.005, ‡p<10−7^{\ddagger}p < 10^{-7}. 7B collapsed to empty PW (K=0K = 0) due to 92% Step-0 <pw_keep/> prior.
ArmLearned PW (+β+\beta)Boost OFF (β→0\beta \to 0)Random PW (+β+\beta)Shuffled PW (+β+\beta)Wrong-W (+β+\beta)Empty PWOracle PW (+β+\beta)PW Attn (%)OOD T4 (L / Off)
3B No-PW (floor)0.037——————0.00.03 / —
3B PW β=0\beta = 00.3880.3880.019‡^{\ddagger}0.0440.0440.0440.263∗^{*}3.80.00 / 0.00
3B PW β=2.0\beta = 2.00.2810.2690.050‡^{\ddagger}0.0130.0370.0190.163∗^{*}10.70.03 / 0.00
3B PW β=3.5\beta = 3.50.3190.3190.013‡^{\ddagger}0.0370.0190.0310.081‡^{\ddagger}26.10.05 / 0.03
3B PW Learn βl,h\beta_{l,h}0.3880.3880.025‡^{\ddagger}0.0370.0190.0370.231†^{\dagger}11.60.03 / 0.00
3B PW β=2,K=18\beta = 2, K = 180.3120.2560.019‡^{\ddagger}0.0620.0370.0370.056‡^{\ddagger}12.90.12 / 0.05
7B PW β=0\beta = 00.0560.0560.0560.0560.0560.0560.2940.00.00 / 0.00
7B PW β=2.5\beta = 2.5 Up0.0310.0310.0310.0310.0310.0310.1940.00.00 / 0.00
Figure 3. Stage 1 Learning Dynamics and Causal Controls. (a) Validation transfer accuracy across GRPO steps on 24 held-out worlds (s1_pw_beta3.5 peaks at ). (b) Causal interventions on 40 unseen test worlds (): replacing learned PWs with random or shuffled tokens collapses accuracy back to the no-memory floor across all 3B PW arms, and self-written PWs beat hand-crafted Oracle PWs.
Figure 3. Stage 1 Learning Dynamics and Causal Controls. (a) Validation transfer accuracy across GRPO steps on 24 held-out worlds (s1_pw_beta3.5 peaks at 36.5%36.5\%). (b) Causal interventions on 40 unseen test worlds (n=160n = 160): replacing learned PWs with random or shuffled tokens collapses accuracy back to the 3.7%3.7\% no-memory floor across all 3B PW arms, and self-written PWs beat hand-crafted Oracle PWs.

Table 1 and Figure 3 establish four clean findings on RuleTransfer-Bench:

1. Self-edited PWs store genuine cross-task knowledge and beat Oracle PWs. All five 3B PW arms jump from 3.7%3.7\% (No-PW) to 28.1–38.8%28.1\text{--}38.8\% unseen transfer accuracy (reaching T1=85–100%T_1 = 85\text{--}100\% and T2=57–62%T_2 = 57\text{--}62\% on PW β=0\beta = 0 and Learn βl,h\beta_{l,h}). Replacing the learned PW with length- and boost-matched Random, Shuffled, or Wrong-World tokens collapses accuracy to 1.3–6.2%1.3\text{--}6.2\% (p≤2.6×10−8p \le 2.6 \times 10^{-8}), ruling out register-token or attention-sink confounds. Remarkably, across all five 3B arms, the model’s self-written PW significantly outperforms our human-authored compact Oracle PW (e.g., 38.8%38.8\% vs. 26.3%26.3\%, p=0.017p = 0.017 for β=0\beta = 0; 31.2%31.2\% vs. 5.6%5.6\%, p<10−7p < 10^{-7} for K=18K = 18), demonstrating end-to-end writer–reader co-adaptation. Qualitatively, Step-0 PWs were polluted by local noise (+4 rush fee), whereas trained PWs discarded 100% of distractors and compressed ∼85\sim 85-token prose by ∼6×\sim 6\times (e.g., relk(a, b) = a - b + 3 ; wrim(x) = x + 3, dropping multiplication symbols under tight caps).

2. Explicit rule lookup works at β=0\beta = 0 up to 3.2k tokens—until tight compression (Kmax⁡=18K_{\max} = 18). To test whether +β+\beta prevents attention dilution when normal context grows long and noisy, we appended 0, 12, or 30 blocks of distracting archive logs containing deprecated decoy formulas (∼281→1,452→3,209\sim 281 \to 1{,}452 \to 3{,}209 prompt tokens) to T1T_1 and T2T_2 across all five 3B checkpoints (Figure 4). While β>0\beta > 0 preserved 4.5–9×4.5\text{--}9\times higher PW attention mass at 3,2093{,}209 tokens (7.0–14.3%7.0\text{--}14.3\% vs. 1.6%1.6\% for β=0\beta = 0), explicit named-rule recall remained virtually flat for both PW β=0\beta = 0 (73.4%→75.0%73.4\% \to 75.0\%) and Learn βl,h\beta_{l,h} (78.1%→75.0%78.1\% \to 75.0\%). Because Stage 1 prompts explicitly name the target operator (compute relk(5,3)), pretrained induction heads locate readable formulas even at 1.6%1.6\% mean attention mass. Crucially, however, under the tightest budget (PW β=2,K=18\beta = 2, K = 18), disabling +β+\beta at test time caused the sharpest drop in Stage 1: −5.6-5.6 pp overall (31.2%→25.6%31.2\% \to 25.6\%), −7-7 pp on OOD T4T_4 (12%→5%12\% \to 5\%, the highest OOD score of any Stage 1 arm), and −6.3-6.3 pp at 1,4521{,}452 tokens (51.6%→45.3%51.6\% \to 45.3\%).

Figure 4. Long-Context Distraction Scaling Stress Test (Stage 1, tokens). (a) On explicitly named rules (, ), both and boosted models resist distraction up to 3.2k tokens, while the tight-budget arm relies measurably on at short/medium lengths. (b) Post-training boost preserves more attention mass on PW tokens under severe context dilution.
Figure 4. Long-Context Distraction Scaling Stress Test (Stage 1, 281→3,209281 \to 3{,}209 tokens). (a) On explicitly named rules (T1+T2T_1 + T_2, n=64n = 64), both β=0\beta = 0 and boosted models resist distraction up to 3.2k tokens, while the tight-budget K=18K = 18 arm relies measurably on +β+\beta at short/medium lengths. (b) Post-training boost preserves 4.5–9×4.5\text{--}9\times more attention mass on PW tokens under severe context dilution.

3. Layerwise boost preference and two optimization failure modes. Unconstrained Learn βl,h\beta_{l,h} (Figure 2b) revealed a structured depth profile: early/middle syntactic layers (L1–L21L_1\text{--}L_{21}) drifted below initialization (1.483–1.4981.483\text{--}1.498) while upper semantic layers (L24–L35L_{24}\text{--}L_{35}) drifted above (1.505–1.5161.505\text{--}1.516). Stage 1 also exposed two concrete RL failure modes: (i) Conservative keep-lock: 3B PW β=2.0\beta = 2.0 learned to write Rule 1 perfectly (T1=100%T_1 = 100\%) and then emit <pw_keep/> on 100%100\% of Turns 2–4 (T2=5%T_2 = 5\%) because overwriting a boosted window carried high immediate downside; and (ii) Cold-start write collapse at 7B: Qwen2.5-7B-Instruct emitted <pw_keep/> on 91.7%91.7\% of Turn-1 steps at Step 0, starving GRPO of non-empty trajectories and collapsing to K=0K = 0 (3.1–5.6%3.1\text{--}5.6\%) despite reading Oracle PWs at 19.4–29.4%19.4\text{--}29.4\%.

Stage 2: Real-World Cross-Domain Persistent PW (RealMultiTask-Bench)

Benchmark Design, Validation Gating, and v1 →\to v2 Diagnosis

Unlike Stage 1—where task prompts explicitly name operators defined in PW—real-world reasoning tasks never mention tokens stored in a global persistent window. We construct RealMultiTask-Bench spanning four objectively verified training domains: (1) Math (GSM8K word problems (Cobbe et al., 2021), disjoint train [0:7000][0{:}7000], val-gate [7000:][7000{:}], and official test split), (2) Countdown (4-number combinatorial target search verified by safe AST evaluation), (3) Knights & Knaves (3-agent formal logic verified for unique SAT assignments), and (4) Python Execution Tracing (6–10 line stateful programs with loops, branches, and list mutations). After training, the single evolved global PW (Kmax⁡=32K_{\max} = 32) is evaluated frozen on 160 held-out in-distribution tasks (40/domain) and 160 completely unseen OOD tasks across two novel domains: (5) Symbolic Sequence Pattern Extrapolation (80 tasks) and (6) Multi-Constraint Scheduling CSP (80 tasks, unique permutation verified).

In each GRPO round, the model views the current global PW, generates G=4G = 4 candidate PW revisions (<pw_keep/> or <pw_write>) at temperature 1.01.0, and evaluates every candidate across the exact same stratified 8-task batch (2 tasks/domain). Policy updates train both the PW-editor (group-normalized cross-domain accuracy, λpw=0\lambda_{\text{pw}} = 0) and the task solver (λtask=0.015\lambda_{\text{task}} = 0.015).

Diagnostic Discovery from Pilot Stage 2 v1 (Un-Gated Persistence). In an initial single-seed pilot (n=80n = 80 ID +40+ 40 OOD, Appendix C), feeding raw accuracy percentages into the reflection prompt and committing the best mini-batch candidate without validation gating caused noisy failure-log strings (e.g., math=0%, logic_knk=0%) to pollute PW in PW β=0\beta = 0 (collapsing overall accuracy to 16.7%16.7\%, math 0.55→0.150.55 \to 0.15) and Learn βl,h\beta_{l,h} (12.5%12.5\%). Strikingly, PW β=2.0\beta = 2.0 escaped collapse, achieved the highest pilot score (28.3%28.3\% overall vs. 24.2%24.2\% No-PW; 27.5%27.5\% vs. 12.5%12.5\% OOD, peaking at 30.0%30.0\% OOD at Step 45 with the alien shorthand perf|prove|ltt|ltts|lt|cntdwn|ltt|stats|lt|rst|scrn|eqtn|stats), and exhibited strong causal coupling (28.3%28.3\% Learned vs. 22.5%22.5\% Boost-Off, 24.2%24.2\% Empty, 11.7%11.7\% Random [p=1.3×10−3p = 1.3 \times 10^{-3}], 6.7%6.7\% Shuffled [p=1.0×10−5p = 1.0 \times 10^{-5}]), whereas PW β=0\beta = 0 showed zero content dependence (16.7%16.7\% Learned ≈16.7%\approx 16.7\% Empty ≈17.5%\approx 17.5\% Shuffled).

Stage 2 v2 (Rigorous Multi-Seed Protocol). To eliminate pollution and properly power OOD testing, Stage 2 v2 introduces two clean fixes: (i) removing raw accuracy percentages from the reflection prompt, and (ii) validation-gated persistence, committing a candidate rewrite w′w' only if its greedy accuracy on a disjoint 24-task cross-domain gate buffer satisfies Accgate(w′)≥Accgate(w)\mathrm{Acc}_{\text{gate}}(w') \ge \mathrm{Acc}_{\text{gate}}(w). We run 3 independent seeds ({42,137,2026}\{42, 137, 2026\}) across four 3B arms—No-PW GRPO, PW β=0\beta = 0, PW β=2.0\beta = 2.0 (All), and PW β=2.5\beta = 2.5 (Upper-Half L18–35L_{18\text{--}35}) (directly testing our Stage 1 layerwise hypothesis)—yielding 960 pooled test evaluations (480 ID + 480 OOD) per arm, plus a 3-arm 7B scale generalization check (Qwen2.5-7B-Instruct).

Stage 2 v2 Multi-Seed and 7B Scale Results

Table 2. Stage 2 v2 Multi-Seed (Qwen2.5-3B, 3 seeds ×\times 320 tasks = 960 evals/arm) and Scale Generalization (Qwen2.5-7B, 320 tasks). Mean ±\pm std across seeds {42,137,2026}\{42,137,2026\} for 3B. Causal interventions evaluate the same best checkpoint under Boost OFF (β→0\beta \to 0), Empty, Random (+β+\beta), and Shuffled (+β+\beta). On 7B PW β=2.5\beta = 2.5 Upper, unseen ood_csp reaches 37.5% with Evolved PW vs. 23.8% (No-PW), 28.8% (Empty), and 23.8% (both Random and Shuffled).
Model / ArmInterventionIn-Dist (160)Unseen OOD (160)Overall (320)MathOOD PatPW Attn
3B No-PW GRPO (3s)Standard RL25.6±4.125.6 \pm 4.123.3±3.723.3 \pm 3.724.5±3.524.5 \pm 3.579.233.30.0%
3B PW β=0\beta = 0 (3s)Evolved PW27.9±3.9\mathbf{27.9 \pm 3.9}21.0±1.921.0 \pm 1.924.5±1.524.5 \pm 1.579.235.41.2%
3B PW β=0\beta = 0 (3s)Empty PW27.5±2.327.5 \pm 2.320.2±0.820.2 \pm 0.823.9±1.423.9 \pm 1.4——0.0%
3B PW β=0\beta = 0 (3s)Random PW27.3±3.127.3 \pm 3.123.3±2.623.3 \pm 2.625.3±2.225.3 \pm 2.2——1.3%
3B PW β=0\beta = 0 (3s)Shuffled PW27.9±3.427.9 \pm 3.421.0±1.221.0 \pm 1.224.5±1.924.5 \pm 1.9——1.3%
3B PW β=2.0\beta = 2.0 All (3s)Evolved PW (+β+\beta)25.0±1.425.0 \pm 1.424.4±0.0\mathbf{24.4 \pm 0.0}24.7±0.7\mathbf{24.7 \pm 0.7}81.734.26.5%
3B PW β=2.0\beta = 2.0 All (3s)Boost OFF (β→0\beta \to 0)24.8±0.624.8 \pm 0.623.5±3.123.5 \pm 3.124.2±1.624.2 \pm 1.6——1.5%
3B PW β=2.0\beta = 2.0 All (3s)Empty PW24.8±3.124.8 \pm 3.124.6±1.624.6 \pm 1.624.7±2.224.7 \pm 2.2——0.0%
3B PW β=2.0\beta = 2.0 All (3s)Random PW (+β+\beta)18.3±5.818.3 \pm 5.826.5±3.826.5 \pm 3.822.4±4.822.4 \pm 4.8——8.6%
3B PW β=2.0\beta = 2.0 All (3s)Shuffled PW (+β+\beta)25.0±2.025.0 \pm 2.021.7±3.121.7 \pm 3.123.3±2.623.3 \pm 2.6——6.1%
3B PW β=2.5\beta = 2.5 Upper (3s)Evolved PW (+β+\beta)17.5±1.817.5 \pm 1.819.2±0.619.2 \pm 0.618.3±1.218.3 \pm 1.268.335.41.4%
3B PW β=2.5\beta = 2.5 Upper (3s)Boost OFF (β→0\beta \to 0)13.7±3.513.7 \pm 3.519.4±0.919.4 \pm 0.916.6±1.316.6 \pm 1.3——0.4%
3B PW β=2.5\beta = 2.5 Upper (3s)Random / Shuffled13.313.3 / 13.513.519.219.2 / 19.019.016.316.3 / 16.316.3——1.5%
7B No-PW GRPO (s42)Standard RL35.037.536.290.051.30.0%
7B PW β=0\beta = 0 (s42)Evolved PW (K<Kn><V>)28.140.034.180.050.01.2%
7B PW β=0\beta = 0 (s42)Empty / Random32.5 / 27.537.5 / 34.435.0 / 30.9——0.0 / 1.7%
7B PW β=2.5\beta = 2.5 Up (s42)Evolved PW (<M><L><C><V><K><N>)34.441.237.887.545.04.5%
7B PW β=2.5\beta = 2.5 Up (s42)Boost OFF (β→0\beta \to 0)32.542.537.585.050.01.5%
7B PW β=2.5\beta = 2.5 Up (s42)Empty PW34.440.637.587.552.50.0%
7B PW β=2.5\beta = 2.5 Up (s42)Random PW (+β+\beta)31.935.633.887.547.57.2%
7B PW β=2.5\beta = 2.5 Up (s42)Shuffled PW (+β+\beta)33.136.234.782.548.85.6%
Figure 5. Stage 2 v2 Real-World Cross-Domain Transfer (3-Seed 3B Mean Std + 7B Scale). (a) Held-out ID () and completely unseen OOD () accuracy. Validation gating completely eliminates Stage 2 v1's collapse; PW All achieves the tightest variance ( ALL, OOD) and highest 3B mean OOD (), though mean accuracy over No-PW GRPO is statistically modest (). (b) Causal interventions demonstrate that is invariant to window content, whereas couples performance to window tokens.
Figure 5. Stage 2 v2 Real-World Cross-Domain Transfer (3-Seed 3B Mean ±\pm Std + 7B Scale). (a) Held-out ID (n=160n = 160) and completely unseen OOD (n=160n = 160) accuracy. Validation gating completely eliminates Stage 2 v1's β=0\beta = 0 collapse; PW β=2.0\beta = 2.0 All achieves the tightest variance (±0.7%\pm 0.7\% ALL, ±0.0%\pm 0.0\% OOD) and highest 3B mean OOD (24.4%24.4\%), though mean accuracy over No-PW GRPO is statistically modest (p=0.70p = 0.70). (b) Causal interventions demonstrate that β=0\beta = 0 is invariant to window content, whereas +β+\beta couples performance to window tokens.

Table 2 and Figure 5 reveal four critical, nuanced findings that single-seed evaluation alone would have obscured:

1. Validation gating fixes β=0\beta = 0 pollution—and exposes the true headroom of static discrete PWs. Removing raw percentage snapshots and adding the 24-task validation gate raised 3B PW β=0\beta = 0 from 16.7%16.7\% (v1) to 24.5±1.5%24.5 \pm 1.5\% (v2), tying No-PW GRPO (24.5±3.5%24.5 \pm 3.5\%). Across 960 pooled 3B evaluations, 3B PW β=2.0\beta = 2.0 All achieved the highest mean overall accuracy (24.7±0.7%24.7 \pm 0.7\%), highest mean OOD accuracy (24.4±0.0%24.4 \pm 0.0\% across all three seeds vs. 23.3±3.7%23.3 \pm 3.7\% No-PW and 21.0±1.9%21.0 \pm 1.9\% PW β=0\beta = 0), highest GSM8K accuracy (81.7%81.7\% vs. 79.2%79.2\%), and 5×5\times lower cross-seed standard deviation (±0.7%\pm 0.7\% vs. ±3.5%\pm 3.5\%). However, pooled two-proportion tests show the mean accuracy difference vs. No-PW GRPO is not statistically significant (p=0.92p = 0.92 ALL; p=0.70p = 0.70 OOD), and Empty PW (24.7%24.7\%) matches Evolved PW (24.7%24.7\%) on average. When LoRA updates can directly adapt weights to stationary benchmarks whose underlying skills are already pretrained, a 32-token static prefix provides stabilization rather than a large mean ceiling jump.

2. Asymmetric (“double-edged”) causal coupling replicates across seeds and scales. At β=0\beta = 0 (3B mean attention mass 1.2%1.2\%), the model is completely invariant to window content: Evolved (24.5%24.5\%) ≈\approx Shuffled (24.5%24.5\%) ≈\approx Empty (23.9%23.9\%) ≈\approx Random (25.3%25.3\%). At β=2.0\beta = 2.0 (attention mass 6.5%6.5\%, 5.2×5.2\times higher), causal sensitivity rises sharply: Random PW drops 3B ID accuracy by −6.7-6.7 pp (25.0%→18.3%25.0\% \to 18.3\%), and in Seed 137 (SymbVerifLKNTLKTrd), Evolved PW (25.3%25.3\%) beats Boost-Off (21.9%21.9\%), Random (21.2%21.2\%), and Shuffled (20.0%20.0\%). At 7B, PW β=0\beta = 0 reaches 40.0%40.0\% OOD (vs. 37.5%37.5\% No-PW, lifting Countdown 7.5%→32.5%7.5\% \to 32.5\%) while Random PW drops OOD to 34.4%34.4\% (−5.6-5.6 pp). Most notably, 7B PW β=2.5\beta = 2.5 Upper—which autonomously evolved the 13-token bracketed code <M><L><C><V><K><N>—achieves the highest overall (37.8%37.8\% vs. 36.2%36.2\% No-PW, 34.1%34.1\% β=0\beta = 0) and highest unseen OOD accuracy (41.2%41.2\% vs. 37.5%37.5\% No-PW) of any 7B arm, driven by a +13.7+13.7 pp jump on unseen constraint scheduling (ood_csp: 37.5%37.5\% vs. 23.8%23.8\% No-PW, 28.8%28.8\% Empty, and 23.8%23.8\% under both Random and Shuffled PW, p=0.059p = 0.059).

3. Scale dependence of upper-layer boosting (β=2.5\beta = 2.5, L≥L/2L_{\ge L/2}). Interestingly, upper-layer boosting showed a clear scale split: at 3B, concentrating β=2.5\beta = 2.5 in L18–35L_{18\text{--}35} significantly hurt Stage 2 v2 (18.3±1.2%18.3 \pm 1.2\% vs. 24.5%24.5\%, p=0.001p = 0.001) because two of three seeds stayed locked at empty PW (K=0K = 0) under the strict validation gate (while Seed 2026 still showed sharp causal coupling: 20.0%20.0\% Evolved vs. 14.7%14.7\% Boost-Off and 13.8%13.8\% Random/Shuffled). At 7B, however, the exact same upper-layer configuration (L14–27L_{14\text{--}27}) succeeded cleanly (37.8%37.8\% ALL, 41.2%41.2\% OOD), suggesting that larger models better exploit concentrated upper-layer attention boosts without destabilizing early parsing.

4. Spontaneous emergence of compressed non-English symbolic codes under λKL,pw=0\lambda_{\text{KL,pw}} = 0. Table 3 catalogs representative windows invented autonomously by the models across stages, seeds, and scales. Without any supervision on window syntax, zero-KL RL consistently compressed verbose strategies into ultra-dense symbolic shorthand: stripped-vowel pipe tokens (perf|prove|ltt|...|eqtn|stats), camel-case composite codes (SymbVerifLKNTLKTrd, SOLVEUNIDIST), and—at 7B scale—abstract bracketed single-letter tags (<M><L><C><V><K><N> and K<Kn><V>).

Table 3. Catalog of Autonomously Evolved Privileged Window Tokens (λKL,pw=0\lambda_{\text{KL,pw}} = 0). Across both stages and model scales (3B and 7B), tight token budgets and zero KL regularization drive spontaneous compression from verbose English into terse formulas, pipe-delimited shorthand, camel-case codes, and abstract bracketed symbols.
Stage / RunModelToksVerbatim Evolved Privileged Window (pw_text)
Stage 1 beta0 (Step 0)3B16+4 rush fee / kral(x,y): x+y+3; rush_fee(+3) (noisy)
Stage 1 learnable_head3B23relk(a, b) = a - b + 3; wrim(x) = x + 3 (∼6×\sim 6\times compressed)
Stage 1 beta2_k183B13miv(a, b) = 2a - 2b + 2 (drops * and all distractors)
Stage 2 v1 beta2 (Step 45)3B32perf|prove|ltt|ltts|lt|cntdwn|ltt|stats|lt|rst|scrn|eqtn|stats
Stage 2 v2 beta0 (s42)3B9verify logic steps, generalize patterns, reuse templates
Stage 2 v2 beta2_all (s137)3B9SymbVerifLKNTLKTrd
Stage 2 v2 beta2_all (s2026)3B5SOLVEUNIDIST
Stage 2 v2 beta0 (s42)7B6K<Kn><V>
Stage 2 v2 beta2.5_up (Step 25)7B16<CK><TK><PK><V><CK><TK><PK><V><W><C><T><P><N><S><CK><TK
Stage 2 v2 beta2.5_up (Step 50)7B13<M><L><C><V><K><N>

Discussion, Design Rules, and Limitations

Operating Taxonomy: When Privileged Windows and +β+\beta Work. Our two-stage study establishes a clear taxonomy of operating regimes. (1) Novel, non-memorizable cross-task invariants (Stage 1): when tasks share persistent latent structure absent from pretraining, RL-edited discrete PW yields 10×10\times transfer gains, strips distractors, and beats human-written prompts via writer–reader co-adaptation. (2) Explicit lookup vs. implicit priors: standard attention (β=0\beta = 0) already retrieves explicitly named rules up to 3.2k tokens, so +β+\beta adds lift there primarily under tight compression (Kmax⁡=18K_{\max} = 18, +5.6+5.6 pp). On implicit, abstract cross-domain priors (Stage 2), β=0\beta = 0 allocates only ∼1.2%\sim 1.2\% attention mass and ignores the window, whereas +β+\beta forces 4–8×4\text{--}8\times higher attention, creating genuine causal coupling, cutting 3B cross-seed variance 5×5\times, and achieving top 7B ID/OOD accuracy (37.8%/41.2%37.8\% / 41.2\%). (3) Weight-absorption limit: on stationary benchmarks where pretrained weights already encode core skills and LoRA adapters are trainable, weight adaptation absorbs most headroom (24.7%24.7\% vs. 24.5%24.5\% across 960 pooled 3B evals). We therefore predict the largest real-world wins for PW-PT in continual test-time adaptation with frozen weights (e.g., per-user/codebase memory) and very long contexts (32k–128k32\text{k}\text{--}128\text{k} tokens) where softmax dilution is 10–100×10\text{--}100\times harsher.

Engineering Rules and Limitations. Four design rules emerge directly from our ablations: (1) bootstrap write exploration (SFT warm-start or write-entropy bonus) to prevent 7B’s 92% <pw_keep/> cold-start collapse; (2) use slot-level additive edits (<pw_set slot=i>) rather than full-window overwrites to prevent high-β\beta keep-lock; (3) validation-gate persistent commits whenever β>0\beta > 0, since forced attention magnifies pollution penalties; and (4) match boost placement to scale (moderate uniform β≈2.0\beta \approx 2.0 at 3B; upper-layer β=2.5\beta = 2.5 at 7B). Key limitations include restricting evaluation to Qwen2.5 (1.5B/3B/7B) with LoRA (r=32r = 32) over 50–100 GRPO steps and ≤3.2k\le 3.2\text{k} contexts; cross-family transfer (Llama/Gemma), RoPE-decoupled memory keys, ultra-long horizons, and continuous-vs-discrete PW comparisons remain promising future directions.

Reproducibility and Ethics. All code, procedural environment generators, exact random seeds, unit tests verifying KV-cache and gradient-checkpointing equivalence, and raw JSON logs for all 27 training runs are reproducible from open-weight models (Qwen2.5) and synthetic or public academic benchmarks (GSM8K); no human subjects or private data are involved.

References

  1. Bulatov, Aydar and Kuratov, Yuri and Burtsev, Mikhail S. (2022). Recurrent Memory Transformer. Advances in Neural Information Processing Systems (NeurIPS).
  2. Burtsev, Mikhail S. and Kuratov, Yuri and Peganov, Anton and Sapunov, Grigory V. (2020). Memory Transformer. arXiv preprint arXiv:2006.11527.
  3. Chevalier, Alexis and Wettig, Alexander and Ajith, Anirudh and Chen, Danqi (2023). Adapting Language Models to Compress Contexts. Proceedings of the 2023 Conference on Empirical Methods in Natural Language Processing (EMNLP).
  4. Cobbe, Karl and Kosaraju, Vineet and Bavarian, Mohammad and Chen, Mark and Jun, Heewoo and Kaiser, Łukasz and Plappert, Matthias and Tworek, Jerry and Hilton, Jacob and Nakano, Reiichiro and Hesse, Christopher and Schulman, John (2021). Training Verifiers to Solve Math Word Problems. arXiv preprint arXiv:2110.14168.
  5. Darcet, Timothée and Oquab, Maxime and Mairal, Julien and Bojanowski, Piotr (2024). Vision Transformers Need Registers. International Conference on Learning Representations (ICLR).
  6. DeepSeek-AI (2025). DeepSeek-R1: Incentivizing Reasoning Capability in LLMs via Reinforcement Learning. arXiv preprint arXiv:2501.12948.
  7. Goyal, Sachin and Ji, Ziwei and Rawat, Ankit Singh and Menon, Aditya Krishna and Kumar, Sanjiv and Nagarajan, Vaishnavh (2024). Think Before You Speak: Training Language Models With Pause Tokens. International Conference on Learning Representations (ICLR).
  8. Graves, Alex and Wayne, Greg and Danihelka, Ivo (2014). Neural Turing Machines. arXiv preprint arXiv:1410.5401.
  9. Hu, Edward J. and Shen, Yelong and Wallis, Phillip and Allen-Zhu, Zeyuan and Li, Yuanzhi and Wang, Shean and Wang, Lu and Chen, Weizhu (2022). LoRA: Low-Rank Adaptation of Large Language Models. International Conference on Learning Representations (ICLR).
  10. Lester, Brian and Al-Rfou, Rami and Constant, Noah (2021). The Power of Scale for Parameter-Efficient Prompt Tuning. Proceedings of the 2021 Conference on Empirical Methods in Natural Language Processing (EMNLP).
  11. Li, Xiang Lisa and Liang, Percy (2021). Prefix-Tuning: Optimizing Continuous Prompts for Generation. Proceedings of the 59th Annual Meeting of the Association for Computational Linguistics (ACL).
  12. Liu, Nelson F. and Lin, Kevin and Hewitt, John and Paranjape, Ashwin and Bevilacqua, Michele and Petroni, Fabio and Liang, Percy (2024). Lost in the Middle: How Language Models Use Long Contexts. Transactions of the Association for Computational Linguistics (TACL).
  13. Mu, Jesse and Li, Xiang Lisa and Goodman, Noah (2023). Learning to Compress Prompts with Gist Tokens. Advances in Neural Information Processing Systems (NeurIPS).
  14. Packer, Charles and Wooders, Sarah and Lin, Kevin and Fang, Vivian and Patil, Shishir G. and Stoica, Ion and Gonzalez, Joseph E. (2023). MemGPT: Towards LLMs as Operating Systems. arXiv preprint arXiv:2310.08560.
  15. Qwen Team (2024). Qwen2.5 Technical Report. arXiv preprint arXiv:2412.15115.
  16. Shao, Zhihong and Wang, Peiyi and Zhu, Qihao and Xu, Runxin and Song, Junxiao and Bi, Xiao and Zhang, Haowei and Zhang, Mingchuan and Li, Y. K. and Wu, Y. and Guo, Daya (2024). DeepSeekMath: Pushing the Limits of Mathematical Reasoning in Open Language Models. arXiv preprint arXiv:2402.03300.
  17. Shinn, Noah and Cassano, Federico and Berman, Edward and Gopinath, Ashwin and Narasimhan, Karthik and Yao, Shunyu (2023). Reflexion: Language Agents with Verbal Reinforcement Learning. Advances in Neural Information Processing Systems.
  18. Sun, Mingjie and Chen, Xinlei and Kolter, J. Zico and Liu, Zhuang (2024). Massive Activations in Large Language Models. Conference on Language Modeling (COLM).
  19. Suzgun, Mirac and Yuksekgonul, Mert and Bianchi, Federico and Jurafsky, Dan and Zou, James (2025). Dynamic Cheatsheet: Test-Time Learning with Adaptive Memory. arXiv preprint arXiv:2504.07952.
  20. Vaswani, Ashish and Shazeer, Noam and Parmar, Niki and Uszkoreit, Jakob and Jones, Llion and Gomez, Aidan N. and Kaiser, Łukasz and Polosukhin, Illia (2017). Attention Is All You Need. Advances in Neural Information Processing Systems (NeurIPS).
  21. Xiao, Guangxuan and Tian, Yuandong and Chen, Beidi and Han, Song and Lewis, Mike (2024). Efficient Streaming Language Models with Attention Sinks. International Conference on Learning Representations (ICLR).
  22. Zhang, Qingru and Singh, Chandan and Liu, Liyuan and Liu, Xiaodong and Yu, Bin and Gao, Jianfeng and Zhao, Tuo (2024). Tell Your Model Where to Attend: Post-hoc Attention Steering for LLMs. International Conference on Learning Representations (ICLR).

Appendix

A. Implementation, Stage 0 Diagnostics, and Training Loop

KV-Cache Exactness and Gradient Checkpointing. Our PWAttentionController wraps each decoder layer’s self_attn.forward under PyTorch SDPA (attn_implementation="sdpa"). When β\beta requires gradients (learnable modes), we switch strictly to SDPBackend.MATH during gradient-enabled passes because fused CUDA SDPA kernels do not backpropagate into additive attn_mask tensors. Both forward() and backward() execute inside ctrl.pw_context(pw_key_mask, task_query_start) so non-reentrant gradient checkpointing recomputes the exact same boosted mask. On Qwen2.5-1.5B-Instruct in FP32 CUDA with left-padded heterogeneous batches (including empty K=0K = 0 sequences), cached step-by-step decoding matches full-sequence forward() within max⁡∣Δlogit∣=4.20×10−4\max|\Delta\text{logit}| = 4.20 \times 10^{-4} at β=2.5\beta = 2.5 versus 4.48×10−44.48 \times 10^{-4} at β=0.0\beta = 0.0.

Table 4. Stage 0 Calibration Sweep on Qwen2.5-1.5B-Instruct (CUDA bf16, 12 worlds). Attention mass scales monotonically with β\beta while next-token KL perturbation stays low for β≤2.0\beta \le 2.0.
β\beta0.01.02.03.04.06.0
Mean PW Attention Mass (%)3.707.4513.4622.7234.7162.02
Zero-Shot Next-Token KL vs. β=0\beta = 0 (nats)0.0000.0930.4191.2683.4593.590

Chat-Template Layout Discovery (Stage 0b). Prepending an unseen <|im_start|>memory\n[PW]<|im_end|>\n turn before <|im_start|>system caused zero-shot Qwen2.5-1.5B and 3B to ignore the window (0%0\% oracle accuracy, emitting bare guessed integers without CoT). Placing <privileged_window> immediately inside the opening <|im_start|>system block—while restricting the PW key boost mask Ipw\mathcal{I}_{\text{pw}} strictly to the raw PW content token IDs—restored immediate zero-shot parsing and raised Step-0 format compliance from 12.5%12.5\% to 87.5%87.5\% on 3B.

Algorithm 1: Privileged Window Post-Training (PW-PT) via Decoupled GRPO. Given pretrained LLM πθ0\pi_{\theta_0}, LoRA adapters θ\theta, boost config β\beta, token cap Kmax⁡K_{\max}, and KL weights (λtask,λpw=0)(\lambda_{\text{task}}, \lambda_{\text{pw}} = 0), for each step t=1,…,Tt = 1, \dots, T:

  1. Sample a batch of worlds/tasks and roll out GG trajectories per group under pw_context(β\beta).
  2. Parse <answer> and verbatim token IDs inside <pw_write>...</pw_write> (capped at Kmax⁡K_{\max}) or <pw_keep/>.
  3. Persist wtw_t across subsequent turns (Stage 1) or validation-gate global commits on 24 disjoint tasks (Stage 2 v2).
  4. Compute immediate task rewards RtaskR_{\text{task}} and downstream future transfer rewards RfutureR_{\text{future}}.
  5. Group-normalize per-segment advantages Atask,ApwA_{\text{task}}, A_{\text{pw}} (Eq. 3).
  6. Compute reference log-probs via disable_adapter() at fixed β0\beta_0.
  7. Update (θ,β)(\theta, \beta) using Eq. (4) with λi=0\lambda_i = 0 on Mpw\mathcal{M}_{\text{pw}} (inside pw_context for gradient checkpointing).

B. Stage 1 Detailed Breakdown and Long-Context Table

Table 5. Stage 1 Per-Task Causal Breakdown (n=40n = 40 per task T1–T4T_1\text{--}T_4) on Best Checkpoints. T1T_1: Rule 1; T2T_2: Rule 2; T3T_3: post(op2(op1(a,b)))\mathrm{post}(\mathrm{op}_2(\mathrm{op}_1(a,b))); T4T_4: OOD reverse composition post(op1(op2(a),b))\mathrm{post}(\mathrm{op}_1(\mathrm{op}_2(a), b)).
ArmPW LenSym %T1T_1T2T_2T3T_3T4T_4 (OOD)AllBoost OFFOracle
3B No-PW0.00.00.050.000.070.030.037——
3B PW β=0\beta = 027.961.00.930.620.000.000.3880.3880.263
3B PW β=2.0\beta = 2.016.360.01.000.050.050.030.2810.2690.163
3B PW β=3.5\beta = 3.525.158.60.850.380.000.050.3190.3190.081
3B PW Learn βl,h\beta_{l,h}27.259.20.950.570.000.030.3880.3880.231
3B PW β=2,K=18\beta = 2, K = 1817.160.80.930.120.070.120.3120.2560.056
Table 6. Long-Context Distraction Scaling Stress Test (32 unseen worlds, T1+T2T_1 + T_2, n=64n = 64). Adding 0, 12, or 30 blocks of noisy operational archive logs scales prompt length from ∼281\sim 281 to ∼3,209\sim 3{,}209 tokens.
ArmShort (∼\sim281t) Acc (ON / OFF)Short Attn %Med (∼\sim1,452t) Acc (ON / OFF)Med Attn %Long (∼\sim3,209t) Acc (ON / OFF)Long Attn %
3B PW β=0\beta = 00.734 / —3.630.750 / —1.950.750 / —1.57
3B PW β=2.0\beta = 2.00.516 / 0.46910.760.469 / 0.4696.260.469 / 0.4845.26
3B PW β=3.5\beta = 3.50.594 / 0.60925.500.562 / 0.56216.460.578 / 0.57814.25
3B PW Learn βl,h\beta_{l,h}0.781 / 0.76611.420.766 / 0.7817.840.750 / 0.7667.04
3B PW β=2,K=18\beta = 2, K = 180.516 / 0.46913.540.516 / 0.4538.930.469 / 0.4697.71

C. Stage 2 v1 Pilot vs. Stage 2 v2 Per-Seed Results

Table 7. Stage 2 v1 Pilot (Un-Gated Persistence, Raw % Snapshot Prompt, n=80n = 80 ID +40+ 40 OOD). Demonstrates both the pollution failure mode under un-gated writes (beta0, learnable_head) and the sharp causal coupling of beta2 (p=1.25×10−3p = 1.25 \times 10^{-3} vs. Random, p=1.0×10−5p = 1.0 \times 10^{-5} vs. Shuffled).
Arm (v1 Pilot, 60 steps)InterventionID (80)OOD (40)ALL (120)Attn %PW Len
s2_no_pwStandard GRPO0.3000.1250.2420.00
s2_pw_beta0Evolved / Empty / Rand / Shuf0.113 / 0.125 / 0.100 / 0.1130.275 / 0.250 / 0.225 / 0.3000.167 / 0.167 / 0.142 / 0.1752.211
s2_pw_beta2Evolved (+β+\beta)0.2870.2750.2839.819
s2_pw_beta2Boost OFF (β→0\beta \to 0)0.2630.1500.2252.519
s2_pw_beta2Empty / Random / Shuffled0.263 / 0.075 / 0.0870.200 / 0.200 / 0.0250.242 / 0.117 / 0.0670 / 14.1 / 14.419
s2_pw_learnable_headStep 60 Eval (polluted)0.0620.2500.1257.330
Table 8. Stage 2 v2 Per-Seed Full Breakdown (Qwen2.5-3B, n=160n = 160 ID +160+ 160 OOD =320= 320 tasks/seed).
RunIDOODALLOFFEmptyRandShufEvolved PW
no_pw_s420.2190.1810.200————""
no_pw_s1370.2370.2630.250————""
no_pw_s20260.3120.2560.284————""
beta0_s420.2370.2370.2370.2370.2220.2340.231verify logic steps, generalize...
beta0_s1370.3310.2000.2660.2660.2560.2840.272unsolved prob;
beta0_s20260.2690.1940.2310.2310.2370.2410.231...
beta2_all_s420.2560.2440.2500.2500.2590.2870.263Consistency Verify Prove...
beta2_all_s1370.2630.2440.2530.2190.2660.2120.200SymbVerifLKNTLKTrd
beta2_all_s20260.2310.2440.2370.2560.2160.1720.237SOLVEUNIDIST
beta2.5_up_s420.1630.1880.1750.1750.1750.1750.175"" (gate kept empty)
beta2.5_up_s1370.1630.1880.1750.1750.1750.1750.175"" (gate kept empty)
beta2.5_up_s20260.2000.2000.2000.1470.1810.1380.138logic_knk code_t

D. Hyperparameters and Compute Budget

All training runs used NVIDIA A100-80GB GPUs on Modal with bfloat16 weights, LoRA (r=32,α=64r = 32, \alpha = 64 on all attention and MLP projections q,k,v,o,gate,up,down), AdamW (β1=0.9,β2=0.999\beta_1 = 0.9, \beta_2 = 0.999, weight decay 0.010.01 on LoRA and 0.00.0 on β\beta), gradient clipping 1.01.0 (clipped separately for LoRA and β\beta in Stage 2), and non-reentrant gradient checkpointing. Stage 1 used lrLoRA=3×10−5\text{lr}_{\text{LoRA}} = 3 \times 10^{-5} (3B) / 2×10−52 \times 10^{-5} (7B), lrβ=6×10−3\text{lr}_\beta = 6 \times 10^{-3}, λtask=0.01\lambda_{\text{task}} = 0.01, λpw=0.0\lambda_{\text{pw}} = 0.0, B=3B = 3 worlds ×\times G=6G = 6 rollouts/step, T=0.85T = 0.85. Stage 2 v2 used lrLoRA=2.5×10−5\text{lr}_{\text{LoRA}} = 2.5 \times 10^{-5} (3B) / 2×10−52 \times 10^{-5} (7B), λtask=0.015\lambda_{\text{task}} = 0.015, λpw=0.0\lambda_{\text{pw}} = 0.0, G=4G = 4 candidates ×\times 8 stratified tasks/step, edit temperature 1.01.0, task temperature 0.850.85, 50 steps. Total compute across all 27 training runs plus diagnostics and causal stress tests was approximately 19 A100-80GB GPU-hours (∼\sim$48 on Modal).