CogSteer: Cognition-Inspired Selective Layer Intervention for Efficiently Steering Large Language Models

Xintong Wang, Jingheng Pan, Liang Ding, Longyue Wang, Longqin Jiang +2 more
10/23/2024
cs.CLcs.AI

No confident code implementation found for this paper. 2 possible matches can be shown below.

Abstract

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.

View on arXivView PDF

Code Implementations

No confident code match yet

We couldn't find an author-owned or strongly-evidenced community implementation for this paper. 2 weaker matches are hidden by default — verify before relying on them.

No code implementations found yet.

Know of an implementation? Let us know in the comments below!

Similar Papers

Cite this paper

@article{wang2024cogsteer,
  title  = {CogSteer: Cognition-Inspired Selective Layer Intervention for Efficiently Steering Large Language Models},
  author = {Xintong Wang and Jingheng Pan and Liang Ding and Longyue Wang and Longqin Jiang and Xingshan Li and Chris Biemann},
  year   = {2024},
  eprint = {2410.17714},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2410.17714v3}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2410.17714.svg)](https://codeofpaper.com/paper/2410.17714)

Discussion