Unsloth: Fine-tuning and reinforcement learning for LLMs
Memory-efficient Python library for accelerated LLM training.
Learn more about Unsloth
Unsloth is a Python library that accelerates the fine-tuning and reinforcement learning processes for large language models while reducing memory consumption. It achieves performance improvements through optimized implementations of attention mechanisms, gradient computations, and memory management techniques that minimize overhead during training operations. The library provides pre-configured model loaders that automatically apply these optimizations to popular transformer architectures, enabling faster training speeds compared to standard implementations. It integrates with existing machine learning frameworks and supports common fine-tuning workflows including supervised learning and reinforcement learning from human feedback.
Memory optimization
Implements custom kernels and algorithmic improvements to reduce VRAM usage during training. The framework achieves reported reductions in memory consumption across different model sizes and training approaches.
Multi-model support
Provides optimized implementations for diverse model architectures including GPT-OSS, DeepSeek-R1, Qwen3, Gemma 3, Llama 3.1, and text-to-speech models. Supports both language models and vision-language models.
Multiple training paradigms
Supports supervised fine-tuning, reinforcement learning methods like GRPO, and specialized training for vision and text-to-speech tasks. Includes export functionality to multiple model formats and deployment platforms.
from unsloth import FastLanguageModel
model, tokenizer = FastLanguageModel.from_pretrained(
model_name="unsloth/llama-2-7b-bnb-4bit",
max_seq_length=2048,
dtype=None,
load_in_4bit=True
)
# Model is now ready with optimized memory and speedIntroduces 3x faster training with 30% less VRAM and 500K context support
- –Introducing 3x faster training & 30% less VRAM. New Triton kernels, padding-free & packing
- –500K Context training and reinforcement learning is now possible on a single 80GB GPU
- –Fine-tune then Deploy LLMs on your Phone with PyTorch and Unsloth
- –Transformers v5 is now supported (not enabled by default due to possible instability)
- –Preliminary multi-GPU support: DDP Guide
Adds FP8 training support with 1.4x speed and 60% less VRAM usage
- –Introducing FP8 Reinforcement Learning! Train on any FP8 supported GPU and get 1.4x faster with 60% less VRAM
- –Unsloth now uses much less VRAM than before, enabling even longer context
- –DeepSeek-OCR fine-tuning is here! We fine-tuned DeepSeek-OCR, improving its language understanding by 89%
- –Qwen3-VL models supported including GGUFs to run locally
- –Analyzed RL training-inference mismatch for FP16 vs. BF16 and concluded that Unsloth does not have this issue
Launches official Docker image and adds support for Blackwell, DGX, and new model families
- –Unsloth now has its own Docker image! Start training with no setup
- –Collabed with NVIDIA for Blackwell and DGX Spark support
- –Qwen3-VL models are all now supported
- –IBM Granite-4.0 models are now supported
- –OpenAI showcased our new gpt-oss RL notebook for autonomously solving the 2048 game
See how people are using Unsloth
Related Repositories
Discover similar tools and frameworks used by developers
GFPGAN
PyTorch framework for blind face restoration using StyleGAN2 priors.
LivePortrait
PyTorch implementation for animating portraits by transferring expressions from driving videos.
WiFi DensePose
System for real-time human pose tracking using WiFi Channel State Information without cameras or wearables.
DeepSpeed
PyTorch library for training billion-parameter models efficiently.
Awesome Nano Banana
Curated collection of images and prompts from Google's Gemini-2.5-Flash-Image model with model comparisons.