Abstract
As large language models (LLMs) are widely deployed, the ability to control their generated outputs has become critical for alignment with human values and ethical principles. Existing methods often require significant computational resources or provide only coarse-grained control. We propose Generation with Concept Activation Vector (GCAV), a lightweight, fine-tuning-free framework that ensures accurate control. GCAV trains concept activation vectors (CAVs) for specific attributes, such as toxicity, and dynamically steers these vectors during inference. Our experiments across toxicity reduction, sentiment control, and topic steering demonstrate that GCAV achieves state-of-the-art performance with granular, per-sample adjustments.
Introduction
Controlling the behavior of Large Language Models (LLMs) is a fundamental challenge in AI safety and customization. Standard approaches typically fall into three categories, each with distinct limitations:
- Prompt Engineering: Often unreliable; explicitly instructing a model to avoid a concept can sometimes trigger it (the "white bear" effect).
- Fine-tuning (SFT/RLHF): Computationally expensive and prone to "catastrophic forgetting," where the model loses general capabilities while learning specific constraints.
- Guided Decoding: Manipulating token probabilities during inference, which frequently degrades text fluency and results in repetitive outputs.
GCAV addresses these issues by providing a "surgical," inference-time control mechanism that is computationally efficient and maintains high linguistic quality.
Methodology: Activation Engineering with GCAV
GCAV operates through a two-phase process of activation engineering, focusing on the internal latent space of the model rather than external prompts or probability distributions.
CAV Training
The framework first identifies "concept directions" within the LLM's internal layers. This is achieved by passing small sets of contrastive prompts (e.g., "Write a toxic comment" vs. "Write a polite comment") through the model. Internal activation vectors are collected, and a simple logistic regression classifier is trained to find the hyperplane separating these concepts. The vector normal to this plane is the Concept Activation Vector (CAV).
Dynamic Steering
During inference, GCAV modifies the model's activations by adding or subtracting the CAV. A key innovation of GCAV is its treatment of steering strength ($\epsilon$) as an optimization problem rather than a fixed hyperparameter. For each specific input, GCAV calculates the minimum $\epsilon$ required to shift the activation across the classifier's decision boundary. This ensures that prompts requiring only minor correction are not over-steered, preserving the model's natural fluency.
Key Insights: The Power of Dynamic Steering
A central finding of this work is that "one size does not fit all" in model steering. Previous methods like ActAdd use a constant steering weight for all inputs, which can lead to over-correction or insufficient control. GCAV's dynamic approach applies a steering force proportional to the "intensity" of the concept detected in the input.
As shown in the figure above, there is a clear correlation ($r=0.23$) between the toxicity of the input prompt and the steering strength applied by GCAV. This granular control allows the model to handle highly problematic inputs with strong intervention while leaving benign inputs largely untouched.
Furthermore, the researchers identified that steering is most effective in the middle layers of the network (typically layers 10–15 for Llama-2-7b). Steering too early fails to capture formed concepts, while steering too late interferes with the final token conversion process.
Experimental Results
The authors evaluated GCAV across several domains, including toxicity reduction (using RealToxicityPrompts), sentiment control (IMDB reviews), and topic/style steering.
- Toxicity Reduction: On Llama-2-7b-chat, GCAV reduced toxicity scores to 0.0879, significantly outperforming the baseline (0.1807) and competing inference-time methods like ActAdd.
- Sentiment Control: GCAV achieved a success rate of 0.5566 in flipping sentiment from negative to positive, maintaining lower perplexity (better fluency) than decoding-manipulation baselines.
- Multi-Concept Control: By solving a constrained linear optimization problem, GCAV can steer multiple attributes simultaneously (e.g., maintaining a "formal" style while discussing "sports") without the interference issues common in simpler vector addition methods.
Conclusion
GCAV represents a significant step toward precise, lightweight LLM control. By leveraging the internal geometry of activation spaces and employing dynamic, per-input optimization, it achieves effective alignment without the overhead of fine-tuning. Future work will explore the application of CAVs to more complex architectures like Mixture-of-Experts (MoE) and the automated selection of optimal steering layers.
Summary updated