Launch Week 3: Five days of launches

Turn Contextual Recall

Turn Contextual Recall is a multi-turn metric used to evaluate a RAG retriever at each turn

Overview

The turn contextual recall metric is a multi-turn RAG metric that uses LLM-as-a-judge to evaluate whether the context your retriever returns at each turn of the conversation is enough to reach the expected outcome.

Required Parameters

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

turnslist of TurnRequired

A list of Turns as exchanges between user and assistant.

Parameters of Turn:

roleuser | assistantRequired

The role of the person speaking, it's either user or assistant

contentstringRequired

The content provided by the role for the turn

retrieval_contextlist of stringRequired

The retrieved context your retriever outputs for the turn sorted by their rank

expected_outcomestringRequired

The expected outcome your chatbot has to reach for the given conversation.

How Is It Calculated?

The turn contextual recall metric slides a window over the turns, breaks the expected outcome down into individual statements using an LLM, then uses the same LLM to determine how many of those statements can be attributed to a node in the retrieval context.


Turn Contextual Recall=Turn Contextual Recall ScoresTotal Number of Assistant Turns\text{Turn Contextual Recall} = \frac{\sum \text{Turn Contextual Recall Scores}}{\text{Total Number of Assistant Turns}}

The final score is the average of the contextual recall scores of every assistant turn in the conversation.

Usage

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

  • Multi-turn E2E testing
  • Online and offline evals for traces and spans

Last updated on

Built byConfident AI