Launch Week 3: Five days of launches

Prompt Alignment

Prompt Alignment is a single-turn metric to determine if your LLM output follows your prompt instructions

Overview

The prompt alignment metric is a single-turn metric that uses LLM-as-a-judge to assess whether your LLM application's output follows the instructions laid out in your prompt template.

Required Parameters

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

inputstringRequired

The input you supplied to your LLM application.

actual_outputstringRequired

The final output your LLM application generates.

Metric Parameters

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

prompt_instructionslist of stringsRequired

A list of strings specifying the instructions you want followed in your prompt template. For example, Reply in all uppercase.

How Is It Calculated?

The prompt alignment metric iterates over each of the prompt instructions you supplied and uses an LLM to classify whether the actual output follows that instruction, using the input as additional context.


Prompt Alignment=Number of Instructions FollowedTotal Number of Instructions\text{Prompt Alignment} = \frac{\text{Number of Instructions Followed}}{\text{Total Number of Instructions}}

The final score is the proportion of prompt instructions that the actual output followed.

Usage

To run the prompt alignment metric on Confident AI, add it to a single-turn metric collection. This will allow you to use prompt alignment 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