
What Is Retrieval-Augmented Generation (RAG)?
Most people assume an LLM knows everything. Ask it about your company's return policy, and it will confidently answer—even if that policy changed last week…
Read tutorialGive LLM applications evidence and actions with embeddings, retrieval, reranking, citations, tools, agents, memory, and controlled loops.
Tutorials
Follow these lessons in order, or jump directly to the topic you need.

Most people assume an LLM knows everything. Ask it about your company's return policy, and it will confidently answer—even if that policy changed last week…
Read tutorial
Most people assume RAG is a different kind of model—a smarter cousin of the plain LLM. It's not. RAG doesn't change the model at all. It changes what goes…
Read tutorial
Reading about RAG is easy. Building one is where the real learning happens—because the first pipeline you run will almost certainly fail in ways no diagram…
Read tutorial
An LLM agent is not a smarter chatbot. It is a goal-driven system that uses a language model as its brain, then loops through action and observation until…
Read tutorial
Most beginners expect an agent to be a special kind of model—something with built-in magic that can browse the web, run code, and get things done. Then…
Read tutorial
You can explain RAG. You can sketch an agent loop. But when a real question lands on your desk, do you know whether to retrieve, route, or just answer?…
Read tutorial
You know RAG retrieves documents and feeds them to a language model. But if someone asked you what actually happens between a source PDF and a grounded…
Read tutorial
You search your company's help docs for "how do I reset my password?" and get nothing useful. You know the answer is in there—you've read the page…
Read tutorial
You ask your RAG system a question. It retrieves a passage that is technically relevant and completely useless—a sentence fragment that starts mid-thought,…
Read tutorial
A 1,500-token document with 512-token chunks and 15% overlap quietly becomes four chunks, and the same paragraph now lives in two of them. Nobody chose…
Read tutorial
Retrieval misses rarely announce their cause. The answer was in the document, the query was reasonable, and the model still returned something useless. The…
Read tutorial
You have a task that needs an LLM. The temptation is to reach for an agent—something autonomous, something that "figures it out." But most of the time, a…
Read tutorial
When people first hear that an LLM can "use tools," they usually picture the model reaching out and doing something itself—searching the web, running code,…
Read tutorial
That gap is not bad luck. It is a missing model. Most beginners picture tool calling as a straight line: ask, call, answer. That picture is accurate for…
Read tutorial
A tool call returns status: "ok". The pipeline moves on. Nobody notices that the result answers a slightly different question than the one the model asked.
Read tutorial
Your agent runs. It calls tools. It produces output. And yet, something is wrong—or it never stops running at all. The frustrating part is that you can't…
Read tutorial
A vector database is not a fancy search box or a generic "database for AI." It is the retrieval engine that decides which evidence earns a seat on the…
Read tutorial
Your knowledge base has the answer. You know it does. You wrote the documents, chunked them carefully, embedded them, and verified the chunks look right.…
Read tutorial
Your retriever returns ten chunks. They all look topically related to your question. None of them actually answer it. The LLM dutifully composes a response…
Read tutorial
You swap in a stronger reranker. The top three results look sharper, the ordering feels smarter, and the demo lands. Then you measure recall and it barely…
Read tutorial
The reranker "feels" better. The top result looks more relevant than it did before. And yet you cannot say whether the stage earned its latency, because…
Read tutorial
A citation is not proof. It is a pointer — and a pointer is only as trustworthy as the instruction that produced it and the check that verifies it.
Read tutorial
You build an agent. You chat with it for a few turns. It helps you draft a plan, picks a tool, runs it, reports back. Then you ask: "What was the second…
Read tutorial
Here's the scene I've watched play out more times than I can count: someone builds their first agent, gives it a task, and watches it loop. It calls a…
Read tutorial
A loop that usually finishes in three steps can still spend most of its money on the runs that don't.
Read tutorial
You can recite the four dispositions — continue, stop, retry, handoff — and still stare at a raw trace with no idea which one applies. That gap is the…
Read tutorial
Structured output and tool calling look almost identical from the outside. Both accept a JSON schema. Both return clean key-value pairs instead of…
Read tutorial
A clean pipeline that answers confidently and wrongly is not a mystery. It is a trace you have not read yet.
Read tutorial
The agent worked in the demo. Then you ran it on your own task, and it called a tool you never expected — or kept calling tools after the answer was…
Read tutorial
A retrieval system returns a top result with a similarity score of 0.83. Most people read that number as "83% relevant" or "83% likely to be correct." It…
Read tutorial
Two retrievers return the same relevant chunk. One puts it at rank 1; the other buries it at rank 4. A single "accuracy" number calls them identical. The…
Read tutorial
A citation is a pointer, not a proof. This drill teaches you to stop trusting the pointer and start reading the span.
Read tutorial
Your agent answered confidently. It was also wrong, and the memory record it trusted was three sessions old.
Read tutorial
You add a rewrite step. The demo answers the question. You feel clever. Then someone asks a slightly different question and the whole thing falls apart,…
Read tutorial
A team sets memory to refresh every six hours to save money. Four hours later, an agent quotes a price, policy, or preference that has already changed. The…
Read tutorial
A filter can be correct and still delete your best evidence. Here is how to watch it happen in twenty lines of NumPy.
Read tutorial
A retrieval system answers in four milliseconds over a million vectors. Your first instinct is that the index must be computing similarity faster than…
Read tutorial
The run failed. The trace is four hundred lines long. Your instinct says the model is dumb — and that instinct is almost always the first thing to throw…
Read tutorial
Two retrievers return two different top-5 lists for the same query. You merge them, and the merged order looks like it was decided by a coin flip. It…
Read tutorial
A citation marker is a promise. The sentence says this passage backs me up. Most RAG evaluations never check whether the promise holds — they check whether…
Read tutorial
The agent remembered everything and still gave the wrong answer. That is the failure this drill is built to prevent.
Read tutorial
Most teams add hybrid retrieval because a vendor page promised better accuracy, then never check whether it helped their own corpus. This exercise forces…
Read tutorial
A query returns a sentence the source no longer contains. The team blames the model. The model is innocent — the index is still holding a chunk that was…
Read tutorial
Retrieval worked. Three chunks came back, all relevant, all cited. Two of them disagree. Now what?
Read tutorial
Most teams pick agents or workflows by vibe. The demo looked smart, the diagram looked clean, and nobody wrote down what the choice would cost per run.…
Read tutorial