Conceptors for Semantic Steering
TL;DR Highlight
LLM의 hidden state에 행렬 기반 'conceptor'를 끼워서 감정·정치성향·우울 같은 개념을 재학습 없이 정밀하게 조종하는 방법
Who Should Read
LLM의 출력 톤이나 성향을 inference time에 제어하고 싶은 ML 엔지니어. 특히 safety-critical 서비스에서 모델 행동을 감사 가능하게(auditable) 조정해야 하는 팀.
Core Mechanics
- 기존 Activation Steering(활성화 벡터를 더하는 방식)은 개념을 단일 벡터 하나로 표현하는데, 실제 개념(예: 감정, 정치 성향)은 다차원 subspace를 차지하므로 정보가 손실됨.
- Conceptor는 개념과 관련된 activation들의 상관행렬(correlation matrix)로 만든 soft projection 행렬로, 각 방향의 신호 강도에 따라 부드럽게 가중치를 줘서 다차원 개념 subspace 전체를 보존함.
- 양극(bipolar) 학습: 긍정·부정 두 극단의 activation을 합쳐서 conceptor를 학습하면 DiffMean 벡터의 ≥95%를 포착할 수 있어, 단일 극단만 학습한 것보다 훨씬 풍부한 표현을 얻음.
- Conceptor quota(개념이 차지하는 차원 수의 소프트 측정값)를 레이어 선택 진단 도구로 쓰면, 별도의 probe 분류기 학습 없이 Gemma-2-9B-IT와 Qwen-2.5-3B에서 Pearson r 최대 0.96으로 개념 분리 가능성을 예측 가능.
- Conceptor는 Boolean 대수(AND, OR, NOT)를 닫힌 형태(closed-form)로 지원해서, 원본 activation 데이터 없이도 '감정 유지하면서 정치성 제거(AND-NOT)' 같은 조합 제어가 가능함.
- Additive 기법과 비교해 degenerate output(반복·불일관 텍스트) 발생률이 Addition 58%, DiffMean 30%인 반면 Conceptor interpolation은 13%로 훨씬 안전함.
Evidence
- 500개 held-out 프롬프트 기준 win ratio: Conceptor가 감정(Gemma-2-2B 0.68, Gemma-2-9B 0.72) > Addition(0.56, 0.61) > DiffMean(0.56, 0.56)으로 최대 +12포인트 우세.
- Qwen-2.5-3B에서 EVR(Explained Variance Ratio) 진단이 거의 무용(r≤0.30)한 반면, Conceptor quota는 Reddit Depression에서 r=0.96 달성, EVR 대비 평균 0.824 높음.
- Boolean AND-NOT 평가: abortion × LGBTQ 쌍에서 AND-NOT이 'Abortion only' 선택률을 19%→30%로 올리면서 'LGBTQ only'는 32%→20%로 낮추는 개념 선택적 격리 달성.
- 정치 성향 MCQ 평가: Conceptor가 'Left' 선택 확률을 0.64→0.80, 선택률 70%→84%로 높이면서 중립 카테고리를 8%→0%로 압축. DiffMean·Addition은 같은 설정에서 미미한 변화만 보임.
How to Apply
- 모델 출력의 감정·톤을 바꾸고 싶다면: 목표 개념의 양극 예시 문장 100쌍(긍정 50 + 부정 50)을 준비하고, 특정 레이어의 hidden state로 conceptor 행렬을 계산한 뒤 forward pass hook으로 끼우면 됨. Conceptor quota를 레이어별로 계산해서 quota가 높은 레이어를 개입 지점으로 고르면 별도 probe 학습 없이 최적 레이어 선택 가능.
- 두 개 개념을 동시에 제어하거나 한 개념은 유지하고 다른 개념은 억제하려면: 두 개념의 subspace overlap을 먼저 확인(≥0.4이면 AND 의미있음, 낮으면 NOT에 효과적), 그에 따라 C_A ∧ C_B 또는 C_A ∧ ¬C_B를 닫힌 형태로 계산해서 동일한 hook에 적용.
- 안전성이 중요한 서비스라면: Replace 모드(z' = β·C·z) 대신 Interpolation 모드(z' = (1-β)·z + β·C·z)를 쓰면 degenerate 출력 발생률이 38%→13%로 줄어듦. residual stream에 개입하는 게 attention output보다 설정 변화에 덜 민감해서 안정적.
Code Example
import torch
import numpy as np
def compute_conceptor(activations: torch.Tensor, aperture: float = 10.0) -> torch.Tensor:
"""
activations: (N, d) - 양극 개념 문장들의 hidden state (긍정+부정 모두 포함)
aperture: alpha 값, 클수록 더 많은 방향 포함 (보통 2~50)
returns: (d, d) conceptor 행렬
"""
N, d = activations.shape
# 상관 행렬 계산
R = (activations.T @ activations) / N # (d, d)
# C = R * (R + alpha^{-2} * I)^{-1}
I = torch.eye(d, device=activations.device)
C = R @ torch.linalg.inv(R + (1.0 / aperture**2) * I)
return C
def conceptor_quota(C: torch.Tensor) -> float:
"""레이어 선택 진단값. 높을수록 개념이 해당 레이어에 잘 인코딩됨."""
d = C.shape[0]
return (torch.trace(C) / d).item()
def conceptor_not(C: torch.Tensor) -> torch.Tensor:
"""NOT 연산: 해당 개념을 억제"""
return torch.eye(C.shape[0], device=C.device) - C
def conceptor_and(C_a: torch.Tensor, C_b: torch.Tensor, eps: float = 1e-6) -> torch.Tensor:
"""AND 연산: 두 개념의 교집합 subspace. overlap이 0.4+ 일 때 의미있음."""
d = C_a.shape[0]
I = torch.eye(d, device=C_a.device)
inv_a = torch.linalg.inv(C_a + eps * I)
inv_b = torch.linalg.inv(C_b + eps * I)
return torch.linalg.inv(inv_a + inv_b - I)
# 사용 예시: Gemma/Qwen 등 transformer 모델에 hook 등록
def make_steering_hook(C: torch.Tensor, beta: float = 1.0, mode: str = 'replace'):
"""
mode='replace': z' = beta * C @ z (강한 조종, 불안정 가능)
mode='interpolate': z' = (1-beta)*z + beta * C @ z (안전)
"""
def hook(module, input, output):
# output이 tuple인 경우 처리
hidden = output[0] if isinstance(output, tuple) else output
if mode == 'replace':
steered = beta * (C @ hidden.transpose(-1, -2)).transpose(-1, -2)
else:
steered = (1 - beta) * hidden + beta * (C @ hidden.transpose(-1, -2)).transpose(-1, -2)
if isinstance(output, tuple):
return (steered,) + output[1:]
return steered
return hook
# 레이어 선택: quota가 가장 높은 레이어 찾기
# layer_quotas = [conceptor_quota(C_per_layer[l]) for l in range(num_layers)]
# best_layer = np.argmax(layer_quotas)
Terminology
Related Papers
Shai-Hulud Themed Malware Found in the PyTorch Lightning AI Training Library
PyTorch Lightning packages 2.6.2 and 2.6.3 delivered credential-stealing malware via a supply chain attack.
Alignment whack-a-mole: Finetuning activates recall of copyrighted books in LLMs
Fine-tuning even safety-aligned LLMs can bypass safeguards and reproduce copyrighted text verbatim, revealing prompt filtering alone isn't enough to prevent copyright infringement.
Show HN: MacMind – A transformer neural network in HyperCard on a 1989 Macintosh
This is an educational project implementing a single-layer Transformer with 1,216 parameters in the scripting language HyperTalk (1987) and training it on a real Macintosh SE/30. It demonstrates that the core mathematics of modern LLMs works the same on hardware from 30 years ago.
MegaTrain: Full Precision Training of 100B+ Parameter LLMs on a Single GPU
Introducing MegaTrain, a system that leverages CPU memory as the primary storage and utilizes the GPU solely as a compute engine, enabling full-precision training of 120B parameter models with just a single H200 GPU.
Show HN: I built a tiny LLM to demystify how language models work
This educational project allows you to build a mini LLM with 8.7 million parameters, trained on a Guppy fish character, from scratch in just 5 minutes using a single Colab notebook, focusing on demystifying the black box nature of LLMs.
Original Abstract (Expand)
Activation-based steering provides control of LLM behavior at inference time, but the dominant paradigm reduces each concept to a single direction whose geometry is left largely unexamined. Rather than selecting a single steering direction, we use conceptors: soft projection matrices estimated from activations pooled across both poles of a bipolar concept, which preserve the concept's full multidimensional subspace. A geometric analysis shows the bipolar subspace strictly subsumes the single-vector baseline. We further show that the conceptor quota provides a parameter-free layer-selection diagnostic, predicting concept separability with Pearson correlations up to r=0.96 across three instruction-tuned models and three semantic dimensions. Beyond selection, conceptors admit a closed-form Boolean algebra (AND, OR, NOT): we evaluate conceptor compositionality on thematically related sub-concepts. Across a systematic five-axis design-space evaluation, conceptors match or outperform additive baselines at layers where concept subspaces are multi-dimensional while producing substantially fewer degenerate outputs. Conceptor steering is a geometrically principled, compositional, and practically safer alternative to single-direction steering from a limited number of contrastive pairs.