Order the stages of a LlamaIndex RAG pipeline from raw data to a query response
- 1QueryEngine. The assembled retrieve then synthesize entrypoint
- 2Index. Nodes organized into a queryable structure (vector / keyword / tree)
- 3ResponseSynthesizer. Composes the final answer from retrieved Nodes
- 4Retriever. Pulls candidate Nodes for a query from the Index
- 5Node. Chunk of a Document with metadata (text, hash, source)
- 6Document. Raw file or string loaded from a data source
LlamaIndex flows Document → Node → Index at ingest, then Retriever → ResponseSynthesizer at query, packaged as a QueryEngine for callers.
Picture turning a stack of books into a library you can ask questions of. You start with the books themselves. You cut each book into chapter-sized cards, each card stamped with its book and page number. You file the cards on shelves organized by topic so you can find them fast. When someone asks a question, a librarian pulls the few most relevant cards from the shelves and a writer turns those cards into a single short answer. The whole assembled service, librarian plus writer behind one counter, is what visitors actually use. They never see the cards, the shelves, or the books directly.
Detailed answer & concept explanation~6 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.
5 minutes: the six stages in order, the swap points, and the design choices each stage captures.
from llama_index.core import VectorStoreIndex, SimpleDirectoryReader
from llama_index.core.node_parser import SentenceWindowNodeParser
from llama_index.core.response_synthesizers import get_response_synthesizer
# Doc -> Nodes
docs = SimpleDirectoryReader('./data').load_data()
parser = SentenceWindowNodeParser.from_defaults(window_size=3)
nodes = parser.get_nodes_from_documents(docs)
# Nodes -> Index
index = VectorStoreIndex(nodes)
# Retriever + Synthesizer -> QueryEngine
retriever = index.as_retriever(similarity_top_k=5)
synth = get_response_synthesizer(response_mode='tree_summarize')
query_engine = index.as_query_engine(retriever=retriever, response_synthesizer=synth)
response = query_engine.query('What did the postmortem identify as the root cause?')Real products, models, and research that use this idea.
- LlamaIndex 0.13 ships the canonical Document → Node → Index → QueryEngine pipeline as the default RAG flow.
- LlamaParse converts PDFs into Documents with preserved structure before NodeParser chunking, used heavily in enterprise document RAG.
- Cohere Rerank attaches as a NodePostprocessor between Retriever and ResponseSynthesizer in many production pipelines.
- Notion-style internal search systems frequently use LlamaIndex's auto-merging retriever to balance chunk-level recall with passage-level coherence.
What an interviewer would ask next. Try answering before peeking at the approach.
QHow would you wire Cohere Rerank into this pipeline without touching the Retriever or Synthesizer?
QWhat happens to citation propagation if you replace VectorStoreIndex with TreeIndex?
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.
Trying to query a Document directly without going through Nodes and an Index, then wondering why retrieval quality is poor.
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.