Practical AI

RAG is a search problem before it is an AI problem

Retrieval-augmented generation sounds fancy until you ship it. Then the hard part is not the model. It is getting the right chunk in front of the model at the right time.

~6 minAI
scroll
01 · the trap

The model cannot answer what it never sees

A lot of teams start RAG by arguing about models. Bigger context window. Better embedding model. New reranker. Useful, sure. But the first failure is usually simpler: the answer was never retrieved. Once that happens, the model is decorating an empty plate.

zsh · missing context

The most common RAG bug looks boring in the logs.

guardrails armed

Hit the button and watch the hidden AI surface area light up.

02 · the pipeline

Chunking is product design

A chunk is not just a blob of text. It is a unit of meaning. If you split a policy table away from its heading, retrieval can find the table and lose the question it answers. If you make chunks huge, every match becomes noisy. Good RAG starts with boring document hygiene: titles, hierarchy, dates, owners, and clean boundaries.

chunking/checklist.js

Metadata is part of the answer. Treat it like source code, not decoration.

03 · the measurement

Measure retrieval before generation

Before you judge answer quality, run a tiny harness that asks: did the retriever find the document a human would use? That gives you a clean signal. If retrieval failed, fix search. If retrieval passed and the answer is bad, fix prompting, context shape, or the model.

AI launch switchboard
sloppy
shippable0
fragile: the model is still freelancing without enough checks

Flip the switches and watch the story turn into a tiny operating model.

0starter questions can expose the obvious misses
0signals to log: query, retrieved ids, answer
0owner for each source keeps docs from rotting
04 · the loop

The best RAG systems are edited weekly

Your corpus changes. User language changes. Product names drift. So the system needs a weekly rhythm: inspect misses, merge duplicate docs, add synonyms, retire stale chunks, and replay the eval set. The glamorous part is the chat box. The durable part is search ops.

source trail