Paper: 2612.02851 — LLM-Compiled Wiki vs. Vector RAG for Classroom Question Answering Authors: Brian Wright (School of Data Science, University of Virginia) Categories: cs.AI, cs.ET Reading scope: Complete untruncated original arXiv HTML (Abstract, Sections 1–5, Tables 1–4, and References); the paper contains no figures. This is a source-based reading, without independent peer review, a code/data audit, or experiment reproduction.

The Problem

When deploying an LLM over a private knowledge base—such as a university course’s slides, notebooks, and textbook—the default recipe is vector retrieval-augmented generation (RAG): split raw files into chunks, embed them, retrieve the top k nearest chunks at query time, and hand them to the model. Yet prior work on the same University of Virginia machine learning course (DS3001) ran into an uncomfortable snag (Section 1.1): no single fixed retrieval setting worked well across both narrow fact questions and broader conceptual questions.

An alternative pattern—Andrej Karpathy’s LLM-compiled wiki (Karpathy, 2026)—flips when structural work happens. Instead of asking the model to stitch together similarity-ranked raw snippets on the fly, you compile the corpus at ingest time into linked concept pages with source citations and an index.md map, then let an agent navigate pages on demand at query time.

That raises a clean engineering question that hype alone cannot answer: does an LLM-compiled wiki genuinely beat vector RAG under the same token budget, or do reported wins simply come from reading more context?

The Explanation

A five-condition test that isolates structure from context volume

Wright tests both representations on one authentic, frozen course snapshot: DS3001: Foundations of Machine Learning plus its companion online book (MLBook), covering 14 topics across 81 text-bearing documents (56 course files—slides with speaker notes, notebooks without outputs, assignments, syllabus, readings—and 25 book chapters, totaling ~235k tokens in the embedding tokenizer; Section 3.1).

  • Raw corpus (for RAG): 203 chunks (1,500 tokens each, 100-token overlap, never crossing file boundaries), embedded with all-mpnet-base-v2 in Pinecone.
  • Compiled wiki: 14 linked concept pages (one per topic, median ~3,900 tokens, range 1,300–7,500) citing the raw files, plus meta/navigation files (index.md at 765 tokens, getting-started.md, status.md, overviews — 21 pages total).

Five conditions hold the answerer (claude-opus-5, medium effort, 1M context), cross-provider blind judge (gpt-5-mini), prompts, and 100-question benchmark (45 single-topic, 45 cross-topic spanning 2–3 topics, 10 unanswerable controls) completely constant (Table 1):

ConditionMaterialSelection MechanismCourse-Material BudgetMean Final Input Tok.
C0NoneClosed-book floorQuestion only131
A-retRaw corpusTop-k vector retrieval (k=10 primary, k=5 tight)15,000 (or 7,500)18,847
A-fullRaw corpusEntire raw corpus in contextUnbounded338,671
B-navCompiled wikiAgent reads index.md + calls read_page(path) (up to 12 turns)Matched 15,000 (or 7,500)13,937
B-fullCompiled wikiEntire compiled wiki in contextUnbounded96,031

To guard against lenient file-level metrics (where retrieving any irrelevant chunk from the right file counts as a “hit”), the author also splits all 90 answerable reference answers into 620 atomic claims and checks how many claims are actually supported by the exact text each system put in context (Section 3.3, Table 4). In addition, the course instructor manually audited 184 graded responses (all 100 closed-book answers, all 44 low-scoring or ungrounded calls across both budgets, and 40 random high-scoring grounded answers), agreeing with the LLM judge on 39/40 of the low/ungrounded calls, 95/100 of closed-book calls, and all but 2 scores overall (Sections 3.5 and 4).

Headline results: tied overall, sharply split by question type

First, grounding kills unflagged fabrication (Table 2). Closed-book C0 averaged 8.65/10 on general ML correctness, yet 58% of its responses made claims unsupported by the course (only 32% grounded), and it confidently answered all 10 unanswerable controls (6.70) instead of flagging them (9.70–9.80 for grounded arms). Once course material was supplied, unflagged fabrication dropped to 0% across every grounded condition (96%–100% grounded, 9.71–9.89 overall score).

Second, under the matched 15,000-token budget, A-ret and B-nav tie overall (9.71 vs. 9.84, diff +0.13, 95% CI [-0.07, +0.32])—because they trade places cleanly across question types (Tables 3 and 4):

Question Class (n=45 each)BudgetMetricVector RAG (A-ret)Wiki Nav (B-nav)B-nav − A-ret (95% CI)
Single-topic15k (k=10)Correctness (1–10)9.939.73-0.20 ([-0.53, +0.02])
Single-topic15k (k=10)Grounded100%93%-7 pts ([-16, 0])
Single-topic15k (k=10)All claims in context87%82%-4 pts ([-18, +9])
Cross-topic15k (k=10)Correctness (1–10)9.499.96+0.47 ([+0.24, +0.73])
Cross-topic15k (k=10)Grounded96%100%+4 pts ([0, +11])
Cross-topic15k (k=10)All claims in context53%87%+33 pts ([+18, +49])
Cross-topic7.5k (k=5)Grounded73%93%+20 pts ([+4, +36])
Cross-topic7.5k (k=5)All claims in context24%67%+42 pts ([+24, +60])

Why the reversal? The claim-level audit pins down two completely different failure modes:

  1. Why vector RAG loses on cross-topic synthesis: Whole-question cosine similarity fills the top-k slots with chunks from whichever single topic dominates the query’s phrasing—or retrieves the right file but the wrong section (25% of RAG’s “covered” questions at k=10 and 41% at k=5 were missing at least one reference claim, Section 4.2). Halving the budget to k=5 collapses RAG’s full-claim coverage on cross-topic questions to just 24%, causing 27% of its cross-topic answers to go beyond the course material. By contrast, B-nav opens index.md and deliberately fetches each relevant topic page—consuming fewer material tokens on average (9,591 vs. 11,873) and hitting the 15k cap on only 10/100 questions.
  2. Why the compiled wiki loses on single-topic detail: B-nav did not fail to navigate—it found the gold page 98% of the time and hit the whole-wiki claim-recall ceiling (94.9% vs. 94.1% for the whole wiki, Table 4). It lost purely because summarization drops niche details. Its lowest score (4/10) was a question on split-selection bias in exhaustive tree search and the GUIDE algorithm: GUIDE appeared in an assigned raw reading (A-ret and A-full scored 10/10), but the compiled wiki summary omitted it completely (Section 4.1).

Full-context controls prove selection—not rewriting—drives the win

When selection is removed (A-full vs. B-full), the two representations become statistically indistinguishable (9.89 vs. 9.85, diff -0.04, CI [-0.26, +0.10]), and A-full reaches 9.89 on cross-topic questions too (Section 4.3). That rules out the hypothesis that LLM compilation magically makes prose easier to reason over: the wiki wins under a budget strictly because its index.md + concept-page structure lets the model select better.

Even better, B-nav matches B-full (9.84 vs. 9.85; 0.00 gap on cross-topic) while reading only about 3 of 21 pages (~14%). Still, multi-turn navigation is not free: averaging 2.35 model calls per question, B-nav’s total billed input tokens across turns (20,186) slightly exceed A-ret’s single call (18,847, ~7% higher), with similar wall-clock latency (25 s vs. 28 s).

Core Concepts

  • Ingest-time compilation vs. query-time retrieval: Vector RAG defers organization until query time via embedding similarity over raw chunks; an LLM-compiled wiki front-loads synthesis into linked concept pages and an index map that an agent navigates step by step.
  • Claim-level context recall: Splitting reference answers into atomic factual claims (620 claims here) and verifying whether the exact text placed in context supports every claim—exposing retrieval misses hidden by file-level “gold file in context” checks.
  • Compilation loss (summary omission): The irreducible trade-off of replacing raw sources with synthesized concept pages—any specific algorithm, footnote, or formula omitted during compilation becomes unreachable even when the entire wiki sits in context.
  • Flagged ungroundedness vs. fabrication: Separating responses that explicitly warn the reader “the course material does not cover this” (flagged) from ungrounded answers that silently present outside claims as course fact (fabrication).

The Insight

Think of a textbook’s index plus curated chapter syntheses versus a pile of shredded pages sorted by keyword similarity (an illustrative analogy). The paper’s cleanest lesson is that LLM-compiled wikis and vector RAG fail in orthogonal ways: RAG fails at coverage when a question bridges multiple topics, whereas a wiki fails at granularity when a question targets a raw detail the compiler left on the cutting-room floor. Because the full-context control (A-full vs. B-full) erases the accuracy gap entirely, a compiled wiki is best understood not as a “smarter document,” but as a high-leverage navigation index that lets a 15k-token budget perform like a 339k-token raw dump.

A Critical Reading

  • A major caveat in the RAG baseline (Footnote 2): A-ret splits raw files into 1,500-token chunks, yet embeds them with all-mpnet-base-v2, whose maximum input length is 384 word-pieces. Only the first ~25% of each chunk drove cosine similarity (the generator still saw the full chunk). The author candidly notes this was kept for continuity with prior work and is a limitation of A-ret rather than modern RAG. A stronger baseline—using smaller chunks (256–512 tokens), long-context embeddings, hybrid BM25 + dense retrieval, or cross-encoder reranking—could substantially narrow the cross-topic gap.
  • Ceiling compression and single-run uncertainty: All four grounded arms cluster tightly between 9.71 and 9.89 out of 10 over 100 questions from a single data-science course, run once per condition (so bootstrap CIs capture question-sampling variance, not generator or judge stochasticity), and audited by a single instructor (Section 5.3).
  • Unmeasured ingest, update, and multimodal costs: The introduction highlights mid-semester syllabus updates and prior multimodal slides/audio, yet this evaluation uses one frozen text-only snapshot and defers wiki compilation cost, incremental re-compilation staleness, and image/table handling to future work (Sections 3.1 and 5.4).
  • Tight-budget fragility applies to wikis too: At 7,500 tokens, B-nav still beat A-ret on cross-topic groundedness (93% vs. 73%), yet hit its token cap on 69/100 questions and produced its only unjustified refusal—showing that long concept pages (1,300–7,500 tokens) create coarse retrieval units when budgets shrink.

What You Can Use

  • Build a hybrid: navigate the compiled wiki, fall back to cited raw files. Because every wiki concept page cites its underlying raw documents, giving the agent a second tool to open cited raw files (or run a fallback raw-chunk lookup) when a concept page misses a specific detail (like GUIDE) directly combines the wiki’s cross-topic routing with RAG’s verbatim recall.
  • Audit your RAG pipeline at the claim level, not the file level. File-level hit rates hid 25%–41% of RAG’s missing claims here because the right file’s wrong chunk was retrieved; checking atomic claims against retrieved text surfaces real recall gaps immediately.
  • Watch embedding context truncation when tuning chunk size. Never pair 1,500-token chunks with a 384-token embedding model—silently embedding only the chunk head cripples retrieval on long documents.
  • Count billed multi-turn tokens, not just final context size. Agentic wiki navigation cut final-call context (13.9k vs. 18.8k), yet 2.35 turns made total billed tokens slightly higher than single-shot RAG; enable prompt caching across turns so multi-step navigation stays cost-competitive.

论文:2612.02851 — LLM-Compiled Wiki vs. Vector RAG for Classroom Question Answering 作者:Brian Wright(弗吉尼亚大学数据科学学院) 分类:cs.AI, cs.ET 阅读范围:完整未截断的 arXiv 原文 HTML(摘要、第 1–5 节、表 1–4 及参考文献);论文正文不含配图。本篇为基于原文的深度解读,不构成独立同行评审、代码/数据审计或实验复现。

问题

把大模型接入私有知识库(例如一门大学课程的幻灯片、代码笔记本和教材)时,业内默认方案一直是向量检索增强生成(Vector RAG):把原始文档切片、做向量嵌入,提问时按相似度召回前 k 个片段交给模型作答。 但作者此前在同一门弗吉尼亚大学机器学习课程(DS3001)上的研究碰到了棘手问题(第 1.1 节):任何一套固定检索策略都顾此失彼,擅长查细节的配置到了综合概念题上就掉点。

Andrej Karpathy 在 2026 年 4 月提出的**「LLM 编译维基(LLM-compiled wiki)」**换了一条思路:把组织结构的工作从「查询时临时拼凑」提前到「入库时预先编译」。 入库阶段先用大模型把原始资料整理成带目录(index.md)、页面互链和原文引用的概念维基页,提问时再由智能体按需翻页阅读。

这引出了一个工程师最关心的问题:在完全相同的词元预算下,编译维基真的比向量 RAG 更强吗,还是说很多时候只是塞进了更多上下文?

翻译

五组对照实验:把「表示结构」与「上下文体积」拆开检验

作者使用一份冻结的真实课程语料做严格对照:DS3001 机器学习基础课及其配套在线教材 MLBook,覆盖 14 个主题、共 81 份纯文本源文档(56 份课程文件含讲义备注、无输出的代码笔记本、作业与阅读材料,加 25 份教材章节,按嵌入模型分词约 235k 词元,第 3.1 节)。

  • 原始切片库(RAG 侧):切成 203 块(每块 1,500 词元、重叠 100 词元、不跨文件),用 all-mpnet-base-v2 嵌入并存入 Pinecone。
  • 编译维基(Wiki 侧):按 14 个主题编译为 14 篇相互链接并引用原始文件的概念页(中位长度约 3,900 词元,范围 1,300–7,500),外加 index.md(765 词元)等导航元页面,共 21 页。

所有五组条件固定同一个回答模型(claude-opus-5,中等推理力度、1M 上下文)、跨厂商盲审裁判(gpt-5-mini)、提示词以及同一套 100 道真实课堂题(45 道单主题题、45 道跨 2–3 个主题的综合题、10 道教材未覆盖的不可回答对照题,表 1):

实验条件使用材料上下文选择方式课程材料预算终轮平均输入词元
C0无闭卷基线仅问题131
A-ret原始语料向量检索 Top-k(主实验 k=10,紧预算 k=5)15,000(或 7,500)18,847
A-full原始语料全部原始文档塞进上下文不限338,671
B-nav编译维基从 index.md 起步,调用 read_page(path) 翻页(最多 12 轮)严格对齐 15,000(或 7,500)13,937
B-full编译维基整部编译维基塞进上下文不限96,031

为了防止宽松的文件级命中指标(哪怕抽到正确文件里毫不相干的一页也算命中)虚高 RAG 表现,作者把全部 90 道可答题的参考答案拆成 620 条原子论点,逐条核查模型实际看到的上下文是否足以支撑每条论点(第 3.3 节、表 4)。 此外,授课教师亲自复核了 184 份评分结果(全部 100 份闭卷回答、两档预算下全部 44 份低分或未扎根回答、以及随机抽取的 40 份高分扎根回答),在低分/未扎根判定上与裁判一致率达 39/40,闭卷判定达 95/100,总分仅 2 处有异议(第 3.5 节、第 4 节)。

核心结果:总分打平,但在两类题上彻底换位

第一,只要给课程材料,隐性胡编就会清零(表 2)。 闭卷组 C0 虽然按通用机器学习标准均分有 8.65/10,但高达 58% 的回答包含了课程资料并不支持的表述(仅 32% 严格扎根于课程),面对 10 道不可答题还全部硬答(6.70 分),而四个有资料组均准确拒答或标注未覆盖(9.70–9.80 分)。 接入课程材料后,四组的无提示编造率全部降至 0%(扎根率 96%–100%,总均分 9.71–9.89)。

第二,在严格对齐的 15,000 词元预算下,A-ret 与 B-nav 总分无显著差异(9.71 对 9.84,差值 +0.13,95% 置信区间 [-0.07, +0.32]),但在单主题题与跨主题题上完全换位(表 3、表 4):

题目类别(各 n=45)预算指标向量 RAG(A-ret)维基导航(B-nav)B-nav − A-ret(95% CI)
单主题题15k(k=10)正确率(1–10)9.939.73-0.20([-0.53, +0.02])
单主题题15k(k=10)扎根率100%93%-7 个百分点([-16, 0])
单主题题15k(k=10)全论点覆盖率87%82%-4 个百分点([-18, +9])
跨主题题15k(k=10)正确率(1–10)9.499.96+0.47([+0.24, +0.73])
跨主题题15k(k=10)扎根率96%100%+4 个百分点([0, +11])
跨主题题15k(k=10)全论点覆盖率53%87%+33 个百分点([+18, +49])
跨主题题7.5k(k=5)扎根率73%93%+20 个百分点([+4, +36])
跨主题题7.5k(k=5)全论点覆盖率24%67%+42 个百分点([+24, +60])

论点级核查清楚揭示了两种截然不同的失分原因:

  1. 为什么跨主题题上向量 RAG 落败:整句提问做向量相似度匹配,前 k 个名额往往被问题措辞里占比最重的单个主题占满,或者召回了正确文件却抽错了段落(k=10 时 RAG 所谓「覆盖成功」的题里有 25% 漏掉至少一条论点,k=5 时升至 41%,第 4.2 节)。 预算减半到 k=5 后,RAG 在跨主题题上的全论点覆盖率暴跌到 24%,27% 的回答超出了材料范围。 反观 B-nav,它先看 index.md 再分别打开涉及的每个主题页,平均只花 9,591 材料词元(少于 RAG 的 11,873),百题中仅 10 题撞上 15k 上限。
  2. 为什么单主题题上编译维基略输:B-nav 并非找不到页面——它命中目标概念页的比例和 RAG 一样高达 98%,论点召回也已打到整部维基的上限(94.9% 对整部维基的 94.1%,表 4)。 真正丢分是因为编译摘要是有损的。 B-nav 得分最低的一题(4/10)问决策树穷举分裂偏差以及 GUIDE 算法如何规避:原始阅读材料里讲了 GUIDE(A-ret 和 A-full 均拿 10/10),但编译维基做摘要时把它省掉了(第 4.1 节)。

全量上下文对照证明:赢在「选择结构」,而非改写内容

撤掉检索与翻页步骤、直接把全部材料塞进上下文(A-full 对 B-full)后,两者的差距彻底消失(9.89 对 9.85,差值 -0.04,CI [-0.26, +0.10]),A-full 在跨主题题上也能拿到 9.89(第 4.3 节)。 这说明把文档编译成维基并没有神奇地让文字更好理解,它的优势在有限预算下完全来自更好的信息选择结构。

更有意思的是,B-nav 仅翻阅了 21 页中的约 3 页(约 14%),表现就追平了整部维基全量输入的 B-full(9.84 对 9.85,跨主题差值 0.00)。 不过多轮翻页也有隐性账单:B-nav 平均每题调用模型 2.35 次,跨轮累计计费输入词元(20,186)反而比单次调用的 A-ret(18,847)高出约 7%,平均耗时也相近(25 s 对 28 s)。

核心概念

  • 入库时编译 vs. 查询时检索:向量 RAG 把组织工作留到提问时靠语义相似度拼凑;LLM 编译维基在入库阶段提前整理出带目录、互链与出处的概念页,提问时按图索骥。
  • 论点级上下文召回:把参考答案拆成原子事实论点(本文共 620 条),逐一检验上下文里的实际文本是否支撑该论点,戳破文件级命中率掩盖的「找对文件却抽错段」假象。
  • 编译折损(摘要遗漏):用综合概念页替代原始文档的固有代价——编译阶段被略过的冷门算法、脚注或细节,即便把整部维基全放进上下文也无法答出。
  • 明示超纲 vs. 隐性编造:严格区分「主动告诉读者材料未涵盖该部分」(明示超纲)与「把课外知识混在回答里不打招呼」(编造)。

洞见

借用一个说明性的类比:编译维基像一本带总目录和章末综述的精编参考书,而向量 RAG 像把原书撕成散页后按关键词相似度临时捞出十页。 这篇论文最清爽的结论在于,编译维基和向量 RAG 的短板恰好正交:RAG 缺的是跨主题的覆盖广度,维基缺的是冷门原句的细节保真度。 全量上下文对照(A-full 与 B-full 打平)进一步点破了本质:LLM 维基并不是把文本写得更聪明,而是充当了一个高杠杆的导航索引,让 15k 词元预算跑出接近 339k 原始语料全量输入的效果。

博导审稿

  • RAG 基线存在一个不能忽略的技术短板(脚注 2)。 A-ret 把原文按 1,500 词元切块,却用了最大输入仅 384 个词片 的 all-mpnet-base-v2 做向量嵌入——这意味着检索索引只看到了每块开头大约四分之一的内容(生成阶段仍能看到整块)。 作者坦诚这是为了延续前作设置,并承认它属于 A-ret 配置局限而非通用向量 RAG 的上限。 如果换成 256–512 词元短切片、长上下文嵌入模型、BM25+向量混合检索或重排器,跨主题差距很可能明显缩小。
  • 天花板压缩与单次运行局限。 四个有资料组的得分全部挤在 9.71–9.89(满分 10)的狭窄区间内,题目仅来自一门数据科学课的 100 题,每组只跑了一次(自举置信区间仅反映抽题误差,不含模型与裁判的随机波动),且人工复核仅由一位授课教师完成(第 5.3 节)。
  • 入库编译、动态更新与多模态成本尚未测量。 引言把「学期中课件更新」与此前多模态讲义作为核心动机,但本次实验仅在单一冻结纯文本快照上测试,维基编译开销、课件改版后的增量同步陈旧度以及图表/音频处理都留给了未来工作(第 3.1 节、第 5.4 节)。
  • 预算收紧时,粗粒度维基页同样吃力。 在 7,500 词元预算下,B-nav 虽在跨主题扎根率上大胜 A-ret(93% 对 73%),但也有 69/100 题撞上词元上限并出现了唯一一次不当拒答,说明 1,300–7,500 词元的整页读取在极紧预算下粒度偏粗。

启发

  • 实战首选混合架构:维基导航主攻全局,引用回退原文兜底细节。 既然每篇维基概念页都自带原始文件引用,只要再给智能体配一个「按引用读取原文或局部检索」的回退工具,就能把维基的跨主题路由与 RAG 的原文细节召回无缝结合。
  • 评测检索质量时,务必做到「论点级」而非「文件级」。 文件级命中率在本文里掩盖了 RAG 高达 25%–41% 的漏召回,只有拿参考答案拆出的原子论点逐条核对上下文,才能看清检索到底漏了什么。
  • 切片长度必须匹配嵌入模型的有效窗口。 切 1,500 词元却配 384 词片上限的嵌入模型会让后四分之三内容对向量检索隐身,排查 RAG 漏召回时应第一时间检查这一点。
  • 核算智能体检索成本要看「多轮累计计费词元」,并善用提示词缓存。 维基导航虽然把终轮上下文压低到 13.9k,但平均 2.35 轮调用使累计计费输入反而略高于单次 RAG;开启跨轮前缀缓存才能真正把导航架构的成本打下来。