Bring your agent. Define your reward. Train with ms-swift.
中文 · Quickstart · Adapters · Rewards · Deployment · Why this project?
Lightning Launch connects existing agents to Agent Lightning + ms-swift/Megatron with a compact, inspectable workflow: task → agent/tool rollout → external reward → policy update → updated-policy rollout. Keep your agent's tool loop and choose a local process, container, or remote worker.
On Linux with two NVIDIA GPUs (tested: 2 × RTX 3060 12 GB), CUDA 12.8 toolkit and compatible drivers, Python 3 and uv, run from the checkout:
bash scripts/run_learning_demo.sh .runs/hermes-mbpp自动安装独立 GPU runtime 和固定版本 Hermes,下载模型和 MBPP,校验数据,完成
24 步原生 ms-swift GRPO、训练前后配对评估,并生成
.runs/hermes-mbpp/experiment/REPORT.md 和 JSON 明细。无需自行准备数据或修改 YAML。
安装和模型下载需要网络;运行目录包含模型缓存、工作区及 checkpoint,请预留磁盘空间。
已有兼容环境可通过 AGL_TRAIN_PYTHON、AGL_HERMES_ROOT、AGL_MODEL 复用。
每次运行使用新目录;完整设置见 demo guide。
Measured Hermes + Qwen3.5-0.8B results (24 GRPO steps):
| Split | Tasks × samples | Assertion pass fraction: base → trained | Fully solved: base → trained |
|---|---|---|---|
| Train | 8 × 2 | 22.92% → 37.50% | 3/16 → 6/16 |
| Validation | 4 × 2 | 25.00% → 37.50% | 2/8 → 3/8 |
| Test subset | 8 × 2 | 12.50% → 12.50% | 2/16 → 2/16 |
80 次评估均完成,176 个保存的工作区重算 reward 无差异。训练集和验证集有提升, 测试子集持平。样本较少,断言对 agent 可见,结果用于展示可工作的学习流程, 不代表隐藏测试基准或广泛泛化;重复采样也不是新增独立题目。 完整实测记录 · 机器可读证据
git clone https://github.com/0KEAHA/lightning-launch.git
cd lightning-launch
python3.11 -m venv .venv && . .venv/bin/activate
pip install -e .
lightning-launch init my-agent-rl
lightning-launch demo --output .runs/demoThe demo runs a small CPU policy-gradient example to exercise rewards and audits. Real LLM training requires a compatible GPU runtime and model, downloaded separately. Follow the complete walkthrough, then:
lightning-launch doctor --config configs/quickstart.yaml
lightning-launch run --config configs/quickstart.yaml
lightning-launch rewards .runs/runs/YOUR_RUNlightning-launch recipe gsm8k ./gsm8k-opencode --agent opencode
lightning-launch recipe mbpp ./mbpp-hermes --agent hermesDownloads, checksums, splits, evaluators and reference self-checks are automatic.
Use --hardware two-gpu-shared for the tested small-GPU topology. Install the
chosen product and GPU runtime, then evaluate or train with the generated config.
See product setup, dataset service and
real-data evidence. For measured learning effects,
see the regression diagnosis and fixed-budget comparison.
- Keep ms-swift. Native GRPO, Megatron parallelism, LoRA, policy synchronization and checkpoints through explicit Swift plugins.
- Bring an existing agent. Hermes, Codex, Claude Code and OpenCode adapters; LangGraph/LangChain, OpenAI Agents, AutoGen, smolagents, CrewAI and DeepSeek Harness SDK entries; custom commands and remote workers.
- Own your reward. Nine built-in scorers, correctness-gated cost bonuses, versioned composition, Python/command/HTTP extensions, component audits and paired policy comparisons.
- See what actually trained. Original token IDs/logprobs, tool feedback masks, complete-group validation, Store readback and acceptance reports.
- Keep the checkout small. Source, examples, documentation and tests. No Swift images, model weights, GPU runtime bundles or private deployment configuration.
“Adapter included” is not a claim that every release, provider feature or deployment has been tested. Validation separates real GPU training, installed SDK/tool probes and unverified combinations.
| You have… | Start here |
|---|---|
| No prepared dataset | Public data recipes |
| A compatible Swift environment | GPU quickstart |
| An existing agent framework | Adapter contract and examples |
| A custom scorer, test runner or reward service | Reward interface |
| Containers, remote services or Kubernetes jobs | Deployment contract |
| Questions about upstream differences | Contribution and attribution |
Agent Lightning already provides real-harness training and proxy-based integration. Our contribution is the ms-swift/Megatron backend integration and ready-to-run operating layer: adapters, trajectory replay, reward management, portable tasks, isolated deployment and testable evidence. We do not claim a new RL algorithm, benchmark superiority or official Microsoft/DeepSeek affiliation. See the source-backed comparison.
Start with CONTRIBUTING.md. Add a real tool-roundtrip test for a new adapter, preserve exact trajectory and reward semantics, and document tested versions. MIT license; upstream notices are retained in NOTICE.