model-backends
Select and troubleshoot XTuner V1 model configs, MoE/VLM backends, FSDP/TP/EP/HSDP sizing, FP8, attention, routers, dispatchers, and optional accelerators.
- License 许可
- Apache-2.0
- 最近更新
- 2026-09-03
- Stars
- ★ 351
- Forks
- 27
01 前言 Front Matter
- name
- model-backends
- license
- Apache 2.0
- metadata
- { "disco-role": "operating" }
- description
- Select and troubleshoot XTuner V1 model configs, MoE/VLM backends, FSDP/TP/EP/HSDP sizing, FP8, attention, routers, dispatchers, and optional accelerators.
- disable-model-invocation
- true
02 资源文件 4
- 参考文档references/api-reference.md12.0 KB
- 参考文档references/model-and-backend-reference.md13.7 KB
- 参考文档references/troubleshooting.md11.3 KB
- 脚本scripts/check_xtuner_backend.py17.2 KB
03 SKILL.md 正文
XTuner model-backends
Use this sub-skill when the task is about XTuner V1 model configuration or backend capability: selecting dense, MoE, or multimodal model config classes; aligning FSDPConfig with model parallel settings; choosing attention/router/dispatcher options; enabling FP8; or diagnosing optional acceleration gaps.
Scope and routing
Use this skill for:
xtuner.v1.modelconfig classes andget_model_config/get_model_config_from_hfhelpers.- Qwen3 dense and MoE, Qwen3.5-VL, InternVL, InternS1, GPT-OSS, DeepSeek/GLM-style MoE families.
- FSDP, tensor parallel (
tp_size), expert parallel (ep_size), HSDP, MoE dispatchers, grouped GEMM, attention backend choices, FP8, optimizer/loss config interactions that affect backend sizing. - Backend diagnostics that are safe without launching training.
Route elsewhere:
- Training launch commands, checkpoint/resume workflows, logs, and trainer construction details -> training.
- Dataset schemas, tokenization, packing, JSONL/media validation -> data-preparation.
- RL advantage, rollout engines, Ray cluster topology, RL losses beyond backend import checks -> reinforcement-learning.
- Legacy
xtunerCLI/config-zoo tasks -> cli-and-tools.
Operating workflow
-
Classify the model family. Decide whether the requested work is text dense, text MoE, or compose/VLM. Use
get_model_config(alias)only for aliases known to XTuner; instantiate concrete classes directly for unaliased variants. -
Resolve required backend features. Mark each requested feature as config-only, CPU/import-checkable, CUDA/NPU-required, or optional-accelerator-required. Do not treat an import check as proof of acceleration.
-
Choose parallelism conservatively. Start with FSDP. Use TP only when memory requires it. For MoE, keep
model_cfg.ep_sizealigned withFSDPConfig(ep_size=...); choose a dispatcher only whenep_size > 1. HSDP requiresep_size == 1. -
Probe safely before claiming support. Run the bundled backend checker from this sub-skill tree:
python scripts/check_xtuner_backend.py python scripts/check_xtuner_backend.py --json --expect-cuda python scripts/check_xtuner_backend.py --check-optional --jsonThe checker reports Torch/CUDA visibility, optional imports, FP8 hardware indicators, and selected XTuner imports. It does not run kernels, build models, or verify training throughput.
-
Use the references for decisions and troubleshooting. Keep long API tables, backend constraints, and failure modes in:
Quick decision guide
- Qwen3 dense / dense VLM: simpler backend surface; no expert routing or MoE dispatcher. Use
Qwen3Dense8BConfig,Qwen3Dense4BConfig,Qwen3Dense0P6BConfig,Qwen3VLDense4BConfig,Qwen3VLDense8BConfig,InternS1MiniConfig, or InternVL dense configs as appropriate.ep_sizeshould stay1. - Qwen3 MoE / MoE VLM: adds routed experts, balancing/z/aux losses, grouped GEMM, and possible expert-parallel all-to-all. Use
Qwen3MoE30BA3Config,Qwen3MoE235BA22Config, Qwen3-VL MoE, Qwen3.5-VL MoE, InternS1, GPT-OSS, DeepSeek, or GLM MoE configs. Alignep_sizein both model and FSDP config. - TP vs EP: TP can reduce memory pressure but reduces per-rank matrix sizes and can hurt efficiency. EP partitions MoE experts but does not remove attention/activation memory and introduces all-to-all communication. Prefer the smallest TP/EP values that satisfy memory and topology constraints.
- FP8: requires a real compatible CUDA backend, Hopper-class or newer device capability for effective FP8, and optional libraries such as AdaptiveGEMM for tile-wise FP8 linear/grouped-linear modules. FP8 import or config construction alone is not acceleration proof.
- Attention:
flash_attentionmay fall back toflex_attentionwhenflash-attnis missing. Useeager_attentiononly for debugging/HF parity or when fused attention is unavailable.
Non-negotiable verification rules
- Never claim FlashAttention, bitsandbytes GPU kernels, DeepEP, grouped GEMM, AdaptiveGEMM, FP8, NPU, or Ray-backed capability unless the relevant optional dependency and hardware path were actually checked.
- A CPU-only check is useful for config/import sanity but is not a CUDA/NPU or performance verification.
- If a backend is optional and missing, provide a safe fallback plan and state the unverified gap explicitly.
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).