Data as of Sep 17, 2026 · Based on 350 AI responses from ChatGPT Search and Google AI Mode · See how Parse measures this
For resolving difficulties with specific, detail-oriented questions, LlamaIndex serves as the primary recommended framework. It is specifically designed to handle advanced retrieval methods like sentence-window and hierarchical indexing, which keep document context intact. While
LlamaIndex is widely viewed as the most direct path to implementing these strategies, other tools like Haystack,
, or ColBERT-based libraries are available if your needs shift toward production-grade pipelines or agentic workflows.
Brands AI recommends here
Named in 81% of answers
The best-fit framework for advanced retrieval strategies. It offers purpose-built tools for sentence-window and hierarchical retrieval, making it highly effective for improving output accuracy on specific questions.
Named in 73% of answers
Named in 49% of answers
Named in 15% of answers
When dealing with hyper-specific, detail-oriented questions, the gold standard framework for advanced retrieval strategies like sentence-window retrieval is **LlamaIndex**.[[1]](https://atlan.com/know/advanced-rag-techniques/) LlamaIndex was built natively around data structuring, node parsing relationships, and…
When dealing with hyper-specific, detail-oriented questions, the gold standard framework for advanced retrieval strategies like sentence-window retrieval is LlamaIndex.
LlamaIndex was built natively around data structuring, node parsing relationships, and granular chunking. Its abstractions make implementing sentence-window retrieval (and its close cousin, parent-child chunking) seamless.
SentenceWindowNodeParser out-of-the-box. It parses your documents down to individual sentences for high-precision embedding matching, while automatically embedding the surrounding context (e.g., 1 sentence before and 1 sentence after) into the metadata.MetadataReplacementPostProcessor that automatically swaps the single matched sentence with the larger window text right before sending it to the LLM for generation.ParentDocumentRetriever.Standard RAG creates a mismatch: large chunks dilute the embedding precision (the specific fact gets lost in a sea of unrelated words), but tiny chunks leave the LLM starving for context ("What does 'it' refer to in this sentence?").
Sentence-window indexing solves this by balancing mathematical precision during vector search with rich contextual delivery during generation.
Would you like a quick code snippet using LlamaIndex to set up a Sentence-Window Retriever , or are you interested in comparing it with parent-child chunking for your specific data format?
For very specific, detail-heavy questions, I’d move beyond “retrieve the top-k chunks” and use a **multi-stage retrieval framework**. Sentence-window retrieval is particularly useful because it separates the unit you *index* from the context you *give the LLM*. ## A practical advanced-RAG framework Think of retrieval…
For very specific, detail-heavy questions, I’d move beyond “retrieve the top-k chunks” and use a multi-stage retrieval framework. Sentence-window retrieval is particularly useful because it separates the unit you index from the context you give the LLM.
Think of retrieval as:
Query → Candidate generation → Precise matching → Context expansion → Reranking → Context assembly → Answer
Instead of embedding arbitrary 500-token chunks, split documents into sentences and embed each sentence independently.
For every sentence, retain metadata such as:
sentence_id
document_id
section_id
position_in_section
position_in_document
Then, if sentence S42 is retrieved, expand it to something like:
S39
S40
S41
[S42 ← matched sentence]
S43
S44
S45
This is the core idea behind sentence-window retrieval: retrieve using a precise semantic unit, but provide the model with its surrounding context.
This tends to help questions such as:
“What exact exception does section 4.2 make for customers who cancel after renewal?” because the answer may be concentrated in one sentence while the qualification appears immediately before or after it.
A strong production pipeline often combines:
For highly specific questions, hybrid retrieval + reranking is usually more important than simply increasing top_k.
A useful pattern is:
┌─ Dense retrieval ─────┐
Query ──────────────┼─ BM25 retrieval ──────┼─> 50–100 candidates
└─ Metadata retrieval ──┘
│
▼
Reranker
│
▼
Top 5–10
│
▼
Context expansion
│
▼
LLM
Don't ask your vector database to perfectly identify the final 5 passages.
Let the first stage maximize recall, then let a reranker maximize precision.
This is the part many RAG systems miss.
Suppose the retriever finds:
Sentence 183:
"However, this limitation does not apply to enterprise accounts..."
That sentence is highly relevant, but by itself the LLM may not know what “this limitation” refers to.
Your retrieval layer should therefore resolve something like:
def expand(sentence, window=2):
return sentences[
sentence.position - window :
sentence.position + window + 1
]
You can make the window dynamic:
high-confidence exact match → ±1 sentence
semantic match → ±2–3 sentences
cross-reference detected → retrieve referenced section
definition detected → retrieve definition + surrounding context
For difficult questions, first determine what kind of retrieval the question requires.
For example:
“Under what circumstances can an enterprise customer terminate the agreement without the 30-day notice requirement?” can become:
Entity: enterprise customer
Concept: termination
Constraint: without 30-day notice
Document relationship: agreement
Potential evidence:
- termination clause
- notice clause
- enterprise exception
- definitions
Then retrieve for each component rather than embedding the entire question once.
This is especially valuable for questions involving multiple constraints.
Don't flatten your documents into anonymous chunks.
Represent something closer to:
Document
└── Chapter
└── Section
└── Subsection
└── Sentence
Then retrieval can move up and down the hierarchy.
For example:
retrieve sentence
↓
expand to paragraph
↓
inspect subsection
↓
retrieve referenced section if necessary
This combines sentence-window retrieval + hierarchical retrieval, which is often substantially more useful for technical documentation, contracts, manuals, and research papers.
For your particular problem, I'd start with this architecture:
USER QUESTION
│
▼
Query understanding
│
┌────────────┼────────────┐
▼ ▼ ▼
Dense BM25 Metadata
search search filters
│ │ │
└────────────┼────────────┘
▼
Candidate pool
50–100
│
▼
Reranker
Top 10
│
┌─────────┴─────────┐
▼ ▼
Sentence window Parent section
│ │
└─────────┬─────────┘
▼
Context dedup/
ordering
│
▼
LLM
Retrieve small, reason over larger context.
That's the fundamental advantage of sentence-window retrieval.
You don't necessarily want to embed 1,000-token chunks just because the LLM needs 1,000 tokens of context. You can index fine-grained units for precision and reconstruct broader context after retrieval.
For especially difficult RAG systems, I'd go one step further and add iterative retrieval:
Question
↓
Initial retrieval
↓
Can the evidence answer the question?
├── yes → answer
└── no
↓
Identify missing information
↓
Second retrieval
↓
Answer
That turns RAG from “find similar text” into an evidence acquisition system, which is generally a much better mental model for detail-oriented questions.
No sources cited
For detail-oriented, precise questions where standard chunking splits apart critical context, **LlamaIndex** is widely considered the gold standard and best-suited framework for sentence-window retrieval. While frameworks like **LangChain** can implement it via custom setups or its `ParentDocumentRetriever` ,…
For detail-oriented, precise questions where standard chunking splits apart critical context, LlamaIndex is widely considered the gold standard and best-suited framework for sentence-window retrieval.
While frameworks like LangChain can implement it via custom setups or its ParentDocumentRetriever , LlamaIndex provides native, first-class abstractions built specifically for advanced data structuring and retrieval granularity.
SentenceWindowNodeParser out of the box, which automatically parses documents down to individual sentences and embeds metadata mapping to the surrounding k-sentences before and after.To help narrow down the best path forward, tell me:
If your RAG system is failing on **very specific, detail-oriented questions**, I’d strongly recommend **LlamaIndex** as the framework to explore first. It has a particularly broad set of retrieval abstractions, including sentence-window retrieval, small-to-big retrieval, auto-merging, hybrid/BM25 retrieval, reranking,…
If your RAG system is failing on very specific, detail-oriented questions, I’d strongly recommend LlamaIndex as the framework to explore first. It has a particularly broad set of retrieval abstractions, including sentence-window retrieval, small-to-big retrieval, auto-merging, hybrid/BM25 retrieval, reranking, query fusion, recursive retrieval, and query decomposition.
The key idea behind sentence-window retrieval is to separate the retrieval unit from the generation context:
This is useful for questions like:
"What was the exact threshold mentioned for X under condition Y?" A large 500–1,000-token chunk may have a mediocre embedding because it contains lots of unrelated text. A single highly relevant sentence can have a much stronger semantic match. But the neighboring sentences often contain the qualifications needed to answer correctly. LlamaIndex explicitly describes this as embedding a sentence while linking it to a surrounding window for synthesis.
For your use case, I wouldn't stop at sentence-window retrieval. I'd build something roughly like:
User Query
│
Query transformation
│
┌─────────────┴─────────────┐
│ │
Dense retrieval BM25 / keyword
│ │
└─────────────┬─────────────┘
│
Candidate pool
│
Reranker
│
Sentence-level hits
│
Expand windows
│
Context deduplication
│
LLM synthesis
LlamaIndex supports these pieces as composable retrieval/querying components. Its current retriever documentation specifically groups hybrid search, reranking, auto-merging, metadata replacement, query fusion, recursive retrieval, routing, and ensemble retrieval among its advanced retrieval capabilities.
| Problem | Strategy I'd try |
|---|---|
| Exact detail buried in a paragraph | Sentence-window retrieval |
| Relevant sentence lacks surrounding context | Sentence window / small-to-big |
| Several adjacent chunks are independently retrieved | Auto-merging retrieval |
| Exact terminology/numbers matter | BM25 + dense hybrid |
| Dense retrieval returns approximately relevant passages | Reranking |
| Question has multiple aspects | Query decomposition / sub-question retrieval |
| Relevant information is spread across a document hierarchy | Recursive/hierarchical retrieval |
| Multiple formulations of the question could find different evidence | Query fusion |
| Documents have useful metadata | Metadata filtering + semantic retrieval |
Auto-merging is particularly interesting as the next step beyond sentence windows: LlamaIndex can retrieve small leaf nodes and recursively merge them into larger parent contexts when enough related pieces have been retrieved.
I'd use LlamaIndex + sentence-window retrieval + reranking + hybrid search as your first serious upgrade.
The important architectural principle is:
Retrieve narrowly, but synthesize broadly. Don't make your embedding chunks enormous just to give the LLM context. Instead, make the retrieval representation highly precise and reconstruct the necessary context after retrieval. That's exactly the motivation LlamaIndex gives for decoupling retrieval chunks from synthesis chunks.
Then build an evaluation set containing the specific questions your current RAG gets wrong. Measure retrieval recall separately from answer correctness—otherwise you won't know whether the problem is "we didn't retrieve the right sentence" or "we retrieved it but the LLM failed to use it."
If you're choosing between LlamaIndex, LangChain, Haystack, and a custom retrieval stack, I'd pick LlamaIndex specifically for this advanced-retrieval-heavy use case. Its retriever ecosystem is unusually well suited to experimenting with these strategies.
If your RAG system is failing on **very specific, detail-oriented questions**, I’d move beyond “better embeddings + top-k” and adopt a **multi-stage retrieval framework** where retrieval granularity and answer context are deliberately separated. For this use case, **LlamaIndex is probably the best framework to start…
If your RAG system is failing on very specific, detail-oriented questions, I’d move beyond “better embeddings + top-k” and adopt a multi-stage retrieval framework where retrieval granularity and answer context are deliberately separated.
For this use case, LlamaIndex is probably the best framework to start with, particularly because it has first-class implementations of sentence-window retrieval, auto-merging/hierarchical retrieval, recursive retrieval, query fusion, reranking, and metadata-based retrieval.
Think of advanced RAG as:
Query → query expansion → fine-grained retrieval → reranking → context expansion → answer
This is the first thing I'd try for your problem.
Instead of embedding 500–1,000-token chunks, split documents into individual sentences and embed each sentence. When a sentence matches the query, retrieve the surrounding sentences as context.
For example:
Retrieved
↓
... previous sentence
→ The retention period is 90 days. ← semantic match
... following sentence
... next sentence
The embedding represents the highly specific sentence, while the LLM receives the surrounding window.
LlamaIndex's SentenceWindowNodeParser and MetadataReplacementNodePostProcessor implement exactly this pattern. Its documented default is five sentences on either side, although you can tune that.
This is especially useful when your questions look like:
The key advantage is precision at retrieval time without sacrificing context at generation time.
Don't let your vector DB's top-k be the final decision.
A strong pipeline is:
Vector/BM25 retrieval
↓
top 30
↓
reranker
↓
top 5–10
↓
context expansion
↓
LLM
For highly specific questions, this often matters more than endlessly tuning the embedding model.
I'd also strongly consider hybrid retrieval:
Query
/ \
BM25 Dense
\ /
Fusion
↓
Reranker
Dense retrieval catches semantic matches; BM25 is particularly valuable when the question contains exact identifiers, terminology, numbers, product names, section references, etc. LlamaIndex provides BM25, fusion, and reciprocal-rerank-fusion retrievers as part of its retrieval stack.
Sentence windows aren't always enough.
Suppose your relevant information is scattered across several sentences or paragraphs:
Document
│
┌──────┴──────┐
Section Section
│
┌───┼───┐
chunk chunk chunk
↑ ↑
retrieved retrieved
A hierarchical index can retrieve the small pieces first, then merge them into their larger parent context when enough related children are retrieved.
LlamaIndex's AutoMergingRetriever does this by retrieving leaf nodes and recursively merging nodes that share a parent.
This gives you a useful principle:
Retrieve small; synthesize large. That is one of the most important ideas in advanced RAG.
For large corpora, you can also create a hierarchy such as:
Document
↓
Document summary
↓
Section
↓
Paragraph
↓
Sentence
Instead of asking your vector DB to find the exact sentence across thousands of documents, first identify the relevant document/section and then drill down.
LlamaIndex calls this recursive retrieval and supports document summaries that map back to their underlying chunks.
This becomes particularly powerful when you have hundreds or thousands of documents.
For your particular problem, I'd experiment in roughly this order:
USER QUERY
│
▼
Query rewriting / expansion
│
┌──────────┴──────────┐
▼ ▼
BM25 Dense search
│ │
└──────────┬──────────┘
▼
Fusion / dedupe
│
▼
Top ~20-50
│
▼
Reranker
│
Top 5-10
│
┌──────────┴──────────┐
▼ ▼
Sentence window Hierarchical
expansion auto-merge
│ │
└──────────┬──────────┘
▼
Context builder
│
▼
LLM
You don't necessarily need every component. I'd build incrementally.
Baseline
chunking → embeddings → vector search → top-k → LLM
↓
First upgrade
sentence retrieval → sentence window → LLM
↓
Second
BM25 + dense → fusion → reranker → sentence window
↓
Third
fine-grained retrieval
↓
hierarchical/auto-merging context
↓
LLM
↓
For really difficult queries
query decomposition
↓
multiple retrieval operations
↓
fusion/reranking
↓
hierarchical context expansion
↓
LLM
LlamaIndex explicitly supports query fusion, recursive retrieval, auto-merging, routing, ensemble retrieval, metadata filtering, and other composed retrieval approaches, so it provides a fairly cohesive framework for experimenting with this progression.
Don't assume that the fanciest retriever will automatically perform better.
Create a small evaluation set of your actual failure cases, perhaps 100–300 questions, and measure:
Then compare:
Baseline
vs.
Sentence Window
vs.
Hybrid + Reranker
vs.
Sentence Window + Reranker
vs.
Auto-Merging
vs.
Hybrid + Reranker + Auto-Merging
LlamaIndex's own advanced-retrieval material emphasizes evaluation rather than assuming advanced retrieval is inherently better.
If I had to pick one starting point for your exact symptom, I'd choose:
LlamaIndex + sentence-level embeddings + sentence-window expansion + hybrid BM25/dense retrieval + reranking. Then add auto-merging/hierarchical retrieval if your difficult questions frequently require information spanning multiple paragraphs or sections.
Sentence windows aren't always enough.
Suppose your relevant information is scattered across several sentences or paragraphs:
Document
│
┌──────┴──────┐
Section Section
│
┌───┼───┐
chunk chunk chunk
↑ ↑
retrieved retrieved
A hierarchical index can retrieve the small pieces first, then merge them into their larger parent context when enough related children are retrieved.
LlamaIndex's AutoMergingRetriever does this by retrieving leaf nodes and recursively merging nodes that share a parent.
This gives you a useful principle:
Retrieve small; synthesize large. That is one of the most important ideas in advanced RAG.
For large corpora, you can also create a hierarchy such as:
Document
↓
Document summary
↓
Section
↓
Paragraph
↓
Sentence
Instead of asking your vector DB to find the exact sentence across thousands of documents, first identify the relevant document/section and then drill down.
LlamaIndex calls this recursive retrieval and supports document summaries that map back to their underlying chunks.
This becomes particularly powerful when you have hundreds or thousands of documents.
For your particular problem, I'd experiment in roughly this order:
USER QUERY
│
▼
Query rewriting / expansion
│
┌──────────┴──────────┐
▼ ▼
BM25 Dense search
│ │
└──────────┬──────────┘
▼
Fusion / dedupe
│
▼
Top ~20-50
│
▼
Reranker
│
Top 5-10
│
┌──────────┴──────────┐
▼ ▼
Sentence window Hierarchical
expansion auto-merge
│ │
└──────────┬──────────┘
▼
Context builder
│
▼
LLM
You don't necessarily need every component. I'd build incrementally.
Baseline
chunking → embeddings → vector search → top-k → LLM
↓
First upgrade
sentence retrieval → sentence window → LLM
↓
Second
BM25 + dense → fusion → reranker → sentence window
↓
Third
fine-grained retrieval
↓
hierarchical/auto-merging context
↓
LLM
↓
For really difficult queries
query decomposition
↓
multiple retrieval operations
↓
fusion/reranking
↓
hierarchical context expansion
↓
LLM
LlamaIndex explicitly supports query fusion, recursive retrieval, auto-merging, routing, ensemble retrieval, metadata filtering, and other composed retrieval approaches, so it provides a fairly cohesive framework for experimenting with this progression.
The best framework for implementing sentence-window retrieval is **[LlamaIndex](https://www.llamaindex.ai/)** , because it provides native, first-class abstractions like `SentenceWindowNodeParser` and `MetadataReplacementPostProcessor` specifically designed for this pattern. While alternative frameworks like…
The best framework for implementing sentence-window retrieval is LlamaIndex , because it provides native, first-class abstractions like SentenceWindowNodeParser and MetadataReplacementPostProcessor specifically designed for this pattern. While alternative frameworks like LangChain support parent-child or document-retrieval hierarchies, LlamaIndex reduces sentence-window implementation down to a few standard configuration lines.
Traditional RAG chops documents into large chunks (e.g., 512 or 1024 tokens) to preserve context, which dilutes exact semantic matches for precise facts. Conversely, tiny chunks (single sentences) provide high precision during vector matching but starve the LLM of surrounding context during generation.
Sentence-window retrieval solves this trade-off by:
| Framework | Native Support for Sentence-Window | Best Alternative Feature | Complexity |
|---|---|---|---|
| LlamaIndex | SentenceWindowNodeParser | Metadata replacement post-processing | Low |
| LangChain | ParentDocumentRetriever (similar hierarchy) | Flexible chain composition | Medium |
| Haystack | Custom component required | Modular node routing | Medium-High |
If you want, I can share a short Python code snippet using LlamaIndex to set up sentence-window parsing and metadata replacement, or we can look into hybrid search / reranking as an alternative approach. What stack or vector database are you currently using?
When it comes to advanced, detail-oriented retrieval strategies like **sentence-window retrieval** or **auto-merging/hierarchical chunking** , the undisputed gold standard framework is LlamaIndex.[](https://www.youtube.com/watch?v=UGCfUyzKHQk)…
When it comes to advanced, detail-oriented retrieval strategies like sentence-window retrieval or auto-merging/hierarchical chunking , the undisputed gold standard framework is LlamaIndex.
While LangChain is phenomenal for agentic workflows, complex orchestration, and chaining multiple tool calls, LlamaIndex was built natively around data structuring, indexing depth, and advanced retrieval mechanics.
Why LlamaIndex Wins for Sentence-Window Retrieval
SentenceWindowNodeParser and MetadataReplacementNodePostProcessor.Alternative Frameworks to Consider
If you'd like, I can:
SentenceWindowNodeParser in LlamaIndexLet me know how you'd like to proceed!
If your main problem is **very specific, detail-oriented questions**, I’d strongly consider **LlamaIndex** as the framework to build the retrieval layer around. It has first-class abstractions for sentence-window retrieval and, more importantly, lets you compose several retrieval strategies rather than locking you…
If your main problem is very specific, detail-oriented questions, I’d strongly consider LlamaIndex as the framework to build the retrieval layer around. It has first-class abstractions for sentence-window retrieval and, more importantly, lets you compose several retrieval strategies rather than locking you into one RAG pattern.
A particularly useful pattern is sentence-window retrieval:
So the retrieval unit is small and precise, while the generation context is larger and coherent. LlamaIndex specifically describes this as decoupling the chunks used for retrieval from those used for synthesis.
For example:
Document:
... sentence 41
sentence 42
sentence 43 ← highly relevant
sentence 44
sentence 45
sentence 46
...
Embedding search
↓
retrieve sentence 43
↓
expand ±3 sentences
↓
LLM receives 40–46
That can outperform conventional 500–1000-token chunking when the answer hinges on a single sentence, number, exception, definition, or technical detail.
For difficult RAG, I'd build a retrieval stack roughly like this:
User query
│
Query understanding
│
┌───────────────┼───────────────┐
↓ ↓ ↓
Dense search BM25/keyword Metadata filters
│ │ │
└───────────────┼───────────────┘
↓
Fusion / RRF
↓
Reranker
↓
Sentence-window expansion
↓
LLM synthesis
LlamaIndex supports the individual pieces: hybrid/BM25 retrieval, reciprocal-rank fusion, reranking, metadata filtering, recursive/auto-merging retrieval, routing, and sentence-window retrieval.
| Failure you're seeing | Strategy I'd try |
|---|---|
| Answer is buried in a paragraph | Sentence-window retrieval |
| Exact terminology/numbers aren't retrieved | BM25 + dense hybrid search |
| Correct chunk is retrieved but ranked too low | Reranker |
| Relevant sentence lacks surrounding context | Sentence window / parent retrieval |
| Information is spread across chunks | Auto-merging / hierarchical retrieval |
| Question references a particular document/year/product | Metadata filtering |
| Question contains several distinct sub-questions | Query decomposition / sub-question retrieval |
| Relevant information can be phrased many ways | Query expansion / HyDE |
| Corpus contains many document types | Router retriever |
LlamaIndex's current retriever documentation explicitly groups these into advanced, auto-, knowledge-graph, and composed/hierarchical retrieval approaches.
If you're currently doing:
chunk → embed → top-k → LLM
I'd evolve it incrementally:
sentence indexing
↓
dense + BM25 retrieval
↓
RRF fusion
↓
cross-encoder/LLM reranking
↓
sentence-window expansion
↓
LLM
Then add metadata filters and hierarchical/recursive retrieval if your corpus is large.
The important conceptual shift is: don't make the chunk simultaneously responsible for retrieval and generation. A tiny sentence can be an excellent retrieval representation while being terrible context for an LLM. Conversely, a huge chunk may provide excellent context but have a poor embedding because the relevant detail is diluted. LlamaIndex explicitly recommends separating those two concerns.
So, if you're asking “what framework gives me the most useful toolbox for advanced RAG rather than just vector search?”, my answer is LlamaIndex, particularly its composable retriever architecture.
If you tell me what your current stack is (e.g. LangChain + Pinecone/Qdrant/Weaviate/pgvector), I can also show you exactly how I'd upgrade your existing pipeline without rewriting the whole system.
For a RAG system that fails on **highly specific, detail-oriented questions**, the problem is usually not the LLM—it is the **retrieval granularity and context assembly strategy**. For advanced retrieval patterns like **sentence-window retrieval**, I would generally start with **LlamaIndex** because it is designed…
For a RAG system that fails on highly specific, detail-oriented questions, the problem is usually not the LLM—it is the retrieval granularity and context assembly strategy. For advanced retrieval patterns like sentence-window retrieval, I would generally start with LlamaIndex because it is designed around indexing and retrieval workflows and has first-class abstractions for techniques such as sentence-window retrieval, recursive retrieval, and hierarchical retrieval.
Use this when your core problem is:
Sentence-window retrieval is a good example:
This gives you fine-grained recall without losing local context. LlamaIndex also supports related patterns like auto-merging and recursive retrieval, which are useful when facts are distributed across sections.
A typical architecture:
Documents
↓
Sentence-level nodes
↓
Vector retrieval
↓
Window expansion (+/- N sentences)
↓
Reranker
↓
LLM answer generation
Choose LangChain if you need:
It can absolutely implement advanced retrieval, but you will often assemble more pieces yourself (custom retrievers, compressors, parent-document strategies, etc.).
A common production pattern is:
LlamaIndex → retrieval layer
LangChain/LangGraph → application orchestration
For detail-heavy QA, I would benchmark these in order:
Best for:
Combine:
BM25 keyword search
+
embedding similarity search
Vector search alone often misses exact identifiers, numbers, names, error codes, and terminology.
Retrieve broadly, then rerank:
Top 50 candidates
↓
Cross-encoder reranker
↓
Top 5 contexts
This often improves precision more than changing the vector database.
Store:
Example:
Retrieve:
"Section 4.2: timeout defaults"
Return:
Full surrounding configuration section
For questions like:
"What changed in version X, and how does it affect authentication failures?" Break into:
For a document QA system where accuracy matters:
LlamaIndex
+
sentence-window retrieval
+
hybrid search
+
reranker
+
metadata filtering
+
RAG evaluation suite
For an agentic product:
LangGraph/LangChain
+
LlamaIndex retrieval backend
+
reranking
+
evaluation loop
The biggest gains usually come from improving retrieval recall and ranking, not from switching LLMs. For very specific questions, a well-designed retriever feeding a smaller model often beats a larger model receiving poor context.
When it comes to advanced, granular retrieval patterns like **sentence-window retrieval** (where you match precise individual sentences during vector search but feed a wider surrounding context window to the LLM), the undisputed leader out-of-the-box is…
When it comes to advanced, granular retrieval patterns like sentence-window retrieval (where you match precise individual sentences during vector search but feed a wider surrounding context window to the LLM), the undisputed leader out-of-the-box is LlamaIndex.
Why LlamaIndex Wins for Sentence-Window Retrieval
SentenceWindowNodeParser to split text at the sentence level and MetadataReplacementPostProcessor to seamlessly swap the matched sentence with its surrounding context window before generation.ParentDocumentRetriever ), whereas LlamaIndex has built-in conceptual models tailored specifically for small-to-big retrieval paradigms.Alternative Frameworks to Consider
Would you like me to share a quick code snippet showing how to set up a sentence-window retriever using LlamaIndex, or are you interested in comparing it with parent-child chunking first?