Introducing Confident Monitor

Faithfulness

Faithfulness is a single-turn metric to evaluate RAG generators

Overview

The faithfulness metric is a single-turn RAG metric that uses LLM-as-a-judge to assess whether your generator's answers rely solely on the retrieved context, without hallucinating or providing misinformation.

Required Parameters

These are the parameters you must supply in your test case to run evaluations for faithfulness metric:

inputstringRequired

The input query you supply to your RAG application.

actual_outputstringRequired

The final output your RAG application's generator generates.

retrieval_contextlist of stringRequired

The retrieved context your retriever outputs for a given input sorted by their rank.

Metric Parameters

These are the parameters you can configure for faithfulness metric when adding it to a metric collection:

truths_extraction_limitnumber

An integer specifying the maximum number of truths to extract from the actual output.

penalize_ambiguous_claimsboolean

A boolean specifying whether to penalize ambiguous claims.

How Is It Calculated?

The faithfulness metric first extracts individual claims from the actual output using an LLM, then uses the same LLM to check how many claims are supported by the retrieved context.


Faithfulness=Number of Truthful ClaimsTotal Number of Claims\text{Faithfulness} = \frac{\text{Number of Truthful Claims}}{\text{Total Number of Claims}}

The final score is the proportion of truthful claims found in the actual output.

Usage

To run the faithfulness metric on Confident AI, add it to a single-turn metric collection. This will allow you to use faithfulness metric for:

  • Single-turn E2E testing
  • Single-turn component-level testing
  • Online and offline evals for traces and spans

Last updated on

Built byConfident AI