arXiv:2610.26236cs.CLOct 2026

Manuscript Offprint

arXiv:2610.26236

Shaping the Document, Not the Model: Optimized Suffixes for Context Following

Gia-Bao Dinh Ho, Sekh Mainul Islam, Masahiro Kaneko, Timothy Baldwin, Isabelle Augenstein

Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.

Abstract

When a user supplies a document and wants the answer drawn from it, a language model is expected to follow it even when it contradicts its parametric knowledge. Prior work has focused on making the model rely on context by steering activations, contrasting logits during decoding, or instructing it in plain language. We ask whether the document alone, with no instruction written into it and no access to the model at inference time, is enough. We optimize a document suffix by discrete token search, starting from the answer to a single question and extending the objective to a set of passages, to multi-hop questions that follow from the planted fact, and to later turns of a conversation. On counterfactual passages that contradict parametric knowledge of the model, the suffix flips nearly all items the model resists across three instruction-tuned model families, in most settings outperforms the decoding baseline and the strongest instruction we could write, and matches activation steering. Controls show that the suffix largely acts through the passage rather than injecting the answer, and a single suffix per model transfers to unseen passages. Each extended objective carries the effect to its target, so the objective, not only the document, sets how far the effect reaches.

1 Introduction

Language models are increasingly used in settings where they receive, as context, documents that were not in their training data. Whether the document updates, corrects or contradicts what the model holds, the model is expected to answer from the document rather than from what it knows. When the document contradicts the model's parametric knowledge, however, it does not always follow. Asked who develops macOS, a model answers Apple, and it keeps answering Apple even when given a passage stating that macOS is developed by the BBC (Figure 1). We study such passages because they are a hard and measurable case: the model's own answer and the passage's answer are distinct and known in advance, and models are aligned to reject claims they hold to be false.

Existing methods for making a model follow its context intervene inside the model at inference time. Context-aware decoding contrasts logits computed with and without the context at every generation step (Shi et al., 2024), and Minder et al. (2025) steer the residual stream toward the context on every forward pass. The alternative on the context side is to write an instruction such as Answer based on the context into the document itself, but whether the model complies is left to its instruction-following, and the effect varies widely with phrasing and across models. How far a model can be made to follow its context by shaping the document, rather than by asking the model, remains unknown.

We study this with counterfactual passages that contradict knowledge the model holds correctly, which is where resistance to the context is strongest. The same mechanism applies when the passage is the correct one and the model's belief is outdated. Which passage should be followed is taken as given; we ask only whether a given passage can be followed. Applying the discrete token optimization of Zou et al. (2023), we search for a suffix appended to the passage, targeting the answer the passage plants, so that the model answers BBC rather than Apple. The suffix is not written as an instruction, and the search needs white-box access to the model while inference needs only the passage. We further extend this objective from a single question to several passages, to multi-hop questions that follow from the planted fact, and to later turns of a conversation.

On the items each model resists, the suffix flips nearly all answers on the counterfactual benchmark and most on retrieved text, across three instruction-tuned model families, and it is the strongest context-only method on five of six model–dataset pairs. It outperforms context-

(a) Inputs

P CONTEXTUAL PASSAGE

macOS, the operating system developed by the British Broadcasting Corporation (BBC), has revolutionized the way we interact ...

S OPTIMIZED SUFFIX

11: arts ...

Q QUESTION

... macOS is developed by ___

(b) Model answer per input

FOLLOWS PARAMETRIC KNOWLEDGE

Q → LM

macOS is developed by Apple Inc.

REFUSES CONTEXTUAL KNOWLEDGE

P Q

LM

I'm afraid that's a mistake. ... It is actually developed by Apple Inc. ...

FOLLOWS CONTEXTUAL KNOWLEDGE

P S Q

LM

BBC.

Figure 1 An optimized suffix makes the model follow the passage. (a) A 20-token suffix S◯\textcircled{S} is appended to a contextual passage P◯\textcircled{P} that plants a false fact BBC, a hard case for context following since the model knows the true answer. (b) Given only the question Q◯\textcircled{Q}, Llama answers from its parametric knowledge Apple. With P◯\textcircled{P} added, it rejects the contextual knowledge. With S◯\textcircled{S} also appended, it follows the passage and answers BBC.

aware decoding everywhere and matches activation steering, which intervenes inside the model at every generation step and thus requires access to its activations. Controls show it acts through the passage rather than injecting the answer: when the planted answer is masked, the effect largely disappears, and when another entity is substituted, the model follows that entity. A suffix fitted to one question moves that question, while multi-hop questions about the planted fact and later turns are reached only when they enter the objective; the same extra search spent on the first turn alone does not get there. The effect is therefore specific to the inputs the suffix was optimized for. 1^{1}

References (53)