liveBook · Manning

Transformer architecture

As explained in Generative AI in Action

The Transformer architecture is a neural-network architecture based primarily on attention mechanisms for processing sequences.

A Transformer is a neural-network architecture built primarily around attention mechanisms. It underpins foundational models that support language understanding and generation across applications such as summarization, translation, classification, question answering, and content generation. section 2.2 section 2.3

Its practical value comes from three connected capabilities:

  • Self-attention considers the full sentence context simultaneously, helping the model capture dependencies between terms that may be far apart. section 2.3
  • Parallel computation makes Transformers faster to train than neural networks that process sequences word by word. section 2.3
  • For generation, the model weighs input elements to predict the next item in a sequence, such as a word or musical note. section 2.3

Predicting a sentence completion

Given “The cat sat on the...,” a Transformer assigns substantial attention to “cat” and may predict “mat” as the likely next word. The same next-item prediction pattern supports larger language-generation workflows. section 2.3

How Generative AI in Action covers it

How deep it goes
Explains self-attention, contextual dependencies, parallel computation, and next-item prediction, but stops short of mathematical or layer-level internals.
Examples
Uses the completion “The cat sat on the...” to illustrate attention-weighted prediction of “mat,” alongside GPT and BERT as Transformer models.
What you can do after
Evaluate Transformer use for language generation while recognizing its substantial computational demands for training and use.
How it connects
Connects self-attention with foundational models, large language models, prompts, next-token prediction, machine translation, and text summarization.

Also explained in

Compare how 28 books explain transformer architecture →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Generative AI in Action. The section links point to the parts of the book it draws on.