दुर्गा बेरागी Durga Beragi, homeEnter the study →

Library › Foundations of computing

Deep Learning

Ian Goodfellow, Yoshua Bengio and Aaron Courville · 2016 · MIT Press

Neural networks from linear algebra up. The textbook of the field.

About the book

Ian Goodfellow, Yoshua Bengio and Aaron Courville published Deep Learning with MIT Press in 2016. It was the first comprehensive textbook on the field. The book has three parts. Part one covers applied mathematics and machine learning basics: linear algebra, probability, numerical computation and machine learning concepts. Part two covers modern practical deep networks: feedforward networks, regularisation, optimisation, convolutional networks, recurrent networks and practical methodology. Part three covers research topics: autoencoders, representation learning, structured probabilistic models, Monte Carlo methods and deep generative models. The full text is free to read online at the authors' website.

Key ideas

  • Deep learning builds representations in layers. Each layer transforms its input into a more abstract representation, and the layers together learn features useful for the task.
  • Neural networks are trained by gradient-based optimisation. The gradients of the error with respect to every weight are computed efficiently by back-propagation through the layers.
  • Regularisation methods such as weight decay, dropout, early stopping and data augmentation help networks generalise well to new data rather than simply memorise their training examples.
  • Convolutional networks suit images, because they share weights across positions in the input. Recurrent networks suit sequences, because they carry a state forward through time.
  • Generative models, such as variational autoencoders and generative adversarial networks, learn to produce new data that resembles their training data. Goodfellow introduced the adversarial approach in 2014.

Why it is on this shelf

It sets out the mathematics behind modern AI in one place, from linear algebra to generative models. It predates the transformer, so it shows the foundations rather than the latest models. Reading it gives the background needed to read current research papers with understanding.

How to start reading it

Read Part One only as needed for gaps. Then read chapters 6 to 9 in Part Two on feedforward networks, regularisation, optimisation and convolutional networks. Use the online version.

About this book

Deep Learning, by Ian Goodfellow, Yoshua Bengio and Aaron Courville, was published by MIT Press in 2016. It was the first comprehensive textbook on the family of methods that had, in the few years before, transformed speech recognition, image recognition and machine translation. The authors also made the full text free to read on the web, and much of its readership has come that way. Within a short time it became the standard reference for students entering the field, and it is still widely assigned.

The book was written at a turning point. Neural networks were an old idea, dating back to the 1940s, and had gone in and out of fashion twice. In the mid-2000s a small group of researchers, including Bengio, showed new ways to train networks with many layers. In 2012 a deep convolutional network trained on graphics processors won the ImageNet image recognition competition by a wide margin, and the field changed almost overnight. Industry poured in money and talent. Knowledge was again scattered across papers, tutorials and the habits of a few laboratories. The authors set out to gather it into one coherent account.

The intended reader is a student or engineer who knows some programming and is willing to work with mathematics. The book does not assume much: it teaches the linear algebra, probability and numerical methods it needs. But it moves quickly, and a reader without some university mathematics will find the early chapters demanding. It is written both for those who will do research and for those who will build systems, and it tries to serve both.

The book sets out to answer a question that is simple to state and hard to answer well. How can a machine learn, from examples, to perform tasks that people do easily but cannot explain, such as recognising a face, understanding speech or translating a sentence? The deep learning answer is that the machine should learn a hierarchy of representations, each layer building more abstract features out of the ones below, by adjusting millions of numerical parameters to reduce its errors on the examples. The book explains how that works, why it works when it does, and what remains unknown.

Because the field has moved so fast, the reader should hold the book's date in mind. It was completed shortly before the transformer architecture, introduced in 2017, which underlies most of today's large language models. It says little about the scale of training that became normal later. It is a book about foundations, and as such it has aged better than many guesses at the time would have suggested, because the foundations have not changed nearly as much as the systems built on them.

The authors

Yoshua Bengio is a computer scientist at the Universite de Montreal, where he founded and long directed the institute now known as Mila. He has worked on neural networks since the late 1980s, through the long period when most of the field had turned away from them. His contributions include early work on neural language models, which learn to represent words as vectors of numbers, research on why deep networks are hard to train, work on unsupervised pre-training of deep networks in the mid-2000s, and, with his students, the attention mechanism for translation that later became central to transformers. In 2018 he shared the Turing Award with Geoffrey Hinton and Yann LeCun for their work on deep learning.

Ian Goodfellow did his doctorate in Montreal under Bengio and Courville. In 2014 he introduced generative adversarial networks, a method in which two networks are trained against each other, one producing samples and the other trying to tell them from real data. The idea spread widely and produced a wave of research on generating realistic images. Goodfellow also did influential work on adversarial examples, inputs altered in ways invisible to people that cause networks to make confident mistakes. He has worked at Google, at OpenAI and at Apple, and later at DeepMind.

Aaron Courville is a professor at the Universite de Montreal and a member of Mila. His research covers deep generative models, representation learning and the combination of vision and language. He co-supervised much of the Montreal group's work on generative modelling and on probabilistic approaches to deep learning.

The book reflects its authors. It is strongest on the topics they knew from the inside: representation learning, optimisation difficulties in deep networks, probabilistic models and generative modelling. It carries the Montreal group's interest in the question of why depth helps and what good representations are. It also reflects a probabilistic outlook common in that group, in which learning is understood as fitting a probability model to data, an outlook that shapes the explanations throughout.

The shape of the argument

The book has an introduction and three parts. The introduction explains what deep learning is, who it is for and how it emerged. It gives a compact history in which neural networks pass through three waves: an early wave tied to cybernetics in the 1940s to 1960s, a second wave called connectionism in the 1980s and 1990s, and the third wave under the name deep learning from about 2006. It also explains why the third wave succeeded where the others stalled: more data, faster computers and some important technical improvements.

The first part covers the mathematics and machine learning needed for everything else. It treats linear algebra, probability and information theory, numerical computation and the basic ideas of machine learning. A reader with a good background can skim much of it. The final chapter of this part, on machine learning basics, is important for everyone, because it introduces the vocabulary used throughout: capacity, overfitting, generalisation, regularisation, estimators and the reasons simple methods fail on hard problems.

The second part is the practical core. It explains feedforward networks and the back-propagation algorithm, regularisation, optimisation, convolutional networks for images and recurrent networks for sequences. It closes with a chapter on practical methodology, a guide to how to actually build and debug a system, and a chapter surveying applications in vision, speech, language and other areas. This part contains what most practitioners use most of the time.

The third part covers research topics, many of which were active and uncertain at the time of writing. It treats linear factor models, autoencoders, representation learning, structured probabilistic models, Monte Carlo methods, the problem of the partition function, approximate inference and deep generative models. This part is more mathematical and more provisional. Some of its topics have become central; others have faded.

Several ideas run through the whole book. The first is representation: the claim that the main job of a deep network is to learn good representations of data. The second is optimisation: the fact that training a network is solving a hard numerical problem, and that much practical success depends on solving it well enough. The third is generalisation: the question of why a network trained on some examples performs well on new ones. The fourth is probability: the view that learning means estimating the distribution that produced the data. The book's argument, taken whole, is that these four ideas together explain both what deep learning can do and where its open problems lie.

Learning representations in layers

The first key idea is that the hard part of many tasks is finding the right way to describe the input. Consider recognising a cat in a photograph. The photograph is a grid of a million or so numbers giving the brightness of colours at each point. No single number says cat. A slight change in lighting or position changes almost every number. The useful facts, such as the presence of ears, whiskers and fur texture, are buried in complex patterns across many numbers.

For decades, the standard approach was for people to design features by hand: edge detectors, colour histograms, measures of texture. A simple learning method then worked on top of these features. This worked moderately well, but designing features required expertise and luck, and the features were never quite right. Deep learning replaces hand design with learning. A network made of many layers transforms the raw input step by step. The first layers come to detect simple patterns such as edges. Later layers combine edges into parts, and parts into objects. Nobody tells the network to do this; the arrangement emerges from training.

The book explains why depth helps. Some functions can be computed far more compactly by deep networks than by shallow ones, in the way a long calculation can be written briefly as a sequence of steps that reuse earlier results. Many real-world concepts seem to have this compositional structure: objects are made of parts, sentences of phrases, phrases of words. A deep network has the right shape to exploit such structure.

A useful analogy is a factory assembly line. Each station performs a simple transformation on what it receives and passes the result on. No single station builds a car, but the line as a whole does. In a deep network, the stations are layers, and what makes it remarkable is that the stations configure themselves by watching the final product and adjusting to reduce defects.

It is common to confuse deep learning with any use of neural networks, or with artificial intelligence in general. Deep learning is a particular approach within machine learning, which is itself one approach within artificial intelligence. Its distinguishing feature is learning multiple levels of representation from data. Not every neural network is deep, and not every intelligent system uses learned representations.

The idea leads to the book's chapter on representation learning, which asks what makes one representation better than another. Good representations tend to disentangle the underlying causes of the data, so that changing one factor, such as lighting, affects only a few features. They are useful for many tasks, not just one. And they can often be learned from data without labels. These themes later became central to the practice of pre-training large models on unlabelled data and then adapting them, which dominates the field today.

Machine learning as generalisation

The second key idea comes from the chapter on machine learning basics, and it underlies everything else. A learning algorithm is judged not by how well it performs on the examples it was trained on but by how well it performs on new examples it has not seen. That gap between training and test performance is the central concern of machine learning.

The book introduces capacity: the range of functions a model can represent. A model with too little capacity underfits; it cannot capture the patterns in the data even on the training set, like a straight line drawn through points that lie on a curve. A model with too much capacity relative to the data overfits; it memorises the training examples, including their noise, and fails on new ones, like a curve that wiggles through every point but predicts nonsense between them. Good learning sits between these extremes.

The book explains classical tools for thinking about this: the trade-off between bias and variance, the idea of an estimator, maximum likelihood estimation and Bayesian estimation. It treats learning as fitting a probabilistic model, so that choosing parameters to make the data most probable is the guiding principle. Many of the loss functions used in deep learning, such as cross-entropy for classification, follow directly from this view.

The chapter also explains why simple methods fail on the problems deep learning tackles. The curse of dimensionality means that in a space with many dimensions, the number of possible inputs is so vast that no amount of data covers it densely. A method that relies only on similarity to nearby training examples cannot generalise far. Deep learning escapes this by assuming that the data have structure: that they lie near lower-dimensional surfaces, called manifolds, inside the high-dimensional space, and that the underlying factors combine in compositional ways. The manifold hypothesis is a working assumption, not a theorem, but it explains a great deal.

A frequent confusion is to think that more training accuracy always means a better model. It does not. A model that gets every training example right may be worse than one that makes a few errors. Practitioners learn to hold out validation data, never touched during training, to estimate true performance. This discipline is the single most important habit the book teaches.

It should be said that deep networks complicate the classical picture. They often have far more parameters than training examples, and by classical reasoning should overfit badly. In practice they often generalise well. The book notes that this is not well understood. Research since its publication has explored this puzzle intensively, and it remains one of the central theoretical questions in the field.

Feedforward networks and back-propagation

The third key idea is the basic machinery. A feedforward network takes an input vector, multiplies it by a matrix of weights, adds a bias, applies a simple nonlinear function to each entry, and passes the result to the next layer, which does the same. The final layer produces the output: a class probability, a number, a sequence. The weights are the parameters to be learned.

The nonlinear function matters. Without it, a stack of layers would collapse into a single linear transformation, and depth would add nothing. Early networks used smooth S-shaped functions. Modern networks mostly use the rectified linear unit, which passes positive values unchanged and sets negative values to zero. The book explains why this simple choice helped: it keeps gradients from vanishing in deep networks, and it is cheap to compute.

The book states the universal approximation theorem: a network with even one hidden layer, given enough units, can approximate any reasonable function as closely as desired. This is often misread as saying that one layer is enough. It is not. The theorem says nothing about how many units are needed, which can be astronomically many, or whether training will find the right weights. Depth matters because it can make the required size manageable and the learning problem easier.

Training means adjusting the weights to reduce a loss function measured on the training data. The standard method is gradient descent: compute how the loss would change if each weight changed slightly, and move every weight a small step in the direction that reduces the loss. The difficulty is computing those gradients for millions of weights efficiently. Back-propagation does this. It applies the chain rule of calculus systematically, working backward from the loss through each layer, reusing intermediate results so that the cost of computing all gradients is roughly the same as the cost of computing the output once.

The book presents back-propagation in terms of computational graphs. Any calculation can be drawn as a graph in which nodes are operations and edges carry values. Back-propagation is a general procedure for computing derivatives on such a graph, of which neural networks are one case. This general view, called reverse-mode automatic differentiation, is what modern software libraries implement, and it frees researchers to design new architectures without deriving gradients by hand.

A useful analogy is assigning responsibility in an organisation after a mistake. The final error is traced back through each step that contributed to it, and each step is told how much it was to blame and in which direction it should change. Back-propagation does this precisely and for every parameter at once. It is often confused with the learning algorithm itself, but it is only the method of computing gradients; the learning is done by the optimiser that uses them.

Regularisation

The fourth key idea is regularisation, defined broadly in the book as any change to a learning method that aims to reduce its error on new data rather than its error on training data. Deep networks have enormous capacity, so preventing them from simply memorising is essential.

The book surveys many methods. Weight decay adds a penalty for large weights, nudging the network towards simpler functions. Data augmentation creates new training examples by transforming existing ones, for example by shifting, flipping or slightly rotating images, teaching the network that such changes should not alter the answer. Early stopping halts training when performance on held-out data stops improving, before the network begins to memorise. Dropout randomly switches off a fraction of units during each training step, so that the network cannot rely on any single unit and must spread its knowledge.

Other methods include parameter sharing, in which different parts of a network are forced to use the same weights, as in convolutional networks; ensemble methods, in which several models are averaged; and multi-task learning, in which one network is trained on several related tasks so that shared features must serve them all. The book also discusses adversarial training, in which the network is trained on inputs deliberately altered to fool it, a topic close to Goodfellow's own research.

An analogy helps. A student preparing for an examination can memorise the answers to past papers or learn the underlying subject. Memorising works perfectly on past papers and fails on new questions. Regularisation methods are the teacher's tricks to force real learning: changing the wording of questions, asking the student to explain to others, testing on unseen problems, and stopping cramming before it turns into rote recall.

A common confusion is to treat regularisation as a single technique. It is a goal, achieved by many means, and the right combination depends on the problem. Another confusion is to think regularisation always reduces capacity. Some methods, like data augmentation, work by enlarging the effective data rather than shrinking the model. The modern practice of training very large models on very large datasets can be seen as an extreme form of this second approach.

Optimisation in deep networks

The fifth key idea is that training a deep network is a difficult optimisation problem, different in character from the optimisation problems of classical mathematics. The loss surface of a deep network, the landscape of loss values over all possible weight settings, has millions of dimensions. It is not convex: it has many valleys, ridges, plateaus and saddle points. There is no guarantee that gradient descent will find the lowest point, and finding it is usually not even the goal.

The book explains why the problem is hard and how practitioners cope. Stochastic gradient descent estimates the gradient from a small random batch of examples at each step rather than the whole dataset. This is cheaper and, surprisingly, often better, because the noise helps the optimiser escape poor regions. Momentum accumulates past gradients, like a ball rolling downhill that keeps its velocity through small bumps. Adaptive methods such as RMSProp and Adam adjust the step size separately for each parameter based on the history of its gradients.

Initialisation matters greatly. If the starting weights are too small, signals shrink to nothing as they pass through layers; if too large, they explode. The book discusses schemes for choosing initial weights so that signals keep a reasonable size. It also explains batch normalisation, then a recent invention, which normalises the inputs to each layer during training and made very deep networks much easier to train.

An important insight in the book concerns the nature of the difficulties. It was long feared that training would get stuck in poor local minima, low points that are not the lowest. Research around the time of writing suggested that in high dimensions, saddle points and flat regions are a bigger problem than bad minima, and that most local minima of large networks are nearly as good as the global one. This shifted attention from escaping minima to moving efficiently across flat regions.

A frequent confusion is to equate training with optimisation in the pure sense. In machine learning, the goal is not to minimise training loss but to generalise. Optimising the training loss perfectly may lead to overfitting. The optimiser and the regulariser work together, and choices like the learning rate or the batch size affect generalisation, not just speed. The book makes this point clearly and repeatedly.

The difficulty of training also explains the long history of neural networks. For years, deep networks could not be trained well, and the field concluded that depth was not worth the trouble. Better initialisation, the rectified linear unit, more data, faster graphics processors and normalisation together changed that. Much of the third wave's success came from making optimisation work rather than from new kinds of models.

Convolutional networks

The sixth key idea is the convolutional network, the architecture that made deep learning's reputation in computer vision. An image has structure that a general network ignores. Nearby pixels are related. A pattern that matters in one place, such as an edge or an eye, would matter anywhere else too. A convolutional network builds these facts into its design.

Instead of connecting every input to every unit, a convolutional layer uses small filters that look at a local patch of the image, and slides the same filter across every position. The same weights are used everywhere, which drastically reduces the number of parameters and lets the network recognise a pattern wherever it appears. Pooling layers then summarise nearby responses, giving some tolerance to small shifts. Stacking such layers produces the hierarchy of features described earlier: edges, then textures and parts, then objects.

The book explains the mathematics of convolution, the motivations of sparse connections, parameter sharing and equivariance to translation, and the variations used in practice. It also discusses the history, including the influence of neuroscience. The work of David Hubel and Torsten Wiesel on the visual cortex of cats in the 1950s and 1960s, showing cells that respond to edges at particular orientations and positions, inspired the earliest designs. Kunihiko Fukushima's neocognitron and Yann LeCun's networks for reading handwritten digits in the late 1980s and 1990s were direct ancestors of the modern architectures.

The analogy with a photographer's loupe helps. A loupe examines one small region at a time but can be moved over the whole print. A convolutional filter is a loupe tuned to one pattern, moved systematically over the image, recording where the pattern appears. A layer has many such loupes, each tuned to a different pattern, and the next layer looks at the map of where the first layer's patterns appeared.

It is common to think that convolutional networks are only for images. They apply to any data with grid-like structure and local patterns: audio, time series, some text tasks and many scientific data types. It is also common to think they mimic the brain closely. The inspiration was real, but the resemblance is loose, and the book is careful not to overstate it.

Since the book appeared, transformers have been adapted to images and compete with or complement convolutional networks in many tasks. But convolution remains widely used, especially where data or computing power are limited, and the ideas of local connection and weight sharing remain central to how the field thinks about architecture.

Recurrent networks and sequences

The seventh key idea is the recurrent network, designed for sequences such as speech, text and time series. A sequence has an order, and the meaning of each element depends on what came before. A recurrent network processes the sequence one element at a time, keeping a hidden state that summarises what it has seen. At each step it combines the new input with the previous state to produce a new state and possibly an output. The same weights are used at every step, which is another form of parameter sharing, this time across time instead of space.

Training recurrent networks is hard. When gradients are propagated back through many steps, they tend either to shrink towards zero or to grow without bound, a problem studied closely by Bengio and colleagues in the 1990s. Vanishing gradients mean the network cannot learn long-range dependencies, such as remembering a name mentioned many sentences earlier. The book explains the problem and the main remedies.

The most important remedy is the long short-term memory network, or LSTM, proposed by Sepp Hochreiter and Jurgen Schmidhuber in 1997. An LSTM unit contains a memory cell and a set of gates, small learned switches that control what is written to the cell, what is kept and what is read out. By letting information pass through many steps unchanged unless a gate intervenes, the LSTM preserves gradients over long spans. The gated recurrent unit is a simpler variant. These architectures powered the advances in speech recognition and translation in the years before the book was written.

The book also covers sequence-to-sequence models, in which one network reads an input sequence and another writes an output sequence, the basis of neural machine translation, and it introduces attention mechanisms, which let the output network look back at different parts of the input at each step rather than relying on a single fixed summary. Attention, developed in Bengio's group, turned out to be the seed of the transformer.

An analogy: a recurrent network reads a sentence the way a person listens to speech, word by word, holding a running sense of what has been said. An LSTM adds a notebook with rules for when to write something down, when to cross it out, and when to consult it. Attention lets the listener glance back at the transcript instead of relying only on memory.

The confusion to avoid is to think recurrent networks are the current standard for language. They were in 2016. Transformers, which drop recurrence and rely entirely on attention, have largely replaced them for language since 2017, because they can be trained in parallel over long sequences and scale better. Recurrent ideas have not vanished, and some recent architectures revive them in new forms, but a reader should not take this chapter as describing the present state of language modelling.

The mathematics underneath

A further idea, easy to pass over, is that deep learning rests on a small set of mathematical tools used relentlessly. The first part of the book teaches them, and it is worth understanding why each is there.

Linear algebra is the language of the computation itself. Inputs are vectors, layers are matrices, and a batch of examples is a matrix too. Training a network is mostly a long series of matrix multiplications. Ideas such as eigenvalues, the singular value decomposition and norms appear when the book discusses why signals grow or shrink through layers, how principal component analysis compresses data, and how weight penalties work. A reader who sees a network as a chain of matrix operations, with a simple nonlinearity between each, has the right mental model.

Probability supplies the meaning of outputs and the shape of losses. A classifier outputs a probability distribution over classes. Training by maximum likelihood is the same as minimising cross-entropy. Concepts such as conditional probability, expectation, variance and common distributions such as the Gaussian recur throughout. Information theory adds entropy and the Kullback-Leibler divergence, which measure uncertainty and the difference between distributions, and which appear in loss functions and in the theory of generative models.

Numerical computation is the reminder that real computers work with finite precision. The book discusses overflow and underflow, when numbers become too large or too small to represent, and shows how standard functions such as the softmax must be computed in rearranged forms to avoid them. It discusses the conditioning of problems, which governs how errors in inputs grow in outputs, and gives a first account of gradient-based optimisation, including the role of curvature, second derivatives and the Hessian matrix. These details explain many practical failures, such as a loss that suddenly becomes not-a-number in the middle of training.

A common mistake is to treat these chapters as a hurdle to clear before the real content. They are better seen as the toolkit the rest of the book uses on every page. A reader who keeps returning to them when later chapters become unclear will learn faster than one who rushes past.

Adversarial examples and robustness

Another idea in the book, close to Goodfellow's research, is that deep networks can be fooled in ways people are not. An adversarial example is an input changed very slightly, often by an amount too small for a person to notice, so that a network that classified the original correctly now gives a confident wrong answer. A photograph of a panda, altered imperceptibly, may be labelled as something else entirely.

The book explains a simple account of why this happens. Networks behave in a largely linear way over much of their input space, and in very high dimensions many tiny changes, each aligned with the direction that increases the error, add up to a large effect on the output. A fast method that steps the input in the direction of the gradient's sign is enough to produce such examples. Training on adversarial examples can make networks more robust, and doubles as a form of regularisation.

This idea matters beyond the laboratory. It shows that high accuracy on test data does not imply that a network sees the world as people do. A network may rely on features that are predictive in the training data but meaningless or fragile in the wider world. For systems used in safety-critical settings, such as vehicles, medicine or security, this is a serious concern, and robustness has grown into a large research field since the book appeared.

It is common to treat adversarial examples as an odd curiosity or a simple bug that better training will remove. Research since 2016 suggests they are deeply tied to how networks represent data, and that robustness often comes at some cost in ordinary accuracy. The book's discussion is an early, clear introduction to a problem that remains open.

Practical methodology

The eighth key idea is less glamorous and more useful than most: building a working system is a matter of method. The book's chapter on practical methodology is short, but many practitioners consider it among the most valuable in the book, because it sets out the habits that separate success from frustration.

The method begins with deciding what to measure. Before building anything, choose a performance metric that matches what matters in the application and decide what level of performance would be useful. Accuracy is often the wrong measure: for detecting a rare disease, a system that always says no is highly accurate and useless. Precision, recall and related measures may be more appropriate. The target should be set by the needs of the application, not by curiosity about how far the numbers can be pushed.

Next, build a simple end-to-end system quickly, using a standard architecture appropriate to the data. Then improve it in a loop: diagnose what is limiting performance, make one change, measure again. If performance on training data is poor, the model is underfitting, and the remedy is more capacity, better optimisation or better features. If training performance is good but test performance poor, the model is overfitting, and the remedy is more data or more regularisation. Gathering more data, the book notes, is often more effective than any clever change to the algorithm.

The chapter covers the choice of hyperparameters, the settings such as learning rate and network size that are not learned by training. It explains manual tuning, grid search and random search, and points out that random search is often more efficient than a grid because only a few hyperparameters usually matter. It singles out the learning rate as the most important hyperparameter to tune.

Finally, the chapter covers debugging, which in machine learning is unusually hard. A bug may not crash the program; it may just make results slightly worse, and that is hard to distinguish from a poor choice of model. The book suggests practical checks: visualise what the model does, look at its worst mistakes, verify gradients numerically, try to overfit a tiny dataset to confirm the model can learn at all, and monitor the statistics of activations and gradients during training.

This chapter connects deep learning to engineering practice more broadly. It reads like advice from experienced craftsmen, and it ages slowly because it concerns method rather than particular models. A reader who absorbs it will avoid many wasted weeks.

Data, hardware and applications

A further idea that the book returns to, especially in its introduction and its applications chapter, is that deep learning's success came as much from scale as from ideas. Many of the methods existed in some form by the 1990s. What changed in the following decades was the size of datasets and the speed of computers. Large labelled collections of images, recorded speech and translated text became available. Graphics processors, built for video games, turned out to be very good at the matrix arithmetic that networks need. Networks that had been too slow or too data-hungry to train became practical.

The book makes the point with a simple observation about network size. The number of connections per neuron in artificial networks, and the total number of neurons, had grown steadily over decades and were still far below those of the human brain. The authors expected growth to continue. Events since 2016 have outrun that expectation, with models trained on vastly more data and computation than the book's examples. The book's emphasis on scale was right; its sense of how far scale would go was, like everyone's at the time, too cautious.

The applications chapter surveys large-scale deep learning in practice: the engineering of training across many machines, ways to compress models for use on small devices, and the use of networks in computer vision, speech recognition, natural language processing and recommendation systems. It discusses neural language models and word embeddings, in which words are represented as vectors so that related words lie close together, an idea with roots in Bengio's own early work. It also touches on knowledge representation and reasoning.

A common confusion is to think the progress of deep learning came from a single breakthrough. It came from many modest improvements arriving together with much more data and much faster hardware. That pattern, in which old ideas become powerful when their resources grow, is worth remembering whenever a technology seems to arrive suddenly.

Probabilistic models and the problem of inference

The ninth key idea occupies much of the third part. It is that many learning problems are best understood as building a probability model of the data, and that the main difficulties then lie in computing with that model. A structured probabilistic model represents a joint distribution over many variables using a graph that shows which variables directly influence which. Directed graphs show causal or generative relationships; undirected graphs show symmetric dependencies. Such graphs make large distributions manageable by breaking them into local pieces.

Two computational problems dominate. The first is the partition function. In undirected models, the probability of a configuration is defined by a score that must be divided by the sum of scores over all possible configurations, so that probabilities add to one. That sum, the partition function, ranges over an astronomically large set and usually cannot be computed. The book devotes a chapter to methods for learning despite it: approximations, sampling-based estimates and objectives that avoid it altogether.

The second problem is inference: given observed data, compute the probabilities of hidden variables that explain it. Exact inference is usually intractable. The book covers approximate methods. Monte Carlo methods, including Markov chain Monte Carlo, draw samples that approximate the distribution. Variational methods replace the true distribution with a simpler one and adjust it to be as close as possible, turning inference into optimisation. The evidence lower bound, a quantity that can be maximised to fit such approximations, appears repeatedly.

These chapters are among the hardest in the book. They draw on statistical physics, Bayesian statistics and information theory, and they use the language of energy, entropy and free energy borrowed from physics. Concepts from Shannon's information theory, such as entropy and the Kullback-Leibler divergence, a measure of how one probability distribution differs from another, appear throughout. Readers without background in probability will need to slow down.

A useful analogy is a detective reconstructing events from clues. The probabilistic model is the detective's understanding of how events produce clues. Inference is reasoning backward from the clues to the events. When the possible events are too numerous to check one by one, the detective must either sample plausible stories and weigh them, the Monte Carlo approach, or fix on a simplified story and refine it, the variational approach.

The confusion to avoid is to think that all of deep learning is probabilistic modelling in this explicit sense. Much of practical deep learning, such as training a classifier, uses probability only lightly, in the choice of loss function. The heavy machinery of the third part matters most for generative models and for research into unsupervised learning. Its relative importance has shifted since 2016, as some of the methods it covers have been overtaken by simpler approaches.

Generative models

The tenth key idea is that networks can be trained not only to recognise data but to produce it. A generative model learns the distribution of its training data well enough to create new samples that resemble it: new faces, new sentences, new pieces of music. The final chapter of the book surveys the approaches known at the time.

Autoencoders are networks trained to reconstruct their input through a narrow middle layer, forcing them to learn a compressed representation. Variants add noise to the input or penalties to the representation to make it more useful. The variational autoencoder, introduced in 2013 and 2014, combines this architecture with variational inference. An encoder maps data to a distribution over hidden codes, a decoder maps codes back to data, and the whole system is trained to maximise a bound on the probability of the data. Sampling a random code and decoding it produces a new example.

Generative adversarial networks, Goodfellow's own invention, take a different route. A generator network turns random noise into samples. A discriminator network tries to tell generated samples from real ones. The two are trained together in a contest: the generator improves by fooling the discriminator, and the discriminator improves by catching the generator. When it works, the generator learns to produce samples the discriminator cannot distinguish from real data. The idea is often explained through the image of a forger and a detective, each forcing the other to improve.

Adversarial training is unstable and hard to tune, and the book is frank about this. Training can oscillate, or the generator can collapse into producing only a few kinds of output. But in the years after the book, adversarial networks produced strikingly realistic images and became one of the most active areas of research.

The book also covers older generative models based on undirected graphs, especially restricted Boltzmann machines and deep belief networks. These were central to the revival of deep learning in the mid-2000s, when Hinton and others used them to pre-train deep networks layer by layer. By 2016 their practical role was already shrinking, and they are now rarely used, though their ideas remain instructive.

Since 2016 the landscape of generative models has changed greatly. Diffusion models, which learn to reverse a gradual noising process, became the leading method for generating images. Large autoregressive transformers, which predict the next token in a sequence, became the leading method for generating text. Neither is covered in the book, though both rest on foundations it explains: the variational bounds behind diffusion models and the probabilistic sequence modelling behind language models are recognisably descendants of material in its third part.

The tradition around it

The book places itself in a long history, and the introduction tells that history fairly. The first wave of neural network research began with Warren McCulloch and Walter Pitts's 1943 model of neurons as logical units and Frank Rosenblatt's perceptron in the late 1950s, which learned to classify simple patterns. This wave was tied to cybernetics, and Norbert Wiener's Cybernetics, on this shelf, is its manifesto: a vision of control and communication shared by animals and machines. Von Neumann's The Computer and the Brain, also on this shelf, reflects the same period's hope of understanding computation by comparing it with the nervous system.

The first wave faded in part because of the limits of single-layer perceptrons, set out sharply by Marvin Minsky and Seymour Papert in their 1969 book Perceptrons. Minsky's Computation: Finite and Infinite Machines, on this shelf, comes from the same author and period and shows the rigorous approach to machines and their limits that shaped artificial intelligence research for decades. The second wave, in the 1980s, brought back-propagation into wide use through the work of David Rumelhart, Geoffrey Hinton and Ronald Williams, and with it the connectionist movement. It faded in the late 1990s as other methods, such as support vector machines, performed better on the problems of the day.

The third wave is the book's own. Its practical success depended on hardware, and the shelf's Computer Architecture: A Quantitative Approach by Hennessy and Patterson describes the long evolution of processors whose parallel descendants, graphics processors and specialised accelerators, made training large networks possible. Its theory draws on probability and on information theory; Shannon and Weaver's The Mathematical Theory of Communication defines the entropy and related measures used in nearly every loss function in the book. Introduction to Algorithms by Cormen, Leiserson and Rivest gives the background for thinking about the cost of computations.

Other books on this shelf frame the larger questions. Turing's 1950 paper on machine intelligence, discussed in Hodges's biography Alan Turing: The Enigma, proposed that machines might learn as children do, a suggestion that deep learning has taken further than Turing could have tested. Hofstadter's Godel, Escher, Bach asks how meaning and self-reference can arise from formal systems, a question that large learned models make newly pressing. Penrose's The Emperor's New Mind argues that human understanding is not computational, a claim worth testing against what deep networks have since achieved and failed to achieve. And Michael Nielsen, co-author of the shelf's quantum computing textbook, wrote a free online introduction to neural networks that many readers use as a gentler path into this book.

After 2016, the field produced a flood of new material: the transformer paper of 2017, the rise of large pre-trained language models, the study of scaling laws relating performance to model size and data, and diffusion models. Newer textbooks and courses cover these developments. Many of them assume the foundations that Goodfellow, Bengio and Courville set out, and refer back to this book for them.

Questions and criticisms

The most obvious limit is date. The book does not cover transformers, the architecture behind most current language and many vision systems, nor the practice of pre-training very large models on vast unlabelled data and adapting them, nor diffusion models, nor reinforcement learning from human feedback. A reader who wants to understand current systems must go further. The book gives the language and mathematics needed to do so, but not the systems themselves.

A second criticism concerns emphasis. The third part gives substantial space to Boltzmann machines, deep belief networks, the partition function and related topics that were central to the Montreal and Toronto research programmes but have since become marginal in practice. A reader working through the third part in order may spend much effort on material of mostly historical interest, while some topics that became central receive little attention.

A third concerns teaching. The book has no exercises, unlike most textbooks. It explains clearly but leaves the reader to find their own practice. It also contains little code; it is intentionally independent of any software library, which keeps it from going out of date but means readers must look elsewhere for hands-on work. Some readers find the early mathematical chapters too compressed to learn from and too elementary to need, an awkward middle.

A fourth concerns theory. The book is honest that much of deep learning lacks theoretical explanation, but some readers wish it had said more about what was known. Since 2016, there has been substantial theoretical work on why over-parameterised networks generalise, on the geometry of loss landscapes, on the behaviour of very wide networks and on the phenomenon in which test error falls, rises and falls again as model size increases. The book's discussion of generalisation is largely classical and does not anticipate these developments.

A fifth concerns scope. The book is about methods, not consequences. It says little about the social effects of deep learning, about bias in data and models, about privacy, energy use or the concentration of computing power in a few companies. These questions have become central in public discussion. The authors have each spoken on them elsewhere, with Bengio in particular becoming prominent in debates about the risks of advanced artificial intelligence. But the book itself stays technical.

What has held up is most of the second part and much of the first. Feedforward networks, back-propagation as automatic differentiation, regularisation, optimisation methods, convolutional networks and the core ideas of sequence modelling and attention are still taught much as the book teaches them. The practical methodology chapter remains excellent advice. The probabilistic framing has proven useful for understanding newer generative models. For a book in a field that changes every few months, that is a strong record.

One more question deserves to be carried from this book into current debates. The authors present deep learning as a set of methods for estimating functions and distributions from data. Some later commentators describe large trained models in much grander terms, as reasoning or understanding, while others dismiss them as mere statistics. The book's sober framing is a useful anchor for both. It makes clear what is being optimised and why, so that claims about what trained systems can or cannot do can be checked against the mechanics. Neither enthusiasm nor dismissal is a substitute for that check, and the book gives a reader the means to make it.

Why it is on this shelf

This shelf follows computing from Babbage's engines through Turing's theory and von Neumann's machines to the present. Deep Learning marks a turn in that story. The earlier books describe machines that follow explicit instructions written by people. This one describes machines whose behaviour is shaped mainly by data, through millions of adjusted numbers that no one sets by hand. That shift, from programming to training, is among the largest changes in computing since the stored-program machine.

For a reader of science and technology, the book explains the methods behind tools that now affect research, industry and daily life, and it gives the mathematical grounding needed to read research papers and to judge claims made about artificial intelligence. For a reader of economics, it explains the technical basis of a technology whose effects on labour and productivity are now widely debated. For a reader of Vedanta, it offers no answer to questions about consciousness, and should not be read as offering one. But it sharpens those questions. A network that learns representations, forms abstractions and produces fluent language does so through mechanisms this book makes explicit. Asking what such a system lacks, if anything, is a useful exercise in thinking clearly about mind.

It also belongs beside the shelf's older books on mind and machine, because it answers some of their questions with working methods and leaves others more open than before. We keep it because it is the clearest single statement of the foundations, written by people who built them, and because those foundations have outlasted the particular systems of its time.

How to read it

Start with the introduction, which is short and gives the history and the map of the book. Then decide what you need from the first part. If your linear algebra and probability are solid, skim those chapters for notation and move on. If not, work through them slowly, with a pencil, and supplement with a dedicated textbook where they are too compressed. Do not skip the chapter on machine learning basics; read it carefully, because its ideas recur everywhere.

The core of a first reading is the second part. Read the chapters on feedforward networks, regularisation, optimisation and convolutional networks in order, and then the chapter on recurrent networks. As you read, implement small examples in a modern library: a network on a simple dataset of handwritten digits, then a small convolutional network, then a recurrent network on a short text. Seeing gradients flow, losses fall and overfitting appear on your own screen teaches what prose cannot.

Read the practical methodology chapter twice: once on the first pass, and again after you have tried to build something and run into trouble. It will mean more the second time.

On a first pass, skip most of the third part. Return to it selectively. If you are interested in generative models, read the chapters on autoencoders, approximate inference and deep generative models, and skim the material on Boltzmann machines. If you are interested in representation learning, read that chapter, which is less mathematical than its neighbours. Leave the partition function and Monte Carlo chapters until you have a specific need.

A sustainable pace is one chapter of the second part every week or two, with implementation alongside. The whole core can be covered in two to three months by a serious reader working alone. After that, read the transformer paper and a recent survey of large language models, and you will find you can follow them.

Keep a notebook of the mathematical facts you had to look up, and review it weekly. Most readers find the same few gaps returning: matrix calculus, conditional probability and the logic of expectations. Closing those gaps once makes every later chapter easier.

From this shelf, read Shannon and Weaver to understand the entropy and divergence measures behind the loss functions. Read von Neumann's The Computer and the Brain and Wiener's Cybernetics for the older vision of machines modelled on nervous systems. Read Penrose's The Emperor's New Mind afterwards, as a strong argument to test against what you have learned.

Questions to carry

  • Why does depth make some functions much easier to represent than a single wide layer?
  • What exactly does the universal approximation theorem promise, and what does it not?
  • Why can a model with more parameters than training examples still generalise well?
  • How does back-propagation differ from the optimiser that uses its gradients?
  • When is gathering more data better than changing the model?
  • Why are saddle points and flat regions a bigger problem than bad local minima in large networks?
  • What assumptions about images are built into a convolutional network?
  • Why do gradients vanish in recurrent networks, and how do gates help?
  • How did attention prepare the way for architectures without recurrence?
  • What makes a learned representation good, and how could you tell?
  • Why is the partition function such an obstacle for undirected models?
  • What does the contest between generator and discriminator actually optimise?
  • Which parts of this book would you need to change to describe current large language models?
  • What, if anything, would a network need beyond learned representations to understand what it represents?

Words to know

  • Representation: the way data is described inside a model; deep networks learn representations layer by layer.
  • Capacity: the range of functions a model can represent; too little underfits, too much can overfit.
  • Overfitting: performing well on training data but poorly on new data because the model has memorised noise.
  • Generalisation: performance on new data drawn from the same source as the training data.
  • Maximum likelihood: choosing parameters that make the observed data most probable under the model.
  • Cross-entropy: a loss function measuring the mismatch between predicted and true probability distributions.
  • Manifold hypothesis: the assumption that real data lie near low-dimensional surfaces inside high-dimensional space.
  • Rectified linear unit: the activation function that passes positive values and sets negative values to zero.
  • Back-propagation: the efficient computation of gradients by applying the chain rule backward through a computational graph.
  • Stochastic gradient descent: updating parameters using gradients estimated from small random batches of data.
  • Adam: an optimiser that adapts the step size for each parameter using running averages of past gradients.
  • Batch normalisation: normalising the inputs to a layer during training to make deep networks easier to train.
  • Regularisation: any change to learning meant to reduce error on new data rather than training data.
  • Dropout: randomly switching off units during training so the network cannot depend on any single unit.
  • Hyperparameter: a setting chosen before training, such as learning rate or network size, rather than learned.
  • Convolution: applying the same small filter at every position of an input to detect a local pattern anywhere.
  • Pooling: summarising nearby responses in a convolutional network to gain tolerance to small shifts.
  • Recurrent network: a network that processes sequences step by step, carrying a hidden state forward.
  • LSTM: a recurrent unit with a memory cell and gates that preserve information over long sequences.
  • Attention: a mechanism that lets a model weigh different parts of its input when producing each output.
  • Partition function: the normalising sum over all configurations in an undirected probabilistic model, usually intractable.
  • Variational inference: approximating a hard distribution with a simpler one adjusted to be as close as possible.
  • Autoencoder: a network trained to reconstruct its input through a compressed middle layer.
  • Variational autoencoder: an autoencoder trained with variational inference so that it can generate new samples.
  • Generative adversarial network: a generator and a discriminator trained against each other to produce realistic samples.

A note on this edition

This is a study edition written for the shelf in our own words. It is a companion and commentary, not a substitute for the book. It describes the ideas of Deep Learning and offers a way to read it, but it does not reproduce the book's text, equations or figures. The book itself is in copyright and is worth getting from a library or bookshop; its authors have also made a version freely readable online. Any errors of fact or emphasis here are ours, not the authors'.

More from “Foundations of computing”

The whole section →