Abstract
Aligning language models (LMs) with user intent is becoming increasingly relevant to enhance user experience. This calls for designing methods that can allow users to control the properties of the language that LMs generate, for example, controlling the length of the generation or the complexity of the language that gets chosen. Most existing work attempts to integrate users' control by conditioning LM generations on natural language prompts or discrete control signals, which are often brittle and hard to scale. In this work, we are interested in continuous control signals, ones that exist along a spectrum that can't easily be captured in a natural language prompt or via existing techniques in conditional generation. Through a case study in controlling the precise response length of generations, we demonstrate how an LM can be finetuned to expect a control vector that is interpolated between a "low" and a "high" token embedding. Our method more reliably exerts response-length control than in-context learning methods or fine-tuning methods that represent the control signal as a discrete signal.
Introduction
While Large Language Models (LLMs) demonstrate remarkable instruction-following capabilities, they frequently struggle with precise numerical constraints. A common user frustration involves requesting a specific output length (e.g., "exactly 50 words") only to receive a response that significantly deviates from the target.
Currently, two primary methods exist for steering model outputs: natural language prompting and discrete control tokens. Natural language prompts are notoriously "brittle," where minor phrasing adjustments lead to inconsistent results. Discrete control tokens (e.g., <LENGTH_50>) suffer from scaling issues; it is impractical to create unique tokens for every possible value, and models do not inherently understand the ordinal relationship between discrete categories. This paper introduces Control through Interpolated Embeddings (CIE) to address this "numerical illiteracy" by representing control signals as a continuous spectrum.
Methodology: Control through Interpolated Embeddings (CIE)
The core innovation of CIE is the move from discrete categories to a geometric representation of control. Instead of expanding the vocabulary with thousands of specific tokens, the researchers introduce two trainable embedding vectors: $e_{lower}$ (representing the minimum value) and $e_{upper}$ (representing the maximum value).
The Interpolation Mechanism
To request a specific value $c$, the system calculates a linear interpolation between these two anchor vectors. This creates a single "control embedding" that represents the desired intensity of the attribute. This vector is then appended to the user's instruction embeddings during inference.
Training and Datasets
The model is fine-tuned to map the position of the embedding on the spectrum to the actual property of the generated text. The researchers utilized three primary datasets for their case study on response length:
- VERBOSITYCTRL: A curated dataset of conversational and NLP tasks.
- VERBOSITYCTRL_range: An augmented version where instructions are paired with 10 different target word counts (20 to 200).
- Alpaca-LI: An external dataset used to evaluate zero-shot generalization to out-of-distribution prompts.
Key Results and Insights
The researchers evaluated performance using the Conditioning Precision Ratio (CPR), which measures the frequency with which a model hits the exact requested word count.
Precision and Scaling
CIE demonstrated significant improvements in precision across multiple model architectures. For instance, on the Gemma-7B model, the exact-match CPR increased from 0.80% (using standard prompting) to 8.90% with CIE. When allowing for a 5% margin of error ([email protected]), Llama-3-8B showed a 23.10 percentage point improvement over the prompting baseline.
Comparison with Discrete Methods
CIE consistently outperformed RULER, a state-of-the-art discrete-token control method. The continuous nature of CIE allows the model to capture the geometric relationship between values, enabling it to generalize to specific lengths it was never explicitly trained on through zero-shot interpolation.
Quality Preservation
A critical concern when imposing strict constraints is the potential degradation of text quality. Using GPT-4 as a judge, the authors found that win-rates remained high, confirming that CIE exerts control without sacrificing the model's general conversational ability or instruction-following quality.
Conclusion and Future Work
CIE offers a robust alternative to brittle prompting for attributes that exist on a spectrum. By treating control as a persistent bias in the embedding space, the model maintains a consistent "sense" of the constraint throughout the generation process.
While this study focused on response length, the authors suggest that CIE could be extended to more subjective attributes like sentiment, politeness, or reading complexity. Future research will explore the simultaneous use of multiple CIE vectors to control several attributes (e.g., length and tone) concurrently.
Summary updated