REAL:用Transformer激活读出实现语言模型引导的精准定位
REAL: Reading Out Transformer Activations for Precise Localization in Language Model Steering
REAL框架通过为每个模块的隐藏激活训练向量量化自编码器(VQ-AE),借助共享可学习码本将潜空间划分为行为相关与行为无关子空间,并以二分类指标量化模块的行为相关性,从而指导模块选择与引导强度。在Llama和Qwen两个模型家族共8个LLM、9个数据集上,该方法在真实性引导任务上较ITI平均相对提升20%,最高达81.5%,所选模块在跨域真实性引导中表现出强零样本泛化能力。
arXiv:2506.08359v4 Announce Type: replace Abstract: Inference-time steering aims to alter an LLM's responses without changing its parameters. A key challenge lies in selecting internal modules that most strongly govern the target behavior; existing approaches often rely on simplistic cues or ad hoc heuristics, leading to suboptimal or unintended effects. In this work, we introduce REAL, a novel framework for identifying behavior-relevant modules (heads or layers) in Transformers. For each module, we train a vector-quantized autoencoder (VQ-AE) on its hidden activations, partitioning the latent space into behavior-relevant and behavior-irrelevant subspaces via a shared, learnable codebook. We quantify each module's behavioral relevance by evaluating how effectively the VQ-AE encodings distinguish between behavior-aligned and behavior-violating responses using a binary classification metric. This relevance score informs both module selection and steering strength. We evaluate REAL across eight LLMs from two model families (Llama and Qwen) and nine datasets spanning truthfulness enhancement, open-domain question answering under knowledge conflicts, and general alignment tasks. REAL enables more effective inference-time interventions, yielding significant improvements on these steering tasks. Notably, it achieves an average relative improvement of 20% (up to 81.5%) over the seminal ITI method on truthfulness steering. Moreover, the modules selected by our method exhibit strong zero-shot generalization in cross-domain truthfulness-steering scenarios. We provide the source code to reproduce all experimental results at https://github.com/liam0949/REAL_ICLR.
来源:arXiv (AI + Vision + Imaging) · arxiv.org