Skip to content

fix: validate DAPO integer labels without float coercion#2203

Open
morluto wants to merge 2 commits into
THUDM:mainfrom
morluto:fix/dapo-exact-integer-labels
Open

fix: validate DAPO integer labels without float coercion#2203
morluto wants to merge 2 commits into
THUDM:mainfrom
morluto:fix/dapo-exact-integer-labels

Conversation

@morluto

@morluto morluto commented Jul 14, 2026

Copy link
Copy Markdown

Problem

The DAPO scorer canonicalizes ground-truth labels with int(float(gt)). That conversion can change the reward result:

  • "0.5" becomes "0", so a prediction of 0 is incorrectly accepted.
  • Integers beyond binary64's exact range can be rounded before comparison. For example, 9007199254740993 no longer matches itself.

DAPO-Math-17K defines its labels as integers, so the scorer should validate that contract instead of truncating or rounding labels.

Change

  • Parse normalized labels with Decimal rather than binary floating point.
  • Reject malformed, non-finite, and non-integral labels with a contextual ValueError.
  • Canonicalize valid integral decimal and exponent spellings without losing large-integer precision.
  • Add CPU regressions for the false positive, precision loss, accepted integral spellings, and rejected label classes.

General symbolic verification and the rm_type=math path are intentionally unchanged.

Verification

  • Base regression proof against origin/main: failed because 0.5 was accepted as 0 and 9007199254740993 was rounded.
  • PYTHONPATH=. /tmp/slime-dapo-venv/bin/python -m pytest -q tests/test_rm_math_dapo.py — 34 passed.
  • ruff check slime/rollout/rm_hub/math_dapo_utils.py tests/test_rm_math_dapo.py — passed.
  • uvx --from black==24.3.0 --with click==8.0.2 black --check slime/rollout/rm_hub/math_dapo_utils.py tests/test_rm_math_dapo.py — passed.
  • Codex autoreview — no accepted or actionable findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@morluto morluto changed the title Validate DAPO integer labels without float coercion fix: validate DAPO integer labels without float coercion Jul 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant