miles-rl-training
Skill này làm gì
Skill này giải thích miles, phiên bản production của framework RL slime. Skill dành cho các đội huấn luyện mô hình rất lớn cần sự ổn định và tốc độ.
Khi nào nên dùng
- ✓Khi bạn huấn luyện một mô hình mixture-of-experts rất lớn như DeepSeek V3.
- ✓Khi bạn cần huấn luyện độ chính xác thấp kiểu FP8 hoặc INT4.
- ✓Khi bạn muốn kết quả huấn luyện và suy luận khớp nhau chặt chẽ và chạy nhanh hơn.
Liên kết skill
https://github.com/Orchestra-Research/AI-Research-SKILLs/blob/main/06-post-training/miles/SKILL.mdSao chép rồi dán vào AI của bạn (Claude, ChatGPT hoặc Cursor) và nhờ nó làm theo hướng dẫn.
Cách dùng
Cách dễ nhất: sao chép tin nhắn và dán vào AI của bạn. AI sẽ đọc skill và làm theo hướng dẫn.
Tin nhắn có sẵn để dán
Dành cho Claude Code, Codex hoặc Cursor: chạy lệnh trong thư mục dự án của bạn và skill sẽ được cài đặt.
Tải tệp SKILL.md về và thả vào thư mục skill của agent.
Ví dụ cách nhờ AI
“Thiết lập một lượt học tăng cường cho mô hình mixture-of-experts rất lớn với huấn luyện FP8.”
5 skill mới mỗi tuần. Đọc chỉ 1 phút.
Cách hoạt động
miles kết hợp một engine suy luận nhanh với một engine huấn luyện và giữ chúng đồng bộ. Nó dùng các định dạng độ chính xác thấp và các phương pháp tăng tốc như speculative RL để rút ngắn thời gian huấn luyện.
Nội dung kỹ thuật (SKILL.md gốc)
Lấy nguyên văn từ GitHub, do tác giả viết bằng tiếng Anh.
miles: Enterprise-Grade RL for Large-Scale Model Training
miles is a high-performance, enterprise-ready RL framework optimized for large-scale model post-training. Built as a production fork of slime, it addresses critical challenges in MoE training stability, low-precision training, and train-inference alignment.
When to Use miles
Choose miles when you need:
- Training 1TB+ MoE models (DeepSeek V3, Qwen3-MoE)
- FP8 or INT4 quantization-aware training
- Bit-wise identical train-inference alignment
- Speculative RL for maximum throughput
- Production stability with enterprise support
Consider alternatives when:
- You want the research-grade original → use slime
- You need flexible backend swapping → use verl
- You want PyTorch-native abstractions → use torchforge
Key Features
Low-Precision Training
- Unified FP8: End-to-end FP8 for both inference and training
- INT4 QAT: 1TB models on single-machine VRAM (H200)
- Rollout Routing Replay (R3): Bit-wise expert alignment for MoE
Performance Optimizations
- Speculative RL: 25%+ rollout speedup with online SFT draft models
- Zero-Copy Weight Sync: CUDA IPC zero-copy mapping
- Partial Rollout: Recycle half-finished trajectories
Train-Inference Alignment
- TIS/MIS: Truncated/Masked Importance Sampling for off-policy correction
- Kernel-level optimization: FlashAttention-3, DeepGEMM integration
Installation
# Recommended: Docker
docker pull radixark/miles:latest
docker run --rm --gpus all --ipc=host --shm-size=16g \
-it radixark/miles:latest /bin/bash
# From source
git clone https://github.com/radixark/miles.git
cd miles
pip install -r requirements.txt
pip install -e .
Quick Start
miles inherits slime's configuration system. Basic training:
python train.py \
--advantage-estimator grpo \
--model-name qwen3-30b-a3b \
--hf-checkpoint /path/to/qwen3-30b-a3b-hf \
--rollout-batch-size 512 \
--n-samples-per-prompt 8
Workflow 1: Large MoE Training
Use this workflow for training large MoE models like DeepSeek V3 or Qwen3-MoE.
Prerequisites Checklist
- H100/H200 GPUs with FP8 support
- MoE model (DeepSeek V3, Qwen3-MoE)
- Docker environment with miles
Step 1: Environment Setup
# FP8 block scaling (recommended for stability)
export NVTE_FP8_BLOCK_SCALING_FP32_SCALES=1
export CUDA_DEVICE_MAX_CONNECTIONS=1
Step 2: Configure Training
python train.py \
--actor-num-gpus-per-node 8 \
--rollout-num-gpus 8 \
--hf-checkpoint /path/to/deepseek-v3 \
--advantage-estimator grpo \
--tensor-model-parallel-size 8 \
--expert-model-parallel-size 4 \
--prompt-data /path/to/data.jsonl \
--num-rollout 3000
Verification Checklist
- Model loads without errors
- Routing decisions are consistent
- No NaN/Inf in loss values
Workflow 2: Speculative RL Training
Use this workflow for maximum rollout throughput with EAGLE speculative decoding.
How Speculative RL Works
- Small draft model generates candidate tokens
- Target model verifies in parallel
- Draft model updated via online SFT to track policy
Step 1: Enable Speculative Decoding
miles supports EAGLE speculative decoding via SGLang:
python train.py \
--actor-num-gpus-per-node 8 \
--hf-checkpoint /path/to/target-model \
--sglang-speculative-algorithm EAGLE \
--sglang-speculative-num-steps 3 \
--sglang-speculative-eagle-topk 1 \
--sglang-speculative-num-draft-tokens 4 \
--sglang-speculative-draft-model-path /path/to/draft-model \
--advantage-estimator grpo \
--prompt-data /path/to/data.jsonl
Step 2: Enable Online MTP Training (Optional)
For online SFT of draft model during training:
--mtp-num-layers 1 \
--enable-mtp-training \
--mtp-loss-scaling-factor 0.2
Note: Online MTP training requires a torch dist checkpoint with MTP weights. Add --mtp-num-layers 1 during checkpoint conversion from HuggingFace.
Expected Speedup
- Standard rollout: Baseline
- Speculative RL: 25-40% faster rollout
- With partial rollout: Additional 10-15% throughput
Configuration Reference
miles inherits all slime arguments. See slime API Reference for the complete list.
Cluster Resources (from slime)
--actor-num-nodes 1
--actor-num-gpus-per-node 8
--rollout-num-gpus
Câu hỏi thường gặp
Nó được xây dựng cho những mô hình nào?
Skill nhắc đến các mô hình trên 1 terabyte như DeepSeek V3 và Qwen3-MoE.
Nó khác slime thế nào?
Skill mô tả miles là một nhánh sẵn sàng cho production của slime, với các tính năng ổn định và độ chính xác thấp.
Nếu tôi cần backend linh hoạt thì sao?
Skill gợi ý verl để đổi backend huấn luyện và suy luận.
Chi tiết
Mô tả gốc của tác giả
Provides guidance for enterprise-grade RL training using miles, a production-ready fork of slime. Use when training large MoE models with FP8/INT4, needing train-inference alignment, or requiring speculative RL for maximum throughput.
Độ phổ biến
- Sao GitHub
- 14k
- Vị trí xếp hạng
- #11191
- Giấy phép
- MIT
- Cập nhật
- 10/10/2026
Bình luận
- …
Thêm skill từ kho mã này
autoresearch
14kHướng dẫn agent của bạn qua một dự án nghiên cứu AI đầy đủ, từ tổng quan tài liệu đến thí nghiệm và viết báo, với một vòng lặp kiểm thử và rà soát lặp lại.
prompt-guard
14kCho phép agent của bạn quét văn bản để phát hiện prompt injection và các nỗ lực jailbreak trước khi nó đến ứng dụng AI, dùng bộ phân loại nhỏ của Meta.
pytorch-fsdp2
14kChỉ cho agent của bạn cách thêm PyTorch FSDP2 vào script huấn luyện để các mô hình lớn được chia ra nhiều GPU và lưu đúng cách.
ml-training-recipes
14kCung cấp cho agent của bạn các công thức huấn luyện mạng nơ-ron đã được kiểm chứng, gồm chọn mô hình, bộ tối ưu, learning rate và xử lý loss tăng vọt.
Skill tương tự
pytorch-patterns
280kGiúp agent của bạn dùng PyTorch cho các mô hình học máy. Áp dụng thực hành tốt nhất để huấn luyện mô hình hiệu quả và đảm bảo kết quả có thể lặp lại.
evm-token-decimals
280kGiúp agent tránh lỗi về số thập phân khi làm việc với các mạng blockchain khác nhau. Đảm bảo giá trị token chính xác trong giao dịch và phép tính.
ito-inference
280kGiúp agent kiểm tra xem các mô hình AI đã sẵn sàng để dùng chưa. Kết nối yêu cầu tài nguyên tính toán với dịch vụ mô hình đã sẵn sàng.