Inspect · Source & workspace
Requested workspace inspection related to source & workspace.
1 call · #0001–#0001
echo <val>ls -l -a <val> <n> > <path>Claude Opus 5 · RL
Qwen3-0.6B CodeOpt GRPO 1dev · Implementation Optimization
01 / PROCESS MAP
Each row shows one agent’s tool events in its own recorded order. Colors show broad activities; bar widths do not represent duration.
Main agentClaude Opus 5 · 158 visible calls
02 / EVENT SEQUENCE
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.
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>.
Requested workspace inspection related to source & workspace.
1 call · #0001–#0001
echo <val>ls -l -a <val> <n> > <path>Requested file and log inspection and workspace inspection related to task requirements.
3 calls · #0002–#0004
Read <path>cd <path>ls -l -a <val> <val> <val> <val> <val> <path>Requested file and log inspection related to reward & policy updates.
1 call · #0005–#0005
cd <path><command> <args>cat <val>Requested file and log inspection related to source & workspace.
5 calls · #0006–#0010
Read <path>Requested environment setup or inspection, source searches and script or workload execution related to parallelism & communication.
1 call · #0011–#0011
envgrep -i -E <val>sortecho <flag>which <val>timeout <n> <val> <val> <n> >& <path>head -n <n>echo <val>Requested tool activity related to benchmark & validation setup.
1 call · #0012–#0012
cd <path><command> <args>echo <val>Requested workspace inspection, file and log inspection and repository inspection related to checkpoints & weight state.
3 calls · #0013–#0015
cd <path>lsecho <flag>ls -R <path> <n> > <path>head -n <n>git log --oneline <flag> <args>grep -r -n <val> --include <path>echo <val>grep -r -n <val> --include <path> <path> <path> <n> > <path>Read <path>Requested file and log inspection, workspace inspection and source searches related to benchmark & validation setup.
1 call · #0016–#0016
echo <val>tail -n <n> <path> <n> > <path>ls -l -a <path> <n> > <path>grep -n <val> <path>head -n <n>Requested file and log inspection related to source & workspace.
1 call · #0017–#0017
Read <path>Requested workspace inspection and file and log inspection related to rollout generation.
1 call · #0018–#0018
echo <val>ls -l -a <path> <n> > <path>echotail -n <n> <path> <n> > <path>ls <path> <path> <n> > <path>Requested source searches and file and log inspection related to rollout generation.
2 calls · #0019–#0020
cd <path>grep -n <val> <path>head -n <n>Read <path>Requested file and log inspection related to benchmark & validation setup.
1 call · #0021–#0021
tail -n <n> <path> <n> > <path>echo <val>Requested file and log inspection related to source & workspace.
1 call · #0022–#0022
Read <path>Requested file and log inspection related to benchmark & validation setup.
1 call · #0023–#0023
tail -c <n> <path> <n> > <path>echo <val>tail -n <n> <path> <n> > <path>Requested source searches and file and log inspection related to rollout generation.
2 calls · #0024–#0025
cd <path>grep -n <val> <path>head -n <n>Read <path>Requested source searches and file and log inspection related to prefix caching.
1 call · #0026–#0026
cd <path>grep -n <val> <path>head -n <n>echo <val>grep -r -n <val> <path> <n> > <path>Requested source searches, file and log inspection and workspace inspection related to benchmark & validation setup.
2 calls · #0027–#0028
grep -c <path> <path>echo <flag>grep -a -E <val> <path>tail -n <n>ls -l -a <path>echo <val>tail -c <n> <path>echocat <path>ps <val>grep -c <val>Requested execution waits, workspace inspection and file and log inspection related to benchmark & validation setup.
2 calls · #0029–#0030
sleep <n>ls -l -a <path>echo <val>tail -c <n> <path>grep -a -E <val> <path>tail -n <n>Requested file and log inspection related to source & workspace.
1 call · #0031–#0031
Read <path>Requested workspace inspection and file and log inspection related to benchmark & validation setup.
1 call · #0032–#0032
ls -l -a <path>echo <val>tail -c <n> <path>echocat <path>tail -n <n>Requested execution waits, workspace inspection and file and log inspection related to benchmark & validation setup.
1 call · #0033–#0033
sleep <n>ls -l -a <path>echo <val>tail -c <n> <path>Requested source searches and file and log inspection related to source & workspace.
2 calls · #0034–#0035
cd <path>grep -r -n <val> <path>head -n <n>Read <path>Requested workspace inspection and file and log inspection related to benchmark & validation setup.
1 call · #0036–#0036
ls -l -a <path>echo <val>cat <path>tail -n <n>tail -c <n> <path>Requested execution waits, workspace inspection and file and log inspection related to benchmark & validation setup.
3 calls · #0037–#0039
sleep <n>ls -l -a <path>echo <val>cat <path>tail -n <n>cd <path>python3 -c <script>Requested script or workload execution related to reward & policy updates.
1 call · #0040–#0040
cd <path>python3 -c <script>Requested source searches and file and log inspection related to benchmark & validation setup.
1 call · #0041–#0041
date -uecho <val>grep -a -c <val> <path>echo <path>grep -a -E <val> <path>tail -n <n>Requested workspace file updates related to benchmark & validation setup.
1 call · #0042–#0042
cd <path>mkdir -p <path>cp -a <path> <path> <n> > <path>rm -f <path><command> <args>echo <val>Requested workspace file updates and script or workload execution related to benchmark & validation setup.
1 call · #0043–#0043
mkdir -p <path>cp -a <path> <path>rm -f <path>bash <script> > <path> <n> >& <path>echo <val>Requested file and log inspection and source searches related to rollout generation.
2 calls · #0044–#0045
cd <path>wc -l <path>grep -n <val> <path>head -n <n>Read <path>Requested source searches and file and log inspection related to prefix caching.
1 call · #0046–#0046
cd <path>grep -n <val> <path>head -n <n>Requested file and log inspection related to rollout generation.
1 call · #0047–#0047
Read <path>Requested workspace inspection and file and log inspection related to rollout generation.
1 call · #0048–#0048
date -uls -l -a <path> <n> > <path>echo <val>cd <path>sed -n <val> <path>Requested source searches and file and log inspection related to rollout generation.
2 calls · #0049–#0050
cd <path>grep -n <val> <path>head -n <n>Read <path>Requested workspace inspection and file and log inspection related to rollout generation.
1 call · #0051–#0051
date -uls -l -a <path>echo <val>cd <path>sed -n <val> <path>Requested file and log inspection related to rollout generation.
1 call · #0052–#0052
cd <path>sed -n <val> <path>Requested workspace inspection, source searches and file and log inspection related to benchmark & validation setup.
1 call · #0053–#0053
date -uls -l -a <path>echo <val>grep -a -E <val> <path>tail -n <n>Requested execution waits, workspace inspection and source searches related to device memory.
2 calls · #0054–#0055
sleep <n>date -uls -l -a <path>echo <path>grep -a -E <val> <path>tail -n <n>echo <val>Requested workspace inspection and file and log inspection related to benchmark & validation setup.
1 call · #0056–#0056
date -uls -l -a <path> <n> > <path>echo <val>tail -c <n> <path> <n> > <path>Requested script or workload execution related to task requirements.
1 call · #0057–#0057
python3 -c <script>Requested script or workload execution related to benchmark & validation setup.
1 call · #0058–#0058
python3 -c <script>Requested environment setup or inspection, source searches and file and log inspection related to device memory.
2 calls · #0059–#0060
env <vars>grep -a -i -E <val> <val>grep -a -v -i -E <val>head -n <n>grep -a <flag> <args>sort -uecho <val>npu-smi info <n> > <path>Requested source searches and file and log inspection related to prefix caching.
1 call · #0061–#0061
cd <path>grep -r -n <val> <path>head -n <n>echo <val>grep -r -n <val> <path> <path> <n> > <path>Requested file and log inspection related to rollout generation.
1 call · #0062–#0062
sed -n <val> <path>echo <val>Requested source searches, file and log inspection and script or workload execution related to device memory.
1 call · #0063–#0063
echo <val>grep -r -n <val> <path>headhead -n <n>python3 -c <script> <n> >& <path>tail -n <n>Requested file and log inspection related to kv-cache management.
1 call · #0064–#0064
sed -n <val> <path>echo <val>Requested file and log inspection related to rollout generation.
1 call · #0065–#0065
sed -n <val> <path>Requested source searches, file and log inspection and script or workload execution related to attention kernels.
2 calls · #0066–#0067
grep -n <val> <path>headecho <val>head -n <n>echo <path>python3 -c <script> <n> >& <path>tail -n <n>echo <flag>sed -n <val> <path>Requested code edits related to source & workspace.
2 calls · #0068–#0069
Edit <path>Requested file and log inspection related to source & workspace.
1 call · #0070–#0070
sed -n <val> <path>Requested file and log inspection and source searches related to kv-cache management.
1 call · #0071–#0071
sed -n <val> <path>echo <val>grep -n <val>Requested code edits related to kv-cache management.
2 calls · #0072–#0073
Edit <path>Requested source searches and file and log inspection related to rollout generation.
3 calls · #0074–#0076
grep -n <val> <path>head -n <n>echo <val>grep -a <flag> <args>sort -uheadsed -n <val> <path>Requested code edits related to rollout generation.
1 call · #0077–#0077
Edit <path>Requested source searches and file and log inspection related to rollout generation.
2 calls · #0078–#0079
grep -n <val> <path>sed -n <val> <path>Requested code edits related to rollout generation.
1 call · #0080–#0080
Edit <path>Requested source searches and file and log inspection related to prefix caching.
1 call · #0081–#0081
grep -n <val> <path>head -n <n>echo <val>Requested file and log inspection related to rollout generation.
1 call · #0082–#0082
sed -n <val> <path>Requested code edits related to rollout generation.
1 call · #0083–#0083
Edit <path>Requested file and log inspection related to rollout generation.
1 call · #0084–#0084
sed -n <val> <path>Requested code edits related to rollout generation.
1 call · #0085–#0085
Edit <path>Requested script or workload execution and source searches related to kv-cache management.
1 call · #0086–#0086
cd <path>python3 -c <script> <n> >& <path>grep -v <val>Requested environment setup or inspection and source searches related to batching & scheduling.
1 call · #0087–#0087
cd <path>env <vars> python3 -c <script> <n> >& <path>grep -v <val>Requested script or workload execution, source searches and file and log inspection related to rollout generation.
3 calls · #0088–#0090
cd <path>python3 -c <script> <n> >& <path>grep -v -i -E <val>tail -n <n>grep -r -l -n <val> <path> <n> > <path>headecho <val>grep -r -n <val> <path> <n> > <path>head -n <n>sed -n <val> <path>Requested code edits related to rollout generation.
1 call · #0091–#0091
Edit <path>Requested workspace file updates, workspace inspection and script or workload execution related to benchmark & validation setup.
2 calls · #0092–#0093
mkdir -p <path>cp -a <path> <path>rm -f <path>ls <path>echo <flag>bash <script> > <path> <n> >& <path>Requested execution waits, workspace inspection and source searches related to device memory.
1 call · #0094–#0094
sleep <n>date -uls -l -a <path> <n> > <path>echo <val>grep -a <flag> <args>sort -uheadRequested source searches and file and log inspection related to kv-cache management.
1 call · #0095–#0095
grep -n <val> <path>head -n <n>echo <val>grep -r -n <val> <path> <path> <n> > <path>Requested source searches, file and log inspection and script or workload execution related to source & workspace.
2 calls · #0096–#0097
grep -r -n <val> <path> <n> > <path>head -n <n>echo <val>grep -r -l -n <val> <path> <path> <path> <n> > <path>cd <path>timeout <n> <val> <path> <n> >& <path>tail -n <n>Requested source searches, file and log inspection and repository inspection related to kv-cache management.
1 call · #0098–#0098
grep -r -n <val> <path>head -n <n>echo <val>cd <path>git status <flag>Requested workspace inspection, source searches and file and log inspection related to device memory.
1 call · #0099–#0099
date -uls -l -a <path> <n> > <path>echo <val>grep -a <flag> <args>sort -uheadRequested execution waits, source searches and file and log inspection related to rollout generation.
2 calls · #0100–#0101
sleep <n>date -uecho <val>grep -a <flag> <args>sort -uheadls -l -a <path>Requested source searches and file and log inspection related to rollout generation.
1 call · #0102–#0102
date -uecho <path>grep -a <flag> <args>sort -uheadecho <val>tail -c <n> <path> <n> > <path>Requested execution waits, source searches and file and log inspection related to rollout generation.
2 calls · #0103–#0104
sleep <n>date -uecho <path>grep -a <flag> <args>sort -uheadecho <val>ls -l -a <path>tail -n <n>Requested execution waits, workspace inspection and file and log inspection related to benchmark & validation setup.
2 calls · #0105–#0106
sleep <n>date -uls -l -a <path>tail -n <n>python3 -c <script>Requested script or workload execution related to task requirements.
1 call · #0107–#0107
python3 -c <script>Requested workspace file updates and script or workload execution related to benchmark & validation setup.
2 calls · #0108–#0109
mkdir -p <path>cp -a <path> <path>rm -f <path>echo <val>date -ubash <script> > <path> <n> >& <path>Requested workspace inspection, file and log inspection and source searches related to rollout generation.
1 call · #0110–#0110
ls <path> <n> > <path>head -n <n>echo <val>grep -r -l -n <val> <path> <n> > <path>ls <path> <path> <n> > <path>Requested script or workload execution and file and log inspection related to kv-cache management.
2 calls · #0111–#0112
cd <path>timeout <n> <val> -m <val> <path> <path> -q -p <val> <n> >& <path>tail -n <n>timeout <n> <val> -m <val> <path> -q -p <val> <flag> <args>Requested workspace inspection, file and log inspection and source searches related to benchmark & validation setup.
1 call · #0113–#0113
date -uls -l -a <path> <n> > <path>tail -n <n>echo <val>grep -a <flag> <args>sort -uhead -n <n>Requested script or workload execution and source searches related to batching & scheduling.
1 call · #0114–#0114
cd <path>python3 -c <script> <n> >& <path>grep -v -i -E <val>Requested environment setup or inspection, source searches and workspace inspection related to rollout generation.
1 call · #0115–#0115
cd <path>env <vars> python3 -c <script> <n> >& <path>grep -v -i -E <val>echo <val>ls <path> <n> > <path>headgrep -r -l -n <val> <path> <n> > <path>head -n <n>Requested workspace inspection, file and log inspection and script or workload execution related to benchmark & validation setup.
1 call · #0116–#0116
date -uls -l -a <path> <n> > <path>tail -n <n>echo <val>cd <path>timeout <n> <val> -m <val> <path> -q -p <val> <n> >& <path>Requested workspace inspection, file and log inspection and source searches related to rollout generation.
2 calls · #0117–#0118
date -uls -l -a <path> <n> > <path>tail -n <n>echo <val>cd <path>ls <path> <n> > <path>grep -i <val>headtimeout <n> <val> -m <val> <path> -q -p <val> <n> >& <path>Requested script or workload execution and file and log inspection related to kv-cache management.
1 call · #0119–#0119
date -ucd <path>timeout <n> <val> -m <val> <val> <path> <path> <n> >& <path>tail -n <n>echo <val>timeout <n> <val> -m <val> <val> --check <path> <path> <n> >& <path>Requested script or workload execution related to rollout generation.
1 call · #0120–#0120
which <val> <val> <val> <n> > <path>echo <flag>python3 -m <module> <script> <script> <script> <script>echo <val>python3 -c <script>Requested workspace inspection, file and log inspection and source searches related to rollout generation.
2 calls · #0121–#0122
date -uls -l -a <path> <n> > <path>tail -n <n>echo <val>grep -a <flag> <args>sort -uhead -n <n>sleep <n>Requested repository inspection and file and log inspection related to source & workspace.
1 call · #0123–#0123
<command> <args>cd <val>git status <flag> <args>head -n <n>Requested repository inspection related to rollout generation.
1 call · #0124–#0124
cd <path>git diff --statecho <val>git diff --stat <flag> <args>Requested execution waits, workspace inspection and file and log inspection related to checkpoints & weight state.
1 call · #0125–#0125
sleep <n>date -uls -l -a <path> <n> > <path>tail -n <n>echo <path>grep -a <flag> <args>sort -uRequested execution waits, workspace inspection and file and log inspection related to source & workspace.
1 call · #0126–#0126
sleep <n>date -uls -l -a <path> <n> > <path>tail -n <n>Requested execution waits, workspace inspection and file and log inspection related to benchmark & validation setup.
5 calls · #0127–#0131
sleep <n>date -uls -l -a <path> <n> > <path>tail -n <n>echo <val>ls <path> <n> > <path><command> <args>python3 -c <script>tail -c <n> <path> <n> > <path>Requested script or workload execution related to checkpoints & weight state.
1 call · #0132–#0132
python3 -c <script>Requested script or workload execution and workspace file updates related to benchmark & validation setup.
3 calls · #0133–#0135
python3 -c <script>mkdir -p <path>cp -a <path> <path>rm -f <path>echo <val>date -ubash <script> > <path> <n> >& <path>Requested environment setup or inspection, workspace inspection and file and log inspection related to device memory.
1 call · #0136–#0136
env <vars>ls -l -a <val> <n> > <path>headecho <val>cat <path> <n> > <path>head -n <n>Requested code edits related to device memory.
3 calls · #0137–#0139
Write <path>Requested workspace inspection, file and log inspection and execution waits related to benchmark & validation setup.
5 calls · #0140–#0144
date -uls -l -a <path> <n> > <path>tail -n <n>ls <path> <n> > <path>echo <val>sleep <n>Requested script or workload execution related to reward & policy updates.
1 call · #0145–#0145
python3 -c <script>Requested source searches and file and log inspection related to device memory.
1 call · #0146–#0146
echo <val>grep -a -n -E <val> <path>tail -n <n>Requested script or workload execution related to benchmark & validation setup.
2 calls · #0147–#0148
python3 -c <script>Requested script or workload execution related to checkpoints & weight state.
1 call · #0149–#0149
python3 -c <script>Requested script or workload execution, source searches and file and log inspection related to reward & policy updates.
1 call · #0150–#0150
python3 -c <script>echo <val>grep -a <flag> <args>sort -uhead -n <n>Requested script or workload execution related to reward & policy updates.
1 call · #0151–#0151
python3 -c <script>Requested workspace file updates, script or workload execution and file and log inspection related to benchmark & validation setup.
1 call · #0152–#0152
mkdir -p <path>cp -a <path> <path> <n> > <path>date -utimeout <n> <val> <path> <n> >& <path>tail -n <n>echo <val>Requested script or workload execution and file and log inspection related to source & workspace.
1 call · #0153–#0153
date -utimeout <n> <val> <path> <n> >& <path>tail -n <n>echo <val>cd <path><command> <args>timeout <n> <val> <path> > <path> <n> >& <path>Requested script or workload execution and file and log inspection related to benchmark & validation setup.
1 call · #0154–#0154
cd <path>timeout <n> <val> -m <val> <path> -q -p <val> <flag> <args>tail -n <n>Requested repository inspection related to rollout generation.
1 call · #0155–#0155
date -uecho <path>cd <path>git diffgit diff <flag> <args>Requested workspace file updates, workspace inspection and repository inspection related to benchmark & validation setup.
1 call · #0156–#0156
date -ucp -a <path> <path> <path> <n> > <path>ls <path>echo <val>cd <path>git status <flag> <args><command> <args>cd <val>Requested script or workload execution related to checkpoints & weight state.
1 call · #0157–#0157
python3 -c <script>Requested environment setup or inspection and source searches related to device memory.
1 call · #0158–#0158
cd <path>env <vars> python3 -c <script> <n> >& <path>grep -v -i -E <val>03 / CANDIDATE ARTIFACT
Read code changes as Git diffs. Identifying strings are masked; binary files are listed by their full relative names.
Base commit: 0b2151ec61de5d99e0811b01c09e43a99a23e69d
@@ -279,6 +279,7 @@ actor_rollout_ref: enforce_eager: false cudagraph_capture_sizes: null free_cache_engine: true+ kv_cache_concurrency_factor: null tensor_model_parallel_size: 2 data_parallel_size: 1 expert_parallel_size: 1@@ -244,6 +244,7 @@ actor_rollout_ref: enforce_eager: false cudagraph_capture_sizes: null free_cache_engine: true+ kv_cache_concurrency_factor: null tensor_model_parallel_size: 2 data_parallel_size: 1 expert_parallel_size: 1@@ -251,6 +251,7 @@ actor_rollout_ref: enforce_eager: false cudagraph_capture_sizes: null free_cache_engine: true+ kv_cache_concurrency_factor: null tensor_model_parallel_size: 2 data_parallel_size: 1 expert_parallel_size: 1@@ -242,6 +242,7 @@ actor_rollout_ref: enforce_eager: false cudagraph_capture_sizes: null free_cache_engine: true+ kv_cache_concurrency_factor: null tensor_model_parallel_size: 2 data_parallel_size: 1 expert_parallel_size: 1@@ -52,6 +52,16 @@ cudagraph_capture_sizes: null # Whether to free engine KVCache after generation. free_cache_engine: True +# When the rollout engine shares a device with a colocated trainer+# (enable_sleep_mode and free_cache_engine both True), cap the KV cache to this+# multiple of the engine's concurrency ceiling (max_num_seqs x max_model_len)+# rather than letting gpu_memory_utilization claim memory the scheduler can+# never address. A smaller KV cache makes the sleep/wake cycle much cheaper and+# leaves HBM for the trainer. null uses the built-in default (4.0);+# 0 disables the cap and restores vLLM's default sizing.+# supported engines: vllm+kv_cache_concurrency_factor: null+ # TP size for rollout. Not effective for hf tensor_model_parallel_size: 2 @@ -194,6 +194,14 @@ class RolloutConfig(BaseConfig): enforce_eager: bool = False cudagraph_capture_sizes: Optional[list] = None free_cache_engine: bool = True+ # When the rollout engine shares a device with a colocated trainer+ # (enable_sleep_mode and free_cache_engine both on), cap the KV cache to+ # this multiple of the engine's concurrency ceiling+ # (max_num_seqs x max_model_len) instead of letting+ # gpu_memory_utilization claim memory the scheduler can never address.+ # Smaller caches make sleep/wake much cheaper and leave HBM for the+ # trainer. Set to 0 to disable the cap and restore vLLM's default sizing.+ kv_cache_concurrency_factor: Optional[float] = None data_parallel_size: int = 1 expert_parallel_size: int = 1 tensor_model_parallel_size: int = 2@@ -54,6 +54,13 @@ from verl.workers.rollout.vllm_rollout.utils import ( ) _VLLM_VERSION = version.parse(vllm.__version__)++# Multiple of the engine's concurrency ceiling (max_num_seqs x max_model_len)+# to size the KV cache to when the rollout engine shares a device with a+# colocated trainer. > 1 leaves room for prefix-cache history; the exact value+# is not performance-critical as long as it comfortably exceeds 1.+_DEFAULT_KV_CACHE_CONCURRENCY_FACTOR = 4.0+ _RESET_PREFIX_CACHE_KWARGS = {} if _VLLM_VERSION >= version.parse("0.13.0"): _RESET_PREFIX_CACHE_KWARGS["reset_connector"] = True@@ -232,6 +239,8 @@ class vLLMHttpServer: set_expandable_segments(True) + self._maybe_cap_kv_cache()+ quantization, hf_overrides = self._apply_quantization() compilation_config = engine_kwargs.pop("compilation_config", None) or {}@@ -836,6 +845,43 @@ class vLLMHttpServer: """Mutate engine_kwargs in-place before the CLI args dict is built. No-op by default.""" pass + def _maybe_cap_kv_cache(self) -> None:+ """Bound the KV cache to what the engine can actually address.++ ``gpu_memory_utilization`` sizes the KV cache against the whole device,+ but when sleep mode is on the engine is sharing that device with a+ colocated trainer. Blocks beyond ``max_num_seqs x max_model_len`` can+ only ever serve as prefix-cache history, while the memory they hold+ must be freed on every sleep and re-allocated on every wake -- and it+ is memory the trainer could otherwise use. Capping to a small multiple+ of the concurrency ceiling keeps prefix caching effective and makes+ the sleep/wake cycle substantially cheaper.++ Only applies when sleep mode and free_cache_engine are both on (the+ colocated case). Honours an explicitly-set environment value.+ """+ if not (self.config.enable_sleep_mode and self.config.free_cache_engine):+ return+ if "VLLM_KV_CACHE_CONCURRENCY_FACTOR" in os.environ:+ return++ factor = self.config.get("kv_cache_concurrency_factor", None)+ if factor is None:+ factor = _DEFAULT_KV_CACHE_CONCURRENCY_FACTOR+ if factor <= 0:+ return++ # Read by vLLM in-process and inherited by the EngineCore subprocess.+ os.environ["VLLM_KV_CACHE_CONCURRENCY_FACTOR"] = str(factor)+ logger.info(+ "colocated rollout: capping KV cache to %sx the engine concurrency "+ "ceiling (max_num_seqs=%s, max_model_len=%s) to speed up sleep/wake "+ "and leave HBM for the trainer",+ factor,+ self.config.max_num_seqs,+ self.config.max_model_len,+ )+ def _get_override_generation_config(self) -> dict: """Return the override_generation_config dict.""" # Override default generation config from hugging face model config,Base commit: 5a0277de14789b245c781911b3119ed6af901b7b
@@ -118,6 +118,7 @@ if TYPE_CHECKING: VLLM_ROCM_CUSTOM_PAGED_ATTN: bool = True VLLM_ROCM_SHUFFLE_KV_CACHE_LAYOUT: bool = False VLLM_ENABLE_V1_MULTIPROCESSING: bool = True+ VLLM_KV_CACHE_CONCURRENCY_FACTOR: float | None = None VLLM_LOG_BATCHSIZE_INTERVAL: float = -1 VLLM_DISABLE_COMPILE_CACHE: bool = False Q_SCALE_CONSTANT: int = 200@@ -1030,6 +1031,19 @@ environment_variables: dict[str, Callable[[], Any]] = { "VLLM_ENABLE_V1_MULTIPROCESSING": lambda: bool( int(os.getenv("VLLM_ENABLE_V1_MULTIPROCESSING", "1")) ),+ # Caps the KV cache to this multiple of the engine's own concurrency+ # ceiling (max_num_seqs x max_model_len) instead of consuming all the+ # memory implied by gpu_memory_utilization. Unset (None) keeps the+ # default behaviour of sizing the KV cache to all available memory.+ # Useful when the engine shares a device with another memory consumer+ # (e.g. a colocated RL trainer): a KV cache far larger than the+ # scheduler can ever address only makes sleep/wake and allocation+ # more expensive. Values <= 0 disable the cap.+ "VLLM_KV_CACHE_CONCURRENCY_FACTOR": lambda: (+ float(os.environ["VLLM_KV_CACHE_CONCURRENCY_FACTOR"])+ if "VLLM_KV_CACHE_CONCURRENCY_FACTOR" in os.environ+ else None+ ), "VLLM_LOG_BATCHSIZE_INTERVAL": lambda: float( os.getenv("VLLM_LOG_BATCHSIZE_INTERVAL", "-1") ),@@ -833,6 +833,33 @@ def may_override_num_blocks(vllm_config: VllmConfig, num_blocks: int) -> int: return num_blocks +def get_max_useful_num_blocks(vllm_config: VllmConfig) -> int | None:+ """Upper bound on the number of KV cache blocks the engine can address.++ The scheduler can never hold more than ``max_num_seqs`` requests of+ ``max_model_len`` tokens in flight, so blocks beyond that are only ever+ usable as prefix-cache history. When the device is shared with another+ memory consumer (e.g. a colocated RL trainer), an oversized KV cache is+ actively harmful: it makes sleep/wake and allocation more expensive and+ starves the co-tenant.++ Returns ``None`` when no cap is configured, leaving default sizing (all+ available memory) untouched.+ """+ factor = envs.VLLM_KV_CACHE_CONCURRENCY_FACTOR+ if factor is None or factor <= 0:+ return None++ block_size = vllm_config.cache_config.block_size+ max_model_len = vllm_config.model_config.max_model_len+ max_num_seqs = vllm_config.scheduler_config.max_num_seqs+ if not block_size or not max_model_len or not max_num_seqs:+ return None++ blocks_per_request = cdiv(max_model_len, block_size)+ return max(1, int(factor * max_num_seqs * blocks_per_request))++ def get_num_blocks( vllm_config: VllmConfig, num_layers: int, available_memory: int, page_size: int ) -> int:@@ -847,6 +874,21 @@ def get_num_blocks( """ num_blocks = int(available_memory // page_size // num_layers) num_blocks = max(num_blocks, 0)++ max_useful = get_max_useful_num_blocks(vllm_config)+ if max_useful is not None and num_blocks > max_useful:+ logger.info(+ "Capping num_gpu_blocks=%d to %d (%.3g GiB) to match the engine's "+ "concurrency ceiling (max_num_seqs=%d, max_model_len=%d); "+ "set VLLM_KV_CACHE_CONCURRENCY_FACTOR=0 to disable.",+ num_blocks,+ max_useful,+ (max_useful * page_size * num_layers) / (1 << 30),+ vllm_config.scheduler_config.max_num_seqs,+ vllm_config.model_config.max_model_len,+ )+ num_blocks = max_useful+ num_blocks = may_override_num_blocks(vllm_config, num_blocks) return num_blocks