通过梯度定位关键词,实现大模型推理时精准可控的语义引导。
GrAInS: Gradient-based Attribution for Inference-Time Steering of LLMs and VLMs
- 基于梯度归因识别影响输出的关键输入词,动态构建引导向量。
- 在多个任务上显著提升准确率与对齐性,降低幻觉率17.6%。
- 无需微调或额外训练,适合需要快速调整模型行为的场景。
推理时引导方法为大型语言模型(LLMs)和视觉语言模型(VLMs)提供了一种轻量级替代方案,通过在测试时修改内部激活值而不更新模型权重来实现。然而,现有方法多依赖固定全局干预向量,忽视单个输入词的因果影响,且未充分利用模型logits中的信息梯度,尤其在视觉与文本输入贡献不均的多模态场景中表现不佳。为此,我们提出GrAInS,一种适用于纯语言与视觉语言模型及任务的推理时引导方法。GrAInS采用对比式梯度归因(集成梯度),识别对理想输出有正负贡献的前k个最具影响力词元,并据此构建捕捉语义转变的方向性引导向量。推理过程中,该方法依据词元级归因信号调整Transformer层的隐藏激活值,并进行归一化以保持表征尺度。这实现了细粒度、可解释且模块化的模型行为控制,无需重训练或辅助监督。实验表明,GrAInS在多项基准上持续优于微调与现有引导基线:在TruthfulQA上使Llama-3.1-8B准确率提升13.22%;将LLaVA-1.6-7B在MMHal-Bench上的幻觉率从0.624降至0.514;在SPA-VL上提升对齐胜率8.11%,同时保持模型流畅性与通用能力。
原文摘要 · Abstract (English)
Inference-time steering methods offer a lightweight alternative to fine-tuning large language models (LLMs) and vision-language models (VLMs) by modifying internal activations at test time without updating model weights. However, most existing approaches rely on fixed, global intervention vectors, overlook the causal influence of individual input tokens, and fail to leverage informative gradients from the model's logits, particularly in multimodal settings where visual and textual inputs contribute unevenly. To address these limitations, we introduce GrAInS, an inference-time steering approach that operates across both language-only and vision-language models and tasks. GrAInS uses contrastive, gradient-based attribution via Integrated Gradients to identify the top-k most influential tokens, both positively and negatively attributed based on their contribution to preferred versus dispreferred outputs. These tokens are then used to construct directional steering vectors that capture semantic shifts from undesirable to desirable behavior. During inference, GrAInS adjusts hidden activations at transformer layers guided by token-level attribution signals, and normalizes activations to preserve representational scale. This enables fine-grained, interpretable, and modular control over model behavior, without retraining or auxiliary supervision. Empirically, GrAInS consistently outperforms both fine-tuning and existing steering baselines: it achieves a 13.22% accuracy gain on TruthfulQA using Llama-3.1-8B, reduces hallucination rates on MMHal-Bench from 0.624 to 0.514 with LLaVA-1.6-7B, and improves alignment win rates on SPA-VL by 8.11%, all while preserving the model's fluency and general capabilities.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。