Architecting RAG that actually ships
Retrieval-augmented generation is easy to demo and hard to ship. Here's the pipeline I reach for — chunking, embeddings, reranking and citations — and the failure modes to design around.
Everyone can wire an embedding model to a vector store and get a demo working in an afternoon. Getting RAG to answer reliably from real data, with citations, in production — that's the actual work.
Start with retrieval, not the model
Most RAG quality problems are retrieval problems. If the right chunk never makes it into the context window, no model can save you. I spend most of my time on chunking strategy, embeddings and reranking before touching the prompt.
Chunk on meaning, not character count. Split on headings and semantic boundaries so a chunk is a self-contained idea. Overlap a little so context isn't cut mid-thought.
Rerank before you trust
Vector search gives you recall; a reranker gives you precision. Pull a wider set of candidates with embeddings, then rerank the top-k so the model reads the best few, not the merely-similar many.
Cite everything
Ground every answer in retrieved sources and surface the citations in the UI. It's the difference between a toy and a tool people trust — and it turns hallucinations into visible, debuggable retrieval misses.
The pattern that ships: chunk well, embed, retrieve wide, rerank, answer with citations, and log every step so you can see exactly where a bad answer came from.
More writing
iAspirants — the best UPSC AI preparation platform
A complete tour of iAspirants, an AI-powered UPSC preparation platform that brings the best UPSC current affairs, daily Prelims MCQ practice, PYQs, AI Mains answer evaluation, smart notes, mind maps and performance analytics together in one place.
Next.js on the edge: streaming, RSC and speed
React Server Components and the edge runtime change how you build for speed. A practical look at streaming, where to render, and keeping Core Web Vitals green.
From API call to agents in production
Calling an LLM API is the easy 10%. The real engineering is the system around it — tools, guardrails, retries and human-in-the-loop. Notes from wiring agents into real products.