sft-and-pretraining
Guides agents creating Axolotl SFT and continual pretraining configs, LoRA or QLoRA recipes, preprocessing workflows, checkpoint resumes, sample packing, and stability triage.
- License 许可
- Apache-2.0
- 最近更新
- 2026-09-03
- Stars
- ★ 351
- Forks
- 27
01 前言 Front Matter
- name
- sft-and-pretraining
- license
- Apache 2.0
- metadata
- { "disco-role": "operating" }
- description
- Guides agents creating Axolotl SFT and continual pretraining configs, LoRA or QLoRA recipes, preprocessing workflows, checkpoint resumes, sample packing, and stability triage.
- disable-model-invocation
- true
02 资源文件 4
- 参考文档references/training-options.md6.0 KB
- 参考文档references/troubleshooting.md7.6 KB
- 参考文档references/workflows.md6.1 KB
- 脚本scripts/make_minimal_sft_config.py8.3 KB
03 SKILL.md 正文
SFT and Pretraining
Use this sub-skill when the task is to fine-tune with Axolotl using supervised fine-tuning, adapt a pretraining recipe, create a LoRA or QLoRA starter config, debug SFT/pretraining loss behavior, reason about checkpoint resume fields, or decide whether to run preprocessing before training.
Axolotl is config-driven: produce or edit a YAML config first, validate it, then use the same config with axolotl preprocess, axolotl train, axolotl inference, and axolotl merge-lora as appropriate.
Read First
- references/workflows.md for SFT, completion-style pretraining, streaming pretraining, validation order, and checkpoint/resume workflow.
- references/training-options.md for LoRA/QLoRA/full fine-tune choices, core config fields, packing, batch sizing, output fields, and preprocessing reuse.
- references/troubleshooting.md for NaN/loss spikes, OOM, tokenizer mismatch, packing length issues, dataset-prepared reuse, checkpoint confusion, and network/model path problems.
- scripts/make_minimal_sft_config.py for a safe local helper that emits a starter SFT YAML without downloading models, loading datasets, or starting training.
Route Boundaries
- Use this sub-skill for default SFT, chat-template/input-output/completion training flow, continual pretraining, minimal config construction,
axolotl preprocessbefore expensive runs,output_dir, checkpoints, resume,dataset_prepared_path, and SFT/pretraining stability triage. - Route dataset schema details, custom field mappings, and prompt-format mechanics to
data-and-configs. - Route DPO, IPO, KTO, ORPO, SimPO, reward modeling, GRPO, and EBFT to
preference-tuningorrl-and-rewards. - Route model architecture quirks, tokenizer/model loading internals, LoRA target-module internals, and adapter compatibility to
model-loading-and-adapters. - Route DeepSpeed/FSDP launch topology, throughput tuning, vLLM serving, and distributed performance to
distributed-and-performance. - Route complete CLI catalog, installation, fetching examples, inference UI, and operational command details to
cli-and-operations.
Quick Workflow
- Pick the workflow: SFT via
datasets, non-streaming pretraining viadatasets: [{type: completion}], or streaming pretraining viapretraining_dataset. - Choose the training mode: LoRA for a common adapter baseline, QLoRA for 4-bit memory pressure, or full fine-tune when all weights should update and hardware allows it.
- Create a config with
base_model, dataset source/type,output_dir, sequence/batch settings, optimizer/LR, precision, checkpoint fields, and adapter fields when needed. - Run
axolotl preprocess <config.yaml>for non-streaming data when you want to validate tokenization, label masking, or reusabledataset_prepared_pathbefore training. - Run
axolotl preprocess <config.yaml> --debugwhen label masking, chat template behavior, or empty/overlong examples are suspected. - Only after validation, run
axolotl train <config.yaml>in the user’s prepared Axolotl environment.
For a starter YAML, use:
python sub-skills/sft-and-pretraining/scripts/make_minimal_sft_config.py \
--base-model NousResearch/Llama-3.2-1B \
--dataset-path ./chat.jsonl \
--dataset-type chat_template \
--adapter qlora \
--output-dir ./outputs/chat-qlora
The helper only writes YAML to standard output or to a requested file; it does not inspect models, access the network, load datasets, or train.
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).