Documentation Index
Fetch the complete documentation index at: https://docs.monostate.ai/llms.txt
Use this file to discover all available pages before exploring further.
Unsloth Integration
Unsloth provides optimized training for LoRA fine-tuning, significantly reducing training time and memory usage.Requirements
| Requirement | Details |
|---|---|
| Installation | pip install unsloth |
| Supported Trainers | default, sft only |
| Supported Models | llama, mistral, gemma, qwen2 |
| Platform | Linux recommended |
Supported Model Architectures
Unsloth is optimized for specific model families:| Architecture | Example Models |
|---|---|
llama | Llama 2, Llama 3, Llama 3.1, Llama 3.2 |
mistral | Mistral 7B, Mistral Nemo |
gemma | Gemma, Gemma 2 |
qwen2 | Qwen 2, Qwen 2.5 |
Quick Start
Parameters
| Parameter | CLI Flag | Default | Description |
|---|---|---|---|
unsloth | --unsloth | False | Enable Unsloth for faster training |
use_sharegpt_mapping | --use-sharegpt-mapping | False | Use Unsloth’s ShareGPT mapping instead of converting |
Python API
With Quantization
Unsloth works with int4 and int8 quantization for reduced memory usage:How It Works
When Unsloth is enabled and requirements are met:- Uses
FastLanguageModelfrom Unsloth library for optimized model loading - Applies optimized gradient checkpointing (
use_gradient_checkpointing="unsloth") - Automatically configures LoRA target modules:
q_proj,k_proj,v_proj,o_proj,gate_proj,up_proj,down_proj - Integrates with PEFT for efficient adapter training
Fallback Behavior
If Unsloth cannot be used, training continues with standard transformers/PEFT:- Unsloth not installed: Warning logged, continues without Unsloth
- Unsupported model type: Warning logged, continues without Unsloth
- Unsupported trainer: Unsloth not applied (only SFT supported)
ShareGPT Mapping
Use--use-sharegpt-mapping to preserve ShareGPT format instead of converting:
Next Steps
LoRA/PEFT
Efficient fine-tuning techniques
Quantization
Reduce memory with quantization