post-training-slime
What it does
This skill guides the use of slime, a framework for post-training large language models with reinforcement learning. It is for research teams training large models such as GLM at scale.
When to use it
- βWhen you want to train a large model with Megatron-LM and fast SGLang rollouts.
- βWhen you need custom data generation and filtering in a reinforcement learning training loop.
- βWhen you are working on GLM, Qwen3, DeepSeek or Llama 3 model training.
Skill link
https://github.com/davila7/claude-code-templates/blob/main/cli-tool/components/skills/ai-research/post-training-slime/SKILL.mdCopy it and paste it into your AI (Claude, ChatGPT or Cursor), asking it to follow the instructions.
How to use
The easiest way: copy the message and paste it into your AI. It reads the skill and follows the instructions.
Ready-to-paste message
For Claude Code, Codex or Cursor: run it in your project folder and the skill gets installed.
Download the SKILL.md and drop it into your agentβs skills folder.
Example of what to ask your AI
βSet up a reinforcement learning post-training run for a large language model using slime.β
5 new skills a week. 1 minute to read.
How it works
It connects a data buffer, Megatron-LM training and SGLang generation. The data buffer prepares prompts and stores samples, while the other two parts handle training and fast response generation.
Technical content (original SKILL.md)
Original text by the author, straight from GitHub.
slime: LLM Post-Training Framework for RL Scaling
slime is an LLM post-training framework from Tsinghua's THUDM team, powering GLM-4.5, GLM-4.6, and GLM-4.7. It connects Megatron-LM for training with SGLang for high-throughput rollout generation.
When to Use slime
Choose slime when you need:
- Megatron-LM native training with SGLang inference
- Custom data generation workflows with flexible data buffers
- Training GLM, Qwen3, DeepSeek V3, or Llama 3 models
- Research-grade framework with production backing (Z.ai)
Consider alternatives when:
- You need enterprise-grade stability features β use miles
- You want flexible backend swapping β use verl
- You need PyTorch-native abstractions β use torchforge
Key Features
- Training: Megatron-LM with full parallelism support (TP, PP, DP, SP)
- Rollout: SGLang-based high-throughput generation with router
- Data Buffer: Flexible prompt management and sample storage
- Models: GLM-4.x, Qwen3, DeepSeek V3/R1, Llama 3
Architecture Overview
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Data Buffer β
β - Prompt initialization and management β
β - Custom data generation and filtering β
β - Rollout sample storage β
βββββββββββββββ¬ββββββββββββββββββββββββββββ¬ββββββββββββββββ
β β
βββββββββββββββΌββββββββββββ βββββββββββββββΌββββββββββββββββ
β Training (Megatron-LM) β β Rollout (SGLang + Router) β
β - Actor model training β β - Response generation β
β - Critic (optional) β β - Reward/verifier output β
β - Weight sync to rolloutβ β - Multi-turn support β
βββββββββββββββββββββββββββ βββββββββββββββββββββββββββββββ
Installation
# Recommended: Docker
docker pull slimerl/slime:latest
docker run --rm --gpus all --ipc=host --shm-size=16g \
-it slimerl/slime:latest /bin/bash
# Inside container
cd /root/slime && pip install -e . --no-deps
From Source
git clone https://github.com/THUDM/slime.git
cd slime
pip install -r requirements.txt
pip install -e .
Quick Start: GRPO Training
# Source model configuration
source scripts/models/qwen3-4B.sh
# Launch training
python train.py \
--actor-num-nodes 1 \
--actor-num-gpus-per-node 4 \
--rollout-num-gpus 4 \
--advantage-estimator grpo \
--use-kl-loss --kl-loss-coef 0.001 \
--rollout-batch-size 32 \
--n-samples-per-prompt 8 \
--global-batch-size 256 \
--num-rollout 3000 \
--prompt-data /path/to/data.jsonl \
${MODEL_ARGS[@]} ${CKPT_ARGS[@]}
Workflow 1: Standard GRPO Training
Use this workflow for training reasoning models with group-relative advantages.
Prerequisites Checklist
- Docker environment or Megatron-LM + SGLang installed
- Model checkpoint (HuggingFace or Megatron format)
- Training data in JSONL format
Step 1: Prepare Data
# data.jsonl format
{"prompt": "What is 2 + 2?", "label": "4"}
{"prompt": "Solve: 3x = 12", "label": "x = 4"}
Or with chat format:
{
"prompt": [
{"role": "system", "content": "You are a math tutor."},
{"role": "user", "content": "What is 15 + 27?"}
],
"label": "42"
}
Step 2: Configure Model
Choose a pre-configured model script:
# List available models
ls scripts/models/
# glm4-9B.sh, qwen3-4B.sh, qwen3-30B-A3B.sh, deepseek-v3.sh, llama3-8B.sh, ...
# Source your model
source scripts/models/qwen3-4B.sh
Step 3: Launch Training
python train.py \
--actor-num-nodes 1 \
--actor-num-gpus-per-node 8 \
--rollout-num-gpus 8 \
--advantage-estimator grpo \
--use-kl-loss \
--kl-loss-coef 0.001 \
--prompt-data /path/to/train.jsonl \
--input-key prompt \
--label-key label \
--apply-chat-template \
--rollout-batch-size 32 \
--n-samples-per-prompt 8 \
--global-batch-size 256 \
--num-rollout 3000 \
--save-interval 100 \
--eval-interval 50 \
${MODEL_ARGS[@]}
Step 4: Monitor Training
- Check TensorBoard:
tensorboard --logdir outputs/ - Verify reward curves are increasing
- Monitor GPU utilization across nodes
Workflow 2: Asynchronous Training
Use async mode for higher throughput by overlapping rollout and training.
When to Use Async
- Large models with long generation times
- High
FAQ
What is Megatron-LM used for here?
The skill uses it for the training side, with full support for parallel training methods.
When should I choose a different framework?
The skill suggests miles for enterprise stability features, verl for swapping backends, and torchforge for PyTorch-native work.
Which models does it support?
It lists GLM-4.x, Qwen3, DeepSeek V3 and R1, and Llama 3.
Details
Original description by the author
Provides guidance for LLM post-training with RL using slime, a Megatron+SGLang framework. Use when training GLM models, implementing custom data generation workflows, or needing tight Megatron-LM integration for RL scaling.
Popularity
- GitHub stars
- 33k
- Ranking position
- #9121
- License
- MIT
- Updated
- 11/2/2026
Comments
- β¦
More skills from this repository
owasp-security
33kTeaches your agent OWASP security guidance for web apps, APIs, mobile, containers and AI agents, so it can spot common weaknesses and suggest fixes.
agent-management
33kLets your agent create, list, hibernate, wake, rename and delete AI agents using the AI Maestro command line, managing each agent's lifecycle.
agent-messaging
33kLets your agent send, receive and reply to signed messages between AI agents, using the Agent Messaging Protocol, mostly on your own machine.
docs-search
33kLets your agent search auto-generated code documentation for function signatures, class definitions and comments, so it checks the real API before changing code.
Similar skills
pytorch-patterns
280kHelps your agent use PyTorch for machine learning models. It applies best practices for efficient model training and ensures reproducible results.
evm-token-decimals
280kHelps your agent avoid errors with decimal numbers across different blockchain networks. It ensures token values are accurate in transactions and calculations.
ito-inference
280kLets your agent check the availability of AI models for use. It connects the compute request with the ready model service.