~/wiki

RAG vs Wiki Compilation

Mis à jour le 2025-12-23Confiance : high
rag-comparisonllm-wiki-patternknowledge-compilationretrieval-systemsandrej-karpathypersistent-vs-ephemeralsystem-architecture

Fundamental architectural comparison between traditional Retrieval-Augmented Generation (RAG) systems and andrej-karpathy's llm-wiki-pattern approach to knowledge management. Represents a shift from ephemeral retrieval to persistent knowledge compilation.

Core Philosophical Difference

Traditional RAG: Knowledge is rediscovered from scratch on every query Wiki Compilation: Knowledge is compiled once and maintained persistently

This difference has profound implications for knowledge accumulation, query efficiency, and system sophistication over time.

Operational Comparison

Traditional RAG Workflow

  1. User asks question
  2. System retrieves relevant document chunks
  3. LLM pieces together fragments at query time
  4. Generates answer from scratch
  5. Answer disappears into chat history

Wiki Compilation Workflow

  1. Sources ingested incrementally into persistent wiki
  2. Knowledge integrated with existing understanding
  3. User asks question
  4. System searches pre-compiled wiki pages
  5. LLM synthesizes from maintained knowledge
  6. Good answers filed back as new wiki pages

Architectural Trade-offs

RAG Advantages

  • Simplicity: Straightforward to implement and understand
  • Source Fidelity: Directly references original document chunks
  • Real-time: Can incorporate new documents immediately
  • Stateless: No complex state management required

RAG Limitations

  • Redundant Work: Same analysis repeated for similar queries
  • Fragment Dependency: Quality depends on chunk retrieval accuracy
  • No Accumulation: Insights don't compound over time
  • Context Loss: Subtle connections require re-discovery each time

Wiki Compilation Advantages

  • Knowledge Compounding: Understanding builds and strengthens over time
  • Sophisticated Synthesis: Cross-references and contradictions pre-analyzed
  • Query Efficiency: Answers draw from compiled knowledge, not raw chunks
  • Persistent Learning: System gets smarter with each source and query

Wiki Compilation Limitations

  • Complexity: Requires sophisticated maintenance workflows
  • Delayed Integration: New sources need processing before availability
  • State Management: Must maintain consistency across evolving knowledge base
  • Schema Evolution: System architecture must adapt as understanding grows

Scaling Characteristics

RAG: Performance degrades with document volume due to retrieval complexity Wiki Compilation: Performance improves with volume as knowledge density increases

Use Case Suitability

RAG Optimal For

  • Document search and basic Q&A
  • Large, relatively static document collections
  • Simple factual retrieval tasks
  • Systems requiring immediate source transparency

Wiki Compilation Optimal For

  • Research and analysis over time
  • Complex synthesis across multiple sources
  • Personal knowledge management
  • Domains requiring evolving understanding

Knowledge Quality Evolution

RAG: Knowledge quality remains constant - system doesn't learn Wiki Compilation: Knowledge quality improves through:

  • Cross-source validation and contradiction resolution
  • Incremental refinement of understanding
  • Connection discovery between previously isolated concepts
  • Synthesis sophistication increases with experience

Implementation Complexity

RAG: Vector databases, embedding models, retrieval tuning Wiki Compilation: Schema design, maintenance workflows, consistency checking

Future Hybrid Approaches

Emerging systems may combine both approaches:

  • Wiki compilation for core knowledge domains
  • RAG fallback for novel or peripheral queries
  • Automatic promotion from RAG results to wiki compilation

See also