How does LlamaIndex Document to Node to Index pipeline differ from LangChain Runnable model?
LlamaIndex is a data-shaped LLM framework whose primitives line up on an ingestion to query path: Document → Node → Index → QueryEngine.
Picture a research librarian's workflow. A messy stack of papers arrives. That is a Document. The librarian cuts each paper into labelled note cards. Those are Nodes. The cards go into a filing cabinet with a clever lookup system. That is the Index. When a reader asks a question, the librarian's lookup and summarise routine pulls the right cards, trims them, and reads back an answer. That is the QueryEngine. LlamaIndex builds this whole library for you. LangChain, by contrast, gives you a kit of generic pipes for connecting any step to any other step, and you decide how to play librarian yourself.
Concept explanation~2 min read
Everything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example. Click to expand.
Concept explanation~2 min read
Everything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example. Click to expand.
LlamaIndex is often described as 'the RAG framework' and LangChain as 'the everything framework.' That framing is half right and half misleading. The durable difference is not what each framework can do, both can do most of what the other can, but the worldview each encodes in its primitives.
LlamaIndex's worldview is data-shaped. The primitives line up on the path from a raw input to a final answer, and the framework's opinions cluster around that path. LangChain's worldview is composition-shaped. The primitives are uniform Runnables you wire together, and the framework is deliberately neutral about what flows through them.
A candidate who can articulate that difference, and then walk Document → Node → Index → QueryEngine without losing the through-line, has done the work to choose the right framework for a real workload.
Document. The unit of raw input
A Document wraps a string of text plus metadata (source, file path, page number, custom fields). Loaders cover the usual suspects: SimpleDirectoryReader for files, NotionPageReader, SlackReader, DatabaseReader, and a long tail of community connectors via LlamaHub.
The Document is intentionally fat. It can hold relationship pointers to other Documents (parent, child, source) and arbitrary metadata that survives every downstream transformation. That metadata is what later lets MetadataFilters constrain retrieval to a particular author, date range, or tenant.
If you skip the metadata at ingestion time, you cannot recover it at query time without re-ingesting. Treat Document metadata as a schema decision, not an afterthought.
Situations where this technique stops working.
2–4 min · Everything important, quickly.
from llama_index.core import (
SimpleDirectoryReader,
VectorStoreIndex,
Settings,
)
from llama_index.core.node_parser import SentenceSplitter
Settings.node_parser = SentenceSplitter(chunk_size=512, chunk_overlap=64)
docs = SimpleDirectoryReader("./papers").load_data() # Documents
index = VectorStoreIndex.from_documents(docs) # Documents -> Nodes -> Index
query_engine = index.as_query_engine(similarity_top_k=5)
response = query_engine.query("Summarise the methodology section.")
print(response)
| Aspect | LlamaIndex (data-shaped) | LangChain (composition-shaped) |
|---|---|---|
| Core unit | Document → Node → Index → QueryEngine | Runnable composed via LCEL |
| RAG ergonomics | First-class. The framework IS a RAG pipeline | Assembled from generic Runnable pieces |
| Agent surface | AgentRunner / AgentWorker split | AgentExecutor (deprecated path) → LangGraph |
| Best fit workload | Retrieval-heavy, data-centric apps | Mixed composition, multi-step orchestration |
Real products, models, and research that use this idea.
- Replit's code-context retrieval uses LlamaIndex-style chunking with neighbour metadata to ground completions
- Notion AI's enterprise search ingests Documents through a parser to index pipeline that mirrors the LlamaIndex shape
What an interviewer would ask next. Try answering before peeking at the approach.
QWhen would you prefer SummaryIndex or TreeIndex over VectorStoreIndex?
Talk about workloads where hierarchical summarisation or full-corpus coverage beats top-k similarity. Long-document QA, comprehensive summaries, low-recall vector setups.
Red flags & common mistakes
The phrases that signal junior thinking. Click to expand.
Red flags & common mistakes
The phrases that signal junior thinking. Click to expand.
Calling LlamaIndex 'a RAG library' and stopping there. The same primitives also power agent and workflow surfaces, and the data-shaped framing is the durable insight.
60 second bullets to scan on the way to the call.
The four core primitives in order
What a NodeParser does and why neighbour metadata matters
Primary sources. Browse if you want the original framing.
Same topic, related formats. Practice these next.