Train AI models with Unsloth and Hugging Face Jobs
Hugging Face has integrated Unsloth with Hugging Face Jobs to enable fast, low-cost LLM fine-tuning. This integration allows users to leverage Unsloth's efficiency—providing approximately 2x faster training and 60% less VRAM usage—to train small language models (SLMs) for a few dollars.
Optimized Fine-Tuning for Small Language Models
Small language models, such as LiquidAI/LFM2.5-1.2B-Instruct, are ideal for fine-tuning because they are inexpensive to train, allow for rapid iteration, and are increasingly competitive on focused tasks. The LFM2.5-1.2B-Instruct model specifically runs under 1GB of memory and is optimized for on-device deployment on CPUs, phones, and laptops.
Running Training Jobs via HF Jobs CLI
Users can submit training jobs to fully managed cloud GPUs via the hf jobs CLI. After installing the CLI using curl -LsSf https://hf.co/cli/install.sh | bash, a job can be submitted with a command such as:
# Example submission for LFM2.5-1.2B-Instruct
hf jobs uv run https://huggingface.co/datasets/unsloth/jobs/resolve/main/sft-lfm2.5.py \
--flavor a10g-small \
--secrets HF_TOKEN \
--timeout 4h \
--dataset mlabonne/FineTome-100k \
--num-epochs 1 \
--eval-split 0.2 \
--output-repo your-username/lfm-finetuned
AI Agent Integration via Hugging Face Skills
To lower the barrier to entry, Hugging Face has introduced "skills" that allow coding agents like Claude Code and Codex to handle the training process via prompting.
Installation for Claude Code
Claude Code uses a plugin system to discover skills. Installation involves adding the marketplace and installing the specific model trainer skill:
/plugin marketplace add huggingface/skills/plugin install hugging-face-model-trainer@huggingface-skills
Installation for Codex
Codex utilizes AGENTS.md files and .agents/skills/ directories. The skill can be installed using the $skill-installer:
$skill-installer install https://github.com/huggingface/skills/tree/main/skills/hugging-face-model-trainer
Generic Installation
Users can also clone the skills repository and manually copy the skill to their agent's skills directory:
git clone https://github.com/huggingface/skills.git
mkdir -p ~/.agents/skills && cp -R skills/skills/hugging-face-model-trainer ~/.agents/skills/
Technical Workflow and Execution
Once the skill is installed, a user can prompt an agent to train a model (e.g., "Train LiquidAI/LFM2.5-1.2B-Instruct on mlabonne/FineTome-100k using Unsloth on HF Jobs"). The agent then executes the following workflow:
- Generates a UV script with inline dependencies.
- Submits the script to HF Jobs via the
hfCLI. - Reports the job ID and provides a monitoring URL via Trackio.
- Pushes the final trained model to the user's Hugging Face Hub repository.
Hardware Recommendations and Costs
Training costs vary based on model size and the recommended GPU flavor:
| Model Size | Recommended GPU | Approx Cost/hr |
|---|---|---|
| <1B params | t4-small |
~$0.40 |
| 1-3B params | t4-medium |
~$0.60 |
| 3-7B params | a10g-small |
~$1.00 |
| 7-13B params | a10g-large |
~$3.00 |
Best Practices for Coding Agents
To optimize results when using coding agents for training, Hugging Face recommends:
- Providing specific Hub IDs for models and datasets (e.g.,
Qwen/Qwen2.5-0.5B). - Explicitly mentioning Unsloth to ensure it is used over other frameworks.
- Requesting cost estimates before launching large jobs.
- Using Trackio for real-time loss curve monitoring.
- Inspecting logs via the agent to check job status.