Repository navigation
[rl] Generator metrics are always generator/*; validation renames its own - #5969
felipemello1 merged 2 commits into
Conversation
|
Claude finished @felipemello1's task in 1m 10s —— View job Approve (please fill in the empty "Summary (human-written)" section before merging) -- review |
There was a problem hiding this comment.
Verdict: Approve -- please address the item below before merging -- the diff removes metrics_prefix from the whole generate path, every in-repo caller is updated, and the W&B keys stay what they were. One description item is still open.
What this PR does. It deletes the metrics_prefix argument that went from the controller through InterGeneratorRouter, the Monarch router and generator actors, Generator, EngineLoop and RequestDispatcher. The dispatcher now writes literal generator/* keys. _collect_validation_rollouts renames generator/* to validation_generator/* after compute_rollout_metrics. Because no generate_fn carries a per-kind label anymore, the Verifiers GenerationServer keeps one generate_fn slot, and replacing it is now harmless.
Example.
Verifiers env, a training group and a validation group overlap (possible once #5228 lands):
base: validation sets the server's generate_fn last -> a training turn logs validation_generator/queue_time_ms
this PR: both fns are identical -> every turn logs generator/queue_time_ms;
only validation's own turns are renamed -> validation_generator/queue_time_ms
Training keys (generator/*) and validation keys (validation_generator/*) on W&B: unchanged.
Must fix
- PR description -- the "Summary (human-written)" section is empty. The author needs to fill it in. Per
CONTRIBUTING.md, agents don't write this section.
Details
Details
- Gate: on main the problem is latent, since validation never overlaps a running training rollout. The description says so, and the change is a net simplification (+96/-82, nearly all of the growth is the new test and the import block). It's a prerequisite for #5228. Moving the label out of the request path is the right layer: one function with no label is correct no matter which group calls it, and a keyed-per-group server (#5948) would add lifetime state that only fixes Verifiers.
- Callsite audit:
metrics_prefixhas no remaining references in the repo. I found no other producer ofgenerator/*turn metrics (the only ones aredispatcher.py:271anddispatcher.py:391-413), so the rename incontroller.py:780-783touches only generator metrics. Therollout/- andvalidation/-prefixed keys fromcompute_rollout_metricsdon't start withgenerator/. - The console allowlist in
observability/metrics/processor.py:62-66still matches the training keys. - The Verifiers comment at
rollouter.py:254-255is accurate:generation_server.py:199readsgroup_idfrom each request's sampling params, not from the closure. - New test
test_validation_renames_generator_metrics: it guards a metric-key invariant that would otherwise break silently, and it's the only test that runs_collect_validation_rollouts. Placement is fine.
A maintainer still needs to review (this touches RL generator core).
3f215a5 to
9f009d7
Compare
tianyu-l
left a comment
There was a problem hiding this comment.
much nicer!
Actually, when I reviewed the previous PR that added "metrics_prefix" to functions, I didn't feel right but let go. I feel in the future we could be more sensitive to such fragile code, even without concrete counter-examples. But changing code is easy nowadays, so not a big deal.
… own The generate path no longer takes metrics_prefix (controller, InterGeneratorRouter, Monarch router and generator, Generator, engine loop, dispatcher). Every request's metrics are named generator/*, and the controller builds one kind of generate_fn for training and validation. _collect_validation_rollouts renames its turns' generator/* metrics to validation_generator/* after results return, so the W&B keys stay as before. This removes a Verifiers bug: its HTTP server holds one generate_fn, replaced by each group that starts, so a request could log under the label of another group's kind.
…name is a loop a later case extends
9f009d7 to
5eb96a2
Compare
Summary (human-written)
Agent details
Stack: main <- #5944 <- this PR <- #5228. Supersedes #5948 (one
generate_fnper group, kept in a dict).TLDR: The generate path no longer carries a metrics label. Generators always name their metrics
generator/*, and validation renames its own tovalidation_generator/*after results return, so the W&B keys stay as on main. #5228 (validation beside training) needs this first: Verifiers' HTTP server holds onegenerate_fn, so once groups of both kinds overlap, a request can log under the other kind's label.Problem
generate_fn: training's sendsmetrics_prefix="generator", validation's"validation_generator".InterGeneratorRouter, the Monarch router and generator,Generator, engine loop, dispatcher.generate_fn(GenerationServer.set_generate_fn). Each group that starts replaces it.Solution
metrics_prefixfrom the generate path. The dispatcher spells each key:generator/queue_time_ms,generator/num_cached_tokens, ..._collect_validation_rolloutsrenames its turns'generator/*metrics tovalidation_generator/*after results return.generator/*for training,validation_generator/*for validation), theGenerateFncontract, routing and request ids._collect_validation_rolloutsand the spelled keys in_prepare_generation_request_metrics. The other files only delete the parameter, plus one comment in the Verifiers rollouter and the new test.You may ask:
generate_fnper group in the Verifiers server, keyed by group id ([rl] Verifiers: one GenerateFn per running rollout group #5948)? It fixes Verifiers only and adds a per-group lifetime. A function with no label can't be the wrong one, whatever calls it. This PR replaces [rl] Verifiers: one GenerateFn per running rollout group #5948.validation_generator/*and notvalidation/generator/*? Dashboards and old runs keep their keys.NOTE:
generator/*key on its turns, and a failed group drops its turns' metrics.metrics_prefixneed a rebase that drops it.rollout_samples.jsonlis unchanged.Test plan
test_async_controller.py::test_validation_renames_generator_metrics. It fails when the rename is removed.test_generator.py,test_engine_loop.py,test_async_controller.py: the calls dropmetrics_prefix.test_metric_timing_mathnow checksgenerator/*keys.