LiSeCo: Linear Semantic Control for Language Generation
cs.CL, cs.SY, eess.SY
Submitted: 2024-05-24
Updated: 2026-09-23
Comments: TMLR 2026 camera ready; earlier version in NeurIPS MINT Workshop 2024
Code: https://github.com/sahil280114/codealpaca
License: http://creativecommons.org/licenses/by/4.0/
The gist: The prevalence of Large Language Models (LLMs) in critical applications highlights the need for controlled language generation methods that are both computationally efficient and enjoy performance
Terminology
Abstract
The prevalence of Large Language Models (LLMs) in critical applications highlights the need for controlled language generation methods that are both computationally efficient and enjoy performance guarantees. To address this need, we use a common model of concept semantics as linearly represented in an LLM's latent space. In particular, we take the view that natural language generation traces a trajectory in this continuous semantic space, realized by the language model's hidden activations. This view permits a control-theoretic treatment of text generation in latent space, in which we propose Linear Semantic Control (LiSeCo), a lightweight, gradient-free intervention that dynamically steers trajectories away from regions corresponding to undesired meanings. In particular, we propose to directly intervene, in an online fashion, the activations of the token that is being generated in embedding space. Crucially, LiSeCo does not simply steer activations towards a desirable region. Instead, it relies on classical techniques from control theory to precisely control activations in a context-dependent way, and guarantees that they are brought into a specific pre-defined region of embedding space that corresponds to allowed semantics. The intervention is computed in closed form according to an optimal controller formulation, minimally impacting generation time. This control of the activations in embedding space allows for fine-grained steering of attributes of the generated sequence. We demonstrate that our approach is effective on different tasks -- toxicity, sentiment, and language (English/Spanish) steering -- while maintaining text quality.
Sources
- Controllable Text Generation in the Instruction-Tuning Era
- Qwen Technical Report
- What's the Magic Word? A Control Theory of LLM Prompting
- Inspecting and Editing Knowledge Representations in Language Models
- Bridging Language and Items for Retrieval and Recommendation: Benchmarking LLMs as Semantic Encoders
- A Unified Understanding and Evaluation of Steering Methods
- Style Vectors for Steering Generative Large Language Model
- LLMs Are Biased Towards Output Formats! Systematically Evaluating and Mitigating Output Format Bias of LLMs
- NeuroLogic A*esque Decoding: Constrained Text Generation with Lookahead Heuristics
- Prompt Engineering Through the Lens of Optimal Control
- Controlling Language and Diffusion Models by Transporting Activations
- Taming AI Bots: Controllability of Neural States in Large Language Models
- Gemma 2: Improving Open Language Models at a Practical Size
- Steering Language Models With Activation Engineering
- Large Language Models for Social Networks: Applications, Challenges, and Solutions
Related papers
- Exploring Solution Divergence and Its Effect on Large Language Model Problem Solving
- Ishigaki-IDS-Bench: A Benchmark for Generating Information Delivery Specification from BIM Information Requirements
- Subliminal Steering: Stronger Encoding of Hidden Signals
- MedStruct-S: A Benchmark for Key Discovery, Key-Conditioned QA and Semi-Structured Extraction from OCR Clinical Reports
- The End of Transformers? On Challenging Attention and the Rise of Sub-Quadratic Architectures
- Untangling the Mechanisms of Misleading Context in Medical Question Answering