NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

Context Noise Gates: Learned Attention Shrinkage Against Distractor-Driven Reasoning Failures

Language models that can solve hard multi-step problems often fail easy versions of the same problems once irrelevant or misleading text is added to the prompt. When a model is told to "think step by step," it can also build an argument that justifies the misleading text instead of setting it aside. We propose a small learned module that shrinks attention toward context the model barely relies on. Signal processing has a tool for this, adaptive soft thresholding, and we borrow it. The module sits inside each attention layer of a frozen model. At every decoding step it predicts a threshold, subtracts that threshold from every attention weight, sets anything below zero to zero, and renormalizes. Weakly attended context tokens therefore lose their influence entirely, while strongly attended ones are only slightly reduced.

The scientific bet is narrower than "denoise the model." Ordinary softmax attention always gives every token some nonzero weight, so distractors can steer the model through many small contributions spread across tokens and attention heads. If many distractor failures work this way, learned shrinkage should remove them cheaply and without retraining the model. If instead distractors work by grabbing a lot of attention, shrinkage will not help, and the experiments will show that too. Either outcome tells us something about where distractor failures come from.

Core Claim

Deep residual shrinkage networks, which add a learned noise-suppression step to the layers of a convolutional network, compute a threshold from the current input by pooling a feature map and passing it through a small fully connected layer and a sigmoid. They then shrink every feature toward zero by that amount, and they are known to suppress background noise adaptively in vibration, EEG and radar signals (Zhao et al., STANet, LST-Net). We transplant this exact mechanism onto post-softmax attention rows in a frozen language model. Let $a_{ij}$ be the attention weight from the current position $i$ to context token $j$. Let $\tau_{i}^{(h)}$ be a threshold predicted per head $h$ from summary statistics of that attention row and the current hidden state. The gated attention is

$$\tilde a_{ij} = \frac{\max(0,\ a_{ij} - \tau_i^{(h)})}{\sum_k \max(0,\ a_{ik} - \tau_i^{(h)}) + \epsilon},$$

where $\epsilon$ is a small constant for numerical stability. Because attention weights are nonnegative, the symmetric two-sided shrinkage that motivates soft thresholding in signal processing plays no role here. What we keep is the other half of the operator: a continuous, differentiable cutoff whose level is chosen anew for each input.

The claim has three parts. First, training only the gate to make the model's outputs on distractor-laden prompts match its outputs on the clean versions recovers a large share of the accuracy lost to distractors. Second, it does so without lowering accuracy on clean prompts. Third, it transfers to distractor types it was not trained on, because the operator can only remove information and cannot add new behavior.

Relation to Prior Work

Four papers establish the failure we target. Can Large Language Models Always Solve Easy Problems if They Can Solve Harder Ones? finds that redundant information is one of the main causes of easy-problem failures, and that 7B models reach only 50–70% consistency between hard and easy versions of the same problem. Thinking in a Crowd builds SciAux, a ScienceQA variant with injected auxiliary snippets, and shows that explicit thinking rationalizes misleading snippets. Qwen3-8B falls from 96.22% accuracy on clean prompts to 77.03% with thinking on and to 74.87% with thinking off when two misleading snippets are present, so roughly a 19-point gap remains to close. Think Clearly and FROST link reasoning errors to redundant, diffuse attention inside long reasoning traces. Together these four papers motivate the work.

Three papers come closest in mechanism and constrain the design. Top-Theta Attention applies a hard threshold to attention elements, calibrated once offline per head, and adds compensation terms to repair the resulting distribution. It found that thresholding after the softmax works much better than thresholding before it, which is why we gate after the softmax. Its goal is reducing memory traffic, not improving reasoning, and its threshold neither adapts to the input nor admits gradient learning. FROST replaces softmax with Softmax₁, which adds 1 to the denominator so that attention can leak away to nothing, and it fine-tunes with LoRA and prunes sentences. Its tail suppression is fixed in form, it requires fine-tuning the model, and its sentence pruning drops a critical step in about 8% of cases. STAR-KV uses differentiable soft thresholding on the singular values of the key-value cache, with thresholds learned during calibration. That shows soft thresholding can be learned cheaply inside large language models, but it targets compression and its thresholds are not computed per input.

Our proposal differs from all three in three ways at once. The threshold is computed per step and per input. The operator is soft and differentiable. And the gate is trained against a distractor-removal objective rather than an efficiency objective. SoftCoT shows that a frozen backbone with a small trained adapter can improve reasoning (GSM8K accuracy rises from 79.61% to 81.03% on LLaMA-3.1-8B). We adopt that same "frozen backbone, small adapter" training approach.

Research Program

We first build the gate. For each attention head it pools the attention row into four numbers: the maximum, the entropy, the mass in the top 5% of entries, and the mean. It concatenates these with a low-dimensional projection of the query and passes the result through one fully connected layer and a sigmoid. The output is scaled into a threshold range of $[0, 1/n_{ctx}\cdot c]$, where $n_{ctx}$ is the context length and $c$ is a learned per-head ceiling. The gate adds well under 1% of the model's parameters, and the backbone stays frozen.

We then construct training pairs by inserting distractors into clean problems. GSM8K problems receive redundant numeric facts and swapped-variable sentences, following the trap types catalogued in ConsisEval. The training objective is the KL divergence between the gated model's next-token distribution on the distracted prompt and the ungated model's distribution on the clean prompt. We add a small term on clean prompts that penalizes any change in the model's outputs.

The analysis has two parts. Because we know exactly where the distractor span sits in each prompt, we can measure the attention mass that span receives before and after gating, broken down by layer and head. For each test example we also estimate how much of the distractor's influence flows through attention entries that fall below the learned threshold. We compute this by ablating only those entries and measuring how much the answer changes. This tail fraction is the predictor at the center of the hypothesis. Examples with a high tail fraction should be fixed by the gate, and examples where the distractor is strongly attended should not be.

Baselines

The do-nothing reference point is the frozen model, run with thinking on and off, on both clean and distracted prompts. For SciAux the reported figures are 96.22% clean, 77.03% thinking on with two misleading snippets, and 74.87% thinking off (Thinking in a Crowd). We will reproduce them before comparing anything. A prompt-instruction baseline adds the sentence "the context may contain irrelevant or misleading information" to the prompt.

The strongest training-based competitor is LoRA fine-tuning on the same distractor-augmented pairs with the same KL objective. We match it to the gate in trainable parameter count, data, number of steps and hyperparameter search budget. This baseline answers the question of whether the gain comes from the shrinkage operator or simply from training on distractor-augmented data. The proposal beats it if it matches LoRA's accuracy on the distractor type seen in training and exceeds it on held-out distractor types or on clean accuracy.

The strongest existing attention-modification method is FROST. We run its Softmax₁ attention with its LoRA recipe, trained on our distractor pairs as well as on its original OpenR1 data, and we disable sentence pruning so that we compare the attention operator alone. FROST reports a +26.70% accuracy gain and a 69.68% token reduction on MATH500 with Phi-4-Reasoning and GPT-oss-20B. No reported result was found on Lacuna for FROST on SciAux or ConsisEval. For the redundant-trace setting, Think Clearly reports AMC 2023 accuracy rising from 75.0% to 82.5% on Qwen2.5-7B, and we include it as a test-time pruning baseline on the reasoning-model experiments.

Two ablations isolate the key ingredient. The first is a static per-head threshold calibrated offline, in the style of Top-θ. Here we report no reported result found on Lacuna for Top-θ on reasoning benchmarks; the paper reports less than 1% accuracy loss on general tasks. The second is a single learned threshold per head that does not depend on the input, trained with the same objective. If the input-conditioned gate does not beat the learned per-head threshold on the held-out distractor types, then adaptivity is not the ingredient that matters.

Why not just…?

Why not just filter the retrieved snippets with a relevance reranker? For redundant facts that have nothing to do with the question, a reranker is a real threat, and we include one as a baseline on the GSM8K-derived set. SciAux's misleading snippets, however, are on-topic by construction, so filtering on relevance alone should keep them. The comparison across these two settings shows whether the gate does anything a reranker cannot. If the reranker matches the gate on both settings, we will say so.

Why not just fine-tune the model on distractor-augmented data? This is the most serious alternative, which is why the matched LoRA baseline exists. Our argument for the gate is structural. It can only reduce attention to tokens the model already weighs lightly, so it should leave clean-context behavior intact and should not memorize the style of the training distractors. The decisive comparison is to train on GSM8K-style redundant facts and test on SciAux misleading snippets and ConsisEval. If LoRA transfers equally well and loses no clean accuracy, the gate's only remaining advantage is that it is cheaper, and the proposal is weakened accordingly.

Why not just turn thinking off, or sample many answers and vote? In SciAux's misleading condition, thinking off reaches 74.87%, which is still about 21 points below clean accuracy, so turning thinking off does not remove the problem. Majority voting multiplies compute by the number of samples. Beyond Logits shows that the model's log-probability separates correct from incorrect paths with an AUC of only 0.18, while its latent-velocity score (LogNorm-LVE) reaches 0.89. We will run self-consistency and LVE best-of-10 at matched sample budgets. Because the gate is applied during each single generation, it can be combined with these selection methods, and we report the combination.

Proposed Experiments

The models are Qwen3-8B, so that the SciAux numbers are directly comparable, and DeepSeek-R1-Distill-Qwen-7B. The benchmarks are SciAux with zero, one and two misleading snippets; ConsisEval on GSM8K, scored by consistency score; and GSM8K with synthetic distractors. On MATH500 and AMC 2023 we use the clean versions only, as a check that the gate does no harm when there are no distractors.

The metrics are accuracy on distracted and clean prompts, the fraction of the clean–distracted gap that is recovered, the number of thinking tokens, attention mass on the distractor span, and the per-example tail fraction. In the code-assisted variant we also report program soundness, judged by the code-structure judge on the program's syntax tree from Evaluating Intermediate Reasoning. The purpose is to check whether a recovered answer comes with recovered logic rather than a lucky guess.

Four checks decide the outcome. First, the gate should recover at least a third of SciAux's 19-point thinking-on gap while losing no more than half a point of clean accuracy. Second, on held-out distractor types it should beat the matched LoRA baseline. Third, the input-conditioned gate should beat the learned per-head threshold. Fourth, the per-example tail fraction should predict which examples the gate fixes. If the gate helps but the tail fraction does not predict where it helps, the stated mechanism is wrong and we will report that. If the gate fails mainly on examples where the distractor is strongly attended, that supports the alternative explanation: rationalization of salient premises needs a different remedy than shrinkage.