r/Rag • • 14h ago

Showcase I tested 4 PDF to Markdown converters: most of them leave page headers and page numbers in your text.

0 Upvotes

Full disclosure first: one of the four is ours (Siteiz - runs in the browser).

I wanted to know how it really compares, so I tried to make the test fair.

I created 8 documents and turned them into PDFs with Chrome, LaTeX and Word. That way I knew exactly what the right output should look like, and could check every heading, list and table. I added one scanned page too.

What surprised me:

  • Three of the four tools left page headers, footers and page numbers in the text. If you chunk that for RAG, the same "Annual Report 2025, Page 3" line ends up in almost every chunk. Ours removed most of them, the others almost none.
  • PyMuPDF4LLM was the best at tables.
  • MarkItDown didn't create a single heading from any PDF, and on the LaTeX files it turned normal paragraphs into tables with one word per cell.
  • Two-column pages still get mixed up by most tools.
  • For scans you need OCR whichever tool you use. With OCR on, ours and PyMuPDF4LLM both got about 95% of the words.

All the scores, the test PDFs and the scoring script are here if you want to check my work or run it on your own converter: https://siteiz.com/learn/pdf-to-markdown-converter-benchmark

What are you using for PDFs? I'm planning to add Docling and Marker next.


r/Rag • • 12h ago

Showcase What we learned building RAG over 13,000 pages of Indian company filings (41% → 93% hit rate@10)

12 Upvotes

We want to answer questions about Indian listed companies from their own filings, eventually for thousands of companies. Before building at that scale, we ran a five-company pilot: 13K pages of annual reports, results, concall transcripts and investor decks. Every choice was tested on a frozen question set, one variable at a time.

Search that finds the right page went from 41% to 93% (hit rate@10, 250 questions).

Why not just let an agent search? An agent's search is only as good as the retriever under it. Good retrieval means the model reads ten relevant passages instead of whole 300-page reports: cheaper, faster, and every answer can point to its page.

What we learned:

  • Parsing is the foundation. We picked the parser on number fidelity, checking every number it printed against the PDF's text layer. If a number doesn't survive parsing, no retriever can find it.
  • Metadata beat models. Reading company, year and doc type out of the question, used as a soft filter, gave more than switching embedding models.
  • One line of context per chunk (company · period · standalone or consolidated) was the biggest chunking win, and the returned text was unchanged.
  • Hybrid BM25 + dense hurt. On filings that repeat every year, the two lists only agreed on look-alikes: last year's report, the same slide in the next deck.
  • A reranker on the top 50 was the cheapest big gain: +10 questions, none lost.
  • Multi-fact questions: split into sub-queries and merge round-robin. Reranking the merged list against the original question undid the gain.
  • Open the output behind every score change. Our most convincing "improvements" were bugs.

Along the way we fixed two bugs in Docling's PDF parser, now merged upstream.

Full write-up with all the numbers and what failed:RAG from first principles


r/Rag • • 7h ago

Showcase What I learned running hybrid retrieval over 5M chunks of my own papers and code

3 Upvotes

I've been running BM25 + embeddings (RRF) over my own library: 373k files, 5.0M chunks of research PDFs, Word manuscripts, lab code and 57 cloned repos. I wrote 30 questions with a known right file and scored exactly what the retriever returns at a 2,000-token budget. Some results surprised me.

1. Keyword beat hybrid on my own files. Right file in the top 5: BM25 alone 60%, hybrid 50%. On BEIR SciFact it's the other way round (nDCG@10 0.658 vs 0.714). Code-heavy libraries are full of exact identifiers, and BM25 nails those. I ship both and default to hybrid, but I wouldn't assume embeddings help on a codebase without measuring.

2. The biggest quality bug wasn't retrieval. A third of my index (2.3M chunks) was stored twice. Re-ingest never deleted rows, and when I split a folder into its repos, every file lived in both projects. Results came back in pairs. Pruning deleted and moved paths did more for result quality than any ranking change I tried.

3. Don't let a chunk cross a page. A chunk that runs from the bottom of page 11 into page 12 gets cited as the wrong page. Splitting on page, slide and notebook-cell boundaries is what lets the top hit cite the right page/slide/line 99.2% of the time on 240 planted facts.

4. Embedding the first 600 characters is almost as good as embedding all of them. Chunks average ~1,200 chars. Embedding the whole chunk moved SciFact from 0.714 to 0.723 and doubled indexing time on a laptop.

5. The baseline to beat is grep, since that's what coding agents do. Ripgrep, ranked by keyword overlap: 23% right file in the top 5, 14.6 s, and a 50,000-file match list. It found 0 of the 5 paper questions, because it can't read PDF.

Still unsolved: conceptual questions over big repos ("where does X scale positions to a volatility target") find the right repo 16/17 times but the exact file only 7/17.

Stack, if useful: SQLite FTS5, nomic-embed-text v1.5 (local), IVF-PQ in NumPy (7 ms p50 at 6.5M vectors). The code and the eval script are here, MIT. I built it: https://github.com/pbathuri/cartograph

For people who've indexed mixed code + prose: did you split them into separate indexes, or tune fusion weights per source?


r/Rag • • 4h ago

Showcase I made a beginner-friendly video about Chunking and Embeddings in RAG

2 Upvotes

I've been learning about Retrieval-Augmented Generation (RAG), and I wanted to explain two fundamental concepts that are important when building RAG applications.

1. Chunking

Breaking documents into smaller, meaningful sections so relevant information can be retrieved.

2. Embeddings

Converting text into numerical vector representations that help retrieval systems identify semantically similar content.

I created a short educational video explaining how these concepts work together in a RAG pipeline.

I'm sharing my own work from Beyond the Token, a new channel focused on AI and software engineering.

🎥 Watch here: https://www.youtube.com/shorts/CzTHn-q9LVg

I'd appreciate honest technical feedback.

What's the most common mistake beginners make when implementing chunking and embeddings?


r/Rag • • 7h ago

Discussion What did you all put in your internal RAG at work?

2 Upvotes

We're building one for a mid-sized company. So far it's the wiki, the policy docs, the support tickets and part of the shared drive (after a LOT of cleanup!!).

Meeting transcripts keep coming up....but they're scattered everywhere. Some sit in the meeting platforms, some in people's own note apps, some on phones. I'm not sure they're worth the mess of pulling together.


r/Rag • • 10h ago

Discussion A RAG system can retrieve the right information and still return an outdated answer. I tested this across 5K and 12K changing facts.

1 Upvotes

One problem I've been particularly interested in is how AI systems handle information that changes over time.

Consider a simple example:

Monday: A supplier's warehouse address is Mumbai.
Tuesday: The warehouse moves to Pune.
Wednesday: You ask an AI agent for the shipping address.

Both addresses are genuine. Both may be available to the retrieval system. But only one is current.

I ran several experiments to understand how different memory approaches handle this.

1. A 12,000-fact benchmark — three seeds

Changing-fact completions and paraphrases:

  • NEXUS: 3 errors / 1,200 trials (0.25%)
  • Strong RAG: 78 errors / 1,200 trials (6.5%)

Obsolete values on updated records:

  • NEXUS: 0 / 342 (0%)
  • Strong RAG: 36 / 342 (10.53%)

2. A separate 5,000-fact free-generation experiment

We updated 30% of the stored facts and let the model generate its own answers.

An interesting result: RAG achieved 99.0% top-5 retrieval recall, but:

  • 18.6% of its answers to update queries contained the obsolete value.
  • 39.3% failed to return the current value.

NEXUS recorded:

  • 0.0% obsolete answers.
  • 0.1% failure to return the current value.

This illustrates why retrieval recall alone may not tell us whether an AI system can answer correctly after a fact changes.

Some important context:

  • The strong RAG baseline used hybrid keyword and dense retrieval with reranking.
  • The baseline had access to old and new records and was instructed to use the newest value.
  • The 12K changing-fact comparison was evaluated across three seeds.
  • The 5K free-generation experiment used one seed.
  • These are internal evaluations by ARSA AI, not independent third-party results.

NEXUS does not win every test.

On a broader schema-free evaluation involving unfamiliar fields, NEXUS answered 78.0% of answerable questions correctly, compared with 87.2% for RAG. It also had a higher wrong-stored-value rate in that test.

That tells us the results depend on the workload, configuration and type of information being tested.

I'm building NEXUS, and I'm sharing these experiments because I want technical criticism, particularly around evaluation design.

For people building production RAG and AI memory systems:

How are you handling corrections, conflicting versions and deletion?

Are you using metadata, versioning, temporal databases, reranking, or a separate memory layer?

I'd particularly appreciate suggestions for stronger baselines and ways to make these evaluations more representative of real production workloads.


r/Rag • • 14h ago

Discussion Query rewrite - I struggle

3 Upvotes

If you work on conversational RAG, sooner or later you will encounter query rewriting. I am really struggling with it. To explain the problem here is an example conversation and what I do to resolve pronouns and query history context:

The conversation is about hedgehogs (what else).

User: Tell me about hedgehogs

Assistant: Provides information about hedgehogs.

User: What do they eat?

Assistant: Earthworms, beetles, slugs, caterpillars, millipedes, earwigs, and spiders. Snails if nothing else is available.

What does query rewriting do?

The query first enters salient referent resolution. At the moment of writing, I use heuristic scoring of recent topic mentions, grammatical role, singular/plural, main noun and mention frequency.

If a candidate passes the confidence threshold they is replaced with hedgehogs:

Retrieval query: What do hedgehogs eat?

If the reference remains missing or ambiguous, the query is marked underspecified. In this case a LLM attempts a rewrite using only the newest assistant answer. The LLM answer must pass validation.

If the validation fails or no answer exists the user gets an explanation of the failure and is asked to clarify her query.

Why is it difficult?

User: Are they mammals?

Or: Is it a mammal?

The user knows they mean hedgehogs. Conversional RAG must establish that connection from the available conversation and grammatical signals. Multiple candidate subjects, singular/plural differences, and ambiguous wording make this difficult.

Query splitting

User: What do hedgehogs eat? Create a table.

Retrieval question: What do hedgehogs eat?

Answer operation: Create a table.

After reference resolution succeeded, the splitter separates the query content from the answer instructions. "Create a table" is an irrelevant search term for the indexed queries. This is done through a LLM call. A decomposition that invents entities or drops unresolved references is once retried with additional instructions to preserve references and avoid invented entities. A simple standalone question can be retained instead of a rejected split. Other failures produce a clarification request to the user.

Translation

Each accepted retrieval question is normalized according to the selected retrieval-language mode. English-oriented flows translate when required; native multilingual flows retain the query language. Indexed retrieval can translate the retrieval query into the configured target languages before searching. (Document load created language specific indexes).

Retrieval gates block still queries marked underspecified. Therefore changing the language will not resolve uncertainty about what they or diese means.

Conclusion

Modern chat LLMs handle query rewrite remarkably well. Users might forget what is required to connect "they, it" to earlier turns.

Building a conversational RAG system makes the problem visible. The retrieval layer requires an explicit standalone query. So the conversational RAG must provide it, without inventing never mentioned entities.

Because modern chat LLMs handle this so reliably, there must be techniques beyond the simple heuristics I use currently.

How do you solve this problem?

  • Classical coreference resolution?
  • LLM-based rewriting?
  • Embedding similarity against conversation history?
  • Conversation memory structures?
  • Something else?

Thank you for your ideas!


r/Rag • • 16h ago

Discussion What is the most common failure you've encountered when deploying RAG in production?

2 Upvotes

I've been thinking about the gap between a RAG demo and a production RAG system.

In a demo, things often look simple:

  1. Upload documents.
  2. Create embeddings.
  3. Retrieve relevant chunks.
  4. Send them to an LLM.
  5. Display an answer with citations.

But production systems introduce much harder problems. For example:

  • Retrieval returns relevant-looking but incomplete context.
  • The LLM combines facts from unrelated passages.
  • The answer includes conclusions that aren't supported by the sources.
  • Citations exist, but don't actually support individual claims.
  • The system answers questions even when the available evidence is insufficient.

I'm particularly interested in the difference between citation validation and actual semantic grounding—a citation can point to a real document while still failing to support the statement associated with it.

For those who have worked on production RAG systems, what has caused you the most trouble?

  • Retrieval quality
  • Chunking and document structure
  • Hallucination detection
  • Citation and evidence verification
  • Evaluation and monitoring

I'm interested in practical experiences and engineering approaches, especially failures that weren't obvious during initial testing.