Skip to content

[data] feat: TransferQueue - Add zero-copy serialization support & usage improvement#4429

Merged
wuxibin89 merged 9 commits intoverl-project:mainfrom
TransferQueue:han/update_tq
Dec 15, 2025
Merged

[data] feat: TransferQueue - Add zero-copy serialization support & usage improvement#4429
wuxibin89 merged 9 commits intoverl-project:mainfrom
TransferQueue:han/update_tq

Conversation

@0oshowero0
Copy link
Collaborator

@0oshowero0 0oshowero0 commented Dec 5, 2025

What does this PR do?

  1. Support zero-copy serialization for SimpleUnit backend through environment variable TQ_ZERO_COPY_SERIALIZATION. [4/4][serialization] Perf: support non-jagged nested tensor for zero-copy serialization in SimpleUnit backend TransferQueue/TransferQueue#121
  2. When calling tq_client.async_put(), TQ will return the updated BatchMeta object to the user. This will improve user experience when using TQ. [Feat] Update BatchMeta after calling put TransferQueue/TransferQueue#119
  3. Add log for transferqueue_utils.py
  4. Add new BatchMeta operations to simplify single-controller usage

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.

# Add code snippet or script demonstrating how to use this

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.

Signed-off-by: 0oshowero0 <o0shower0o@outlook.com>
Copilot AI review requested due to automatic review settings December 5, 2025 08:26
Copy link
Contributor

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

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 updates the TransferQueue dependency to version 0.1.3.dev5. This is a positive step towards integrating new features like zero-copy serialization and an improved async_put method. However, my review highlights a concern with using a development (.dev) version of a dependency, which poses a stability risk. I have added comments recommending a switch to a stable release if possible. Furthermore, while this PR updates the dependency, the new features described in the PR description do not appear to be utilized yet in the existing codebase (e.g., in verl/utils/transferqueue_utils.py). I suggest creating a follow-up task to adopt these improvements to fully leverage the updated dependency.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR upgrades the TransferQueue dependency from version 0.1.2.dev0 to 0.1.3.dev5, enabling zero-copy serialization support and improved API functionality.

Key Changes:

  • Updated TransferQueue version to 0.1.3.dev5 across all dependency specifications
  • Enables zero-copy serialization through environment variable configuration
  • Returns BatchMeta object from async_put() calls for improved user experience

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
setup.py Updated TRANSFERQUEUE_REQUIRES to version 0.1.3.dev5
requirements_transferqueue.txt Updated TransferQueue package version to 0.1.3.dev5
.github/workflows/e2e_transferqueue.yml Updated TransferQueue installation version in both FSDP and Megatron test jobs

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Signed-off-by: 0oshowero0 <o0shower0o@outlook.com>
log_file="${log_dir}/qwen3-8b_tq_${timestamp}.log"

# You may try to enable zero-copy serialization for TransferQueue when using SimpleStorageUnit backend.
export TQ_ZERO_COPY_SERIALIZATION=False
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is there a side-effect when TQ_ZERO_COPY_SERIALIZATION=True? Can we always enable it?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Enable zero copy serialization will lead to a slightly higher deserialization cost since we need to deserialize each tensor in a loop. For nested tensors in torch.strided layout, we also need to reconstruct the nested tensor during deserialization.

Copy link
Collaborator Author

@0oshowero0 0oshowero0 Dec 8, 2025

Choose a reason for hiding this comment

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

In our experiment, enable TQ_ZERO_COPY_SERIALIZATION=True will slightly decrease the throughput for small tensors. So we still use False as default setting for now.

Refer to:
https://www.yuque.com/haomingzi-lfse7/hlx5g0/asmgy8hp5535bxu3?singleDoc#

@@ -1,2 +1,2 @@
# requirements.txt records the full set of dependencies for development
TransferQueue==0.1.2.dev0
Copy link
Collaborator

Choose a reason for hiding this comment

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

There's no need a separate requirements_transferqueue.txt since we already set it in setup.py.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

done

Signed-off-by: 0oshowero0 <o0shower0o@outlook.com>
Signed-off-by: 0oshowero0 <o0shower0o@outlook.com>
Signed-off-by: 0oshowero0 <o0shower0o@outlook.com>
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Signed-off-by: 0oshowero0 <o0shower0o@outlook.com>
@wuxibin89 wuxibin89 merged commit baf3a63 into verl-project:main Dec 15, 2025
76 of 84 checks passed
@0oshowero0 0oshowero0 deleted the han/update_tq branch December 17, 2025 09:32
vyomakesh0728 added a commit to vyomakesh0728/verl that referenced this pull request Jan 22, 2026
…age improvement (verl-project#4429)

### What does this PR do?

1. Support zero-copy serialization for SimpleUnit backend through
environment variable `TQ_ZERO_COPY_SERIALIZATION`.
TransferQueue/TransferQueue#121
2. When calling `tq_client.async_put()`, TQ will return the updated
`BatchMeta` object to the user. This will improve user experience when
using TQ. TransferQueue/TransferQueue#119
3. Add log for transferqueue_utils.py
4. Add new BatchMeta operations to simplify single-controller usage


### 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
# Add code snippet or script demonstrating how to use this
```

### 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: ...
- [ ] 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).
(If not accessible, please try [the Feishu group
(飞书群)](https://applink.larkoffice.com/client/chat/chatter/add_by_link?link_token=772jd4f1-cd91-441e-a820-498c6614126a).)

---------

Signed-off-by: 0oshowero0 <o0shower0o@outlook.com>
sophiayyya pushed a commit to sophiayyya/verl that referenced this pull request Jan 25, 2026
…age improvement (verl-project#4429)

### What does this PR do?

1. Support zero-copy serialization for SimpleUnit backend through
environment variable `TQ_ZERO_COPY_SERIALIZATION`.
TransferQueue/TransferQueue#121
2. When calling `tq_client.async_put()`, TQ will return the updated
`BatchMeta` object to the user. This will improve user experience when
using TQ. TransferQueue/TransferQueue#119
3. Add log for transferqueue_utils.py
4. Add new BatchMeta operations to simplify single-controller usage


### 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
# Add code snippet or script demonstrating how to use this
```

### 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: ...
- [ ] 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).
(If not accessible, please try [the Feishu group
(飞书群)](https://applink.larkoffice.com/client/chat/chatter/add_by_link?link_token=772jd4f1-cd91-441e-a820-498c6614126a).)

---------

Signed-off-by: 0oshowero0 <o0shower0o@outlook.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.

3 participants