arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2605.21770cs.LG
收藏

基于流形的注意力引导

Manifold-Guided Attention Steering

University of California, San Diego(加州大学圣地亚哥分校)

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

AI总结:

本文提出了一种基于流形的注意力引导方法,通过在推理过程中监控注意力头与正确性流形的距离,动态纠正偏差,从而提高大语言模型在数学推理、代码生成和分子生成等任务中的表现。

摘要:

尽管大型语言模型具备完成正确推理所需的知识,但在推理任务中仍经常出现错误。一种可能的改进方法是通过激活引导。然而,现有激活引导方法使用固定且预先计算的修正向量,忽略了模型当前所处的生成轨迹位置;结果是无差别扰动,会像错误步骤一样自由地破坏已正确步骤。我们提出基于流形的注意力引导(MAGS),这是一种基于几何观察的轨迹感知推理过程干预方法:特定注意力头的输出激活在错误点偏离低维正确性流形,并且这种偏差会通过后续步骤累积。对于每个识别出的注意力头,我们从正确和错误轨迹的对比对中学习一个低维子空间,该子空间捕捉了误差行为偏离正确行为的方向。在推理过程中,我们监控每个头与该流形的距离,并在偏差超过学习阈值时应用针对性的投影修正,将注意力输出引导回正确的子空间,防止误差传播。MAGS在数学推理(MATH-500,GSM8K)、代码生成(HumanEval,MBPP)和分子生成(SMILES)等基准测试中均优于未引导的基线和静态引导方法,表明正确性流形是LLM注意力几何学中的普遍特征。

英文摘要:

Large language models frequently produce errors in reasoning tasks despite possessing the underlying knowledge required for correct reasoning. One possible approach to improve reasoning consistency is through activation steering. However, existing activation steering approaches apply fixed, pre-computed correction vectors, ignoring where the model currently sits along its generation trajectory; the result is indiscriminate perturbation that disrupts already-correct steps as freely as erroneous ones. We propose Manifold-Guided Attention Steering (MAGS), a trajectory-aware inference-time intervention grounded in a geometric observation: the output activations of specific attention heads diverge from a low-dimensional correctness manifold at the point of error, and this deviation compounds through subsequent steps. For each identified attention head, we learn a low-dimensional subspace from contrastive pairs of correct and incorrect traces that capture the directions along which error behavior deviates from correct behavior. During inference, we monitor each head's proximity to this manifold and apply a targeted projection correction when deviation exceeds a learned threshold, steering the attention output back toward the correct subspace before the error propagates. MAGS consistently outperforms both unsteered baselines and static steering approaches across benchmarks spanning mathematical reasoning (MATH-500, GSM8K), code generation (HumanEval, MBPP), and molecular generation (SMILES), suggesting that correctness manifolds are a general feature of LLM attention geometry.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑