Yes, you can fine tune an LLM locally on one consumer GPU or a recent Mac. Pick a small instruct model (1B to 8B), put a few hundred to a few thousand clean examples into a chat format JSONL file, and train a LoRA or QLoRA adapter with Unsloth on an NVIDIA GPU, or mlx-lm on an Apple Silicon Mac. Then test it on held out examples and export it to GGUF so it runs in Ollama, LM Studio or llama.cpp (see Ollama vs llama.cpp vs LM Studio if you are picking a runner). Unsloth's requirements table, rechecked on November 12, 2026, lists about 6 GB of VRAM as the absolute minimum to QLoRA train an 8B model and 22 GB for 16 bit LoRA.

This guide walks through each step, explains which tool to use in late 2026, and flags the mistakes that waste the most time.

Step 0: decide whether you should fine tune at all

Fine tuning changes how a model behaves. It is good at teaching a consistent style, format, tone or narrow skill, such as always answering in your company's JSON schema, classifying support tickets, or writing in a house voice. It is a poor way to add frequently changing facts; retrieval, meaning feeding relevant documents into the prompt, handles that better.

Try a well written prompt with a few examples first. If that gets you most of the way but results are inconsistent, too long, or too expensive in tokens, fine tuning is worth it. If the goal is specifically better code generation (instruction or FIM datasets, pass@k checks), see how to fine tune an LLM for code generation. For labeling text, such as routing tickets, see how to fine tune an LLM for a classification task. If your real goal is to understand how models learn, our guide to training a small LLM from scratch is the better project.

Step 1: choose your hardware path

Your machineRecommended toolTypical method
NVIDIA GPU on Linux, WSL or WindowsUnsloth, Axolotl or TRLQLoRA or LoRA
AMD or Intel GPUUnsloth or Axolotl, following their guidesLoRA or QLoRA
Apple Silicon Macmlx-lm, or the Unsloth Desktop appLoRA or QLoRA
No suitable GPUA free Colab or Kaggle notebook (see how to fine tune an LLM in Google Colab)QLoRA

How much VRAM you need to fine tune locally

These are the absolute minimums from Unsloth's requirements page (checked November 12, 2026). QLoRA trains on a 4 bit copy of the model; LoRA here means 16 bit.

Model sizeQLoRA (4 bit)LoRA (16 bit)
3B3.5 GB8 GB
8B6 GB22 GB
14B8.5 GB33 GB
27B22 GB64 GB
70B41 GB164 GB

Unsloth notes that some models need more, and that a batch size of 1 to 3 is the first fix for out of memory errors. Our LoRA vs QLoRA guide explains the tradeoff, and how much VRAM you need for an LLM covers the inference side. For system RAM, disk and context length, see the hardware requirements to fine tune an LLM. If you train in BF16 on a GeForce RTX 30 card, our RTX 3090 BF16 guide explains why those cards run BF16 tensor math at half rate.

Step 2: choose a tool

Unsloth

Unsloth is the most popular route for single GPU fine tuning (like most local stacks, it sits on PyTorch; see PyTorch vs JAX if you are choosing a framework first). It is Apache 2.0 licensed and comes in three forms, according to its GitHub README: Unsloth Desktop (now the recommended install, with builds for Windows, macOS and Linux), a web UI called Unsloth Studio, and Unsloth Core, the Python library. Its requirements page says training works on NVIDIA, AMD and Intel GPUs and on Macs, and the code route needs Python 3.11 to 3.13. It supports LoRA, QLoRA, full fine tuning, DPO and GRPO (see our GRPO vs PPO explainer and our guide to fine tuning an LLM with reinforcement learning), and it exports straight to GGUF. Its README claims about 2 times faster training with 70 percent less VRAM; treat that as the vendor's own figure. The latest release on PyPI is 2026.11.4 (November 11, 2026).

Axolotl

Axolotl is a free, Apache 2.0 fine tuning framework driven by YAML config files. It shines when you want reproducible configs, multi GPU training, or newer techniques: its README lists FSDP2, DeepSpeed, context and expert parallelism, NVFP4 LoRA, and, since September 2026, GGUF export through axolotl export. Version 0.21.1 (October 27, 2026) needs Python 3.12 or newer and an NVIDIA GPU (Ampere or newer for bf16 and Flash Attention) or an AMD GPU.

TRL

TRL, Hugging Face's post training library (version 1.17.1 on PyPI since October 30, 2026), provides SFTTrainer, DPOTrainer, GRPOTrainer and more on top of Transformers, with PEFT integration for LoRA and QLoRA. It is the most flexible option if you are comfortable writing Python, and Unsloth itself plugs into TRL's trainers. There is also a CLI, for example trl sft --model_name_or_path Qwen/Qwen2.5-0.5B --dataset_name trl-lib/Capybara --output_dir out.

mlx-lm on a Mac

Apple's MLX ecosystem includes mlx_lm.lora (mlx-lm 0.32.2, October 2026), which supports LoRA, DoRA and full fine tuning, and switches to QLoRA automatically for quantized models. See our MLX vs GGUF guide for the Mac picture.

What about torchtune?

Many older tutorials recommend torchtune. Its repository now states that it is no longer actively maintained and that development wound down in 2025, so choose one of the tools above for new projects. Our Torchtune vs Unsloth comparison and Torchtune vs Axolotl spell out when each still makes sense.

Step 3: pick a base model

  • Start with an instruct model, not a base model. Unsloth's guide notes that instruct models can be fine tuned directly with chat templates and need less data.
  • Start small. A 1B to 8B model trains quickly, so you can iterate on your data. Unsloth lists bf16 LoRA needs of about 3 GB for Qwen3.5 0.8B, 5 GB for 2B and 10 GB for 4B in its Qwen3.5 fine tuning guide. Scale up once the pipeline works.
  • Check the licence. Apache 2.0 and MIT models are simplest for commercial use. Our explainer on open weight vs open source has a licence table.
  • Follow the model's own guide. Some families have specific advice. Unsloth's Qwen3.5 guide, for example, recommends 16 bit LoRA rather than QLoRA.
  • Decide whether you need reasoning. Hybrid and thinking models need reasoning traces in the training data or they can lose their thinking; our guide to fine tuning a thinking LLM or instruct model covers the data mix and chat template fixes.

Qwen, Gemma and Llama all have small instruct versions with wide tool support; to try the newest Qwen before training it, see how to run Qwen 3.8 27B locally.

Step 4: prepare your data

Data quality decides the result more than any hyperparameter.

  1. Use the chat format. Store one example per line in JSONL, each with a list of messages, for example a system message, a user message and the ideal assistant reply. TRL, Unsloth and Axolotl all accept conversational data in this style and apply the model's chat template for you.
  2. Write the outputs you actually want. Every assistant message is a lesson. Fix inconsistent, wrong or rambling answers before training.
  3. Aim for coverage, not volume. A few hundred clean, varied examples often beat thousands of near duplicates.
  4. Hold out a test set. Keep a slice of examples the model never trains on, so you can tell learning from memorising.
  5. Keep sensitive data in mind. Local training keeps data on your machine, but anything you later publish, including adapters, can leak training content.

You can load local files or browse public examples with Hugging Face Datasets; our Hugging Face Datasets tutorial shows load_dataset("json", ...) on a local file.

Step 5: configure and train

Here is a minimal Unsloth Core script, adapted from Unsloth's Qwen3.5 fine tuning guide. It trains a 16 bit LoRA on a 4B model.

from unsloth import FastLanguageModel
from datasets import load_dataset
from trl import SFTTrainer, SFTConfig

max_seq_length = 2048
dataset = load_dataset("json", data_files={"train": "train.jsonl"}, split="train")

model, tokenizer = FastLanguageModel.from_pretrained(
    model_name="Qwen/Qwen3.5-4B",
    max_seq_length=max_seq_length,
    load_in_4bit=False,
    load_in_16bit=True,
)
model = FastLanguageModel.get_peft_model(
    model, r=16, lora_alpha=16, lora_dropout=0, bias="none",
    target_modules=["q_proj", "k_proj", "v_proj", "o_proj",
                    "gate_proj", "up_proj", "down_proj"],
    use_gradient_checkpointing="unsloth", random_state=3407,
)
trainer = SFTTrainer(
    model=model, train_dataset=dataset, tokenizer=tokenizer,
    args=SFTConfig(max_seq_length=max_seq_length,
                   per_device_train_batch_size=1, gradient_accumulation_steps=4,
                   warmup_steps=10, max_steps=100, learning_rate=2e-4,
                   logging_steps=1, optim="adamw_8bit", output_dir="outputs"),
)
trainer.train()

Unsloth's guide lists about 10 GB of VRAM for 16 bit LoRA on Qwen3.5-4B. Sensible starting settings from its hyperparameter guide are rank 16 or 32, alpha equal to the rank or double it, a learning rate of 2e-4, and 1 to 3 epochs.

With Axolotl, the equivalent is a YAML file and one command, for example axolotl train examples/llama-3/lora-1b.yml from its fetched examples.

Step 6: watch the loss and evaluate

Training loss should fall and then flatten. Unsloth's guide says a loss around 0.5 to 1.0 is often a good sign, and a loss near zero can mean overfitting. Track validation loss on your held out set too; if it rises while training loss keeps falling, stop earlier or add data.

Then run the same 20 to 50 held out prompts through the base model and your fine tune and compare them side by side. For a structured task, score them automatically, for example by checking whether the JSON parses.

Step 7: export and run it locally

You have three common outputs:

  • The LoRA adapter on its own, a small file you can load on top of the base model.
  • A merged 16 bit model, for serving with vLLM or Transformers, usually saved as safetensors files (see what is safetensors).
  • A GGUF file, for Ollama, LM Studio and llama.cpp.

In Unsloth, saving to GGUF is a single call, such as model.save_pretrained_gguf("my-model", tokenizer, quantization_method="q4_k_m").

Run your fine tuned model in Ollama

Ollama does not train models; it runs them. Its import docs accept either a GGUF file or a folder of merged safetensors weights. Write a Modelfile containing FROM ./my-model.Q4_K_M.gguf (or FROM . inside the safetensors folder), then run ollama create my-model followed by ollama run my-model. Ollama does not quantize a GGUF during import, so pick the quant before you export. To run it in LM Studio instead, follow our guide on how to fine tune an LLM for LM Studio, which covers lms import and the prompt template fix. Our GGUF quantization guide helps you pick the quant type.

Common mistakes

  • Wrong chat template. Training with one template and chatting with another produces odd output. Let the tool apply the model's own template.
  • Too many epochs. More than three passes over a small dataset often leads to memorisation.
  • Skipping the export test. Chat with the GGUF in the runner you will actually use before you call it done; a wrong template shows up there first.
  • Judging by training loss alone. Always test on held out prompts.
  • Starting too big. Debug your pipeline on a small model first.

Pros and cons of fine tuning locally

  • Pros: data never leaves your machine; no per token training fees; the result runs offline.
  • Cons: you need suitable hardware or a free notebook; you own the debugging; large models still need cloud GPUs.

It suits developers who need a reliable format or style, teams with private data, and hobbyists learning how post training works.

FAQ

Can I fine tune an LLM on my own computer?

Yes. With QLoRA, Unsloth lists about 6 GB of VRAM as the minimum for an 8B model and 3.5 GB for a 3B model, so many consumer NVIDIA GPUs can do it, and Apple Silicon Macs can fine tune with mlx-lm or Unsloth Desktop.

What small LLM should I fine tune locally first?

Start with a small instruct model you can retrain in minutes, such as Qwen3.5 0.8B, 2B or 4B, which Unsloth lists at about 3, 5 and 10 GB for 16 bit LoRA. Gemma and Llama small models work too. Check the licence before you ship the result.

How much data do I need to fine tune an LLM?

There is no fixed number. A few hundred clean, varied examples are often enough to teach a format or style, while new skills need more. Quality and consistency matter more than volume.

Unsloth or Axolotl: which should I use?

Unsloth is the quickest path on a single GPU and offers a desktop app and notebooks. Axolotl suits reproducible YAML configs, multi GPU setups and newer research techniques. Both are free and open source. Torchtune is no longer maintained; see Torchtune vs Unsloth.

Is fine tuning better than RAG?

They solve different problems. Fine tuning changes behaviour, such as style, format and narrow skills; retrieval supplies up to date facts. Many production systems use both. If your facts live in a graph, our guide to fine tuning an LLM with a knowledge graph shows how to combine the two, and our EmbeddingGemma 2 guide shows how to run a local embedding model for the retrieval side.

Can you fine tune a local LLM with Ollama?

No. Ollama runs and serves models but has no training command. Train the adapter with Unsloth, Axolotl, TRL or mlx-lm, export a GGUF or merged safetensors folder, then import it with a Modelfile and ollama create.