How Does BERT Differ From GPT?
How BERT (reads both ways) and GPT (writes left to right) are trained and used differently, explained simply for your AI interview.
In short
BERT and GPT both use the transformer design, but BERT is trained to fill in hidden pieces of text using both sides, while GPT is trained to predict the next word from the words before it. So BERT suits understanding tasks like labelling, and GPT suits writing.
11 min readBeginnerCommon · estimateFacts checked 26 November 2026
Say it out loud
Read it once, then say it without looking. Start with the short one; use the long one when they ask you to go deeper.
BERT and GPT both use the transformer design, but they are trained for different jobs. BERT hides some pieces of text and guesses them from both sides, so it is good at understanding text, for example sorting it into labels. GPT predicts the next word from the words before it, so it is built for writing. For a team, I'd pick by the output they need, then test both on their own examples.
BERT and GPT are built from the same kind of transformer blocks, and the 2018 BERT paper says the two models are nearly identical in architecture, apart from how attention is masked. The big difference is how each one is trained and which way it reads. BERT stands for Bidirectional Encoder Representations from Transformers, so it reads the words on both sides of a gap at once.
BERT is trained by hiding 15 percent of the tokens and guessing each hidden one from the words around it. To use it on a job, you add one small extra step on top, called an output layer, which turns the model's answer into a label. Then you fine-tune it on labelled examples. That makes it a good fit for sorting text into categories, such as complaint emails.
OpenAI's GPT-1 post is dated June 2018. It learns by predicting the next word from the words before it, so it reads left to right. Later GPT models, such as GPT-3, can do tasks from instructions and examples in the input, with no retraining. That suits writing.
So my answer to a team is to pick by the output and the cost. A fixed label list often suits a small BERT-style model. Free text, like a draft reply, suits a GPT-style model, with a person checking it before it goes out. A prompted GPT-style model can also pick a label, so I'd test both on past cases and let the results decide.
What is the difference between BERT and GPT, in plain words?
A transformer is the neural network design behind both BERT and GPT. Both use it, so their building blocks are almost the same. What differs is how each one is trained and which way it reads the text.
Attention is how each word decides which other words to look at. The 2018 BERT paper says the two models are nearly identical in architecture, apart from how attention is masked. The mask sets which words a word is allowed to look at.
Think of two new hires on a bank's document team. One gets a loan agreement with some words blanked out, and fills each gap by reading the whole page. The other drafts a letter one word at a time, and can only see the words already written. A bank's complaints team needs both skills: one to sort emails, and one to draft replies.
Key words
- Transformer
- The network design both models are built from, based on attention.
- Token
- A piece of a word that the model reads. A short common word is usually one token, and a long or rare word can be several.
- Bidirectional
- Reading the words on both sides of a word at the same time.
- Pre-training
- The first, large training run on plain text, before any particular task.
- Fine-tuning
- A short extra training run on labelled examples for one task.
How is each one trained?
BERT is trained with a fill-in-the-gap task. The paper masks 15 percent of the tokens at random, and asks the model to predict each hidden one from the words around it. It also learns a second task: whether one sentence really follows another. Half the time it does, and half the time the second sentence is picked at random.
- BERT
Fill in the gaps
Hide 15 percent of the tokens and guess them from both sides. Add a sentence-pair task.
- GPT
Guess the next word
Read the words so far and predict the next token. Repeat for every position in the text.
- Shared
Same building blocks
Both are stacks of transformer layers. The BERT paper calls the two nearly identical apart from attention masking.
The same sentence, two ways to learn
One bank note
a real sentence from the text
BERT: fill in the gaps
Hide 15% of the tokens
pieces of words, picked at random
Guess each hidden piece
uses the pieces on both sides
GPT: guess the next word
Show the words so far
only the words to the left
Guess the next word
repeated for every position
Understands the text
then one small output layer on top
Writes text, word by word
it keeps adding one word at a time
- 1The sentence goes into BERT's training.
- 2The same sentence goes into GPT's training.
- 3Some pieces are hidden, and BERT guesses them.
- 4Each step guesses the next word.
- 5The trained BERT model is used to understand text.
- 6The trained GPT model writes one word after another.
OpenAI's GPT-1 post is dated 11 June 2018. Its training had two stages, as OpenAI's own page put it: learn from a very large amount of text, then fine-tune on smaller labelled sets.
“the BERT Transformer uses bidirectional self-attention, while the GPT Transformer uses constrained self-attention where every token can only attend to context to its left.”
BERT paper (Devlin et al., 2018)
“first we train a transformer model on a very large amount of data in an unsupervised manner”
OpenAI, June 2018 (GPT-1)
Here is one bank note turned into practice both ways. Real BERT hides small pieces of words, not whole words, so this is a simplified picture. The positions are fixed, so the output is the same on every run.
# One bank note, turned into practice the two ways. The hidden positions are fixed, so every run prints the same.
note = ["Refund", "approved", "on", "the", "3rd", "after", "the", "duplicate", "charge"]
# BERT-style: hide some words, then guess them from both sides.
hidden = [1, 4]
masked = ["[MASK]" if i in hidden else w for i, w in enumerate(note)]
print("BERT input: " + " ".join(masked))
print("BERT guesses: " + ", ".join(note[i] for i in hidden))
# GPT-style: show the words so far, then guess the next one.
for i in range(1, 4):
print("GPT input: " + " ".join(note[:i]) + " -> guess: " + note[i])Output
BERT input: Refund [MASK] on the [MASK] after the duplicate charge BERT guesses: approved, 3rd GPT input: Refund -> guess: approved GPT input: Refund approved -> guess: on GPT input: Refund approved on -> guess: the
Which way does each one read the text?
BERT looks at the words on both sides of a gap, in every layer. GPT's attention lets each word look only at the words before it. Looking both ways makes filling a gap easy. Training a model to predict the next word is different.
The BERT paper explains why. Standard language models can only be trained left to right or right to left, since looking both ways would let each word indirectly see itself. So GPT only sees the words to the left. That fits its job, which is to write the next word.
- BERT
Reads both sides
Each word sees the words before and after it. Strong for understanding a whole text.
- GPT
Reads one way
Each word sees only the words before it. Built for writing the next word.
Which one would you pick for a real job?
Take a bank's complaints team. It gets about 40,000 emails a month, and each one needs a category from a fixed list of 12. The team also wants a first draft of a reply for each complaint. These are two different jobs, so they can need two different models. The numbers are made up, but the shape is real.
Two jobs in one bank's complaints team
Sort 40k complaints
into 12 fixed categories
Draft replies for staff
staff check before sending
BERT-style model
reads the whole email at once
GPT-style model
writes the reply word by word
One label per email
chosen from the 12 categories
Draft for a human to edit
never sent without a check
- 1Each complaint email goes to the labelling model.
- 2Each request for a reply goes to the writing model.
- 3The labelling model picks one category for the email.
- 4The draft goes to a staff member, who checks it before it is sent.
The GPT side also works in a second way. GPT-3 showed that a model can do tasks from instructions and examples in its input, with no retraining:
“For all tasks, GPT-3 is applied without any gradient updates or fine-tuning, with tasks and few-shot demonstrations specified purely via text interaction with the model.”
GPT-3 paper (2020)
- 1
Sort the emails
Fine-tune a BERT-style model on labelled past emails. One extra output layer gives one category per email, from the fixed list.
- 2
Draft the replies
Use a GPT-style model with instructions and examples. Its output is free text, so a person reads it before anything is sent.
- 3
Test both on past cases
Run each on a sample of old emails. Count the wrong labels and the weak drafts, and let those numbers decide.
Tip
In the interview, say the choice follows the output and the cost: a fixed label list often suits a small BERT-style classifier, free text suits a GPT-style model, and a prompted GPT-style model can also pick a label, so test both on past emails.
What does the interviewer want to hear?
A strong answer covers
- BERT reads both sides and is trained to fill in hidden pieces.
- GPT reads left to right and is trained to predict the next word.
- Both use the transformer design, so the main difference is training and reading direction.
- BERT is fine-tuned with one small output layer for labels.
- GPT is used to write, and by prompting in later models.
- Pick the model from the output you need, then test on your own examples.
Common traps
Trap"BERT is the newer, better GPT."
BetterTwo designs for two jobs. BERT reads both ways to understand text, and GPT writes forward.
Trap"GPT is just a bigger BERT."
BetterThe main difference is the training task and the reading direction.
Trap"Use the bigger model. It always wins."
BetterCheck the output first. A label from a fixed list and a free-text draft call for different designs.
Can you spot the wrong design?
Spot the wrong design
A team asks for a BERT-style model to draft customer replies. What is wrong with the plan?
Quick check
The bank wants one category for each complaint, picked from a fixed list of 12, at high volume and low cost. Which setup fits best?
Can you answer these from memory?
Flash cards · tap a card to flip it
What will they ask next?
Last updated on 26 November 2026
Building a labelling or search tool on your own text?
I design and build AI products and agents, including the screens and the system behind them. Book a short call, tell me what your text is and what the model must do, and we will see if it fits.