Manifold-Guided Attention Steering

Ian Li, Kapilesh Guruprasad, Raunak Sengupta, Ninad Satish, Loris D'Antoni, Rose Yu

TL;DR

Manifold-Guided Attention Steering (MAGS) is a "trajectory-aware" method that improves LLM reasoning by intervening only when the model begins to drift toward an error. By projecting internal activations back onto a learned "correctness manifold" during inference, MAGS fixes reasoning slips in real-time without disrupting the steps the model already gets right.

What Problem Does This Paper Address?

Large Language Models (LLMs) often possess the knowledge to solve a problem but fail to apply it consistently across multiple reasoning steps. This is evidenced by the fact that if you sample an LLM multiple times, it might get the answer right once and wrong twice—the "capability" is there, but the "reliability" is missing.

Existing solutions, like activation steering, try to fix this by adding a constant "correction vector" to the model's internal states. However, these methods are "blind": they apply the same nudge at every single token, regardless of whether the model is currently on the right track or not. This often leads to "over-steering," where the intervention actually breaks correct reasoning or makes the model's output sound garbled (high perplexity).

Methods

The authors introduce MAGS, which treats reasoning as a geometric path through a high-dimensional space.

  1. Contrastive Manifold Construction: The researchers collect pairs of "correct" and "incorrect" reasoning traces for the same problems. By calculating the difference between these activations and applying Principal Component Analysis (PCA), they identify a low-dimensional error subspace—the specific directions in which "wrong" activations tend to drift.
  2. Dynamic Triggering: During inference, MAGS monitors specific attention heads. It calculates a proximity score to see how much the current activation projects onto the error subspace.
  3. Targeted Projection: If the drift exceeds a certain threshold (meaning the model is about to make a mistake), MAGS intervenes. Instead of adding a fixed vector, it performs a projection correction: it mathematically "subtracts" the component of the activation that resides in the error subspace, effectively pushing the model back onto the "correctness manifold."
  4. Head Selection: To keep things efficient, they don't monitor every part of the model. They pre-select a small number of "high-signal" attention heads that are most predictive of errors.

Datasets

The authors evaluated MAGS across three diverse domains to prove its generality:

  • Mathematical Reasoning: MATH-500 and GSM8K.
  • Code Generation: HumanEval and MBPP (where correctness is verified by actually running the code).
  • Molecular Generation: A task involving the creation of SMILES strings (chemical notation) that are both syntactically valid and have high binding affinity to target proteins.

Key Insights and Ideas

  • Errors are Localized: The "error signal" isn't spread evenly across the model. It is concentrated in specific attention heads. This allows for very "surgical" interventions.
  • Information Preservation: Because MAGS uses a projection rather than an additive shift, it leaves the dimensions of the activation that are unrelated to the error completely untouched. This explains why it maintains much better output fluency than previous methods.
  • Attention Anchoring: The authors found that correcting a reasoning step at time $t$ makes that token a better "anchor" for future steps. Subsequent parts of the generation attend more strongly to the corrected token, preventing the error from compounding.
  • Multi-Objective Steering: In the molecular task, they showed that you can steer for two things at once (e.g., "be a valid molecule" AND "bind to this protein") by using two independent manifolds, avoiding the "interference" that usually happens when you try to optimize for multiple goals.

Key Results

MAGS consistently outperformed unsteered models and static steering baselines (like ITI and Angular Steering):

  • Accuracy Gains: On the MATH-500 benchmark, MAGS improved Llama-3.1-8B accuracy by 5.2 percentage points over the baseline.
  • Coding: It boosted HumanEval pass@1 scores by approximately 4 points on both Llama and Gemma models.
  • Fluency: Unlike other steering methods that often increase perplexity (making the model's language less natural), MAGS maintained perplexity levels nearly identical to the unsteered model.
  • Robustness: Ablation studies showed that MAGS is much less sensitive to hyperparameter tuning than static methods, largely because the "proximity trigger" acts as a natural safeguard.

Limitations and Future Work

  • Data Requirements: MAGS requires a dataset of contrastive (correct vs. incorrect) traces to "fit" the manifold. This might be difficult to find for very niche or low-resource tasks.
  • Offline Head Selection: Currently, the "important" attention heads are identified ahead of time. The authors suggest that a future version could select heads dynamically based on the context of the conversation.
  • Head Independence: The current model treats each attention head as an independent actor. Modeling the interactions between heads could potentially lead to even more powerful corrections with even less computational overhead.

Summary updated

BibTeX
@inproceedings{li2026manifold,
  author = {Ian Li and Kapilesh Guruprasad and Raunak Sengupta and Ninad Satish and Loris D'Antoni and Rose Yu},
  title = {{Manifold-Guided Attention Steering}},
  booktitle = {FoGen @ ICML},
  year = {2026},
  url = {https://openreview.net/forum?id=kFPAOPghBQ},
}
Figure