Concepts / Transformers vs. LLMs

Transformers vs. LLMs

A transformer is a design. An LLM is a purpose. Today's LLMs are usually built from transformers, but the purpose and the design are separate questions.

  • Programming

Two Labels That Travel Together

Read a recent machine learning paper, a product announcement, or a forum thread, and you will often see the words transformer and LLM used as if they meant the same thing. The habit is understandable. The language models that have attracted the most attention in recent years are built on the transformer architecture, so the two labels tend to travel together. But they name different things. One is a neural network architecture, which is a design for how a network's computations are organized. The other is a category of AI model defined by what it does, namely processing language.

This article is about keeping those two ideas apart. Along the way you will trace how information moves through two different designs, because seeing the internal mechanics is the fastest way to understand why the terms overlap and why they do not match perfectly.

Key point

A transformer is a design. An LLM is a purpose. Today's LLMs are usually built from transformers, but the purpose and the design are separate questions.

Following a Hidden State Through a Sentence

Before the transformer enters the picture, consider the recurrent design, which is one of the alternatives used for some language models. A recurrent model reads a sequence one token at a time. At each step it combines the current token with a hidden state, which is a running summary of what the model has seen so far. The updated hidden state is then passed on to the next step. Information from early tokens can only reach later steps by being carried inside that hidden state.

Token: Thestep 1Hidden state h1summary of TheToken: catstep 2Hidden state h2summary of The catToken: satstep 3Hidden state h3summary of The cat satcombined intopassed forwardcombined intopassed forwardcombined into
What happens to the hidden state at each token, and how does information from early tokens travel forward to later steps? Read left to right: each token updates the hidden state, and that updated state is handed to the next step.
Worked example

Tracing where the word The can influence the last step

A recurrent model reads the three-token sequence The, cat, sat. Trace how information from the first token can reach the third step.

  1. 1
    Step 1

    The model reads The and combines it with its starting hidden state, producing h1.

  2. 2
    Step 2

    The model reads cat and combines it with h1, producing h2. Anything learned from The that was kept in h1 is now part of h2.

  3. 3
    Step 3

    The model reads sat and combines it with h2, producing h3. The information from The has now passed through two updates before it can affect this step.

  4. 4
    Check

    There is no direct link from The to step 3. Influence from the first token only arrives by surviving inside the hidden state across every intermediate step.

Result

The first token affects the final step only indirectly, through the chain of hidden states. This sequential chain is the defining feature of the recurrent design.

Separating the Design from the Purpose

Definition

The transformer is a neural network architecture. It is a design for how a network's computations are organized. An LLM, short for large language model, is a model category defined by its purpose of processing language. The two terms therefore answer different questions: how the model is built, and what the model is for.

The reason the labels blur is that today's LLMs are constructed from transformers. Overlap, however, is not identity. Some transformers are not LLMs, and some LLMs are not transformers. The diagram below shows how the purpose-driven category and the architectural category relate to each other.

Neural networkarchitectureshow computations areorganizedTransformerarchitectureVision transformerstransformer used forcomputer visionRecurrent designarchitectureTransformer-basedLLMsoverlap of the two familiesConvolutional designarchitectureRecurrent orconvolutional LLMsLLMs not built ontransformersLLMpurpose: processinglanguageincludesincludesincludesused forbuildsincludesincludesbuildsbuilds
How do the transformer architecture and the LLM category contain or overlap with each other? The transformer sits in the design family, the LLM sits in the purpose family, and the two meet where transformer-based language models are built.
Key point

Architecture is a property of how a model is built. Purpose is a property of what the model is for. A single model can be classified along both axes at once, which is why the two labels can be compared but not swapped.

Classifying Systems Along Both Axes

The clearest way to test the relationship is to classify concrete systems. For each one, ask two questions: is it built on the transformer architecture, and is its purpose processing language?

Worked example

Three systems, two questions each

Classify three hypothetical systems. System A is a chatbot that generates text and is built on a transformer. System B is an image classifier built on a vision transformer. System C is a text-generating language model built on a recurrent design.

  1. 1
    System A

    It is built on a transformer, and its purpose is processing language. It is a transformer and an LLM.

  2. 2
    System B

    It is built on a transformer, but its purpose is computer vision, not language. It is a transformer that is not an LLM.

  3. 3
    System C

    Its purpose is processing language, but it is built on a recurrent design, not a transformer. It is an LLM that is not a transformer.

  4. 4
    Pattern

    Two systems answer yes to the architecture question and no to the purpose question, or the reverse. Neither question determines the other.

Result

System A is both, System B is only a transformer, and System C is only an LLM. This is the exact pattern that makes the two mirror-image assumptions fail.

Mistakes About the Two Terms

The most common error here is a pair of mirror-image assumptions. Each one feels reasonable because the two sets overlap heavily in practice, but each fails for a different reason.

  • Common mistake

    Assuming every transformer is an LLM

    What it looks like

    A vision transformer used to classify images is a transformer that does not process language.

    Why it fails

    The transformer is an architecture, and transformers can be used for computer vision. Architecture alone does not fix the purpose.

    Do this instead

    Ask whether the model is used for language processing before calling it an LLM.

  • Common mistake

    Assuming every LLM is a transformer

    What it looks like

    A language model built on a recurrent or convolutional design processes language but is not a transformer.

    Why it fails

    Some LLMs are based on recurrent and convolutional architectures, so the purpose category is broader than the transformer design.

    Do this instead

    Check the architecture separately, rather than inferring it from the word LLM.

  • Common mistake

    Using the two terms as perfect synonyms in technical writing, which hides the difference between how a model is built and what it does.

Why Some LLMs Avoid Transformers

If transformer-based LLMs are the dominant design, why would anyone build LLMs on recurrent or convolutional foundations? The source gives a direct answer: the main motivation behind these alternatives is to improve the computational efficiency of LLMs. The goal is to make language models cheaper to run in terms of computation, not to create a different kind of language model. The purpose stays the same. Only the underlying design changes.

A convolutional design takes a different route from the recurrent one. Instead of passing a hidden state step by step, it applies a filter over fixed windows of neighboring tokens. Each position in the sequence is processed using a small window around it, and stacking layers lets the windows cover more of the sentence. Both designs are alternatives to the transformer, and both are used to build language models that serve the LLM purpose.

QuestionTransformer-based LLMRecurrent or convolutional LLM
ArchitectureTransformerRecurrent or convolutional design
PurposeProcessing languageProcessing language
Is it an LLM?YesYes
Is it a transformer?YesNo
Stated motivation in the sourceDominant design of today's LLMsImproving computational efficiency

Both families serve the same purpose. They differ in architecture, and the alternatives are motivated by efficiency.

Testing the Two Assumptions

MEDIUM

A colleague writes in a design document: Since our model is a transformer, it is an LLM, so the same evaluation applies to any transformer. Identify the two claims hidden in this sentence, and explain which one is a mirror-image assumption and why each one can fail.

Hints
  • Separate the claim that a transformer is an LLM from the claim that an LLM is a transformer.
  • Think about whether a transformer could be used for computer vision.
  • Think about whether a language model could be built on a recurrent design.

What do you think happens?

Is every LLM necessarily a transformer?

  • Yes, because LLMs are defined by the transformer architecture

  • No, because some LLMs are based on recurrent or convolutional architectures

Reveal answer
Answer:

No, because some LLMs are based on recurrent and convolutional architectures.

An LLM is defined by its purpose of processing language, not by a particular architecture. Today's LLMs are built on transformers, but that is a fact about current designs rather than a definition.

Key Takeaways

  • The transformer is a neural network architecture, while an LLM is a model category defined by its purpose of processing language.
  • The two terms are often used synonymously because today's LLMs are based on the transformer architecture, but they are not identical.
  • Not all transformers are LLMs, since transformers can be used for computer vision, and not all LLMs are transformers, since some are based on recurrent and convolutional architectures.
  • The alternative recurrent and convolutional designs are motivated by improving the computational efficiency of LLMs, not by changing their purpose.

Related concepts

More concepts starting with T