通过模拟人类认知选层,高效精准控制大模型输出。
CogSteer: Cognition-Inspired Selective Layer Intervention for Efficiently Steering Large Language Models
- 基于人类眼动数据找关键中间层进行干预
- 在多个模型上提升生成质量并减少毒性输出
- 适合需要安全可控的AI应用开发者
大型语言模型(LLMs)通过大规模预训练实现优异性能,但其内部机制缺乏可解释性,限制了对特定应用的有效引导。本文从认知科学视角出发,利用眼动测量分析人类认知指标与模型各层表征之间的层间相关性,提出一种启发式方法以选择最优干预层来调节模型语义。基于此,我们设计了一种高效的、选择性地仅干预关键层的微调策略,相比传统全层或仅末层调整更具效率。此外,在推理阶段引入隐式层对比干预机制,有效引导模型避开有毒输出。在GPT-2、Llama2-7B和Mistral-7B上的实验表明,该方法在自然语言理解、推理与生成任务中均表现优异,兼具模型无关性、可解释性与部署效率。
原文摘要 · Abstract (English)
Large Language Models (LLMs) achieve remarkable performance through pretraining on extensive data. This enables efficient adaptation to diverse downstream tasks. However, the lack of interpretability in their underlying mechanisms limits the ability to effectively steer LLMs for specific applications. In this work, we investigate the intrinsic mechanisms of LLMs from a cognitive perspective using eye movement measures. Specifically, we analyze the layer-wise correlation between human cognitive indicators and LLM representations. Building on these insights, we propose a heuristic approach for selecting the optimal steering layer to modulate LLM semantics. To this end, we introduce an efficient selective layer intervention based on prominent parameter-efficient fine-tuning methods, which conventionally adjust either all layers or only the final layer. Additionally, we present an implicit layer contrastive intervention during inference to steer LLMs away from toxic outputs. Extensive experiments on natural language understanding, reasoning, and generation tasks, conducted on GPT-2, Llama2-7B, and Mistral-7B, demonstrate the effectiveness and efficiency of our approach. As a model-agnostic framework, it enhances the interpretability of LLMs while improving efficiency for safe deployment.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。