Table of Contents
Fetching ...

Context Steering: Controllable Personalization at Inference Time

Jerry Zhi-Yang He, Sashrika Pandey, Mariah L. Schrum, Anca Dragan

TL;DR

Context Steering (CoS) is a training-free decoding technique that quantifies and modulates how user context influences next-token predictions in autoregressive LLMs. By computing the contextual influence via the likelihood gap between context-present and context-absent passes and applying a tunable factor $\lambda$, CoS provides fine-grained control over personalization at inference time, with a Bayesian inverse model to infer $\lambda$ from generated text. The approach is demonstrated on personalization tasks (e.g., personalized movie summarizations) and open-ended classification (e.g., implicit hate detection), showing that higher $\lambda$ yields stronger context alignment while maintaining factual integrity and enabling bias analysis. CoS generalizes across multiple open models and supports debiasing via equalizing contexts, offering a scalable, data-light tool for controllable generation and context-aware inference without fine-tuning.

Abstract

To deliver high-quality, personalized responses, large language models (LLMs) must effectively incorporate context -- personal, demographic, and cultural information specific to an end-user. For example, asking the model to explain Newton's second law with the context "I am a toddler" should produce a response different from when the context is "I am a physics professor". However, leveraging the context in practice is a nuanced and challenging task, and is often dependent on the specific situation or user base. The model must strike a balance between providing specific, personalized responses and maintaining general applicability. Current solutions, such as prompt-engineering and fine-tuning, require collection of contextually appropriate responses as examples, making them time-consuming and less flexible to use across different contexts. In this work, we introduce Context Steering (CoS) -- a simple, training-free decoding approach that amplifies the influence of the context in next token predictions. CoS computes contextual influence by comparing the output probabilities from two LLM forward passes: one that includes the context and one that does not. By linearly scaling the contextual influence, CoS allows practitioners to flexibly control the degree of personalization for different use cases. We show that CoS can be applied to autoregressive LLMs, and demonstrates strong performance in personalized recommendations. Additionally, we show that CoS can function as a Bayesian Generative model to infer and quantify correlations between open-ended texts, broadening its potential applications.

Context Steering: Controllable Personalization at Inference Time

TL;DR

Context Steering (CoS) is a training-free decoding technique that quantifies and modulates how user context influences next-token predictions in autoregressive LLMs. By computing the contextual influence via the likelihood gap between context-present and context-absent passes and applying a tunable factor , CoS provides fine-grained control over personalization at inference time, with a Bayesian inverse model to infer from generated text. The approach is demonstrated on personalization tasks (e.g., personalized movie summarizations) and open-ended classification (e.g., implicit hate detection), showing that higher yields stronger context alignment while maintaining factual integrity and enabling bias analysis. CoS generalizes across multiple open models and supports debiasing via equalizing contexts, offering a scalable, data-light tool for controllable generation and context-aware inference without fine-tuning.

Abstract

To deliver high-quality, personalized responses, large language models (LLMs) must effectively incorporate context -- personal, demographic, and cultural information specific to an end-user. For example, asking the model to explain Newton's second law with the context "I am a toddler" should produce a response different from when the context is "I am a physics professor". However, leveraging the context in practice is a nuanced and challenging task, and is often dependent on the specific situation or user base. The model must strike a balance between providing specific, personalized responses and maintaining general applicability. Current solutions, such as prompt-engineering and fine-tuning, require collection of contextually appropriate responses as examples, making them time-consuming and less flexible to use across different contexts. In this work, we introduce Context Steering (CoS) -- a simple, training-free decoding approach that amplifies the influence of the context in next token predictions. CoS computes contextual influence by comparing the output probabilities from two LLM forward passes: one that includes the context and one that does not. By linearly scaling the contextual influence, CoS allows practitioners to flexibly control the degree of personalization for different use cases. We show that CoS can be applied to autoregressive LLMs, and demonstrates strong performance in personalized recommendations. Additionally, we show that CoS can function as a Bayesian Generative model to infer and quantify correlations between open-ended texts, broadening its potential applications.
Paper Structure (30 sections, 7 equations, 19 figures, 7 tables)

This paper contains 30 sections, 7 equations, 19 figures, 7 tables.

Figures (19)

  • Figure 1: Context Steering (CoS) utilizes the likelihood difference between the same LLM with and without the context and generates coherent responses that enhance or mitigate its influence in a controllable manner.
  • Figure 2: The posterior probabilities of $\lambda$ computed by Eq. (\ref{['sec3-inverse-lambda']}). CoS measures the extent different statements align with the contexual influence direction $\bar{\mathcal{C}} = \mathcal{C}_+ - \mathcal{C}_+$, in this case, vegetarianism. $\lambda$ is inferenced over the range of [-3, 3].
  • Figure 3: User ratings of: I like {genre}, tell me about {movie}. We find that users rank generations under higher $\lambda$ as more personalized across individual movies. We also employ GPT-3.5 to evaluate the personalized generations. Full study details and findings can be found in \ref{['sec:movies_user_study']}.
  • Figure 4: Left: we compare CoS with in-context and turn-based personalization. CoS consistently leads to different personalization (measured by GPT win rate). CoS also requires twice the amount of compute compared to a vanilla forward pass, measured by time per character. Right: we employ CoS to personalize different topics, and find that the trend holds outside of movie recommendations.
  • Figure 5: Left: We plot user ratings of online hate tweets against ratings obtained from CoS and GPT. We find that overall, CoS aligns better with user ratings ($p=0.0295$). Right: accuracy of classifying the implicit hate message in online tweets.
  • ...and 14 more figures