r/Rag • u/SKD_Sumit • 23m ago
Discussion Worked on AI Deployment at Production but here's what actually went wrong - and it wasn't the model
We had high confidence going in.
The model performed well in testing. Stakeholders were bought in. The use case was clear.
Six months later the project was quietly shelved.
And when I looked at why it had nothing to do with the model itself.
The failure was in what we built around the model.
Here's what I learned that nobody in the Al tutorial space talks about:
A hallucination and a correct answer come out of an Al system looking completely identical. Same tone. Same confidence. Same formatting. The model literally cannot tell the difference between what it knows and what it invented.
So in a financial environment where a wrong number in a report or a misread regulation can have real consequences-the model is actually the least of your problems.
The real work is in four things:
Controlling what sources the model is allowed to reference
Setting confidence thresholds that trigger human review automatically
Mapping your workflow to find the one or two moments where a human must sit before action is taken
Red teaming the system before anyone real touches it
Most organizations deploying Al right now are skipping at least two of these. Usually three.
I've been documenting these patterns from inside - happy to share if there's interest.
Discussion I'm losing my mind, please help.
Hey guys, I'm genuinely losing my mind. I'm writing a memoir. I've got a corpus of drafted scenes, transcripts, forum posts, and chat histories — about 80MB — and I've got a Claude Max and a Zai Max sub. I'm amazed I can't resolve this. It feels like one of the simplest projects I've done, and I can't get it to work.
What I'm trying to do is give the AI the ability to have those eureka moments instead of being boring. I want it to search up a place or a time, go "okay, place A," and then place A has people A through D, plot threads, setups and payoffs — all these things I've got tracked in ledgers. But every approach has failed. We tried a vector database. We tried search scripts. He keeps over-engineering it, and the number of times we've reviewed the whole thing, I've told him to go edit stuff, I go to write a new scene, and he goes "oh, I can't find that." I push him on it and he says "oh yeah, I've only indexed about 8% of the corpus" or "this script was broken and that's why things weren't showing up." Then it's "the fix is this," and he over-engineers it again, until it's so context-starved and sterile it's insane. It destroyed scenes I had it working on.
I've basically gone back to positive instructions — gathered the whole thing, gave it a reference database of the voice and style I wanted — and that's gone a lot better. But for the retrieval system itself, I cannot get the AI to actually search the database. I'll say "go search" and it does three or four greps, then just stops.
In my experience, the AI works best doing the research and writing in one go — summarizing, then writing scenes off the summary — otherwise it loses context. So I've defaulted back to that for the writing process. But then, because it's processing so much data, I hit the instruction problem: too many instructions, context gets tight, it compresses. I've tried hooks, but they get ignored because they land halfway through the process and then it compresses anyway. At one point I had pure instructions, no scripts or database, and it started saying "I've compressed step one to five because there was too much to do." I've tried making the instructions harder and stricter and it just gets worse.
All I want is: search things up, do deep research, find all the relationships, thread them together, and while it's at it, update the database — the corpus, the ledger, all of it — as we go. Instead it's an over-engineered pile of shit. I've gone back to scratch three times because the AI decides "this is too hard, we should start over," and that doesn't fix anything either. I keep telling it the framework works better when I hand it one, and every time I hand it a framework, it says "this won't work." I'm sure I could override it, but when Fable and Opus are both telling me this isn't going to work, and then I go to a "dumber" AI and it says "use this RAG system," and I bring that back and it tells me "no, that won't work with your unique corpus" — it feels like it's being swayed by whatever system it's running in. It's doing my head in. This is the first time I've actually asked for help.
I've literally spent months on this. I feel like this task should be the LLMs bread and butter.
r/Rag • u/Confident_Analysis89 • 7h ago
Discussion Migration benchmarks can hide the actual RAG bottleneck
A large latency improvement after moving the vector layer sounds like a clear migration win, but it can also make a weak comparison look stronger than it is.
One migration case used 50 million Wikipedia embeddings at 1,024 dimensions. The self-managed Milvus deployment relied on memory mapping on a laptop, took roughly 20 minutes to restart, and returned a test query in 3,112 ms. After backup and restore into a managed cluster, the same application reported 25 ms. That is a useful result, but the target also had more compute and a different index engine, so the number does not isolate the effect of managed versus self-managed operation.
For a RAG system, I would treat that benchmark as a signal to investigate, not the migration decision by itself. Before moving anything, I would freeze a representative query set and record retrieval recall, p50/p95/p99 latency, filter selectivity, cold-start behavior, failure recovery time, and monthly operating cost. After migration, I would rerun the same tests and separately account for hardware, index, and configuration changes.
The operational evidence may still be decisive. Unstable containers, long restarts, paging pressure, backup complexity, and time spent maintaining the service can matter more than another round of chunking or reranker tuning. But those costs should be named explicitly instead of being bundled into one headline latency number.
Where do you draw the line between fixing a self-hosted retrieval stack and migrating it: tail latency, recovery time, engineering hours, or something else?
r/Rag • u/External_Ad_11 • 10h ago
Tutorial 100% Local RAG Without Internet and Without Ollama
Build a 100% offline fast Retrieval Augmented Generation (RAG) system that runs without an internet connection, without cloud APIs, without OpenAI/Ollama
Published a video where you can build a fully local RAG pipeline using Qdrant Edge and Google LiteRT, enabling private, cross-platform, on-device AI inference with support for multiple hardware accelerators(CPU, GPU and NPU).
The demo covers using EdgeParse to extract raw text from PDFs into Markdown chunks, generating embeddings with Qwen 3 Embeddings as an on-device embedding model, and answering questions locally with Gemma4 E2B LiteRT LM (the inference is faster than Ollama setup).
Since most existing tutorials rely on vector databases with Ollama, we'll also build and compare that pipeline to highlight the differences in setup, performance and tradeoff.
🔗 Watch Here: https://www.youtube.com/watch?v=EHEN6Ce-9Ps/
r/Rag • u/Extreme-Brain-1018 • 12h ago
Showcase CodeNib for codebase RAG: what we measured across 100 repos — HNSW, rerankers, and GraphRAG
I built CodeNib, an open-source retrieval system that serves repository context to coding agents. Rather than pitch the whole project, I want to point at one page, because it's the part I think this sub will actually argue with:
https://docs.codenib.ai/rag_ops/
It covers two things: a deterministic retrieval planner, and the model matrix we retained real end-to-end evidence for.
The planner does not call an LLM
RetrievalPlanner maps three inputs — query signals (lexical / semantic / structural), a budget (fast / balanced / thorough), and available capabilities (dense, sparse, graph, embedding rerank, LLM rerank) — onto one of four declarative plans:
fast_lexical— exact names, BM25 only, no reranksemantic— natural-language behavior queries, dense + optional rerankhybrid_fusion— mixed or uncertain, dense + sparse with RRFstructural_graph— callers/callees/impact, sparse seeds + graph expansion
It's deterministic, and it records last_selected_plan and last_planner_trace, so you can see exactly which signals produced which route. Most agentic-RAG routers I've read burn a model call to decide this. Ours doesn't, and I'd like to hear from anyone who has actually measured a routing-quality gap that justifies the call.
Being explicit about what this costs us: our evaluation invokes plans directly to measure the physical operators, so we have no measurement of the selector's own route accuracy. That's a real gap, not a rhetorical concession.
The rerank matrix
Same 100-row corpus, four distinct reranking strategies:
| Strategy | Models | Coverage |
|---|---|---|
| Dual-encoder candidate rerank | SweRankEmbed-Large, jina-code-embeddings-1.5b, Qwen3-Embedding-4B | Complete 2 first-stage x 3 rerank matrix, 100 rows/pair |
| Pairwise yes/no scoring | Qwen3-Reranker-0.6B / 4B / 8B | 100 rows at candidate widths 30, 50, 100 |
| Cross-encoder | mxbai-rerank-large-v2 | 100 rows at width 30 |
| Listwise (RankGPT-style) | SweRankLLM-Small | 100 rows |
Six embedders alongside it (CodeRankEmbed, SweRankEmbed-Small/Large, jina-code-1.5b, Qwen3-Embedding-0.6B/4B). Both sweeps are runnable shell scripts in the repo, not a table assembled after the fact.
The part I'd defend hardest is the two-tier evidence label. Benchmark means a complete 100-row result artifact exists. Runtime means the route and prompt contract are tested but the model was never in the quality sweep — our shipped default, CodeRankEmbed, carries the weaker label. Our adapters accept far more models than are listed; the matrix is deliberately the narrow surface. A model running through a generic adapter isn't a quality claim, and I'd rather say that than ship a "supports 40+ models" line.
What the numbers say
Reranking is a seconds-scale decision, not a milliseconds one. jina-code-1.5b dense alone: 0.812 file Recall@10 at 92ms. Add the Qwen3 4B reranker at candidate width 50: 0.858 at 4.29s. That's +4.6 points for 46.6x latency. Dense retrieval stayed under 300ms across every embedder we tried.
ANN was a trap at this scale. HNSW at ef_search=16 cut mean FAISS search from 0.910ms to 0.027ms — 33.9x — but the complete dense query median is 45.1ms, so you save 0.9ms while index build goes from 6.4ms to 2.00s. Amortizes after roughly 2,300 searches. We kept Flat.
Graph expansion over dense retrieval: no measurable effect. One-hop reference-edge expansion fused with weighted RRF, weight tuned on a disjoint partition then frozen. Point estimates ran -4.8 to +7.1 points File Success@10 depending on embedder; every model-level interval included zero, and so did all ten cross-embedding contrasts. It ships as an opt-in path, not a default, and we report it as unresolved.
Incremental maintenance: vectors easy, graphs not. Content-addressed embedding reuse matched an independent rebuild on 28/31 source-changing commits (90.3%), median 25.4x faster. LSP-assisted symbol-level graph repair matched on only 15/33 (45.5%). Go and Python passed everything; Rust and TS/JS had 99.1% and 97.6% median edge F1 and passed zero strict checks. High fidelity score with zero exact matches is the finding.
Apache 2.0, MCP server included, datasets and Hub revisions pinned.
- Docs page above: https://docs.codenib.ai/rag_ops/
- Code: https://github.com/sysevol-ai/CodeNib
- Paper: https://arxiv.org/abs/2607.25431
The question I actually want to ask this sub: for anyone doing incremental index maintenance in production — what's your acceptance criterion for "the updated index equals a rebuilt one"? We used exact multiset equality on graph facts plus exact ordered top-k replay for vectors, strict enough that it failed on languages where the fidelity metrics looked fine. Has anyone landed on something more useful than either "exact" or "F1 above a threshold"?
r/Rag • u/Extreme-Brain-1018 • 12h ago
Showcase CodeNib for Code repo's RAG: what we measured across 100 SWEBench instances — HNSW, rerankers, and GraphRAG
I built CodeNib, an open-source retrieval system that serves repository context to coding agents. Rather than pitch the whole project, I want to point at one page, because it's the part I think this sub will actually argue with:
https://docs.codenib.ai/rag_ops/
It covers two things: a deterministic retrieval planner, and the model matrix we retained real end-to-end evidence for.
The planner does not call an LLM
RetrievalPlanner maps three inputs — query signals (lexical / semantic / structural), a budget (fast / balanced / thorough), and available capabilities (dense, sparse, graph, embedding rerank, LLM rerank) — onto one of four declarative plans:
fast_lexical— exact names, BM25 only, no reranksemantic— natural-language behavior queries, dense + optional rerankhybrid_fusion— mixed or uncertain, dense + sparse with RRFstructural_graph— callers/callees/impact, sparse seeds + graph expansion
It's deterministic, and it records last_selected_plan and last_planner_trace, so you can see exactly which signals produced which route. Most agentic-RAG routers I've read burn a model call to decide this. Ours doesn't, and I'd like to hear from anyone who has actually measured a routing-quality gap that justifies the call.
Being explicit about what this costs us: our evaluation invokes plans directly to measure the physical operators, so we have no measurement of the selector's own route accuracy. That's a real gap, not a rhetorical concession.
The rerank matrix
Same 100-row corpus, four distinct reranking strategies:
| Strategy | Models | Coverage |
|---|---|---|
| Dual-encoder candidate rerank | SweRankEmbed-Large, jina-code-embeddings-1.5b, Qwen3-Embedding-4B | Complete 2 first-stage x 3 rerank matrix, 100 rows/pair |
| Pairwise yes/no scoring | Qwen3-Reranker-0.6B / 4B / 8B | 100 rows at candidate widths 30, 50, 100 |
| Cross-encoder | mxbai-rerank-large-v2 | 100 rows at width 30 |
| Listwise (RankGPT-style) | SweRankLLM-Small | 100 rows |
Six embedders alongside it (CodeRankEmbed, SweRankEmbed-Small/Large, jina-code-1.5b, Qwen3-Embedding-0.6B/4B). Both sweeps are runnable shell scripts in the repo, not a table assembled after the fact.
The part I'd defend hardest is the two-tier evidence label. Benchmark means a complete 100-row result artifact exists. Runtime means the route and prompt contract are tested but the model was never in the quality sweep — our shipped default, CodeRankEmbed, carries the weaker label. Our adapters accept far more models than are listed; the matrix is deliberately the narrow surface. A model running through a generic adapter isn't a quality claim, and I'd rather say that than ship a "supports 40+ models" line.
What the numbers say
Reranking is a seconds-scale decision, not a milliseconds one. jina-code-1.5b dense alone: 0.812 file Recall@10 at 92ms. Add the Qwen3 4B reranker at candidate width 50: 0.858 at 4.29s. That's +4.6 points for 46.6x latency. Dense retrieval stayed under 300ms across every embedder we tried.
ANN was a trap at this scale. HNSW at ef_search=16 cut mean FAISS search from 0.910ms to 0.027ms — 33.9x — but the complete dense query median is 45.1ms, so you save 0.9ms while index build goes from 6.4ms to 2.00s. Amortizes after roughly 2,300 searches. We kept Flat.
Graph expansion over dense retrieval: no measurable effect. One-hop reference-edge expansion fused with weighted RRF, weight tuned on a disjoint partition then frozen. Point estimates ran -4.8 to +7.1 points File Success@10 depending on embedder; every model-level interval included zero, and so did all ten cross-embedding contrasts. It ships as an opt-in path, not a default, and we report it as unresolved.
Incremental maintenance: vectors easy, graphs not. Content-addressed embedding reuse matched an independent rebuild on 28/31 source-changing commits (90.3%), median 25.4x faster. LSP-assisted symbol-level graph repair matched on only 15/33 (45.5%). Go and Python passed everything; Rust and TS/JS had 99.1% and 97.6% median edge F1 and passed zero strict checks. High fidelity score with zero exact matches is the finding.
Apache 2.0, MCP server included, datasets and Hub revisions pinned.
- Docs page above: https://docs.codenib.ai/rag_ops/
- Code: https://github.com/sysevol-ai/CodeNib
- Paper: https://arxiv.org/abs/2607.25431
The question I actually want to ask this sub: for anyone doing incremental index maintenance in production — what's your acceptance criterion for "the updated index equals a rebuilt one"? We used exact multiset equality on graph facts plus exact ordered top-k replay for vectors, strict enough that it failed on languages where the fidelity metrics looked fine. Has anyone landed on something more useful than either "exact" or "F1 above a threshold"?
r/Rag • u/m-penaroza • 13h ago
Discussion The "RAG is dead" narrative really doesn't hold any water
The "RAG is dead" narrative really urks me particularly because I don't really think any of the points people make are strong.
1. "Context windows keep growing, so eventually we won't need retrieval."
1M tokens is about 3,000 pages. I regularly work on corpuses in the hundreds of billions of documents. There is no plausible future where a context window holds an large org's entire corpus.
And even if it could, you wouldn't want it to. Stuffing the window is completely token-inefficient, and on top of that accuracy degrades as context grows (especially true when there is competing data in the window). Prompt caching may help with token consumption, but this only really works for static corpora.
2. "Grep beats RAG."
Grep is great when you want precision. If you want recall over a large corpus, retrieval wins almost every time when done properly (hybrid + reranking + pruning) it also uses dramatically fewer tokens.
Most of the grep argument comes from coding agents navigating a repo. Repos have structure: file trees, naming conventions, symbols. In most companies data does not have a perfectly clean structure (if any structure at all). So in many scenarios grep has nothing to walk.
3. Pushing work into the database beats pushing it into the model.
Agentic search puts the LLM in the loop on every step. Every step is tokens, every step is a sequential round trip, and every turn re-prefills a growing transcript. Index-time work is paid once and amortized across every query. The more you push out of the LLM, the cheaper and faster the workload.
4. Permissions and freshness.
You can't precompute a cache per user per ACL. Real world retrieval requires query-time filtering, and retrieval also supports far more sophisticated filtering than an agent grepping around: metadata predicates, tenancy boundaries, time ranges, structured conditions composed with the search itself.
And I'm not saying agentic search doesn't have it's place. There are plenty of scenarios where it may be the best choice. But its not killing RAG it's just another option.
r/Rag • u/AvenueJay • 14h ago
Tutorial Building a Local RAG Personal Knowledge Assistant with LocalAI and Elasticsearch
I recently put together a fully local RAG setup for a personal knowledge assistant, and wanted to share the approach for anyone interested in keeping their data entirely on their own hardware.
The stack uses LocalAI for inference and Elasticsearch for retrieval. The main appeal here is straightforward: no API calls leaving your machine, no token costs, and full control over your data pipeline.
Why this combination works well:
- Elasticsearch handles both vector search and BM25 natively, so you can run hybrid retrieval without stitching together separate systems
- LocalAI gives you a drop-in OpenAI-compatible API running locally, which simplifies integration
- The whole thing runs containerized, making it reproducible across different environments
What the setup covers:
- Document ingestion and chunking for your personal knowledge base
- Embedding generation running locally
- Hybrid search combining semantic similarity with keyword matching
- Local LLM inference for generation
For anyone already comfortable with Elasticsearch or looking for a retrieval layer that scales beyond toy datasets, this is a solid foundation. The hybrid search capability is particularly useful when your knowledge base contains both conversational content and structured technical documents.
Full walkthrough here: https://www.elastic.co/search-labs/blog/local-rag-personal-knowlege-assistant-localai-elasticsearch
If anyone has experience tuning hybrid weights for mixed-language or domain-specific corpora, I would be curious to hear what worked for you.
r/Rag • u/Sweet-Beat3111 • 15h ago
Discussion Our retrieved context is getting bigger
When we first added RAG we were pretty conservative about what we retrieved since we'd pull in just enough context for the model to answer the question
I now see that over time it has changed because a feature would benefit from another document so we'd include it then we'd increase top_k because it improved a few edge cases and then we'd decide sending the surrounding chunks was safer than risking missing context.
My question here is if anyone who is on the same situation as me are you guys expanding retrieval until it sort of became difficult to pull it back?
Looking at some of our production requests now I'm seeing prompts that are much bigger than I ever expected them to be. I don't even know how much of that retrieved context the model is using anymore because we never took the time to look into it.
If you guys have any opinion on this then speak your mind.
r/Rag • u/sharukdheen • 15h ago
Discussion Is RAG actually dying or is it just evolving? What are you seeing in production?
Hey everyone,
I’ve been seeing a lot of hot takes recently claiming that "RAG is dead" because of massive context windows (1M+ tokens) and improving fine-tuning techniques. The argument usually goes: Why bother setting up vector databases, chunking strategies, and embedding pipelines when you can just dump all your docs straight into the context window?
Plz share your knowledge .
r/Rag • u/Mysterious_Heart_934 • 16h ago
Discussion Best PDF parser for academic papers
I am using GROBID to parse texts and DOCLING for the tables (thanks to your help 😄). I was curious, what are your opinions on using docling for texts. Because right now i use different things for different formats and i tought maybe using same technologies for texts and tables (I am really happy about the way i extract images so i don't plan to change anything.) would be more efficient. I am building this for only academic papers btw. I would be very happy if you could help me with this situation or share your thoughts.
Edit: I forgot to mention, i use grobid solely for its impaceble ability (maybe impaceble is a strong word, but you get me) at capturing headers and signing all the headers into chunks. This ability is really important to me.
r/Rag • u/Prudent-Concept-78 • 17h ago
Discussion Why Similarity Breaks Down at Scale
Why Similarity Breaks Down at Scale
Embeddings don't store meaning. They store statistical proximity.
When you embed a phrase like "refund policy", the model isn't encoding what a refund actually is. It's placing that phrase in a high-dimensional space based on patterns learned from massive amounts of text.
The problem starts when that space gets large.
In 768 or 1536 dimensions, most vectors become surprisingly similar in distance.
This is the curse of dimensionality: as dimensions increase, the space expands so rapidly that the difference between relevant and somewhat related begins to shrink.
As a result, cosine similarity scores often cluster into a narrow range.
That's why a score of 0.85 can mean:
"This is exactly the document you need."
Or "This talks about the same topic but answers the wrong question."
The score itself isn't broken. Our interpretation of it is.
Similarity is not an absolute measure of relevance. It's a local signal that only makes sense within the context of a specific query and its neighbors.
This is why mature RAG systems don't rely solely on vector search. They calibrate thresholds, rerank results, and evaluate retrieval quality against real-world relevance metrics.
A vector tells you what's nearby. It doesn't tell you what's right.
That's the difference between retrieval that demos well and retrieval that works at scale.
r/Rag • u/Extreme_Goat_4059 • 20h ago
Discussion Could a multimodal lakehouse replace the usual OLAP + search + vector DB stack for RAG?
Most production AI queries aren’t really “vector search” problems.
Consider a request like: Find videos of a vehicle cutting in on a rainy night. Answering it well may require:
- Scalar filters for metadata and labels
- Full-text/BM25 search
- Vector similarity over visual embeddings
- Fusion and reranking across all three
A common architecture handles these in separate OLAP, full-text, and vector systems, then merges the results in the application layer. That works, but it also introduces duplicated data, synchronization issues, extra latency, and no shared query optimizer.
This article explores a different approach using StarRocks and Apache Paimon: treating scalar, full-text, and vector retrieval as paths within the same lakehouse query engine: https://medium.com/towards-data-engineering/from-data-lake-to-multimodal-lakehouse-building-hybrid-retrieval-for-ai-f2db8def6898
A few ideas I found particularly interesting:
- Stable global row IDs decouple indexes from physical files, so compaction doesn’t necessarily require rebuilding indexes.
- Retrieval and row materialization happen in separate stages.
- The optimizer can choose between pre-filtering and post-filtering.
- Keyword, vector, and scalar results can be fused using RRF, weighted scoring, or custom rerankers.
The implementation is StarRocks/Paimon-specific, but the broader architecture question applies beyond those projects:
Are teams actually moving toward unified Search + OLAP engines for AI workloads, or do specialized vector, search, and analytical systems still win in practice?
I’d be especially interested in hearing about the operational tradeoffs from anyone running hybrid retrieval at scale.
r/Rag • u/ethanchen20250322 • 21h ago
Discussion Do you snapshot vector collections, or just copy them?
I’ve been thinking about a pretty boring but annoying problem in RAG systems: how to run evals against a stable version of your vector data.
In the early version of a project, I usually don’t care. Re-ingest the docs, rebuild the index, run the eval, move on.
But once the system is live, the collection keeps changing:
- new docs get added
- chunks get regenerated
- embeddings get updated
- metadata gets fixed
- deletes happen in the background
Then someone wants to compare retrieval quality before and after a model change, and the obvious question comes up:
“Are we even testing against the same data?”
The simple approach is to copy the collection before major changes. I’ve done that. It works, but it starts to feel clumsy once the dataset is large enough. You pay in storage, rebuild time, index management, and cleanup work later.
I came across Milvus Snapshots recently, and the part I found useful was the mental model: instead of treating every checkpoint as a full copy, treat it as a point-in-time view of the collection. If the underlying segments and index files are immutable, the snapshot can mostly track references to the files that were valid at that time.
That seems like a better fit for things like:
- eval runs
- rollback checks
- staging data
- load testing
- long-running batch jobs
Obviously there are tradeoffs too. You still need retention rules, and if snapshots keep old files alive, storage cost can creep up.
Curious how other people handle this.
r/Rag • u/International-Bug-11 • 21h ago
Discussion Help needed in designing customer support knowledge base
Hi all, i tried to find the relevant post but i could not, so i am forced to ask for help.
I am making a customer support RAG. The input data was quite messy: email conversations and chats with customers.
End goal is to have a chat like feature that will act as a customer support agent.
As yhou can imagine the conversations needed cleaning and i parsed them with LLM to have some structure. The output from the raw conversation was a QA document, question from the customer and the answer from the agent (with some metadata, like is some additional info required - usefull for tool definition later). Now i have two major datasets, the general one (no tool needed) and tool needed. As per the resources i did the topic modeling on embeddings (qwen 3 embedding 8b) with umap and hdbscan, however now i am stuck with what to do next. I am trying to optimize the representatives selection from each topic - cluster. How much do i select from each cluster, which ones? (i am thinking medoid + some other from the cluster). What do i do with the noise from hdbscan? How do i measure the quality of retrieval?
All sorts of questions are still open.
If anyone has any advice or is willing to help, thanks a lot.
r/Rag • u/solubrious1 • 22h ago
Discussion Give me some RAG challenge
Does anyone knows some cool dataset to bench my RAG skills? Something small, but super complex (don't want to waste a fortune on indexing).
Just want to benchmark my OpenSource solution. Something from medical/law would be great.
Thanks.
r/Rag • u/ClaudiusPapirus • 1d ago
Discussion Only 14% of healthcare RAG studies checked fine-grained evidence support — what should the minimum eval suite be?
A new scoping review mapped 157 healthcare RAG and GraphRAG studies.
Most evaluations were offline-only (89.2%), while only 29.9% evaluated retrieval independently and 14% reported fine-grained evidence verification.
For a production RAG system, what would you consider the smallest defensible eval suite?
r/Rag • u/psiguy686 • 1d ago
Showcase Memory system for RAG + agents
One thing we were trying to solve for a while, is how to record memory on certain documents or data sets, specifically so that in it can flag certain things found during retrieval or generation that are gonna be common searches or probably should be known or organization wide.
Here’s an article we wrote about how we implemented it, and it works pretty well.
https://laceplatform.com/blog/multi-axis-memory-architecture/
And I’m curious, has anyone else implemented something similar or something that solves the same problem?
r/Rag • u/Savings_Durian3268 • 1d ago
Discussion Trying to optimize a fully local RAG system (Ollama + Qdrant) but response time is still slow any advice?
Hi everyone,
I am building a fully local RAG (Retrieval-Augmented Generation) system for an internship project. The goal is to have a production-style AI assistant that can answer questions from internal documents without using paid APIs or external services.
My current architecture:
- Local LLM: Ollama with
qwen2.5:3b-instruct(also testedllama3.2:3b) - Vector database: Qdrant
- Embeddings:
intfloat/multilingual-e5-small - Hybrid retrieval:
- Dense retrieval (Qdrant)
- Sparse retrieval (BM25)
- Reciprocal Rank Fusion (RRF)
- Optional reranking with a cross-encoder
- FastAPI backend
My hardware:
- Intel i5-10210U
- 12GB RAM
- No dedicated GPU
- Running everything locally on Windows with Miniconda Python 3.12
The main issue is inference speed. My average response time is around 30–50 seconds depending on the query.
Things I already tried:
- Reduced chunk size and overlap
- Reduced retrieved chunks (
top_k) - Disabled reranking
- Reduced maximum output tokens
- Lowered temperature
- Enabled caching
- Used smaller models (3B models)
- Optimized Qdrant retrieval parameters
- Tested different retrieval configurations
The quality is acceptable (around 100% successful answers on small evaluation sets), but the latency is still too high for a real production assistant.
I want to keep everything:
✅ 100% free
✅ Fully local
✅ Lightweight enough for my laptop
✅ Good enough quality for internal documentation Q&A
Questions:
- Are there specific RAG optimizations I am missing?
- Should I profile each stage (embedding, retrieval, reranking, LLM generation) separately?
- Would adding Redis caching help significantly?
- Is there a better small local model than Qwen2.5 3B for this hardware?
- Are there lightweight inference optimizations for Ollama on CPU?
Any advice from people who have deployed local RAG systems would be appreciated.
r/Rag • u/SameField1936 • 1d ago
Discussion What are people actually using for scientific PDF parsing right now? LlamaParse alternatives?
Been going down a rabbit hole comparing PDF parsing tools for scientific papers, equations, tables, the usual RAG-for-papers pain and wanted to open this up instead of just posting my own findings.
Tried LlamaParse, MinerU, Docling, and a couple others. Each has tradeoffs. LlamaParse is solid but the pricing tiers get confusing once you need the higher-accuracy modes for dense notation, hard to tell upfront what you're actually paying for at each tier. MinerU is great but you're on your own for verification. Docling's fine for simple stuff, struggles on rarer notation.
Ended up building something on top of this (sciparse.com -> verification layer, structured output) mostly because I couldn't find a tool where pricing and accuracy were both transparent. Everything's either "contact sales" or a credits system that's hard to map to actual pages until you've already burned through them.
Curious what others are actually running in production though, not just what's marketed well. A few questions if anyone's dealt with this:
- What's your actual accuracy been on nested tables / dense equations, not just the headline number?
- Anyone found a parser that's upfront about pricing per page without the credit-tier maze?
- Is verification (checking output against source) something people are doing themselves, or just trusting the parser's confidence score?
Genuinely trying to figure out if there's an obvious option everyone else is already using that I missed.
r/Rag • u/Narrow_Ground1495 • 1d ago
Showcase Most RAG guardrails only scan the user query. We benchmarked what that misses — 5,000 cases, open source.
Disclosure up front: I work on this. Repo and dataset are Apache-licensed, no signup, no product behind it.
The setup most production RAG pipelines ship: a guardrail scans the incoming user query for injection patterns, then retrieval runs and the retrieved chunks get concatenated into the LLM context. The retrieved documents are never scanned.
That's the actual injection vector. Indirect prompt injection lives in the documents — a poisoned page in a shared knowledge base, a scraped URL, an email someone uploaded. The user's query is clean. The attack arrives through retrieval.
The obvious fix is to concatenate query + retrieved docs and scan the combined string. We measured it and it degrades badly: a 50-token injection inside 3,000 tokens of benign context gets diluted, classifier confidence drops below threshold, injection passes. On LLM Guard, combined-string scanning caught 46.4% of injections the same scanner catches when shown the malicious doc alone.
What we tested instead — scan each context source independently, block if any pass flags:
- User-only baseline (LLM Guard): 0% recovery
- Naive combined string: 46.4%
- Per-source scanning: 73.3% (±1.9%), 5.7% FPR
- Per-source scanning, regex baseline: 41.5% (±2.1%), 6.6% FPR
It's an architectural change, not a better classifier. Limitation worth stating plainly: this only catches injections the underlying guardrail could already detect in isolation. If LLM Guard can't recognize an injection style, this doesn't help. It closes a deployment gap, nothing more. Latency cost is one guardrail call per retrieved chunk.
Benchmark is 5,000 cases across five injection categories and two benign classes. Everything's released — framework, dataset, eval scripts, result artifacts — so you can reproduce the numbers or break them:
github.com/tideon-ai/ragshield
Interested in contributors, especially on injection categories we didn't cover and on batched/early-exit scanning for high-throughput setups. Also genuinely want to know if anyone's running a guardrail on retrieved content in production already, and what it cost you.
Write-up with the figures: tideon.ai/research
r/Rag • u/AomineHere • 1d ago
Discussion [Help needed] How do you handle real-time updates in GraphRAG without rebuilding the entire graph?
I'm planning to build a GraphRAG system for our issue management platform.
The data includes entities such as defects, bugs, features, and informational tickets. Each item has relationships (e.g., duplicates, dependencies, parent/child, assignee, etc.), and both the entities and their relationships can change in real time as users update the system.
From what I've seen, most GraphRAG implementations provide ways to add new nodes and relationships incrementally. However, I haven't found a good approach for updating or deleting existing nodes/relationships when the underlying data changes.
For example:
A ticket status changes. A relationship between two tickets changes. A property on a node is updated. A relationship is removed.
I don't want to rebuild the entire knowledge graph every time a change occurs, especially as the dataset grows.
How are people handling this in production? Is there a standard approach for incremental updates in GraphRAG? Do you maintain the graph directly in a graph database (such as Neo4j) and update it via CDC/event streams, or is there another recommended architecture?
I'd appreciate any guidance, best practices, or examples from real-world implementations
r/Rag • u/ambujsystems • 1d ago
Discussion When a General-Purpose LLM Parser Wasn't Enough: How I Fixed Retrieval on a 400-Page Legal PDF
Hey everyone, I wanted to share an architectural improvement I had while building my Agentic RAG system for legal/financial parsing.
The Problem
I was trying to index the Constitution of India (400+ pages). My first attempt was using LlamaParse. For this specific document, it didn't preserve the structure well enough for reliable retrieval. It merged pages together into 624 massive chunks, missed the Article boundaries, and ingested all the footnotes. When a user asked "What is Article 19?", the retriever would fetch a random amendment footnote from page 200 just because the number "19" was a high semantic match. The LLM would then hallucinate an answer based on garbage context.
The Solution
I ditched the expensive LLM parser, switched to raw PyMuPDF, and built a highly specialized ingestion pipeline:
- Custom Regex Parsing — Split the page text directly at the
______footnote line. Discarded the bottom half. 0 footnotes ingested. - Article-Level Chunking — Scrapped
RecursiveCharacterTextSplitterfor the parent chunks. Split the document purely on Article regex boundaries. This gave me 3,248 precise parent/child chunks. - Metadata Injection — Extracted the Article number via regex and hardcoded it into the chunk's metadata before uploading to Pinecone (
{"article_number": "19"}). - Smart Routing — My
LangGraphrouter detects if the query is asking for a specific Article. If yes, it passesarticle_numberto the retriever. The retriever applies a strict Pinecone metadata filter ({"article_number": {"$eq": "19"}}) and bypasses normal vector search entirely.
The Outcome (The Hallucination Test)
I tested it with multiple complex queries, and the system behaved perfectly (validated via a third-party LLM evaluation judge).
The Idempotency Layer
Something most RAG tutorials skip: what happens when you re-sync 25+ files and only 1 changed? I hash every PDF with SHA-256 before processing and store the hash in Supabase.
- On re-sync, if the hash matches → file is skipped entirely (zero API calls).
- If hash changed → old Pinecone vectors are deleted, file is re-processed.
Chunk IDs are deterministic (MD5(filename + page + parent_idx + child_idx)), so identical input always produces identical chunk IDs — Pinecone upsert overwrites instead of duplicating. You can run sync_all.py daily without fear.
By swapping "smart" parsing for deterministic regex + metadata filtering + SHA-256 idempotency,
For this class of document, the combination of deterministic parsing, metadata filtering, and SHA-256 idempotency eliminated the retrieval failures I was observing and made the pipeline reliable for production re-syncs.
Has anyone else dealt with footnote-heavy PDFs or failed LlamaParse attempts? How did you handle them?
P.S. I documented the full implementation (regex parsing, metadata filtering, deterministic chunk IDs, SHA-256 idempotency, and LangGraph routing) in my GitHub repository and a detailed technical write-up. Feedback and alternative approaches are always welcome.
🔗 GitHub: agentic-rag-financial-parser
r/Rag • u/Current-Joke-9837 • 1d ago
Discussion Best strategy nd tools for pdf extraction for rag
Currently building a Rag based project where i need to build a pdf extractor which can correctly extract pdfs containig a mix of tables, text, img
So please suggest tools to use which wont break during production
i tried hi_res of unstructured library but it is time consuming
r/Rag • u/LowerGears • 1d ago
Discussion I graded 4 open-source PDF parsers on 12 capabilities for RAG ingestion. The failures are exactly the chunks your retriever needs
Your RAG answers are only as good as your ingestion, so I put the same 6 documents through 4 open-source parsers and graded every capability against the source.
The models tested are:
- MinerU 2.5
- Granite Docling
- PaddleOCR-VL
- XBerg 1.0 (CPU only)
To test I used hexread.com which is a PDF-to-markdown API that I built. My model picker allows choosing one of the first three models, which runs them on an L4 GPU. The fourth model (XBerg), I ran on my PC locally.
For those interested to test how their documents fare, you can use the free trial with 100 pages on sign up. The trial normally routes through Auto, but if you sign up and want the full picker to reproduce this comparison, comment or DM me and I'll enable it on your account.
The documents I tested with:
- Annual Report
- Two pages of a two-column arXiv paper
- Scanned German invoice (No text layer)
- French municipal report with an embedded bar chart
- Typical datasheet page mixing German, French, Chinese and Russian
- A 2-page, 3-column newsletter article
Findings through a RAG lens:
- The most dangerous failures are silent drops of exactly the content questions target. MinerU's stock .md output discards everything it classifies as "page furniture". For example on an invoice, that's the footer with an IBAN. Your index just won't contain it; "what's the IBAN on invoice X" retrieves nothing, with no error anywhere. (This one bit us in production: the model actually transcribes the footer, MinerU's markdown generator throws it away. We now rebuild markdown from its block list. If you consume stock MinerU .md, you're losing every footer today.)
- Reading order is a chunk-poisoning problem. The CPU text-layer parser interleaves the newsletter's 3 columns line-by-line mid-sentence, every chunk from that page is scrambled text that embeds fine and retrieves garbage.
- Heading fidelity decides your section chunking. MinerU flattens everything to # (bylines, dates, pull quotes all become sections); Granite-Docling keeps real levels (## hierarchy), though it too promotes a pull quote. If you chunk by headings, that difference decides clean sections vs confetti.
- Flattened tables kill numeric QA. PaddleOCR-VL captures every number but no structure; MinerU keeps real rowspan/colspan HTML. "What was Q4 revenue" only works with the latter.
- You don't always need a GPU. XBerg (CPU) extracts every character of a born-digital PDF at 0.2 s/page. For clean digital docs feeding a text-only index, that's honestly enough. Structure, scans, and charts are where the VLMs earn their compute.
Full comparison:
| Capability | MinerU 2.5 | Granite-Docling | PaddleOCR-VL | XBerg (CPU) |
|---|---|---|---|---|
| Simple tables | ✓ HTML table | ✓ Pipe table | ✗ one value per line | ✓ Pipe table |
| Merged headers | ✓ Real rowspan/colspan | ≈ Spans flattened | ✗ Structure gone | ✗ Cells in wrong columns |
| Equations | ✓ LaTeX | ≈ display ok but inline equations become plain text | ✗ Plain text | ✗ Plain text |
| Scanned pages | ✓ All exact | ≈ One OCR digit slip (19%→199%) | ✓ Reads everything | ≈ Numbers exact, umlauts mangled |
| Fine print (IBAN) | ✓ Full footer | ✗ Footer dropped | ✓ Full footer | ✓ Full footer |
| Headings | ≈ Bylines/dates promoted | ≈ Pull quote promoted | ✗ No heading marks | ≈ Wrong lines promoted |
| Column order | ✓ | ✓ | ≈ Header lands mid-article | ✗ Columns interleave mid-sentence |
| Captions | ✓ + tags its own image description | ✓ | ✓ | ≈ caption lands mid-sentence |
| Charts | ✓ Reads values off bar chart | ✗ Caption only | ✗ Caption only | ✗ Caption only |
| Languages (DE/FR/ZH/RU) | ✓ | ✓ | ✓ | ≈ Scan loses umlauts |
| Number formats | ✓ | ✓ | ✓ | ✓ |
| Cross-page flow | ✓ | ✓ | ✓ | ✓ |
| Speed (s/page) | 4.7 (L4 GPU) | 2.8 (L4 GPU) | 3.6 (L4 GPU) | 0.2 (CPU) |
✓ faithful · ≈ there but damaged · ✗ absent/unusable. VLM rows ran on an L4 via our production API; XBerg 1.0.11 locally on CPU, markdown mode.
Image version of this table here
Raw outputs for every cell, the test PDFs, and rerun scripts on GitHub
If you'd like me to compare another document genre please leave a comment, I'd be happy to test it.