AI Post Transformers

Backprop as Functor: Composing Learners Through Category Theory

AI Post Transformers

Show Notes

This episode examines "Backprop as Functor," which argues that gradient descent on a whole network equals the composition of the gradient-descent learners of its parts. It defines a learner as four pieces: a parameter space, an implementation, an update, and a "request" function. The request tells an upstream module what input it should have received, and this supplies the missing intermediate training target. The discussion explains the categorical machinery in plain terms (categories, functors, monoidal structure, and the Para and Learn categories). It presents the main theorem: a faithful, strong symmetric monoidal functor sends parametrised functions to gradient-descent learners, with the request given by backprop. The episode compares this to difference target propagation, which only approximates backprop, and to lenses and open games, where the request plays the role of the backward "put". It notes that the paper has no experiments and asks whether the formalism does more than restate the fact that the chain rule is functorial. It then starts a worked quadratic-error example showing why the composite update matches plain gradient descent. Listeners get a clear view of what a compositional treatment of backprop does and does not buy.

Sources: 1. Backprop as Functor: A compositional perspective on supervised learning — Brendan Fong, David I. Spivak, Rémy Tuyéras, 2017 http://arxiv.org/abs/1711.10455 2. Backprop as Functor: A compositional perspective on supervised learning — Brendan Fong, David Spivak, Rémy Tuyéras, 2017 (arXiv); LICS 2019 https://scholar.google.com/scholar?q=Backprop+as+Functor%3A+A+compositional+perspective+on+supervised+learning 3. Categorical Foundations of Gradient-Based Learning — G.S.H. Cruttwell, Bruno Gavranović, Neil Ghani, Paul Wilson, Fabio Zanasi, 2021 (arXiv); ESOP 2022 https://scholar.google.com/scholar?q=Categorical+Foundations+of+Gradient-Based+Learning 4. The Simple Essence of Automatic Differentiation — Conal Elliott, 2018 https://scholar.google.com/scholar?q=The+Simple+Essence+of+Automatic+Differentiation 5. Position: Categorical Deep Learning is an Algebraic Theory of All Architectures — Bruno Gavranović, Paul Lessard, Andrew Dudzik, Tamara von Glehn, João G. M. Araújo, Petar Veličković, 2024 https://scholar.google.com/scholar?q=Position%3A+Categorical+Deep+Learning+is+an+Algebraic+Theory+of+All+Architectures 6. Difference Target Propagation — Dong-Hyun Lee, Saizheng Zhang, Asja Fischer, Yoshua Bengio, 2015 https://scholar.google.com/scholar?q=Difference+Target+Propagation 7. Compositional Game Theory — Neil Ghani, Jules Hedges, Viktor Winschel, Philipp Zahn, 2016 (arXiv); LICS 2018 https://scholar.google.com/scholar?q=Compositional+Game+Theory 8. Combinators for Bidirectional Tree Transformations: A Linguistic Approach to the View-Update Problem — J. Nathan Foster, Michael B. Greenwald, Jonathan T. Moore, Benjamin C. Pierce, Alan Schmitt, 2007 https://scholar.google.com/scholar?q=Combinators+for+Bidirectional+Tree+Transformations%3A+A+Linguistic+Approach+to+the+View-Update+Problem 9. Lenses and Learners — Brendan Fong, Michael Johnson, 2019 https://scholar.google.com/scholar?q=Lenses+and+Learners 10. From Open Learners to Open Games — Jules Hedges, 2019 https://scholar.google.com/scholar?q=From+Open+Learners+to+Open+Games 11. Categorical Deep Learning: An Algebraic Theory of Architectures — Bruno Gavranović, Paul Lessard, Andrew Dudzik, Tamara von Glehn, João G. M. Araújo, Petar Veličković, 2024 https://scholar.google.com/scholar?q=Categorical+Deep+Learning%3A+An+Algebraic+Theory+of+Architectures 12. Reverse Derivative Categories — R. Cockett, G. Cruttwell, J. Gallagher, J.-S. P. Lemay, B. MacAdam, G. Plotkin, D. Pronk, 2020 https://scholar.google.com/scholar?q=Reverse+Derivative+Categories 13. Backpropagation in the Simply Typed Lambda-calculus with Linear Negation — Alois Brunel, Damiano Mazza, Michele Pagani, 2020 https://scholar.google.com/scholar?q=Back

More from AI Post Transformers

Oct 24, 2026

This episode explores a 2021 formal proof, in the Lean theorem prover, that decision stumps (one-threshold classifiers) are PAC learnable. It starts from a simple learner that places its threshold at the largest positively labeled training point, so it can only err by calling true positives negative. The discussion explains why formalizing this on the real line is hard. Probability over uncountable spaces needs sigma-algebras and measurability, which textbooks skip, and the Giry monad lets the formal statement stay close to the pencil-and-paper one. It also compares this work with earlier formal ML efforts, including Certigrad's proof of unbiased stochastic backpropagation gradients in Lean, Coq-verified Hoeffding bounds for finite hypothesis classes, and VC-dimension theory, which the paper deliberately leaves out. The episode also sets up the claim that a step in the standard textbook proofs doesn't hold as stated. That claim should interest anyone curious about what machine-checked proofs reveal about familiar learning-theory results.

Oct 24, 2026

This episode explores a 2024 paper that tries to turn mechanistic interpretability into formal guarantees. The idea is to reverse-engineer a small transformer into an algorithm, then use that algorithm to write a much shorter proof of a lower bound on the model's accuracy. The test case is a one-layer, attention-only model trained to output the maximum of four integers. The discussion contrasts this approach with local-robustness verifiers and PAC-Bayes bounds. It also sets out the two trivial extremes: brute-force enumeration of about sixteen million inputs, and a vacuous accuracy bound of zero. The interpretation finds that the model attends to larger tokens, copies what it attends to, and barely depends on position. Treating everything the interpretation leaves unexplained as worst-case yields a "cubic" proof that cuts the compute roughly four-million-fold, at the cost of certifying about 95% accuracy instead of the true 99.9%. Listeners get a clear look at how a better mechanistic understanding could make guarantees cheaper, along with the caveat that the evidence comes from a single tiny model.

Oct 24, 2026

This episode explores the Saxe, McClelland, and Ganguli paper on exact learning dynamics in deep linear neural networks. It explains why these networks are worth studying even though they collapse to a single linear map: their gradient-descent dynamics are still coupled and non-convex, and they show the long plateaus followed by sudden error drops seen in real deep nets. The discussion covers the Baldi and Hornik result that every critical point is a saddle except the best low-rank solution. It then covers the "decoupled invariant manifold," where each input-output mode evolves independently. The mode-strength equation, whose growth rate is proportional to its own value, explains why small initial weights produce long plateaus. The episode argues that depth need not slow learning if the initial conditions are chosen well, and ties this to unsupervised pretraining and to random initialization. Listeners get a clear, step-by-step derivation of why training time depends on the starting point.

Oct 23, 2026

This episode examines PASTA, a method that lets users highlight part of a prompt and has the model attend to it more strongly, without changing any weights. It covers why markup like asterisks may not work as emphasis for LLMs. It then places PASTA against instruction tuning, activation steering (ActAdd, CAA, Inference-Time Intervention) and knowledge editing (ROME, MEMIT, REMEDI). The key difference is that PASTA changes where selected attention heads read, rather than what they output. The discussion explains the mechanism: scores outside the highlighted span are scaled by a small alpha (0.01) and renormalized, which is equivalent to a roughly hundredfold relative boost on the span. The hosts also raise questions about head selection and evaluation, including the absence of comparisons against the neighboring steering methods. Listeners interested in controllability, long-context failures and conflicts between a prompt and a model's memorized knowledge will find it useful.

Oct 23, 2026

This episode examines MEMORILLA, a Stanford-led preprint in which a small trained module reads a whole store of pre-embedded documents and hands a frozen language model just 16 soft-token vectors, instead of pasting retrieved text into the prompt. It motivates the design with a personalization scenario. An old, unrelated chat reveals a preference for blunt feedback, so similarity search may miss it, and the signal is spread across many chats that top-k retrieval can't integrate. The discussion contrasts this approach with full-context prompting, agent memory systems (MemGPT, Mem0, MemoRAG, A-MEM), question-blind compression methods (ICAE, xRAG), and per-corpus cache training (Cartridges). It also traces the design's lineage to Perceiver, BLIP-2's Q-Former and prompt tuning. Listeners get a skeptical framing of the headline claim, including whether gains come from reading the store or from training on the benchmarks, and whether comparing against baselines that weren't trained on them is fair. The evaluation covers personalization, long-document QA, knowledge-intensive QA and a TextWorld agent.

See all episodes →