Skip to content
26 / Answers

Fine-tuning teaches behaviour, not facts.

Fine-tuning takes a pretrained language model and trains it further on your own examples of input and ideal output, so it adopts a style, a format or a narrow skill. It is the right tool when the model knows enough but behaves wrong. It is the wrong tool for knowledge that changes, which retrieval handles better. With LoRA and QLoRA it fits on a single GPU.

Changes
Style, format, task behaviour
Does not fix
Missing or changing knowledge (use RAG)
Needs
Hundreds to thousands of clean examples
I built
FineTune Studio, a QLoRA platform
  • 5production AI apps
  • 14engineers led
  • 200+students mentored
01

Questions students ask

The fine-tuning questions searched most, answered from building a fine-tuning platform.

What is fine tuning LLM?

Fine-tuning a large language model means continuing its training on a smaller, targeted dataset so that its outputs shift towards what that dataset shows. The base model already knows language and a great deal about the world from pretraining; fine-tuning does not add much knowledge but reshapes behaviour: the tone it writes in, the format it returns, how it handles a specific kind of task, which of several plausible answers it prefers. Instruction tuning, the step that turns a raw model into a chat assistant, is itself a fine-tune. Your fine-tune is the same idea, pointed at your task.

How does fine tuning LLM work?

You assemble examples as pairs (a prompt and the response you want), feed them through the model, compare its predicted tokens with the target tokens, and nudge the weights with gradient descent to make the target more likely. Repeat over the dataset for a few passes. Full fine-tuning updates every weight, which needs memory several times the model's size. Parameter-efficient methods such as LoRA freeze the base weights and train small adapter matrices instead, cutting memory and producing a compact adapter you can swap or share. The result is evaluated on held-out examples against the base model before anyone trusts it.

Training vs fine tuning LLM

Training from scratch (pretraining) starts from random weights and consumes trillions of tokens of text on thousands of GPUs over weeks; it produces a model that knows language and the world. Fine-tuning starts from that pretrained model and uses thousands of examples on one or a few GPUs over hours; it produces a model that behaves the way your examples do. Nobody fine-tuning for a product is training a model. When someone says 'we trained our own AI', they almost always mean fine-tuned, or more often, built retrieval over their documents without training anything at all.

What is LoRA fine tuning?

LoRA (low-rank adaptation) fine-tunes by adding two small matrices to selected layers of the model, whose product approximates the weight change full training would make, and training only those. The base weights stay frozen, so memory for gradients and optimiser state drops dramatically, training is faster, and the output is a small adapter file instead of a full copy of the model. QLoRA goes further by holding the frozen base in 4-bit precision, which is how a seven- or eight-billion-parameter model fine-tunes on a single consumer GPU. FineTune Studio, the platform I built, runs QLoRA with base-versus-tuned comparison built in.

How to fine tune LLM locally

  • Pick an open model that fits your GPU in 4-bit: a seven- or eight-billion-parameter model needs roughly six to ten gigabytes of VRAM with QLoRA.
  • Prepare a dataset as JSON Lines with prompt and response fields in a consistent chat format; hold out ten per cent.
  • Use Hugging Face Transformers with PEFT and TRL, or a wrapper such as Unsloth or Axolotl that configures them for you.
  • Train for one to three epochs with a small learning rate; watch training and validation loss.
  • Merge the adapter or keep it separate; export to GGUF to run the result in Ollama.
  • Compare base and tuned outputs on the held-out prompts before using it for anything.

How to fine tune LLM for specific task

Define the task precisely as an input-output contract: given this kind of input, produce output in exactly this shape. Collect examples that cover the real variety of inputs, including awkward ones, and make the outputs consistent, because the model will learn your inconsistencies. Try prompting with a few examples first; if that already works, you do not need to fine-tune. If it does not, fine-tune a small model on a few hundred examples, evaluate on held-out cases with a scoring rule that matches the task (exact match for extraction, a rubric for writing), and add examples where it fails. Narrow tasks fine-tune well; vague ones do not.

How to prepare dataset for fine tuning

The dataset decides the outcome. Gather real inputs from your use case, not invented ones. Write or curate the ideal response for each; a careful person with domain knowledge beats a model at this, and a model can draft for the person to edit. Normalise format strictly: one chat template, consistent fields, no stray whitespace. Deduplicate, remove anything personal or confidential, and balance the categories so one type does not dominate. Split into train and held-out sets before you look at results. Three hundred excellent examples beat three thousand noisy ones; I have watched that play out on FineTune Studio more than once.

Can you fine tune GPT 4?

OpenAI offers fine-tuning through its API for a selected set of its models, and newer GPT-4-class models have been on that list, so yes for the models they expose, with the data uploaded to them and the tuned model hosted by them. You cannot download the weights, and the available models and prices change, so check the current fine-tuning documentation. The trade-off against open models: hosted fine-tuning is convenient and gives you a stronger base, while open-model fine-tuning gives you ownership, local execution and control over data. Many teams prototype on hosted and move to open for scale or privacy.

How to fine tune GPT

Prepare a JSON Lines file of chat conversations in the provider's format, with system, user and assistant messages per example, and a separate validation file. Upload the files through the API, create a fine-tuning job naming the base model and files, and wait for it to finish; the job reports training loss and produces a new model identifier. Call that identifier in place of the base model. Evaluate on prompts the model has not seen and compare with the base model using the same prompts. Keep the dataset under version control, because the next iteration will be about fixing the examples, not the training settings.

Difference between RAG and fine tuning

RAG supplies knowledge at answer time by retrieving passages from your documents and letting the model read them; it updates by adding a file, cites its sources, and fails visibly when retrieval misses. Fine-tuning changes the model's behaviour by training on examples; it updates by retraining, cannot cite, and fails quietly when inputs drift. If the model does not know something, use RAG. If it knows but does it wrong, fine-tune. Many products use both, a lightly tuned model inside a retrieval pipeline. Having built RAG.NextUpgrad and FineTune Studio in the same year, I start with RAG and fine-tune only for what retrieval cannot fix.

02

Your first fine-tune

A weekend on one GPU, with a result you can trust.

  1. 01

    Prove prompting is not enough

    Ten failing examples that few-shot prompting cannot fix. If it can, stop here.

  2. 02

    Three hundred clean pairs

    Real inputs, ideal outputs, one format, ten per cent held out.

  3. 03

    QLoRA on a small open model

    One to three epochs; watch validation loss; export the adapter.

  4. 04

    Compare before shipping

    Base versus tuned on the held-out set, scored blind. Keep what wins.

03

In the room

Where these systems get explained to students.

A model that behaves your way?

I run fine-tunes with honest before-and-after evaluation, and I will tell you if you do not need one.