Long-context tips

How to structure prompts so Meridian reads every word — not just the first and last paragraph.

Critical — read this first

Large language models suffer from the lost-in-the-middle problem: they pay most attention to the beginning and end of a prompt. Information buried in the middle is frequently ignored or hallucinated over. Every technique on this page exists to defeat that failure mode.

1

Put your most important instruction at the very top

The first 200 tokens get disproportionate weight. Open with a single-sentence directive — “You must output valid JSON only” — before any context, examples, or pleasantries. Do not bury the constraint after three paragraphs of background.

2

Repeat the constraint at the very bottom

Close the prompt by restating the critical rule verbatim. Models anchor on recency; a final “Remember: output JSON only” acts as a second anchor that catches what the middle may have diluted.

3

Break long documents into labeled sections

Use Markdown headings, numbered lists, or XML-style tags (<context>, <rules>). Section boundaries act as retrieval anchors. A flat wall of text has no landmarks; the model skims it.

4

Rank chunks by importance, not chronology

If you are pasting multiple documents, put the most critical one first and second-most-critical last. Chronological or “natural” ordering buries the signal in the middle. Treat your prompt like an inverted-pyramid news article.

5

Use inline emphasis for non-negotiable terms

Bold, ALL-CAPS, or backtick-wrapped tokens draw attention inside dense paragraphs. A single MUST inside a sentence is more likely to be respected than a polite “please try to.”

6

Keep the total under 70% of the context window

Performance degrades well before the advertised limit. If the model supports 128k tokens, aim for ~90k max. The remaining headroom gives the attention mechanism room to breathe and reduces mid-context dropout.

7

Test with a canary in the middle

Insert a unique, verifiable instruction halfway through your prompt — “Mention the word ‘blueberry’ in your response.” If the model misses it, your middle content is being dropped. Restructure and test again.

Critical — read this last

The single highest-leverage change you can make: put your most important instruction at the top AND repeat it verbatim at the bottom. Everything else on this page is optimization. That one habit solves 80% of lost-in-the-middle failures.