Skip to content

Conversation

simonsays1980
Copy link
Contributor

@simonsays1980 simonsays1980 commented Oct 6, 2025

Why are these changes needed?

Computing the num_module_steps_trained_(lifetime)_throughput metrics are biased due to the way how we record throughput times in a loop over module batches. This PR offers a fix to this bias.

Related issue number

Checks

  • I've signed off every commit(by using the -s flag, i.e., git commit -s) in this PR.
  • I've run pre-commit jobs to lint the changes in this PR. (pre-commit setup)
  • I've included any doc changes needed for https://docs.ray.io/en/master/.
    • I've added any new APIs to the API Reference. For example, if I added a
      method in Tune, I've added it in doc/source/tune/api/ under the
      corresponding .rst file.
  • I've made sure the tests are passing. Note that there might be a few flaky tests, see the recent failures at https://flakey-tests.ray.io/
  • Testing Strategy
    • Unit tests
    • Release tests
    • This PR is not tested :(

Signed-off-by: simonsays1980 <[email protected]>
@simonsays1980 simonsays1980 marked this pull request as ready for review October 6, 2025 16:11
@simonsays1980 simonsays1980 requested a review from a team as a code owner October 6, 2025 16:11
@simonsays1980 simonsays1980 added rllib RLlib related issues rllib-multi-agent An RLlib multi-agent related problem. rllib-logging This problem is related to logging metrics labels Oct 6, 2025
cursor[bot]

This comment was marked as outdated.

@kamil-kaczmarek kamil-kaczmarek changed the title LINTER [RLlib] [fix] [metrics] avoid biasing the throughput Oct 7, 2025
Copy link
Contributor

@kamil-kaczmarek kamil-kaczmarek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great catch! Some Small fixes needed.

cursor[bot]

This comment was marked as outdated.

self.metrics.log_value(
key=(mid, NUM_MODULE_STEPS_TRAINED_LIFETIME),
value=module_batch_size,
reduce="sum",
Copy link
Contributor

@kamil-kaczmarek kamil-kaczmarek Oct 8, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the learner we report this with_throughput=True

Let's add with_throughput=True here to standardize this and make sure we have consistent metrics.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We'd need to add with_throughput=True here.

Copy link
Contributor

@kamil-kaczmarek kamil-kaczmarek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey! Added few more comments to make sure that we report metrics consistently for both learner and differentiable_learner.

Thanks for being patient with this PR!

@simonsays1980 simonsays1980 requested review from a team as code owners October 9, 2025 08:33
@simonsays1980 simonsays1980 requested review from a team, edoakes and jjyao as code owners October 9, 2025 08:33
cursor[bot]

This comment was marked as outdated.

@simonsays1980 simonsays1980 force-pushed the fix-module-steps-throughputs branch from 7c42aaa to ddcaeab Compare October 9, 2025 09:06
@simonsays1980 simonsays1980 requested review from kamil-kaczmarek and removed request for a team, edoakes and jjyao October 9, 2025 13:54
Copy link
Contributor

@kamil-kaczmarek kamil-kaczmarek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just one last edit and we're good to go 🚀

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

Labels

rllib RLlib related issues rllib-logging This problem is related to logging metrics rllib-multi-agent An RLlib multi-agent related problem.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants