LLM fine-tuning guides: GPT models, Gemma 3, Gemini, Unsloth, examples, courses, data

A step-by-step LLM fine-tuning guide, OpenAI GPT fine-tuning, Gemma 3, Gemini and Unsloth tutorials, examples, quantization, courses and datasets.

Presenting to a room
Presenting to a room

Key takeaways

  • Define the task and metric, baseline with prompting, then fine-tune with clean, well-formatted data.
  • GPT-3 fine-tuning is retired, and newer GPT models are tuned through OpenAI's API.
  • Gemma 3 and Unsloth notebooks make QLoRA fine-tuning practical on free or consumer GPUs.
  • Quantization compresses models, fine-tuning changes behaviour, and QLoRA combines both.
  • Your own task data beats public datasets, which help for general skills and reducing forgetting.

Fine-tuning adapts a pretrained language model to your task with examples, and today it is practical on a single GPU thanks to LoRA and QLoRA. Good guides differ mainly by platform: OpenAI's API, Google's Gemma and Gemini, or open tools like Unsloth. I built FineTune Studio for QLoRA fine-tuning with Transformers, PEFT and TRL, so this page covers a step-by-step guide, GPT models, Gemma 3, Gemini, Unsloth, examples, quantization, courses and datasets.

What is a step-by-step guide to fine-tuning LLMs?

Define the task and success metric, try prompting first as a baseline, collect high-quality examples, format them with the model's chat template, choose a base model and method such as QLoRA, train, then compare tuned and base models on held-out data.

Also asked as: gpt-3 fine tuning guide

After evaluation, iterate on data rather than hyperparameters, since data quality usually matters most. Deploy the adapter with the base model, or merge and quantize it for efficient serving. Monitor outputs in production and collect failures for the next round. Keep everything versioned: dataset, configuration, adapter and evaluation results. FineTune Studio follows these steps, streaming live loss over WebSockets and showing base-versus-tuned outputs side by side so improvements are visible.

How do you fine-tune GPT models, including GPT-3?

OpenAI introduced fine-tuning for GPT-3 base models in 2021, but those legacy models have been retired. Today you fine-tune newer GPT models through OpenAI's fine-tuning API, uploading JSONL files of chat-formatted examples and starting a job.

Prepare examples with system, user and assistant messages showing the exact behaviour you want, validate the file, and upload a separate validation set. OpenAI reports training and validation loss, and the resulting model gets its own ID for API calls. Some models also support preference fine-tuning and reinforcement fine-tuning for reasoning tasks. Compare tuned results against prompting with the base model, since newer models often need fine-tuning less than older ones.

What does a Gemma 3 fine-tuning tutorial cover?

Gemma 3 tutorials typically load an instruction-tuned Gemma model in 4-bit precision, attach LoRA adapters with PEFT, format data with Gemma's chat template, train with TRL's SFTTrainer on a free or consumer GPU, and evaluate the results.

Also asked as: gemma 3 fine tuning tutorial

Gemma 3 comes in several sizes, from very small models suited to phones up to 27 billion parameters, so choose the smallest size that meets your quality bar; smaller sizes also train faster, speeding iteration. Google's documentation provides Keras and Hugging Face tutorials, and Unsloth offers optimised notebooks. Watch for Gemma's specific chat format and licence terms. After training, merge adapters and export to GGUF to run locally with Ollama or llama.cpp.

What is an example of fine-tuning Gemini?

An example: fine-tune Gemini Flash on Vertex AI to classify customer support tickets into categories and urgency levels, using a few hundred labelled examples in JSONL format, then compare accuracy with the base model's prompted performance.

Also asked as: gemini fine tuning example

In Vertex AI, upload training and validation datasets to Cloud Storage, create a supervised tuning job for a supported Gemini version, and monitor metrics in the console. The tuned model gets an endpoint you call like any Gemini model. Tuning suits consistent output formats, domain-specific classification or a particular writing style. For knowledge that changes, use retrieval instead. Budget for training and serving costs, which differ from base model usage, and keep a held-out set to verify gains.

What does an Unsloth fine-tuning tutorial cover?

Unsloth tutorials load a model with FastLanguageModel in 4-bit, add LoRA adapters, prepare a dataset with the right chat template, train with TRL's SFTTrainer, test generation, and save adapters or export merged models to GGUF for Ollama.

Also asked as: unsloth tutorial fine tuning

Unsloth's optimised kernels speed up training and cut memory use, letting larger models fit on free Colab GPUs or consumer cards. Its notebooks cover popular models such as Llama, Qwen, Gemma and Mistral, plus reinforcement learning methods such as GRPO for reasoning. Start with a provided notebook, swap in your dataset, and change one setting at a time. Compare outputs before and after training on held-out examples to confirm genuine improvement.

What are examples of fine-tuning LLMs?

Common examples include teaching a model a company's support tone, extracting fields from invoices into fixed JSON, classifying tickets or documents, following a code style, summarising medical or legal text in a set format, and improving tool calling for an agent.

Also asked as: examples of fine tuning llm

Others include adapting models to Indian languages or code-mixed text, generating product descriptions in a brand voice, and distilling a large model's skill into a small, cheap model. Fine-tuning works best for consistent behaviour on narrow tasks, not for adding facts that change. FineTune Studio demonstrates the pattern with QLoRA and side-by-side comparisons, which reveal whether a dataset actually improved the behaviour you targeted.

What is the difference between quantization and fine-tuning?

Quantization compresses a model's weights to lower precision, such as 4-bit, so it uses less memory and runs faster, slightly reducing quality. Fine-tuning changes a model's weights or adds adapters to teach new behaviour. They serve different goals and combine well.

Also asked as: quantization vs fine tuning

QLoRA combines them during training: the base model is quantized to 4-bit to save memory while small LoRA adapters are trained in higher precision. After fine-tuning, you can also quantize the merged model to formats such as GGUF or AWQ for efficient serving; Q4_K_M and similar formats balance size and quality well. Quantization never teaches new skills, and fine-tuning does not make models smaller. Evaluate quality after both steps, since aggressive quantization can undo fine-tuning gains.

What is a full course on fine-tuning LLMs?

Strong free options include the Hugging Face LLM Course and smol course, DeepLearning.AI short courses on fine-tuning and reinforcement fine-tuning, Maxime Labonne's open LLM Course on GitHub, and Unsloth's documentation with notebooks.

Also asked as: fine tuning llm full course

A complete path covers transformer basics, data preparation and chat templates, supervised fine-tuning with LoRA and QLoRA, preference tuning with DPO, reinforcement methods such as GRPO, evaluation, quantization and deployment. Practise each stage with a small model on a real task. Books such as Hands-On Large Language Models and the LLM Engineer's Handbook add depth. Join communities such as the Hugging Face forums for help when stuck. Finish with a project that measurably improves a model.

Is there a good LLM fine-tuning course on Udemy?

Udemy has several LLM fine-tuning courses; choose ones updated recently, covering LoRA, QLoRA, chat templates, evaluation and deployment with current libraries such as TRL, PEFT and Unsloth, taught by instructors with real projects.

Also asked as: llm fine tuning course udemy

Check preview lessons, update dates and recent reviews, and avoid courses built on outdated APIs or retired models. Good courses include hands-on notebooks you can run on free GPUs and explain why choices matter, not just which buttons to press. Since free resources from Hugging Face and DeepLearning.AI cover much of the same ground, use paid courses for structure and support. Courses frequently go on sale, so compare before enrolling.

What are the best fine-tuning datasets?

The best dataset is usually built from your own task. Useful public datasets include the Tulu 3 SFT mixture and OpenHermes for general instructions, UltraChat for conversation, code instruction sets such as Magicoder, maths sets such as MetaMathQA, and UltraFeedback for preferences.

Also asked as: best fine tuning datasets

For multilingual and Indian language work, datasets such as Cohere's Aya collection help. Check licences carefully, since some datasets include outputs from commercial models with usage restrictions. Clean duplicates, fix formatting and remove low-quality examples before training. Mixing a general dataset with your domain data can reduce forgetting. Hold out a test set matching real usage, review random samples manually, and document dataset sources so results stay reproducible.

Sources

  1. OpenAI, Fine-tuning guideplatform.openai.com
  2. Google, Gemma fine-tuning documentationai.google.dev
  3. Google Cloud, Tune Gemini modelscloud.google.com
  4. Unsloth, documentationdocs.unsloth.ai
  5. Maxime Labonne, LLM Coursegithub.com
  6. Dettmers et al., QLoRA: Efficient Finetuning of Quantized LLMsarxiv.org
Pranjul Rathour
Pranjul Rathour
GenAI Engineer · India

GenAI engineer and AI product builder with 2+ years shipping production-grade AI systems: RAG pipelines, fine-tuned LLMs, hybrid retrieval and multi-modal apps across vision, speech and OCR, architected end to end from ingestion to deployment. Leads engineering for SCULT INDIA's 14-member team, founded the 500+ member TechVerse Enclave community and has mentored 200+ students. Three hackathon first prizes: Changethon 2025 (IIT Roorkee), Product Genesis at Vividhotsava 2025 (CSJMU) and BYTEBATTLE (MeetKats).

Open to GenAI roles, hackathon judging, mentorship sessions and guest talks at colleges. For campus sessions the inviting institution covers the visit end to end: travel (a First AC train ticket for journeys up to five hours, a flight for anything longer), accommodation, meals, and pickup and drop; the honorarium and workshop fees are negotiable on WhatsApp or on the call, and requests are welcome from institutions that can cover the visit this way. Email pranjulrathour41@gmail.com.

Keep reading

More on Fine-tuning LLMs

All Fine-tuning LLMs guides →
Campus talks · hackathon judging · mentoring

Want this as a live session at your college?

Open to GenAI roles, hackathon judging, mentorship sessions and guest talks at colleges. For campus sessions the inviting institution covers the visit end to end: travel (a First AC train ticket for journeys up to five hours, a flight for anything longer), accommodation, meals, and pickup and drop; the honorarium and workshop fees are negotiable on WhatsApp or on the call, and requests are welcome from institutions that can cover the visit this way.

Pranjul Rathour, GenAI engineer in India