Skip to content

[rl] Fix default validation console keys so the reward is printed - #4938

Draft
lokic233 wants to merge 1 commit into
pytorch:mainfrom
lokic233:fix/rl-validation-console-keys
Draft

lokic233 wants to merge 1 commit into
pytorch:mainfrom
lokic233:fix/rl-validation-console-keys

Conversation

@lokic233

Copy link
Copy Markdown

Summary

MetricsProcessor.Config.console_log_keys_validation defaults to validation/reward/_mean and validation/reward/_max (torchtitan/rl/observability/metrics/processor.py). Those keys are never emitted:

  • The validation reward comes from compute_rollout_metrics(prefix="validation") (torchtitan/rl/controller.py:691) as m.Metric(f"{prefix}_reward", m.SummaryStats...). After reduction the keys are validation_reward/_mean, validation_reward/_max, and so on.
  • _filter_allow_list (torchtitan/rl/observability/metrics/console.py) runs re.search for each pattern, and neither default pattern matches any emitted key.

So the default validation console line has never shown the reward. The metric backends were not affected, because they receive every key.

The train-side default already uses the emitted form (rollout_reward/_mean). The math examples override the validation list with validation_reward/_mean/_max, and rl/examples/search_r1/README.md tells users to watch validation_reward/_mean. The existing console tests use synthetic validation/reward/_mean keys, which is why they never caught the mismatch.

Changes

  • Change the two default patterns to validation_reward/_mean and validation_reward/_max.
  • Add test_default_validation_allow_list_matches_emitted_reward_keys. It feeds real compute_rollout_metrics output through the default config and asserts that both reward keys are printed.

Test plan

Run on Linux x86_64 with Python 3.12, torch 2.14.0+cpu, torchmonarch 0.6.0 and torchstore at main. vLLM was installed without its CUDA dependencies.

PYTHONPATH=$PWD pytest -p no:asyncio tests/rl/unit_tests/cpu/test_metrics.py
# with this change:                 80 passed
# processor.py reverted to main:    1 failed (the new test), 79 passed

PYTHONPATH=$PWD HF_HUB_OFFLINE=1 pytest -p no:asyncio --continue-on-collection-errors \
  --ignore=tests/rl/unit_tests/cpu/test_muse_glimmer_renderer.py tests/rl/unit_tests/cpu
# with this change: 320 passed, 2 skipped, 1 error
# main:             319 passed, 2 skipped, 1 error

Two parts of the suite could not run locally:

  • test_verifiers.py hits a collection error because the optional verifiers package is not installed here. It fails the same way on main.
  • test_muse_glimmer_renderer.py was ignored because its tokenizer fixture downloads from the HF Hub, which this machine cannot reach.

CI covers both.

compute_rollout_metrics(prefix="validation") emits the reward as
validation_reward with SummaryStats, which reduces to validation_reward/_mean,
validation_reward/_max, ... The default console_log_keys_validation patterns
were validation/reward/_mean and validation/reward/_max, which never match, so
the default validation console line never showed the reward.

Use the emitted form (as the train-side default and the math examples already
do) and add a test that feeds real compute_rollout_metrics output through the
default config.
@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Sep 29, 2026
@pytorch-bot

pytorch-bot Bot commented Sep 29, 2026 •

Copy link
Copy Markdown

Workflows were awaiting approval. CI has now been triggered for the ciflow labels on this PR.

@tianyu-l

tianyu-l commented Oct 7, 2026

Copy link
Copy Markdown
Contributor

is this review ready?

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ciflow/rl CLA Signed This label is managed by the Meta Open Source bot.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants