Neural networks surround us, in the form of large language models, speech transcription systems, molecular discovery algorithms, robotics, and much more. Stripped of anything else, neural networks are compositions of differentiable primitives, and studying them means learning how to program and how to interact with these models, a particular example of what is called differentiable programming.
This primer is an introduction to this fascinating field imagined for someone, like Alice, who has just ventured into this strange differentiable wonderland. I overview the basics of optimizing a function via automatic differentiation, and a selection of the most common designs for handling sequences, graphs, texts, and audios. The focus is on a intuitive, self-contained introduction to the most important design techniques, including convolutional, attentional, and recurrent blocks, hoping to bridge the gap between theory and code (PyTorch and JAX) and leaving the reader capable of understanding some of the most advanced models out there, such as large language models (LLMs) and multimodal architectures.
Download or buy the book
- Buy the book on the Amazon stores (independently published):
United States | United Kingdom | Germany | France | Spain | Italy | Netherlands | Poland | Sweden | Canada | Australia - Downloaded the updated full draft (03/10/2024).
- A static preprint is also available on arXiv (arXiv 2404.17625).
- For the differences between the versions: errata list.
Table of contents
- Chapter 1: Foreword and introduction
- Chapter 2: Mathematical preliminaries
- Chapter 3: Datasets and losses
- Chapter 4: Linear models
- Chapter 5: Fully-connected layers
- Chapter 6: Automatic differentiation
- Chapter 7: Convolutional layers
- Chapter 8: Convolutions beyond images
- Chapter 9: Scaling up the models
- Chapter 10: Transformer models
- Chapter 11: Transformers in practice
- Chapter 12: Graph layers
- Chapter 13: Recurrent layers
- Appendix A: Probability theory
- Appendix B: 1D universal approximation
Solutions to the exercises
Coming soon!
Additional chapters
I will publish here additional chapters on advanced material that I could not fit into the first volume. Eventually, I hope these will be part of a second volume. More probably, they will languish here forever.
- Model re-use (including parameter-efficient fine-tuning and model merging).
- Density estimation and generative modelling.
- Conditional computation (mixture-of-experts, early exits).
- Metric and self-supervised learning.
- Debugging and understanding the models.