Put critical instructions in the first 20% of system prompts — transformers attend to early tokens more
Position your system prompt's most important instructions in the first 20% of tokens, because transformer attention mechanisms allocate disproportionate processing to early sequence positions through positional encoding and causal masking.
Why This Is a Rule
Transformer attention is not uniform across sequence positions. Positional encoding and causal masking create a primacy effect: early tokens in the sequence receive more cumulative attention from subsequent tokens than later ones. In practice, instructions placed at the beginning of a system prompt are more reliably followed than identical instructions placed at the end.
This is analogous to the human primacy effect in memory — first items in a list are recalled better than middle items — but the mechanism is architectural rather than cognitive: the attention mechanism literally processes early tokens with more integration time because every subsequent token attends to them.
The 20% threshold is the practical heuristic: the first fifth of your system prompt's token budget should contain the most critical behavioral instructions, constraints, and identity definitions. Secondary instructions, examples, and contextual information can follow. If your most important instruction is buried at token 800 of a 1000-token prompt, it competes for attention with everything that came before it.
When This Fires
- Writing or designing system prompts for LLM-based tools
- When AI assistants don't follow instructions that are present in the system prompt
- Optimizing prompt performance for specific behaviors
- During any prompt engineering where instruction priority matters
Common Failure Mode
Writing system prompts like documents — background context first, instructions at the end: "You are an assistant that... [200 tokens of context]. When responding, please... [critical instruction buried at position 300]." The critical instruction competes with 200 tokens of context for attention. Invert: critical instructions first, then context.
The Protocol
When writing system prompts: (1) Identify the 3-5 most critical instructions — the behaviors that must be followed above all else. (2) Place them in the first 20% of the prompt's token budget. (3) Follow with secondary instructions, context, and examples. (4) If a critical instruction isn't being followed despite being present → check its position. Moving it to the first 20% often resolves the compliance issue without changing the wording.