How Deep Learning Becomes a Large Language Model

An LLM is a very large deep neural network trained on text. During training, it repeatedly predicts missing or next tokens, measures its errors, and adjusts billions of parameters across many layers. During inference, it keeps those parameters mostly fixed and uses them to predict one next token at a time.

1. Text examples 2. Training changes weights 3. Prompt goes in 4. Tokens come out 5. Data patterns can carry bias

Bridge from deep learning to LLMs: the previous page showed that a neural network is built from layers, weights, and mathematical bias terms. An LLM uses the same idea at a much larger scale. Transformer layers process relationships between tokens; training adjusts huge numbers of weights; inference runs those layers repeatedly to generate text. The mathematical bias term inside a neuron is not the same thing as social or cultural bias in an output.

How an LLM is made and run
1. Build the deep-learning structure

Engineers create a transformer: many neural-network layers with attention mechanisms that connect tokens to relevant context.

2. Train and align the model

Text becomes tokens. The model predicts tokens, compares predictions with training targets, and uses error feedback to adjust its parameters. Further tuning and human feedback shape behaviour.

3. Run inference

Your prompt is tokenised and passed through every layer. The model calculates next-token probabilities, selects a token, appends it, and repeats until the response ends.

Why it is expensive: a large model may contain billions of parameters. Training repeats calculations across vast datasets; inference must load and use those parameters for every generated token.
Why bias can appear
Biased or incomplete data + design choices + feedback and evaluation gaps → unequal or misleading outputs
Training data reflects society

Text can contain historical inequalities, stereotypes, dominant viewpoints, missing communities, and unequal representation across languages and cultures.

People make design choices

Dataset selection, filtering, labels, model objectives, safety rules, and human-feedback processes all influence which behaviours are rewarded or suppressed.

Context changes the result

Prompts, deployment settings, probability-based token selection, and weak testing for particular groups can expose or amplify learned patterns.

Responsible response: treat outputs as generated predictions—not neutral truth. Check evidence, test across different people and contexts, involve affected communities, and provide human review for consequential decisions.
The Big Picture
An LLM does not normally look up a fixed answer while it is writing. It has already learned patterns during training, then it uses those patterns to predict what word piece, or token, should come next.
1

Text Examples

The model starts with many examples of written language.

2

Training

It practises predicting tokens and adjusts its weights when it is wrong.

3

Learned Weights

The learned patterns are stored as numbers inside the model.

student -> asks asks -> question teacher -> explains
4

Inference

A prompt goes in, then the model predicts one next token at a time.

prompt -> next token -> output
1

Split Text

Text is broken into tokens. A token can be a word, part of a word, or punctuation.

2

Learn Patterns

During training, the model practises predicting the next token from earlier tokens.

3

Save Weights

The useful patterns are saved in weights. This demo shows them as a small table.

4

Generate

During inference, the model uses the prompt and weights to produce tokens one by one.

Try the Process

Choose a tiny dataset, show what patterns training finds, then run inference from a prompt.

Training learns from examples Inference uses learned weights Generation repeats next-token prediction
What Training Produces

In a real LLM, training adjusts billions of weights. In this teaching demo, we show that idea as a small memory table of token patterns.

Seen Context Possible Next Token Why It Learned That
Inference Walkthrough

The model starts from the prompt, checks which patterns match the recent context, then picks the most likely next token.

Next-Token Probabilities

This is the core of inference: after training, the model gives candidate next tokens different probabilities.

Sample Output
Training vs Inference Log
System ready.