I Fine-Tuned My Own AI Model. Here's What Actually Happened.
Not a tutorial. Just a record of what I was curious about, what I tried, and what I learned.
I didn't set out to train an AI model today.
I just wanted to understand how it works — the actual mechanics underneath. What happens between "here's a bunch of text" and "here's a model that can talk." I've been using these tools long enough that not knowing felt like a gap I couldn't ignore anymore.
So I started asking questions. And one question led to another until I found myself staring at a T4 GPU on Google Colab, watching a loss curve drop in real time.
This is that story.
The First Question
How do you actually train an AI?
Turns out there are two very different answers depending on what you mean by "train."
From scratch means you start with nothing — random weights, billions of parameters, and you feed the entire internet into it over weeks on server farms. That's what companies like Anthropic and Meta do. That's not for me, not for my RTX 2050, not for any solo builder on a laptop.
Fine-tuning means you take a model that already understands language — already went through that brutal first phase — and you continue training it on your specific data. You're not teaching it how to speak. You're steering existing knowledge toward a specific behavior.
That second path is real. That second path is actually mine.
Understanding What's Inside These Models
Before jumping into fine-tuning, I needed to understand what these models actually are.
Parameters and training data are two separate axes — and most people conflate them.
Parameters = capacity. The size of the brain.
Training data = what fills that capacity. The education.
A 7B model was probably trained on 1–2 trillion tokens — Common Crawl web scrapes, Wikipedia, GitHub, books, papers, years of news, Reddit. A 70B on 3–5 trillion. Frontier models — nobody knows exactly, but estimates land around 10–15 trillion tokens or more.
The reason models keep getting bigger isn't arbitrary. There are actual scaling laws — research showing that if you double the parameters, you should also double the training data to use that capacity efficiently. A bigger brain can hold more complex patterns, longer reasoning chains, more nuanced relationships between ideas.
But here's what clicked for me: a good 3B model that was pre-trained on quality data already knows language, knows the world, knows how to reason. When you fine-tune it, you're not rebuilding any of that. You're just steering what already exists.
A fine-tuned 3B can absolutely outperform a raw 7B on a narrow task. Not theory — that's what the community has shown repeatedly.
The VRAM Problem Nobody Talks About Clearly
I have an RTX 2050 with 4GB of VRAM. I've been running qwen2.5:7b-instruct-q4_K_M locally through Ollama and it worked — but it was slow. Noticeably, frustratingly slow.
I checked Task Manager. RTX sitting at 30%. CPU spiking to 60%.
That's the split. Ollama was loading part of the model on GPU, the rest on CPU RAM — because the model didn't fully fit. Every single generated token had to pass through both. That CPU spike was the bottleneck.
One command changed everything:
ollama ps
It showed me: 55 layers on CPU, 45 on GPU. More than half the model was running on my RAM. The model size was 5.1GB. My usable VRAM after Windows reserves its cut — maybe 3.2GB. It couldn't fit.
The fix wasn't complicated. Switch to a model that actually fits.
Qwen2.5 7B q4_K_M ? ~4.5GB ? splits CPU/GPU ? slow
Qwen2.5 3B q4_K_M ? ~2GB ? 100% GPU ? fast
Llama 3.2 1B ? ~0.8GB ? 100% GPU ? blazing
I tested llama3.2:1b — 100% GPU. The speed difference was immediately obvious.
For local inference on a 4GB card, anything above 3B is going to split. That's just the math.
What q4 Actually Means
I kept seeing q4_K_M everywhere without fully understanding it. Turns out it's simpler than it sounds.
Quantization is about precision, not knowledge.
The original model stores each weight in 16-bit or 32-bit floating point — precise decimal numbers. q4 compresses each weight down to 4 bits — rougher, less precise numbers. Same education. Same knowledge. Just stored less precisely.
If fp16 is remembering "the answer is 3.748291" — q4 is remembering "the answer is around 3.7."
The community has measured this extensively. q4_K_M typically shows about 2–5% performance drop compared to full precision. For instruction following, tool calling, summarization — you'd never notice. For precise mathematics or extremely subtle reasoning — maybe. The K_M part means it uses a smarter compression algorithm that preserves quality better than basic q4.
The tradeoff is just worth it for local inference.
The Actual Fine-Tuning Run
For fine-tuning, I needed Colab — specifically the free T4 GPU with 15GB VRAM. That changes what's possible significantly. 7B models become comfortable. Even 14B is possible with the right settings.
The framework: Unsloth with QLoRA.
QLoRA means instead of retraining all parameters — too heavy, too slow — you attach a small trainable adapter layer on top of the frozen base model. Only that adapter gets updated. Unsloth handles the memory optimization automatically.
The dataset: glaive-function-calling-v2 from HuggingFace. 2000 examples of tool calling conversations. Publicly available, free, one line to download.
raw_dataset = load_dataset("glaiveai/glaive-function-calling-v2", split="train[:2000]")
Training took about 30 minutes on T4. The loss curve:
Step 10 ? 1.318
Step 50 ? 0.534
Step 90 ? 0.457
Dropping cleanly. The model was learning.
After training: export to GGUF q4_K_M, copy to Google Drive, download to local machine, load into Ollama.
The Test
Before benchmarking, I ran a quick sanity check. I asked the fine-tuned model:
"Get me the current weather in Jakarta."
It responded:
{
"action": "get_weather",
"data": {
"city": "Jakarta"
}
}
No explanation. No rambling. Just the structured tool call. Before fine-tuning, the base model on the same prompt would answer in plain text — "I can help you with the weather in Jakarta, but I don't have real-time access..."
One is a chatbot. The other is an agent. That's the difference fine-tuning made.
Benchmark Results
I wrote a benchmarking script — 15 test prompts across three categories, both models scored 0–2 per response. Results:
Base model 18/30 (60%)
Fine-tuned 26/30 (87%)
The most telling category was edge cases. "I need help." — the base model called a help tool. The fine-tuned model understood it was an ambiguous request and asked a clarifying question. "Do something with the files." — base called file_management. Fine-tuned asked what specifically needed to be done.
That judgment — knowing when to act versus when to ask — is what training data teaches.
The one weakness: tool name consistency. The model learned the pattern of tool calling correctly but improvises specific names based on what the glaive dataset used. send_telegram vs send_telegram_notification vs send_telegram_message — all structurally correct, all variations of the same intent.
The fix is custom training data with exact tool names defined. That's the next round.
What I Actually Learned
A few things that shifted how I think about all of this:
The moat is data, not architecture. Transformer architecture is public. The competitive advantage companies have is how well they filter and curate their training data. Llama 3 was a bigger jump over Llama 2 not because of architectural changes — mostly because they cleaned the pre-training data significantly better.
Small fine-tuned models are real. A 3B model fine-tuned on 200 high-quality examples of your specific workflow will outperform a raw 7B on that workflow. This isn't a consolation prize for not having better hardware. It's genuinely the right approach for narrow tasks.
VRAM is the actual constraint. Not intelligence, not architecture, not even quantization. VRAM determines what's possible locally, and understanding the math — model size, context window overhead, layer splitting — makes everything else make sense.
Synthetic data generation is the next frontier. For round two, I'm planning to use a stronger cloud model to generate the custom dataset — exactly the tool names, exactly the workflow patterns I need. The community calls this synthetic data generation. It's how a lot of serious fine-tuning projects work at speed.
What's Next
The model exists. It runs locally on my machine at 100% GPU. It knows how to call tools.
What it doesn't know yet is my tools — the specific names, the specific workflows, the exact way my PERSONAL_OS documentation pipeline works, what parameters my Telegram bot expects, how OpenClaw handles task execution.
That's the next round. Custom dataset. My stack. My naming conventions.
The foundation is built. Now I build on it.
This post is part of an ongoing series on building things with whatever I have.
Tools used: Google Colab, Unsloth, HuggingFace, Ollama, Python, and a lot of patience.