Qwen3-8B RL Training with Eagle3 Spec Decoding OOM error
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 8.5k
- Forks
- 1.3k
- Avg merge
- 5h 36m
- Merged PRs (30d)
- 22
Description
Bug Description
When conducting RL training with Eagle3 speculative decoding on Qwen3-8B on 4*H200 (and even 8*H200), GPU OOM always occur after only 3~4 rollout steps.
According to the log, GPU memory usage keeps rising after each rollout step even though flush_cache and release_memory_occupation are called on the SGLang side. (An inspection of the full log indicates that, after each rollout step, the memory usage increases by about 15GB). It might be the cases that resume_memory_occupation allocates too much memory, or release_memory_occupation release too little, causing a memory leak across rollouts.
An excerpt of the OOM error is shown below:
[36m(MegatronTrainRayActor pid=982439)[0m [2025-12-03 06:17:51] timer.py:24 - Timer sleep start
[36m(MegatronTrainRayActor pid=982439)[0m [2025-12-03 06:17:52] memory_utils.py:41 - [Rank 0] Memory-Usage before offload model: {'gpu': '0', 'total_GB': 139.8, 'free_GB': 51.45, 'used_GB': 88.35, 'allocated_GB': 80.63, 'reserved_GB': 81.22}
[36m(MegatronTrainRayActor pid=982439)[0m [2025-12-03 06:17:54] memory_utils.py:41 - [Rank 0] Memory-Usage after offload model: {'gpu': '0', 'total_GB': 139.8, 'free_GB': 88.47, 'used_GB': 51.34, 'allocated_GB': 80.63, 'reserved_GB': 81.22}
[36m(MegatronTrainRayActor pid=982439)[0m [2025-12-03 06:17:54] timer.py:32 - Timer sleep end (elapsed: 2.4s)
[36m(SGLangEngine pid=980268)[0m [2025-12-03 06:17:55] INFO: 172.17.0.3:53854 - "POST /resume_memory_occupation HTTP/1.1" 200 OK
[36m(SGLangEngine pid=980266)[0m [2025-12-03 06:17:17] INFO: 172.17.0.3:40948 - "GET /health HTTP/1.1" 200 OK [32m[repeated 3x across cluster][0m
[36m(SGLangEngine pid=980269)[0m [2025-12-03 06:17:55] Cache flushed successfully!
[36m(SGLangEngine pid=980269)[0m [2025-12-03 06:17:55] INFO: 172.17.0.3:48178 - "GET /flush_cache HTTP/1.1" 200 OK
[36m(MegatronTrainRayActor pid=982439)[0m [2025-12-03 06:17:55] timer.py:24 - Timer update_weights start
[36m(MegatronTrainRayActor pid=982439)[0m [2025-12-03 06:17:55] reloadable_process_group.py:145 - Reloading 7 process groups in pid 982439
[36m(MegatronTrainRayActor pid=982439)[0m [2025-12-03 06:17:55] memory_utils.py:41 - [Rank 0] Memory-Usage before update_weights: {'gpu': '0', 'total_GB': 139.8, 'free_GB': 70.92, 'used_GB': 68.88, 'allocated_GB': 80.63, 'reserved_GB': 81.22}
[36m(MegatronTrainRayActor pid=982439)[0m Update weights: 0%| | 0/38 [00:00<?, ?it/s]
[36m(SGLangEngine pid=980269)[0m [2025-12-03 06:17:55] INFO: 172.17.0.3:48180 - "POST /update_weights_from_tensor HTTP/1.1" 200 OK
[36m(SGLangEngine pid=980269)[0m [2025-12-03 06:17:55] INFO: 172.17.0.3:48184 - "POST /update_weights_from_tensor HTTP/1.1" 200 OK
[36m(MegatronTrainRayActor pid=982439)[0m Update weights: 3%|▎ | 1/38 [00:00<00:10, 3.58it/s]
[36m(MegatronTrainRayActor pid=982439)[0m Update weights: 21%|██ | 8/38 [00:00<00:01, 25.95it/s]
[36m(MegatronTrainRayActor pid=982439)[0m Update weights: 39%|███▉ | 15/38 [00:00<00:00, 39.36it/s]
[36m(MegatronTrainRayActor pid=982439)[0m Update weights: 58%|█████▊ | 22/38 [00:00<00:00, 48.35it/s]
[36m(MegatronTrainRayActor pid=982439)[0m Update weights: 79%|███████▉ | 30/38 [00:00<00:00, 56.12it/s]
[36m(MegatronTrainRayActor pid=982439)[0m Update weights: 97%|█████████▋| 37/38 [00:00<00:00, 52.79it/s]
[36m(MegatronTrainRayActor pid=982439)[0m Update weights: 100%|██████████| 38/38 [00:00<00:00, 41.60it/s]
[36m(MegatronTrainRayActor pid=982439)[0m [2025-12-03 06:17:56] memory_utils.py:41 - [Rank 0] Memory-Usage after update_weights:
{'gpu': '0', 'total_GB': 139.8, 'free_GB': 49.36, 'used_GB': 90.44, 'allocated_GB': 95.89, 'reserved_GB': 101.91}
[36m(SGLangEngine pid=980267)[0m [torch_memory_saver.cpp] cuMemCreate CUDA_ERROR_OUT_OF_MEMORY (may not be an issue e.g. torch allocator will free cache and retry)
[36m(SGLangEngine pid=980267)[0m [torch_memory_saver.cpp] cudaError error: 2 (out of memory) file=csrc/core.cpp func=resume line=182
[36m(MegatronTrainRayActor pid=982439)[0m [2025-12-03 06:17:56] timer.py:32 - Timer update_weights end (elapsed: 1.2s)
[36m(SGLangEngine pid=980266)[0m [2025-12-03 06:17:56] INFO: 172.17.0.3:54568 - "POST /resume_memory_occupation HTTP/1.1" 200 OK [32m[repeated 10x across cluster][0m
[36m(SGLangEngine pid=980269)[0m [2025-12-03 06:18:17] INFO: 172.17.0.3:38206 - "GET /health HTTP/1.1" 200 OK
[36m(SGLangEngine pid=980266)[0m [2025-12-03 06:17:55] INFO: 172.17.0.3:54140 - "GET /flush_cache HTTP/1.1" 200 OK [32m[repeated 3x across cluster][0m
[36m(SGLangEngine pid=980266)[0m [2025-12-03 06:17:56] INFO: 172.17.0.3:54546 - "POST /update_weights_from_tensor HTTP/1.1" 200 OK [32m[repeated 150x across cluster][0m
[36m(SGLangEngine pid=980267)[0m [2025-12-03 06:18:17] INFO: 172.17.0.3:33086 - "GET /health HTTP/1.1" 200 OK
[36m(SGLangEngine pid=980269)[0m [2025-12-03 06:19:17] INFO: 172.17.0.3:41328 - "GET /health HTTP/1.1" 200 OK [32m[repeated 3x across cluster][0m
[36m(SGLangEngine pid=980269)[0m [2025-12-03 06:20:17] INFO: 172.17.0.3:38886 - "GET /health HTTP/1.1" 200 OK [32m[repeated 4x across cluster][0m
full error log:
run-qwen3-8b-rl-eagle3-OOM-issue.log
Environment
- NVIDIA-SMI 575.57.08 Driver Version: 575.57.08 CUDA Version: 12.9, H200
- image: slimerl/slime:latest
Steps for reproducing the bug
- download models and dataset
hf download Qwen/Qwen3-8B --local-dir /root/Qwen3-8B
hf download Zjcxy-SmartAI/Eagle3-Qwen3-8B-zh --local-dir /root/Eagle3-Qwen3-8B-zh
hf download download --repo-type dataset zyzshishui0627/gsm8k --local-dir /root/gsm8k
- convert model to torch_dist
cd /root/slime
source scripts/models/qwen3-8B.sh
PYTHONPATH=/root/Megatron-LM python tools/convert_hf_to_torch_dist.py \
${MODEL_ARGS[@]} \
--hf-checkpoint /root/Qwen3-8B \
--save /root/Qwen3-8B_torch_dist
- run this script
cd /root/slime
bash ./scripts/run-qwen3-8b-rl-eagle3.sh
Expected behavior
- GPU memory usage should remain almost constant across rollout steps (memory usage before rollout starts and after rollout ends should be almost identical, rather than increasing).
- RL training with Slime + SGLang + Eagle3 on Qwen3-8B should run without CUDA OOM on 4×H200 or 8×H200.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing with scripts/run-qwen3-8b-rl-eagle3.sh after following the model conversion steps in tools/convert_hf_to_torch_dist.py and scripts/models/qwen3-8B.sh. Compare the memory logs before and after each rollout, including the SGLang flush_memory and resume_memory_occupation calls shown in the report. Done means memory remains stable across rollouts and the Qwen3-8B Eagle3 run completes without CUDA OOM on the stated hardware.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python, shell
- Domain
- distributed-systems, machine-learning, performance
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100