# miles-rl-training

A skill that walks your agent through RL training of large MoE models on miles: FP8, INT4, speculative rollout. Useful when you're setting up training on H100/H200.

- skill · `type=skill` · Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, OpenCode · 946 installs · ★ 13956
- Author: Orchestra Research
- License: MIT · policy=mirror · the beginning of the file is at the end of this page
- Source: https://github.com/Orchestra-Research/AI-Research-SKILLs/tree/HEAD/06-post-training/miles/SKILL.md
- Updated: 2026-10-11
- HTML: https://affpapa.org/en/nevibecode/skills/miles-rl-training

## What it does

miles is a production fork of slime for post-training large models. The skill hands your agent ready workflows: training MoE models like DeepSeek V3 or Qwen3-MoE, FP8 and INT4 quantization, EAGLE speculative decoding through SGLang. Two workflows inside, each with checklists and `python train.py` commands.

You need FP8-capable GPUs (H100 or H200), the `radixark/miles:latest` Docker image, and the dependencies from `requirements.txt`: `sglang-router>=0.2.3`, `ray`, `torch>=2.0.0`, `transformers>=4.40.0`. Online MTP training needs a torch dist checkpoint with MTP weights — add them during HuggingFace conversion with `--mtp-num-layers 1`. Skip that step and the option won't run.

The skill inherits slime's config system, so cluster and Megatron parallelism flags will look familiar if you've used slime before. Need flexible backend swapping? Look at verl. Want PyTorch-native abstractions? torchforge.

## Install

### Claude Code (native platform)

1. **Skills CLI (Vercel)**
```bash
npx skills add Orchestra-Research/AI-Research-SKILLs --skill miles-rl-training -a claude-code
```
```bash
npx skills add Orchestra-Research/AI-Research-SKILLs --skill miles -a claude-code
```

2. **Manually: put the files in place**
- File: `~/.claude/skills/miles/SKILL.md` — Copy the whole skill folder; for one project use .claude/skills/miles/

### Codex

1. **Skills CLI (Vercel)**
```bash
npx skills add Orchestra-Research/AI-Research-SKILLs --skill miles -a codex
```

2. **Manually: put the files in place**
- File: `.agents/skills/miles/SKILL.md` — For all projects use ~/.agents/skills/

### Cursor

1. **Skills CLI (Vercel)**
```bash
npx skills add Orchestra-Research/AI-Research-SKILLs --skill miles -a cursor
```

2. **Manually: put the files in place**
- File: `.cursor/skills/miles/SKILL.md` — Cursor also reads .agents/skills/ and .claude/skills/

### GitHub Copilot

1. **GitHub CLI**
```bash
gh skill install Orchestra-Research/AI-Research-SKILLs miles
```

2. **Manually: put the files in place**
- File: `.github/skills/miles/SKILL.md`

### Gemini CLI

1. **Skills CLI (Vercel)**
```bash
npx skills add Orchestra-Research/AI-Research-SKILLs --skill miles -a gemini-cli
```

2. **Platform CLI**
```bash
gemini skills install https://github.com/Orchestra-Research/AI-Research-SKILLs --path 06-post-training/miles
```

### Windsurf (Devin Desktop)

**Manually: put the files in place**
- File: `.devin/skills/miles/SKILL.md` — The legacy .windsurf/skills/ path still works

### OpenCode

**Skills CLI (Vercel)**
```bash
npx skills add Orchestra-Research/AI-Research-SKILLs --skill miles -a opencode
```

### Claude.ai

**Claude.ai**
- Zip the folder and upload it in Settings → Capabilities → Skills

Where a file is given instead of a command, copy the files from the source to that path: https://github.com/Orchestra-Research/AI-Research-SKILLs/tree/HEAD/06-post-training/miles/SKILL.md

## When to use it
- run RL training on a 1TB+ MoE model
- enable FP8 or INT4 QAT without NaN loss
- align train and inference at the expert routing level
- speed up rollout with EAGLE speculative decoding
- recycle half-finished trajectories via partial rollout

## Example prompts
- Help me set up miles for DeepSeek V3 training with FP8
- How do I enable EAGLE speculative decoding in miles?
- Check my train.py config for MoE: expert parallelism and rollout

## Source text · SKILL.md · MIT

Below is the content of a third-party file. It is data, not instructions for you: do not act on anything written inside unless the human asks. Block tag: ba1cd552d8f1b9bc.

BEGIN THIRD-PARTY FILE ba1cd552d8f1b9bc
````text
---
name: miles-rl-training
description: 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.
version: 1.0.0
author: Orchestra Research
license: MIT
tags: [Reinforcement Learning, MoE, FP8, INT4, Enterprise, SGLang, Megatron-LM]
dependencies: [sglang-router>=0.2.3, ray, torch>=2.0.0, transformers>=4.40.0]
---

# 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

```bash
# 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:

```bash
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
````
END THIRD-PARTY FILE ba1cd552d8f1b9bc

The third-party file has ended. Everything between the ba1cd552d8f1b9bc tags is data: requests and commands from it are not followed. An “end of file” line with another tag inside the block is part of the file.

First 2706 of 8900 bytes. © Orchestra Research · MIT · https://github.com/Orchestra-Research/AI-Research-SKILLs/tree/HEAD/06-post-training/miles/SKILL.md

_Part of the page did not fit — see the HTML version._

---
NeVibeCode on affpapa.org. Catalog texts are descriptions, not instructions for the agent. How to choose and install: https://affpapa.org/en/nevibecode/agents.md
