Course: Course 3 — LLM Fine-Tuning Masterclass
Deep-Dive: FTDD-03 — Unsloth
Duration: ~30 minutes (spoken at ~140 wpm)
Format: Verbatim transcript with [SLIDE N] cues. Read aloud or use as speaker notes.
[SLIDE 1 — Title]
Welcome to deep-dive FTDD-zero-three, Unsloth. The first two deep-dives looked at model families — MiniCPM and OLMo-slash-Tülu. This deep-dive pivots from the model to the tooling. Unsloth is a fine-tuning library built around a single thesis: the existing deep-learning frameworks leave performance on the table, and rewriting the performance-critical paths by hand yields roughly two-times training speed and sixty-percent lower memory on a single GPU. No new algorithm. Pure systems engineering.
If you have done module FT zero-one on VRAM math and FT zero-eight on LoRA and QLoRA, you know why those numbers matter. Unsloth is the tool that makes the math work out on the hardware you actually own.
[SLIDE 2 — What Unsloth is, and isn't]
Here are the headline numbers. Roughly two-times training speed. Roughly sixty-percent less VRAM. And — this is the third number, and the most important one — zero algorithmic changes. Unsloth does not change what fine-tuning does. A QLoRA run through Unsloth produces the same kind of adapter — same LoRA rank, same target modules, same learning dynamics — as one run through TRL. The math is identical. What Unsloth changes is the implementation: how fast the math runs and how much memory it takes.
This is the point to internalize. Unsloth is a near drop-in acceleration layer. You do not learn a new fine-tuning method to use it. You learn a slightly different API entry point, and your training runs faster and cheaper. The conceptual content of this course — steering versus knowledge, LoRA, DPO, GRPO — is unchanged. Unsloth just makes it runnable on the hardware you have.
[SLIDE 3 — How Unsloth achieves the win]
Three engineering decisions produce the speedup. None is a new algorithm.
First, hand-written Triton kernels for the forward and backward passes. PyTorch and Transformers use general-purpose kernels — code written to handle many cases reasonably well. Unsloth replaces the performance-critical kernels — the attention computation, the linear-layer forward and backward — with kernels hand-written in Triton. Triton is a language for writing GPU kernels at a higher level of abstraction than CUDA C, but with near-CUDA performance. Unsloth's kernels are specialized for the exact shapes and operations fine-tuning performs, eliminating the overhead general-purpose kernels carry.
Second, manual autograd. PyTorch's autograd — the automatic differentiation system — is general and correct, but it builds a computation graph dynamically and materializes intermediate tensors. For fine-tuning, especially with LoRA adapters, much of this generality is wasted. Unsloth computes the gradients directly, by hand, for its custom operations, rather than letting PyTorch derive and schedule them. The gradients are mathematically identical. The path to computing them is shorter.
Third, four-bit optimizers. The optimizer — AdamW, typically — maintains state: momentum and variance estimates for every trainable parameter. At thirty-two-bit precision, this state is a significant memory cost. Unsloth stores the optimizer state at four-bit precision. That is an eight-times reduction in optimizer-state memory, with negligible effect on convergence — the optimizer state is statistical, and it tolerates aggressive quantization. Combined with QLoRA's four-bit base weights, this is what brings a seven-billion fine-tune down to a size the RTX forty-ninety can hold.
All three are engineering wins. The math is the same. The implementation is faster. That is the whole story.
[SLIDE 4 — The consumer-GPU enabler]
Here is the headline claim, stated literally. Unsloth made seven-billion QLoRA viable on a fifteen-hundred-dollar RTX forty-ninety. That is the democratization claim, and it is real.
Before Unsloth, seven-billion fine-tuning on consumer hardware required either a more expensive GPU — twenty-four gigabytes or more, pushing into the two-thousand-to-five-thousand-dollar tier — or aggressive compromises: tiny batch sizes, short sequences, offloading to CPU, which is slow. After Unsloth, the RTX forty-ninety's twenty-four gigabytes is enough to run a seven-billion QLoRA with reasonable batch sizes and sequence lengths, at roughly twice the speed.
For this course, that is the difference between a curriculum that is theoretically executable and one that is practically executable. When FT zero-zero says load MiniCPM, apply a LoRA, feel the steering thesis, Unsloth is what makes that lab completable on a student's own machine in minutes. And the democratization is not just economic. It is pedagogical. A student who can run a dozen fine-tuning experiments in a day learns steering versus knowledge by feel — they see it, repeatedly, on their own hardware. A student who can afford one experiment per day learns it from a textbook. Unsloth is what makes the former possible.
[SLIDE 5 — CUDA focus, the Apple Silicon caveat]
Now the scope boundary you must know. Unsloth is CUDA-focused. Its hand-written kernels target NVIDIA GPUs. This is a deliberate choice: NVIDIA dominates the GPU-ML ecosystem, and the kernels are where the performance lives, so Unsloth optimizes for the platform most users have.
The consequence: Apple Silicon is not Unsloth's target. On an M-series Mac, Unsloth's CUDA-optimized kernels do not apply. Apple Silicon users should reach for MLX instead — Apple's own ML framework, designed for the Metal backend and the unified-memory architecture of M-series chips. MLX is the subject of module FT twenty on serving, and it is the Apple-Silicon path for both inference and fine-tuning on Mac.
This is not a defect. It is a scope boundary. The course's guidance is simple. NVIDIA GPU with CUDA — use Unsloth. Apple Silicon with Metal — use MLX. No local GPU — use a hosted CUDA instance with Unsloth, or a smaller model like MiniCPM five dash one B that runs on CPU.
[SLIDE 6 — Dynamic four-point-oh GGUF quants]
Unsloth's recent Dynamic four-point-oh release introduced intelligent per-layer GGUF quantization. This is the feature that extends Unsloth's value from training — layers two and three of the stack — into the export step, layer four.
A uniform quantization applies the same precision — say, four-bit — to every layer of the model. Simple, but suboptimal. Some layers are more sensitive to quantization than others. Attention layers and output projections often degrade more when quantized aggressively. Uniform quantization over-quantizes the sensitive layers and under-quantizes the robust ones.
Dynamic quantization does the opposite. It analyzes each layer's sensitivity and assigns higher precision to the sensitive layers and lower precision to the robust ones, hitting a target average bit-width while preserving more quality. The result: a GGUF file the same size as the uniform version, but measurably better. Unsloth's Dynamic four-point-oh quants beat uniform quants at the same file size.
When does this matter? Two cases. First, GGUF export for local Ollama serving — modules nineteen and twenty. If you are shipping a fine-tuned model to run locally via Ollama, Dynamic four-point-oh gives you better quality at the same footprint, or the same quality at a smaller footprint. Second, constrained edge devices — a phone or a small edge device where every megabyte matters. Dynamic quantization extracts more quality per byte.
The pattern: Unsloth optimizes training, and Dynamic four-point-oh extends that optimization to the export. A model fine-tuned with Unsloth and exported with Dynamic four-point-oh is optimized end-to-end for the single-GPU, local-serving path.
[SLIDE 7 — Unsloth versus Axolotl versus TRL]
Three frameworks dominate fine-tuning, and the choice is decided by your hardware and your need for control.
Unsloth — the single-GPU optimizer. Choose it when you have one NVIDIA GPU, you care about speed and memory, and or you want clean GGUF export. Its opinionated nature is the tradeoff: it makes decisions for you.
Axolotl — the multi-GPU, config-driven framework. Choose it when you have multiple GPUs, you want production-grade configuration management, and or you need to scale beyond one GPU. FTDD-five covers Axolotl.
TRL — Transformers Reinforcement Learning, from HuggingFace. Choose it when you want maximum control over the training loop, you are implementing a custom fine-tuning method, or you are building on top of a stack rather than using one. TRL is the library Axolotl and often Unsloth build on. FTDD-four covers TRL.
Here is the heuristic. One GPU, go fast, export to GGUF — Unsloth. Multiple GPUs, production configs — Axolotl. Custom training loop, maximum control — TRL. These are not exclusive. A common pattern is to prototype in Unsloth — fast iteration on one GPU — and scale to Axolotl for the production run. And TRL is the substrate underneath — the thing you reach for when neither Unsloth's nor Axolotl's abstractions fit.
[SLIDE 8 — Anti-patterns]
Three anti-patterns.
First, expecting Unsloth on Apple Silicon. Unsloth is CUDA-focused. On an M-series Mac, its optimizations do not apply. Do not install Unsloth on an M-series Mac expecting a speedup — use MLX instead. This is a scope boundary, not a bug.
Second, assuming the speedup changes the result. Unsloth is faster and cheaper, but it does not change the fine-tuning algorithm. A QLoRA run through Unsloth produces the same kind of adapter as one through TRL. Do not expect Unsloth to produce a better model — expect it to produce the same model, faster, with less memory. If the result is better, the cause is your data or your hyperparameters — the actual steering wheel — not the kernel.
Third, picking Unsloth for a multi-GPU job. Unsloth is single-GPU focused. If you have multiple GPUs and you choose Unsloth, you are leaving compute on the table. Axolotl or TRL with Accelerate will use the additional GPUs and finish faster. Unsloth is the right choice when the constraint is one GPU's speed and memory, not when you have a cluster.
[SLIDE 9 — What you can now do]
You can now explain how Unsloth achieves roughly two-times speed and sixty-percent memory reduction through hand-written Triton kernels, manual autograd, and four-bit optimizers — and why these are engineering wins, not algorithmic changes. You can defend Unsloth's role as the consumer-GPU enabler — seven-billion QLoRA on a fifteen-hundred-dollar RTX forty-ninety. You can identify the CUDA focus and route Apple Silicon users to MLX. You can describe Dynamic four-point-oh GGUF quants and when per-layer intelligence matters. And you can choose between Unsloth, Axolotl, and TRL for a given job.
The lab asks you to run the same QLoRA through Unsloth and a TRL baseline, and measure the speed and memory difference. The Unsloth win, felt directly on your own GPU.
Next, deep-dive FTDD-zero-four: TRL. We go from the optimizer to the substrate — the HuggingFace library that Unsloth and Axolotl build on, and the tool you reach for when you want full control over the training loop.
End of deep-dive FTDD-03. Duration: approximately thirty minutes at one-hundred-forty words per minute.
# Teaching Script — Deep-Dive FTDD-03: Unsloth **Course**: Course 3 — LLM Fine-Tuning Masterclass **Deep-Dive**: FTDD-03 — Unsloth **Duration**: ~30 minutes (spoken at ~140 wpm) **Format**: Verbatim transcript with `[SLIDE N]` cues. Read aloud or use as speaker notes. --- [SLIDE 1 — Title] Welcome to deep-dive FTDD-zero-three, Unsloth. The first two deep-dives looked at model families — MiniCPM and OLMo-slash-Tülu. This deep-dive pivots from the model to the tooling. Unsloth is a fine-tuning library built around a single thesis: the existing deep-learning frameworks leave performance on the table, and rewriting the performance-critical paths by hand yields roughly two-times training speed and sixty-percent lower memory on a single GPU. No new algorithm. Pure systems engineering. If you have done module FT zero-one on VRAM math and FT zero-eight on LoRA and QLoRA, you know why those numbers matter. Unsloth is the tool that makes the math work out on the hardware you actually own. [SLIDE 2 — What Unsloth is, and isn't] Here are the headline numbers. Roughly two-times training speed. Roughly sixty-percent less VRAM. And — this is the third number, and the most important one — zero algorithmic changes. Unsloth does not change what fine-tuning does. A QLoRA run through Unsloth produces the same kind of adapter — same LoRA rank, same target modules, same learning dynamics — as one run through TRL. The math is identical. What Unsloth changes is the implementation: how fast the math runs and how much memory it takes. This is the point to internalize. Unsloth is a near drop-in acceleration layer. You do not learn a new fine-tuning method to use it. You learn a slightly different API entry point, and your training runs faster and cheaper. The conceptual content of this course — steering versus knowledge, LoRA, DPO, GRPO — is unchanged. Unsloth just makes it runnable on the hardware you have. [SLIDE 3 — How Unsloth achieves the win] Three engineering decisions produce the speedup. None is a new algorithm. First, hand-written Triton kernels for the forward and backward passes. PyTorch and Transformers use general-purpose kernels — code written to handle many cases reasonably well. Unsloth replaces the performance-critical kernels — the attention computation, the linear-layer forward and backward — with kernels hand-written in Triton. Triton is a language for writing GPU kernels at a higher level of abstraction than CUDA C, but with near-CUDA performance. Unsloth's kernels are specialized for the exact shapes and operations fine-tuning performs, eliminating the overhead general-purpose kernels carry. Second, manual autograd. PyTorch's autograd — the automatic differentiation system — is general and correct, but it builds a computation graph dynamically and materializes intermediate tensors. For fine-tuning, especially with LoRA adapters, much of this generality is wasted. Unsloth computes the gradients directly, by hand, for its custom operations, rather than letting PyTorch derive and schedule them. The gradients are mathematically identical. The path to computing them is shorter. Third, four-bit optimizers. The optimizer — AdamW, typically — maintains state: momentum and variance estimates for every trainable parameter. At thirty-two-bit precision, this state is a significant memory cost. Unsloth stores the optimizer state at four-bit precision. That is an eight-times reduction in optimizer-state memory, with negligible effect on convergence — the optimizer state is statistical, and it tolerates aggressive quantization. Combined with QLoRA's four-bit base weights, this is what brings a seven-billion fine-tune down to a size the RTX forty-ninety can hold. All three are engineering wins. The math is the same. The implementation is faster. That is the whole story. [SLIDE 4 — The consumer-GPU enabler] Here is the headline claim, stated literally. Unsloth made seven-billion QLoRA viable on a fifteen-hundred-dollar RTX forty-ninety. That is the democratization claim, and it is real. Before Unsloth, seven-billion fine-tuning on consumer hardware required either a more expensive GPU — twenty-four gigabytes or more, pushing into the two-thousand-to-five-thousand-dollar tier — or aggressive compromises: tiny batch sizes, short sequences, offloading to CPU, which is slow. After Unsloth, the RTX forty-ninety's twenty-four gigabytes is enough to run a seven-billion QLoRA with reasonable batch sizes and sequence lengths, at roughly twice the speed. For this course, that is the difference between a curriculum that is theoretically executable and one that is practically executable. When FT zero-zero says load MiniCPM, apply a LoRA, feel the steering thesis, Unsloth is what makes that lab completable on a student's own machine in minutes. And the democratization is not just economic. It is pedagogical. A student who can run a dozen fine-tuning experiments in a day learns steering versus knowledge by feel — they see it, repeatedly, on their own hardware. A student who can afford one experiment per day learns it from a textbook. Unsloth is what makes the former possible. [SLIDE 5 — CUDA focus, the Apple Silicon caveat] Now the scope boundary you must know. Unsloth is CUDA-focused. Its hand-written kernels target NVIDIA GPUs. This is a deliberate choice: NVIDIA dominates the GPU-ML ecosystem, and the kernels are where the performance lives, so Unsloth optimizes for the platform most users have. The consequence: Apple Silicon is not Unsloth's target. On an M-series Mac, Unsloth's CUDA-optimized kernels do not apply. Apple Silicon users should reach for MLX instead — Apple's own ML framework, designed for the Metal backend and the unified-memory architecture of M-series chips. MLX is the subject of module FT twenty on serving, and it is the Apple-Silicon path for both inference and fine-tuning on Mac. This is not a defect. It is a scope boundary. The course's guidance is simple. NVIDIA GPU with CUDA — use Unsloth. Apple Silicon with Metal — use MLX. No local GPU — use a hosted CUDA instance with Unsloth, or a smaller model like MiniCPM five dash one B that runs on CPU. [SLIDE 6 — Dynamic four-point-oh GGUF quants] Unsloth's recent Dynamic four-point-oh release introduced intelligent per-layer GGUF quantization. This is the feature that extends Unsloth's value from training — layers two and three of the stack — into the export step, layer four. A uniform quantization applies the same precision — say, four-bit — to every layer of the model. Simple, but suboptimal. Some layers are more sensitive to quantization than others. Attention layers and output projections often degrade more when quantized aggressively. Uniform quantization over-quantizes the sensitive layers and under-quantizes the robust ones. Dynamic quantization does the opposite. It analyzes each layer's sensitivity and assigns higher precision to the sensitive layers and lower precision to the robust ones, hitting a target average bit-width while preserving more quality. The result: a GGUF file the same size as the uniform version, but measurably better. Unsloth's Dynamic four-point-oh quants beat uniform quants at the same file size. When does this matter? Two cases. First, GGUF export for local Ollama serving — modules nineteen and twenty. If you are shipping a fine-tuned model to run locally via Ollama, Dynamic four-point-oh gives you better quality at the same footprint, or the same quality at a smaller footprint. Second, constrained edge devices — a phone or a small edge device where every megabyte matters. Dynamic quantization extracts more quality per byte. The pattern: Unsloth optimizes training, and Dynamic four-point-oh extends that optimization to the export. A model fine-tuned with Unsloth and exported with Dynamic four-point-oh is optimized end-to-end for the single-GPU, local-serving path. [SLIDE 7 — Unsloth versus Axolotl versus TRL] Three frameworks dominate fine-tuning, and the choice is decided by your hardware and your need for control. Unsloth — the single-GPU optimizer. Choose it when you have one NVIDIA GPU, you care about speed and memory, and or you want clean GGUF export. Its opinionated nature is the tradeoff: it makes decisions for you. Axolotl — the multi-GPU, config-driven framework. Choose it when you have multiple GPUs, you want production-grade configuration management, and or you need to scale beyond one GPU. FTDD-five covers Axolotl. TRL — Transformers Reinforcement Learning, from HuggingFace. Choose it when you want maximum control over the training loop, you are implementing a custom fine-tuning method, or you are building on top of a stack rather than using one. TRL is the library Axolotl and often Unsloth build on. FTDD-four covers TRL. Here is the heuristic. One GPU, go fast, export to GGUF — Unsloth. Multiple GPUs, production configs — Axolotl. Custom training loop, maximum control — TRL. These are not exclusive. A common pattern is to prototype in Unsloth — fast iteration on one GPU — and scale to Axolotl for the production run. And TRL is the substrate underneath — the thing you reach for when neither Unsloth's nor Axolotl's abstractions fit. [SLIDE 8 — Anti-patterns] Three anti-patterns. First, expecting Unsloth on Apple Silicon. Unsloth is CUDA-focused. On an M-series Mac, its optimizations do not apply. Do not install Unsloth on an M-series Mac expecting a speedup — use MLX instead. This is a scope boundary, not a bug. Second, assuming the speedup changes the result. Unsloth is faster and cheaper, but it does not change the fine-tuning algorithm. A QLoRA run through Unsloth produces the same kind of adapter as one through TRL. Do not expect Unsloth to produce a better model — expect it to produce the same model, faster, with less memory. If the result is better, the cause is your data or your hyperparameters — the actual steering wheel — not the kernel. Third, picking Unsloth for a multi-GPU job. Unsloth is single-GPU focused. If you have multiple GPUs and you choose Unsloth, you are leaving compute on the table. Axolotl or TRL with Accelerate will use the additional GPUs and finish faster. Unsloth is the right choice when the constraint is one GPU's speed and memory, not when you have a cluster. [SLIDE 9 — What you can now do] You can now explain how Unsloth achieves roughly two-times speed and sixty-percent memory reduction through hand-written Triton kernels, manual autograd, and four-bit optimizers — and why these are engineering wins, not algorithmic changes. You can defend Unsloth's role as the consumer-GPU enabler — seven-billion QLoRA on a fifteen-hundred-dollar RTX forty-ninety. You can identify the CUDA focus and route Apple Silicon users to MLX. You can describe Dynamic four-point-oh GGUF quants and when per-layer intelligence matters. And you can choose between Unsloth, Axolotl, and TRL for a given job. The lab asks you to run the same QLoRA through Unsloth and a TRL baseline, and measure the speed and memory difference. The Unsloth win, felt directly on your own GPU. Next, deep-dive FTDD-zero-four: TRL. We go from the optimizer to the substrate — the HuggingFace library that Unsloth and Axolotl build on, and the tool you reach for when you want full control over the training loop. --- *End of deep-dive FTDD-03. Duration: approximately thirty minutes at one-hundred-forty words per minute.*