Pick between LlamaIndex and LangChain for a fresh RAG pipeline and defend the choice on default-effort grounds
You are starting a RAG pipeline from scratch on a corpus of 50,000 PDFs. Pick either LlamaIndex or LangChain, and defend the choice on default-effort grounds, what is each framework optimised for, and where does the default path go straight at your problem versus around it?
LlamaIndex wins on data-shaped RAG (its primitives are RAG nouns). LangChain wins on composition-shaped agentic RAG (its Runnables compose with everything else).
Imagine two kitchens. One has every cabinet labelled 'flour,' 'sugar,' 'eggs,' and dedicated bowls for whisking, kneading, and proofing. The other has a generic set of mixing tools that work for any recipe but nothing is pre-labelled. If you mostly bake bread, the bread-shaped kitchen wins on day one because everything you need is right where you expect it. If you bake bread sometimes and stir-fry other times, the generic kitchen wins because the same tools work for both. LlamaIndex is the bread kitchen for RAG; LangChain is the generic kitchen for everything-including-RAG.
Detailed answer & concept explanation~7 min readEverything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example. Click to expand.
Everything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example. Click to expand.
Everything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example.
Everything important, quickly.
6 min: LlamaIndex's RAG-native primitives + LangChain's composition strength + the data-shape vs composition-shape axis + production hybrid pattern + when to combine both + migration cost mechanics.
Real products, models, and research that use this idea.
- Notion AI's document-search backend reportedly uses LlamaIndex-style data primitives because the corpus shape is the defining constraint.
- Klarna's customer-support agent uses LangChain for the multi-step agent workflow with retrieval as one of many tool calls.
- Harvey AI (legal RAG) combines high-fidelity LlamaParse ingestion with custom retrieval logic; the data layer leans LlamaIndex-shaped.
- Perplexity's search and synthesize pipeline composes retrieval with multi-step LLM orchestration; the shape is closer to LangChain's Runnable model.
- Linear's AI features run LangGraph for the workflow plus retrieval logic that could be either framework's responsibility; representative of the hybrid pattern.
What an interviewer would ask next. Try answering before peeking at the approach.
QWalk through a hybrid pattern that uses both frameworks.
QWhen would you actually pick LangChain over LlamaIndex for a pure RAG pipeline?
Don't say thisRed flags and common mistakes that signal junior thinking. Click to expand.
Red flags and common mistakes that signal junior thinking. Click to expand.
Picking LangChain for a pure RAG pipeline because it is more popular, then hand-rolling response synthesizers, node postprocessors, and router query engines that LlamaIndex ships out of the box.
The night-before-the-interview bullets. Scan these on the way to the call.
Primary sources. Skim if you want the original framing.
Same topic, related formats. Practice these next.