Close-up of an NVIDIA GeForce RTX graphics card, the kind of GPU used to fine-tune language models with Unsloth
Photo by Christian Wiediger on Unsplash · source · credits

Unsloth Tutorial: Fine-Tune a Small LLM on Free Colab and Run It in Ollama

Also available in Hindi: यह लेख हिंदी में पढ़ें

Fine-tuning used to need expensive GPUs. Unsloth, an open-source library, lets you train a small model on the free T4 GPU in Google Colab and then run the result on your own computer with Ollama. Hugging Face's TRL docs describe it as up to 2x faster with up to 80% less VRAM, and it works with TRL's SFTTrainer.

Before you start: do you need fine-tuning?

Fine-tuning teaches a model a style, format or narrow task. To answer from your documents, start with RAG. The Unsloth docs say the dataset matters most: usually two columns, question and answer, and well-structured data beats a pile of raw documents.

The workflow

Unsloth workflow from free Colab notebook to Ollama in five steps
From Unsloth docs. Illustration, not a screenshot.
  1. Open an Unsloth notebook from its docs and connect the free T4 GPU. Run every cell in order. Do not skip any.
  2. Load a 4-bit instruct model. Unsloth suggests beginners start with a small instruct model such as Llama 3.1 (8B). Instruct models need less data than base models. load_in_4bit = True is QLoRA, which cuts memory use about 4x.
  3. Add LoRA adapters. LoRA trains small extra matrices instead of every weight. The notebooks use r = 16 and lora_alpha = 16.
  4. Train. max_steps = 60 is a quick test. For a real run, use num_train_epochs = 1. Unsloth recommends 1 to 3 epochs. More can overfit.
  5. Export and run (below).

Read the training loss

A loss around 0.5 to 1.0 is often a good sign, though it depends on your data. If it does not fall, change your settings or data. If it drops to 0, the model is probably memorizing, so check it on examples it has not seen.

Save it for Ollama

Unsloth save options: LoRA adapter, merged 16-bit and GGUF
From Unsloth docs. Illustration, not a screenshot.

The LoRA adapter alone is about 100 MB. For Ollama or llama.cpp, export GGUF:

model.save_pretrained_gguf("my_model", tokenizer, quantization_method = "q4_k_m")

q4_k_m is a popular, smaller choice. q8_0 keeps more quality but the file is bigger. Export can take 5 to 10 minutes. Unsloth's Ollama notebook also creates the Modelfile with your chat template, so you can run ollama create and then ollama run.

Prefer no code? Unsloth Studio is a newer web interface for training and exporting.

Already running models locally? Read where Ollama stores models, the best tools to run LLMs locally and our LM Studio local API guide, or see the Unsloth tool page.

Sources

FAQ

Is Unsloth free?

The open-source library is free. You can train on Colab's free T4 GPU, Kaggle or your own GPU.

Which model should a beginner use?

A small instruct model, such as Llama 3.1 (8B) in 4-bit.

How many epochs should I train?

Test with 60 steps, then train 1 to 3 epochs. More can overfit.

Can I run the fine-tuned model offline?

Yes. Export to GGUF and load it in Ollama or llama.cpp.

About the author

Suraj Kumar builds and edits AIUseFlow, a directory of AI tools for vibe coders, agent builders and creators. Guides like this one walk through a practical workflow with cited sources — not a news wire rewrite. How we rank tools.

Get the weekly stack

Rank movers and new AI tools for builders, once a week. Free, no spam, unsubscribe anytime.