liveBook · Manning

Transformer architecture

As explained in Grokking AI Applications

A transformer is a neural-network architecture for sequential data that uses attention to relate elements of an input sequence.

A transformer is a neural-network architecture for sequential data, especially text. It uses attention to relate elements of an input sequence, helping the model focus on the most relevant words while accounting for their positions. section 1.6

A useful mental model is a layered sequence-processing system:

  • Represent the input as tokens and embeddings. section 1.7
  • Process those representations through layers of interconnected neural-network nodes. section 1.6
  • Use attention to emphasize relationships between the most relevant parts of the sequence. section 1.6
  • Generate text one token at a time after large-scale pretraining. section 1.7

Predicting a capital

For “What is the capital of Italy?”, attention can emphasize “Italy” rather than words such as “what” or “is”, supporting the prediction “Rome.” section 1.6

Figure 1.11 How a GPT architecture generates sentences

Use the architecture diagram to trace how a GPT system generates sentences from its processed sequence. section 1.6

How Grokking AI Applications covers it

How deep it goes
Defines attention and layered processing with an example, but stops short of mathematical or implementation-level internals.
Examples
Uses GPT-3, the question about Italy's capital, token-by-token generation, and diagrams of GPT architecture and training.
What it assumes
Introduces neural networks, deep learning, tokens, embeddings, and attention as the foundation for understanding transformers.
What you can do after
Understand how attention and layered neural networks support GPT-style sequence processing and text generation.
How it connects
Connects transformers with neural networks, deep learning, attention, embeddings, pretraining, fine-tuning, and context windows.

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 Grokking AI Applications. The section links point to the parts of the book it draws on.