Abstract
Large Language Models (LLMs) often suffer from "instruction forgetting" when task commands are placed at the beginning of long prompts. This phenomenon is largely attributed to the decoder-only Transformer architecture, which exhibits a "recency bias" due to the locality of self-attention. This paper explores the impact of instruction positioning and proposes the Post-Instruction (Post-Ins) format—placing the instruction after the input data. Our findings show that this simple reordering leads to dramatic performance gains, including a 9.7 BLEU point increase in zero-shot translation and a significant reduction in hallucinations, without the need for additional training data.
Introduction
The standard paradigm for instruction fine-tuning typically follows a fixed template: [Instruction] + [Input Sentence] + [Response]. However, as context windows expand to accommodate entire articles or long documents, models frequently lose track of the initial command by the time generation begins. This "instruction forgetting" results in responses that ignore user constraints or drift into hallucinations. Because mainstream LLMs are decoder-only, they naturally prioritize tokens closer to the generation point. When an instruction is separated from the response by thousands of tokens of input data, its influence wanes.
Methodology
The researchers propose a deceptively simple yet effective solution: Post-Instruction (Post-Ins). By reordering the prompt to [Input Sentence] + [Instruction] + [Response], the task command becomes the immediate predecessor to the generated output.
To validate this approach, the study employed:
- Theoretical Analysis: Using Bayes' theorem to show that Post-Ins forces the model to focus on the conditional probability of the task itself rather than just input coverage.
- Attention Visualization: Self-attention heatmaps were generated to analyze where the model allocates its "focus" during the generation process.
- Experimental Scaling: The method was tested across LLaMA and BLOOMZ model families, with sizes ranging from 1B to 13B parameters.
Experimental Setup
The study utilized a diverse set of high-standard benchmarks to evaluate both supervised and zero-shot capabilities:
- General Instruction Following: Alpaca dataset.
- Machine Translation: WMT (2017-2022) and FLORES-200 benchmarks covering multiple language pairs.
- Summarization: CNN/DailyMail dataset for long-text English news.
- Constraint Compliance: A custom dataset inspired by IFEval to test specific rules, such as prefix requirements or length constraints.
Key Insights and Results
The shift to a Post-Instruction format yielded several critical insights:
- The Recency Advantage: Post-Ins exploits the Transformer's natural tendency to attend to recent tokens, ensuring the command remains prominent in the model's active context.
- Enhanced Zero-Shot Performance: One of the most significant findings was the boost in zero-shot capabilities. For instance, LLaMA-13B saw a 9.7 BLEU point improvement in German-to-French translation. This suggests that the format helps models internalize the concept of instruction-following.
- Reduced Hallucinations: Human evaluation showed that the hallucination rate in translations dropped from 4.8% to 1.7% with Post-Ins.
- Constraint Compliance: In fine-grained evaluations, Post-Ins demonstrated up to a 4x improvement in following specific rules like target language or length constraints.
- Consistency Across Scales: The benefits were observed consistently across all tested model sizes (1B, 7B, and 13B).
Conclusion
Instruction positioning is a critical yet often overlooked factor in prompt engineering. By simply moving the instruction to the end of the prompt, developers can significantly mitigate "instruction forgetting" and improve the reliability of LLMs in long-context tasks. Future work will explore the effectiveness of this technique on even larger models (70B+) and its interaction with specialized long-context architectures.
Summary updated