Evaluation
Modules:
| Name | Description |
|---|---|
evaluator |
|
evaluators |
|
experiment |
|
metric_implementation |
Pinned metric scripts and the Python environment used to evaluate them. |
Classes:
| Name | Description |
|---|---|
EvaluationRecord |
A record identifying evaluations for a specific task. |
Evaluator |
A class for LLM output evaluators. |
ExperimentBatchConfig |
Configuration for a batch of experiments to be executed by a pipeline. |
ExperimentConfig |
Configuration for an experiment to be executed by a pipeline. |
GenerationRecord |
A record identifying generations for a specific task. |
GenerationSource |
The generation artifact used by an evaluation. |
MetaTierGroupedRecord |
A record grouping evaluation records by generator name |
MetricImplementation |
Immutable provenance for one built-in metric implementation. |
ResultRecord |
A record indicating the result of generation or evaluation. |
ScoreCalculator |
A protocol for computing evaluation scores. |
ScorerFactory |
A protocol for constructing a Scorer given a Model. |
TaskConfig |
Configuration for a task to be executed by a pipeline. |
EvaluationRecord
Bases: GenerationRecord
A record identifying evaluations for a specific task.
Attributes:
| Name | Type | Description |
|---|---|---|
dataset_record |
DatasetRecord
|
The record of the dataset. |
generator_name |
str
|
The name of the generator. |
task_name |
str
|
The name of the task. |
model_record |
ModelRecord
|
The record of the model. |
experiment_name |
str | None
|
The name of the experiment, if applicable. |
generator_fingerprint |
str
|
Identity of the solver configuration and explicit version. Empty for legacy records without this identity. |
task_fingerprint |
str
|
Identity of preprocessing and sample field mapping. Empty for legacy records without this identity. |
evaluator_name |
str
|
The name of the evaluator. |
evaluator_provenance_json |
str
|
Canonical script/runtime provenance. |
evaluator_fingerprint |
str
|
Identity of the evaluator configuration, including its judge settings and explicit version. Empty for legacy records without this identity. |
Methods:
| Name | Description |
|---|---|
__eq__ |
Checks equality with another record. |
__hash__ |
Generates a hash for the evaluation record. |
__lt__ |
Checks if this record is less than another record. |
get_evaluation_record |
Generates an evaluation record from the generation record. |
get_meta_grouped_record |
Generates a perturbation grouped record from the evaluation record. |
Source code in evalsense/evaluation/experiment.py
205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 | |
generation_id
property
Stable summary row ID for the stored generation configuration.
generation_record
property
Generates a generation record from the evaluation record.
Returns:
| Name | Type | Description |
|---|---|---|
GenerationRecord |
GenerationRecord
|
The generation record. |
label
property
Generates a label for the evaluation record.
Returns:
| Name | Type | Description |
|---|---|---|
str |
str
|
The label for the evaluation record. |
__eq__
Checks equality with another record.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
other
|
object
|
The other record to compare with. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
bool |
bool
|
True if the records are equal, False otherwise. |
Source code in evalsense/evaluation/experiment.py
__hash__
Generates a hash for the evaluation record.
Returns:
| Name | Type | Description |
|---|---|---|
int |
int
|
The hash of the evaluation record. |
Source code in evalsense/evaluation/experiment.py
__lt__
Checks if this record is less than another record.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
other
|
object
|
The other record to compare with. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
bool |
bool
|
True if this record is less than the other, False otherwise. |
Source code in evalsense/evaluation/experiment.py
get_evaluation_record
get_evaluation_record(
evaluator_name: str,
evaluator_fingerprint: str = "",
*,
evaluator_provenance_json: str = "",
) -> EvaluationRecord
Generates an evaluation record from the generation record.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
evaluator_name
|
str
|
The name of the evaluator. |
required |
evaluator_fingerprint
|
str
|
Identity of the evaluator configuration, including its judge settings and explicit version. Defaults to an empty string for legacy/manual records without a fingerprint. |
''
|
evaluator_provenance_json
|
str
|
Canonical metric script and runtime provenance. Empty for custom or legacy implementations. |
''
|
Returns:
| Name | Type | Description |
|---|---|---|
EvaluationRecord |
EvaluationRecord
|
The evaluation record. |
Source code in evalsense/evaluation/experiment.py
get_meta_grouped_record
Generates a perturbation grouped record from the evaluation record.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
metric_name
|
str
|
The name of the metric being evaluated. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
PerturbationGroupedRecord |
MetaTierGroupedRecord
|
The perturbation grouped record. |
Source code in evalsense/evaluation/experiment.py
Evaluator
dataclass
A class for LLM output evaluators.
Attributes:
| Name | Type | Description |
|---|---|---|
cache_key |
str
|
Include the scorer's declared configuration and judge model settings. |
model_name |
str
|
Retrieves the model name associated with the evaluator config. |
Source code in evalsense/evaluation/evaluator.py
cache_key
property
Include the scorer's declared configuration and judge model settings.
ExperimentBatchConfig
dataclass
Configuration for a batch of experiments to be executed by a pipeline.
Methods:
| Name | Description |
|---|---|
validate |
Validates the experiment configuration. |
Attributes:
| Name | Type | Description |
|---|---|---|
all_experiments |
list[ExperimentConfig]
|
Generates a list of all experiments in the batch. |
Source code in evalsense/evaluation/experiment.py
all_experiments
property
Generates a list of all experiments in the batch.
Returns:
| Type | Description |
|---|---|
list[ExperimentConfig]
|
list[ExperimentConfig]: A list of all experiments in the batch. |
validate
Validates the experiment configuration.
Raises:
| Type | Description |
|---|---|
ValueError
|
If the configuration is invalid. |
Source code in evalsense/evaluation/experiment.py
ExperimentConfig
dataclass
Configuration for an experiment to be executed by a pipeline.
Attributes:
| Name | Type | Description |
|---|---|---|
evaluation_record |
EvaluationRecord
|
A identifying evaluations for a specific task. |
generation_record |
GenerationRecord
|
A identifying generations for a specific task. |
Source code in evalsense/evaluation/experiment.py
evaluation_record
property
A identifying evaluations for a specific task.
Returns:
| Name | Type | Description |
|---|---|---|
EvaluationRecord |
EvaluationRecord
|
A record of the evaluations for the experiment. |
generation_record
property
A identifying generations for a specific task.
Returns:
| Name | Type | Description |
|---|---|---|
GenerationsRecord |
GenerationRecord
|
A record of the generations for the experiment. |
GenerationRecord
Bases: BaseModel
A record identifying generations for a specific task.
Attributes:
| Name | Type | Description |
|---|---|---|
dataset_record |
DatasetRecord
|
The record of the dataset. |
generator_name |
str
|
The name of the generator. |
task_name |
str
|
The name of the task. |
model_record |
ModelRecord
|
The record of the model. |
experiment_name |
str | None
|
The name of the experiment, if applicable. |
generator_fingerprint |
str
|
Identity of the solver configuration and explicit version. Empty for legacy records without this identity. |
task_fingerprint |
str
|
Identity of preprocessing and sample field mapping. Empty for legacy records without this identity. |
Methods:
| Name | Description |
|---|---|
__eq__ |
Checks equality with another record. |
__hash__ |
Generates a hash for the generation record. |
__lt__ |
Checks if this record is less than another record. |
get_evaluation_record |
Generates an evaluation record from the generation record. |
Source code in evalsense/evaluation/experiment.py
64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 | |
generation_id
property
Stable summary row ID for the stored generation configuration.
label
property
Generates a label for the generation record.
Returns:
| Name | Type | Description |
|---|---|---|
str |
str
|
The label for the generation record. |
__eq__
Checks equality with another record.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
other
|
object
|
The other record to compare with. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
bool |
bool
|
True if the records are equal, False otherwise. |
Source code in evalsense/evaluation/experiment.py
__hash__
Generates a hash for the generation record.
Returns:
| Name | Type | Description |
|---|---|---|
int |
int
|
The hash of the generation record. |
Source code in evalsense/evaluation/experiment.py
__lt__
Checks if this record is less than another record.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
other
|
object
|
The other record to compare with. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
bool |
bool
|
True if this record is less than the other, False otherwise. |
Source code in evalsense/evaluation/experiment.py
get_evaluation_record
get_evaluation_record(
evaluator_name: str,
evaluator_fingerprint: str = "",
*,
evaluator_provenance_json: str = "",
) -> EvaluationRecord
Generates an evaluation record from the generation record.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
evaluator_name
|
str
|
The name of the evaluator. |
required |
evaluator_fingerprint
|
str
|
Identity of the evaluator configuration, including its judge settings and explicit version. Defaults to an empty string for legacy/manual records without a fingerprint. |
''
|
evaluator_provenance_json
|
str
|
Canonical metric script and runtime provenance. Empty for custom or legacy implementations. |
''
|
Returns:
| Name | Type | Description |
|---|---|---|
EvaluationRecord |
EvaluationRecord
|
The evaluation record. |
Source code in evalsense/evaluation/experiment.py
GenerationSource
Bases: BaseModel
The generation artifact used by an evaluation.
Attributes:
| Name | Type | Description |
|---|---|---|
log_location |
str
|
Resolved path of the source generation log. |
sha256 |
str
|
SHA256 of the complete source file before scoring. |
Methods:
| Name | Description |
|---|---|
capture |
Identify a saved generation artifact without depending on Inspect IDs. |
Source code in evalsense/evaluation/experiment.py
capture
classmethod
Identify a saved generation artifact without depending on Inspect IDs.
Source code in evalsense/evaluation/experiment.py
MetaTierGroupedRecord
Bases: EvaluationRecord
A record grouping evaluation records by generator name (as generator name specifies the meta tier, which defines the expected score ranking).
Attributes:
| Name | Type | Description |
|---|---|---|
dataset_record |
DatasetRecord
|
The record of the dataset. |
generator_name |
str
|
The name of the generator. |
task_name |
str
|
The name of the task. |
model_record |
ModelRecord
|
The record of the model. |
experiment_name |
str | None
|
The name of the experiment, if applicable. |
generator_fingerprint |
str
|
Empty when grouping across tier generators; otherwise the solver configuration and explicit version identity. |
task_fingerprint |
str
|
Identity of preprocessing and sample field mapping. Empty for legacy records without this identity. |
evaluator_name |
str
|
The name of the evaluator. |
evaluator_fingerprint |
str
|
Identity of the evaluator configuration, including its judge settings and explicit version. Empty for legacy records without this identity. |
evaluator_provenance_json |
str
|
Canonical script/runtime provenance. |
metric_name |
str
|
The name of the metric being evaluated. |
Methods:
| Name | Description |
|---|---|
__eq__ |
Checks equality with another record. |
__hash__ |
Generates a hash for the perturbation grouped record. |
__lt__ |
Checks if this record is less than another record. |
get_evaluation_record |
Generates an evaluation record from the generation record. |
get_meta_grouped_record |
Generates a perturbation grouped record from the evaluation record. |
Source code in evalsense/evaluation/experiment.py
344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 | |
generation_id
property
Stable summary row ID for the stored generation configuration.
generation_record
property
Generates a generation record from the evaluation record.
Returns:
| Name | Type | Description |
|---|---|---|
GenerationRecord |
GenerationRecord
|
The generation record. |
label
property
Generates a label for the evaluation record.
Returns:
| Name | Type | Description |
|---|---|---|
str |
str
|
The label for the evaluation record. |
__eq__
Checks equality with another record.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
other
|
object
|
The other record to compare with. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
bool |
bool
|
True if the records are equal, False otherwise. |
Source code in evalsense/evaluation/experiment.py
__hash__
Generates a hash for the perturbation grouped record.
Returns:
| Name | Type | Description |
|---|---|---|
int |
int
|
The hash of the perturbation grouped record. |
Source code in evalsense/evaluation/experiment.py
__lt__
Checks if this record is less than another record.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
other
|
object
|
The other record to compare with. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
bool |
bool
|
True if this record is less than the other, False otherwise. |
Source code in evalsense/evaluation/experiment.py
get_evaluation_record
get_evaluation_record(
evaluator_name: str,
evaluator_fingerprint: str = "",
*,
evaluator_provenance_json: str = "",
) -> EvaluationRecord
Generates an evaluation record from the generation record.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
evaluator_name
|
str
|
The name of the evaluator. |
required |
evaluator_fingerprint
|
str
|
Identity of the evaluator configuration, including its judge settings and explicit version. Defaults to an empty string for legacy/manual records without a fingerprint. |
''
|
evaluator_provenance_json
|
str
|
Canonical metric script and runtime provenance. Empty for custom or legacy implementations. |
''
|
Returns:
| Name | Type | Description |
|---|---|---|
EvaluationRecord |
EvaluationRecord
|
The evaluation record. |
Source code in evalsense/evaluation/experiment.py
get_meta_grouped_record
Generates a perturbation grouped record from the evaluation record.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
metric_name
|
str
|
The name of the metric being evaluated. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
PerturbationGroupedRecord |
MetaTierGroupedRecord
|
The perturbation grouped record. |
Source code in evalsense/evaluation/experiment.py
MetricImplementation
dataclass
Immutable provenance for one built-in metric implementation.
Captures a full script revision, its expected Evaluate content hash, Python, and installed versions of the metric's runtime dependencies. Missing optional packages are recorded as null. Recreate evaluators in a fresh process after changing the environment. No environment variables or filesystem paths are recorded.
This does not pin pretrained model weights, tokenizer assets, hardware or nondeterministic kernels. Use immutable model snapshots and retain the lockfile for experiments that require those guarantees.
Attributes:
| Name | Type | Description |
|---|---|---|
name |
str
|
Supported metric identifier. |
revision |
str
|
Full Hugging Face Space commit. |
source_hash |
str
|
Expected Evaluate hash of the script and helper code. |
python |
str
|
Python interpreter version. |
packages |
tuple
|
Sorted package names and installed versions, or None for packages absent from this environment. |
Methods:
| Name | Description |
|---|---|
load |
Load the pinned script and reject an incompatible cached fallback. |
resolve |
Capture the supported script definition and installed package versions. |
Source code in evalsense/evaluation/metric_implementation.py
provenance
property
Return a fresh JSON-compatible description suitable for saved scores.
provenance_json
property
Canonical, hashable representation for evaluation identity.
load
Load the pinned script and reject an incompatible cached fallback.
Evaluate can fall back to the latest locally cached module even when a revision was requested. Its resolved content hash must therefore match the supported implementation before any scores are computed. This is a reproducibility check, not a sandbox for untrusted metric code.
Source code in evalsense/evaluation/metric_implementation.py
resolve
classmethod
Capture the supported script definition and installed package versions.
Source code in evalsense/evaluation/metric_implementation.py
ResultRecord
Bases: BaseModel
A record indicating the result of generation or evaluation.
Attributes:
| Name | Type | Description |
|---|---|---|
status |
RecordStatus
|
The status of the record. |
error_message |
str | None
|
The error message, if any. |
log_location |
str | None
|
The location of the associated Inspect log file. |
source_generation |
GenerationSource | None
|
The generation artifact used by an evaluation. None for generation results and older metadata. |
Source code in evalsense/evaluation/experiment.py
ScoreCalculator
Bases: Protocol
A protocol for computing evaluation scores.
Methods:
| Name | Description |
|---|---|
calculate |
Computes evaluation scores for the given evaluation method |
calculate_async |
Asynchronously computes evaluation scores for the given evaluation method |
Source code in evalsense/evaluation/evaluator.py
calculate
abstractmethod
calculate(
*,
prediction: str,
input: str | None = None,
reference: str | None = None,
metadata: dict[str, Any] | None = None,
**kwargs,
) -> Score
Computes evaluation scores for the given evaluation method
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
prediction
|
str
|
The model output to evaluate. |
required |
input
|
str
|
The input to the model. Optional. |
None
|
reference
|
str
|
The reference output to compare against. Optional. |
None
|
metadata
|
dict[str, Any]
|
Additional Inspect AI sample/task state metadata. Optional. |
None
|
**kwargs
|
dict
|
Additional keyword arguments specific to the given evaluation method. |
{}
|
Returns:
| Name | Type | Description |
|---|---|---|
Score |
Score
|
The Inspect AI Score object with the calculated result. |
Source code in evalsense/evaluation/evaluator.py
calculate_async
abstractmethod
async
calculate_async(
*,
prediction: str,
input: str | None = None,
reference: str | None = None,
metadata: dict[str, Any] | None = None,
**kwargs,
) -> Score
Asynchronously computes evaluation scores for the given evaluation method
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
prediction
|
str
|
The model output to evaluate. |
required |
input
|
str
|
The input to the model. Optional. |
None
|
reference
|
str
|
The reference output to compare against. Optional. |
None
|
metadata
|
dict[str, Any]
|
Additional Inspect AI sample/task state metadata. Optional. |
None
|
**kwargs
|
dict
|
Additional keyword arguments specific to the given evaluation method. |
{}
|
Returns:
| Name | Type | Description |
|---|---|---|
Score |
Score
|
The Inspect AI Score object with the calculated result. |
Source code in evalsense/evaluation/evaluator.py
ScorerFactory
Bases: Protocol
A protocol for constructing a Scorer given a Model.
Methods:
| Name | Description |
|---|---|
create_scorer |
Creates a Scorer from a Model. |
Source code in evalsense/evaluation/evaluator.py
create_scorer
abstractmethod
Creates a Scorer from a Model.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
model
|
Model
|
The model to create a scorer for. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
Scorer |
Scorer
|
The created scorer. |
TaskConfig
dataclass
Configuration for a task to be executed by a pipeline.
Source code in evalsense/evaluation/experiment.py
See Result management for cache identity, component versions and handling of existing results.
ResultRecord.source_generation identifies the generation artifact used for an
evaluation through its resolved path and complete-file SHA256 digest.
GenerationSource.capture(path) captures that reference from a saved generation
log. It is separate from the configuration identity in GenerationRecord.
Metric implementation provenance
The built-in BLEU, ROUGE and BERTScore evaluators pin their Evaluate scripts to
full Hub commits and check the loaded content hash, including helper scripts.
A different cached fallback raises an error before scoring. Pins are defined in
evalsense.evaluation.metric_implementation and should be updated together with
numerical regression checks.
evaluator.implementation.provenance exposes the script revision, content hash,
Python version and selected installed runtime dependency versions. The same
manifest is saved in each score's metric_provenance metadata and in the
EvaluationRecord.evaluator_provenance_json field. It changes evaluation cache
identity and log filenames without invalidating generated outputs. Ordinary
metric names and numerical definitions are unchanged.
Legacy records remain readable but do not satisfy a new implementation identity. The standard summary, correlation and meta-evaluation analysers reject versions that would otherwise share labels. Analyse one implementation at a time, for example in separate projects; do not silently discard historical results. Corpus BLEU also rejects scores without the matching provenance before recomputation. Custom evaluators retain their existing identity unless they explicitly provide an implementation.
These manifests are not a complete environment lock. Retain uv.lock, use
uv sync --frozen, and restart after dependency changes. Pretrained model weights,
tokenizer assets, custom aggregators, hardware and nondeterministic execution are
outside the script/version check. Preserve immutable model snapshots separately.