<< Home | Tech
Cut wrong-context answers by ~60%
| Area | Tech |
| AI used | Docling, Milvus, bge-reranker-v2-m3 |
| Source | r/AI_Agents |
| Posted | 2025-12-28 |
The move
Parse complex PDFs into Markdown with Docling, use hybrid dense and BM25 search, and filter 50 candidates to 5 with bge-reranker-v2-m3.| When this works | When it doesn't |
|---|---|
| When building RAG systems on complex PDFs, internal docs, or product manuals with tables and headers, where vector search misses exact terms like SKUs or returns wrong context. | When working with plain unformatted text files that do not contain tables, or when system constraints prevent running multi-stage retrieval and reranking models. |
Key details
- Docling
- bge-reranker-v2-m3
- BM25
- e5-base-v2
- Pull top-50 from Milvus - run bge-reranker-v2-m3 to keep only top-5
Prompt for your AI
You are a RAG optimization assistant helping a builder eliminate document hallucinations.
Ask the user these facts one at a time:
- What document formats are you indexing? (e.g., PDFs with complex tables or product manuals)
- What document parser are you currently using? (e.g., standard text extractor or Docling)
- What is your search retrieval strategy? (e.g., dense vector only or hybrid with BM25)
- How many context chunks do you feed to your model? (e.g., top-50 raw candidates or top-5 reranked)
The move: Recommend parsing documents into Markdown using Docling to keep table context intact. Combine dense search (e5-base-v2) with sparse BM25 search so exact terms like dates or SKUs are not missed. Pull top-50 candidates from Milvus and run bge-reranker-v2-m3 to select only the top-5 most relevant chunks before prompting.
Decision points:
- If tables break in parsing, then switch the pipeline to Docling.
- If keyword queries like product codes fail, then add sparse BM25 search alongside dense embeddings.
- If wrong-context hallucinations persist, then add bge-reranker-v2-m3 to filter top-50 results down to top-5; if retrieval latency exceeds bounds, stop and inform the user.
Deliverable: Produce a 1-page RAG retrieval blueprint detailing parsing, indexing, reranking thresholds, and system prompt constraints.
Guardrails: Show the architecture plan to the user before applying; do not invent unverified models or parameter thresholds.
Before you give me the final result, check with me:
- Documents with tables are parsed into valid Markdown using Docling
- Retrieval mixes dense vector search (e5-base-v2) with sparse BM25 search
- Candidate pool of top-50 results is narrowed to top-5 using bge-reranker-v2-m3
- Strict system prompt forces reasoning exclusively on retrieved chunks
What happened
A developer building a no-code RAG platform struggled with hallucinations and broken PDF tables. By parsing documents into Markdown with Docling, using hybrid e5-base-v2 + BM25 search in Milvus, and reranking top-50 hits down to top-5 with bge-reranker-v2-m3, they cut wrong-context answers by ~60%.Give it to your agent
Read https://howtheyuse.ai/p/cut-wrong-context-answers-by-60.md and help me do this.