Warning: Long book review ahead. The point of my long review below is to digest what I've learned, and hopefully to better remember what I've learned for future reference.
"Why Machines Learn" is a fascinating book focused on the math underlying modern AI. With minimal historical and conceptual coverage of AI/ML developments, the book focuses on illustrating - through equations and graphs - the math underlying machine learning. It took me back to high school and college days and it was an enjoyable challenge to follow the math as best as I could. I was able to mostly follow the logic of each individual equation through the first half of the book, whereas I chose to follow the logical train of thought more than the individual equation in the second half of the book.
"Why Machines Learn" draws on linear algebra, calculus, probability and statistics, and optimization theory. It starts out by discussing the perceptron, an algorithm for supervised learning (i.e., using annotated data) of single-layer neural networks that perform binary classifications. In the perceptron, ML learns the weight vector, given a set of input data vectors, to find a hyperplane that linearly separates the data into two groups. The XOR problem, however, stalled ML developments: instances of data points where one cannot draw a straight line to separate two groups (exemplified by four data points, two circles and two triangles, laid out in a square, equally distanced from each other). Minsky and Papert proved that a single layer of perceptrons could not solve such problems. This issue led to the first AI winter, from roughly 1974 to 1980.
Before covering the thawing of that AI winter, Ananthaswamy reviews additional pre-AI winter algorithms, including the least mean squares (LMS) algorithm, one of the most influential ML algorithms and foundational for training neural networks. LSM is the most widely used adaptive algorithm on the planet, used in some form (for example) by every modem in the world. It was also the first algorithm for training an artificial neuron that used an approximation of the method of steepest descent. Every deep neural network today - with millions, billions, possibly trillions of weights - uses some form of gradient descent for training. LMS is the foundation of backpropagation, and backpropagation is the foundation of modern AI.
Ananthaswamy additionally covers probability in predictive analytics, in both the frequentist and Bayesian variants. Bayes' theorem being used specifically to find posterior probability: the prior probability updated given the evidence. Maximum likelihood estimation (MLE) is an example of a frequentist ML algorithm, whereas Maximum a Posteriori estimation (MAP) is an example of a Bayesian ML algorithm. MLE works well for a lot of sampled data, whereas MAP works best with less data. As the amount of sampled data grows, MAP and MLE begin converging in their estimate of the underlying distribution. However, the sample size becomes an issue as we add more features - and in real-life ML problems, features can number in the tens, hundreds, thousands, or more. A trick statisticians and probability theorists use to make the problem more tractable is to assume that all features are sampled from their own distributions independently of one another. It's an assumption that makes the mathematics much easier, and is computationally far less intensive. This assumption is called naive Bayes, or idiot Bayes classifier.
The AI winter broke in the 1980s, especially with the 1986 publication of a pathbreaking paper by Rumelhart, Hinton, and Williams on an algorithm called backpropagation - which showed how to train multi-layer (as opposed to single-layer) perceptrons: neural networks with three or more layers (one input layer, one output layer, and one or more hidden layers in-between). It wouldn't be until the 2000s and especially the 2010s that computers would be powerful enough to handle the demands of these multi-layer neural networks, but when they did, a revolution in deep learning was unleashed. (GPUs were a significant contributor to that take-off as well).
The basis of backpropagation is to determine the error made by the network by comparing the produced output with the expected output and then figure out how to change the weights of the network based on the error so that the network produces the correct output. The algorithm makes the sequence of computations from input to loss differentiable at every step, which means that we can compute the gradient of the loss function. Given the gradient, we can update each weight and bias a little bit and thus perform gradient descent until the loss is acceptably minimized. With backpropagation, you can in principle construct a network with any number of layers, any number of neurons per layer: just provide the network with a set of inputs, figure out what the expected output should be, calculate the loss, calculate the gradient of the loss, update the weights/biases, and rinse and repeat.
Another ML concept, developed by Yann LeCun, is the architecture of the convolutional neural network (CNN), used for grid-like structures, and trained using backpropagation. CNN pools information from many vectors into fewer vectors (illustrated in the book by an image grid of 5x5 being turned into a 4x4 grid and then a 3x3 grid). Max pooling reduces spatial features. -> Designer of CNNs has to make decisions about hyperparameters not learned during the training process, decisions that influence the network's performance: including the size and number of kernel filters, size and number of max pooling filters, number of convolution and max pooling layers, size and number of fully connected layers, and activation functions. "Fine-tuning, or finding the right values for, the hyperparameters is an art unto itself. Crucially, these are not learned via backpropagation" (p. 373).
In ML, each input variable is considered a dimension, and the more complex ML algorithms use thousands or more dimensions (sometimes MANY more). Often, however, much of the variation in high-dimensional data needed to distinguish clusters lies in some lower-dimensional space. Principal Component Analysis (PCA) is used to reduce the data to a tractable number of lower dimensions. If you're having difficulties linearly separating lower-dimensional data, you can do the opposite of PCA: project the data into higher dimensions, sometimes even into an infinite-dimensional space, where there is always some linearly separating hyperplane. This is the basis of the Support Vector Machine (SVM), which uses kernel functions to map data into higher-dimensional spaces.
The SVM algorithm "rocked" the ML community in the 1990s and 2000s, and has been credited for enabling machines to recognize everything from voices, handwriting, and faces to cancer cells. Research in SVMs and kernel methods to some extent derailed research into neural networks until the latter came to dominate ML again from the 2010s onwards. The resulting deep learning revolution happened as researchers started to massively increase the number of hidden layers, using massive amounts of training data and computing power. Today's deep neural networks use billions or even hundreds of billions of neurons and tens or even hundreds of hidden layers - and have led to significant improvements in computer vision, natural language processing, machine translation, medical image analysis, pattern detection in financial data, and much more.
Whereas most of the book covers the mathematics behind ML, the final chapter (Chapter 12) and the Epilogue discuss how we've arrived at a point where standard ML theory and our mathematical understanding can no longer adequately explain why today's deep neural networks work so well. This is the concept of grokking, first discovered by OpenAI in 2020. Typically, models have a bias-variance trade-off: the simper the model, the greater the bias (leading to underfitting, and a higher risk of both training and test errors); the more complex the model, the greater the variance (leading to overfitting, a lower risk of training error, and a higher risk of test error). In models that are too complex, the classification boundary tracks every little deviation in the data, overfitting them: resulting in the model doing really well on the training data, but making significant classification errors during testing. Theoretically, neural networks should follow the Goldilocks principle, as the best model is one that lands somewhere in the middle of the two.
However, deep neural networks are not behaving like this. Instead, as depicted on a double-descent graph on page 405, as networks become bigger, after initial overfitting, the test errors are minimized again. Deep networks are over-parameterized and should overfit and not generalize well to unseen test data, YET THEY DO. This absence of overfitting in very complex model, or the ability to generalize from the data long after initial overfitting, is what is called grokking, and it's something that standard ML theory and math cannot adequately explain. With grokking, networks do better than could be expected from a model that had simply memorized the training data, seemingly being able to "understand" and reason about the data's rules and patterns at a deeper level. [Note that I do not have the expertise to fully evaluate if the author is overstating the discrepancy from traditional ML and math here, and/or whether grokking might be better understood and explained today.]
"Why Machines Learn" ends with very brief coverage of ChatGPT and related generative AI, stating that one of the most significant developments of the past 5 years is self-supervised learning, a method that takes unlabeled data and creates implicit labels without human involvement and then supervises itself (and is the basis of ChatGPT). This has freed ML from having to use expensive, human-annotated data. The author notes that scaling - using either more parameters or more training data or both - has produced "emergent" behavior, leading to debates on whether LLMs are starting to reason and even model the world. "Researchers are at odds over whether LLMs are actually doing any reasoning or are simply regurgitating text that satisfies the statistical patterns and regularities they encounter in the training data, or even whether there's any meaningful difference between these two ideas" (p. 403). My best guess is that LLMs are more regurgitators than anything, and even the reasoning that is being produced is just a result of taking more time to respond and break things down into steps. But perhaps there's some truth to there being less of a stark difference between the two. It will definitely be interesting to see what the future holds in this regard.