Risk Scorers
A risk scorer turns evaluation metrics into a monitored risk level. It points at a risk scoring methodology, configures that methodology’s parameters, selects which metric values it applies to, and aggregates the resulting scores into one number for the AI app. Where a policy answers pass or fail, a risk scorer answers how bad.
# risk_scorers.yaml
risk_scorers:
- key: "harmful_content"
display_name: "Harmful Content Risk Scorer"
domain: "safety"
risk_scoring_methodology_key: "safety_risk_scoring_methodology"
metric: "safety_score"
scope:
evaluation_keys: ["harmful_content"]
config:
impact: 7.0
aggregation: "mean"What a risk scorer decides
| Field | Effect |
|---|---|
risk_scoring_methodology_key, config |
The risk scoring methodology to apply, and the values for the parameters it declares in its config_spec. The same methodology can therefore back several risk scorers with different weights. |
metric, scope |
Which metric values are fed to the methodology. scope: "all_latest" uses the latest run of every evaluation key in the app; a fine-grained scope narrows this by evaluation_keys, task_specification_keys, scorer_keys and metric_keys. |
aggregation |
How the per-value scores combine into the reported score: mean, max (worst case) or min (best case). |
domain |
The risk domain the risk scorer is reported under, e.g. safety or quality. |
The aggregated score lies in the 0–10 range and maps to a level: low up to 2, medium up to 4, high up to 9, and critical above that.
Working with risk scorers
Register the risk scoring methodology first with lf add risk-scoring-methodology, then add the risk scorer with lf add risk-scorer. Once the evaluations have run, lf overview risk-scorers shows each risk scorer’s score and level, and lf export risk-scorers writes them back to YAML. See the risk scorers guide for a quickstart.
Configuration
Properties
key string required
Unique identifier assigned to the entity in AI Platform.
Pattern: ^[a-zA-Z0-9_\-]+$
Max Length: 250
display_name string required
The risk scorer’s name displayed to the user.
description string
Short description of the risk scorer.
Default: None
domain string required
The domain this risk scorer belongs to.
risk_scoring_methodology_key string required
The key of the risk scoring methodology used by this risk scorer.
scope PolicyRuleSimpleScope, PolicyRuleFinegrainedScope required
The scope of metrics this risk scorer operates on.
config object
Configuration values for the risk scoring methodology’s config_spec parameters.
Default: {}
aggregation string required
Aggregation method used to combine risk scores across the scope.
metric string required
The metric key this risk scorer filters on when evaluating the risk score.
tags array[string]
Tags associated with the risk scorer.
Default: []
Risk Scorers
risk_scorers:
- key: "quality_internal"
display_name: "Quality Risk Scorer (Internal)"
description: >
Monitors model accuracy on the QA evaluation for internally deployed systems.
domain: "performance_and_reliability"
risk_scoring_methodology_key: "performance_risk_scoring_methodology"
scope:
evaluation_keys: ["ai-knowledge-mcqa"]
config:
impact: 4.0
deployment_reach: "internal"
metric: "accuracy"
aggregation: "mean"
- key: "quality_external"
display_name: "Quality Risk Scorer (External)"
description: >
Monitors model accuracy on the QA evaluation for externally deployed systems.
External deployment amplifies the risk score relative to the internal risk scorer.
domain: "performance_and_reliability"
risk_scoring_methodology_key: "performance_risk_scoring_methodology"
scope:
evaluation_keys: ["ai-knowledge-mcqa"]
config:
impact: 4.0
deployment_reach: "external"
metric: "accuracy"
aggregation: "mean"