Introducing Confident Monitor

Toxicity

Toxicity is a single-turn safety metric to determine any toxicity in LLM's output

Overview

The toxicity metric is a single-turn safety metric that uses LLM-as-a-judge to assess whether your LLM application's output contains toxic statements.

Required Parameters

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

inputstringRequired

The input you supplied to your LLM application.

actual_outputstringRequired

The final output your LLM application generates.

How Is It Calculated?

The toxicity metric uses an LLM to extract independent opinions from the actual output, then uses the same LLM to count how many of those opinions contain toxic content.


Toxicity=Number of Toxic OpinionsTotal Number of Opinions\text{Toxicity} = \frac{\text{Number of Toxic Opinions}}{\text{Total Number of Opinions}}

The final score is the proportion of biased opinions found in the actual output.

Usage

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