Grace: The Value of Choice
A course in reinforcement learning, from bandits to policy optimisation
Reinforcement learning is learning what to do when nobody says which actions are correct. What an action is worth can be found out only by taking it, and the payment for it can arrive many steps later, with nothing attached to say which action earned it. This book makes those two difficulties precise enough to compute with, and proves what can still be guaranteed once they are.
- Format
- Paperback, 457 pages, 27 chapters
- Published
- 3 October 2026
- ISBN
- 979-8178618011
- Exercises
- 12 folders covering 15 chapters, MIT-licensed, free
How it is built
The mathematics is carried by a story. In the Verge, reward arrives like weather, hours or days after the act that earned it, and people live with it by deciding in advance what the weather likes. Gridfall has a man who will not cross the mill bridge on a Thursday and has never once lost money, and the town treats him as an authority on bridges. Grace is nineteen and the last apprentice of a guild whose entire claim was that this is not how the world has to be read. Her teacher walked east into the Long Horizon eleven years ago and has not come out. Each chapter puts Grace somewhere she cannot yet do what she needs to, and she works it out in her Ledger, wrongly at first. The theory starts from what she wrote.
What it covers
The first two chapters treat a problem with one state and nineteen choices, which is small enough to solve completely. After them come Markov decision processes and dynamic programming, optimal control, Monte Carlo and temporal-difference learning, function approximation and deep RL, model-based methods, policy gradients and trust regions, imitation and inverse RL, learning from human feedback, and offline and multi-agent learning. The closing chapter is about what happens as the discount factor approaches one, where most of the guarantees stop being useful. Every result is proved, with three exceptions that say on the page where their proof is. No proof depends on Grace, so the story can be skipped without losing any of the mathematics.
The exercises are free
Each exercise turns one theorem of its chapter into a measurement. The contraction rate becomes a straight line on a log plot, Baird's counterexample diverges, and the forward and backward views of TD(λ) agree to sixteen digits. Everything runs in Python on the free tier of Colab. The proofs need undergraduate probability, linear algebra and some calculus, and the two inequalities that do most of the work, Hoeffding's and Jensen's, are stated where they first appear. The book was written for the master's course in reinforcement learning at Sapienza University of Rome.
The exercises are public: each one is a folder with a skeleton to fill in, the tests that check it, and the script that runs the experiment. Nothing in them needs a GPU, and the code is MIT-licensed.