Transformer model (transformer models). What it means.

A transformer is a neural network design that processes a whole sequence at once and uses a mechanism called attention to work out how each part relates to every other part. It is the basis of large language models.

By Brady Heinrich · Updated

Definition

A transformer is a neural network design that processes a whole sequence at once and uses a mechanism called attention to work out how each part relates to every other part. It is the basis of large language models.

What is a transformer model?

A transformer is the architecture behind almost every modern language model, and many image, audio and video models too. It was introduced in a 2017 research paper titled "Attention Is All You Need". The "T" in GPT stands for transformer.

Its central idea is attention. To understand one word, the model looks at all the other words in the input and weighs how relevant each is. In "the trophy did not fit in the case because it was too big", attention is what lets the model link "it" to "trophy" and not "case".

How does a transformer work?

  1. Tokenise. Text is split into tokens.
  2. Embed. Each token becomes a vector of numbers, with information about its position added.
  3. Attend. In each layer, every token looks at every other token and takes in information from the relevant ones. Several attention "heads" run in parallel, each tracking a different kind of relationship.
  4. Transform. A small feedforward network processes each token's updated vector.
  5. Repeat. Steps 3 and 4 are stacked many times. Deeper layers capture more abstract patterns.
  6. Predict. A language model outputs the probability of each possible next token.

Why did transformers replace earlier designs?

Recurrent networks (earlier)Transformers
Reads textOne token after anotherAll tokens at once
Long-range linksWeak: early words fadeStrong: any token can attend to any other
Training speedSlow, hard to paralleliseFast on modern chips
ScalingGains flattenKeeps improving with more data and compute

Processing everything in parallel made it practical to train on far more text than before, and that is what made large language models possible.

What are transformers used for?

  • Language: chat assistants, translation, search and summarisation.
  • Code: completion and generation.
  • Vision: image classification and understanding.
  • Audio: speech recognition and synthesis.
  • Multimodal models: text, images and audio handled together.

What are the limits?

Attention compares every token with every other, so cost climbs steeply as input gets longer. That is why models have a context window, a cap on how much they can take in at once. Transformers also learn statistical patterns, not verified facts, which is why they can produce fluent errors.

An example

A user pastes a 30-page contract into an assistant and asks whether the termination clause conflicts with the renewal terms. The two passages are 20 pages apart. Because a transformer lets every token attend to every other token in its context window, the model can relate clause 4.2 to clause 19.1 directly and point out that one allows 30 days notice while the other assumes 90.

The common mistake

Confusing the architecture with a product. A transformer is a design, not a model you can buy. Two transformer-based models can differ enormously depending on their size, training data and tuning, so compare models on your own task, not on their architecture.

How people search for transformer model

  • attention is all you need22,200 a month
  • transformer architecture6,600 a month
  • transformer model3,600 a month
  • transformers ai1,600 a month
  • transformer neural network590 a month
  • what is a transformer model260 a month

US monthly searches, Google Ads keyword data.

Related terms

Go deeper

Building something ambitious? Let's talk.

We reply within one business day.