RAG
RAG, or Retrieval-Augmented Generation, is a pattern where an LLM answers by retrieving relevant chunks from an external corpus at query time and placing them into context. In this vault, RAG is important mainly because llm-wiki is presented as a contrasting “compile knowledge first” pattern.
Definition
RAG keeps source material outside the model and retrieves parts of it when a user asks a question. The system usually breaks documents into chunks, embeds those chunks, searches for semantically similar material, and then asks the LLM to answer using retrieved snippets.
This is powerful because the model can use private or current information without being retrained. It is also relatively simple to build compared with fine-tuning or full knowledge graph systems.
Strengths
- It can use new documents without retraining the model.
- It keeps source material separate from model weights.
- It can cite retrieved passages when implemented carefully.
- It is useful for large collections where the user does not know exactly which document matters.
Limits
The research report frames the main limitation clearly: traditional RAG tends to “rediscover” knowledge at every query. It retrieves and synthesizes again and again rather than maintaining a persistent layer of accumulated understanding.
Common weaknesses include:
- repeated summarization of the same knowledge;
- weak accumulation across sessions;
- dependence on chunk quality and embedding retrieval;
- difficulty answering global questions across a whole corpus;
- limited human inspectability unless retrieval traces are exposed.
Graph-enhanced RAG
lightrag and hipporag are two examples of graph-enhanced RAG. They both respond to the same weakness in classic RAG: flat chunks often fail when answers depend on relationships across multiple documents.
LightRAG attacks this through dual-level graph retrieval and incremental graph updates. HippoRAG attacks it through a memory-inspired graph index and Personalized PageRank. See quality-comparison-analysis for a detailed side-by-side comparison of these approaches. Both are retrieval systems, but they move RAG closer to structured memory.
Relationship to LLM Wiki
llm-wiki can be understood as an alternative to pure RAG. Instead of retrieving raw fragments at the moment of the question, the agent compiles sources into a persistent Markdown wiki during ingest.
The difference is practical:
| Question | RAG | LLM Wiki |
|---|---|---|
| Where is knowledge kept? | Chunks, vectors, source docs | Linked Markdown pages |
| When is synthesis performed? | Query time | Ingest time, then extended over time |
| What compounds? | The document store | The synthesized wiki itself |
| Can a human inspect it? | Partly, depending on tooling | Yes, directly as files |
RAG remains valuable. The point is not that RAG is “bad,” but that LLM Wiki addresses a different failure mode: the lack of durable, editable, cumulative synthesis. By focusing on compiling knowledge ahead of time rather than merely retrieving answers, an LLM Wiki builds an interconnected graph that actively compounds its value over time.
Related Retrieval Families
The newer research places RAG alongside several related systems, organized by what each system treats as its persistent unit:
| System | Family | Persistent Unit |
|---|---|---|
| Classic RAG | Graph/retrieval-first | Chunks and embeddings |
| GraphRAG | Graph/retrieval-first | Graph + community summaries |
| lightrag | Graph/retrieval-first | Graph + embeddings (dual-layer) |
| hipporag | Graph/retrieval-first | Non-parametric memory index |
| mem0 | Memory-first | Universal memory layer |
| LLM Wiki | Artifact-first | Linked Markdown wiki |
These are not interchangeable. Each family optimizes a different trade-off: retrieval accuracy, session continuity, or human legibility.
Meta AI RAG Approach (confidence: high)
Lewis et al. (2021) da Meta AI propuseram uma receita de ajuste fino para RAG usando um modelo seq2seq pré-treinado como memória paramétrica e um índice de vetor denso da Wikipedia como memória não paramétrica. O RAG combina um componente de recuperação de informações com um gerador de texto, permitindo modificar conhecimento interno sem re-treinar o modelo.
O processo funciona assim: o RAG recebe uma entrada, recupera documentos relevantes de uma fonte (ex: Wikipedia), concatena-os como contexto ao prompt original, e alimenta o gerador de texto que produz a saída final. Isso torna o RAG adaptável a situações onde os fatos evoluem ao longo do tempo, resolvendo o problema do conhecimento paramétrico estático dos LLMs.
O RAG apresentou desempenho forte em Natural Questions, WebQuestions e CuratedTrec, gerando respostas mais factuais, específicas e diversas que modelos puramente paramétricos.
Related
- llm-wiki — the artifact-first pattern contrasted with RAG.
- retrieval-augmented-generation — expanded name/page for RAG.
- agent-memory-systems — broader ecosystem of memory and retrieval systems.
- llm-wiki-vs-memory-and-graph-rag — comparison of families.
- lightrag-vs-hipporag — focused comparison of two graph-enhanced RAG systems.
- qmd — hybrid local search engine for scaling retrieval past index.md
- cognee — graph-backed retrieval/memory alternative
- agent-loop — RAG is one implementation of the observe step in the agent loop
- context-engineering — RAG provides context at retrieval time; context engineering governs the full information environment
Sources
^[raw/articles/karpathy-llm-wiki-gist.md] ^[raw/articles/levelup-llm-wiki-deep-dive.md] ^[raw/articles/venturebeat-llm-wiki.md] ^[raw/papers/pesquisa-aprofundada-padrao-llm-wiki.md]