5D Library › Retrieval-Augmented Generation Geometry, Reciprocal Rank Fusion and Multi-Agent Error Cascades · 中文
Preface: Retrieval, Assembly and Chains
Note
Please read this first. This book studies the mathematics of retrieval-augmented generation (RAG) and multi-agent pipelines: the geometry of high-dimensional vector retrieval, the fusion of lexical and dense retrieval, the dilution of evidence in the context, and error propagation and verification in multi-step tasks. All corpora, queries, retrieval results and agent runs in it are synthetic data generated by its programs; its numbers show mechanisms and orders of magnitude, are not measurements of any particular model or product, and recommend no vendor.
A retrieval-augmented or multi-agent system can be split into three links: retrieval — finding the chunks of a knowledge base relevant to a question; assembly — putting the chunks found into a language model’s context; and the chain — having several steps or several agents carry the task through in relay. Each link has its popular intuition: higher dimension and more chunks are better; a longer context is better; more agents are better. This book writes each intuition as a runnable model and finds where it holds, where it fails, and whether the cost of failure can be computed.
Like the other books of 5D Library, it falsifies first, then sets bounds, and reports negative results honestly — including one of its own demonstrations that, through bad luck, reaches a wrong conclusion in Chapter 8.
What the book covers
Chapter 1 uses concentration of measure, effective dimension and hubness to show the geometric costs of high-dimensional vector retrieval. Chapter 2 sets the blind spots of lexical and dense retrieval side by side and tests the smoothing constant of reciprocal rank fusion. Chapter 3 uses a stylised reader model to compute “lost in the middle” and evidence dilution, and finds the best number of chunks for the context. Chapter 4 works out error cascades in chained multi-agent pipelines and writes verifier gating as an absorbing Markov chain. Chapter 5 relaxes two assumptions — independent verifiers and independent retries — and counts the tail-latency cost of reliability. Chapter 6 treats the statistics of evaluation itself: sample size, judge bias and the winner’s curse. Chapter 7 reads Liu Xiang and Liu Xin’s Qilue as routing by category and the Han Feizi’s canyan as checking against several sources. Chapter 8 gives a five-step check and a pre-registered offline evaluation.
This book borders several other books of 5D Library and recalls them only briefly where they overlap: Book 11 treated the geometry of self-attention; Book 26 probability judgement and calibration; Book 42 exploration and exploitation; Book 49 information geometry; Book 58 the unit economics of AI inference. This book does not repeat them.
Claims corrected on checking
- “Higher dimension is more accurate” holds only in an isotropic model. With 768 nominal dimensions and variance falling off as a power law, only 31.7 effective dimensions remain, and the wrong chunk is ranked first among a hundred thousand with probability 0.9875 (p02). In any dimension, the larger the corpus, the higher the top-1 error: at 256 dimensions from 0.0730 to 0.5030 (p01).
- High-dimensional space produces hub chunks by itself. In a hundred dimensions, 1 % of chunks intrude on the top ten of 77.7 % of unrelated questions (p03).
- Dense retrieval cannot recognise identifiers, lexical retrieval cannot recognise paraphrases, and fusion does not automatically combine their strengths. Fusing complete rankings leaves both query types at a recall@1 of 0.055; fusing short lists leaves identifier queries at 0.475 (p04).
- is not universally optimal. It is not the best for recall@1 in any of three scenarios; with one strong and one weak retriever, no beats the strong one alone (p05).
- The number of chunks in the context has an optimum, and it depends on the corpus. With off-topic distractors the best is 8 chunks, with plausible near-misses 2 (p06).
- is confirmed, and three-way voting helps only while errors are independent (p08); a deterministic, independent check lifts a ten-step chain to 0.9949 (p09).
- A verifier’s value lies in independence, not just accuracy. If hard steps stay hard, even a deterministic check reaches only 0.886; a judge that shares the generator’s blind spot reaches only 0.6950 (p10).
- A 3-point improvement needs about three thousand queries to be detected reliably (p12); picking the best of 256 equally good configurations inflates it by more than seven points (p14).
How to read the boxes
Marked boxes separate published evidence, runnable Python calculations (16 programs, standard library only, fixed random seeds, each actually run at build time with its real output printed beneath it), classical sources, notes and the author’s hypotheses; every hypothesis states what result would show it wrong.
Disclosure
The author uses the works of 5D Library, including this book, as the methodological basis of his community courses, the 5D Ascension Cards (Dimensional Shift Card Decks) and the Yafu AI knowledge base; the Yafu AI knowledge base itself uses retrieval augmentation, so the author has a direct commercial interest in the subject of this book. The book promotes no course, card deck, software, embedding model, vector database, language model or agent platform, provides no link to or recommendation of any vendor, and accepts no sponsorship. The evaluation in Chapter 8 uses only software and de-identified query text, and its code and protocol are published openly for anyone to check.
Fan, Y. (2026). Retrieval-Augmented Generation Geometry, Reciprocal Rank Fusion and Multi-Agent Error Cascades: High-Dimensional Concentration of Measure, Hybrid Lexical-Dense Retrieval Bounds and Verifier-Gated Fixed Points [检索增强生成几何、倒数秩融合与多智能体误差级联] (Version 1.0.0). 5D Library. https://doi.org/10.5281/zenodo.24090170 · Licensed under Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International (CC BY-NC-ND 4.0).