Yes, you can fine tune an LLM without a GPU, as long as the model is small. Train a LoRA adapter on a model under about 1 billion parameters with Hugging Face TRL and PEFT on the CPU build of PyTorch, keep examples short, and expect seconds per step instead of fractions of a second. On our 8 core test box, a 135M model learned a simple JSON task in under 90 seconds and a 0.5B model in a little over two minutes. For anything around 7B, skip the CPU: use an Apple Silicon Mac with mlx-lm or a free Kaggle or Colab GPU instead.
This guide shows the exact setup we ran on November 14, 2026, the time and memory it took, the settings that matter on a CPU, and when another route makes more sense. Version numbers and limits come from the official docs, checked the same day.
What's new (November 20, 2026): PEFT 0.22.0 (November 19) requires Python 3.11 or newer. We reran the SmolLM2 test on it, with TRL 1.18.2 and Accelerate 1.16.0, and changed no code: same answer, 1.58 GB peak RAM. The 50 steps took 129 seconds instead of 84 because the box was busy.
Can you fine tune an LLM without a GPU?
You can, but the size of the model decides whether it is practical. Training needs the model weights in memory plus activations and the optimizer state for whatever you train. A CPU has plenty of RAM compared with a consumer graphics card, but far less raw math throughput, so the limit on a CPU is time, not memory.
Two things make CPU fine tuning workable:
- LoRA. Instead of updating every weight, you train small adapter matrices. In our runs that meant 3.5 percent of the weights for the 135M model and 1.75 percent for the 0.5B model. Our LoRA vs QLoRA guide explains how adapters work.
- Small models. Models such as SmolLM2 and the smaller Qwen releases were built to run on modest hardware, and they can learn a narrow task (a format, a label set, a tone) from a few hundred examples.
Some GPU habits carry over less well. QLoRA loads the base model in 4 bit through bitsandbytes, and its installation guide now lists CPU builds (AVX2 on x86), but 4 bit loading mainly saves memory, which is rarely the bottleneck on a CPU. We did not test QLoRA on a CPU. The popular speedup library Unsloth says on its requirements page that its Studio app runs on CPU for chat and data recipes, while training needs an NVIDIA, AMD or Intel GPU or a Mac. Our guide to the hardware requirements to fine tune an LLM shows what each GPU size can train.
Your options at a glance
| Route | What it needs | Good for | Main limit |
|---|---|---|---|
| CPU with TRL and PEFT | Any modern PC with 8 GB or more RAM | Models up to about 1B, narrow tasks | Slow: seconds per step |
| Apple Silicon Mac with mlx-lm | M series Mac with enough unified memory | 1B to 7B models with LoRA or QLoRA | Only on Macs |
| Free Kaggle GPU | A Kaggle account | 1B to 8B models with LoRA or QLoRA | Weekly quota, 12 hour sessions |
| Free Colab GPU | A Google account | Short experiments | Limits unpublished, GPU not guaranteed |
llama.cpp llama-finetune | A llama.cpp build and an FP32 GGUF | Experiments only | The project calls it work in progress |
If you only want to try the workflow, start on the CPU with a tiny model. If you want a useful 7B or 8B model, jump to the Mac or free GPU sections.
How to fine tune an LLM on a CPU, step by step
These are the steps we ran on a Linux box with 8 virtual cores of an Intel Xeon and no GPU. They also work on Windows and macOS with Python 3.
Step 1: install the CPU build of PyTorch
The default PyTorch download on Linux includes CUDA libraries you do not need. The PyTorch install selector gives a CPU only index URL, which keeps the install much smaller:
python3 -m venv venv
./venv/bin/pip install torch --index-url https://download.pytorch.org/whl/cpu
./venv/bin/pip install transformers peft trl datasets accelerate
On November 14 that installed PyTorch 2.15.0, Transformers 5.23.0, PEFT 0.21.3, TRL 1.18.0, Datasets 5.2.0 and Accelerate 1.15.0. On November 20 it pulled PEFT 0.22.0, which needs Python 3.11 or newer.
Step 2: prepare a small chat dataset
TRL's SFTTrainer accepts a conversational format: each row holds a messages list with user and assistant turns. We built 200 synthetic rows that ask for a country's capital and expect a one line JSON answer, such as {"country": "Norway", "capital": "Oslo"}. Each example was about 50 tokens. Short examples matter on a CPU, because time per step grows with sequence length. If your real goal is reliable JSON, read our guide to fine tuning an LLM to output JSON for when constrained decoding is the better fix.
Step 3: train a LoRA adapter on the CPU
This is the core of the script we ran. use_cpu=True is a standard Transformers TrainingArguments option that forces the CPU even if a GPU exists:
from peft import LoraConfig
from trl import SFTTrainer, SFTConfig
cfg = SFTConfig(output_dir="out", max_steps=50, per_device_train_batch_size=4,
learning_rate=2e-4, max_length=128, use_cpu=True,
save_strategy="no", report_to="none")
lora = LoraConfig(r=16, lora_alpha=32, target_modules="all-linear", task_type="CAUSAL_LM")
trainer = SFTTrainer(model=model, args=cfg, train_dataset=ds,
processing_class=tok, peft_config=lora)
trainer.train()
We loaded the model in FP32 (dtype=torch.float32), the safe default on a CPU. PyTorch used all 8 cores without any extra setting.
Step 4: test the result
After training we asked each model for the capital of Norway in JSON, with greedy decoding. Both returned {"country": "Norway", "capital": "Oslo"}. For a real task, hold back 10 to 20 percent of your examples and check them after training, as described in our local fine tuning guide. Our guide to fine tuning an LLM for code generation shows a fuller evaluation loop on a GPU.
What we measured on an 8 core CPU
| Model | Base parameters | Trained by LoRA | Steps (batch 4) | Training time | Time per step | Peak RAM | Loss, first vs last 10 steps |
|---|---|---|---|---|---|---|---|
SmolLM2-135M-Instruct | 134.5M | 4.9M (3.5%) | 50 | 84 s | 1.7 s | 1.54 GB | 2.61 to 0.21 |
Qwen2.5-0.5B-Instruct | 494.0M | 8.8M (1.75%) | 20 | 136 s | 6.8 s | 3.37 GB | 1.43 to 0.09 |
Peak RAM is the peak resident memory of the whole Python process. Percentages are the share of all weights, adapter included. The box was shared with other jobs, and a few steps in each run took several times longer than the rest, so treat these as rough numbers from one machine, not a benchmark.
What the numbers mean in practice:
- Memory is not the problem. Even the 0.5B model stayed under 3.5 GB, so an ordinary laptop with 8 GB of RAM can do this.
- Time grows quickly with size. The 0.5B model has about 3.7 times the parameters of the 135M model and took about 4 times as long per step.
- Scale it with simple math. At 6.8 seconds per step, 1,000 short examples at batch size 4 is 250 steps, or about 28 minutes per epoch on a similar CPU. Longer examples raise that.
- Bigger models get impractical. A 7B model in FP32 needs about 28 GB just for its weights (7 billion times 4 bytes) before any training memory, and each step would be far slower than the 0.5B run.
Settings that make CPU training bearable
- Keep
max_lengthlow. We used 128 tokens. Trim long examples or split them. - Use a small batch with gradient accumulation if you need a larger effective batch.
gradient_accumulation_stepsadds steps of compute but no extra memory. - Train a LoRA rank of 8 or 16. Higher ranks add trainable weights and time with little gain on narrow tasks.
- Turn off checkpoints while testing (
save_strategy="no"), then save once at the end withtrainer.save_model(). - Run a short trial first. Set
max_stepsto 10, time it, and multiply before you start a long run. - Close other heavy programs. CPU training uses every core, and we saw steps slow down sharply whenever other work ran on the same machine.
How to fine tune an LLM on a Mac without an NVIDIA GPU
An Apple Silicon Mac has a GPU, so this is not strictly training without one, but it is the most common situation for people searching this question: no NVIDIA card. Apple's mlx-lm package (version 0.32.2 on PyPI on November 14) fine tunes with LoRA, DoRA or full fine tuning, and switches to QLoRA automatically when you point it at a quantized model:
pip install "mlx-lm[train]"
mlx_lm.lora --model <hugging face repo or local path> --train --data ./data --iters 600
Its docs list memory fixes in order: use a quantized model, lower --batch-size (default 4) and use --grad-accumulation-steps, train fewer layers with --num-layers (default 16), shorten examples and add --grad-checkpoint. The docs give one reference point: Mistral 7B with batch size 1 and 4 layers ran at about 250 tokens per second on an M1 Max with 32 GB. We did not test mlx-lm for this guide. MLX vs PyTorch covers the framework choice on a Mac.
Use a free cloud GPU instead
If your laptop has no usable GPU, a free notebook is usually faster than any CPU for models above 1B:
- Kaggle documents its free hardware: one NVIDIA P100 or two T4 cards, 29 GB of RAM in GPU sessions, up to 12 hours per session, and a weekly GPU quota of 30 hours or sometimes higher. Its notebook docs also explain Save & Run All, which runs a notebook to the end without you watching.
- Google Colab is free too, but its FAQ says free resources are not guaranteed, limits fluctuate and are not published, and free notebooks run for at most 12 hours.
Our Google Colab vs Kaggle GPU comparison goes through both services in detail, and our Colab fine tuning walkthrough shows a full QLoRA run on a free T4.
What about llama.cpp and Unsloth on a CPU?
llama.cpp ships a llama-finetune example, but its training README says fine tuning is "technically functional (for FP32 models and limited hardware setups)" and the code is very much work in progress. It reports that Stories 260K and Llama 3.2 1B seem to work with 24 GB of memory, and that CPU training needs a build without extra backends such as CUDA. It is interesting to try, not something to rely on.
Unsloth, as noted above, does not train on a CPU. Its Studio app runs chat with GGUF models and data recipes on CPU only machines, which is handy for preparing a dataset before you move to a GPU.
Which route should you pick?
- You want to learn the workflow or teach a tiny model one format: CPU with TRL and PEFT, using a model of 0.5B or smaller. To train a toy model from zero on a CPU instead, see how to train a small LLM from scratch.
- You have an Apple Silicon Mac and want a 3B to 7B model: mlx-lm with a quantized model.
- You want an 8B model and have no GPU at all: a free Kaggle session, then download the adapter.
- You need it to work every time: rent a GPU by the hour. Our guide to how much VRAM you need for an LLM helps you size it.
FAQ
Can I fine tune an LLM on a CPU only laptop?
Yes, for small models. On our 8 core test machine, LoRA training of a 0.5B model used 3.37 GB of RAM at about 6.8 seconds per step, and a 135M model used 1.54 GB at about 1.7 seconds per step. A laptop with 8 GB of RAM can handle that, just slowly.
How long does it take to fine tune an LLM without a GPU?
It depends on model size, example length and the number of steps. Our 0.5B run on short examples worked out to about 28 minutes per epoch for 1,000 examples at batch size 4. A 135M model is roughly four times faster. Time a 10 step trial on your own machine and multiply.
Can I use QLoRA without a GPU?
Possibly, but it is rarely worth it. bitsandbytes, the library behind 4 bit QLoRA in the Hugging Face stack, now publishes CPU builds, yet 4 bit loading mostly saves memory, and memory is not the limit on a CPU. We tested plain LoRA in FP32 only. On an Apple Silicon Mac, mlx-lm runs QLoRA when you give it a quantized model.
What is the smallest model worth fine tuning?
Models around 100M to 500M parameters can learn narrow jobs such as a fixed output format or a small label set; ours learned a JSON pattern in under 90 seconds. For open ended writing or reasoning, they stay weak, and you will want 1B to 8B models on a GPU or Mac.
Can I fine tune a 7B model on a CPU?
Not practically. The weights alone take about 28 GB in FP32, and each training step would take far longer than our 0.5B run. Use a free Kaggle GPU or an Apple Silicon Mac with mlx-lm for 7B models.
Can I run my CPU fine tuned model in Ollama?
Yes, after a few steps. Merge the LoRA adapter into the base model with PEFT, convert the result to GGUF with llama.cpp's converter, and import it into Ollama. Our local fine tuning guide walks through the export.



