Skip to content
← Back to blog

RAG vs. the LLM Wiki: Two Ways to Give an AI Memory

I'm building an airgapped research agent, and one question kept coming back: should it retrieve raw chunks (RAG) or read a curated wiki? They sound like rivals. They aren't — and here's how I actually think about it.

by Jay Lee7 min readWorking with AI

I've been building a local, airgapped agent that works on top of a research database — no internet, everything running on the box. Early on, one question kept resurfacing and quietly shaping the whole architecture: when the agent needs to know something, should it pull raw fragments out of a vector store (RAG), or read from a curated wiki that a human and an AI maintain together?

They're usually pitched as competitors. After living with both, I don't think that framing survives contact with a real system. Here's the mental model I landed on — starting from the ground up.

Two philosophies of memory

RAGvsthe LLM Wiki

Both are ways to let an AI lean on your documents. But they treat memory in opposite ways — one grabs fragments on demand, the other curates them in advance.

RAG · Retrieval-Augmented Generation

Fetch fragments when needed

A question comes in, and the system pulls similar-looking chunks from a big pile of raw documents on the spot and hands them to the model. Automatic, and it scales no matter how much you throw at it.

LLM Wiki · the Karpathy pattern

Curate it ahead of time

A human and an AI keep a set of distilled wiki pages. The model reads the index first, then reads whole relevant pages. It takes effort, but the answers come out tidy and trustworthy.

One-panel analogy

A box of photocopied scraps vs. a well-made encyclopedia

Picture the same library, used two different ways.

A hand plucking a fragment from a swirl of scattered paper scrapsRAG

Shred thousands of pages into a box, and when a question arrives, fish out the few scraps that look related and drop them on the AI's desk. Fast and automatic — but they're fragments stripped of context, so an off-topic scrap sneaks in, or the page that actually mattered never surfaces.

An open book radiating links to a set of orderly cardsLLM Wiki

A librarian summarizes the essentials into pages and wires them together with an index and links. The AI skims the index and reads the right page in full. Prep takes work — but by the time it reads, the knowledge is already verified and connected.

How it works

Same question, different route

RAG flows like this
PREP
Docs → fragments
Chop documents, embed as vectors, store in a vector DB
01
Question → vector
Project the query into the same number-space
02
Find near chunks
Auto-retrieve the top few closest fragments
03
Stuff & generate
Paste those chunks into the prompt; the model writes
The LLM Wiki flows like this
PREP
Curate into pages
Human + AI distill & verify wiki pages, keep an index and links
01
Read the index first
The model scans the index and names the relevant pages
02
Read pages in full
Whole pages with context intact — not fragments
03
Good answers → new pages
File the answer back into the wiki; knowledge grows itself

The core difference is what you retrieve. RAG returns a chunk; the wiki returns a whole page found via the index. And RAG's knowledge only updates when the sources change — while the wiki's knowledge gets tidier the more you use it.

Side by side

Laid out next to each other

DimensionRAGLLM Wiki
Unit retrievedDocument chunk — context clippedWhole page — context intact
How it findsSemantic similarity (vector distance)Explicit index + link navigation
CurationAlmost none — raw text goes inHuman + AI distill, resolve, verify
How it growsAdd & re-embed sourcesAnswers filed back as pages — self-accumulating
ContradictionsConflicting chunks can arrive togetherResolved or flagged during curation
Setup costLow — drop it in, it's searchableHigh — needs ongoing curation discipline
ScaleMillions of docs, automaticallyAs much as humans can shepherd (the core)
Sweet spotBroad recall over vast, messy sourcesCurated domain knowledge, trusted answers, reasoning
Upsides & the price

There's no free lunch

RAG

  • Drop it in and it's searchable — light setup
  • Scales to however many sources you have
  • Runs automatically, no human upkeep
  • Context-less chunks cause wrong citations
  • Answer quality rides on chunking & embeddings
  • Doesn't filter out conflicts or duplicates

LLM Wiki

  • Reads verified knowledge with context intact
  • Index & links pin the exactly relevant pages
  • Gets tidier as you use it — it grows itself
  • Dies without curation discipline
  • Only scales to what humans can maintain
  • Goes stale and polluted if neglected
So which one

You don't pick one — you stack them

They aren't rivals; they play different roles. A good system doesn't drop either — it layers them: trusted answers come from the wiki first, broad raw coverage is backed by RAG. (The airgapped agent I'm building runs exactly this two-tier setup.)

Tier 1Verified wiki (LLM Wiki)read first
Human + AI curated pages. Read the index first to frame the answer you can trust.
Tier 2Raw corpus (RAG)backs it up
The vast, un-curated originals. Whatever the wiki hasn't covered — the corners, the latest, the details — swept up by hybrid vector + keyword search.

Add a layer that computes numbers in code (not RAG, not the wiki) and one that checks every answer against its sources, and you get an agent that works without making things up — and shows its receipts.

RAG = Retrieval-Augmented Generation · LLM Wiki = Andrej Karpathy's index-first knowledge base that humans and LLMs read and write together.

The one-liner — RAG is on-the-fly retrieval that grabs fragments; the LLM Wiki is curation you read whole. In practice, you stack them.

That last layer — compute-in-code plus a verification gate — is the part I care about most, but it's a story for another post. For now: if you're wiring up retrieval for an agent and find yourself arguing "RAG or a wiki," try reframing it as "wiki first, RAG underneath." The question mostly dissolves.

Written by

Jay Lee

Korea-Licensed Pharmacist (#68652) · Senior Researcher

Korea University, College of Pharmacy (B.S. + M.S., drug delivery systems & industrial pharmacy). Building production-grade AI tools across medicine, finance, and productivity — without a CS degree. Domain expertise first, code second.

About the author →
ShareX / TwitterLinkedIn