How we evaluate the answer accuracy of a RAG-based AI assistant

leadsci, aaniretake21 Mar 2025

Problem

AlfaStrakhovanie builds LLM-based advisors that answer from the company knowledge base through retrieval-augmented generation (RAG). A plain LLM does not know internal documents, its data stops at the training cutoff, and it hallucinates. Once retrieval is added, the team needs a number that says whether answers are correct, and the classic text-overlap metrics are suspected of missing paraphrases and synonyms.

Example from the article: a RAG assistant over the Russian text of "Harry Potter and the Philosopher's Stone" is scored before and after adding retrieval, using a GPT-4o mini judge that outputs 1 or 0.

Solution in brief

Collect questions with reference answers, have people rate how close generated answers are to the references, and compare each automatic metric with those ratings. In the authors' insurance dataset an LLM judge correlated with humans better than BLEU, ROUGE, METEOR or BERTScore. The chosen judge (GPT-4o mini) then gives a 0/1 accuracy for each model, before and after RAG.

Questions this case answers
  • How to pick an automatic similarity metric for generated answers that agrees with human raters when exact-match and n-gram metrics miss paraphrases
  • How to measure what retrieval adds to a language model by scoring the same question set before and after adding a knowledge base
  • How to measure the answer accuracy of a RAG-based question-answering assistant?
  • How to choose between BLEU, ROUGE, METEOR, BERTScore and an LLM judge for scoring generated answers?

Tools and methods

  • BLEU, ROUGE, METEOR, BERTScore — baseline text-similarity metrics against the reference answer
  • LLM as a judge (GPT-3.5, GPT-4, Mistral 7B, GPT-4o mini) — rates semantic closeness of two answers
  • Human evaluation — ground truth for choosing the metric
  • LlamaIndex with multilingual-e5-large embeddings — the simple vector RAG under test
  • Llama 3.2 3B, Qwen 2 7B, GPT-4o mini — models compared before and after RAG
Continue reading — it's free

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