LLM Fundamentals and Why Fine-Tune

A language model is a model of text. Given the words so far, it estimates what comes next. A large language model (LLM) is that idea scaled up — many parameters, huge training data, usually built on transformers.

Intuition

Core job in one line: predict the next token.

Example: “The cat sat on the ___”

The model assigns probabilities to possible next words:

Next word Probability
mat 0.41
sofa 0.22
floor 0.18
roof 0.06
refrigerator 0.001

It then picks one, adds it to the sentence, and repeats the whole process for the following word. Everything an LLM does — chat, summarising, writing code — is this one step run over and over.

How it works

What “large” adds

Scale (parameters + data + compute) is why modern LLMs can:

Well-known families include GPT, Claude, Gemini, and Llama-style open-weight models.

Three common LLM shapes

Type Plain-English idea Typical uses
Encoder-only Looks both left and right (bidirectional). Great at understanding. Classification, NER, similarity, search embeddings (BERT family)
Decoder-only Reads left-to-right; generates the next token. Chat and free-form generation (GPT-style)
Encoder–decoder Encoder reads input; decoder writes output. Translation-style and many sequence-to-sequence tasks

An easy way to remember the difference:

Almost every chat assistant you use today is decoder-only.

The usual training stages

Stage What happens
Pretraining Learn general language from huge unlabeled text
Fine-tuning Adapt to a task, domain, or instruction style with more focused data
Safety / alignment Extra training so the model follows policies and behaves more helpfully/safely

Why fine-tuning is often necessary

A general pretrained model is a strong starting point, but many products need:

Fine-tuning updates the model on task-specific data so those habits become part of the weights.

A concrete example

An insurance company wants every claim note summarised in exactly this shape:

CLAIM: <id>
LOSS TYPE: <fire | flood | theft | other>
AMOUNT: <number or unknown>
NEXT ACTION: <one sentence>

With prompting, the model gets it right most of the time, but on maybe 1 note in 12 it adds a friendly sentence at the top, or writes “Fire damage” instead of fire. At 4,000 notes a day, that is hundreds of broken records.

After fine-tuning on 2,000 correctly formatted examples, the format becomes a habit instead of a request. The prompt can then be short, because the model has already learned what the answer should look like.

That is the real test for fine-tuning: do you need this behaviour every single time, forever?

What goes wrong

One-line summary

LLMs learn next-token prediction at huge scale; fine-tuning is how you turn that general skill into stable, task-specific behavior.

Key terms