Skip to content

Comments

[trainer] fix: Address feedback on critic update logic from commit ff…#2229

Closed
xingyunjohn1 wants to merge 2 commits intoverl-project:mainfrom
xingyunjohn1:fix/critic-update-logic
Closed

[trainer] fix: Address feedback on critic update logic from commit ff…#2229
xingyunjohn1 wants to merge 2 commits intoverl-project:mainfrom
xingyunjohn1:fix/critic-update-logic

Conversation

@xingyunjohn1
Copy link
Contributor

[trainer] fix: Address feedback on critic update logic from commit ff750e2

What does this PR do?

Thanks @vermouth1992 !
This PR addresses the feedback provided in commit ff750e2 regarding the actor-critic update logic in examples/split_placement/split_monkey_patch.py.

It ensures that the actor model is updated, and that this update occurs after the critic model. Additionally, the critic update is now wrapped in a conditional block to make its usage optional via the self.use_critic flag.

Checklist Before Starting

  • Search for similar PRs. Paste at least one query link here: [trainer] fix: fix split placement #2227
  • Format the PR title as [{modules}] {type}: {description} (This will be checked by the CI)
    • {modules} include fsdp, megatron, sglang, vllm, rollout, trainer, ci, training_utils, recipe, hardware, deployment, ray, worker, single_controller, misc, perf, model, algo, env, tool, ckpt, doc, data
    • If this PR involves multiple modules, separate them with , like [megatron, fsdp, doc]
    • {type} is in feat, fix, refactor, chore, test
    • If this PR breaks any API (CLI arguments, config, function signature, etc.), add [BREAKING] to the beginning of the title.
    • Example: [BREAKING][fsdp, megatron] feat: dynamic batching

Test

For changes that can not be tested by CI (e.g., algorithm implementation, new model support), validate by experiment(s) and show results like training curve plots, evaluation results, etc.

API and Usage Example

Demonstrate how the API changes if any, and provide usage example(s) if possible.

# Add code snippet or script demonstrating how to use this

High-Level Design

Demonstrate the high-level design if this PR is complex.

Specific Changes

List the specific changes.

Checklist Before Submitting

Important

Please check all the following items before requesting a review, otherwise the reviewer might deprioritize this PR for review.

xingyunjohn1 referenced this pull request Jun 27, 2025
…re (#2143)

### What does this PR do?

This PR addresses an `IndentationError` that was causing the
`critic_output.get()` call to fail when `self.use_critic` was false.

### Checklist Before Starting

- [x] Search for similar PRs. [The PR cause the
problem](#281)
- [x] Format the PR title as `[{modules}] {type}: {description}` (This
will be checked by the CI)
- `{modules}` include `fsdp`, `megatron`, `sglang`, `vllm`, `rollout`,
`trainer`, `ci`, `training_utils`, `recipe`, `hardware`, `deployment`,
`ray`, `worker`, `single_controller`, `misc`, `perf`, `model`, `algo`,
`env`, `tool`, `ckpt`, `doc`, `data`
- If this PR involves multiple modules, separate them with `,` like
`[megatron, fsdp, doc]`
  - `{type}` is in `feat`, `fix`, `refactor`, `chore`, `test`
- If this PR breaks any API (CLI arguments, config, function signature,
etc.), add `[BREAKING]` to the beginning of the title.
  - Example: `[BREAKING][fsdp, megatron] feat: dynamic batching`

### Test

> For changes that can not be tested by CI (e.g., algorithm
implementation, new model support), validate by experiment(s) and show
results like training curve plots, evaluation results, etc.

### API and Usage Example

> None. This is just a simple bug fix involving a few lines of code.

```python
# Add code snippet or script demonstrating how to use this
```

### High-Level Design

> This is just a simple bug fix involving a few lines of code.

### Specific Changes

> This is just a simple bug fix involving a few lines of code.

### Checklist Before Submitting

> [!IMPORTANT]
> Please check all the following items before requesting a review,
otherwise the reviewer might deprioritize this PR for review.

- [x] Read the [Contribute
Guide](https://github.com/volcengine/verl?tab=readme-ov-file#contribution-guide).
- [ ] Apply [pre-commit
checks](https://github.com/volcengine/verl?tab=readme-ov-file#code-linting-and-formatting):
`pre-commit install && pre-commit run --all-files --show-diff-on-failure
--color=always`
- [ ] Add / Update [the
documentation](https://github.com/volcengine/verl/tree/main/docs).
- [ ] Add unit or end-to-end test(s) to [the CI
workflow](https://github.com/volcengine/verl/tree/main/.github/workflows)
to cover all the code. If not feasible, explain why: ...
- [ ] Once your PR is ready for CI, send a message in [the `ci-request`
channel](https://verl-project.slack.com/archives/C091TCESWB1) in [the
`verl` Slack
workspace](https://join.slack.com/t/verl-project/shared_invite/zt-3855yhg8g-CTkqXu~hKojPCmo7k_yXTQ).
actor_output = actor_output.get()
actor_output_metrics = reduce_metrics(actor_output.meta_info["metrics"])
metrics.update(actor_output_metrics)
actor_output = actor_output.get()
Copy link
Collaborator

Choose a reason for hiding this comment

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

This is still not correct. See #2227

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thank you for pointing out the issues in my code.

After checking the original codebase, I can confirm that the condition if self.config.trainer.critic_warmup <= self.global_steps: should indeed be added at L188 to ensure the critic warmup is implemented.

I also noted that PR #2227 moved the actor update to occur before the critic update, which is inconsistent with the logic in verl/trainer/ppo/ray_trainer.py.

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