Late Context Masking: Accuracy and Fidelity to Context-Aware Decoding

Abstract Language models are often more likely to repeat what they memorized than to follow the text in their prompt. Context-aware decoding (CAD) is a common fix: it runs the model a second time without the context and pushes the prediction away from that run. We make the second run cheaper. The two runs share the model's lower layers, and only its last 16 layers, out of 32 to 48, are run again with the context hidden from them, a design we call the late fork. On MemoTrap, a benchmark that asks the model to end familiar quotes with new words, the late fork is 3.5 and 8.6 percentage points more accurate than CAD on Qwen3-4B-Base and Qwen3-8B-Base. The contrast weight sets how hard a decoder pushes away from the second run, and in this comparison both use 0.5, half the weight CAD's authors used on MemoTrap. When CAD's weight is instead tuned on a held-out development split, the 4B comparison is inconclusive. The two decoders choose different tokens: where CAD departs from greedy decoding, the late fork picks CAD's token only 43% and 62% of the time. On Mistral-7B the late fork is about as accurate as CAD, and on Yi-1.5-9B, where CAD adds only 2.5 points over greedy decoding, the late fork adds 4.5 more. On redefine-math it gives no gain over greedy decoding. We conclude that the late fork is a different decoder from CAD, and that its benefit depends on the task. Code and data The code, decision records and per-item outputs are in https://github.com/SeverinVisionary/late-context-masking at commit 35bbd0d. Disclosure The research questions, preregistrations and conclusions are the author's, and the author checked every result. Claude Opus 5.5 (Anthropic) wrote the experiment code and analysis. The author drafted this prose with AI assistance. Codex gpt-6-astra (OpenAI) reviewed the research plan and three of the later preregistrations, and ChatGPT reviewed the research plan and this draft. Experiments ran on one Colab A100 GPU. The author is responsible for the content.

Authors

Publication Details

Journal
Zenodo (CERN European Organization for Nuclear Research)
Published
2026-11-09
DOI
https://doi.org/10.5281/zenodo.24089207
Primary Topic
Natural Language Processing Techniques
Type
preprint
Controls
|||
ALL TIME
JAN
FEB
MAR
APR
MAY
JUN
JUL
AUG
SEP
OCT
NOV
preprint

Late Context Masking: Accuracy and Fidelity to Context-Aware Decoding

Hanyu Yang
Zenodo (CERN European Organization for Nuclear Research)
Natural Language Processing Techniques
preprint

Late Context Masking: Accuracy and Fidelity to Context-Aware Decoding

Hanyu Yang
preprint en

Abstract

Abstract Language models are often more likely to repeat what they memorized than to follow the text in their prompt. Context-aware decoding (CAD) is a common fix: it runs the model a second time without the context and pushes the prediction away from that run. We make the second run cheaper. The two runs share the model's lower layers, and only its last 16 layers, out of 32 to 48, are run again with the context hidden from them, a design we call the late fork. On MemoTrap, a benchmark that asks the model to end familiar quotes with new words, the late fork is 3.5 and 8.6 percentage points more accurate than CAD on Qwen3-4B-Base and Qwen3-8B-Base. The contrast weight sets how hard a decoder pushes away from the second run, and in this comparison both use 0.5, half the weight CAD's authors used on MemoTrap. When CAD's weight is instead tuned on a held-out development split, the 4B comparison is inconclusive. The two decoders choose different tokens: where CAD departs from greedy decoding, the late fork picks CAD's token only 43% and 62% of the time. On Mistral-7B the late fork is about as accurate as CAD, and on Yi-1.5-9B, where CAD adds only 2.5 points over greedy decoding, the late fork adds 4.5 more. On redefine-math it gives no gain over greedy decoding. We conclude that the late fork is a different decoder from CAD, and that its benefit depends on the task. Code and data The code, decision records and per-item outputs are in https://github.com/SeverinVisionary/late-context-masking at commit 35bbd0d. Disclosure The research questions, preregistrations and conclusions are the author's, and the author checked every result. Claude Opus 5.5 (Anthropic) wrote the experiment code and analysis. The author drafted this prose with AI assistance. Codex gpt-6-astra (OpenAI) reviewed the research plan and three of the later preregistrations, and ChatGPT reviewed the research plan and this draft. Experiments ran on one Colab A100 GPU. The author is responsible for the content.

Zenodo (CERN European Organization for Nuclear Research)
Natural Language Processing Techniques
AI Navigator

Ask Laika to Summarize, Analyze, and Connect papers live on the map.

Summarize Papers & Methodologies

Extract key findings, datasets, and comparative methods across publications.

Benchmark Rankings & Visual Analytics

Rank top research institutions, authors, funders, topics, and journals by Field-Weighted Citation Impact (FWCI) and paper volume with instant charts.

Connect Distant Disciplines

Bridge topological clusters on the map to find hidden collaborative intersections.

Laika access coming soon