Scaling RAG Accuracy from 49% to 86% in a Finance Q&A Assistant

Soheb Moin, Nitin Arora, Yunfei Bai, Kumar Satyen Gaurav, Mohak Chugh, Parth Bavishi2 Dec 2024

Problem

Amazon Finance operations analysts answer customer queries on accounts payable and receivable. Each answer needs subject matter experts (SMEs) and several policy documents with standard operating procedures. A reply takes hours to days. New hires suffer most because they have no quick access to the right text. SMEs judged the first RAG assistant correct in only 49% of cases, far below what finance operations expected.

Example from the article: about 14% of the wrong answers came from incomplete context. The fixed-size chunker (for example 512 tokens or 384 words) cut documents across section and paragraph boundaries.

Solution in brief

The team measured accuracy with an LLM judge, which differed from SME grades by about 5%. Failure analysis then set the fix order: semantic chunking (49% to 64%), task-specific prompts (64% to 76%), and a better embedding model (76% to 86%).

Questions this case answers
  • How to improve the answer accuracy of a retrieval-augmented assistant over long structured documents when expert grading of each answer is too expensive
  • How to attribute wrong answers of a retrieval-augmented system to chunking, retrieval or generation and fix them in order of impact
  • How to raise the answer accuracy of a RAG assistant over policy documents when the first version is correct in under half of the cases?
  • How to evaluate a RAG assistant automatically when expert review of every answer does not scale?

Tools and methods

  • Amazon Bedrock — hosts the generator model, the embedding models, the judge model and Guardrails
  • OpenSearch — vector store for the knowledge base
  • Streamlit — chat UI
  • semantic chunking — splits documents by HTML structure instead of a fixed size
  • LLM-as-a-judge — scores generated answers against SME reference answers
  • prompt engineering — task-specific prompts, chain-of-thought, citation prompt, meta-prompting
  • guardrails — PII detection and prompt-injection filters, plus a validation step against the retrieved context
Continue reading — it's free

Google or a one-time email code. No password.