HyperAIHyperAI

Command Palette

Search for a command to run...

Outstanding PaperACL 2024

워드 임베딩은 언어 모델의 스티어(Steers)이다

Chi Han Jialiang Xu Manling Li Yi Fung Chenkai Sun Nan Jiang Tarek Abdelzaher Heng Ji

초록

언어 모델(LM)은 언어 말뭉치에 대한 사전 학습 과정에서 워드 임베딩을 자동으로 학습한다. 워드 임베딩은 일반적으로 개별 단어의 특징 벡터로 해석되지만, 언어 모델 생성에서의 역할은 충분히 탐구되지 않았다. 본 연구에서는 출력 워드 임베딩을 이론적·경험적으로 재조명하며, 이들의 선형 변환이 언어 모델의 생성 스타일을 스티어링하는 것과 동등하다는 것을 발견하였다. 이러한 스티어를 LM-Steers라 명명하고, 모든 크기의 언어 모델에 존재함을 확인하였다. 각 스타일을 스티어링하는 데에는 원본 언어 모델 크기의 0.2%에 해당하는 매개변수 학습만 필요하다. 언어 모델 독성 제거 및 감정 제어와 같은 작업에서, LM-Steers는 생성 품질과의 균형을 더욱 유지하면서 최첨단 제어 생성 방법과 동등하거나 우수한 성능을 달성할 수 있다. 학습된 LM-Steer는 텍스트 스타일에 대한 렌즈 역할을 수행하며, 언어 모델 생성과 연관될 때 워드 임베딩이 해석 가능하다는 것을 밝히고, 스타일 차이를 가장 잘 나타내는 텍스트 구간을 부각할 수 있다. 하나의 LM-Steers는 명시적 계산식을 통해 서로 다른 언어 모델 간에 전이될 수 있다. 또한 LM-Steers를 단순히 스케일링하거나 여러 LM-Steers의 변환을 덧셈으로 결합하여 언어 모델을 연속적으로 스티어링할 수도 있다. 코드는 https://github.com/Glaciohound/LM-Steer에서 공개적으로 이용 가능하다.

One-sentence Summary

Researchers at University of Illinois Urbana-Champaign introduce LM-Steers, which leverage the finding that linear transformations of output word embeddings are equivalent to steering language model generation styles, requiring only 0.2%0.2\%0.2% of the original parameters while achieving comparable or superior detoxification and sentiment control performance to state-of-the-art methods without sacrificing generation quality.

Key Contributions

  • The paper introduces LM-Steers as theoretically and empirically supported linear transformations of output word embeddings that steer language model generation styles, with the phenomenon observed across language models of different sizes and each style learned using parameters equal to 0.2% of the original model size.
  • On language model detoxification and sentiment control tasks, LM-Steers achieve comparable or superior performance to state-of-the-art controlled generation methods while maintaining a better balance between control effectiveness and generation quality.
  • Learned LM-Steers can be transferred to other language models through an explicit-form calculation, support continuous and compositional control by scaling or adding transformations, and reveal interpretable style differences and text spans in associated generations.

Introduction

Language models rely on learned word embeddings to determine the probability of each next token, making these embeddings central to understanding and guiding generation in tasks such as detoxification, sentiment control, and personalized text production. Prior work has mostly interpreted embeddings at the word level or uses control methods that are costly, classifier-dependent, prompt-sensitive, or limited in flexibility and transferability. The authors leverage a simple linear transformation of output word embeddings, called LM-Steer, to directly link embedding dimensions with generation styles. This approach enables efficient, interpretable, compositional, and transferable control over language model generation without retraining the full model.

Method

The authors leverage a theoretical observation that, under certain assumptions, changing the generation style of a language model can be represented as a linear transformation in the output word embedding space. This insight leads to LM-Steer, a lightweight and architecture-agnostic steering module that keeps the base language model frozen and applies a learned linear transformation only to the final word embeddings. The framework contains three functional views: embedding adaptation, supervised steering training, and controlled generation. As shown in the figure below:

Let ev\mathbf{e}_vev​ denote the original output word embedding of token vvv. LM-Steer replaces it with an adapted embedding ev′\mathbf{e}'_vev′​ by adding a style-dependent perturbation. This is written as

ev′=ev+ϵWev=(I+ϵW)ev.\mathbf{e}'_v = \mathbf{e}_v + \epsilon W \mathbf{e}_v = (I + \epsilon W)\mathbf{e}_v.ev′​=ev​+ϵWev​=(I+ϵW)ev​.

Here, WWW is the learnable steering matrix, and ϵ\epsilonϵ is a scalar that controls both the polarity and the intensity of the steering. A positive ϵ\epsilonϵ and a negative ϵ\epsilonϵ steer generation in opposite directions. The base language model is fixed, while WWW is the only trained parameter. The authors also use a small default steering magnitude, ϵ0=10−3\epsilon_0 = 10^{-3}ϵ0​=10−3, because small values are sufficient to induce controlled style shifts without destabilizing the underlying model.

The design can also be interpreted at the logit level. For a context vector c\mathbf{c}c, the original LM computes a logit proportional to c⊤ev\mathbf{c}^\top \mathbf{e}_vc⊤ev​. After steering, the logit becomes

c⊤ev′=c⊤ev+ϵc⊤Wev.\mathbf{c}^\top \mathbf{e}'_v = \mathbf{c}^\top \mathbf{e}_v + \epsilon \mathbf{c}^\top W \mathbf{e}_v.c⊤ev′​=c⊤ev​+ϵc⊤Wev​.

This means the steering matrix introduces a context-dependent adjustment through the bilinear term c⊤Wev\mathbf{c}^\top W \mathbf{e}_vc⊤Wev​. Unlike a static token blacklist or a global logit offset, this adjustment varies with the context, which gives LM-Steer greater expressive power over distribution shifts.

Training is simple and likelihood based. The authors instantiate a steered model PϵWP_{\epsilon W}PϵW​ by applying the transformed embeddings to the original LM. For positive style examples, PϵWP_{\epsilon W}PϵW​ is trained to maximize likelihood on positively labeled text. If negatively labeled examples are available, the negatively steered model P−ϵWP_{-\epsilon W}P−ϵW​ is trained on them. In effect, WWW learns directions in the word embedding space that separate the desired style distribution from the opposite style distribution, so that changing the sign or magnitude of ϵ\epsilonϵ changes the relative preference among candidate tokens during decoding.

At generation time, no iterative generation procedure or external controller is required. The user selects a steering value ϵ\epsilonϵ, plugs the steered embeddings into the fixed LM, and performs normal decoding. This keeps the generation pipeline efficient and makes the method easy to integrate with different decoder architectures.

The linearity of the transformation also supports fine-grained compositional control. Because steering is defined by ϵW\epsilon WϵW, users can interpolate or extrapolate across style levels by varying ϵ\epsilonϵ continuously. If two steering matrices are learned for different styles, their effects can also be combined additively. For two steers (ϵ1,W1)(\epsilon_1, W_1)(ϵ1​,W1​) and (ϵ2,W2)(\epsilon_2, W_2)(ϵ2​,W2​), generation can be conditioned by the summed steering matrix ϵ1W1+ϵ2W2\epsilon_1 W_1 + \epsilon_2 W_2ϵ1​W1​+ϵ2​W2​, enabling simultaneous control over multiple stylistic factors.

A further system-level property of LM-Steer is transferability. If the embedding spaces of two language models are related by a linear mapping HHH, then a steering matrix learned in one model can be transported to another. Suppose source-space embeddings and context vectors are expressed in terms of target-space embeddings as ev=Hev′\mathbf{e}_v = H \mathbf{e}'_vev​=Hev′​ and c=Hc′\mathbf{c} = H \mathbf{c}'c=Hc′. Then the steering term transforms as

c⊤Wev=(Hc′)⊤W(He′)=c′⊤(H⊤WH)ev′.\mathbf{c}^\top W \mathbf{e}_v = (H\mathbf{c}')^\top W (H\mathbf{e}') = \mathbf{c}'^\top (H^\top W H)\mathbf{e}'_v.c⊤Wev​=(Hc′)⊤W(He′)=c′⊤(H⊤WH)ev′​.

Therefore, the transferred steering matrix for the target model is H⊤WHH^\top W HH⊤WH. This allows the authors to reuse a learned steer across models of different sizes and parameterizations without retraining the full steering matrix from scratch. Refer to the following diagram for transferability and data efficiency trends:

Because only a small output embedding transformation is learned, the module is parameter efficient and lightweight. The base model remains unchanged, and the added computation during decoding is limited to a dense transformation of the output embeddings. This design also reduces the supervision burden, since the learnable steering subspace is much smaller than the full model, allowing meaningful style control even with limited labeled data.

Experiment

The experiments evaluate LM-Steer on language detoxification and sentiment control across multiple pre-trained models, comparing it with classifier-guided, fine-tuning, and decoding baselines on toxicity and sentiment metrics as well as generation quality. Results show that LM-Steer achieves strong steering performance while preserving fluency and diversity, supports smooth continuous and compositional control, and remains efficient with few training samples and low decoding overhead. Additional analysis confirms that a steering module can be transferred across model scales through embedding-space mapping, giving broad applicability and robustness.

In language model detoxification, LM-Steer is reported as the best-performing method among the evaluated approaches. The baselines show a common trade-off, where stronger toxicity reduction is often accompanied by higher perplexity and less stable fluency. Toxicity metrics separate the methods more clearly than diversity metrics, which remain broadly similar. LM-Steer is described as achieving the best detoxification performance. PPLM provides little toxicity improvement over the original model while reducing fluency. DAPT and DExperts reduce toxicity more clearly than PPLM, with visible fluency costs. Diversity scores stay relatively comparable across methods, suggesting toxicity and fluency are the main distinguishing dimensions.

Human evaluators generally preferred LM-Steer over LoRA and DExperts across detoxification, fluency, and topicality. Compared with GPT-2, LM-Steer appeared stronger for detoxification and topicality, while fluency remained comparable. LM-Steer was rated better than LoRA on all three human evaluation metrics. LM-Steer was rated better than DExperts on all three metrics, especially topicality. LM-Steer outperformed GPT-2 on detoxification and topicality, with similar fluency.

LM-Steer shows the strongest positive sentiment control among the compared models, especially on prompts that favor positive generations, despite its simpler and smaller design. It remains competitive with larger expert-based baselines and maintains relatively good fluency compared with LoRA and Soft-Blacklist. On negative-side control, it stays near the top of the compared models but does not consistently lead. LM-Steer achieves the best positive sentiment control on positive prompts in the positive-side setting. It offers lower perplexity than LoRA and Soft-Blacklist, suggesting better fluency in the positive control case. It remains a strong option for negative sentiment control, ranking near the top rather than dominating the other side.

The comparison shows that LM-Steer is highly parameter efficient, using far fewer learnable parameters than most steering baselines. Its decoding overhead is modest, with speed close to the base language model. Methods with larger parameter costs or slower decoding, such as PPLM and MuCoLa, are less efficient on both measures. LM-Steer uses much smaller parameter budgets than most compared methods. LM-Steer's decoding time remains close to the base language model speed. PPLM and MuCoLa show substantially higher decoding overhead than LM-Steer.

Increasing the steering value produces a continuous shift in generated text from clearly toxic content to more neutral content. The example generations show that both the amount of toxic wording and its intensity become lower as the steering value moves from negative to positive. Negative steering values produce more explicit toxic or insulting phrasing. Positive steering values yield generations with fewer and less intense toxic words.

The experiments evaluate LM-Steer for detoxification, sentiment control, parameter efficiency, and qualitative behavior under varying steering strengths. LM-Steer is consistently preferred for its strong detoxification, good fluency, better topicality than GPT-2, and superior human ratings compared with LoRA and DExperts. It also demonstrates highly parameter-efficient sentiment control with modest decoding overhead, achieving the strongest positive-side control and remaining competitive on negative-side control, while qualitative examples show that increasing steering strength steadily shifts outputs from toxic to neutral content.


AI로 AI 구축

아이디어에서 출시까지 — 무료 AI 코코딩, 즉시 사용 가능한 환경, 최적의 GPU 가격으로 AI 개발을 가속화하세요.

AI 협업 코딩
바로 사용 가능한 GPU
최적의 가격

HyperAI Newsletters

최신 정보 구독하기
한국 시간 매주 월요일 오전 9시 에 이번 주의 최신 업데이트를 메일로 발송합니다
이메일 서비스 제공: MailChimp