In this categoryLocal AI · 24
- How to Install Ollama on macOSStart
- How to Install Ollama on Windows
- How to Run Llama 3 Locally with Ollama
- How to Pick the Right Local AI Model for Your Hardware
- Best GGUF Models to Run by VRAM Tier (8GB, 12GB, 16GB, 24GB, 48GB)
- Run LLMs in Your Browser With WebGPU: No Install, No Server (WebLLM)
- How to Use Ollama as a Drop-In OpenAI API
- GGUF vs MLX vs NVFP4: Local AI Quantization Formats Explained
How to Fine-Tune an LLM with LoRA (Beginner Guide)
Understand what fine-tuning actually does, why LoRA makes it possible on consumer hardware, and what you need before you write a single line of training code.
Prompting tells a model what to do. Fine-tuning changes what the model is. When a general-purpose LLM does not reliably write in your company's style, answer in a specific domain, or follow a strict output format, fine-tuning is how you bake those behaviors in permanently rather than fighting them with longer and longer system prompts.
- A GPU with at least 16 GB VRAM for a serious fine-tune (RTX 3090, 4090, or an A10G cloud instance)
- Python 3.10+ with pip and a working CUDA environment
- A dataset of at least 100 examples in JSONL format (more on this below)
- Unsloth installed — it cuts VRAM usage by roughly half and speeds training 2x
Fine-tuning vs prompting: when to use which
Prompting is fast to iterate but pays a cost every inference: the instruction repeats in every request, burning tokens and sometimes getting ignored. Fine-tuning compiles behavior into the weights so the model already knows what you want. Use prompting when you need flexibility. Use fine-tuning when you need consistency at scale, a specific domain voice, or a strict structured output format the base model keeps breaking.
| Situation | Use prompting | Use fine-tuning |
|---|---|---|
| Speed to first result | Yes | No |
| Consistent tone across thousands of calls | Sometimes | Yes |
| Teaching new knowledge | No | No (use RAG instead) |
| Strict output format (JSON schema) | Fragile | Yes |
| Low-latency production inference | Heavier prompts hurt | Yes |
LoRA vs QLoRA: the practical difference
Full fine-tuning updates every weight in the model. For a 7B-parameter model that is gigabytes of gradient data per step. LoRA (Low-Rank Adaptation) adds small trainable adapter matrices on top of frozen base weights. You train only the adapters, which are a fraction of the size. QLoRA goes further by also quantizing the base model to 4-bit first, cutting VRAM usage dramatically. The trade-off is a slight quality loss from quantization, which is usually acceptable. On a single RTX 3090, QLoRA lets you fine-tune a Llama 3 8B model in a few hours. Full fine-tuning of the same model would need a multi-GPU server.
Why Unsloth
Unsloth rewrites the attention kernels used during training to use significantly less memory and run faster than the standard Hugging Face + PEFT stack. On identical hardware, Unsloth typically gives 2x the throughput and fits a larger batch size, which means fewer training steps to reach the same result. It supports Llama 3, Mistral, Phi-3, Gemma, and most popular open-weight architectures. You use the same familiar Trainer API, so switching from PEFT to Unsloth is a small change.
Hardware requirements
The minimum for a real fine-tune is 16 GB VRAM with QLoRA enabled. Below that you hit out-of-memory errors or have to reduce batch size to 1, which makes training unstable. Common setups that work well:
| GPU | VRAM | Max model size (QLoRA) | Notes |
|---|---|---|---|
| RTX 3090 / 4090 | 24 GB | 13B | Best consumer option |
| RTX 3080 Ti | 12 GB | 7B (tight) | Possible with gradient checkpointing |
| A10G (cloud) | 24 GB | 13B | AWS g5 instances |
| A100 (cloud) | 40–80 GB | 70B | For serious scale |
| CPU only | — | Not viable | Training on CPU takes days |
Dataset format: JSONL
Most fine-tuning frameworks expect one JSON object per line (JSONL). Each object holds a conversation with roles. The most common format used by Llama 3 and Mistral models is the ShareGPT / conversations format:
{"conversations": [{"role": "system", "content": "You are a support agent for Acme Corp. Reply concisely and always offer a next step."}, {"role": "user", "content": "My order hasn't arrived."}, {"role": "assistant", "content": "I'm sorry to hear that. Can you share your order number? I'll look it up and give you a status update right away."}]}
{"conversations": [{"role": "system", "content": "You are a support agent for Acme Corp. Reply concisely and always offer a next step."}, {"role": "user", "content": "I was charged twice."}, {"role": "assistant", "content": "That should not have happened. Please share the email on your account and I'll flag it for our billing team to reverse the duplicate charge today."}]}Each line is a complete, self-contained example. The system prompt sets the persona; the user turn is the input; the assistant turn is what you want the model to learn to produce. You can have multi-turn conversations in a single example by adding more role/content pairs, but single-turn examples are easier to collect and work well for most tasks.
What comes next
Now that you understand the mechanics, you are ready to run an actual training job. The next guide in this series walks through fine-tuning Llama 3 on your own JSONL dataset using Unsloth, from pip install to a GGUF file ready to load into Ollama.
Local models run better with more VRAM. CompareRTX GPUs on Amazonbefore you upgrade.(affiliate link. We may earn a commission at no extra cost. Disclosure)
Related guides
Best GPU for Running AI Locally in 2026
VRAM is the single spec that determines which models you can run. Here is how every major GPU stacks up for local LLMs and image generation in 2026.
How to Prepare a Training Dataset for LLM Fine-Tuning
Build a clean JSONL dataset using the right conversation format, apply quality filters, hit the minimum example count, and use synthetic generation to fill gaps.
Watch related tutorials
28:15
31:50
19:55
25:30
16:45
22:40Weekly local AI drops
New models, what runs on your hardware, and the guides to set them up. One email a week, unsubscribe any time.