Repository navigation
Description
Background
resources_servers/example_tool_call_multireward defines its own ToolCallMultiRewardVerifyResponse(BaseVerifyResponse) with a reward_components field (plus example-specific top-level scores). There is no shared base for this in nemo_gym — any new multi-reward environment must re-roll the field itself, and there's nothing that pins down the field name/shape that downstream training-framework integrations read by name.
NeMo Gym integrates with multiple RL frameworks (e.g. NeMo-RL, VeRL, Unsloth), each needs a consistent way to read per-objective rewards off a Gym verify result:
- NeMo-RL consumes per-component rewards positionally as
reward1, reward2, ...batch keys (see Support multi-objective (GDPO) rewards for NeMo Gym environments RL#2892 for wiring the NeMo Gym path). - VeRL consumes them by name: its GDPO advantage estimator (
compute_gdpo_outcome_advantageinverl/trainer/ppo/core_algos.py) reads component keys listed inalgorithm.gdpo_reward_keys(e.g.["accuracy_reward", "format_reward"]) out ofnon_tensor_batch, which the GDPO reward manager populates from the score function's result dict. VeRL also supports per-component weights viaalgorithm.gdpo_reward_weights.
So the multi-reward output should be defined once, generically, in nemo_gym as the producer-side contract, and each framework integration consumes it as appropriate — rather than each environment inventing its own field and each integration guessing at it. A {name: score} dict serves both: VeRL maps it almost directly (it's name-keyed), and NeMo-RL packs it into positional reward1..K.
Proposal
Add a MultiRewardVerifyResponse base/mixin in nemo_gym defining reward_components: dict[str, float] | None = None, documented as the canonical, trainer-agnostic way for a verifier to emit multiple reward objectives:
reward_componentsmaps objective name → score;rewardremains the scalar (recommended: the sum) so single-reward consumers are unaffected.- It's the responsibility of each RL-framework integration to consume
reward_components(e.g. pack it into whatever per-component representation the trainer expects). The packing/ordering is the integration's concern, not the verifier's — the only producer-side guarantee is the stable{name: score}dict. - Optionally provide a helper that sets
reward = sum(reward_components.values()). - Migrate
example_tool_call_multirewardto extend it, and update the multi-reward verifier how-to doc (docs: multi-reward verification #1661) to reference the shared class instead of an env-local one.
Consumers / sequencing
- NeMo-RL is the first integration to wire this up: see Support multi-objective (GDPO) rewards for NeMo Gym environments RL#2892 (read
reward_componentsin the NeMo Gym rollout path and pack it into positionalreward1..Kfor GDPO). The shape should be aligned with that work so it's validated against a real consumer. - VeRL already ships GDPO and consumes per-component rewards by name (
algorithm.gdpo_reward_keys), so the samereward_componentsdict is the right shape for it — once the VeRL↔Gym integration surfaces those keys into VeRL's score/reward_extra_infodict. This path hasn't been validated end-to-end yet (the VeRL integration may not passreward_componentsthrough today), so we should confirm it against a real GDPO run. Because VeRL selects components by name, the component names are part of this contract, not just the values.
Out of scope
- Per-objective top-level fields (e.g.
correctness,schema_valid,format) stay environment-specific — they exist only so aggregate-metrics profiles them during evaluation, and their names are the env's choice.
Related: #1661, #1662, NVIDIA-NeMo/RL#2892.
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsDone
Activity
init-nikhil commentedon Jul 14, 2026
I am up to speed on Gym overall architecture now, I've started to tackle this. Will get a first draft PR up.
cc: @ananthsub @bernardwin
init-nikhil commentedon Jul 16, 2026
Making the
reward_componentsfield requiredIn the case of a
MultiRewardVerifyResponse, I think we should keep thereward_componentsfield required (non-optional).MultiRewardVerifyResponse, you're saying this env is multi-reward so reward_components should always be thereinit-nikhil commentedon Jul 16, 2026
Not providing
sum(reward_components.values()as the defaultrewardI don't think we should implicitly aggregate with sum. The aggregation strategy is part of the reward/task definition, and an unweighted sum isn't the common case in modern LLM post-training. Making sum the default bakes in an opinionated choice that will be wrong for many workloads.
verify()in each env definition will specify how to aggregate rewards and if that's not enough, advanced trainer integrations can choose to do custom logic using the reward components.feat: add BaseMultiRewardVerifyResponse for shared multi-reward contr…
feat: add BaseMultiRewardVerifyResponse for shared multi-reward contr…