AI Learning Courses
AI Learning Courses › Chapters › Chapter 5
CHAPTER 5 OF 15

AI Architecture: How AI Systems Are Built

Behind every AI app is a stack of layers, from chips in data centres to the screen you tap. In this chapter we look at that full stack, then zoom into the main neural network designs - especially the Transformer.

▶ Watch the 9 narrated lessons Take the chapter quiz

The AI technology stack ▶ Watch

The six layers of a modern AI system, from compute at the bottom to applications at the top.
The six layers of a modern AI system, from compute at the bottom to applications at the top.
▶ Play this diagram as a visual lesson

Main neural network architectures ▶ Watch

ArchitectureBest atExample uses
Feed-forward networkSimple patterns in numbersScoring, basic predictions
CNN (convolutional)Images and videoFace unlock, medical scans
RNN / LSTMSequences, step by stepOlder speech and translation systems
TransformerLanguage and almost everythingLLMs, translation, vision, code
GAN (generative adversarial)Realistic imagesImage synthesis, style transfer
Diffusion modelHigh-quality image and video creationText-to-image, text-to-video
Autoencoder / VAECompressing and reconstructingDenoising, anomaly detection
Mixture of ExpertsVery large efficient modelsRouting each input to specialist sub-networks

The Transformer: the engine of modern AI ▶ Watch

Introduced in 2017 in a research paper titled "Attention Is All You Need", the Transformer replaced older step-by-step designs. Its key idea, self-attention, lets every word in a sentence look at every other word at the same time and decide which ones matter for understanding it.

A simplified view of a Transformer language model generating the next token.
A simplified view of a Transformer language model generating the next token.
▶ Play this diagram as a visual lesson
  1. Tokenizer - text is split into tokens (whole words or parts of words).
  2. Embeddings - each token becomes a list of numbers (a vector) representing its meaning, plus information about its position.
  3. Self-attention - each token gathers information from the other tokens it relates to. In "The cat sat on the mat because it was tired", attention helps link "it" to "cat".
  4. Feed-forward layers - process the combined information.
  5. Many blocks - attention and feed-forward blocks are stacked dozens of times; deeper blocks capture more abstract meaning.
  6. Output - the model produces a probability for every possible next token, picks one, adds it, and repeats.

Where the model runs ▶ Watch

Chapter summary

  • An AI system is a stack: compute, data, frameworks, models, APIs and applications.
  • Different architectures suit different data: CNNs for images, Transformers for language and more.
  • Self-attention lets Transformers understand how all the words in a text relate to each other.
  • Models can run in the cloud, on the device, or both.