What situations could cause the 'Memory usage increased after sleeping' problem?
Hi, I’m using verl framework to train Qwen3-30B-A3B, and my train task has trained for more than 200 steps, but at 223 step, we occured the ‘Memory usage increased after sleeping’ problem, It’s a little bit weird, I don’t know how to fix it, Is there anybody can give some clues to help me fix this problem? THANKS!
My enviroment is as follows: hardware: Huawei Ascend NPU 910B, 8 nodes 8 NPUs, total 64 NPUs CANN: 8.2.RC1 Python: 3.10.18 vllm: 0.9.1 vllm-ascend: 0.9.1rc3 torch: 2.5.1 torch-npu: 2.5.1.post1
Here is the error logs: File "/cache/verl_algo/verl/single_controller/ray/base.py", line 766, in func return getattr(self.worker_dict[key], name)(*args, **kwargs) File "/cache/verl_algo/verl/single_controller/base/decorator.py", line 430, in inner return func(*args, **kwargs) File "/cache/verl_algo/verl/utils/profiler/mstx_profile.py", line 210, in wrapper return func(self, *args, **kwargs) File "/cache/verl_algo/verl/workers/fsdp_workers.py", line 762, in generate_sequences with self.rollout_sharding_manager: File "/cache/verl_algo/verl/utils/profiler/performance.py", line 105, in f return self.log(decorated_function, *args, **kwargs) File "/cache/verl_algo/verl/utils/profiler/performance.py", line 118, in log output = func(*args, **kwargs) File "/cache/verl_algo/verl/workers/sharding_manager/fsdp_vllm.py", line 240, in exit self.inference_engine.sleep(level=1) File "/cache/verl_env/lib/python3.10/site-packages/vllm/entrypoints/llm.py", line 1322, in sleep self.llm_engine.sleep(level=level) File "/cache/verl_env/lib/python3.10/site-packages/vllm/engine/llm_engine.py", line 1860, in sleep self.model_executor.sleep(level=level) File "/cache/verl_env/lib/python3.10/site-packages/vllm/executor/executor_base.py", line 207, in sleep self.collective_rpc("sleep", kwargs=dict(level=level)) File "/cache/verl_env/lib/python3.10/site-packages/vllm/executor/uniproc_executor.py", line 57, in collective_rpc answer = run_method(self.driver_worker, method, args, kwargs) File "/cache/verl_env/lib/python3.10/site-packages/vllm/utils.py", line 2671, in run_method return func(*args, **kwargs) File "/cache/verl_env/lib/python3.10/site-packages/vllm_ascend/worker/worker.py", line 202, in sleep assert freed_bytes >= 0, "Memory usage increased after sleeping." AssertionError: Memory usage increased after sleeping.
vllm community's answer: https://discuss.vllm.ai/t/what-situations-could-cause-the-memory-usage-increased-after-sleeping-problem/1769/2
Hi, please provide your script.
Hi, thanks for the report. Based on the current public evidence, this needs more information before we can identify a concrete verl-side root cause.
Known possible situations:
- The assertion is raised inside
vllm_ascend.worker.sleep, meaning the memory measured after sleep was lower/free-memory accounting looked worse than before sleep. - vLLM sleep mode has backend-specific memory accounting behavior; on custom backends such as Ascend NPU, this assertion may be too strict or may not reflect actual device-level memory state.
- In verl rollout paths with
free_cache_engine=true, sleep is expected between rollout/training phases. On NPU, the current code path uses sleep level 1. - PR #6456 fixed a separate CUDA HYBRID DP>1 sleep propagation issue, but that PR explicitly says #3902 is a different Ascend NPU / old SPMD scenario, so it is not enough to mark this issue as fixed.
Could you please provide:
- the exact verl commit and full launch script/config;
- rollout mode,
free_cache_engine, tensor/data/expert parallel sizes, andgpu_memory_utilization; - full logs around step 223, including per-rank/per-node memory before and after sleep;
- whether
rollout.free_cache_engine=falseor lowergpu_memory_utilizationavoids the assertion; - whether the issue reproduces with a smaller model or fewer nodes.
中文:感谢反馈。基于目前公开信息,还不能确认这是一个明确的 verl 侧 bug,需要更多复现信息。
目前能确定的可能场景:
- 断言发生在
vllm_ascend.worker.sleep内部,含义是 sleep 前后显存统计显示没有释放,甚至看起来占用增加。 - vLLM sleep mode 的显存统计和释放在不同后端上可能不一致;Ascend NPU 这类自定义后端上,该断言可能过于严格,或不能准确反映真实设备级显存状态。
- 在 verl 中如果
free_cache_engine=true,rollout/training 切换时调用 sleep 是预期行为;NPU 路径当前会使用 sleep level 1。 - PR #6456 修复的是 CUDA HYBRID 且 DP>1 时 sleep 没有传播到所有 DP shard 的另一个问题,并且该 PR 明确说明 #3902 是不同场景,所以不能据此判断本 issue 已修复。
请补充:
- 使用的 verl 精确 commit,以及完整启动脚本/配置;
- rollout mode、
free_cache_engine、TP/DP/EP 参数和gpu_memory_utilization; - step 223 前后的完整日志,尤其是每个 rank/node 的 sleep 前后显存;
- 设置
rollout.free_cache_engine=false或降低gpu_memory_utilization后是否能绕过; - 小模型或更少节点是否能复现。
This response was generated by a scheduled Codex GPT5.5 issue processing task.
We work on vLLM sleep/wake memory accounting on the CUDA side (upstream PRs vllm-project/vllm#57899 and vllm-project/vllm#58183). The Ascend path may differ, but two causes we have measured produce exactly this symptom (device free memory lower after sleep than before, so freed_bytes goes negative), plus one diagnostic angle:
-
Probe-semantics mismatch. Framework-level statistics (reserved/allocated) and device-level free memory measure different things; a caching allocator can hold freed blocks without returning them to the device. If the before/after readings mix the two sources, the sign can flip without any real growth. This is one concrete form of what @Kirrito-k423 noted above about the assertion being potentially too strict for custom backends.
-
Unrelated allocations landing between the two probes. Communication channel buffers are typically created lazily at first use, so a collective running between the before-reading and the sleep call can lower device free memory independently of sleep itself.
-
One-time vs. recurring. This report hit the assertion at step 223 after roughly 222 successful sleep/wake rounds, which argues against a first-sleep one-time allocation and toward something that grows or only triggers late. Checking whether the negative delta keeps growing on every sleep from that step onward would separate a one-time event from a real leak.
What pinned these down for us was a per-allocation-site breakdown: tag weights / KV cache / CUDA graph pool / communication buffers / library workspaces separately, then reconcile the sum against device free memory until the unexplained residual is zero. Happy to share the accounting script if that helps.
Following up on our earlier comment — the per-allocation-site accounting toolkit is now public: https://gist.github.com/AlanFokCo/7e790fe60f2e5f2957c0b994e782a9cf
It tags weights / KV cache / CUDA graph pool / communication buffers / library workspaces separately across sleep/wake cycles and reconciles the sum against device free memory until the unexplained residual is zero. probe.py drives N sleep/wake rounds and records per-stage device counters; analyze_memory.py then joins allocator intervals to PyTorch snapshot blocks offline (no CUDA imports). Both sides of the measurement are kept visible — driver free memory vs. PyTorch reserved/allocated — because mixing those two sources is root cause (1) in our earlier comment.
One correction to that comment: the upstream PR reference vllm-project/vllm#58183 was closed unmerged and split into smaller pieces — the checkpoint-path multi-worker semantics landed as vllm-project/vllm#64186 (merged 2026-10-28), and the utility-call hardening is in review as vllm-project/vllm#64183. The graph-discard line continues as vllm-project/vllm#57899.