Train or fine-tune language and vision models using TRL (Transformer Reinforcement Learning) or Unsloth with Hugging Face Jobs infrastructure. Covers SFT, DPO, GRPO and reward modeling training methods, plus GGUF conversion for local deployment. Includes guidance on the TRL Jobs package, UV scripts with PEP 723 format, dataset preparation and validation, hardware selection, cost estimation, Trackio monitoring, Hub authentication, model selection/leaderboards and model persistence.
SkillScore96Maintained
Automatic
◆AI Engineer pack
Last verified 8/19/2026
What it changes
Passed 21 of 22 test cases with the skill, and 11 of 22 without it.
Without skill52%
With skill96%
Checks it passed that the model alone missed
Recommends using uvx trl-jobs sft.
Identifies --secrets as the CLI flag name.
Configures report_to='trackio' for experiment tracking.
and 11 more in the full report
10 fixed12 passed either way1 still failing0 broke
Pass-rate lift
+43 pp
Tokens
+140%
Agent turns
0%
Response time
-29%
Model gemini-3.6-flashMeasured 8/19/2026v122 of 23 cases passed with skill · 22 comparable
Tokens, turns and time describe resource use, not a dollar price.
See it in action
One of 10 test cases the skill fixed. Same model, same prompt, with and without the skill.
1 of 10
Prompt
I want to launch a remote script using the `hf` command-line tool. Should I run `hf jobs run uv` or `hf jobs uv run`?
What was checked, without and with the skill
Checked
Without skill
With skill
Specifies hf jobs uv run as the correct command syntax.
Missed
Passed
case-09 · gemini-3.6-flash · 8/19/2026 · answers are capped and redacted
What's inside
The instructions your model reads when the skill loads.
SKILL.md198 lines19 filesincludes scripts
TRL Training on Hugging Face Jobs
Overview
Train language models using TRL (Transformer Reinforcement Learning) on fully managed Hugging Face infrastructure. No local GPU setup required — models train on cloud GPUs and results are automatically saved to the Hugging Face Hub.
TRL provides multiple training methods:
SFT (Supervised Fine-Tuning) — standard instruction tuning
DPO (Direct Preference Optimization) — alignment from preference data
GRPO (Group Relative Policy Optimization) — online RL training
Reward Modeling — train reward models for RLHF
See references/training_methods.md for method overviews and selection guidance.
When to Use Unsloth
Use Unsloth (references/unsloth.md) instead of standard TRL when GPU memory is limited (~60% less VRAM), speed matters (~2x faster), training large models (>13B), or training Vision-Language Models (Unsloth has FastVisionModel support). See scripts/unsloth_sft_example.py for a production-ready training script.
Key Directives
Submit jobs via hf jobs uv run (CLI) or the hf_jobs() MCP tool if the Hugging Face MCP server is configured — pass the training script inline, don't save to a local file unless the user explicitly requests it. If the user asks to "train a model" or "fine-tune", create the training script AND submit the job immediately.
Always include Trackio for real-time monitoring — use scripts/ templates.
Provide job details after submission: job ID, monitoring URL, estimated time; note the user can request status checks later.
Use example scripts as templates: scripts/train_sft_example.py, scripts/train_dpo_example.py, etc.
Local Script Execution
Repository scripts use PEP 723 inline dependencies. Run them with uv run:
uv run scripts/estimate_cost.py --help
uv run scripts/dataset_inspector.py --help
Prerequisites Checklist
Account & Authentication:
Hugging Face account with Pro/Team/Enterprise plan (Jobs require a paid plan); authenticated login.
HF_TOKEN for Hub push is CRITICAL — the training environment is ephemeral, so results are lost unless pushed to the Hub. Token must have write permissions. Pass secrets={"HF_TOKEN": "$HF_TOKEN"} in the job config.