Shahzad Ali · Learning notes

The AI machinery room.

How the different approaches fit together.

My visual notes on the machinery behind AI: how a system learns, how it is built and what it produces.

An imagined machinery room with labelled learning methods, layered neural networks, a transformer and a flow from data to applications. The relationships and corrections are explained below.
My AI-assisted visual sketch. The machinery is a metaphor; the explanations below clarify the labels. View full size ↗

The map I keep in mind

Three questions.
One system.

AIThe broad field
Machine learningLearning from data or experience
Deep learningLearning through many neural-network layers
01 · Learning signal

How does it learn?

Labelled examples, structure in data, prediction targets taken from the data, or rewards from actions.

SupervisedUnsupervisedSelf-supervisedReinforcement
02 · Architecture

How is it built?

The arrangement of the computation. A transformer is one kind of neural-network architecture.

TransformerCNNRNNGNN
03 · Task

What does it do?

A model might classify an image, estimate a number, choose an action or generate new content.

ClassifyPredictActGenerate
Put them together · A GPT-style language model

Predict text during trainingTransformer architectureGenerate text when used

Later training can add demonstrations and feedback. Several labels can describe the same system.
  1. Supervised learning

    Learning from examples

    Give a model examples with answers: emails labelled “spam” or “inbox”, for instance. Training adjusts the model to improve its predictions on those examples.

    The useful question is how well it handles new examples. Labels, data quality and the problem being solved all matter.

    Neural networks
  2. Unsupervised learning

    Finding structure

    Give a model data without an answer label for each example. It may group similar items or find a simpler way to represent them.

    For example, a shop could group customers by purchasing patterns. A cluster shows similarity under the chosen method; explaining its cause needs further investigation.

    Patterns and representations
  3. Self-supervised learning

    The data supplies the target

    Text can supply its own training questions. Hide a token and predict it, or use earlier text to predict the following token. That creates many examples without someone labelling every answer.

    BERT learns from masked text. A GPT-style model learns next-token prediction. Both can learn useful representations before additional training for specific uses.

    Pretraining
  4. Reinforcement learning

    Actions have consequences

    An agent takes actions, receives rewards and learns a policy: a way to choose what to do. The aim is a higher total reward over time.

    In the DQN work, a deep neural network learned to play Atari games from screen pixels and rewards. This connects reinforcement learning directly with deep learning. The reward defines what success means to the system.

    Reinforcement learning
  5. Deep learning

    Layers build representations

    A deep neural network transforms its input through many layers. Each stage creates numerical representations that later stages can use.

    The “knobs” are learned parameters. The picture’s steps from patterns to reasoning are a visual simplification. Real networks vary in depth and structure, and individual layers rarely have one neat human label.

    Inside a neural network
  6. Network architectures

    Different arrangements for different data

    CNNs reuse filters across local regions, such as parts of an image. RNNs carry a state through a sequence. Transformers use attention to combine information. GNNs pass information along the links in a graph.

    An image, a sentence and a molecule have different structures. These designs offer ways to use that structure. Many systems combine several components.

    The transformer
  7. Generative models

    Creating a new example

    An autoregressive language model builds text token by token. A GAN trains a generator alongside a discriminator. A standard diffusion model learns to reverse added noise, then uses repeated denoising to generate a sample.

    These approaches learn from training examples and can produce new text, images or other data. A generated result still needs checking for the task you want it to perform.

    Generating with a model
  8. From data to a useful system

    Training and using are different stages

    Training changes the model’s parameters. Inference uses the trained model on an input. A typical chat supplies fresh context while the parameters remain fixed.

    The application adds its own decisions: which data to use, what success means and how to check results. Fluent language and attractive images alone cannot establish accuracy.

    Training and inference

Sources behind the technical details

Sources for these notes.

Reviewed . The machinery is an illustration. The papers and textbook explain the underlying methods.

  1. Authors’ textbook · Published 2016

    Deep Learning · Chapters 1, 9 and 10 ↗

    Goodfellow, Bengio and Courville. The introduction maps AI and deep learning. Chapters 9 and 10 explain convolutional filters and recurrent networks.

  2. Primary research · First released

    BERT: Pre-training of Deep Bidirectional Transformers for Language Understanding ↗

    Devlin and colleagues. Masked-language training supplies targets from the text itself. BERT uses bidirectional context, showing how transformer designs can serve different tasks.

  3. Primary research · First released

    Human-level control through deep reinforcement learning ↗

    Mnih and colleagues. The DQN system combines a deep neural network with reinforcement learning on Atari games.

  4. Primary research · First released

    Attention Is All You Need ↗

    Vaswani and colleagues. Introduces the transformer. Sections 3.1–3.5 describe attention, masking, feed-forward networks, residual connections, normalisation, embeddings and position.

  5. Primary research · First released

    Neural Message Passing for Quantum Chemistry ↗

    Gilmer and colleagues. Describes learning on molecular graphs by passing and aggregating information between connected nodes.

  6. Primary research · First released

    Language Models are Few-Shot Learners ↗

    Brown and colleagues. Describes autoregressive language modelling, whole-model parameter counts and learning from context with fixed trained weights. Its results also document limitations.

  7. Primary research · First released

    Generative Adversarial Networks ↗

    Goodfellow and colleagues. Introduces joint training of a generator and a discriminator.

  8. Primary research · First released

    Denoising Diffusion Probabilistic Models ↗

    Ho and colleagues. Defines a noise-adding process and a learned reverse process for generating samples.

← Back to my computing notes