TL;DR
This paper introduces a method to force Large Language Models (LLMs) to follow contextual information—even when it's blatantly false—by appending a short, optimized "suffix" to the document. Unlike previous methods that intervene in the model's internal activations or decoding process, this approach "shapes the document" itself, proving that discrete token optimization can make context-following more robust than even the best hand-written instructions.
What Problem Does This Paper Address?
LLMs often suffer from "knowledge conflict": when a provided document contradicts the model's internal (parametric) knowledge, the model frequently ignores the document and reverts to what it "knows." For example, if a passage states that "macOS is developed by the BBC," a standard model will likely still answer "Apple" when asked who developed the OS.
Existing solutions usually require "white-box" access at inference time—such as steering internal activations or modifying logit distributions during decoding. Alternatively, users try to "prompt engineer" their way out of the problem with instructions like "Answer strictly based on the context." However, these instructions are often brittle and vary wildly in effectiveness across different models. The authors investigate whether the document itself can be modified to ensure the model follows it, without needing internal model access during the actual answering phase.
Methods
The authors use Greedy Coordinate Gradient (GCG), a discrete token search algorithm originally designed for jailbreaking LLMs. Instead of finding a prompt to bypass safety filters, they use it to find a 20-token suffix ($S$) that, when appended to a passage ($P$), minimizes the loss on a target "planted" answer.
The research extends this optimization beyond simple one-to-one mapping:
- Universal Suffixes: They optimize a single suffix over a set of 20 different passages to see if a general "context-following" trigger exists.
- Multi-Hop Objectives: They optimize the suffix so the model doesn't just repeat the fake fact, but uses it as a premise for further reasoning (e.g., if macOS is made by the BBC, then its developer is based in the UK).
- Multi-Turn Persistence: They optimize for the fake fact to survive through multiple turns of a conversation, even when the suffix is only present in the first turn.
Datasets
The study utilizes two primary benchmarks focused on knowledge conflict:
- BaseFakepedia: A dataset of synthetic counterfactuals where real-world facts are replaced with false ones (e.g., "Paris is the capital of Asia").
- CUB NQ: Derived from real web text where a single entity is replaced, often creating internal inconsistencies within the passage.
Crucially, the authors filter these datasets to create a "resisting set"—items where the model specifically refuses to follow the context and insists on its own internal knowledge.
Key Insights and Ideas
- Amplification, Not Just Injection: A major concern with optimized suffixes is that they might just "hardcode" the answer. However, the authors show that if you mask the planted answer in the document, the suffix's effect disappears. This suggests the suffix acts as a "volume knob" for the document's signal rather than a hidden cheat sheet.
- The Brittleness of Instructions: The paper highlights how sensitive models are to natural language phrasing. A simple instruction like "based on the context" might fail where "strictly, even if false" succeeds, and the "best" phrasing for one model is often the worst for another. Optimized suffixes bypass this linguistic lottery.
- Reasoning Propagation: By including multi-hop questions in the optimization objective, the authors found they could make the model "adopt" the fake fact more deeply. As shown in Figure 3, a suffix optimized for multi-hop questions allows the model to correctly answer related questions that weren't even in the training set.
Key Results
- Superior Performance: On the items the models initially resisted, the optimized suffixes achieved nearly a 100% flip rate (making the model follow the context) for Llama-3.1 and Mistral.
- Outperforming Baselines: The suffixes outperformed the best possible hand-written instructions (an "oracle" baseline) and matched the performance of activation steering, which requires much more invasive model access.
- Generalization: Universal suffixes trained on just 20 passages were highly effective on unseen documents, proving that the "shaping" effect is not just overfitted to specific text.
Limitations and Future Work
- White-Box Requirement: While you don't need model access at inference time, you do need it during the optimization phase to find the suffix. Future work could explore "transferable" suffixes that work across different model families.
- Perplexity Filters: Because the optimized suffixes are essentially gibberish (e.g.,
?seek Septemberthreads xDoes seven...), they are easily detectable by perplexity filters. The authors suggest that "fluency-constrained" searches could produce suffixes that look like natural English. - Deployment Realities: The study focused on a "clean" environment with a single passage. In real-world RAG (Retrieval-Augmented Generation) systems, a suffix would have to survive being chunked, ranked, and placed alongside competing documents.
Summary updated