Input-dependent edits improve language model behavior when answers vary

When Should an LLM Steering Edit Depend on the Input?

Artificial Intelligence

Summary

This paper looks at how to change or steer large language models (LLMs) during their processing to fix or adjust outputs. The authors find that edits depending on the input work best when the correct change varies within a category of answers, like different ways to rewrite a sentence part. They show that picking changes based on similar examples in the model’s memory improves results, especially for small word-level edits early in processing. When the answer is already fixed by the category alone, simpler edits work just as well.

What this means in practice

  • For language model developers: Improve targeted output corrections by applying input-dependent activation edits based on nearest neighbors during model inference.
  • For natural language processing engineers: Implement fine-grained control in text generation systems by choosing edit strategies appropriate for word-level or clause-level changes in different network layers.

Authors

Rachael Harkness, Konrad Rawlik

Abstract

An activation steering edit should depend on the input exactly when the destination varies \emph{inside} the class a query requests, and that is measurable before any rule is fitted or applied. Contrastive Activation Addition (CAA) adds one fixed direction to every input, the difference of the class means. Conditioning it on the requested class accounts for the between-class variation in the required displacement and leaves the within-class variation untouched, which no rule that reads only the source state can express. We study the impact of increasing input-dependence in the steering edit, moving from a difference of means to a destination retrieved per query --- the mean of the $k$ stored states nearest the query, inside the requested class --- in which the two baselines are endpoints: at $k$ equal to the class size the retrieved rule \emph{is} the class-conditional difference of means. We measure input-dependent steering on six substitution corpora that vary in whether the edit changes a word or a clause, and on an external benchmark, and find that input-dependent steering outperforms fixed-direction steering when the destination varies within the class. Retrieval wins at every layer of every substitution corpus in two models, and the level of input-dependence needed governs how to apply it: word-level edits are best made in the first tenth of the network from a few neighbours, clause-level edits at any depth from the class mean. Where the class already determines the answer the class mean suffices and retrieval only matches it, though a fixed direction still fails there. Four quantities computed from the states alone identify the regime in which the edit should be applied.