How to Start Fine-Tuning Your Local LLM: A Beginner's Guide
Fine-tuning turns a general-purpose AI into one that knows your business, your writing style, and your domain. Here's how to start — even if you've never trained a model before.
A general-purpose LLM is like a brilliant generalist who just joined your company. They're smart and capable, but they don't know your products, your customers, your writing style, or your domain-specific terminology. Fine-tuning is the process of training that model on your specific data so it becomes an expert in your world.
The good news: fine-tuning has become dramatically more accessible. You don't need a PhD, a supercomputer, or a massive dataset. With a modern GPU and a few hours, you can fine-tune a capable model for your specific use case.
Here's how.
What Fine-Tuning Actually Is (And Isn't)
Let's clear up some confusion first.
Fine-tuning is updating a model's weights using additional training data. You start with a pre-trained model (like Llama 4 or Qwen 3.5) and continue training it on your specific dataset. The model learns the patterns in your data and incorporates them into its behavior. Fine-tuning is NOT:- Prompt engineering (just putting instructions in the system prompt)
- RAG (Retrieval-Augmented Generation, where you give the model documents at query time)
- Continued pre-training on raw text (that's far more expensive and rarely needed)
Fine-tuning sits between prompt engineering (zero cost, limited customization) and full pre-training (massive cost, complete control). For most practical use cases, fine-tuning is the right tool.
When You Actually Need Fine-Tuning
Before investing time in fine-tuning, ask yourself if you actually need it. Fine-tuning is the right choice when:
You need consistent style or format. If you want every output to follow a specific template — JSON with exact fields, a particular writing voice, structured reports in a fixed format — fine-tuning bakes this in reliably. You have domain-specific knowledge that doesn't exist in the base model. Your internal company jargon, proprietary product names, specialized medical or legal terminology, or industry-specific procedures that weren't in the training data. Prompting isn't working well enough. You've tried extensive prompting and the model still gets things wrong. Fine-tuning on examples of correct behavior fixes this at the weight level. You want faster inference without the overhead of large system prompts. A fine-tuned model can "know" things without you needing to explain them every request, reducing token usage and improving speed. RAG isn't sufficient. Sometimes you need the model to internalize knowledge rather than just retrieve it. For reasoning patterns, writing styles, and classification tasks, fine-tuning outperforms RAG.LoRA: The Technique That Made Fine-Tuning Accessible
The breakthrough that democratized fine-tuning is called LoRA — Low-Rank Adaptation.
Here's the problem LoRA solves: a full fine-tune of a 7B model requires updating 7 billion parameters. With a GPU that has 24 GB of VRAM, that's not feasible — the model weights alone don't even fit in memory during training.
LoRA inserts small, trainable "adapter" matrices into the model's attention layers. Instead of updating all 7 billion weights, you only train these small adapters — typically 1–5% of the total parameters. The original model weights stay frozen.
The result: training a 7B model with LoRA requires about 6–10 GB of VRAM instead of 60+ GB. The quality of the fine-tuned model is usually 95–99% as good as a full fine-tune. Training time drops from weeks to hours.
QLoRA (Quantized LoRA) takes this further by loading the base model in 4-bit quantization during training, reducing VRAM requirements even more. A 7B model can be fine-tuned with QLoRA on a GPU with just 8 GB of VRAM.Building Your Dataset: The Most Important Step
The quality of your fine-tuned model depends almost entirely on the quality of your training data. This is where most beginners underinvest.
What your dataset should look like:For instruction fine-tuning (the most common type), each data point is a prompt-response pair. You're showing the model examples of "when given this kind of input, respond like this."
Format example:
{
"instruction": "Summarize this customer complaint and classify its severity.",
"input": "I ordered a laptop on March 5th and it still hasn't arrived. My order says delivered but I never received it. This is the third time this has happened with your company.",
"output": "SUMMARY: Customer reports non-delivery of laptop ordered March 5th, despite system showing delivered. Third recurring issue with same customer.
SEVERITY: High — repeated delivery failures with same customer, high churn risk."
}
How many examples do you need?
The honest answer: fewer than you think. For style and format adaptation, 100–500 high-quality examples can produce significant improvements. For domain-specific knowledge, 500–2,000 examples typically produces a strong result. For complex classification or reasoning tasks, 2,000–10,000 examples is common.
Quality beats quantity. 200 excellent, consistent, carefully crafted examples will outperform 2,000 messy, inconsistent ones.
Creating your dataset:Option 1: Manually write prompt-response pairs. Slow but produces the highest quality data.
Option 2: Extract from existing data. If you have customer support tickets and their resolutions, sales emails and their outcomes, or technical documentation and Q&A pairs, you already have training data.
Option 3: Use a strong model to generate synthetic data. Give GPT-4o or Claude your task description and ask it to generate 100 diverse examples. Then review and filter them. This is the fastest way to bootstrap a dataset.
Tools: What to Actually Use
Unsloth is the recommended starting point for most beginners. It's a Python library that wraps the fine-tuning process, automatically handles LoRA and QLoRA setup, and is 2–5× faster than naive implementations. Works with Llama, Qwen, Mistral, and Gemma. Free, open-source, excellent documentation. Axolotl is more configurable than Unsloth and better for production-grade fine-tuning pipelines. Requires more setup but handles more complex scenarios. LLaMA-Factory provides a web UI for fine-tuning — useful if you're less comfortable with Python. Point it at your dataset, configure your settings, click start. Hugging Face Transformers + PEFT is the most flexible but also the most complex. Use this if you need maximum control over the training process or are doing research.For most people starting out: use Unsloth.
A Practical Step-by-Step Example
Here's a concrete walkthrough for fine-tuning a Llama 3.1 8B model on a customer support dataset using Unsloth and QLoRA on a single GPU.
Step 1: Set up your environmentpip install unsloth datasets transformers trl
Step 2: Prepare your dataset in JSONL format
Each line is one training example: {"instruction": "...", "input": "...", "output": "..."}
Step 3: Write your training script
from unsloth import FastLanguageModel
from datasets import load_dataset
from trl import SFTTrainer
# Load model with 4-bit quantization
model, tokenizer = FastLanguageModel.from_pretrained(
model_name="unsloth/llama-3.1-8b-instruct",
max_seq_length=2048,
load_in_4bit=True,
)
# Add LoRA adapters
model = FastLanguageModel.get_peft_model(
model,
r=16, # LoRA rank — higher = more capacity, more VRAM
lora_alpha=16,
target_modules=["q_proj", "k_proj", "v_proj", "o_proj"],
)
# Load your dataset
dataset = load_dataset("json", data_files="your_dataset.jsonl")
# Train
trainer = SFTTrainer(model=model, tokenizer=tokenizer, train_dataset=dataset["train"])
trainer.train()
# Save the LoRA adapter
model.save_pretrained("my-fine-tuned-model")
Step 4: Run and monitor
Training on 1,000 examples for 3 epochs on an RTX 4060 Ti (16 GB) takes about 45–90 minutes. Monitor your training loss — it should decrease steadily. If it oscillates wildly or increases, lower your learning rate.
Step 5: Test and iterate
Run your fine-tuned model on examples from your test set. Evaluate outputs manually. Identify failure patterns. Add more training examples addressing those failures. Re-train.
Common Mistakes to Avoid
Using too low a learning rate. The default learning rate in most frameworks is often too conservative for small datasets. Start with 2e-4 for LoRA fine-tuning. Catastrophic forgetting. If you fine-tune too aggressively on a small dataset, the model forgets general capabilities. Keep your LoRA rank moderate (r=16 or r=32) and don't train for too many epochs (3–5 is usually right). Not evaluating on a holdout set. Keep 10–20% of your data for evaluation. If your training loss is low but evaluation loss is high, you're overfitting. Ignoring data quality. One bad pattern in your training data will be reliably reproduced. Review your dataset carefully before training. Starting with a model that's too large. Fine-tuning a 70B model when a 7B model would do is a waste of compute. Start small, evaluate, and scale up only if needed.What You Can Realistically Achieve
With a single RTX 4060 Ti (16 GB) and a weekend of effort:
- Fine-tune a 7B model on 1,000–5,000 examples
- Create a customer support bot that knows your products
- Build a document classifier trained on your categories
- Develop a writing assistant that matches your company's style guide
- Train a code assistant on your internal codebase conventions
The barrier to building domain-specific AI has never been lower. The tools are free, the hardware requirements are accessible, and the results are genuinely impressive.
Browse models suitable for fine-tuning in the Model Library → Explore training datasets in the Dataset Hub → Read the full fine-tuning guide with LoRA and DPO details →