How I Cut Hallucinations 99% on Amazon Bedrock

How I Cut Hallucinations 99% on Amazon Bedrock

My RAG AI document summarization agent on Amazon Bedrock, that summarizes a knowledge base of 1000+ documents, began hallucinating on long technical documents as it scaled. By grounding the model in source content with Bedrock Knowledge Bases and implementing chain-of-thought (CoT) fact verification before every summary, I cut hallucinations by 99% while keeping latency under three seconds.

I build resilient, scalable and secure cloud and AI solutions

The Problem Statement

Summarizing long documents in a single pass forced the model to hold every detail in context at once. As documents grew longer and details were spread thin, the agent filled the gaps with plausible text, adding inaccurate details and specifics the source never contained.
Worse, the failure is invisible. Users rely on summaries to avoid reviewing the source, which makes accuracy and relevance non-negotiable.

Requirements

  • Accuracy: every statement must be traceable to the source document.
  • Relevance: the summary reflects the most important content in the document.
  • Performance: low latency, sustained at volume and scale.

AWS Services

Service
Role
Amazon Bedrock
Foundation model that generates the summaries
Amazon Bedrock Knowledge Bases
Ingestion, semantic chunking and retrieval for RAG
Embedding model on Amazon Bedrock
Vectors that power relevant retrieval

Solution Architecture


Documents are chunked and embedded once at ingestion. At request time, the agent retrieves only the relevant excerpts, and the model verifies every fact against them before returning the summary.

Layer 1: Ground the Model in Source Content

The fix starts with what the model sees. Instead of the full document, the agent receives only excerpts retrieved from a Bedrock Knowledge Base, and every statement it writes must come from them.
  • Semantic chunking. Fixed-size chunking splits text at a token count and can divide one idea across two chunks. Semantic chunking compares adjacent sentences using embeddings and splits where the meaning shifts, governed by  breakpointPercentileThreshold ,  bufferSize  and  maxTokens . Each chunk carries a complete idea, so it can be retrieved independently.
  • Tuned embeddings. The embedding model does two jobs: it sets semantic chunk boundaries, and it ranks chunks for relevance at query time. Tuning it ensures retrieval returns the excerpts that carry the document's key facts, not text that only shares keywords.
  • Retrieval-augmented generation. With retrieved chunks as its only input, the model summarizes by reading rather than recalling. Every statement has a source excerpt to check against.

Layer 2: Verify Every Fact Before Writing

Grounding controls what the model sees; verification controls how it uses it. Zero-shot chain-of-thought (CoT) instructions require the model to reason step by step and explicitly verify each fact against the retrieved excerpts before it writes. Anything it cannot support is excluded. Step-by-step reasoning adds generation time, and testing confirmed it fits within the latency threshold.

Results

  • 99% reduction in hallucinations, meeting factual accuracy goals.
  • Processed 1,000 documents in one hour, delivering each summary within three seconds.

Lessons Learned

  • Change what the model sees before changing the model. Long-document hallucination is a context problem first.
  • Make chunking an architecture decision. It determines what can be retrieved, and therefore what the model can get right.
  • Build verification into generation. Stopping an unsupported claim before it is written costs less than correcting it after a user acts on it.
Any opinions in this article are those of the individual author and may not reflect the opinions of AWS.
Enjoyed reading this content? Let the author know!

Your likes, comments, shares, and saves help creators reach more builders.

Loading recommendations

Loading article