Runner
steerability.evaluation.runner
Sweep runner: configurations x trials x suites over one base model.
SteeringEval owns what Inspect cannot: pipeline lifecycle and GPU discipline. Inspect treats
models as cheap concurrent handles to endpoints; a steered pipeline is a GPU-resident object that
must be built, steered, evaluated, and released sequentially, so the runner evaluates one pipeline
at a time and never passes more than one pipeline-backed model to one eval or eval_set call.
There is no results checkpoint: the .eval logs under save_dir/inspect_logs/ are the store, and
eval_set resumes each (configuration, trial, suite) cell from them at sample granularity. eval_set
matches task identity only (task, task args, model name); the runner's seed, generate defaults, provider
options, fit, and backend are not part of it, so a changed protocol needs a new save_dir rather than a
re-run into the old one. Each result row's provenance entry records what actually ran.
Three frames reshape a completed run: results() gives the tidy one-row-per-metric frame,
runs_frame pivots it to one row per (pipeline, trial) with one column per metric and per swept
argument, and samples_frame reads the .eval logs to give one row per (pipeline, trial, sample)
with per-sample scores joined to sample metadata. summarize_runs aggregates the per-trial frame
into the summary form the plotting layer consumes.
logger = logging.getLogger(__name__)
module-attribute
SteeringEval
Evaluate steering pipeline configurations on Inspect suites, over trials, sequentially.
Configurations expand from pipelines (fixed controls, ControlSpec sweeps, and the empty
baseline arm); a pre-flight support check runs over every configuration before any model or
engine work. Each configuration is built and steered once, then every trial runs every suite
against it before the pipeline is released; each suite run builds and discards its own
provider, named by the configuration's config_id. Repetition is trial-based: with seed
set, each (configuration, trial) derives one seed, attached to sampling dispatches whose
config carries no seed of its own. Inspect epochs are not used.
Attributes:
| Name | Type | Description |
|---|---|---|
pipelines |
Mapping from pipeline name to |
|
base_model_name_or_path |
Hugging Face model ID or local path of the base model. |
|
suites |
The |
|
backend |
Backend forwarded to the pipelines (a |
|
fit |
Fit venue policy forwarded to the pipelines. |
|
hf_model_kwargs |
Load-time kwargs for in-process model loads. |
|
device_map |
Device placement for in-process model loads. |
|
trust_remote_code |
Trust remote code when loading tokenizers. |
|
num_trials |
Trials per configuration; a completion target, not part of run identity. |
|
seed |
Base seed deriving one seed per (configuration, trial), or None. |
|
provider_options |
|
|
generate_defaults |
|
|
on_unsupported |
|
|
save_dir |
Directory holding the |
|
progress |
Draw a |
|
display |
Inspect's per-sample |
Source code in steerability/evaluation/runner.py
58 59 60 61 62 63 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 203 204 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 342 343 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 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 | |
backend = backend
instance-attribute
base_model_name_or_path = base_model_name_or_path
instance-attribute
device_map = device_map
instance-attribute
display = display
instance-attribute
fit = fit
instance-attribute
generate_defaults = dict(generate_defaults) if generate_defaults is not None else None
instance-attribute
hf_model_kwargs = hf_model_kwargs or {}
instance-attribute
num_trials = int(num_trials)
instance-attribute
on_unsupported = on_unsupported
instance-attribute
pipelines = pipelines
instance-attribute
progress = bool(progress)
instance-attribute
provider_options = provider_options
instance-attribute
save_dir = Path(save_dir) if save_dir is not None else None
instance-attribute
seed = seed
instance-attribute
suites = suites
instance-attribute
trust_remote_code = trust_remote_code
instance-attribute
results()
The last run()'s results as one row per (config, trial, suite, task, scorer/metric).
runs_frame (module-level, or the runs_frame method for swept-parameter columns)
pivots this frame to one row per (pipeline, trial), and summarize_runs aggregates
trials into the {metric}_mean / {metric}_std / {metric}_sem summary rows the
plotting layer (steerability.evaluation.plotting) consumes. samples_frame (module-level,
or the samples_frame method) reads the .eval logs for per-sample scores and paired
per-sample deltas.
Returns:
| Type | Description |
|---|---|
DataFrame
|
A |
DataFrame
|
|
Raises:
| Type | Description |
|---|---|
RuntimeError
|
If |
Source code in steerability/evaluation/runner.py
325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 | |
run()
Run every configuration x trial x suite cell, sequentially, resuming from the logs.
Returns:
| Name | Type | Description |
|---|---|---|
dict[str, list[dict]]
|
A mapping from pipeline name to a list of run dictionaries. Each run dictionary has |
|
keys |
dict[str, list[dict]]
|
|
Raises:
| Type | Description |
|---|---|
RuntimeError
|
If any configuration is unsupported and |
Warns:
| Type | Description |
|---|---|
UserWarning
|
If a static runtime kwarg in |
Source code in steerability/evaluation/runner.py
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 203 204 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 | |
runs_frame(metrics, *, params=None, suite=None, task=None)
The last run()'s per-trial metric values, one row per (pipeline, trial).
Pivots results() through the module-level runs_frame and, when params names
swept constructor arguments as column -> (spec name, argument name), attaches each
as a column keyed on config_id, read from the run records' resolved parameters.
Rows of configurations that do not sweep the argument (the baseline arm, fixed
pipelines) receive NaN. A column whose values are all numeric is returned with a
numeric dtype; non-numeric values (strings, lists) are kept raw.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
metrics
|
Mapping[str, str]
|
Mapping from output column name to a metric key, either
|
required |
params
|
Mapping[str, tuple[str, str]] | None
|
Optional mapping from output column name to |
None
|
suite
|
str | None
|
Suite to select; required when the results span several. |
None
|
task
|
str | None
|
Task to select; required when the results span several. |
None
|
Returns:
| Type | Description |
|---|---|
DataFrame
|
The wide frame with columns |
DataFrame
|
column per |
Raises:
| Type | Description |
|---|---|
RuntimeError
|
If |
ValueError
|
If |
KeyError
|
If a metric key matches nothing, or a bare metric name is ambiguous. |
Source code in steerability/evaluation/runner.py
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 | |
samples_frame(scores, *, metadata_keys=(), params=None, suite=None, task=None, include_text=False)
The last run()'s per-sample scores, one row per (pipeline, trial, sample).
Reads the .eval logs written under the run's log directory (the save_dir, or the
temporary directory when none was given) through the module-level samples_frame, and,
when params names swept constructor arguments as column -> (spec name, argument name),
attaches each as a column keyed on config_id, exactly as runs_frame does. Rows of
configurations that do not sweep the argument (the baseline arm, fixed pipelines) receive
NaN. A column whose values are all numeric is returned with a numeric dtype; non-numeric
values are kept raw.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
scores
|
Mapping[str, str]
|
Mapping from output column name to a score key, either |
required |
metadata_keys
|
Sequence[str]
|
Sample metadata entries to carry as columns. |
()
|
params
|
Mapping[str, tuple[str, str]] | None
|
Optional mapping from output column name to |
None
|
suite
|
str | None
|
Suite to select; required when the results span several. |
None
|
task
|
str | None
|
Task to select; required when the results span several. |
None
|
include_text
|
bool
|
Add the sample input and the model completion as |
False
|
Returns:
| Type | Description |
|---|---|
DataFrame
|
The frame with columns |
DataFrame
|
|
DataFrame
|
|
Raises:
| Type | Description |
|---|---|
RuntimeError
|
If |
ValueError
|
If |
KeyError
|
If a score key names a scorer or dict key absent from a sample. |
Source code in steerability/evaluation/runner.py
410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 | |
runs_frame(results, metrics, *, suite=None, task=None)
One row per (pipeline, trial) with one column per requested metric.
Pivots the tidy SteeringEval.results() frame into the wide per-trial form that
summarize_runs and the plotting layer (steerability.evaluation.plotting) consume. The
config column is renamed pipeline and trial is renamed trial_id.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
results
|
DataFrame
|
The frame returned by |
required |
metrics
|
Mapping[str, str]
|
Mapping from output column name to a metric key, either |
required |
suite
|
str | None
|
Suite to select; required when the frame holds several. |
None
|
task
|
str | None
|
Task to select; required when the frame holds several. |
None
|
Returns:
| Type | Description |
|---|---|
DataFrame
|
The wide frame with columns |
DataFrame
|
column per |
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
KeyError
|
If a metric key matches nothing, or a bare metric name is ambiguous. |
Source code in steerability/evaluation/runner.py
476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 | |
samples_frame(results, log_root, *, scores, metadata_keys=(), suite=None, task=None, include_text=False)
One row per (pipeline, trial, sample) with per-sample scores read from the eval logs.
Reads each run record's task logs under log_root (the runner's save_dir) and flattens
their samples. scores maps an output column to a score key, either "scorer" for a
scalar-valued score or "scorer/key" for one key of a dict-valued score; scalar values
(numbers, booleans, and the C/I/P/N letter grades) are converted through
inspect_ai.scorer.value_to_float(), and any other value is kept raw. metadata_keys names
sample metadata entries to carry as columns. include_text adds the sample input and the
model completion.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
results
|
Mapping[str, list[dict]]
|
The |
required |
log_root
|
str | Path
|
Directory the run wrote its logs under (the runner's |
required |
scores
|
Mapping[str, str]
|
Mapping from output column name to a score key. Must be non-empty. |
required |
metadata_keys
|
Sequence[str]
|
Sample metadata entries to carry as columns. |
()
|
suite
|
str | None
|
Suite to select; required when the results span several. |
None
|
task
|
str | None
|
Task to select; required when the results span several. |
None
|
include_text
|
bool
|
Add the sample input and the model completion as |
False
|
Returns:
| Type | Description |
|---|---|
DataFrame
|
A |
DataFrame
|
|
DataFrame
|
|
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
KeyError
|
If a score key names a scorer or dict key absent from a sample. |
Source code in steerability/evaluation/runner.py
581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 | |
summarize_runs(runs, metric_cols, group_cols=('pipeline', 'config_id'), param_cols=())
Aggregate per-trial rows into {metric}_mean / {metric}_std / {metric}_sem rows.
Produces the summary-frame contract the plotting layer (steerability.evaluation.plotting)
consumes; the plots read {metric}_mean and {metric}_std, and {metric}_sem (the
standard error of the mean over trials) is carried for tabular reporting. Adds n_trials
(the non-null count of the first metric) and carries each param_cols entry with its
first value per group; param_cols entries absent from runs are ignored. A
single-trial group's std and sem are 0.0 rather than NaN, so the plotting layer draws a
zero-length error bar.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
runs
|
DataFrame
|
The wide per-trial frame from |
required |
metric_cols
|
Sequence[str]
|
Metric column names to aggregate. Must be non-empty. |
required |
group_cols
|
Sequence[str]
|
Grouping columns defining one configuration. |
('pipeline', 'config_id')
|
param_cols
|
Sequence[str]
|
Per-configuration columns (e.g. a swept argument) to carry through. |
()
|
Returns:
| Type | Description |
|---|---|
DataFrame
|
One row per group with the aggregated columns. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
Source code in steerability/evaluation/runner.py
704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 | |