$npx -y skills add microsoft/azure-skills --skill finetuningFine-tune models on Azure AI Foundry using SFT (supervised), DPO (preference), or RFT (reinforcement with graders). Covers dataset preparation, training job submission, deployment, and evaluation. USE FOR: fine-tune, SFT, DPO, RFT, training data, grader, distillation, fine-tuned
| 1 | # Fine-Tuning on Azure AI Foundry |
| 2 | |
| 3 | Fine-tune models using SFT (supervised), DPO (preference), or RFT (reinforcement with graders). Covers dataset prep, training, deployment, and evaluation. |
| 4 | |
| 5 | ## When to Use |
| 6 | |
| 7 | Use this sub-skill when the user asks about: |
| 8 | - Fine-tuning a model (SFT, DPO, or RFT) |
| 9 | - Preparing, validating, or formatting training data |
| 10 | - Submitting, monitoring, or diagnosing training jobs |
| 11 | - Calibrating graders or pass thresholds for RFT |
| 12 | - Deploying or evaluating a fine-tuned model |
| 13 | - Choosing between training types (SFT vs DPO vs RFT) |
| 14 | - Distillation, synthetic data generation, or dataset quality scoring |
| 15 | - Large file uploads for training data |
| 16 | - Cleaning up fine-tuning resources (files, deployments) |
| 17 | |
| 18 | **Do NOT use for:** General model deployment without fine-tuning (use deploy-model), agent creation (use agents), prompt optimization without training (use prompt-optimizer). |
| 19 | |
| 20 | ## Workflows |
| 21 | |
| 22 | | Stage | Guide | |
| 23 | |-------|-------| |
| 24 | | **Quick start** | [workflows/quickstart.md](workflows/quickstart.md) | |
| 25 | | **Full pipeline** | [workflows/full-pipeline.md](workflows/full-pipeline.md) | |
| 26 | | **Create data** | [workflows/dataset-creation.md](workflows/dataset-creation.md) | |
| 27 | | **Iterate** | [workflows/iterative-training.md](workflows/iterative-training.md) | |
| 28 | | **Diagnose** | [workflows/diagnose-poor-results.md](workflows/diagnose-poor-results.md) | |
| 29 | |
| 30 | ## References |
| 31 | |
| 32 | | Topic | File | |
| 33 | |-------|------| |
| 34 | | SFT vs DPO vs RFT | [references/training-types.md](references/training-types.md) | |
| 35 | | Hyperparameters | [references/hyperparameters.md](references/hyperparameters.md) | |
| 36 | | Data formats | [references/dataset-formats.md](references/dataset-formats.md) | |
| 37 | | Grader design (RFT) | [references/grader-design.md](references/grader-design.md) | |
| 38 | | Reward hacking | [references/reward-hacking.md](references/reward-hacking.md) | |
| 39 | | Agentic RFT (tools) | [references/agentic-rft.md](references/agentic-rft.md) | |
| 40 | | Deployment | [references/deployment.md](references/deployment.md) | |
| 41 | | Training curves | [references/training-curves.md](references/training-curves.md) | |
| 42 | | Evaluation | [references/evaluation.md](references/evaluation.md) | |
| 43 | | Vision fine-tuning | [references/vision-fine-tuning.md](references/vision-fine-tuning.md) | |
| 44 | | Large file uploads | [references/large-file-uploads.md](references/large-file-uploads.md) | |
| 45 | | Platform gotchas | [references/platform-gotchas.md](references/platform-gotchas.md) | |
| 46 | |
| 47 | ## Scripts |
| 48 | |
| 49 | | Script | Purpose | |
| 50 | |--------|---------| |
| 51 | | `scripts/submit_training.py` | Submit SFT/DPO/RFT jobs | |
| 52 | | `scripts/monitor_training.py` | Poll job until completion | |
| 53 | | `scripts/calibrate_grader.py` | Find optimal RFT pass_threshold | |
| 54 | | `scripts/check_training.py` | Analyze curves, list checkpoints | |
| 55 | | `scripts/deploy_model.py` | Deploy via ARM REST API | |
| 56 | | `scripts/evaluate_model.py` | LLM judge evaluation | |
| 57 | | `scripts/convert_dataset.py` | Convert between SFT/DPO/RFT formats | |
| 58 | | `scripts/generate_distillation_data.py` | Generate synthetic training data | |
| 59 | | `scripts/score_dataset.py` | Quality scoring on training data | |
| 60 | | `scripts/cleanup.py` | Delete old files and deployments | |
| 61 | | `scripts/validate/` | Data validators (SFT, DPO, RFT) + stats | |
| 62 | |
| 63 | ## Rules |
| 64 | |
| 65 | 1. **Always baseline first** — evaluate the base model before fine-tuning |
| 66 | 2. **Validate data** before submitting — run `scripts/validate/validate_sft.py` |
| 67 | 3. **Calibrate RFT graders** — target 25-50% failure rate on the base model |
| 68 | 4. **Evaluate checkpoints** — don't blindly deploy the final one |
| 69 | 5. **Measure token cost** alongside accuracy when comparing models |
| 70 | |
| 71 | ## Quick Reference |
| 72 | |
| 73 | | Task | Command | |
| 74 | |------|---------| |
| 75 | | Validate SFT data | `python scripts/validate/validate_sft.py data.jsonl` | |
| 76 | | Submit SFT job | `python scripts/submit_training.py --model gpt-4.1-mini --training-file train.jsonl --validation-file val.jsonl --type sft` | |
| 77 | | Monitor job | `python scripts/monitor_training.py --job-id ftjob-xxx` | |
| 78 | | Analyze curves | `python scripts/check_training.py --job-id ftjob-xxx` | |
| 79 | | Deploy model | `python scripts/deploy_model.py --model-id ft:gpt-4.1-mini:... --name my-eval` | |
| 80 | | Evaluate model | `python scripts/evaluate_model.py --deployment-name my-eval --test-file test.jsonl` | |
| 81 | |
| 82 | ## Error Handling |
| 83 | |
| 84 | | Error | Cause | Fix | |
| 85 | |-------|-------|-----| |
| 86 | | "API version not supported" | Older `openai` SDK on `/v1/` endpoint | Upgrad |