---
title: "Fine-Tuning Local Models with Docker Offload and Unsloth"
description: "Gemma 3 270M, a sub-1GB local model, can be fine-tuned with LoRA via Unsloth to mask personally identifiable information."
url: "https://swe.quest/articles/fine-tuning-local-models-with-docker-offload-and-unsloth-8a67120e1423508b"
canonical: "https://www.docker.com/blog/fine-tuning-models-with-offload-and-unsloth/"
source: "Docker"
published: "2025-10-02"
difficulty: "medium"
kind: "How-to"
reading_minutes: 8
tags: ["model-training","llms","privacy","containers"]
---

# Fine-Tuning Local Models with Docker Offload and Unsloth

A post on [Docker](https://swe.quest/sources/docker.md), published 2025-10-02, 8 min read, How-to. Original: [https://www.docker.com/blog/fine-tuning-models-with-offload-and-unsloth/](https://www.docker.com/blog/fine-tuning-models-with-offload-and-unsloth/)

## Summary

Gemma 3 270M, a sub-1GB local model, can be fine-tuned with LoRA via Unsloth to mask personally identifiable information. Before fine-tuning it returned only "\[PERSON\]"; afterward it correctly redacted names, ID numbers and dates. The walkthrough runs the official Unsloth Docker image on a cloud NVIDIA L4 GPU through Docker Offload from a MacBook, with Mutagen syncing files back to the laptop. It then trains on the ai4privacy pii-masking-400k dataset in under 20 minutes, converts the result to GGUF with llama.cpp, and packages and pushes the roughly 518MB model to Docker Hub for use with Docker Model Runner.

Written by swe.quest, not by the author.

**Difficulty:** Medium: assumes a working developer; shows how it is built or done

## Topics

- [Model training](https://swe.quest/tags/model-training.md) (AI & ML)
- [LLMs](https://swe.quest/tags/llms.md) (AI & ML)
- [Privacy](https://swe.quest/tags/privacy.md) (Security)
- [Containers](https://swe.quest/tags/containers.md) (Infrastructure)

## Prerequisites

- Docker CLI basics ([easy posts on Containers](https://swe.quest/tags/containers.md?difficulty=easy))
- LLM fine-tuning concepts ([easy posts on LLMs](https://swe.quest/tags/llms.md?difficulty=easy))
- LoRA adapters

## Keywords

Docker Offload, Unsloth, Gemma 3, LoRA, GGUF, Docker Model Runner, llama.cpp, Mutagen

## Related posts

- [LoRA Explained: Faster, More Efficient Fine-Tuning with Docker](https://swe.quest/articles/lora-explained-faster-more-efficient-fine-tuning-with-docker-c2d6a36ff181eafe.md): Docker · 2025-10-09 · Medium · 8 min read · Model training, LLMs, Privacy
  Gemma 3 270M can be specialized into a compact PII-masking assistant using LoRA, which freezes the base weights and trains only small low-rank adapters, cutting compute and memory needs while avoiding catastrophic forgetting.
- [Run Gemma 3 with Docker Model Runner: Fully Local GenAI Developer Experience](https://swe.quest/articles/run-gemma-3-with-docker-model-runner-fully-local-genai-developer-experience-c005339b3915484f.md): Docker · 2025-04-09 · Medium · 7 min read · LLMs, Inference & serving, Containers, JavaScript
  Docker Model Runner (in Docker Desktop for macOS 4.40.0+) exposes an OpenAI-compatible API on localhost, so Gemma 3 can be pulled with \`docker model pull ai/gemma3\` and called through the standard OpenAI SDK by pointing baseURL at http://localhost:12434/engines/v1.
- [Fine-Tuning Gemma Models in Hugging Face](https://swe.quest/articles/fine-tuning-gemma-models-in-hugging-face-d432d00965e71590.md): Hugging Face · 2024-02-23 · Medium · 5 min read · Model training, LLMs, Python
  Gemma 2B and 7B can be fine-tuned cheaply with LoRA via the Hugging Face PEFT library, loading the base model in 4-bit NF4 with bitsandbytes (QLoRA) so it fits on free Colab GPUs.
- [Run LLMs Locally with Docker: A Quickstart Guide to Model Runner](https://swe.quest/articles/run-llms-locally-with-docker-a-quickstart-guide-to-model-runner-ccfbbb71db5d1485.md): Docker · 2025-04-04 · Medium · 5 min read · Inference & serving, LLMs, Containers, Developer tools
  Docker Model Runner, in beta with Docker Desktop 4.40 on Apple silicon, pulls LLMs packaged as OCI artifacts and serves them through an OpenAI-compatible API backed by llama.cpp.
- [Welcome Gemma - Google’s new open LLM](https://swe.quest/articles/welcome-gemma-google-s-new-open-llm-a7d68dd269473a81.md): Hugging Face · 2024-02-21 · Medium · 9 min read · LLMs, Inference & serving, Model training, Python
  Google's Gemma open LLM family ships in 2B and 7B sizes, each with base and instruction-tuned variants and an 8K context.

Browse: [Latest posts](https://swe.quest/index.md) · [Topics](https://swe.quest/tags.md) · [Sources](https://swe.quest/sources.md) · [Topic map](https://swe.quest/map.md) · [Site guide (llms.txt)](https://swe.quest/llms.txt)
