← Back to Pull requests

[trainer] feat: configurable replay buffer poll interval for the V1 trainer #8596

Closed
unknown closed this pull request without merging on Nov 19, 2026 06:14 UTC
View on GitHub
unknown unknown commented on Nov 08, 2026 06:37 UTC
Author

What does this PR do?

Part of https://github.com/verl-project/verl/issues/8595 (Qwen3.5 GRPO on TPU v7x). Independent of the other PRs there.

Adds trainer.v1.sampler.poll_interval (default 2.0 s, so nothing changes unless it is set) and passes it to the built-in ReplayBuffer / ReplayBufferAsync.

Why: while a V1 training step waits for its batch, the built-in replay buffers check the rollout progress every poll_interval seconds, a constructor argument the trainer never sets, so it is always 2.0 s. A batch that completes between two checks waits for the next one: up to 2 s per step. With Qwen3.5-0.8B GRPO on 8 TPU v7x chips the step took 37 s with the rollout changes we propose in vllm-torchtpu (23 s with further rollout-side settings and changes that are not proposed here), so the poll alone could add about 5% to 9%.

Not a duplicate: main (31cfccb4) has no way to set the interval from the config (the trainer builds the buffers with the constructor default); we searched the open PRs for poll_interval (query below) before opening this one. The search also finds the draft #8526, which adds a different key, trainer.v1.decoupled_async.poll_interval, for its new decoupled_async trainer mode and leaves the ReplayBuffer constructor's poll_interval as it is. The two are independent; they touch different lines of ppo_trainer.yaml and the generated configs, so at most a config rebase is needed (#8526's current diff applies cleanly on top of this branch).

Checklist Before Starting

  • Search for similar PRs. Paste at least one query link here: https://github.com/verl-project/verl/pulls?q=is%3Apr+is%3Aopen+poll_interval

  • Format the PR title as [{modules}] {type}: {description} (This will be checked by the CI)
  • Test

    Commands run on CPU against this branch (main 31cfccb4 plus this PR):

  • pytest tests/trainer/ppo/v1/test_trainer_base_on_cpu.py: 38 passed, 28 of them new (6 tests): the default stays 2.0 for every trainer mode; a configured value reaches the built-in buffers of every mode; 0, negative and non-finite values (inf, -inf, nan, and the strings "inf" / "nan") are rejected, and finite positive values, a numeric string included, are accepted; a custom sampler does not receive the key; with 0.1 the built-in async buffer has exactly the state of a ReplayBufferAsync subclass that sets 0.1. Negative control: 24 of the new cases fail on main.

  • pytest tests/trainer/ppo/v1/test_trainer_base_on_cpu.py tests/trainer/ppo/v1/test_replay_buffer_on_cpu.py tests/trainer/ppo/v1/test_separate_async_step_switch_on_cpu.py: 154 passed (126 on main).

  • pytest tests/trainer/ppo: 484 passed (456 on main, plus the 28 new). Five async tests fail on main and here alike in our environment, which lacks pytest-asyncio.

  • bash scripts/generate_trainer_config.sh leaves the four regenerated _generated_.yaml reference configs unchanged.

  • pre-commit hooks (run as their commands, with ruff 0.12.2 and mypy 1.17.0 as pinned): ruff, ruff-format, mypy, autogen-trainer-cfg, docs-time, docstring, license, device-API, DataProto, test-structure, naming, example-naming, uv and compileall checks pass.

  • Result: with poll_interval=0.1 the remaining wait for the poll was about 0.24 s per step in our GRPO runs (TPU v7x, Qwen3.5-0.8B), instead of up to 2 s; there it was set through a ReplayBufferAsync subclass, and the first test command above checks that this key gives the same buffer state.
  • API and Usage Example

    python3 -m verl.trainer.main_ppo ... trainer.v1.trainer_mode=separate_async trainer.v1.sampler.poll_interval=0.1
    

    Design & Code Changes

  • New key under trainer.v1.sampler in verl/trainer/config/ppo_trainer.yaml (the four _generated_.yaml reference configs regenerated), documented in docs/advance/v1_async_trainer.md.

  • _build_replay_buffer (verl/trainer/ppo/v1/trainer_base.py) passes it to the built-in buffers; a value that is not a finite number of seconds above 0 is rejected (an infinite interval would otherwise fail later, in time.sleep).

  • Custom samplers keep their constructor contract and do not receive it.

  • Behaviour: the interval only decides when the trainer notices that a batch is ready; batches, their order and the weights version are unchanged.
  • Checklist Before Submitting

  • Read the Contribute Guide.

  • Apply pre-commit checks: the hooks listed under Test pass.

  • Add / Update the documentation: docs/advance/v1_async_trainer.md.

  • Add unit or end-to-end test(s): tests/trainer/ppo/v1/test_trainer_base_on_cpu.py.

  • Once your PR is ready for CI, send a message in the ci-request channel.

  • If your PR is related to the recipe submodule: not related.
  • AI assistance: developed with an AI coding assistant; the author has reviewed every changed line, and the tests above were run as described (on TPU v7x where stated).

    Diff: 622 lines (+466 / -156) across 7 files Reviewer: jialei777 Review duration: 15816m
    All Vouch review confidence checks passed
    Residual risk 0.33 = Change Risk (0.78) × (1 − Review Confidence (0.58)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.78 · 622 lines diff across 7 files
    0.78
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.17 · 1 substantive comment(s)
    0.17
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    57%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.385
    Shallow Review Depth shallow_review_depth
    0.289
    Sensitive Paths sensitive_paths
    0.078
    Ai Authored ai_authored
    0.050
    Real PR Conversation Timeline
    1 comments
    "Review active on #8596"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 58.0% reviewed sensitive_module
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 78.5% (HIGH) · Higher = larger blast radius
    78.5%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 58.0% · Lower = rushed or shallow review
    58.0%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 33.0% · Safe to merge
    33.0%