Skip to content

04. Retrieval-Augmented Generation ​

Augmentation·Chapter 04

Chunking, recall, reranking and citations

8 posts

Where this chapter fits: 90% of RAG success lives in retrieval, not generation. This chapter takes the chain apart ring by ring — chunking, indexing, recall, reranking, assembly, evaluation — and gives a verifiable criterion for each, avoiding blind “swap the model when results are bad” trial and error.

Questions this chapter answers ​

  • How should documents be split, and what goes wrong when splitting is off?
  • When answers are inaccurate, did recall fail to find the content, or did the reranker pick the wrong piece?
  • How much context should retrieval consume, and how do you trim when it overflows?

Article index ​

Hands-on5 min read2026-11-29

Edit one paragraph and re-embed everything? The chunk id decides what incremental updates cost

Insert one paragraph and four chunk-id schemes re-embed 100%, 100%, about 44%, or 0% of the old chunks. Sequence ids do not fail when content changes — they fail when length changes, which is what your update trigger should key on.

Hands-on5 min read2026-11-29

Split a multi-hop question into sub-queries: both-hop recall goes from 5/10 to 9/10, but rewriting one hop changes nothing

When one question needs two separate pieces of evidence, a single full-sentence query gets both in only 5 of 10 cases; splitting into two hops gets 9. Rewrite only one hop and it falls to 2/10 and 5/10. The win is not rewriting itself but whether the rewrite covers every hop and the budget is split per hop.

Hands-on4 min read2026-11-29

A 20-question eval cannot see a 10-point gap: the three RAG metrics do not share a denominator

Context recall, faithfulness and answer correctness get reported as three numbers in one table, but their denominators are reference claims, answer claims and questions. On 20 questions, an 80% correctness score has a 95% interval 33.5 points wide, and separating 80% from 90% needs about 197 questions per group.

Hands-on3 min read2026-11-28

Wiring BM25 to Chinese text with split(): four tokenizer variants, 2/12 versus 10/12 recall

89 passages, 12 hand-written queries, BM25 at Lucene defaults (k1=1.2, b=0.75). With whitespace tokenization, 9 of 12 queries score zero across the whole corpus; character 1+2-grams reach 7/12 Recall@1, beating jieba's 4/12, at 2.8x the vocabulary.

Hands-on4 min read2026-11-28

How answers carry their sources: citation tracing is really a context-budget problem

Citations come in three trust levels: prompt-only numbering guarantees nothing, file-level annotations point only at a file, and paragraph-level cited_text carries exact character ranges. Any citation is verifiable only if the quoted sentence actually made it into the prompt — so citations start as a budget-allocation problem.

Hands-on5 min read2026-11-28

When hybrid retrieval and rerank are not worth adding: three failure modes and four criteria

Hybrid retrieval fixes misses in recall; rerank fixes bad ordering. Neither rescues the other's problem. The default RRF constant differs by 30x between two systems, and rerank cost grows linearly with candidates — diagnose which stage is failing before adding another one.

Hands-on4 min read2026-11-28

Cosine, dot product or normalization: which similarity metric should retrieval actually use

Cosine is just a normalized dot product. Pick the wrong basis and nothing breaks — the ranking quietly starts favoring longer vectors. Four systems' defaults side by side, plus a hand-checkable example of when the ranking flips.

Hands-on3 min read2026-11-27

Chunk by characters, and your token budget breaks the moment you switch corpora

Same 2,000-character chunks with 200 characters of overlap: median 1,297 tokens on Chinese, 396 on English. A local measurement of three corpora, and how hard thresholds like 1,024 get punched through.

Topic backlog ​

OpenAIChat · Full-stack engineering for LLM-powered conversations and apps