xtuner
Use XTuner for large-model SFT, pretraining, MLLM fine-tuning, data preparation, model/backend configuration, RL/GRPO post-training, and legacy XTuner tooling.
- License 许可
- Apache-2.0
- 最近更新
- 2026-09-03
- Stars
- ★ 351
- Forks
- 27
01 前言 Front Matter
- name
- xtuner
- license
- Apache 2.0
- metadata
- { "disco-role": "operating" }
- description
- Use XTuner for large-model SFT, pretraining, MLLM fine-tuning, data preparation, model/backend configuration, RL/GRPO post-training, and legacy XTuner tooling.
- disable-model-invocation
- true
02 资源文件 6
- 参考文档references/native-verification.md3.4 KB
- 参考文档references/package-and-environment.md3.6 KB
- 参考文档references/repo-provenance.md1.9 KB
- 参考文档references/repo-routing-metadata.json565 B
- 参考文档references/troubleshooting.md4.4 KB
- 脚本scripts/check_xtuner_install.py5.8 KB
03 SKILL.md 正文
XTuner repo skill
Use this root skill when a task names XTuner or asks for operating guidance around XTuner V1 large-model training, data preparation, MoE/model backend choices, GRPO/RL post-training, or legacy XTuner utilities.
XTuner V1 is a PyTorch-based training engine aimed at large dense, MoE, and multimodal models. Most real training/RL work needs accelerator resources, model/data assets, and optional backend packages. This generated skill gives safe command builders, validators, and routing guidance; it does not require the original source checkout.
Start here
- Check the package and backend surface. Read references/package-and-environment.md, then run scripts/check_xtuner_install.py in the user's XTuner environment.
- Route to the right workflow. Use the sub-skill map below. Do not mix V1 direct CLIs with the old legacy
xtuner MODE ...router. - Validate data before training. Use
data-preparationfor SFT, MLLM, and RL JSONL schemas before building training or RL launch commands. - Treat accelerator checks as real gates. CPU imports and synthetic cases do not prove CUDA/NPU/FP8/Ray rollout execution. Use references/native-verification.md before claiming backend success.
- Use troubleshooting early. Cross-cutting install/import/backend failures are in references/troubleshooting.md; workflow-specific failures live in each sub-skill.
Sub-skill routes
| Task signal | Read |
|---|---|
V1 SFT, pretraining, MLLM fine-tuning, TrainingArguments, TrainerConfig, torchrun, FSDP/checkpoint/resume, training logs |
sub-skills/training/SKILL.md |
| SFT/MLLM/RL JSONL validation, media paths, chat templates, tokenizer configs, dataset caching, packing, GSM8K conversion | sub-skills/data-preparation/SKILL.md |
Dense/MoE/VLM model configs, get_model_config, FSDP/TP/EP/HSDP, attention/router/dispatcher, FP8, CUDA/NPU optional backends |
sub-skills/model-backends/SKILL.md |
| RL/GRPO launch planning, Ray resources, rollout engines, agent loops, judgers, reward data, replay buffers, evaluation, traces | sub-skills/reinforcement-learning/SKILL.md |
Legacy xtuner MODE ..., old config-zoo search/copy, model conversion planning, chat/eval/preprocess tools, HF Trainer examples |
sub-skills/cli-and-tools/SKILL.md |
Package facts to remember
- Public package/distribution name:
xtuner. - Source snapshot used for this skill: see references/repo-provenance.md.
- Python requirement from package metadata:
>=3.10. - Verified package version in the construction environment:
0.2.0. - V1 installed-package entry points used by generated helpers:
- SFT/training:
python -m xtuner.v1.train.cli.sft ... - RL:
python -m xtuner.v1.train.cli.rl ...
- SFT/training:
- Optional RL support uses Ray plus a rollout backend such as LMDeploy, SGLang, or vLLM.
- Optional acceleration surfaces include FlashAttention, bitsandbytes quantization, GroupedGEMM, AdaptiveGEMM, FP8 kernels, DeepEP, and NPU/vendor stacks. Verify these in the target environment before relying on them.
Minimal install and smoke check
Use the package/environment reference for details. A typical installed-package check is:
python -m pip install xtuner
python scripts/check_xtuner_install.py --json
python -m xtuner.v1.train.cli.sft --help
For RL planning, install Ray and a chosen rollout backend in the target environment, then check:
python -m xtuner.v1.train.cli.rl --help
If python -m xtuner.v1.train.cli.sft --help prints warnings about missing FlashAttention or bitsandbytes CUDA binaries but still exits successfully, treat those as optional acceleration limitations unless the user explicitly needs that feature.
Guardrails
- Do not launch training, Ray clusters, model downloads, benchmark evaluation, or model conversion unless the user supplies assets/resources and approves side effects.
- Do not claim GPU/NPU/FP8/backend verification from CPU imports alone.
- Do not ask future agents to open or run original repository docs, examples, tests, configs, or scripts. Use the generated references and bundled helper scripts here.
- For source checkout freshness, compare the current checkout to references/repo-provenance.md; run
refresh-repo-skillwhen it diverges.
04 同仓库更多 Skills
passnet-triton-opt
Make a single PassNet Triton kernel fast AND numerically faithful: performance model (when a replacement can win at all), block/grid/warp tuning, autotune policy, launch overhead, and per-op numeric recipes to pass the dtype baseline tolerances. Use when a pass matches and is correct but speedup below expected, or when correctness fails by small numeric margins.
passnet-solve
END-TO-END playbook for solving one PassNet sample: analyze the computation graphs, decide the optimization strategy (what to fuse, what to replace, what to leave alone), drive the iteration loop, and maximize the sample score. This is the ENTRY skill — invoke it first for any PassNet optimization task; it tells you when to use passnet-pattern-fusion, passnet-triton-opt and passnet-feedback.
passnet-skill
PassNet GPU kernel optimization via compiler passes. Design and implement Triton-based optimization passes, create pass files under ./pass_dir/, self-evaluate with pass_evaluator, and iterate to maximize GPU speedup.
passnet-pattern-fusion
Author PassNet pass files: write patterns that actually MATCH the FX graph, pick fusion regions (which ops to absorb into one Triton kernel), and structure multi-pass submissions with the mandatory shared-dispatch architecture. Use when creating or fixing pattern()/replacement_args()/replacement_func() files, when a pass "failed to match", or when deciding how to fuse multiple kernels/ops.
passnet-orchestrate
Round/batch planning and decision support for PassNet graph optimization. Use for multi-sample triage, worker allocation, eval-budget policy, and post-eval keep/revert decisions. For solving one concrete sample end to end, use passnet-solve as the entry skill; consult this skill only when you need broader planning or a specific decision gate.
passnet-feedback
Fast, deterministic feedback for PassNet work: pre-flight pattern/match verification WITHOUT burning a GPU evaluation, per-node bottleneck analysis of a sample's graphs, and eval-log parsing into per-variant status + estimated score + failure classification. Use BEFORE every GPU evaluation (check_pattern), at the START of a sample (analyze_graph), and AFTER every evaluation (parse_eval_log).