#7364·trl

OpenReward's default GRPO reward function cannot distinguish "never scored" from "scored 0.0"

Author: shaurya416Created Sep 24, 2026Updated Sep 30, 2026

trl/experimental/openreward/environment.py:192 initializes self.reward to 0.0 and only overwrites it inside _call_ors_tool (environment.py:266-296) when a tool call returns a non-null reward. A rollout that never calls a reward-bearing tool -- gives up, hits max_tool_calling_iterations, or has every tool call raise -- leaves self.reward at its untouched 0.0 default. trl/experimental/openreward/_spec.py:69-75's _outcome_only_reward_func, the reward_funcs= every OpenRewardSpec-based GRPOTrainer gets by default, returns env.reward unconditionally:

python
# _spec.py:69-75
def _outcome_only_reward_func(environments, **_):
    """Default reward function: last non-null reward in each rollout's trajectory."""
    return [env.reward for env in environments]

So a rollout that was never scored and a rollout that was scored and genuinely failed both report the identical 0.0.

Measured

Verbatim-substitution repro (function bodies above copied unmodified into a standalone harness with a fake _session.call_tool; pip install trl[openreward] is network/classifier-gated so this is a source substitution, not a live run):

Case Tool calls made self.rewards env.reward _outcome_only_reward_func output
A — never scored (gives up / crashes before submitting) none [] 0.0 0.0
B — attempted, genuinely wrong (test_wrong_echo_returns_no_match_with_zero_reward) 1, returns reward=0.0 [0.0] 0.0 0.0
C — attempted, genuinely correct 1, returns reward=1.0 [1.0] 1.0 1.0

A and B are bitwise identical downstream even though only B represents an actual outcome.

Prior art: this was already fixed once, in a PR that stalled and got closed

PR #6430 implemented exactly this fix (a has_reward flag, set only when a tool call returns a non-null reward, reset in reset(), with _outcome_only_reward_func returning None — not 0.0 — when has_reward is False, so unscorable_mask correctly excludes it) and got a substantive positive review from a maintainer: "this is a clean, well-reasoned fix for a real reward-hacking vector." It was then closed unmerged over an unrelated SDPO test-coverage issue and swept by a blanket low-trust-account label applied to many unrelated PRs around the same time, not a technical rebuttal of the diagnosis. The underlying code (environment.py, _spec.py) has had no commits since, so the bug is still live at current HEAD. Filing this as a clean issue so the diagnosis has a stable home independent of that PR, in case someone wants to pick the fix back up.

Happy to open the PR.