High-Performance Training
Supports efficient training in various modes by connecting Megatron with SGLang.
A LITTLE SLIME. A LOT OF POSSIBILITY.
slime is an LLM post-training framework for RL scaling, providing two core capabilities:
Explore in your browser. Ready to run? Install slime →
SLIME / ONE RL RUN
A 75-second guided example. Your saved experiment stays as it is.
Illustrative answers and rewards, not a measured run. An update need not improve the next reward.
Supports efficient training in various modes by connecting Megatron with SGLang.
Enables arbitrary training data generation workflows through custom data generation interfaces and server-based engines.
Training, rollout, custom generation, rewards, verifiers, and environment interaction flow through the same training / rollout / Data Buffer path.
BUILT IN THE OPEN. USED AT SCALE.
slime has powered RL post-training across Z.ai’s GLM generations. Explore the model releases, then use the same core capabilities in your own experiment.
00 / SET UP ONCE
Start with the prepared image, or build a conda environment. Then choose a model below and take your launch script with you.
The image includes Megatron, SGLang and slime’s patches. On your Linux x86_64 GPU host, have Git, Docker and the NVIDIA driver ready, with NVIDIA Container Toolkit ↗.
SLIME_IMAGE=slimerl/slime:latest-cu129
docker pull "$SLIME_IMAGE"
git clone https://github.com/THUDM/slime.git
cd slime
mkdir -p ../slime-data
docker run --rm -it --gpus all --ipc=host \
--shm-size=16g --ulimit memlock=-1 --ulimit stack=67108864 \
-v "$PWD:/root/slime" -v "$PWD/../slime-data:/data" \
-w /root/slime "$SLIME_IMAGE" /bin/bash
pip install -e . --no-deps
python -c "import slime, sglang, megatron.core; import torch; print('GPUs:', torch.cuda.device_count())"
Your checkout stays on the host. Models, data and checkpoints under /data persist in the sibling slime-data directory after the container exits. The builder uses /data by default.
The repository’s build_conda.sh creates a slime environment with Python 3.12, CUDA 12.9, Megatron, SGLang and the matching patches. It installs micromamba and compiles native dependencies.
Use a Linux x86_64 NVIDIA machine with Bash, Git, curl, patch, a C/C++ toolchain and a compatible GPU driver. The current script expects write access to /root. For B200/B300, use the CUDA 13 Docker image above.
git clone https://github.com/THUDM/slime.git
cd slime
BASE_DIR=/root SHELL=/bin/bash bash build_conda.sh
source ~/.bashrc
micromamba activate slime
export CUDA_HOME="$CONDA_PREFIX"
python -c "import slime, sglang, megatron.core; import torch; print('GPUs:', torch.cuda.device_count())"
After the build finishes, activate the environment in each new shell. In the builder’s Files step, choose writable model, data and output paths; Megatron is at /root/Megatron-LM. Build script ↗
01 / THE EXPERIMENT BUILDER
Save a complete snapshot as A; your working experiment is B. Undo / Redo changes B. Replacing A is a separate action. Exports below always use B.
02 / FROM PLAY TO RUN
A starting recipe grounded in this repository. Prepare the environment, review the assumptions, then run.
GPU counts describe placement, not a memory-fit guarantee. These generated combinations have not been benchmarked on your hardware. Start with a short run and compare reward, log-prob mismatch, clipping, and rollout time.
04 / WHEN YOU WANT TO GO FURTHER
Open a question. Find the next measurement, then the right tool.
Inspect generated text, checkpoint loading, and the chat template first. Save a rollout, replay a fixed batch on the training side, then compare log-probs before changing the algorithm.
Debug & replay →Understand mismatch →Separate rollout, reward, weight transfer, and training time. Trace the critical path, then profile the busy engine. Use tools/profile_rollout.py to collect SGLang traces and inspect prefill/decode behavior.
Profiling →Timeline & tracing →Metrics →Split GPU ownership, then choose a weight transport that matches the network. Add PD when prefill and decode need different resources; use persistent rollout storage when jobs need recovery.
External engines →Delta sync →Partial / distributed async →straw →Recovery →Start with a custom per-sample generation function and reward. Replace rollout orchestration only when your data scheduling or cross-step state needs it.
Agent RL →Extension interfaces →SGLang topology →