Definition
Retrieval Augmented Generation (RAG) is a technique that combines information retrieval with text generation. It retrieves relevant documents or chunks from a knowledge base and feeds them to an LLM as context for answering queries. The term was formally introduced by Lewis et al. in a 2020 paper, establishing the paradigm that the LLM Wiki pattern later evolved from.
Key Points
- RAG emerged from the understanding that LLMs have limited parametric knowledge and need external context
- The standard RAG pipeline: query → embed → vector search → retrieve chunks → LLM generate
- RAG operates at query time, while LLM Wiki operates at ingest time
- Karpathy’s LLM Wiki was explicitly positioned as an alternative to the RAG paradigm
- The compilation vs interpretation analogy: RAG interprets at every query, LLM Wiki compiles once
Genealogy and Evolution
The research report traces a clear genealogy from earlier systems toward LLM Wiki:
- 2023 — Generative Agents (observation, reflection, planning with memory retrieval) and MemGPT (virtual context model inspired by operating systems)
- 2024 — GraphRAG (graph/community summaries for global questions over private corpora), MCP (Anthropic’s model context protocol)
- 2025 — HippoRAG 2 (memory-inspired non-parametric retrieval), mem0 (production memory layer for agents)
- 2026 — Karpathy’s LLM Wiki gist (April), Tencent’s LLM-Wiki paper (May)
This timeline shows RAG evolving from flat chunk retrieval toward graph-enhanced and memory-inspired variants. LLM Wiki represents a different branch: compile-time synthesis rather than retrieval-time generation.
Graph-Enhanced RAG Variants
Classic RAG retrieves flat chunks, which can be fragmented when answers depend on relationships across documents. Two graph-enhanced variants address this: ^[raw/papers/lightrag-simple-and-fast-rag.md]
- lightrag — Builds a knowledge graph of entities and relationships from text, then supports dual-level retrieval (low-level for specific entities, high-level for broader themes) and incremental graph updates.
- hipporag — Inspired by hippocampal indexing theory, extracts a schemaless knowledge graph and uses Personalized PageRank for multi-hop associative retrieval across documents.
Both are retrieval-first systems. They improve RAG’s ability to connect distributed knowledge, but their primary artifact remains a retrieval index rather than a readable wiki.
Three Families of Related Systems
The research categorizes RAG and adjacent approaches into three families:
- Graph/retrieval-first — Systems like GraphRAG, LightRAG, and HippoRAG that focus on better retrieval and synthesis over large corpora. Their persistent unit is a graph/vector index.
- Memory-first — Systems like mem0 and MemGPT that focus on retaining facts and context across sessions. Their persistent unit is a memory store.
- Artifact-first — llm-wiki produces a durable human-readable Markdown wiki. Its persistent unit is a linked page.
Each family optimizes a different trade-off: retrieval accuracy, session continuity, or human legibility.
Related Concepts
- rag — Abbreviated form and practical implementation details
- llm-wiki — The compile-time alternative to RAG
- embeddings — Vector embeddings are the core retrieval mechanism in RAG
- agent-memory-systems — Broader ecosystem of memory and retrieval
- lightrag-vs-hipporag — Comparison of two graph-enhanced variants
Sources
^[raw/articles/karpathy-llm-wiki-gist.md] ^[raw/articles/levelup-llm-wiki-deep-dive.md]