~/wiki

RAG vs Wiki Pattern

Mis à jour le 2025-12-29Confiance : high
rag-comparisonllm-wiki-patternandrej-karpathyknowledge-retrievalpersistent-learningstateless-vs-statefuldocument-processing

Fundamental comparison between traditional Retrieval-Augmented Generation (RAG) systems and andrej-karpathy's llm-wiki-pattern, highlighting different approaches to knowledge management and query answering.

Traditional RAG Approach

Process Flow

  1. Upload collection of files
  2. Chunk and embed documents
  3. At query time: retrieve relevant chunks
  4. Generate answer from retrieved fragments
  5. Repeat process for each new query

Characteristics

  • Stateless: Each query starts fresh
  • Rediscovery: Knowledge reconstructed every time
  • Fragment-based: Works with document chunks, not integrated knowledge
  • No accumulation: Understanding doesn't build over time
  • Limited synthesis: Difficult to connect insights across multiple documents

Examples

  • NotebookLM
  • ChatGPT file uploads
  • Most commercial RAG systems
  • Document Q&A tools

LLM Wiki Pattern Approach

Process Flow

  1. Ingest sources into persistent wiki structure
  2. LLM builds and maintains cross-referenced knowledge base
  3. At query time: synthesize from existing wiki pages
  4. File valuable answers back as new wiki content
  5. Knowledge compounds with each interaction

Characteristics

  • Stateful: Persistent knowledge accumulation
  • Pre-synthesized: Understanding built incrementally over time
  • Integration-based: Works with structured, cross-referenced content
  • Compounding: Each addition makes the whole more valuable
  • Rich synthesis: Connections already established across sources

Key Differences

Aspect Traditional RAG Wiki Pattern
Knowledge State Stateless retrieval Persistent accumulation
Processing Time Query-time discovery Ingest-time integration
Cross-reference Ad-hoc during query Pre-established and maintained
Contradictions Discovered per query Flagged and tracked systematically
Synthesis Quality Limited by retrieval Rich, pre-built connections
Maintenance None (static chunks) Automated wiki maintenance

When to Use Each

RAG Works Well For

  • Simple document Q&A
  • One-off queries against large document sets
  • When you don't need knowledge to compound
  • Rapid deployment without setup overhead
  • Documents that rarely need cross-referencing

Wiki Pattern Works Well For

  • Long-term knowledge building
  • Complex synthesis across multiple sources
  • Research that builds over time
  • When contradictions and evolution matter
  • Domains where connections between concepts are valuable

Hybrid Approaches

Some systems might combine both patterns:

  • Wiki pattern for core, frequently-accessed knowledge
  • RAG for supplementary document collections
  • Different layers for different types of content

Performance Implications

RAG

  • Pros: Simple setup, works immediately, scales to large document sets
  • Cons: Repeated processing overhead, limited synthesis depth, no knowledge accumulation

Wiki Pattern

  • Pros: Rich synthesis, compounding value, deep cross-references, maintained consistency
  • Cons: Higher setup cost, requires ongoing LLM maintenance, more complex architecture

See also