unsloth

Fine-tune LLMs with LoRA and QLoRA using Unsloth's optimized training framework.

Updated May 4, 2026
One-click install
npx skills add https://github.com/Junkfooooood/hermes-governance --skill unsloth-junkfooooood
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: unsloth
Source: https://github.com/Junkfooooood/hermes-governance/tree/main/skills/mlops/training/unsloth
Command: npx skills add https://github.com/Junkfooooood/hermes-governance --skill unsloth-junkfooooood

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires unsloth, torch, transformers, trl, datasets, peft, and includes references (resource) components.

What problem does it solve? Fine-tuning large language models typically requires expensive GPUs and long training times. This Skill provides guidance for using Unsloth to run LoRA and QLoRA fine-tuning 2-5x faster with significantly less VRAM, making local and Colab-based training practical. ## Core Features & Use Cases - Fast LoRA/QLoRA Fine-tuning: Train Llama, Qwen, Mistral, Gemma, Phi, gpt-oss, and DeepSeek models with 4-bit or 16-bit adapters using FastLanguageModel. - Reinforcement Learning: Train reasoning models with GRPO, GSPO, DPO, ORPO, and KTO using memory-efficient RL workflows. - Model Export & Deployment: Save fine-tuned models to GGUF for Ollama and llama.cpp, or to 16-bit for vLLM and SGLang deployment. - Use Case: Fine-tune Llama 3.1 (8B) on a custom dataset in a free Colab notebook, then export it to GGUF and run it locally in Ollama. ## Quick Start Ask the assistant to show how to fine-tune a Llama model with Unsloth using QLoRA on a custom dataset and export it to GGUF for Ollama.

Frequently Asked Questions about unsloth

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I fine-tune a Llama model with Unsloth?

Load the model with FastLanguageModel.from_pretrained using load_in_4bit for QLoRA, attach LoRA adapters, prepare a dataset with the datasets library, and train with TRL's SFTTrainer. Unsloth provides free Colab notebooks for Llama, Qwen, Gemma, and other models.

What is the difference between LoRA and QLoRA fine-tuning?

LoRA trains small adapter matrices in 16-bit precision while freezing the base model. QLoRA additionally quantizes base weights to 4-bit, cutting VRAM usage sharply. Unsloth recommends starting with QLoRA since its dynamic 4-bit quants have negligible accuracy loss.

How much VRAM do I need for Unsloth fine-tuning?

QLoRA 4-bit training needs about 5 GB for a 7B model and 41 GB for a 70B model, while 16-bit LoRA needs roughly 19 GB and 164 GB respectively. If you hit out-of-memory errors, lower the batch size to 1, 2, or 3.

Does Unsloth work on Windows and AMD GPUs?

Yes. Unsloth supports Linux and Windows (including WSL), and works on NVIDIA GPUs with CUDA capability 7.0 or higher, plus AMD and Intel GPUs. The simplest setup is pip install unsloth or the official unsloth/unsloth Docker image.

How do I run a fine-tuned Unsloth model in Ollama?

After training, save the model to GGUF format using Unsloth's saving utilities, which merge adapters into 16-bit weights before quantization. The resulting GGUF file can be loaded directly into Ollama, llama.cpp, Open WebUI, or Jan.

Can Unsloth train reasoning models with reinforcement learning?

Yes. Unsloth supports GRPO, GSPO, DPO, ORPO, and KTO for reinforcement learning, using up to 80% less VRAM than other RL libraries. It includes notebooks for training reasoning models like DeepSeek-R1-style and gpt-oss with GRPO.