freecoding.school100% FREE · NO SIGNUP
Tensor TownISSUE #68 of 120

retrieval augmented generation · rag basics

NeuraVSThe Overfit Ogre
Neura saysRAG (retrieval-augmented generation) feeds an LLM relevant documents so it answers from real sources.

LLMs have a fixed knowledge cutoff and hallucinate on specifics. RAG retrieves relevant documents (from your data) at query time and puts them in the prompt, so the model answers grounded in real, current, citable sources. It's the standard way to build "chat with your docs / knowledge base" — cheaper and more current than fine-tuning, and it lets you cite where answers came from.

Power-ups you unlock

The Overfit Ogre attacks — common mistakes

Boss battleExplain why RAG beats fine-tuning for answering from a changing knowledge base.

Example code

<!doctype html><html><head><meta charset="utf-8"></head>
<body style="background:#06040d;color:#e6e0ff;font-family:monospace;padding:20px"><pre>question → retrieve top docs → put in prompt → LLM answers
grounded + current + citable
(no retraining when docs change)</pre></body></html>
▶ Open the interactive comic issue
‹ Self-Consistency · Sample And VoteRag · Vector Stores · Embeddings · Chunking ›