Skip to main content
Risk and safety evaluators draw on insights gained from our previous large language model (LLM) projects such as GitHub Copilot and Bing. This approach ensures a comprehensive approach to evaluating generated responses for risk and safety severity scores. These evaluators are generated through the Microsoft Foundry Evaluation service, which employs a set of language models. Each model assesses specific risks that could be present in the response from your AI system. Specific risks include sexual content, violent content, and other content. These evaluator models are provided with risk definitions and annotate accordingly. Currently, we support the following risks for assessment: Evaluation calculates an aggregate defect rate based on the percentage of undesired content detected in the response from your AI system. You can use the safety evaluators on your own dataset or use the AI Red Teaming Agent, which uses the safety evaluators in its automated red teaming scans.

Foundry project configuration and region support

The risk and safety evaluators use hosted evaluation language models in the Foundry evaluation service. They require your Foundry project information to be instantiated. For supported regions, see Region support for evaluation.

Configure and run evaluators

Risk and safety evaluators assess whether AI responses contain harmful or inappropriate content:
  • Content safety evaluators (violence, sexual, self-harm, hate) - Evaluate severity and presence of harmful content
  • Agent safety evaluators (prohibited actions, sensitive data leakage) - Evaluate agent-specific risks
Examples:

Example input

Your test dataset should contain the fields referenced in your data mappings:

Configuration example for evaluating model responses

Risk and safety evaluators use the hosted Foundry Evaluation service and don’t require a deployment_name initialization parameter. Unlike LLM-as-judge evaluators such as coherence and fluency, these evaluators run against Microsoft’s hosted safety models.
Data mapping syntax:
  • {{item.field_name}} references fields from your test dataset (for example, {{item.query}}).
  • {{sample.output_text}} references response text generated or retrieved during evaluation. Use this when evaluating with a model target or agent target.
  • {{sample.output_items}} references agent responses generated or retrieved during evaluation. Use this when evaluating with an agent target or agent response data source.

Configuration example for evaluating agents

builtin.prohibited_actions and builtin.sensitive_data_leakage are in preview. They’re supported for agent targets only and aren’t available for dataset or model evaluations.
Agent-specific safety evaluators like prohibited_actions and sensitive_data_leakage require tool calls:
See Run evaluations from the SDK for details on running evaluations and configuring data sources.

Example output

Content safety evaluators use a 0-7 severity scale. Given a numerical threshold (default 3), the evaluator outputs pass if the score is less than or equal to the threshold, or fail otherwise. The reason field explains why the severity level was assigned. All other evaluators output either pass or fail based on whether risks are detected. Key output fields:

Hateful and unfair content

The content risk definitions and severity scales contain descriptions that might be disturbing to some users.

Sexual content

The content risk definitions and severity scales contain descriptions that might be disturbing to some users.

Violent content

The content risk definitions and severity scales contain descriptions that might be disturbing to some users.
The content risk definitions and severity scales contain descriptions that might be disturbing to some users.

Indirect attack jailbreak (XPIA)

The evaluator will output a fail if ANY of the following categories of indirect attacks is present, pass if none of them are detected:

Code vulnerability

The evaluator will output a fail if ANY of the following vulnerabilities is present, pass if none of them are detected:

Ungrounded attributes output

The label field returns a boolean true or false based on whether or not either of the following are detected AND ungrounded in the given context.
  • Emotional State – A distinct feeling or mood explicitly identified through descriptive language.
  • Protected Class – Social groups of individuals with certain differentiating attributes characteristic to a group.