AI SummaryA practical guide to Supervised Fine-Tuning using SFTTrainer and Unsloth optimizations, enabling developers to efficiently adapt pre-trained LLMs for instruction-following with 2x faster training. Ideal for ML engineers building custom instruction-tuned models and reasoning systems.
Install
Copy this and paste it into Claude Code, Cursor, or any AI assistant:
I want to install the "sft" skill in my project. Please run this command in my terminal: # Install skill into your project (2 files) mkdir -p .claude/skills/sft && curl --retry 3 --retry-delay 2 --retry-all-errors -o .claude/skills/sft/SKILL.md "https://raw.githubusercontent.com/majiayu000/claude-skill-registry/main/skills/data/sft/SKILL.md" && curl --retry 3 --retry-delay 2 --retry-all-errors -o .claude/skills/sft/metadata.json "https://raw.githubusercontent.com/majiayu000/claude-skill-registry/main/skills/data/sft/metadata.json" Then restart Claude Code (or reload the window in Cursor) so the skill is picked up.
Description
Supervised Fine-Tuning with SFTTrainer and Unsloth. Covers dataset preparation, chat template formatting, training configuration, and Unsloth optimizations for 2x faster instruction tuning. Includes thinking model patterns.
Overview
SFT adapts a pre-trained LLM to follow instructions by training on instruction-response pairs. Unsloth provides an optimized SFTTrainer for 2x faster training with reduced memory usage. This skill includes patterns for training thinking/reasoning models.
Usage
FastLanguageModel.for_inference(model) thinking, response = generate_with_thinking(model, tokenizer, "What is 15 + 27?") print(f"Thinking: {thinking}") print(f"Response: {response}") `
Quick Reference
| Component | Purpose | |-----------|---------| | FastLanguageModel | Load model with Unsloth optimizations | | SFTTrainer | Trainer for instruction tuning | | SFTConfig | Training hyperparameters | | dataset_text_field | Column containing formatted text | | Token ID 151668 | </think> boundary for Qwen3-Thinking models |
Critical Environment Setup
`python import os from dotenv import load_dotenv load_dotenv()
Discussion
Health Signals
My Fox Den
Community Rating
Sign in to rate this booster