Urgent.News

600+ sources. One page. See who else covered it.

Editions

Tech

RAG vs. Direct Context: I Tested Both on Real Documents, Here's What Broke

A hands-on test of BGE-M3 + Qwen3 (RAG vs. direct-context answering) on a real research paper and a full-length book including a retrieval bug hiding in a footnote, and one surprisingly good model behavior. I wanted to answer a simple question: when you feed a document to an AI model, is it actually reading it or just pattern-matching to whatever text happens to look similar to your question? So…

I conducted a hands-on test comparing BGE-M3 + Qwen3 (RAG vs. direct-context answering) on real documents, including a research paper and a book. The goal was to determine if AI models are actually reading the document or merely pattern-matching to text that resembles the question. I built an open-source pipeline to generate separate answers for each approach.

For the research paper, both RAG and direct answers agreed on the topic of the paper, which presented a transformer-based bidirectional machine translation system for the legal domain. The RAG approach retrieved chunks from the document, while the direct answer read the raw text. The retrieval process was straightforward, using fixed-size chunking and plain cosine similarity without any fancy tricks.

However, when testing a full-length book, RAG failed to provide an accurate answer. It mistakenly identified a footnote in the dedication as the paper's main contribution, which was almost word-for-word a title of a blog post. This issue stemmed from the model not filtering out the front matter, such as dedications, acknowledgments, and footnotes, before processing the text. In contrast, the direct answer correctly identified the document as a book review and promotional content for a specific work.

On a more positive note, when asked a more specific question about the book, RAG performed exceptionally well. It accurately stated that the retrieved context did not include a relevant answer to the question about the main contribution of the paper. This demonstrated that RAG can work effectively when the retrieved context genuinely lacks the necessary information, as opposed to providing incorrect or misleading answers.

Written by urgent.news from Dev.to's reporting — not their text. Machine-written — it may contain errors, so check the original before relying on it.

Read the original at dev.to →

More in Tech

AWS WAF Challenge : bloquer les bots avant qu’ils n’atteignent l’application

Quand on m’a appelé, l’attaque durait depuis environ une semaine. Elle visait la page de connexion d’une application historique qui générait son HTML côté serveur.

  • Attack targeted legacy application's login page
  • Million queries from vast IP addresses, ineffective IP blocking
  • AWS WAF Challenge feature placed at infrastructure layer

Why RAG on legal text keeps hallucinating dates - and what actually fixed it

A couple of weeks ago I dropped the CRA text (the EU's cybersecurity regulation for IoT devices) into ChatGPT and asked when the main requirements actually kick in.

  • ChatGPT incorrectly stated CRA regulation entered force in 2024, 3 years off.
  • Dispersed dates in EU regulation PDF caused AI confusion.
  • Platanor rebuilt repository with proper file structure to fix RAG hallucinations.