Skip to main content

Out-of-Distribution Detection

Available

llm.ood_detection

Measures how well the system detects and refuses queries that fall outside its intended use case.

Contract​

FieldValue
version1.0.0
metric_typepointwise
scorer_contractper_row
directionhigher_is_better
entrypointaip_metrics_llm.unanswered.ood
target_kindNone

Required columns​

  • input_id
  • prompt
  • sut_response

Accepted schemas​

[
{
"name": "gdi_text_v1",
"task_types": [
"multi_turn_llm",
"multi_turn_rag",
"single_turn_llm",
"single_turn_rag"
]
}
]

Methodology​

  1. An LLM judge classifies behaviour; a generator synthesises out-of-domain probes from the use-case profile.
  2. Build one in-domain case plus several out-of-domain probes and query the system under test.
  3. The judge labels each as a good in-domain answer, good out-of-domain refusal, over-rejection, or missed refusal.
  4. Score 1 for each correct behaviour and report the accuracy over all cases.

Score semantics​

Scores range 0-1, the accuracy of answering in-domain queries while refusing out-of-domain ones. A high score means good in/out-of-domain discrimination; a low score means it over-rejects or answers off-scope queries. Higher is better.

Worked example​

One in-domain query answered correctly plus 3 out-of-domain probes (2 refused, 1 wrongly answered) -> 3/4 = 0.75.

Configuration schema​

{
"properties": {
"concurrency_limit": {
"default": 5,
"maximum": 64,
"minimum": 1,
"title": "Concurrency Limit",
"type": "integer",
"x-aip-param-role": "operational"
},
"inverted": {
"default": false,
"title": "Inverted",
"type": "boolean",
"x-aip-param-role": "scoring_metadata"
},
"max": {
"default": 1.0,
"title": "Max",
"type": "number",
"x-aip-param-role": "scoring_metadata"
},
"metric_name": {
"default": "ood_detection",
"title": "Metric Name",
"type": "string",
"x-aip-param-role": "scoring_metadata"
},
"min": {
"default": 0.0,
"title": "Min",
"type": "number",
"x-aip-param-role": "scoring_metadata"
},
"n_sut_retries": {
"default": 0,
"maximum": 5,
"minimum": 0,
"title": "N Sut Retries",
"type": "integer"
},
"num_ood_queries": {
"default": 3,
"maximum": 32,
"minimum": 1,
"title": "Num Ood Queries",
"type": "integer"
},
"sut_temperature": {
"default": 0.2,
"maximum": 2.0,
"minimum": 0.0,
"title": "Sut Temperature",
"type": "number"
},
"synthesis_temperature": {
"default": 0.0,
"maximum": 2.0,
"minimum": 0.0,
"title": "Synthesis Temperature",
"type": "number"
},
"timeout_seconds": {
"default": 60.0,
"exclusiveMinimum": 0,
"title": "Timeout Seconds",
"type": "number",
"x-aip-param-role": "operational"
},
"use_case": {
"anyOf": [
{
"additionalProperties": {
"type": "string"
},
"type": "object"
},
{
"type": "null"
}
],
"default": null,
"title": "Use Case"
},
"weight": {
"default": 1.0,
"title": "Weight",
"type": "number",
"x-aip-param-role": "scoring_metadata"
}
},
"title": "OODMetricConfig",
"type": "object"
}

Execution​

{
"emits_metric_family": false,
"function_name": null,
"max_concurrency": 8,
"processing_kind": "network",
"stream_batch_size": 5000,
"timeout_seconds": 21600
}

Complete manifest​

accepts:
- name: gdi_text_v1
task_types:
- multi_turn_llm
- multi_turn_rag
- single_turn_llm
- single_turn_rag
config_schema:
properties:
concurrency_limit:
default: 5
maximum: 64
minimum: 1
title: Concurrency Limit
type: integer
x-aip-param-role: operational
inverted:
default: false
title: Inverted
type: boolean
x-aip-param-role: scoring_metadata
max:
default: 1.0
title: Max
type: number
x-aip-param-role: scoring_metadata
metric_name:
default: ood_detection
title: Metric Name
type: string
x-aip-param-role: scoring_metadata
min:
default: 0.0
title: Min
type: number
x-aip-param-role: scoring_metadata
n_sut_retries:
default: 0
maximum: 5
minimum: 0
title: N Sut Retries
type: integer
num_ood_queries:
default: 3
maximum: 32
minimum: 1
title: Num Ood Queries
type: integer
sut_temperature:
default: 0.2
maximum: 2.0
minimum: 0.0
title: Sut Temperature
type: number
synthesis_temperature:
default: 0.0
maximum: 2.0
minimum: 0.0
title: Synthesis Temperature
type: number
timeout_seconds:
default: 60.0
exclusiveMinimum: 0
title: Timeout Seconds
type: number
x-aip-param-role: operational
use_case:
anyOf:
- additionalProperties:
type: string
type: object
- type: 'null'
default: null
title: Use Case
weight:
default: 1.0
title: Weight
type: number
x-aip-param-role: scoring_metadata
title: OODMetricConfig
type: object
dependencies: []
description: How well does the system detect and refuse queries outside its intended
use case?
direction: higher_is_better
display_name: Out-of-Distribution Detection
entrypoint: aip_metrics_llm.unanswered.ood
execution:
emits_metric_family: false
function_name: null
max_concurrency: 8
processing_kind: network
stream_batch_size: 5000
timeout_seconds: 21600
kind: metric
manifest_version: '1'
max_prompt_slots: 0
metric_metadata:
methodology:
- An LLM judge classifies behaviour; a generator synthesises out-of-domain probes
from the use-case profile.
- Build one in-domain case plus several out-of-domain probes and query the system
under test.
- The judge labels each as a good in-domain answer, good out-of-domain refusal,
over-rejection, or missed refusal.
- Score 1 for each correct behaviour and report the accuracy over all cases.
score_semantics: Scores range 0-1, the accuracy of answering in-domain queries while
refusing out-of-domain ones. A high score means good in/out-of-domain discrimination;
a low score means it over-rejects or answers off-scope queries. Higher is better.
summary: Measures how well the system detects and refuses queries that fall outside
its intended use case.
worked_example: One in-domain query answered correctly plus 3 out-of-domain probes
(2 refused, 1 wrongly answered) -> 3/4 = 0.75.
metric_type: pointwise
name: llm.ood_detection
partition_types: []
required_columns:
- input_id
- prompt
- sut_response
required_kinds: []
scorer_contract: per_row
target_kind: null
unsupported_trace_shapes: []
version: 1.0.0