Skip to content

feat: shared MultiRewardVerifyResponse (reward_components) as a trainer-agnostic multi-reward contract #1664

Description

@cwing-nvidia

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_advantage in verl/trainer/ppo/core_algos.py) reads component keys listed in algorithm.gdpo_reward_keys (e.g. ["accuracy_reward", "format_reward"]) out of non_tensor_batch, which the GDPO reward manager populates from the score function's result dict. VeRL also supports per-component weights via algorithm.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_components maps objective name → score; reward remains 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_multireward to 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_components in the NeMo Gym rollout path and pack it into positional reward1..K for 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 same reward_components dict is the right shape for it — once the VeRL↔Gym integration surfaces those keys into VeRL's score/reward_extra_info dict. This path hasn't been validated end-to-end yet (the VeRL integration may not pass reward_components through 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.

Activity

  1. added
    core-infra
    on Jun 23, 2026
  2. removed
    core-infra
    on Jul 2, 2026
  3. init-nikhil commented on Jul 14, 2026

    @init-nikhil
    Member

    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

  4. init-nikhil commented on Jul 16, 2026

    @init-nikhil
    Member

    Making the reward_components field required

    In the case of a MultiRewardVerifyResponse, I think we should keep the reward_components field required (non-optional).

    • if you subclass MultiRewardVerifyResponse, you're saying this env is multi-reward so reward_components should always be there
    • optional means trainers still have to handle the missing case, which defeats the point of a shared contract
    • opt-in is at the class level (MultiRewardVerifyResponse vs BaseVerifyResponse), not "maybe this field is set"
  5. init-nikhil commented on Jul 16, 2026

    @init-nikhil
    Member

    Not providing sum(reward_components.values() as the default reward

    I 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.

  6. moved this from Dev WIP to Review Todo in NeMo Gym 0.5.0 - Aug 5on Jul 20, 2026
  7. moved this from Review Todo to Dev WIP in NeMo Gym 0.5.0 - Aug 5on Jul 21, 2026
  8. moved this from Dev WIP to Review WIP in NeMo Gym 0.5.0 - Aug 5on Jul 21, 2026
  9. moved this from Done to QA Todo in NeMo Gym 0.5.0 - Aug 5on Jul 29, 2026
  10. added a commit that references this issue on Jul 29, 2026
    b995852
  11. moved this from QA Todo to QA WIP in NeMo Gym 0.5.0 - Aug 5on Jul 29, 2026
  12. moved this from QA WIP to QA Verified in NeMo Gym 0.5.0 - Aug 5on Aug 4, 2026
  13. moved this from QA Verified to Done in NeMo Gym 0.5.0 - Aug 5on Aug 4, 2026
  14. added a commit that references this issue on Aug 7, 2026
    15a4d8a
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions