LLM-Compiled Wiki versus RAG for Classroom Question Answering

Brian WrightarXiv 2026

TL;DR

When building an AI tutor for a university course, should you use standard vector RAG (retrieving raw text chunks on the fly) or an LLM-compiled wiki (synthesizing the course into linked concept pages ahead of time)? This paper puts both head-to-head on a real machine learning course and finds they trade places: the wiki wins on questions that connect multiple topics, while vector RAG has a slight edge on single-topic lookups.

What Problem Does This Paper Address?

General-purpose LLMs are fluent, but left to their own devices, they answer from parametric memory—which can clash with how a specific course defines, sequences, or scopes its material. The standard fix is Retrieval-Augmented Generation (RAG), which fetches relevant snippets of course material at query time.

However, prior work showed that fixed retrieval strategies are brittle: a setup that excels at specific, single-fact questions can stumble on broader, multi-topic ones. This raises a fundamental design question: does how you structure a course corpus at ingest time matter more than how much you retrieve at query time?

Methods

The author runs a controlled experiment holding the generator LLM (claude-opus-5), prompts, and question set constant, varying only the knowledge representation and how context is selected:

  • Vector RAG (A-ret): The standard baseline. Raw course files are split into 1,500-token chunks, embedded, and the top-$k$ most similar chunks are retrieved for each question.
  • LLM-Compiled Wiki (B-nav): Following Andrej Karpathy’s proposal, an LLM synthesizes the raw corpus at ingest time into 14 linked concept pages (one per topic) with citations back to the original files. At query time, the model acts as an agent: it starts with index.md and navigates the wiki using a read_page tool within a matched token budget (15,000 tokens, equivalent to $k=10$ chunks; plus a tighter 7,500-token / $k=5$ sensitivity test).

To separate the effect of representation from sheer context volume, the study includes three controls: Closed-book (C0) with no course materials, Full raw corpus (A-full), and Full wiki (B-full). An independent LLM judge (gpt-5-mini) grades every response for correctness (1–10), groundedness in the course material, and claim-level context recall.

Evaluation conditions

Datasets

The corpus comes from an authentic undergraduate/graduate course, DS3001 Foundations of Machine Learning, paired with its companion online textbook (MLBook). It comprises 81 text-bearing documents (~235k tokens) across 14 topics, including lecture slides, notebooks, readings, and the syllabus.

The evaluation set consists of 100 human-generated, instructor-reviewed questions:

  • 45 topic-page questions: Answerable from a single topic.
  • 45 cross-page questions: Requiring synthesis across two or three topics.
  • 10 unanswerable controls: In-scope questions that the course material does not actually answer.

Key Insights and Ideas

  • Representation is a trade-off, not a blowout: Overall, the two approaches tie. Their strengths mirror how they work.
  • Why the wiki wins on cross-topic synthesis: Vector similarity search ranks chunks against the question as a whole, which tends to pull chunks from whichever single topic dominates the question's wording. By contrast, a wiki navigator reading from an index of topics can deliberately open a page for each topic involved.
  • Why RAG edges ahead on single-topic lookups: Compiling a wiki means summarizing. Occasionally, a summary drops a niche detail (such as the GUIDE algorithm for decision tree splits) that remains intact in the raw files.
  • Grounding is mostly about having any material: Once course material is in context, unflagged fabrications drop to 0%. Without it, the closed-book model made unsupported claims on 58% of its answers.

Key Results

  • Cross-page questions: At the 15,000-token budget, B-nav outperformed A-ret on correctness (9.96 vs. 9.49 out of 10; 95% CI $[+0.24, +0.73]$) and brought every needed reference claim into context 87% of the time, compared to 53% for A-ret.
  • Topic-page questions: A-ret held a slight, non-significant lead (9.93 vs. 9.73).
  • Tighter budget ($k=5$ / 7,500 tokens): Halving the token budget widened the wiki's groundedness advantage on cross-page questions (93% vs. 73% grounded).
  • Efficiency: B-nav matched the full-wiki upper bound (B-full, 9.84 vs. 9.85) while reading only ~14% of the wiki, though its multi-step navigation averaged 2.35 model calls per question (20,186 billed tokens vs. 18,847 for A-ret). With everything in context (A-full vs. B-full), both representations performed identically, but A-full required nearly 4× as many tokens (338,671 vs. 96,031).
A-ret vs. B-nav by question class

Limitations and Future Work

The study evaluates a single data science course, relies on one human reviewer to audit the LLM judge, and runs each condition once per question (meaning confidence intervals capture question-sampling error, not model stochasticity). Future work includes running multiple trials per question, measuring ingest costs, testing how well both systems handle mid-semester curriculum updates, incorporating multimodal materials, and measuring actual student learning outcomes in a live classroom.

Summary updated

BibTeX
@misc{wright2026llm,
  author = {Brian Wright},
  title = {{LLM-Compiled Wiki versus RAG for Classroom Question Answering}},
  year = {2026},
  eprint = {2612.02851},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2612.02851},
}
Figure