4  Introduction

In the 1990s, Yann LeCun trained a convolutional neural network called LeNet-5 (LeCun et al. 1998) to read handwritten digits on bank checks - and it worked so well that it was deployed in production by several banks across the United States. For the first time, a machine could reliably read human handwriting, a task that had defeated every rule-based system ever built.

In 2012, Andrew Ng led a team at Google Brain that trained a massive neural network on 10 million unlabeled images from YouTube. Without ever being told what a cat was, the network spontaneously learned to detect cats - a result so surprising it made the front page of The New York Times. That same year, Alex Krizhevsky, Ilya Sutskever, and Geoffrey Hinton stunned the computer vision community by winning the ImageNet competition with AlexNet (Krizhevsky et al. 2012), a deep convolutional neural network that crushed the competition by a margin so large it effectively ended the debate about whether deep learning worked.

In 2017, Google DeepMind's AlphaGo (Silver et al. 2016) defeated Ke Jie, the world's number-one Go player, in a three-game match. Go has more possible positions than there are atoms in the observable universe, and for decades it was considered decades away from being solved by AI. AlphaGo solved it with a combination of deep neural networks and reinforcement learning.

In November 2022, OpenAI launched ChatGPT. Within five days it had one million users. Within two months it had 100 million - the fastest-growing consumer application in history. For the first time, ordinary people could hold a conversation with an AI that felt genuinely intelligent.

In 2025, humanoid robots powered by neural networks - from companies like Figure, Boston Dynamics, and Agility Robotics - began performing real tasks in warehouses and factories. Vision-language-action models allowed robots to understand spoken instructions and translate them into physical movements.

These milestones are not isolated events. They are waypoints on an exponential curve. Each one was built on the foundations laid by the previous breakthroughs, and each one was dismissed as impossible just a few years before it happened. This book is about understanding that curve - where it came from, where it is now, and where it is going - and about giving you the tools to build on it yourself.

TipWho This Book Is For

This book assumes you have basic programming experience and some familiarity with mathematics (linear algebra, calculus, probability). You do not need prior experience with machine learning or neural networks - we will build that understanding from the ground up. By the end, you will be able to train models, build agentic systems, and understand the research papers that define the frontier.

4.1 Artificial Intelligence

Artificial intelligence is a field of computer science created with the ambition of building machines that can think. The term was coined by John McCarthy in 1956 at the Dartmouth Conference (McCarthy et al. 1955), where a small group of researchers - including Marvin Minsky, Claude Shannon, and Nathaniel Rochester - gathered with the bold hypothesis that “every aspect of learning or any other feature of intelligence can in principle be so precisely described that a machine can be made to simulate it.”

That hypothesis turned out to be correct in spirit but wildly optimistic in timeline. The early AI researchers imagined that human-level machine intelligence was perhaps 20 years away. Instead, the field went through decades of hype, disappointment (the infamous “AI winters”), and incremental progress before the deep learning revolution of the 2010s finally delivered on some of those original promises.

Today, AI encompasses a broad family of techniques:

  • Symbolic AI (also called “good old-fashioned AI” or GOFAI): Systems that reason using explicit rules and logic. Expert systems, theorem provers, and game-playing programs like IBM's Deep Blue belong here.
  • Statistical AI / Machine Learning: Systems that learn patterns from data. This includes classical techniques like support vector machines, random forests, and logistic regression.
  • Deep Learning: A subset of machine learning that uses neural networks with many layers. This is where the revolution happened - and it is the focus of this book.
  • Generative AI: Systems that produce new content - text, images, audio, video, code. Large language models like GPT-4 and Claude, image generators like Stable Diffusion, and music generators like Suno all fall here.
NoteThe AI Landscape in One Sentence

All of deep learning is machine learning, all of machine learning is AI, but not all AI is machine learning - and certainly not all AI is deep learning. When people say “AI” in 2025, they almost always mean deep learning or generative AI specifically.

4.2 Machine Learning

Machine learning is a paradigm in which machines learn from data rather than being explicitly programmed. The core idea is deceptively simple: instead of writing rules by hand, you show the machine many examples and let it discover the rules itself.

Consider a classic problem: how do you write a program to distinguish between a cat and a dog? You could try writing explicit rules - “cats have pointy ears, dogs have floppy ears” - but this fails immediately. Some cats have floppy ears (Scottish Folds). Some dogs have pointy ears (German Shepherds). The animal might be partially obscured, photographed from an unusual angle, or in unusual lighting. Every rule you write has exceptions, and every exception needs its own rules, and those rules have their own exceptions. The approach collapses under its own complexity.

Yet a three-year-old child can distinguish cats from dogs effortlessly, having seen perhaps a dozen examples of each. The child does not learn explicit rules - she learns by exposure, building an internal representation of “catness” and “dogness” that is robust to variations in pose, lighting, breed, and context.

Machine learning replicates this process computationally. You collect thousands of labeled images (“this is a cat,” “this is a dog”), feed them to a learning algorithm, and the algorithm adjusts its internal parameters until it can reliably classify new, unseen images. The critical insight is that the programmer never specifies what features distinguish cats from dogs - the algorithm discovers them.

There are three main flavors of machine learning:

  1. Supervised learning: The training data includes labels (correct answers). You show the model an image and tell it “this is a cat.” The model learns to predict labels for new, unseen data. Classification and regression are supervised tasks.
  2. Unsupervised learning: The training data has no labels. The model must discover structure on its own - clusters, patterns, relationships. Dimensionality reduction, clustering, and generative modeling are unsupervised tasks.
  3. Reinforcement learning: The model learns by interacting with an environment and receiving rewards or penalties. It discovers strategies through trial and error. AlphaGo, robotic control, and RLHF (reinforcement learning from human feedback, used to fine-tune ChatGPT) are reinforcement learning.
CautionThe Unreasonable Effectiveness of Data

One of the most important lessons of modern machine learning is that more data almost always beats a better algorithm. A simple model trained on a billion examples will often outperform a sophisticated model trained on a million. This insight - sometimes called “the bitter lesson” (Sutton 2019) (after Richard Sutton's famous essay) - is one of the driving forces behind the scaling revolution in AI.

4.3 Deep Learning

Deep learning is, at its core, a simple idea: use neural networks with more than one layer to learn hierarchical representations of data. That is the entire definition. But the consequences of this simple idea have been extraordinary.

The word “deep” in deep learning refers to the depth of the network - the number of layers between the input and the output. A network with one hidden layer is “shallow.” A network with dozens or hundreds of layers is “deep.” The key insight is that each layer learns to represent the data at a different level of abstraction. In an image recognition network:

  • The first layer learns to detect edges and simple textures.
  • The second layer combines edges into corners, curves, and simple shapes.
  • The third layer combines shapes into parts - eyes, ears, noses.
  • The fourth layer combines parts into objects - faces, animals, cars.
  • Deeper layers learn increasingly abstract and task-specific representations.

This hierarchy of representations is what gives deep learning its power. Instead of engineering features by hand (as classical machine learning required), the network learns its own features - and the features it learns are often more effective than anything a human engineer would design.

4.3.1 Neural Nets

A neural network is a computational model inspired - loosely - by the structure of biological brains. It consists of layers of interconnected “neurons,” where each neuron performs a simple computation: it takes a weighted sum of its inputs, adds a bias term, and passes the result through a nonlinear activation function.

The first hardware neural network was built by Frank Rosenblatt at Cornell in 1958 (Rosenblatt 1958). His “Mark I Perceptron” was a room-sized machine with 400 photocells connected to a layer of artificial neurons by a tangle of wires. It could learn to distinguish simple shapes - triangles from squares, for instance - by adjusting the connections between neurons based on whether it got the right answer.

TipFrom Room-Sized to Pocket-Sized

Rosenblatt's Perceptron filled an entire room and could barely distinguish shapes. Today, the neural network in your smartphone's camera can identify faces, read text, segment objects, and apply artistic styles - in real time, using less power than a light bulb. The algorithms are fundamentally the same; what changed is the scale of computation.

Fortunately, today you do not need messy hardware to experiment with neural networks. Modern frameworks like PyTorch handle all the mathematical details - gradient computation, memory management, GPU acceleration - and let you focus on designing and training your models.

4.3.2 The Standard Deep Learning Recipe

Regardless of whether you are building an image classifier, a language model, or a robotic controller, the recipe for deep learning follows the same fundamental pattern:

  1. Gather the data. Collect or download a dataset relevant to your task. For image classification, this means images with labels. For language modeling, this means text corpora. For reinforcement learning, this means an environment the agent can interact with.
  2. Preprocess the data. Convert the raw data into a format the neural network can consume - typically tensors of floating-point numbers. Images are converted to pixel arrays and normalized. Text is tokenized into integer sequences. Tabular data is scaled and encoded.
  3. Design the architecture. Choose a neural network architecture suited to your data and task. Convolutional networks (CNNs) for images, transformers for text, recurrent networks for sequences, and so on.
  4. Train the model. Feed the data through the network, compute a loss (how wrong the model's predictions are), and use backpropagation and an optimizer (like Adam or SGD) to adjust the network's weights to reduce the loss. Repeat for many epochs.
  5. Evaluate and iterate. Test the model on held-out data it has never seen. If performance is insufficient, adjust the architecture, hyperparameters, or data, and retrain.
  6. Deploy. Use the trained model to make predictions on new data. This might mean hosting it as an API, embedding it in a mobile app, or running it on an edge device.

This recipe holds true at every scale - from a weekend project classifying anime characters to training a trillion-parameter language model on a cluster of thousands of GPUs. The principles are identical; only the scale changes.

ImportantYour First Project: A Practical Starting Point

If you have never trained a neural network before, here is the simplest path to a working project:

  1. Install PyTorch (pip install torch torchvision).
  2. Use a Vision Transformer (ViT) pretrained on ImageNet as your starting point. The torchvision library provides several pretrained ViT variants.
  3. Collect 50-100 images for each class you want to classify (use DuckDuckGo image search, or curate from existing datasets on Hugging Face).
  4. Fine-tune the pretrained ViT on your custom dataset. This requires only a few dozen lines of code and trains in minutes on a modern GPU.
  5. Deploy the model on Hugging Face Spaces for free - you will have a working web app that anyone can use.

The fast.ai course by Jeremy Howard provides excellent step-by-step guidance for exactly this workflow.

4.3.3 What This Book Covers

This book is organized as a journey through the landscape of modern AI:

  • Chapters 1-3 establish the foundations: the history of deep learning, the rise of foundational models (transformers, GPT, BERT, and beyond), and the key concepts you need to understand everything that follows.
  • Chapter 4 covers the engineering of agentic systems - building AI that can take actions in the world, use tools, and collaborate with other agents.
  • Chapter 5 is the heart of the book: building your own AI from scratch, covering architecture design, training, and deployment.
  • Chapters 6-10 explore advanced topics: model fusion, multimodality, compression, explainability, and interpretability.
  • Chapters 11-12 address the cutting edge: prompt attacks and security, and the path toward AGI and ASI.
  • Chapters 13-22 cover frontier topics: distillation, world models, reinforcement learning, geometric deep learning, and research directions that will define the next decade of AI.

Let us begin by looking at the history of deep learning - not from the very beginning, but from the moment it started capturing the public's imagination with AlphaGo.

4.4 A Glimpse of the Future: The Era of Experience

Before we dive into history, it is worth pausing to consider where all of this might be heading - because the trajectory is extraordinary.

In 2025, David Silver and Richard Sutton - two of the most influential figures in reinforcement learning, and the architects behind AlphaGo and the foundational theory of RL respectively - published a visionary paper titled Welcome to the Era of Experience (Silver and Sutton 2025). Their thesis is profound: we are leaving the “Era of Data,” in which AI systems learn from static, human-generated datasets, and entering the “Era of Experience,” in which AI systems learn primarily from their own interactions with the world.

The distinction matters enormously. In the Era of Data, AI is fundamentally limited by human knowledge - it can only learn what humans have written down, photographed, or recorded. A language model trained on the internet can, at best, recombine existing human knowledge. It cannot discover genuinely new knowledge, because its entire training signal comes from the past.

In the Era of Experience, AI systems generate their own training data through interaction. An RL agent playing chess does not need a dataset of human chess games - it plays against itself, billions of times, and discovers strategies that no human has ever conceived. AlphaZero (Silver et al. 2017) demonstrated this dramatically: trained entirely through self-play with zero human data, it not only surpassed all human chess knowledge but developed novel strategies that grandmasters described as “alien” and “beautiful.”

Silver and Sutton argue that this paradigm will generalize far beyond games. As AI systems gain the ability to interact with digital environments (writing and executing code, browsing the web, operating computers) and physical environments (through robotics), they will increasingly learn from experience rather than from human-curated datasets. The implications are staggering: AI systems that can discover knowledge beyond what humans currently know.

ImportantThe Three Eras of AI
  1. The Era of Rules (1950s-2000s): Humans write explicit rules. AI is limited by human ability to articulate knowledge. (Expert systems, symbolic AI.)
  2. The Era of Data (2010s-2020s): AI learns from human-generated data. Limited by the quantity, quality, and scope of human data. (Deep learning, LLMs, diffusion models.)
  3. The Era of Experience (2025+): AI learns from its own interactions with the world. Limited only by compute and environment access. (RL agents, self-play, world models.)

Read the original paper: “Welcome to the Era of Experience” (Silver and Sutton 2025).

4.4.1 Will Data Even Matter?

One of the most provocative recent developments is the emergence of research on training with zero data. Several papers on arXiv have demonstrated that neural networks can, under certain conditions, be trained without any external data at all - using synthetic data generated by the model itself, mathematical structure inherent in the task, or self-supervised objectives that require no labeled examples.

This is not as paradoxical as it sounds. Consider:

  • Self-play in games: AlphaZero was trained with literally zero human data. The rules of chess were sufficient - the system generated all its own training data through self-play.
  • Synthetic data generation: Models like Phi (Microsoft) have shown that training on carefully generated synthetic data can match or exceed training on real data. If an AI can generate its own high-quality training data, the bottleneck shifts from “do we have enough data?” to “do we have enough compute to generate and train on it?”
  • Test-time compute: Reasoning models like OpenAI's o1 (OpenAI 2024) and DeepSeek-R1 (Guo et al. 2025) improve their performance not by training on more data, but by spending more compute at inference time - “thinking longer” about each problem. This decouples performance from dataset size entirely.

If these trends continue - and there is every reason to believe they will - the traditional bottleneck of AI (“we need more data”) may largely disappear. What remains is compute. The ability to train larger models, run more self-play episodes, generate more synthetic data, and allocate more test-time reasoning - all of these scale with compute, not with data collection.

NoteThe Only Bottleneck That Matters

In the future, compute may be the only bottleneck. Data can be synthesized. Algorithms are converging (transformers dominate nearly every domain). Hardware is improving but remains physically constrained by chip fabrication, energy supply, and cooling. The companies and nations that control the most compute - through GPU clusters, custom chips (TPUs, Trainium, Groq), and energy infrastructure - may control the future of AI. This is why the geopolitics of chip manufacturing (TSMC, NVIDIA, export controls) has become a matter of national security.

References

Guo, Daya, Dejian Yang, Haowei Zhang, et al. 2025. DeepSeek-R1: Incentivizing Reasoning Capability in LLMs via Reinforcement Learning.” arXiv Preprint arXiv:2501.12948.
Krizhevsky, Alex, Ilya Sutskever, and Geoffrey E Hinton. 2012. “ImageNet Classification with Deep Convolutional Neural Networks.” Advances in Neural Information Processing Systems.
LeCun, Yann, Léon Bottou, Yoshua Bengio, and Patrick Haffner. 1998. “Gradient-Based Learning Applied to Document Recognition.” Proceedings of the IEEE 86 (11): 2278-324.
McCarthy, John, Marvin L. Minsky, Nathaniel Rochester, and Claude E. Shannon. 1955. “A Proposal for the Dartmouth Summer Research Project on Artificial Intelligence.”
OpenAI. 2024. O1 System Card. https://cdn.openai.com/o1-system-card.pdf.
Rosenblatt, Frank. 1958. “The Perceptron: A Probabilistic Model for Information Storage and Organization in the Brain.” Psychological Review 65 (6): 386.
Silver, David, Aja Huang, Chris J Maddison, et al. 2016. “Mastering the Game of Go with Deep Neural Networks and Tree Search.” Nature 529: 484-89.
Silver, David, Thomas Hubert, Julian Schrittwieser, et al. 2017. “Mastering Chess and Shogi by Self-Play with a General Reinforcement Learning Algorithm.” arXiv Preprint arXiv:1712.01815.
Silver, David, and Richard S Sutton. 2025. “Welcome to the Era of Experience.” arXiv Preprint arXiv:2503.01307.
Sutton, Richard S. 2019. The Bitter Lesson. http://www.incompleteideas.net/IncIdeas/BitterLesson.html.