Ask what should change when the equation is manipulated, then let the visualization test that expectation.
Foundation Lab
Retrieval-Augmented Generation (RAG)
RAG is the dominant paradigm for grounding LLMs in external/updated knowledge
p(y|x) = \sum_{d} p(d|x) \cdot p(y|x, d)Selected Foundation Object
Keep the equation fixed; move through the evidence.
RAG trades model capacity for external memory: smaller models + good retrieval can match larger models
p(y|x) = \sum_{d} p(d|x) \cdot p(y|x, d)Use the runnable panel, the key equation, and canonical papers as separate forms of evidence for the same object.
The useful learning product is the reusable mechanism you can carry into another model, paper, or engineering tradeoff.
Use prerequisites, dependents, and semantic links to repair the next gap without leaving the object behind.
Why It Matters for Modern Models
- RAG is the dominant paradigm for grounding LLMs in external/updated knowledge
- Explains why vector databases and embedding search became critical infrastructure
- Separates "what the model knows" from "what the model can access"—enables knowledge updates without retraining
What Tutorials Skip
What is still poorly explained in textbooks and papers:
- RAG trades model capacity for external memory: smaller models + good retrieval can match larger models
- Retrieval quality is bottleneck: irrelevant docs hurt more than no docs (noise injection)
- The "lost in the middle" problem: LLMs struggle to use information from middle of long contexts—retrieval ranking matters
Interactive Visualization
Core Math (Optional Deep Dive)
If you want intuition first, start with the key equation and the visualization. Come back here for the full walkthrough.
RAG augments generation with retrieved documents:
Retrieval uses embedding similarity:
where , are query/document encoders (often shared, e.g., BERT, Contriever).
Generation conditions on retrieved context: