[reward] code reward gives 1.0 to a program that fails a test after the first 10
for codecontests / apps / codeforces / taco, prime_code runs all tests once and if anything fails re-runs only the first 10 and returns passed/10. the first run already found the failing test but that result is thrown away, so a program right on 1-10 and wrong on 11 gets 1.0 like a correct one. sandbox_fusion does the same
repro on main (linux, or macos with mp.set_start_method("fork")):
import json
from verl.utils.reward_score import default_compute_score
tests = json.dumps({"inputs": [f"{i}\n" for i in range(1, 12)], "outputs": [f"{2*i}\n" for i in range(1, 12)]})
wrong = "```python\nn = int(input())\nprint(2 * n if n <= 10 else 0)\n```"
right = "```python\nn = int(input())\nprint(2 * n)\n```"
default_compute_score("codecontests", wrong, tests) # 1.0
default_compute_score("codecontests", right, tests) # 1.0from #1921 the second pass is there to give slow tests more time, fine for timeouts but a wrong answer wont change with more time. fix is to count a known wrong answer past test 10 as one more fail (10/11 here), timeouts and runtime errors left alone, same in sandbox_fusion. sending a PR with it and two tests right after this
used an AI assistant to help look into this and write the fix
Source: verl-project/verl