Skip to content

[rollout] fix: fix bug for remax when the rollout mode is async - #2574

Merged
vermouth1992 merged 1 commit into
verl-project:mainfrom
none0663:fix_vllm_async_mode_for_REMAX
Jul 16, 2025
Merged

vermouth1992 merged 1 commit into
verl-project:mainfrom
none0663:fix_vllm_async_mode_for_REMAX

Conversation

@none0663

Copy link
Copy Markdown
Contributor

What does this PR do?

fix bug for remax when the rollout mode is async, as metioned in #2551

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request correctly fixes a bug in the ReMax advantage estimation for asynchronous rollout mode by ensuring the correct sequence generator is used. My review identified one high-severity issue related to code duplication, which could pose a maintenance risk. I've recommended refactoring the duplicated logic into a helper method to improve maintainability and prevent future bugs.

Comment on lines +1188 to +1191
if not self.async_rollout_mode:
gen_baseline_output = self.actor_rollout_wg.generate_sequences(gen_baseline_batch)
else:
gen_baseline_output = self.async_rollout_manager.generate_sequences(gen_baseline_batch)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

high

This logic for selecting the sequence generator based on self.async_rollout_mode is duplicated from lines 1177-1180. This duplication creates a maintenance burden and increases the risk of introducing bugs if the logic needs to be updated in the future and one of the instances is missed.

To mitigate this risk and improve code clarity, I strongly recommend refactoring this repeated logic into a single helper method.

For example:

# In RayPPOTrainer class
def _get_sequence_generator(self):
    """Returns the appropriate sequence generator based on the rollout mode."""
    if self.async_rollout_mode:
        return self.async_rollout_manager
    return self.actor_rollout_wg

# Then the call sites can be simplified:
generator = self._get_sequence_generator()
gen_batch_output = generator.generate_sequences(gen_batch)
# ... and for the baseline:
gen_baseline_output = generator.generate_sequences(gen_baseline_batch)

Applying this pattern would make the code more robust and easier to maintain.

@vermouth1992 vermouth1992 changed the title [rollout] fix : fix bug for remax when the rollout mode is async [rollout] fix: fix bug for remax when the rollout mode is async Jul 16, 2025
@vermouth1992
vermouth1992 merged commit f0964b6 into verl-project:main Jul 16, 2025
@none0663
none0663 deleted the fix_vllm_async_mode_for_REMAX branch July 17, 2025 03:00
HelloWorld686 pushed a commit to HelloWorld686/verl that referenced this pull request Jul 17, 2025
…-project#2574)

### What does this PR do?

> fix bug for remax when the rollout mode is async, as metioned in
verl-project#2551
yellowbee686 pushed a commit to yellowbee686/verl that referenced this pull request Jul 25, 2025
…-project#2574)

### What does this PR do?

> fix bug for remax when the rollout mode is async, as metioned in
verl-project#2551
oseyosey pushed a commit to oseyosey/verl that referenced this pull request Jul 28, 2025
…-project#2574)

### What does this PR do?

> fix bug for remax when the rollout mode is async, as metioned in
verl-project#2551
Juniper1021 pushed a commit to Juniper1021/verl that referenced this pull request Aug 7, 2025
…-project#2574)

### What does this PR do?

> fix bug for remax when the rollout mode is async, as metioned in
verl-project#2551
whatadayG pushed a commit to whatadayG/verl that referenced this pull request Sep 5, 2025
…-project#2574)

### What does this PR do?

> fix bug for remax when the rollout mode is async, as metioned in
verl-project#2551
chenjiaoAngel added a commit to chenjiaoAngel/verl that referenced this pull request Nov 14, 2025
…-project#2574)

### What does this PR do?

> fix bug for remax when the rollout mode is async, as metioned in
verl-project#2551
TimurTaepov pushed a commit to giorgossideris/verl that referenced this pull request Dec 20, 2025
…-project#2574)

### What does this PR do?

> fix bug for remax when the rollout mode is async, as metioned in
verl-project#2551
oseyosey pushed a commit to oseyosey/verl that referenced this pull request Jan 20, 2026
…-project#2574)

### What does this PR do?

> fix bug for remax when the rollout mode is async, as metioned in
verl-project#2551
vyomakesh0728 added a commit to vyomakesh0728/verl that referenced this pull request Jan 22, 2026
…-project#2574)

### What does this PR do?

> fix bug for remax when the rollout mode is async, as metioned in
verl-project#2551
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.

2 participants