Repetition is a tool with a specific failure mode
Restating a constraint near the question works. The cost is small and the effect on adherence at long context is often large. The danger is not the tokens; it is that you now have two statements of the same rule in two places, maintained by different people at different times.
Six months later the system prompt says “answer in at most three sentences” and the trailing reminder says “be thorough”. The model resolves the contradiction however it likes, and the behaviour looks random because nobody has read both strings in the same sitting.
One source of truth, two renderings
The fix is structural rather than editorial. Keep the constraints as data, and render both copies from them.
CONSTRAINTS = {
"format": "Reply as JSON matching the Answer schema. No prose outside it.",
"grounding": "Use only the numbered passages. Cite each claim as [n].",
"refusal": "If the passages do not answer the question, return \"insufficient\".",
}
system = SYSTEM_TEMPLATE.format(**CONSTRAINTS) # full version, top
reminder = "\n".join(CONSTRAINTS[k] for k in REMIND_AT_END) # subset, bottomNow the two cannot disagree, and choosing what to repeat is a one-line configuration change you can run an experiment on.
What is worth repeating
Not everything. The reminder is paid on every request and it competes for the same attention it is trying to win.
Repeat:
- The output contract. The single most fragile instruction at long context, and the cheapest to verify, so also the easiest to measure.
- The grounding rule. “Only use the passages” degrades with distance in exactly the way you would expect, and its failure is a fabricated answer.
- The refusal condition. Because it fires rarely, it is the instruction the model has least recent evidence of.
Do not repeat: the role, the tone, the background, the examples, the policy list. These shape a whole answer rather than gating a specific behaviour, and they survive distance better.
The order inside the reminder
If you are repeating three lines directly before generation begins, the last one has the strongest position of anything in the entire request. Put the constraint that is violated most often there.
Which one that is, you know from your own failure log rather than from a guess. If 60% of your bad outputs are format violations, the format line goes last. This is a two-minute change that is worth the two minutes.
The sandwich has a limit
Stating something at the top and the bottom helps. Stating it four times through the context does not help proportionally, and past a point it hurts: the repeated block is text competing with your evidence, and a model reading the same rule five times in different phrasings can treat the variations as different rules.
Two placements is the sensible ceiling. If two are not enough, the problem is usually not repetition: it is that the instruction is ambiguous, or that it contradicts something else in the prompt, or that the task needs a schema-constrained decoder rather than a request.
Prefer a mechanism to a repetition
The honest hierarchy, strongest first:
- Make it structurally impossible. Constrained decoding or a tool schema for output format. The model cannot emit invalid JSON if the decoder will not sample it.
- Validate and retry. Parse the output, and on failure send it back with the specific error. Cheap, deterministic, and it turns a soft instruction into a hard guarantee.
- Repeat the instruction near the question. This lesson.
- Word the instruction more firmly. Weakest, and where most teams spend their time.
Repetition is worth doing because it is nearly free and it reduces how often the first two have to fire. It is not a substitute for either. A system whose format correctness depends on an instruction being remembered is a system that will produce a malformed answer during your busiest hour.
Measure adherence, not vibes
The experiment is cheap because the outcome is machine-checkable. Run your evaluation set with and without the reminder, and count schema validation failures, missing citations and refusals-that-should-have-happened.
A typical result at long context is a meaningful drop in format violations and no change in answer quality, which is exactly what you want from 40 tokens. If you see no change at all, your context is probably short enough that this whole lesson does not apply to you yet, and knowing that is worth the run.
Every lesson here is open. Your progress is recorded once you pass the Data, SQL and Getting to the Answer exam.
Check your understanding
A team repeats its full 900-token system prompt after the retrieved passages. Format violations fall slightly, but answers become inconsistent in tone and occasionally contradict the policy. What went wrong?
Pick the one you would defend. Your answer stays private.
Stuck on something?Ask Sayali, your AI tutor
