Scorers
steerability.evaluation.scorers
Adapt Inspect scorers into per-row SampleScorer rewards for steering controls.
The adapter lets an Inspect scorer (includes(), match(), model_graded_fact(...)) drive
controls that consume a SampleScorer (prompt optimizers, sequence rerankers) while algorithms/
stays free of Inspect imports. A model-graded scorer used this way runs grader traffic from inside
a control's steer() or decode loop; when the grader is a local model it shares the GPU with the
pipeline, so prefer API graders or size headroom accordingly.
sample_scorer_from_inspect(scorer, *, target_key='reference', to_float=None, model_name='steerability/sample-scorer')
Adapt an Inspect scorer into a per-row SampleScorer.
Each call builds a standalone TaskState from the row (row["input"] as the user turn, the
response as the assistant turn, row[target_key] as the target, the row as metadata), runs the
scorer, and converts Score.value to a float.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
scorer
|
Scorer
|
The Inspect scorer to adapt. |
required |
target_key
|
str
|
Row key holding the reference target; a missing or None value scores against an empty target. |
'reference'
|
to_float
|
Callable | None
|
Converts |
None
|
model_name
|
str
|
Model name recorded on the constructed state and output. |
'steerability/sample-scorer'
|
Returns:
| Type | Description |
|---|---|
SampleScorer
|
A |
Source code in steerability/evaluation/scorers.py
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 | |