Skip to content

[fsdp] fix: use torch 2.7 state dict api for torch 2.6 to resolve OOM - #2606

Merged
eric-haibin-lin merged 4 commits into
verl-project:mainfrom
weifengpy:main
Jul 23, 2025
Merged

eric-haibin-lin merged 4 commits into
verl-project:mainfrom
weifengpy:main

Conversation

@weifengpy

@weifengpy weifengpy commented Jul 17, 2025 •

Copy link
Copy Markdown
Contributor

What does this PR do?

for torch==2.6.0, distributed state dict is buggy and can leads to OOM
copy the fixed state dict api from torch==2.7.0 to verl/third_party. It's convinent for users who cannot upgrade to torch==2.7.0

Checklist Before Starting

  • Search for similar PRs. Paste at least one query link here: ...
  • 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.

HYDRA_FULL_ERROR=1 CUDA_LAUNCH_BLOCKING=1 python3 -m verl.trainer.main_ppo       algorithm.adv_estimator=grpo       data.train_files=$HOME/data/gsm8k/train.parquet       data.val_files=$HOME/data/gsm8k/test.parquet       data.train_batch_size=512       data.max_prompt_length=1024       data.max_response_length=2048       data.filter_overlong_prompts=True       data.truncation='error'       data.image_key=images       actor_rollout_ref.model.path=Qwen/Qwen2.5-VL-32B-Instruct       actor_rollout_ref.model.use_remove_padding=True       actor_rollout_ref.model.enable_gradient_checkpointing=True       actor_rollout_ref.actor.strategy=fsdp2       actor_rollout_ref.actor.optim.lr=1e-6       actor_rollout_ref.actor.ppo_mini_batch_size=128       actor_rollout_ref.actor.ppo_micro_batch_size_per_gpu=10       actor_rollout_ref.actor.use_kl_loss=True       actor_rollout_ref.actor.kl_loss_coef=0.01       actor_rollout_ref.actor.kl_loss_type=low_var_kl       actor_rollout_ref.actor.entropy_coeff=0       actor_rollout_ref.rollout.name=vllm       actor_rollout_ref.rollout.log_prob_micro_batch_size_per_gpu=20       actor_rollout_ref.rollout.tensor_model_parallel_size=4       actor_rollout_ref.rollout.gpu_memory_utilization=0.6       actor_rollout_ref.rollout.enable_chunked_prefill=True       actor_rollout_ref.rollout.enforce_eager=False       actor_rollout_ref.rollout.free_cache_engine=False       actor_rollout_ref.rollout.n=5      actor_rollout_ref.ref.strategy=fsdp2       actor_rollout_ref.ref.log_prob_micro_batch_size_per_gpu=20       actor_rollout_ref.ref.fsdp_config.param_offload=True       trainer.critic_warmup=0       trainer.logger=['console','tensorboard']       trainer.project_name='verl_grpo_example_geo3k'       trainer.experiment_name='qwen2_5_vl_32b_function_rm'       trainer.n_gpus_per_node=8      trainer.nnodes=1       trainer.save_freq=-1       trainer.test_freq=5       trainer.total_epochs=5

Design & Code Changes

Demonstrate the high-level design if this PR is complex, and 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.

FSDP2 memory snapshot: cpu offloading works and peak memory is slightly lower than FSDP1
Screenshot 2025-07-17 at 14 53 49

@CLAassistant

CLAassistant commented Jul 17, 2025 •

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@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 addresses an Out-Of-Memory issue in torch<2.7 by backporting the state_dict API from torch 2.7. The approach of vendoring the newer code and using it conditionally based on the PyTorch version is sound. However, the changes include debugging code in verl/workers/fsdp_workers.py that must be removed before merging, as it contains a hard breakpoint that will halt execution.

Comment thread verl/workers/fsdp_workers.py Outdated

@register(dispatch_mode=Dispatch.ONE_TO_ALL)
def init_model(self):
torch.cuda.memory._record_memory_history(max_entries=10000000)

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.

critical

This line appears to be for debugging memory usage and uses an internal PyTorch API (_record_memory_history). This should be removed before merging to avoid unintended side effects in production.

Comment thread verl/workers/fsdp_workers.py Outdated
Comment on lines +586 to +608
try:
(
self.actor_module_fsdp,
self.actor_optimizer,
self.actor_lr_scheduler,
self.actor_model_config,
) = self._build_model_optimizer(
model_path=local_path,
fsdp_config=fsdp_config,
optim_config=optim_config,
override_model_config=override_model_config,
use_remove_padding=use_remove_padding,
use_fused_kernels=use_fused_kernels,
enable_gradient_checkpointing=self.config.model.get("enable_gradient_checkpointing", False),
trust_remote_code=self.config.model.get("trust_remote_code", False),
use_liger=self.config.model.get("use_liger", False),
role="actor",
enable_activation_offload=self.config.model.get("enable_activation_offload", False),
)
except Exception:
torch.cuda.memory._dump_snapshot(f"{self.config.actor.strategy}_rank{torch.distributed.get_rank()}.pkl")
torch.cuda.memory._dump_snapshot(f"{self.config.actor.strategy}_rank{torch.distributed.get_rank()}.pkl")
torch.distributed.breakpoint()

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.

critical

This try...except block and the subsequent lines for memory snapshotting and breakpointing appear to be debugging code. The torch.distributed.breakpoint() will halt execution, and memory dumps are not intended for production code. This debugging logic should be removed.

            (
                self.actor_module_fsdp,
                self.actor_optimizer,
                self.actor_lr_scheduler,
                self.actor_model_config,
            ) = self._build_model_optimizer(
                model_path=local_path,
                fsdp_config=fsdp_config,
                optim_config=optim_config,
                override_model_config=override_model_config,
                use_remove_padding=use_remove_padding,
                use_fused_kernels=use_fused_kernels,
                enable_gradient_checkpointing=self.config.model.get("enable_gradient_checkpointing", False),
                trust_remote_code=self.config.model.get("trust_remote_code", False),
                use_liger=self.config.model.get("use_liger", False),
                role="actor",
                enable_activation_offload=self.config.model.get("enable_activation_offload", False),
            )

Comment thread verl/workers/fsdp_workers.py Outdated
)
except Exception:
torch.cuda.memory._dump_snapshot(f"{self.config.actor.strategy}_rank{torch.distributed.get_rank()}.pkl")
torch.cuda.memory._dump_snapshot(f"{self.config.actor.strategy}_rank{torch.distributed.get_rank()}.pkl")

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

is this code for debugging only?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

yeap. I will update the PR to undo all the changes to fsdp_workder.py

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

done. the PR is now ready for review

Summary:

Test Plan:

Reviewers:

Subscribers:

Tasks:

Tags:
Comment thread verl/utils/fsdp_utils.py
full_state (`dict`): The full state dict to load, can only be on rank 0
"""
from torch.distributed.checkpoint.state_dict import StateDictOptions, set_model_state_dict

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

fsdp_utils.py has the true change @eric-haibin-lin

third_party/torch are just copy-paste from torch==2.7.0 (state_dict.py and _state_dict_utils.py)

@weifengpy

weifengpy commented Jul 20, 2025 •

Copy link
Copy Markdown
Contributor Author

@eric-haibin-lin should we kick off CI?

@eric-haibin-lin
eric-haibin-lin merged commit 4c10ddd into verl-project:main Jul 23, 2025
yellowbee686 pushed a commit to yellowbee686/verl that referenced this pull request Jul 25, 2025
…verl-project#2606)

### What does this PR do?

for torch==2.6.0, distributed state dict is buggy and can leads to OOM
copy the fixed state dict api from torch==2.7.0 to verl/third_party.
It's convinent for users who cannot upgrade to torch==2.7.0

### Checklist Before Starting

- [x] Search for similar PRs. Paste at least one query link here: ...
- [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

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

```python
HYDRA_FULL_ERROR=1 CUDA_LAUNCH_BLOCKING=1 python3 -m verl.trainer.main_ppo       algorithm.adv_estimator=grpo       data.train_files=$HOME/data/gsm8k/train.parquet       data.val_files=$HOME/data/gsm8k/test.parquet       data.train_batch_size=512       data.max_prompt_length=1024       data.max_response_length=2048       data.filter_overlong_prompts=True       data.truncation='error'       data.image_key=images       actor_rollout_ref.model.path=Qwen/Qwen2.5-VL-32B-Instruct       actor_rollout_ref.model.use_remove_padding=True       actor_rollout_ref.model.enable_gradient_checkpointing=True       actor_rollout_ref.actor.strategy=fsdp2       actor_rollout_ref.actor.optim.lr=1e-6       actor_rollout_ref.actor.ppo_mini_batch_size=128       actor_rollout_ref.actor.ppo_micro_batch_size_per_gpu=10       actor_rollout_ref.actor.use_kl_loss=True       actor_rollout_ref.actor.kl_loss_coef=0.01       actor_rollout_ref.actor.kl_loss_type=low_var_kl       actor_rollout_ref.actor.entropy_coeff=0       actor_rollout_ref.rollout.name=vllm       actor_rollout_ref.rollout.log_prob_micro_batch_size_per_gpu=20       actor_rollout_ref.rollout.tensor_model_parallel_size=4       actor_rollout_ref.rollout.gpu_memory_utilization=0.6       actor_rollout_ref.rollout.enable_chunked_prefill=True       actor_rollout_ref.rollout.enforce_eager=False       actor_rollout_ref.rollout.free_cache_engine=False       actor_rollout_ref.rollout.n=5      actor_rollout_ref.ref.strategy=fsdp2       actor_rollout_ref.ref.log_prob_micro_batch_size_per_gpu=20       actor_rollout_ref.ref.fsdp_config.param_offload=True       trainer.critic_warmup=0       trainer.logger=['console','tensorboard']       trainer.project_name='verl_grpo_example_geo3k'       trainer.experiment_name='qwen2_5_vl_32b_function_rm'       trainer.n_gpus_per_node=8      trainer.nnodes=1       trainer.save_freq=-1       trainer.test_freq=5       trainer.total_epochs=5
```

### Design & Code Changes

> Demonstrate the high-level design if this PR is complex, and 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.

- [x] Read the [Contribute
Guide](https://github.com/volcengine/verl/blob/main/CONTRIBUTING.md).
- [x] Apply [pre-commit
checks](https://github.com/volcengine/verl/blob/main/CONTRIBUTING.md#code-linting-and-formatting):
`pre-commit install && pre-commit run --all-files --show-diff-on-failure
--color=always`
- [x] Add / Update [the
documentation](https://github.com/volcengine/verl/tree/main/docs).
- [x] 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: ...
- [x] 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).

FSDP2 memory snapshot: cpu offloading works and peak memory is slightly
lower than FSDP1
<img width="1193" height="543" alt="Screenshot 2025-07-17 at 14 53 49"
src="https://github.com/user-attachments/assets/2d5b88b2-0d9e-40f7-ad75-f42b9acf1bab"
/>

---------

Co-authored-by: H <linhaibin.eric@gmail.com>
@kisseternity

Copy link
Copy Markdown

Still have oom issue using fsdp2_load_full_state_dict after upgrading to verl-0.5.0 release, using torch 2.6.0. May still need to upgrade torch version?

@weifengpy

Copy link
Copy Markdown
Contributor Author

Still have oom issue using fsdp2_load_full_state_dict after upgrading to verl-0.5.0 release, using torch 2.6.0. May still need to upgrade torch version?

probably to install verl from source code directly to include the fix

oseyosey pushed a commit to oseyosey/verl that referenced this pull request Jul 28, 2025
…verl-project#2606)

### What does this PR do?

for torch==2.6.0, distributed state dict is buggy and can leads to OOM
copy the fixed state dict api from torch==2.7.0 to verl/third_party.
It's convinent for users who cannot upgrade to torch==2.7.0

### Checklist Before Starting

- [x] Search for similar PRs. Paste at least one query link here: ...
- [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

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

```python
HYDRA_FULL_ERROR=1 CUDA_LAUNCH_BLOCKING=1 python3 -m verl.trainer.main_ppo       algorithm.adv_estimator=grpo       data.train_files=$HOME/data/gsm8k/train.parquet       data.val_files=$HOME/data/gsm8k/test.parquet       data.train_batch_size=512       data.max_prompt_length=1024       data.max_response_length=2048       data.filter_overlong_prompts=True       data.truncation='error'       data.image_key=images       actor_rollout_ref.model.path=Qwen/Qwen2.5-VL-32B-Instruct       actor_rollout_ref.model.use_remove_padding=True       actor_rollout_ref.model.enable_gradient_checkpointing=True       actor_rollout_ref.actor.strategy=fsdp2       actor_rollout_ref.actor.optim.lr=1e-6       actor_rollout_ref.actor.ppo_mini_batch_size=128       actor_rollout_ref.actor.ppo_micro_batch_size_per_gpu=10       actor_rollout_ref.actor.use_kl_loss=True       actor_rollout_ref.actor.kl_loss_coef=0.01       actor_rollout_ref.actor.kl_loss_type=low_var_kl       actor_rollout_ref.actor.entropy_coeff=0       actor_rollout_ref.rollout.name=vllm       actor_rollout_ref.rollout.log_prob_micro_batch_size_per_gpu=20       actor_rollout_ref.rollout.tensor_model_parallel_size=4       actor_rollout_ref.rollout.gpu_memory_utilization=0.6       actor_rollout_ref.rollout.enable_chunked_prefill=True       actor_rollout_ref.rollout.enforce_eager=False       actor_rollout_ref.rollout.free_cache_engine=False       actor_rollout_ref.rollout.n=5      actor_rollout_ref.ref.strategy=fsdp2       actor_rollout_ref.ref.log_prob_micro_batch_size_per_gpu=20       actor_rollout_ref.ref.fsdp_config.param_offload=True       trainer.critic_warmup=0       trainer.logger=['console','tensorboard']       trainer.project_name='verl_grpo_example_geo3k'       trainer.experiment_name='qwen2_5_vl_32b_function_rm'       trainer.n_gpus_per_node=8      trainer.nnodes=1       trainer.save_freq=-1       trainer.test_freq=5       trainer.total_epochs=5
```

### Design & Code Changes

> Demonstrate the high-level design if this PR is complex, and 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.

- [x] Read the [Contribute
Guide](https://github.com/volcengine/verl/blob/main/CONTRIBUTING.md).
- [x] Apply [pre-commit
checks](https://github.com/volcengine/verl/blob/main/CONTRIBUTING.md#code-linting-and-formatting):
`pre-commit install && pre-commit run --all-files --show-diff-on-failure
--color=always`
- [x] Add / Update [the
documentation](https://github.com/volcengine/verl/tree/main/docs).
- [x] 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: ...
- [x] 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).

FSDP2 memory snapshot: cpu offloading works and peak memory is slightly
lower than FSDP1
<img width="1193" height="543" alt="Screenshot 2025-07-17 at 14 53 49"
src="https://github.com/user-attachments/assets/2d5b88b2-0d9e-40f7-ad75-f42b9acf1bab"
/>

---------

Co-authored-by: H <linhaibin.eric@gmail.com>
Juniper1021 pushed a commit to Juniper1021/verl that referenced this pull request Aug 7, 2025
…verl-project#2606)

### What does this PR do?

for torch==2.6.0, distributed state dict is buggy and can leads to OOM
copy the fixed state dict api from torch==2.7.0 to verl/third_party.
It's convinent for users who cannot upgrade to torch==2.7.0

### Checklist Before Starting

- [x] Search for similar PRs. Paste at least one query link here: ...
- [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

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

```python
HYDRA_FULL_ERROR=1 CUDA_LAUNCH_BLOCKING=1 python3 -m verl.trainer.main_ppo       algorithm.adv_estimator=grpo       data.train_files=$HOME/data/gsm8k/train.parquet       data.val_files=$HOME/data/gsm8k/test.parquet       data.train_batch_size=512       data.max_prompt_length=1024       data.max_response_length=2048       data.filter_overlong_prompts=True       data.truncation='error'       data.image_key=images       actor_rollout_ref.model.path=Qwen/Qwen2.5-VL-32B-Instruct       actor_rollout_ref.model.use_remove_padding=True       actor_rollout_ref.model.enable_gradient_checkpointing=True       actor_rollout_ref.actor.strategy=fsdp2       actor_rollout_ref.actor.optim.lr=1e-6       actor_rollout_ref.actor.ppo_mini_batch_size=128       actor_rollout_ref.actor.ppo_micro_batch_size_per_gpu=10       actor_rollout_ref.actor.use_kl_loss=True       actor_rollout_ref.actor.kl_loss_coef=0.01       actor_rollout_ref.actor.kl_loss_type=low_var_kl       actor_rollout_ref.actor.entropy_coeff=0       actor_rollout_ref.rollout.name=vllm       actor_rollout_ref.rollout.log_prob_micro_batch_size_per_gpu=20       actor_rollout_ref.rollout.tensor_model_parallel_size=4       actor_rollout_ref.rollout.gpu_memory_utilization=0.6       actor_rollout_ref.rollout.enable_chunked_prefill=True       actor_rollout_ref.rollout.enforce_eager=False       actor_rollout_ref.rollout.free_cache_engine=False       actor_rollout_ref.rollout.n=5      actor_rollout_ref.ref.strategy=fsdp2       actor_rollout_ref.ref.log_prob_micro_batch_size_per_gpu=20       actor_rollout_ref.ref.fsdp_config.param_offload=True       trainer.critic_warmup=0       trainer.logger=['console','tensorboard']       trainer.project_name='verl_grpo_example_geo3k'       trainer.experiment_name='qwen2_5_vl_32b_function_rm'       trainer.n_gpus_per_node=8      trainer.nnodes=1       trainer.save_freq=-1       trainer.test_freq=5       trainer.total_epochs=5
```

### Design & Code Changes

> Demonstrate the high-level design if this PR is complex, and 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.

- [x] Read the [Contribute
Guide](https://github.com/volcengine/verl/blob/main/CONTRIBUTING.md).
- [x] Apply [pre-commit
checks](https://github.com/volcengine/verl/blob/main/CONTRIBUTING.md#code-linting-and-formatting):
`pre-commit install && pre-commit run --all-files --show-diff-on-failure
--color=always`
- [x] Add / Update [the
documentation](https://github.com/volcengine/verl/tree/main/docs).
- [x] 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: ...
- [x] 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).

FSDP2 memory snapshot: cpu offloading works and peak memory is slightly
lower than FSDP1
<img width="1193" height="543" alt="Screenshot 2025-07-17 at 14 53 49"
src="https://github.com/user-attachments/assets/2d5b88b2-0d9e-40f7-ad75-f42b9acf1bab"
/>

---------

Co-authored-by: H <linhaibin.eric@gmail.com>
whatadayG pushed a commit to whatadayG/verl that referenced this pull request Sep 5, 2025
…verl-project#2606)

### What does this PR do?

for torch==2.6.0, distributed state dict is buggy and can leads to OOM
copy the fixed state dict api from torch==2.7.0 to verl/third_party.
It's convinent for users who cannot upgrade to torch==2.7.0

### Checklist Before Starting

- [x] Search for similar PRs. Paste at least one query link here: ...
- [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

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

```python
HYDRA_FULL_ERROR=1 CUDA_LAUNCH_BLOCKING=1 python3 -m verl.trainer.main_ppo       algorithm.adv_estimator=grpo       data.train_files=$HOME/data/gsm8k/train.parquet       data.val_files=$HOME/data/gsm8k/test.parquet       data.train_batch_size=512       data.max_prompt_length=1024       data.max_response_length=2048       data.filter_overlong_prompts=True       data.truncation='error'       data.image_key=images       actor_rollout_ref.model.path=Qwen/Qwen2.5-VL-32B-Instruct       actor_rollout_ref.model.use_remove_padding=True       actor_rollout_ref.model.enable_gradient_checkpointing=True       actor_rollout_ref.actor.strategy=fsdp2       actor_rollout_ref.actor.optim.lr=1e-6       actor_rollout_ref.actor.ppo_mini_batch_size=128       actor_rollout_ref.actor.ppo_micro_batch_size_per_gpu=10       actor_rollout_ref.actor.use_kl_loss=True       actor_rollout_ref.actor.kl_loss_coef=0.01       actor_rollout_ref.actor.kl_loss_type=low_var_kl       actor_rollout_ref.actor.entropy_coeff=0       actor_rollout_ref.rollout.name=vllm       actor_rollout_ref.rollout.log_prob_micro_batch_size_per_gpu=20       actor_rollout_ref.rollout.tensor_model_parallel_size=4       actor_rollout_ref.rollout.gpu_memory_utilization=0.6       actor_rollout_ref.rollout.enable_chunked_prefill=True       actor_rollout_ref.rollout.enforce_eager=False       actor_rollout_ref.rollout.free_cache_engine=False       actor_rollout_ref.rollout.n=5      actor_rollout_ref.ref.strategy=fsdp2       actor_rollout_ref.ref.log_prob_micro_batch_size_per_gpu=20       actor_rollout_ref.ref.fsdp_config.param_offload=True       trainer.critic_warmup=0       trainer.logger=['console','tensorboard']       trainer.project_name='verl_grpo_example_geo3k'       trainer.experiment_name='qwen2_5_vl_32b_function_rm'       trainer.n_gpus_per_node=8      trainer.nnodes=1       trainer.save_freq=-1       trainer.test_freq=5       trainer.total_epochs=5
```

### Design & Code Changes

> Demonstrate the high-level design if this PR is complex, and 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.

- [x] Read the [Contribute
Guide](https://github.com/volcengine/verl/blob/main/CONTRIBUTING.md).
- [x] Apply [pre-commit
checks](https://github.com/volcengine/verl/blob/main/CONTRIBUTING.md#code-linting-and-formatting):
`pre-commit install && pre-commit run --all-files --show-diff-on-failure
--color=always`
- [x] Add / Update [the
documentation](https://github.com/volcengine/verl/tree/main/docs).
- [x] 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: ...
- [x] 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).

FSDP2 memory snapshot: cpu offloading works and peak memory is slightly
lower than FSDP1
<img width="1193" height="543" alt="Screenshot 2025-07-17 at 14 53 49"
src="https://github.com/user-attachments/assets/2d5b88b2-0d9e-40f7-ad75-f42b9acf1bab"
/>

---------

Co-authored-by: H <linhaibin.eric@gmail.com>
chenjiaoAngel added a commit to chenjiaoAngel/verl that referenced this pull request Nov 14, 2025
…verl-project#2606)

### What does this PR do?

for torch==2.6.0, distributed state dict is buggy and can leads to OOM
copy the fixed state dict api from torch==2.7.0 to verl/third_party.
It's convinent for users who cannot upgrade to torch==2.7.0

### Checklist Before Starting

- [x] Search for similar PRs. Paste at least one query link here: ...
- [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

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

```python
HYDRA_FULL_ERROR=1 CUDA_LAUNCH_BLOCKING=1 python3 -m verl.trainer.main_ppo       algorithm.adv_estimator=grpo       data.train_files=$HOME/data/gsm8k/train.parquet       data.val_files=$HOME/data/gsm8k/test.parquet       data.train_batch_size=512       data.max_prompt_length=1024       data.max_response_length=2048       data.filter_overlong_prompts=True       data.truncation='error'       data.image_key=images       actor_rollout_ref.model.path=Qwen/Qwen2.5-VL-32B-Instruct       actor_rollout_ref.model.use_remove_padding=True       actor_rollout_ref.model.enable_gradient_checkpointing=True       actor_rollout_ref.actor.strategy=fsdp2       actor_rollout_ref.actor.optim.lr=1e-6       actor_rollout_ref.actor.ppo_mini_batch_size=128       actor_rollout_ref.actor.ppo_micro_batch_size_per_gpu=10       actor_rollout_ref.actor.use_kl_loss=True       actor_rollout_ref.actor.kl_loss_coef=0.01       actor_rollout_ref.actor.kl_loss_type=low_var_kl       actor_rollout_ref.actor.entropy_coeff=0       actor_rollout_ref.rollout.name=vllm       actor_rollout_ref.rollout.log_prob_micro_batch_size_per_gpu=20       actor_rollout_ref.rollout.tensor_model_parallel_size=4       actor_rollout_ref.rollout.gpu_memory_utilization=0.6       actor_rollout_ref.rollout.enable_chunked_prefill=True       actor_rollout_ref.rollout.enforce_eager=False       actor_rollout_ref.rollout.free_cache_engine=False       actor_rollout_ref.rollout.n=5      actor_rollout_ref.ref.strategy=fsdp2       actor_rollout_ref.ref.log_prob_micro_batch_size_per_gpu=20       actor_rollout_ref.ref.fsdp_config.param_offload=True       trainer.critic_warmup=0       trainer.logger=['console','tensorboard']       trainer.project_name='verl_grpo_example_geo3k'       trainer.experiment_name='qwen2_5_vl_32b_function_rm'       trainer.n_gpus_per_node=8      trainer.nnodes=1       trainer.save_freq=-1       trainer.test_freq=5       trainer.total_epochs=5
```

### Design & Code Changes

> Demonstrate the high-level design if this PR is complex, and 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.

- [x] Read the [Contribute
Guide](https://github.com/volcengine/verl/blob/main/CONTRIBUTING.md).
- [x] Apply [pre-commit
checks](https://github.com/volcengine/verl/blob/main/CONTRIBUTING.md#code-linting-and-formatting):
`pre-commit install && pre-commit run --all-files --show-diff-on-failure
--color=always`
- [x] Add / Update [the
documentation](https://github.com/volcengine/verl/tree/main/docs).
- [x] 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: ...
- [x] 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).

FSDP2 memory snapshot: cpu offloading works and peak memory is slightly
lower than FSDP1
<img width="1193" height="543" alt="Screenshot 2025-07-17 at 14 53 49"
src="https://github.com/user-attachments/assets/2d5b88b2-0d9e-40f7-ad75-f42b9acf1bab"
/>

---------

Co-authored-by: H <linhaibin.eric@gmail.com>
TimurTaepov pushed a commit to giorgossideris/verl that referenced this pull request Dec 20, 2025
…verl-project#2606)

### What does this PR do?

for torch==2.6.0, distributed state dict is buggy and can leads to OOM
copy the fixed state dict api from torch==2.7.0 to verl/third_party.
It's convinent for users who cannot upgrade to torch==2.7.0

### Checklist Before Starting

- [x] Search for similar PRs. Paste at least one query link here: ...
- [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

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

```python
HYDRA_FULL_ERROR=1 CUDA_LAUNCH_BLOCKING=1 python3 -m verl.trainer.main_ppo       algorithm.adv_estimator=grpo       data.train_files=$HOME/data/gsm8k/train.parquet       data.val_files=$HOME/data/gsm8k/test.parquet       data.train_batch_size=512       data.max_prompt_length=1024       data.max_response_length=2048       data.filter_overlong_prompts=True       data.truncation='error'       data.image_key=images       actor_rollout_ref.model.path=Qwen/Qwen2.5-VL-32B-Instruct       actor_rollout_ref.model.use_remove_padding=True       actor_rollout_ref.model.enable_gradient_checkpointing=True       actor_rollout_ref.actor.strategy=fsdp2       actor_rollout_ref.actor.optim.lr=1e-6       actor_rollout_ref.actor.ppo_mini_batch_size=128       actor_rollout_ref.actor.ppo_micro_batch_size_per_gpu=10       actor_rollout_ref.actor.use_kl_loss=True       actor_rollout_ref.actor.kl_loss_coef=0.01       actor_rollout_ref.actor.kl_loss_type=low_var_kl       actor_rollout_ref.actor.entropy_coeff=0       actor_rollout_ref.rollout.name=vllm       actor_rollout_ref.rollout.log_prob_micro_batch_size_per_gpu=20       actor_rollout_ref.rollout.tensor_model_parallel_size=4       actor_rollout_ref.rollout.gpu_memory_utilization=0.6       actor_rollout_ref.rollout.enable_chunked_prefill=True       actor_rollout_ref.rollout.enforce_eager=False       actor_rollout_ref.rollout.free_cache_engine=False       actor_rollout_ref.rollout.n=5      actor_rollout_ref.ref.strategy=fsdp2       actor_rollout_ref.ref.log_prob_micro_batch_size_per_gpu=20       actor_rollout_ref.ref.fsdp_config.param_offload=True       trainer.critic_warmup=0       trainer.logger=['console','tensorboard']       trainer.project_name='verl_grpo_example_geo3k'       trainer.experiment_name='qwen2_5_vl_32b_function_rm'       trainer.n_gpus_per_node=8      trainer.nnodes=1       trainer.save_freq=-1       trainer.test_freq=5       trainer.total_epochs=5
```

### Design & Code Changes

> Demonstrate the high-level design if this PR is complex, and 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.

- [x] Read the [Contribute
Guide](https://github.com/volcengine/verl/blob/main/CONTRIBUTING.md).
- [x] Apply [pre-commit
checks](https://github.com/volcengine/verl/blob/main/CONTRIBUTING.md#code-linting-and-formatting):
`pre-commit install && pre-commit run --all-files --show-diff-on-failure
--color=always`
- [x] Add / Update [the
documentation](https://github.com/volcengine/verl/tree/main/docs).
- [x] 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: ...
- [x] 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).

FSDP2 memory snapshot: cpu offloading works and peak memory is slightly
lower than FSDP1
<img width="1193" height="543" alt="Screenshot 2025-07-17 at 14 53 49"
src="https://github.com/user-attachments/assets/2d5b88b2-0d9e-40f7-ad75-f42b9acf1bab"
/>

---------

Co-authored-by: H <linhaibin.eric@gmail.com>
oseyosey pushed a commit to oseyosey/verl that referenced this pull request Jan 20, 2026
…verl-project#2606)

### What does this PR do?

for torch==2.6.0, distributed state dict is buggy and can leads to OOM
copy the fixed state dict api from torch==2.7.0 to verl/third_party.
It's convinent for users who cannot upgrade to torch==2.7.0

### Checklist Before Starting

- [x] Search for similar PRs. Paste at least one query link here: ...
- [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

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

```python
HYDRA_FULL_ERROR=1 CUDA_LAUNCH_BLOCKING=1 python3 -m verl.trainer.main_ppo       algorithm.adv_estimator=grpo       data.train_files=$HOME/data/gsm8k/train.parquet       data.val_files=$HOME/data/gsm8k/test.parquet       data.train_batch_size=512       data.max_prompt_length=1024       data.max_response_length=2048       data.filter_overlong_prompts=True       data.truncation='error'       data.image_key=images       actor_rollout_ref.model.path=Qwen/Qwen2.5-VL-32B-Instruct       actor_rollout_ref.model.use_remove_padding=True       actor_rollout_ref.model.enable_gradient_checkpointing=True       actor_rollout_ref.actor.strategy=fsdp2       actor_rollout_ref.actor.optim.lr=1e-6       actor_rollout_ref.actor.ppo_mini_batch_size=128       actor_rollout_ref.actor.ppo_micro_batch_size_per_gpu=10       actor_rollout_ref.actor.use_kl_loss=True       actor_rollout_ref.actor.kl_loss_coef=0.01       actor_rollout_ref.actor.kl_loss_type=low_var_kl       actor_rollout_ref.actor.entropy_coeff=0       actor_rollout_ref.rollout.name=vllm       actor_rollout_ref.rollout.log_prob_micro_batch_size_per_gpu=20       actor_rollout_ref.rollout.tensor_model_parallel_size=4       actor_rollout_ref.rollout.gpu_memory_utilization=0.6       actor_rollout_ref.rollout.enable_chunked_prefill=True       actor_rollout_ref.rollout.enforce_eager=False       actor_rollout_ref.rollout.free_cache_engine=False       actor_rollout_ref.rollout.n=5      actor_rollout_ref.ref.strategy=fsdp2       actor_rollout_ref.ref.log_prob_micro_batch_size_per_gpu=20       actor_rollout_ref.ref.fsdp_config.param_offload=True       trainer.critic_warmup=0       trainer.logger=['console','tensorboard']       trainer.project_name='verl_grpo_example_geo3k'       trainer.experiment_name='qwen2_5_vl_32b_function_rm'       trainer.n_gpus_per_node=8      trainer.nnodes=1       trainer.save_freq=-1       trainer.test_freq=5       trainer.total_epochs=5
```

### Design & Code Changes

> Demonstrate the high-level design if this PR is complex, and 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.

- [x] Read the [Contribute
Guide](https://github.com/volcengine/verl/blob/main/CONTRIBUTING.md).
- [x] Apply [pre-commit
checks](https://github.com/volcengine/verl/blob/main/CONTRIBUTING.md#code-linting-and-formatting):
`pre-commit install && pre-commit run --all-files --show-diff-on-failure
--color=always`
- [x] Add / Update [the
documentation](https://github.com/volcengine/verl/tree/main/docs).
- [x] 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: ...
- [x] 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).

FSDP2 memory snapshot: cpu offloading works and peak memory is slightly
lower than FSDP1
<img width="1193" height="543" alt="Screenshot 2025-07-17 at 14 53 49"
src="https://github.com/user-attachments/assets/2d5b88b2-0d9e-40f7-ad75-f42b9acf1bab"
/>

---------

Co-authored-by: H <linhaibin.eric@gmail.com>
vyomakesh0728 added a commit to vyomakesh0728/verl that referenced this pull request Jan 22, 2026
…verl-project#2606)

### What does this PR do?

for torch==2.6.0, distributed state dict is buggy and can leads to OOM
copy the fixed state dict api from torch==2.7.0 to verl/third_party.
It's convinent for users who cannot upgrade to torch==2.7.0

### Checklist Before Starting

- [x] Search for similar PRs. Paste at least one query link here: ...
- [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

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

```python
HYDRA_FULL_ERROR=1 CUDA_LAUNCH_BLOCKING=1 python3 -m verl.trainer.main_ppo       algorithm.adv_estimator=grpo       data.train_files=$HOME/data/gsm8k/train.parquet       data.val_files=$HOME/data/gsm8k/test.parquet       data.train_batch_size=512       data.max_prompt_length=1024       data.max_response_length=2048       data.filter_overlong_prompts=True       data.truncation='error'       data.image_key=images       actor_rollout_ref.model.path=Qwen/Qwen2.5-VL-32B-Instruct       actor_rollout_ref.model.use_remove_padding=True       actor_rollout_ref.model.enable_gradient_checkpointing=True       actor_rollout_ref.actor.strategy=fsdp2       actor_rollout_ref.actor.optim.lr=1e-6       actor_rollout_ref.actor.ppo_mini_batch_size=128       actor_rollout_ref.actor.ppo_micro_batch_size_per_gpu=10       actor_rollout_ref.actor.use_kl_loss=True       actor_rollout_ref.actor.kl_loss_coef=0.01       actor_rollout_ref.actor.kl_loss_type=low_var_kl       actor_rollout_ref.actor.entropy_coeff=0       actor_rollout_ref.rollout.name=vllm       actor_rollout_ref.rollout.log_prob_micro_batch_size_per_gpu=20       actor_rollout_ref.rollout.tensor_model_parallel_size=4       actor_rollout_ref.rollout.gpu_memory_utilization=0.6       actor_rollout_ref.rollout.enable_chunked_prefill=True       actor_rollout_ref.rollout.enforce_eager=False       actor_rollout_ref.rollout.free_cache_engine=False       actor_rollout_ref.rollout.n=5      actor_rollout_ref.ref.strategy=fsdp2       actor_rollout_ref.ref.log_prob_micro_batch_size_per_gpu=20       actor_rollout_ref.ref.fsdp_config.param_offload=True       trainer.critic_warmup=0       trainer.logger=['console','tensorboard']       trainer.project_name='verl_grpo_example_geo3k'       trainer.experiment_name='qwen2_5_vl_32b_function_rm'       trainer.n_gpus_per_node=8      trainer.nnodes=1       trainer.save_freq=-1       trainer.test_freq=5       trainer.total_epochs=5
```

### Design & Code Changes

> Demonstrate the high-level design if this PR is complex, and 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.

- [x] Read the [Contribute
Guide](https://github.com/volcengine/verl/blob/main/CONTRIBUTING.md).
- [x] Apply [pre-commit
checks](https://github.com/volcengine/verl/blob/main/CONTRIBUTING.md#code-linting-and-formatting):
`pre-commit install && pre-commit run --all-files --show-diff-on-failure
--color=always`
- [x] Add / Update [the
documentation](https://github.com/volcengine/verl/tree/main/docs).
- [x] 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: ...
- [x] 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).

FSDP2 memory snapshot: cpu offloading works and peak memory is slightly
lower than FSDP1
<img width="1193" height="543" alt="Screenshot 2025-07-17 at 14 53 49"
src="https://github.com/user-attachments/assets/2d5b88b2-0d9e-40f7-ad75-f42b9acf1bab"
/>

---------

Co-authored-by: H <linhaibin.eric@gmail.com>
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.

4 participants