Commit 5e7d351
refactor(evaluator)!: make runner and agent-eval metrics built-in
Storing a Gym or Harbor taskset meant bundling its reward metric with
`CloudpickleMetricBundlePackager()` -- the opt-in the docs correctly frame as
"shipping custom code" -- for a metric the platform owns. Same for the three
agent-eval metrics. None of them is custom: their entire state is JSON-able
scalars, so they belong in `MetricVariants` alongside the other 23 built-ins.
Promotes five: `GymRewardMetric`, `HarborRewardMetric`, `AgentPhaseSuccessMetric`,
`EvidencePresenceMetric`, `SkillUsedMetric`. Each gains a `MetricType` member and
subclasses `MetricBase` directly, carrying its own discriminator and fields.
No separate config class. The `values/` config + `metrics/` runtime split exists
to keep heavy runtime deps out of the config layer -- `metrics/bleu.py` imports
sacrebleu at module scope, so `values.metrics.BLEU` stays importable without it.
These five add no deps over their config, every config class in that module has
exactly one consumer (its own runtime subclass), and no values-level union
requires them to be co-located, so the split would be indirection that buys
nothing. The type strings are unchanged from what the metrics already emitted
(`gym_reward`, `harbor_reward`, ...), so nothing moves on the wire; what changes
is that they now bundle inline and rehydrate without executing pickled code.
BREAKING: `type` is now a fixed discriminator, so the `metric_type` override is
gone. `Field(discriminator="type")` cannot express a per-caller type string. The
override was used in exactly one place repo-wide -- a test fixture -- and cost
every caller the cloudpickle opt-in.
The two reward metrics could not simply subclass `MetricBase` where they lived.
`MetricBase` drags the dataset-schema stack (jinja2, jsonschema), and
`harbor_runtime` is on the optimizer's light import path, guarded by
`test_agent_eval_import_does_not_pull_the_execution_stack`. Defining them there
turned that test red. They now live in `metrics/runner_rewards.py` on the heavy
side, and `harbor_runtime` re-exports `HarborRewardMetric` through a module
`__getattr__` with a `TYPE_CHECKING` declaration, so `from ...harbor_runtime
import HarborRewardMetric` still works and still type-checks while the light path
stays light. The two default-metric construction sites import locally for the
same reason.
`gym/results.py` gets no such shim. It declares no `__all__`, never published
`GymRewardMetric` as part of its surface, and nothing imports the metric from
that path -- the deep-path imports are all private helpers. The public path is
`from ...runtimes.gym import GymRewardMetric`, which the package `__init__`
serves from the canonical module.
The skill's curated metric list deliberately does not gain these five. That page
is about choosing a scorer for your data, and none of them is a choice -- they
arrive with the runner or the harness. `test_skill_examples` records the
reasoning next to the existing `tunable-rag-evaluator` exemption.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Signed-off-by: Sandy Chapman <schapman@nvidia.com>1 parent 965a736 commit 5e7d351
18 files changed
Lines changed: 384 additions & 224 deletions
File tree
- packages/nemo_evaluator_sdk
- src/nemo_evaluator_sdk
- agent_eval
- runtimes
- gym
- metrics
- tests/agent_eval
- plugins/nemo-evaluator/tests
- sdk/python/nemo-platform/src/nemo_platform/beta/evaluator
- agent_eval
- runtimes
- gym
- metrics
Lines changed: 37 additions & 50 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
22 | | - | |
| 22 | + | |
23 | 23 | | |
24 | | - | |
| 24 | + | |
| 25 | + | |
25 | 26 | | |
26 | 27 | | |
27 | 28 | | |
| |||
30 | 31 | | |
31 | 32 | | |
32 | 33 | | |
33 | | - | |
34 | | - | |
| 34 | + | |
| 35 | + | |
35 | 36 | | |
36 | 37 | | |
37 | 38 | | |
| |||
45 | 46 | | |
46 | 47 | | |
47 | 48 | | |
48 | | - | |
| 49 | + | |
49 | 50 | | |
50 | 51 | | |
51 | | - | |
52 | | - | |
53 | | - | |
54 | | - | |
| 52 | + | |
| 53 | + | |
55 | 54 | | |
56 | | - | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
57 | 59 | | |
58 | | - | |
59 | | - | |
60 | | - | |
| 60 | + | |
61 | 61 | | |
62 | 62 | | |
63 | 63 | | |
| |||
70 | 70 | | |
71 | 71 | | |
72 | 72 | | |
73 | | - | |
| 73 | + | |
74 | 74 | | |
75 | 75 | | |
76 | 76 | | |
77 | 77 | | |
78 | 78 | | |
79 | 79 | | |
80 | 80 | | |
81 | | - | |
82 | | - | |
83 | | - | |
84 | | - | |
85 | | - | |
86 | | - | |
87 | | - | |
88 | | - | |
89 | | - | |
90 | | - | |
91 | | - | |
92 | | - | |
93 | | - | |
94 | | - | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
95 | 87 | | |
96 | 88 | | |
97 | | - | |
| 89 | + | |
98 | 90 | | |
99 | 91 | | |
100 | 92 | | |
101 | 93 | | |
102 | | - | |
| 94 | + | |
103 | 95 | | |
104 | | - | |
| 96 | + | |
105 | 97 | | |
106 | | - | |
| 98 | + | |
107 | 99 | | |
108 | 100 | | |
109 | 101 | | |
110 | | - | |
111 | | - | |
| 102 | + | |
| 103 | + | |
112 | 104 | | |
113 | 105 | | |
114 | | - | |
| 106 | + | |
115 | 107 | | |
116 | 108 | | |
117 | | - | |
| 109 | + | |
118 | 110 | | |
119 | 111 | | |
120 | 112 | | |
| |||
134 | 126 | | |
135 | 127 | | |
136 | 128 | | |
137 | | - | |
138 | | - | |
139 | | - | |
140 | | - | |
141 | | - | |
| 129 | + | |
| 130 | + | |
142 | 131 | | |
143 | | - | |
144 | | - | |
145 | | - | |
146 | | - | |
147 | | - | |
148 | | - | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
149 | 136 | | |
150 | 137 | | |
151 | 138 | | |
| |||
175 | 162 | | |
176 | 163 | | |
177 | 164 | | |
178 | | - | |
| 165 | + | |
179 | 166 | | |
180 | 167 | | |
181 | | - | |
| 168 | + | |
182 | 169 | | |
183 | 170 | | |
184 | 171 | | |
185 | 172 | | |
186 | | - | |
| 173 | + | |
187 | 174 | | |
188 | 175 | | |
189 | 176 | | |
| |||
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
72 | 72 | | |
73 | 73 | | |
74 | 74 | | |
75 | | - | |
76 | 75 | | |
| 76 | + | |
77 | 77 | | |
78 | 78 | | |
79 | 79 | | |
| |||
Lines changed: 8 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
25 | | - | |
26 | 25 | | |
27 | 26 | | |
28 | 27 | | |
| |||
94 | 93 | | |
95 | 94 | | |
96 | 95 | | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
97 | 103 | | |
98 | 104 | | |
99 | 105 | | |
| |||
156 | 162 | | |
157 | 163 | | |
158 | 164 | | |
159 | | - | |
| 165 | + | |
160 | 166 | | |
161 | 167 | | |
162 | 168 | | |
| |||
Lines changed: 0 additions & 28 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
29 | | - | |
30 | 29 | | |
31 | 30 | | |
32 | 31 | | |
| |||
43 | 42 | | |
44 | 43 | | |
45 | 44 | | |
46 | | - | |
47 | | - | |
48 | | - | |
49 | | - | |
50 | | - | |
51 | | - | |
52 | | - | |
53 | | - | |
54 | | - | |
55 | | - | |
56 | | - | |
57 | | - | |
58 | | - | |
59 | | - | |
60 | | - | |
61 | | - | |
62 | | - | |
63 | | - | |
64 | | - | |
65 | | - | |
66 | | - | |
67 | | - | |
68 | | - | |
69 | | - | |
70 | | - | |
71 | | - | |
72 | | - | |
73 | 45 | | |
74 | 46 | | |
75 | 47 | | |
| |||
Lines changed: 28 additions & 28 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
31 | 31 | | |
32 | 32 | | |
33 | 33 | | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
34 | 39 | | |
35 | 40 | | |
36 | 41 | | |
| |||
60 | 65 | | |
61 | 66 | | |
62 | 67 | | |
63 | | - | |
| 68 | + | |
64 | 69 | | |
65 | 70 | | |
66 | 71 | | |
| |||
174 | 179 | | |
175 | 180 | | |
176 | 181 | | |
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 | 182 | | |
204 | 183 | | |
205 | 184 | | |
| |||
1365 | 1344 | | |
1366 | 1345 | | |
1367 | 1346 | | |
1368 | | - | |
| 1347 | + | |
1369 | 1348 | | |
1370 | 1349 | | |
1371 | 1350 | | |
| |||
1493 | 1472 | | |
1494 | 1473 | | |
1495 | 1474 | | |
| 1475 | + | |
| 1476 | + | |
| 1477 | + | |
| 1478 | + | |
| 1479 | + | |
| 1480 | + | |
| 1481 | + | |
| 1482 | + | |
| 1483 | + | |
| 1484 | + | |
| 1485 | + | |
| 1486 | + | |
| 1487 | + | |
| 1488 | + | |
| 1489 | + | |
| 1490 | + | |
| 1491 | + | |
| 1492 | + | |
| 1493 | + | |
| 1494 | + | |
| 1495 | + | |
Lines changed: 9 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
36 | 36 | | |
37 | 37 | | |
38 | 38 | | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
39 | 48 | | |
40 | 49 | | |
41 | 50 | | |
| |||
0 commit comments