DeepSeek-V4-Pro · RL

R01 · GRPO code

Valid

Qwen3-0.6B CodeOpt GRPO 1dev · Implementation Optimization

1.46×PERFORMANCE RATIO
148TOOL EVENTS
1TEXT PATCHES
0BINARY NAMES

01 / PROCESS MAP

Tool activity

Each row shows one agent’s tool events in its own recorded order. Colors show broad activities; bar widths do not represent duration.

Main agentDeepSeek-V4-Pro · 148 visible calls

InspectEditValidateExecuteBuildProfileRollbackOther
92Inspect
2Build
33Validate
16Execute
5Other

02 / EVENT SEQUENCE

Event timeline

Requests are grouped by agent, activity and topic. Delegations open into child branches. Summaries describe visible requests; tool errors and missing responses are flagged. A recorded response does not establish command success or a performance improvement.

Show event timelineHide event timeline84 groups · 148 calls

Scroll within this panel to view all events. Command sketches retain familiar programs and options. Values become <val> or <n>; paths, addresses and script bodies are hidden as <path>, <url> and <script>.

Main agent

  1. Inspect · Task requirements

    Requested workspace inspection and file and log inspection related to task requirements.

    3 calls · #0001–#0003

    echo <val>ls -l -a <val>cat <path>cd <val>find <val> <val> <val> <val> <val> -maxdepth <n> -type <val> <flag> <args><command> <args>
    1 more command sketches
    wc -l <path> <path> <path> <path> <path> <path> <path> <path>
  2. Inspect · Source & workspace

    Requested file and log inspection related to source & workspace.

    6 calls · #0004–#0009

    cd <val>sed -n <val> <path>
  3. Inspect · Parallelism & communication

    Requested environment setup or inspection, source searches and file and log inspection related to parallelism & communication.

    1 call · #0010–#0010

    envsortgrep -E <val>sed -n <val>echo <flag>cat <path>
    1 more command sketches
    head -c <n> <path>
  4. Inspect · Source & workspace

    Requested repository inspection and script or workload execution related to source & workspace.

    1 call · #0011–#0011

    cd <path>git status --shortgit log <flag> <args>python - <script>
  5. Validate · Benchmark & validation setup

    Requested script or workload execution, workspace inspection and file and log inspection related to benchmark & validation setup.

    1 call · #0012–#0012

    cd <val>timeout <n> <val> <path>echo <val>ls -l <val>tail -n <n> <path> <n> > <path>sed -n <val>
  6. Inspect · Source & workspace

    Requested file and log inspection, environment setup or inspection and source searches related to source & workspace.

    2 calls · #0013–#0014

    cat <val>echoenvgrep <val>ls -l -a <path>head
    2 more command sketches
    ls <path>find <path> -maxdepth <n> -type <val> -name <val> -o -maxdepth <n> -type <val> <args>
  7. Validate · Benchmark & validation setup

    Requested environment setup or inspection, script or workload execution and file and log inspection related to benchmark & validation setup.

    1 call · #0015–#0015

    export <vars>cd <val>timeout <n> <val> <path> > <path> <n> >& <path>env <vars>echo <val>tail -n <n> <path>
    2 more command sketches
    echo <flag>tail -n <n> <path> <n> > <path>
  8. Validate · Reward & policy updates

    Requested runtime inspection, source searches and file and log inspection related to reward & policy updates.

    1 call · #0016–#0016

    ps <flag> <args>grep -E <val>head -n <n>ls -l -a <val>tail -n <n> <path> <n> > <path>echo <flag>
  9. Validate · Benchmark & validation setup

    Requested workspace inspection, runtime inspection and source searches related to benchmark & validation setup.

    3 calls · #0017–#0019

    ls -l -a <val>ps <flag> <args>grep -E <val>head -n <n>tail -n <n> <path> <n> > <path>echo <flag>
    12 more command sketches
    export <vars>cd <val>rm -f <path> <path> <path> <path><command> <args>echo <val>sleep <n>grep -E <path>headtail -n <n> <path>cat <path>tail -n <n>cat <path> <n> > <path>
  10. Validate · Reward & policy updates

    Requested runtime inspection, source searches and file and log inspection related to reward & policy updates.

    1 call · #0020–#0020

    ps <flag> <args>grep -E <val>grep -v <val>head -n <n>ls -l -a <path>stat <path>
    4 more command sketches
    echo <val>ps -p <n> -o <val><command> <args>tail -n <n> <n> > <path>
  11. Inspect · Checkpoints & weight state

    Requested workspace inspection, source searches and file and log inspection related to checkpoints & weight state.

    4 calls · #0021–#0024

    cd <path>find <val> -maxdepth <n> -type <val>grep -E <val>head -n <n>grep -R <val> -n <val>sed -n <val> <path>
    1 more command sketches
    echo <flag>
  12. Inspect · Rollout generation

    Requested source searches and file and log inspection related to rollout generation.

    3 calls · #0025–#0027

    cd <path>grep -R <val> -n <val>head -n <n>sed -n <val> <path>
  13. Validate · Benchmark & validation setup

    Requested execution waits, workspace inspection and file and log inspection related to benchmark & validation setup.

    1 call · #0028–#0028

    sleep <n>datels -l -a <val>tail -n <n> <path> <n> > <path>echo <val>ps <flag> <args>
    3 more command sketches
    grep -E <val>grep -v <val>head -n <n>
  14. Inspect · Source & workspace

    Requested workspace inspection, file and log inspection and repository inspection related to source & workspace.

    1 call · #0029–#0029

    cd <path>find <val> -maxdepth <n> -type <val>sed -n <val>echo <flag>wc -lgit status --short
    1 more command sketches
    head
  15. Inspect · Rollout generation

    Requested file and log inspection and source searches related to rollout generation.

    5 calls · #0030–#0034

    cd <path>sed -n <val> <path>grep -n <val> -n <path>head -n <n>grep -n <val> -R <path> <path>grep -n <val> -R <val>
  16. Inspect · Source & workspace

    Requested file and log inspection and script or workload execution related to source & workspace.

    1 call · #0035–#0035

    cd <path>sed -n <val> <path>python - <script>
  17. Validate · Benchmark & validation setup

    Requested execution waits, workspace inspection and file and log inspection related to benchmark & validation setup.

    2 calls · #0036–#0037

    sleep <n>datels -l <val>tail -n <n> <path> <n> > <path>echo <flag>ps <flag> <args>
    4 more command sketches
    grep -E <val>grep -v <val>headtail -n <n> <path>
  18. Inspect · Source & workspace

    Requested runtime inspection, file and log inspection and workspace inspection related to source & workspace.

    1 call · #0038–#0038

    ps <flag> <args>head -n <n>ls -l <path> -d <n> > <path>tail -n <n> <path> <n> > <path>tail -n <n>
  19. Validate · Benchmark & validation setup

    Requested execution waits, file and log inspection and workspace inspection related to benchmark & validation setup.

    3 calls · #0039–#0041

    sleep <n>datetail -n <n> <path>echo <val>ls -l <val>ps <flag> <args>
    5 more command sketches
    head -n <n>grep -v -E <val>echo <flag>cat <path> <n> > <path>python - <script>
  20. Inspect · Benchmark & validation setup

    Requested source searches and file and log inspection related to benchmark & validation setup.

    1 call · #0042–#0042

    grep -n -E <val> <path>tail -n <n>sed -n <val>
  21. Inspect · Source & workspace

    Requested file and log inspection and source searches related to source & workspace.

    3 calls · #0043–#0045

    cd <path>sed -n <val> <path>grep -n <val> -n <path> <path>grep -R <val> -n <path> <path>headgrep -n <val> -n <path>
    1 more command sketches
    grep -n <val> <path>
  22. Inspect · Optimizer & gradients

    Requested source searches and file and log inspection related to optimizer & gradients.

    1 call · #0046–#0046

    cd <path>grep -n <val> <path> <path>head -n <n>sed -n <val> <path>
  23. Inspect · Source & workspace

    Requested file and log inspection and source searches related to source & workspace.

    1 call · #0047–#0047

    cd <path>sed -n <val> <path>grep -n <val> <path>
  24. Inspect · Batching & scheduling

    Requested source searches and file and log inspection related to batching & scheduling.

    1 call · #0048–#0048

    cd <path>grep -R <val> -n <path>sed -n <val> <path>grep -R <val> -n <val>grep -n <val> -n <path> <path> <path> <n> > <path>
  25. Inspect · Source & workspace

    Requested file and log inspection related to source & workspace.

    1 call · #0049–#0049

    cd <path>sed -n <val> <path>
  26. Execute · Benchmark & validation setup

    Requested environment setup or inspection, workspace file updates and execution waits related to benchmark & validation setup.

    1 call · #0050–#0050

    export <vars>cd <val>rm -f <path> <path> <path> <path><command> <args>echo <val>sleep <n>
    3 more command sketches
    ps <flag> <args>grep -E <val>grep -v <val>
  27. Inspect · Batching & scheduling

    Requested source searches and file and log inspection related to batching & scheduling.

    1 call · #0051–#0051

    cd <path>grep -R <val> -n <val>head -n <n>grep -R <val> -n <path>sed -n <val> <path>
  28. Inspect · Source & workspace

    Requested file and log inspection and source searches related to source & workspace.

    3 calls · #0052–#0054

    cd <path>sed -n <val> <path>grep -R <val> -n <val>sed -n <val>grep -v <val>
  29. Inspect · Rollout generation

    Requested source searches and file and log inspection related to rollout generation.

    1 call · #0055–#0055

    cd <path>grep -n <val> -n <path> <path>sed -n <val> <path>grep -n <val> <path>
  30. Execute · Parallelism & communication

    Requested workspace inspection, source searches and file and log inspection related to parallelism & communication.

    1 call · #0056–#0056

    cd <path>find <path> -maxdepth <n> -type <val>grep -E -i <val>sed -n <val>grep -R <val> -n <path> <flag> <args>head -n <n>
    1 more command sketches
    grep -R <val> -n <val> <val> <val> <n> > <path>
  31. Other · Parallelism & communication

    Requested environment setup or inspection and source searches related to parallelism & communication.

    1 call · #0057–#0057

    envgrep -E <val>
  32. Inspect · Parallelism & communication

    Requested file and log inspection and source searches related to parallelism & communication.

    1 call · #0058–#0058

    cd <path>sed -n <val> <path>grep -R <val> -n <val>head -n <n>grep -R <val> -n <path> <flag> <args>
  33. Inspect · Source & workspace

    Requested file and log inspection and source searches related to source & workspace.

    11 calls · #0059–#0069

    cd <path>sed -n <val> <path>grep -R <val> -n <val> <val> <val>head -n <n>grep -R <val> -n <path> <path> <path>head
    7 more command sketches
    grep -R <val> -n <val>grep -R <val> -n <path>grep -n <val> -n <path> <path> <n> > <path>grep -R <val> -n <path> <val>grep -R <val> -n <path> <path>grep -R <val> -n <val> <flag> <args>grep -n <val> <path>
  34. Execute · Benchmark & validation setup

    Requested workspace inspection, file and log inspection and runtime inspection related to benchmark & validation setup.

    1 call · #0070–#0070

    datels -l <val>tail -n <n> <path> <n> > <path>ps <flag> <args>head -n <n>
  35. Inspect · Source & workspace

    Requested file and log inspection and source searches related to source & workspace.

    4 calls · #0071–#0074

    cd <val>sed -n <val> <path>cd <path>grep -R <val> -n <val>grep -R <val> -n <path> <path>head -n <n>
  36. Execute · Benchmark & validation setup

    Requested execution waits, file and log inspection and source searches related to benchmark & validation setup.

    1 call · #0075–#0075

    sleep <n>datetail -n <n> <path>grep -v -E <val>echo <flag>ps <flag> <args>
    1 more command sketches
    head -n <n>
  37. Inspect · Rollout generation

    Requested file and log inspection and source searches related to rollout generation.

    1 call · #0076–#0076

    cd <path>sed -n <val> <path>grep -n <val> <path>
  38. Execute · Benchmark & validation setup

    Requested execution waits, workspace inspection and source searches related to benchmark & validation setup.

    1 call · #0077–#0077

    sleep <n>datels -l <val>grep -E <val> <path>tail -n <n>ps <flag> <args>
    1 more command sketches
    head -n <n>
  39. Execute · Checkpoints & weight state

    Requested script or workload execution and file and log inspection related to checkpoints & weight state.

    2 calls · #0078–#0079

    python - <script>cat <path>python -c <script>
  40. Inspect · Rollout generation

    Requested source searches and file and log inspection related to rollout generation.

    1 call · #0080–#0080

    cd <path>grep -R <val> -n <val>head -n <n>grep -n <val> <path> <path>
  41. Inspect · Benchmark & validation setup

    Requested runtime inspection, source searches and file and log inspection related to benchmark & validation setup.

    1 call · #0081–#0081

    ps <flag> <args>grep -E <val>grep -v <val>head -n <n>ls -l <path>
  42. Inspect · Source & workspace

    Requested repository inspection related to source & workspace.

    1 call · #0082–#0082

    cd <path>git status --short
  43. Inspect · Rollout generation

    Requested file and log inspection related to rollout generation.

    1 call · #0083–#0083

    cd <path>sed -n <val> <path>
  44. Other · Source & workspace

    Requested script or workload execution related to source & workspace.

    1 call · #0084–#0084

    python - <script>
  45. Inspect · Rollout generation

    Requested source searches and file and log inspection related to rollout generation.

    2 calls · #0085–#0086

    cd <path>grep -n <val> <flag> <args>sed -n <val> <path>
  46. Inspect · Source & workspace

    Requested source searches, file and log inspection and workspace inspection related to source & workspace.

    2 calls · #0087–#0088

    cd <path>grep -n <val> <flag> <args>sed -n <val> <path>ls <path>head -n <n>grep -n <val> <path>
    1 more command sketches
    head
  47. Inspect · Reward & policy updates

    Requested file and log inspection and script or workload execution related to reward & policy updates.

    1 call · #0089–#0089

    cd <path>cat > <path> <script>python - <script>
  48. Inspect · Source & workspace

    Requested file and log inspection and source searches related to source & workspace.

    2 calls · #0090–#0091

    cd <path>sed -n <val> <path>grep -n <val> <flag> <args>grep -R <val> -n <path>head -n <n>
  49. Build · Rollout generation

    Requested script or workload execution, repository inspection and file and log inspection related to rollout generation.

    1 call · #0092–#0092

    cd <path>python - <script>git -C <path> <val> <flag> <args>sed -n <val>
  50. Execute · Rollout generation

    Requested script or workload execution, repository inspection and file and log inspection related to rollout generation.

    2 calls · #0093–#0094

    cd <path>python - <script>git -C <path> <val> <flag> <args>sed -n <val>
  51. Inspect · Rollout generation

    Requested script or workload execution, repository inspection and file and log inspection related to rollout generation.

    2 calls · #0095–#0096

    cd <path>python - <script>git -C <path> <val> <flag> <args>sed -n <val>python -m <module> -q <script> <script> <script> <script>echo <val>
    2 more command sketches
    git diff --statgit status --short
  52. Validate · Benchmark & validation setup

    Requested environment setup or inspection, workspace file updates and execution waits related to benchmark & validation setup.

    2 calls · #0097–#0098

    export <vars>cd <val>rm -f <path> <path> <path> <path><command> <args>echo <val>sleep <n>
    6 more command sketches
    ps <flag> <args>grep -E <val>grep -v <val>datetail -n <n> <path> <n> > <path>head -n <n>
  53. Inspect · Benchmark & validation setup

    Requested runtime inspection, source searches and file and log inspection related to benchmark & validation setup.

    2 calls · #0099–#0100

    ps <flag> <args>grep -E <val>grep -v <val>head -n <n>ls -l <path>cat <path>
    4 more command sketches
    tail -n <n>echotail -n <n> <path>echo <flag>
  54. Inspect · Rollout generation

    Requested file and log inspection and source searches related to rollout generation.

    1 call · #0101–#0101

    cd <path>cat <path>grep -n <val> <flag> <args>head -n <n>
  55. Execute · Rollout generation

    Requested script or workload execution related to rollout generation.

    1 call · #0102–#0102

    cd <path>python - <script>python -m <module> -q <script>echo <val>
  56. Inspect · Source & workspace

    Requested runtime inspection, source searches and file and log inspection related to source & workspace.

    1 call · #0103–#0103

    ps <flag> <args>grep -E <val>grep -v <val>head -n <n>ls -l -a <val>head
  57. Validate · Benchmark & validation setup

    Requested environment setup or inspection, workspace file updates and execution waits related to benchmark & validation setup.

    6 calls · #0104–#0109

    export <vars>cd <val>rm -f <path> <path> <path> <path><command> <args>echo <val>sleep <n>
    12 more command sketches
    ps <flag> <args>grep <val>grep -v <val>grep -E <path>tail -n <n> <path>datetail -n <n> <path> <n> > <path>grep -v -E <val>echo <flag>head -n <n>ls -l <path>cat <path> <n> > <path>
  58. Validate · Checkpoints & weight state

    Requested script or workload execution and file and log inspection related to checkpoints & weight state.

    1 call · #0110–#0110

    python - <script>cat <path>python -c <script>
  59. Validate · Benchmark & validation setup

    Requested file and log inspection and script or workload execution related to benchmark & validation setup.

    1 call · #0111–#0111

    cat <path>python -c <script>
  60. Inspect · Task requirements

    Requested file and log inspection related to task requirements.

    1 call · #0112–#0112

    cat <path>
  61. Inspect · Source & workspace

    Requested source searches and file and log inspection related to source & workspace.

    1 call · #0113–#0113

    cd <path>grep -R <val> -n <path> <path> <path>head -n <n>grep -n <val> <path> <path> <path>
  62. Other · Source & workspace

    Requested script or workload execution related to source & workspace.

    1 call · #0114–#0114

    date -uecho <val> <val>python - <script>
  63. Inspect · Source & workspace

    Requested file and log inspection and source searches related to source & workspace.

    4 calls · #0115–#0118

    cd <path>sed -n <val> <path>grep -n <val> <flag> <args>grep -R <val> -n <path>headsed -n <val>
    1 more command sketches
    grep -n <val> <path>
  64. Inspect · Checkpoints & weight state

    Requested script or workload execution, repository inspection and file and log inspection related to checkpoints & weight state.

    1 call · #0119–#0119

    cd <path>python - <script>python -m <module> -q <script>echo <val>git -C <path> <val> <flag> <args>sed -n <val>
  65. Inspect · Source & workspace

    Requested runtime inspection, source searches and file and log inspection related to source & workspace.

    1 call · #0120–#0120

    ps <flag> <args>grep -E <val>grep -v <val>head -n <n>
  66. Execute · Benchmark & validation setup

    Requested environment setup or inspection, workspace file updates and execution waits related to benchmark & validation setup.

    1 call · #0121–#0121

    export <vars>cd <val>rm -f <path> <path> <path> <path><command> <args>echo <val>sleep <n>
    3 more command sketches
    ps <flag> <args>grep -E <val>grep -v <val>
  67. Execute · Device memory

    Requested execution waits, source searches and file and log inspection related to device memory.

    2 calls · #0122–#0123

    sleep <n>dategrep -n -E <val> <path> <n> > <path>tail -n <n>echo <val>ls -l <path> <n> > <path>
  68. Execute · Checkpoints & weight state

    Requested script or workload execution and file and log inspection related to checkpoints & weight state.

    1 call · #0124–#0124

    python - <script>cat <path> <n> > <path>python -c <script>
  69. Validate · Benchmark & validation setup

    Requested environment setup or inspection, workspace file updates and execution waits related to benchmark & validation setup.

    1 call · #0125–#0125

    export <vars>cd <val>rm -f <path> <path> <path> <path><command> <args>echo <val>sleep <n>
    3 more command sketches
    ps <flag> <args>grep -E <val>grep -v <val>
  70. Execute · Benchmark & validation setup

    Requested script or workload execution related to benchmark & validation setup.

    1 call · #0126–#0126

    python - <script>
  71. Validate · Checkpoints & weight state

    Requested execution waits, source searches and file and log inspection related to checkpoints & weight state.

    5 calls · #0127–#0131

    sleep <n>dategrep -n -E <val> <path> <n> > <path>tail -n <n>echo <val>ls -l <path> <n> > <path>
    8 more command sketches
    ls -l <path>ps <flag> <args>head -n <n>ls -l <path> <path> <n> > <path>grep -E <val>grep -v <val>cat <path> <n> > <path>python -c <script> <n> > <path>
  72. Validate · Benchmark & validation setup

    Requested execution waits, workspace inspection and file and log inspection related to benchmark & validation setup.

    2 calls · #0132–#0133

    sleep <n>datels -l <path> <path> <n> > <path>tail -n <n> <path> <n> > <path>grep -v -E <val>ps <flag> <args>
    2 more command sketches
    grep -E <val>grep -v <val>
  73. Validate · Checkpoints & weight state

    Requested script or workload execution related to checkpoints & weight state.

    1 call · #0134–#0134

    python - <script>
  74. Build · Source & workspace

    Requested environment setup or inspection, script or workload execution and workspace inspection related to source & workspace.

    1 call · #0135–#0135

    export <vars>cd <val>echo <flag>timeout <n> <val> <path>echo <val>ls -l <val>
    2 more command sketches
    cat <path> <n> > <path>true
  75. Other · Rollout generation

    Requested script or workload execution related to rollout generation.

    2 calls · #0136–#0137

    cd <path>python - <script>python -m <module> -q <script> <script> <script> <script>echo <val>
  76. Inspect · Rollout generation

    Requested repository inspection and file and log inspection related to rollout generation.

    1 call · #0138–#0138

    cd <path>git diff --statgit diff <flag> <args>sed -n <val>
  77. Inspect · Source & workspace

    Requested repository inspection, file and log inspection and environment setup or inspection related to source & workspace.

    2 calls · #0139–#0140

    cd <path>git status --shortcat <path>export <vars>cd <val>timeout <n> <val> <path> <val> > <path> <n> >& <path>
    4 more command sketches
    echo <val>head -c <n> <path> <n> > <path>echotail -n <n>
  78. Inspect · Checkpoints & weight state

    Requested runtime inspection, source searches and file and log inspection related to checkpoints & weight state.

    1 call · #0141–#0141

    ps <flag> <args>grep -E <val>grep -v <val>headecho <val>ls -l <path> <n> > <path>
  79. Inspect · Source & workspace

    Requested environment setup or inspection, file and log inspection and workspace inspection related to source & workspace.

    2 calls · #0142–#0143

    cd <val>env <vars> timeout <n> <val> <path> > <path> <n> >& <path>echo <val>cat <path>ls -l <path> <n> > <path>timeout <n> <val> <path> > <path> <n> >& <path>
    3 more command sketches
    head -n <n>cat <path> <n> > <path>python -c <script>
  80. Inspect · Rollout generation

    Requested file and log inspection related to rollout generation.

    1 call · #0144–#0144

    cd <path>awk <val> <path> <path> <path> <path>head -n <n>
  81. Inspect · Source & workspace

    Requested repository inspection related to source & workspace.

    1 call · #0145–#0145

    cd <path>git diff --checkecho <val>
  82. Validate · Benchmark & validation setup

    Requested script or workload execution related to benchmark & validation setup.

    1 call · #0146–#0146

    python - <script>
  83. Inspect · Rollout generation

    Requested script or workload execution and repository inspection related to rollout generation.

    1 call · #0147–#0147

    cd <path>python -m <module> -q <script> <script> <script> <script>git diff --checkecho <val>git status --short
  84. Execute · Benchmark & validation setup

    Requested script or workload execution related to benchmark & validation setup.

    1 call · #0148–#0148

    python - <script>

03 / CANDIDATE ARTIFACT

Text patches & binary names

Read code changes as Git diffs. Identifying strings are masked; binary files are listed by their full relative names.

verl · 4 changed files

Base commit: 0b2151ec61de5d99e0811b01c09e43a99a23e69d

diff --git a/verl/utils/colocated_optimize.py b/verl/utils/colocated_optimize.pynew file mode 100644index 0000000000000000000000000000000000000000..4e04ef9188adae95456d5e798c95499bda234f95--- /dev/null+++ b/verl/utils/colocated_optimize.py@@ -0,0 +1,97 @@+# Copyright 2025 Bytedance Ltd. and/or its affiliates+#+# Licensed under the Apache License, Version 2.0 (the "License");+# you may not use this file except in compliance with the License.+# You may obtain a copy of the License at+#+#     http://www.apache.org/licenses/LICENSE-2.0+#+# Unless required by applicable law or agreed to in writing, software+# distributed under the License is distributed on an "AS IS" BASIS,+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.+# See the License for the specific language governing permissions and+# limitations under the License.+"""Heuristics for small-model colocated RL workloads.++When a single small dense model is trained and rolled out on the same NPU,+releasing the rollout cache between every GRPO update costs more wall-clock+time than the memory it returns.  These helpers let the trainer and the vLLM+server derive the same decision from the public workload configuration so+their sleep/wake behaviour stays consistent.+"""++from __future__ import annotations++import torch++from verl.utils.device import is_torch_npu_available++# Rough dense-model parameter estimate (vocab embedding + attention and MLP+# weights).  It is intentionally approximate; it only has to distinguish a+# sub-1B model from the much larger models for which the resident-cache+# heuristic would be unsafe.+_MAX_APPROX_PARAMETERS = 1_000_000_000+_MAX_MODEL_LEN = 2048+_MAX_NUM_SEQS = 64+_MIN_DEVICE_MEMORY_BYTES = 50 * 1024**3+++def approximate_dense_parameter_count(hf_config) -> int:+    """Return a conservative dense parameter count for a HF text config."""+    if hf_config is None:+        return 0+    explicit = getattr(hf_config, "num_parameters", None)+    if isinstance(explicit, (int, float)) and explicit > 0:+        return int(explicit)++    vocab_size = int(getattr(hf_config, "vocab_size", 0) or 0)+    hidden_size = int(getattr(hf_config, "hidden_size", 0) or 0)+    num_layers = int(getattr(hf_config, "num_hidden_layers", 0) or 0)+    intermediate_size = int(getattr(hf_config, "intermediate_size", 0) or 0)+    if min(vocab_size, hidden_size, num_layers, intermediate_size) <= 0:+        return 0++    embedding_params = vocab_size * hidden_size+    per_layer_params = 4 * hidden_size * hidden_size + 3 * hidden_size * intermediate_size+    if not getattr(hf_config, "tie_word_embeddings", False):+        embedding_params *= 2+    return embedding_params + num_layers * per_layer_params+++def should_keep_rollout_weights_resident(+    *,+    model_config,+    max_model_len: int | None,+    max_num_seqs: int | None,+    rollout_name: str | None = None,+    actor_strategy: str | None = None,+) -> bool:+    """Whether a colocated workload is small enough to keep vLLM resident.++    The rollout process and the FSDP actor share one NPU.  For small dense+    models the 60+ GiB device comfortably holds both, and skipping the+    multi-second sleep/wake cycle preserves identical training and sampling+    semantics while removing fixed per-update overhead.+    """+    if not is_torch_npu_available(check_device=True):+        return False+    if rollout_name not in (None, "vllm"):+        return False+    if actor_strategy not in (None, "fsdp2"):+        return False+    if max_model_len is None or max_model_len > _MAX_MODEL_LEN:+        return False+    if max_num_seqs is None or max_num_seqs > _MAX_NUM_SEQS:+        return False++    hf_config = getattr(model_config, "hf_config", None)+    approx_parameters = approximate_dense_parameter_count(hf_config)+    if approx_parameters <= 0 or approx_parameters > _MAX_APPROX_PARAMETERS:+        return False++    try:+        device = torch.device("npu", torch.npu.current_device())+        total_memory = torch.npu.get_device_properties(device).total_memory+    except Exception:+        return False+    return int(total_memory) >= _MIN_DEVICE_MEMORY_BYTESdiff --git a/verl/workers/engine_workers.py b/verl/workers/engine_workers.pyindex bf379b49c3dc21ef702d49be1467318692a471f7..90716f56e32e9ac9dfa7b674437c2882209abd17 100644--- a/verl/workers/engine_workers.py+++ b/verl/workers/engine_workers.py@@ -500,6 +500,27 @@ class ActorRolloutRefWorker(Worker, DistProfilerExtension):     def init_model(self):         model_config: HFModelConfig = omega_conf_to_dataclass(self.config.model) +        from verl.utils.colocated_optimize import should_keep_rollout_weights_resident++        keep_rollout_resident = (+            "actor" in self.role+            and "rollout" in self.role+            and should_keep_rollout_weights_resident(+                model_config=model_config,+                max_model_len=self.config.rollout.get("max_model_len", None),+                max_num_seqs=self.config.rollout.get("max_num_seqs", None),+                rollout_name=self.config.rollout.get("name", None),+                actor_strategy=self.config.actor.get("strategy", None),+            )+        )+        if keep_rollout_resident:+            # The actor and rollout share one NPU and the model is small enough+            # that both fit comfortably.  Keeping the rollout cache resident+            # avoids a multi-second sleep/wake cycle before and after every+            # actor update.  Training and sampling semantics are unchanged.+            with open_dict(self.config.rollout):+                self.config.rollout.free_cache_engine = False+         # 1. build reference model         if "ref" in self.role:             # TODO: align ref config with actor config@@ -553,18 +574,44 @@ class ActorRolloutRefWorker(Worker, DistProfilerExtension):                 optimizer_config=actor_config.optim,                 checkpoint_config=actor_config.checkpoint,             )+            if keep_rollout_resident:+                # With only one FSDP rank there is no communication benefit+                # from resharding after each forward.  Keeping the full+                # parameters materialized makes post-update observation+                # projection and the per-update rollout weight export+                # substantially cheaper; memory remains within the budget+                # identified by the colocated small-model heuristic.+                from dataclasses import replace as dataclasses_replace++                actor_training_config = dataclasses_replace(+                    actor_training_config,+                    engine_config=dataclasses_replace(+                        actor_training_config.engine_config,+                        reshard_after_forward=False,+                    ),+                )              assert self.config.actor.use_dynamic_bsz == self.config.rollout.log_prob_use_dynamic_bsz              # assign engine configs             actor_training_config.engine_config.use_dynamic_bsz = self.config.actor.use_dynamic_bsz-            actor_training_config.engine_config.infer_max_token_len_per_gpu = (-                self.config.rollout.log_prob_max_token_len_per_gpu-            )+            if keep_rollout_resident and self.config.actor.use_dynamic_bsz:+                # Micro-batches of 1024 tokens leave a 0.6B NPU model+                # extremely kernel-launch bound and force >10 FSDP+                # unshard/reshard cycles per update.  A single-device 60GiB+                # NPU has ample headroom for much larger no-padding chunks;+                # this only changes gradient accumulation grouping, not the+                # optimization step or the loss normalization.+                actor_training_config.engine_config.infer_max_token_len_per_gpu = 8192+                actor_training_config.engine_config.max_token_len_per_gpu = 8192+            else:+                actor_training_config.engine_config.infer_max_token_len_per_gpu = (+                    self.config.rollout.log_prob_max_token_len_per_gpu+                )+                actor_training_config.engine_config.max_token_len_per_gpu = self.config.actor.ppo_max_token_len_per_gpu             actor_training_config.engine_config.infer_micro_batch_size_per_gpu = (                 self.config.rollout.log_prob_micro_batch_size_per_gpu             )-            actor_training_config.engine_config.max_token_len_per_gpu = self.config.actor.ppo_max_token_len_per_gpu             actor_training_config.engine_config.micro_batch_size_per_gpu = (                 self.config.actor.ppo_micro_batch_size_per_gpu             )diff --git a/verl/workers/rollout/vllm_rollout/utils.py b/verl/workers/rollout/vllm_rollout/utils.pyindex 248c42d3b1ebc1d190cdc8c68e069b4a9c216544..149de5705f7a5ccccc8b97ead1706ed137bf98fd 100644--- a/verl/workers/rollout/vllm_rollout/utils.py+++ b/verl/workers/rollout/vllm_rollout/utils.py@@ -37,7 +37,12 @@ VLLM_LORA_INT_ID = 123 VLLM_LORA_NAME = "123" VLLM_LORA_PATH = "simon_lora_path" -VLLM_ASCEND_REQUIRED_ENV_VARS = {"VLLM_ALL2ALL_BACKEND": "flashinfer_all2allv", "VLLM_ASCEND_ENABLE_NZ": "0"}+VLLM_ASCEND_REQUIRED_ENV_VARS = {+    "VLLM_ALL2ALL_BACKEND": "flashinfer_all2allv",+    "VLLM_ASCEND_ENABLE_NZ": "0",+    "TASK_QUEUE_ENABLE": "1",+    "HCCL_OP_EXPANSION_MODE": "AIV",+}   def _resolve_vllm_weight_sync_local_rank(worker_local_rank: int, parallel_config: Any) -> int:diff --git a/verl/workers/rollout/vllm_rollout/vllm_async_server.py b/verl/workers/rollout/vllm_rollout/vllm_async_server.pyindex 962cf1fb5579f4dd7e4d857ac447544c532ec1ab..04903cb50ac94ee83c1d1dfe853ce4009ce5db95 100644--- a/verl/workers/rollout/vllm_rollout/vllm_async_server.py+++ b/verl/workers/rollout/vllm_rollout/vllm_async_server.py@@ -123,6 +123,22 @@ class vLLMHttpServer:          self.config = self._init_config(config)         self.model_config = self._init_model_config(model_config)++        from dataclasses import replace++        from verl.utils.colocated_optimize import should_keep_rollout_weights_resident++        if should_keep_rollout_weights_resident(+            model_config=self.model_config,+            max_model_len=self.config.max_model_len,+            max_num_seqs=self.config.max_num_seqs,+            rollout_name=self.config.name,+        ):+            # The trainer side makes the same decision before spawning this+            # server.  Keeping weights and KV cache resident avoids the+            # sleep/wake cycle around each FSDP update.+            self.config = replace(self.config, free_cache_engine=False)+         self._validate_configs()          self.rollout_mode = rollout_mode@@ -1021,6 +1037,12 @@ class vLLMReplica(RolloutReplica):                 # use VLLM_ASCEND_TASK_QUEUE_ENABLE to support different TASK_QUEUE_ENABLE mode for                 # train and rollout on Ascend NPU                 env_vars["TASK_QUEUE_ENABLE"] = os.environ["VLLM_ASCEND_TASK_QUEUE_ENABLE"]+            elif is_torch_npu_available(check_device=False):+                # Ascend guidance for ACLGraph deployments.  A single pipeline+                # level and AIV HCCL op expansion reduce device-side dispatch+                # overhead; both are process-local performance knobs.+                env_vars.setdefault("TASK_QUEUE_ENABLE", "1")+                env_vars.setdefault("HCCL_OP_EXPANSION_MODE", "AIV")              server = self.server_class.options(                 scheduling_strategy=ray.util.scheduling_strategies.NodeAffinitySchedulingStrategy(