Click any words you think contain an error. Click again to unmark.
Two compounding bugs, alphabetical ordering throws away the relevance signal, and skipping per-chunk ids forces the model to confabulate citations from chunk text.
Picture handing a kid five flashcards to study for a quiz. Two mistakes here. First, you sorted the cards alphabetically by which book they came from, instead of putting the most useful card first or last where the kid will actually remember it. Second, you ripped the corner stickers off the cards, so when the kid says which card they used they have to describe what was written on it, and they will get the description wrong. Fix one: put the strongest card at the start, the second strongest at the end. Fix two: leave the stickers on so the kid can just say S1 or S2.
Detailed answer & concept explanation~4 min readEverything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example. Click to expand.
Everything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example. Click to expand.
Everything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example.
Everything important, quickly.
4 minutes: identify both errors, explain why alphabetical sort interacts badly with lost-in-the-middle, describe the stable-id assembly pattern, name a provider-native citation API.
Real products, models, and research that use this idea.
- Anthropic's 2026 RAG cookbook for Claude Opus 4.7 assembles evidence blocks with [S1]-style tags and orders by Cohere Rerank 3.5 score.
- OpenAI's Responses API for GPT-5 ships first-class document-id citations, the SDK builds the assembly with stable ids by default.
- Cohere Command R+ takes a `documents` parameter so the API itself enforces stable id to source binding.
- LangGraph's RAG templates use a relevance-sorted assembler with explicit per-chunk ids and warn against title sorting.
- Pinecone's hosted RAG starter explicitly head-loads the top-scoring chunk and tail-loads the second-best to exploit primacy and recency.
What an interviewer would ask next. Try answering before peeking at the approach.
QHow would you decide between head-loading the top chunk versus head and tail loading?
QWhat does a render-time validator do with citations the model emits?
Don't say thisRed flags and common mistakes that signal junior thinking. Click to expand.
Red flags and common mistakes that signal junior thinking. Click to expand.
Sorting evidence blocks by document title rather than by relevance score. Useful chunks land in lost-in-the-middle positions and the model misses them.
The night-before-the-interview bullets. Scan these on the way to the call.
Primary sources. Skim if you want the original framing.
Same topic, related formats. Practice these next.