PageSourceSearch

https://verificate.ai/_next/static/chunks/pages/articles/why-rag-hallucinates-30f7fb82fbdc4e2b.js

js verificate.ai collected 2026-10-05 13:58:48 UTC 15,882 bytes, 1 lines download raw bytes

1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[4931],{2944:(e,t,s)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/articles/why-rag-hallucinates",function(){return s(5371)}])},5371:(e,t,s)=>{"use strict";s.r(t),s.d(t,{default:()=>h});var r=s(7876),i=s(8230),n=s.n(i),a=s(5543);let l={slug:"/articles/why-rag-hallucinates",type:"TechArticle",cta:"cti",title:"Why RAG still hallucinates — and what to change first | Verificate",h1:"Why RAG still hallucinates — and what to change first",description:"Your RAG system retrieves the right documents and still gives wrong answers. A practical guide to telling retrieval failures from generation failures, why citations can mislead, and the fixes worth trying before you change architecture.",datePublished:"2026-09-19",readMinutes:7,keywords:["RAG hallucination","why RAG hallucinates","RAG wrong answers","RAG citation errors","retrieval-augmented generation","RAG evaluation","grounded generation"],faq:[{q:"Why does RAG hallucinate even when it retrieves the right document?",a:"Because retrieval and generation are separate steps. Retrieval puts relevant text in front of a language model, but the model still writes the answer. It can overlook the passage, misread it, blend it with what it learned in training, or add detail that is not there."},{q:"Does a citation mean the answer is grounded?",a:"No. A citation shows that a source exists and was available. It does not show that the source supports the specific claim. Check claim support separately from whether the citation resolves."},{q:"How do I tell a retrieval failure from a generation failure?",a:"For each wrong answer, check whether the passage containing the right answer was among the retrieved results. If it was not, it is a retrieval failure. If it was there and the answer is still wrong, it is a generation failure. The fixes are different."},{q:"Should I replace my RAG system?",a:"Not necessarily. Many problems are fixed by better retrieval, a refusal path and claim-level checks. Consider a different approach for the questions where answers must be checkable and repeatable, and where errors are expensive."}]},o=e=>{let{href:t,children:s}=e;return(0,r.jsx)(n(),{href:t,className:"text-[#8CCB43] underline underline-offset-4",children:s})};function h(){return(0,r.jsxs)(a.m7,{meta:l,children:[(0,r.jsx)(a.P,{children:"You built a retrieval-augmented generation (RAG) system. It finds the right documents. It still gives wrong answers, sometimes with a citation attached. This is common, and it is usually not one problem but several. This guide helps you work out which ones you have."}),(0,r.jsx)(a.H2,{children:"Retrieval and generation fail differently"}),(0,r.jsxs)(a.P,{children:["RAG has two steps. First it ",(0,r.jsx)(a.OH,{children:"retrieves"})," passages that look relevant to the question. Then a language model ",(0,r.jsx)(a.OH,{children:"generates"})," an answer with those passages in front of it. Either step can fail, and the fixes are different, so start by separating them."]}),(0,r.jsx)(a.P,{children:"Take a sample of wrong answers. For each one, ask: was the passage containing the correct answer among the retrieved results?"}),(0,r.jsx)(a.UL,{items:[(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(a.OH,{children:"No"})," — a retrieval failure. The model never saw what it needed."]}),(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(a.OH,{children:"Yes"})," — a generation failure. The model had the evidence and still got it wrong."]})]}),(0,r.jsx)(a.P,{children:"Teams often spend months tuning retrieval when most of their remaining errors are generation failures. Count before you tune."}),(0,r.jsx)(a.H2,{children:"Common retrieval failures"}),(0,r.jsx)(a.UL,{items:[(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(a.OH,{children:"The answer is split across chunks."})," Documents are cut into pieces for indexing. A condition in one piece and its exception in another may never be retrieved together."]}),(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(a.OH,{children:"Similar is not the same as relevant."})," Search by meaning finds text that sounds like the question. A superseded policy sounds exactly like the current one."]}),(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(a.OH,{children:"Out-of-date content."})," If old versions stay in the index, they will be retrieved."]}),(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(a.OH,{children:"The answer needs several documents."})," Questions such as “which suppliers are affected by this change?” need many re
1cords joined together, not the top few passages."]})]}),(0,r.jsx)(a.H2,{children:"Common generation failures"}),(0,r.jsx)(a.UL,{items:[(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(a.OH,{children:"Blending."})," The model mixes retrieved text with what it absorbed in training, and the result reads smoothly."]}),(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(a.OH,{children:"Over-reading."})," The passage says “may”; the answer says “will”."]}),(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(a.OH,{children:"Filling gaps."})," When the passages do not quite answer the question, a fluent model tends to complete the picture rather than say so."]}),(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(a.OH,{children:"Lost in the middle."})," With many passages supplied, material in the middle is more easily overlooked."]}),(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(a.OH,{children:"Inconsistency."})," Because generation involves sampling, the same question can produce different answers on different runs."]})]}),(0,r.jsx)(a.H2,{children:"Why a citation can mislead"}),(0,r.jsx)(a.P,{children:"A citation feels like proof. It is worth being precise about what it shows. These are three different checks:"}),(0,r.jsx)(a.UL,{items:[(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(a.OH,{children:"The citation resolves"})," — the source exists and opens."]}),(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(a.OH,{children:"The source supports the claim"})," — it actually says what the answer says."]}),(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(a.OH,{children:"The answer is correct"})," — the claim is true, complete and current."]})]}),(0,r.jsx)(a.P,{children:"A system can score perfectly on the first and poorly on the second. If you report one “citation accuracy” figure, make sure you know which of these it measures."}),(0,r.jsx)(a.H2,{children:"What to change first"}),(0,r.jsx)(a.P,{children:"Before changing architecture, try the cheaper fixes. Many teams get most of the way with these:"}),(0,r.jsx)(a.UL,{items:[(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(a.OH,{children:"Build a test set with unanswerable questions."})," Include questions whose answers are not in your documents. You cannot improve refusal if you never measure it."]}),(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(a.OH,{children:"Add a way to decline."})," Make “the documents do not answer this” an allowed, rewarded outcome."]}),(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(a.OH,{children:"Remove superseded content"})," from the index, or label versions and filter on them."]}),(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(a.OH,{children:"Check claims, not just citations."})," Verify that each cited passage supports the sentence it is attached to."]}),(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(a.OH,{children:"Use fixed rules where the policy is fixed."})," If the decision is “orders over this amount need approval”, write a rule. Do not ask a model to rediscover it each time."]})]}),(0,r.jsx)(a.Pq,{children:"Well-built RAG systems do many of these things. “RAG” describes a pattern, not a quality level — what matters is the whole workflow and how it performs on your questions."}),(0,r.jsx)(a.H2,{children:"When the fixes are not enough"}),(0,r.jsx)(a.P,{children:"Some requirements are hard to meet while a language model is still the step that decides the answer:"}),(0,r.jsx)(a.UL,{items:["The same situation must produce the same decision every time.","Every answer must point to a record a person can inspect.","The system must decline reliably when support is missing.","Errors are costly — financially, legally or to safety."]}),(0,r.jsxs)(a.P,{children:["For those questions, it is worth looking at approaches that move more of the work ahead of the question and reduce what is left to generation. ",(0,r.jsx)(o,{href:"/articles/rag-vs-compile-time-inference",children:"RAG vs Compile-Time Inference"})," compares the two, including what the alternative costs. If a knowledge graph is on your shortlist, see ",(0,r.jsx)(o,{href:"/articles/graphrag-vs-compile-time-inference",children:"GraphRAG vs Compile-Time Inference"}),"."]}),(0,r.jsxs)(a.P,{children:["Whatever you choose, measure it the same way: the ",(0,r.jsx)(o,{href:"/docs/compile-time-inference#evaluation",children:"evaluation guide"})," lists the separate measurements worth reporting."]})]})}},5543:(e,t,s)=>{"use strict";s.d(t,{Cy:()=>g,H2:()=>m,OH:()=>u,P:()=>x,Pq:()=>f,UL:()=>p,m7:()=>w});var r=s(7876),i=s(8230),n=s.n(i),a=s(8419),l=s(6075),o=s(6887),h=s(1298),c=s(8558),d=s(8300);function m(e){let{children:t}=e;return(0,r.jsx)("h2",{className:"mt-12 text-2xl md:text-[28px] font-bold text-white tracking-tight",children:t})}function x(e){let{children:t}=e;return(0,r.jsx)("p",{className:"mt-5 text-[15.5px] text-white/60 leading-relaxed",children:t})}function u(e){let{children:t}=e;return(0,r.jsx)("strong",{className:"text-white font-semibold",children:t})}function p(e){let{items:t}=e;return(0,r.jsx)("ul",{className:"mt-5 space-y-2.5",children:t.map((e,t)=>(0,r.jsxs)("li",{className:"flex gap-3 text-[15.5px] text-white/60 leading-relaxed",children:[(0,r.jsx)("span",{className:"mt-[9px] w-1.5 h-1.5 rounded-full bg-[#8CCB43] shrink-0"}),(0,r.jsx)("span",{children:e})]},t))})}function g(e){let{label:t,code:s}=e;return(0,r.jsxs)("div",{className:"mt-6 rounded-2xl border border-white/[0.08] bg-[#0C0F0A] overflow-hidden",children:[(0,r.jsx)("div",{className:"px-5 py-2.5 border-b border-white/[0.06] font-mono text-xs text-white/45",children:t}),(0,r.jsx)("pre",{className:"px-5 py-4 overflow-x-auto text-[13px] leading-relaxed font-mono text-white/80",children:(0,r.jsx)("code",{children:s})})]})}function f(e){let{children:t}=e;return(0,r.jsx)("div",{className:"mt-6 rounded-2xl border border-[#2C3D1B] bg-[#12190C] px-6 py-5 text-[15px] text-white/70 leading-relaxed",children:t})}function w(e){var t,s,i,m,x;let{meta:u,children:p}=e,g=[{"@context":"https://schema.org","@type":null!=(x=u.type)?x:"TechArticle",headline:u.h1,description:u.description,url:"".concat(d.W6).concat(u.slug),datePublished:u.datePublished,dateModified:u.datePublished,author:u.author?{"@type":"Person",name:u.author.name,...u.author.url?{url:u.author.url}:{},worksFor:{"@type":"Organization",name:"Verificate Pty Ltd",url:d.W6}}:{"@type":"Organization",name:"Verificate Pty Ltd",url:d.W6},publisher:{"@type":"Organization",name:"Verificate Pty Ltd",url:d.W6},mainEntityOfPage:"".concat(d.W6).concat(u.slug),...(null==(i=u.keywords)?void 0:i.length)?{keywords:u.keywords.join(", ")}:{},...(null==(m=u.citation)?void 0:m.length)?{citation:u.citation.map(e=>({"@type":"CreativeWork",name:e.name,url:e.url})),isBasedOn:u.citation.map(e=>e.url)}:{}}];return(null==(t=u.faq)?void 0:t.length)&&g.push((0,d.P$)(u.faq)),(0,r.jsxs)("div",{className:"bg-[#080A08] text-white/85 min-h-screen antialiased",children:[(0,r.jsx)(c.A,{title:u.title,path:u.slug,description:u.description,image:u.image,type:"article",jsonLd:g}),(0,r.jsx)(h.Nv,{}),(0,r.jsxs)("main",{id:"main-content",children:[(0,r.jsx)(h.wn,{className:"pt-28 sm:pt-36 pb-4",children:(0,r.jsxs)("div",{className:"max-w-3xl",children:[(0,r.jsxs)("div",{className:"flex items-center gap-3 text-white/40 font-mono text-xs",children:[(0,r.jsx)(n(),{href:"/articles",className:"text-[#8CCB43] hover:underline",children:"Articles"}),(0,r.jsx)("span",{children:"\xb7"}),(0,r.jsx)(n(),{href:"/news",className:"hover:text-[#8CCB43] hover:underline",children:"News & press"}),(0,r.jsx)("span",{children:"\xb7"}),(0,r.jsx)("span",{children:new Date(u.datePublished).toLocaleDateString("en-AU",{year:"numeric",month:"short",day:"numeric"})}),(0,r.jsx)("span",{children:"\xb7"}),(0,r.jsxs)("span",{children:[u.readMinutes," min read"]})]}),(0,r.jsx)("h1",{className:"mt-5 text-3xl sm:text-4xl md:text-[44px] font-bold tracking-tight text-white leading-tight",children:u.h1})]})}),(0,r.jsx)(h.wn,{className:"pb-10",children:(0,r.jsx)("article",{className:"max-w-3xl",children:p})}),(null==(s=u.faq)?void 0:s.length)?(0,r.jsx)(h.wn,{className:"py-10 border-t border-white/[0.06]",children:(0,r.jsxs)("div",{className:"max-w-3xl",children:[(0,r.jsx)(h.YZ,{children:"FAQ"}),(0,r.jsx)("div",{className:"mt-6 space-y-6",children:u.faq.map(e=>(0,r.jsxs)("div",{children:[(0,r.jsx)("h3",{className:"font-bold text-white",children:e.q}),(0,r.jsx)("p",{className:"mt-2 text-[15px] text-white/55 leading-relaxed",children:e.a})]},e.q))})]})}):null,"cti"===u.cta?(0,r.jsx)(h.wn,{className:"py-16",children:(0,r.jsxs)("div",{className:"rounded-3xl border border-[#2C3D1B] bg-gradient-to-b from-[#12190C] to-[#0B0F0A] px-8 md:px-14 py-12 text-center",children:[(0,r.jsx)("h2",{className:"text-2xl md:text-3xl font-bold text-white tracking-tight",children:"Bring a question your AI needs to get right."}),(0,r.jsx)("p",{className:"mt-4 text-white/60 max-w-2xl mx-auto",children:"Compile-Time Inference prepares your records before questions arrive, so supported answers and decisions can be checked against their evidence. Start with the questions where a wrong answer costs the most."}),(0,r.jsxs)("div",{className:"mt-8 flex flex-wrap justify-center gap-4",children:[(0,r.jsxs)(n(),{href:"/compile-time-inference",className:"inline-flex items-center gap-2 px-5 py-3 rounded-lg bg-[#8CCB43] hover:bg-[#7cbb37] text-[#0A0D0A] font-semibold transition-colors",children:["See Compile-Time Inference ",(0,r.jsx)(a.A,{className:"w-4 h-4"})]}),(0,r.jsxs)("a",{href:"/Verificate_Compile-Time_Inference_Brochure.pdf",download:"Verificate_Compile-Time_Inference_Brochure.pdf",className:"inline-flex items-center gap-2 px-5 py-3 rounded-lg border border-white/15 hover:border-[#8CCB43]/50 text-white font-semibold transition-colors",children:[(0,r.jsx)(l.A,{className:"w-4 h-4"})," Download the brochure (PDF)"]}),(0,r.jsxs)(n(),{href:"/contact?interest=compile-time-inference",className:"inline-flex items-center gap-2 px-5 py-3 rounded-lg border border-white/15 hover:border-[#8CCB43]/50 text-white font-semibold transition-colors",children:["Talk to us ",(0,r.jsx)(a.A,{className:"w-4 h-4"})]})]})]})}):(0,r.jsx)(h.wn,{className:"py-16",children:(0,r.jsxs)("div",{className:"rounded-3xl border border-[#2C3D1B] bg-gradient-to-b from-[#12190C] to-[#0B0F0A] px-8 md:px-14 py-12 text-center",children:[(0,r.jsx)("h2",{className:"text-2xl md:text-3xl font-bold text-white tracking-tight",children:"Put a real gate on your AI output."}),(0,r.jsx)("p",{className:"mt-4 text-white/60 max-w-2xl mx-auto",children:"Verificate Gate (available via MCP) runs deterministic checks plus an engineering-quality review on every AI output — in Claude Code, Cursor, Windsurf or any MCP client. 30-day free trial, no card required."}),(0,r.jsxs)("div",{className:"mt-8 flex flex-wrap justify-center gap-4",children:[(0,r.jsxs)(n(),{href:"/auth/signup",className:"inline-flex items-center gap-2 px-5 py-3 rounded-lg bg-[#8CCB43] hover:bg-[#7cbb37] text-[#0A0D0A] font-semibold transition-colors",children:[(0,r.jsx)(o.A,{className:"w-4 h-4"})," Start 30-day free trial"]}),(0,r.jsxs)(n(),{href:"/gate",className:"inline-flex items-center gap-2 px-5 py-3 rounded-lg border border-white/15 hover:border-[#8CCB43]/50 text-white font-semibold transition-colors",children:["See how the Gate works ",(0,r.jsx)(a.A,{className:"w-4 h-4"})]})]})]})})]})]})}}},e=>{e.O(0,[8096,8799,636,8792],()=>e(e.s=2944)),_N_E=e.O()}]);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.