[2604.07242] Weaves, Wires, and Morphisms: Formalizing and Implementing the Algebra of Deep Learning
Abstract:Despite deep learning models running well-defined mathematical functions, we lack a formal mathematical framework for describing model architectures. Ad-hoc notation, diagrams, and pseudocode poorly handle nonlinear broadcasting and the relationship between individual components and composed models. This paper introduces a categorical framework for deep learning models that formalizes broadcasting through the novel axis-stride and array-broadcasted categories. This allows the mathematical function underlying architectures to be precisely expressed and manipulated in a compositional manner. These mathematical definitions are translated into human manageable diagrams and machine manageable data structures. We provide a mirrored implementation in Python (pyncd) and TypeScript (tsncd) to show the universal aspect of our framework, along with features including algebraic construction, graph conversion, PyTorch compilation and diagram rendering. This lays the foundation for a systematic, formal approach to deep learning model design and analysis.
Published in Transactions on Machine Learning Research (08/2026) Weaves, Wires, and Morphisms: Formalizing and Imple- menting the Algebra of Deep Learning Vincent Abbott ∗ vtabbott@mit.edu Laboratory for Information and Decision Systems, Massachusetts Institute of Technology Gioele Zardini ∗…
saved by
related reading
- A Mathematical Framework for Transformer Circuitstransformer-circuits.pub
- [2604.21691] There Will Be a Scientific Theory of Deep Learningarxiv.org
- 2404.17625arxiv.org
- Modular Manifolds - Thinking Machines Labthinkingmachines.ai
- [2604.21691] There Will Be a Scientific Theory of Deep Learningarxiv.org
- [2606.06624] Principles and Practice of Deep Representation Learning: or a Mathematical Theory of Memoryarxiv.org
- [2410.21265] Modular Duality in Deep Learningarxiv.org
- NL.pdfabehrouz.github.io
- [2403.14606] The Elements of Differentiable Programmingarxiv.org
- The Building Blocks of Interpretabilitydistill.pub
- Deep learning as program synthesis — LessWronglesswrong.com
- Robust Code Generation of Efficient Tensor Computation Using 𝔽_2arxiv.org