Lost in the middle: where a long prompt hides its own instructions
A team put the key instruction in the middle of a very long prompt, and the model kept ignoring it. Models attend most reliably to the beginning and the end.
Lost in the middle: where a long prompt hides its own instructions
A technical lead at a customer-service SaaS company had an instruction the model would not follow. It was clear. It was correct. It was right there in the prompt. And the model ignored it often enough that the team assumed the model simply could not do what they were asking.
The model could do it. It just was not reading the part of the prompt where they had put it.
The instruction was buried
Their prompt was long. The critical instruction, the one the whole feature depended on, sat in the middle of it, surrounded by paragraphs of context, examples, and other rules. It had ended up there for no particular reason. Someone had added it at the point in the prompt they happened to be editing, and it stayed where it landed.
We moved it. Same instruction, same words, now placed near the end of the prompt, right before the model’s turn to respond. Compliance jumped. The team had not changed what they asked. They had changed where they asked it, and that was the whole difference.
The instruction had been lost in the middle, in the most literal sense. It was present, and it was in the one region of a long prompt the model attends to least.
Models read the edges best
Language models do not weigh every part of a long context equally. They attend most reliably to what is at the beginning and what is at the end. Content in the middle of a long prompt gets less attention, and an instruction placed there is more likely to be underweighted or missed. This is a well-observed behavior, and it has a direct consequence for how you build prompts. Position is not neutral. Where you put an instruction changes how likely the model is to follow it.
The trap is that a prompt reads fine to a human. You scan it, the instruction is clearly there, so you conclude the model must be seeing it too. But the model is not reading the way you are. It is attending unevenly, and the middle of a long prompt is exactly where important instructions go to be quietly ignored.
Placement is a lever you can use on purpose.
- Put critical instructions at the edges. Lead with what matters most, and restate the key requirement near the end, just before the model responds.
- Do not bury the ask in the middle. If an instruction is essential, it should not sit in the low-attention stretch of a long prompt.
- Repeat the essential rule. For a must-follow instruction, stating it at both the start and the end is cheap insurance.
- Shorten the prompt. A shorter prompt has less middle to get lost in, so trimming often helps compliance on its own.
- Test placement as well as wording. When an instruction is ignored, try moving it before assuming the model cannot comply.
The point is to stop treating a prompt as a flat list where position does not matter. It matters, and the edges are where your important instructions belong.
How we approach it at Density Labs
In the AI Opportunity Assessment, our fixed two-week engagement priced at $2,500, an instruction the model “will not follow” is often an instruction the model never really weighed, because it was buried in the middle of a long prompt. Before we conclude a model cannot do something, we check where the instruction sits and try it at the edges. A surprising number of stubborn failures turn out to be placement, not capability.
A long prompt has a low-attention middle, and that is exactly where teams tend to hide the instruction that matters most. Move it to the edge.
Where you put the instruction is part of the instruction.