5  Computation

Up to now we have relied on frameworks to manage model construction, parameters, initialization, and device execution behind the scenes. Moving from textbook prototypes to production-scale systems requires opening that black box. Training an 8-billion-parameter language model in 32-bit floating point with Adam demands 128 GB of parameter, gradient, and optimizer state before storing a single activation, and runs across thousands of GPUs where hardware failures interrupt training every few hours. At that scale, understanding how frameworks represent, initialize, compute with, and persist models is essential.

Everything in this chapter builds on one central data structure: a neural network is a tree of modules whose leaves hold its state—trainable parameters and fixed buffers alike—each addressed by its path from the root. Every framework operation walks that same tree:

Resources and Further Reading

The resources below accompany the sections of this chapter; each names the section it goes with. All are freely accessible online except where noted.

Books

Courses and video lectures

Tutorials, notes, and interactive

Foundational papers