Abstract
Machine learning has long relied on empirical success, often lacking a unified theoretical framework. This paper surveys how Category Theory (CT) addresses this "research debt" by providing a formal language for compositionality. By treating components like layers, loss functions, and optimizers as morphisms in a category, researchers can rigorously define backpropagation, Bayesian inference, and model equivariance.
Introduction
Deep learning is frequently described as "alchemy"—a collection of effective but poorly understood heuristics. As the field fragments into specialized sub-disciplines like reinforcement learning and computer vision, the lack of a common mathematical "plumbing" becomes a significant hurdle. The core issue is compositionality: while we understand individual components, we lack formal tools to describe their interaction in complex systems. Category Theory, the mathematical study of structure and composition, offers a high-level view that can unify these disparate areas.
Categorical Frameworks for ML
The survey identifies three primary pillars where CT is making significant inroads:
1. Gradient-based Learning
To formalize the "chain rule," researchers use Reverse Derivative Categories. A key innovation is the Para construction, which provides a structural way to handle model parameters. In this framework, parameters are not just external variables but are integrated into the morphism's type.
Furthermore, Lenses and Optics provide a bidirectional framework that naturally captures the forward pass (prediction) and backward pass (gradient update) of neural networks.
2. Categorical Probability
Moving away from traditional measure theory, Markov Categories offer a "synthetic" approach to probability. Using algebraic axioms, these categories define joint distributions, marginalization, and Bayesian inversion through the interaction of morphisms, simplifying the theoretical overhead of probabilistic modeling.
3. Invariant and Equivariant Learning
Unsupervised learning tasks, such as clustering, are analyzed through Functoriality. If an algorithm is a functor, it must preserve the relationships (morphisms) between datasets, such as scaling or isometries. This ensures that the model's behavior is structurally consistent across different data representations.
Key Insights and Theoretical Results
The application of CT to ML yields several profound insights:
- Backpropagation as a Functor: Backpropagation is revealed to be more than an algorithm; it is a structural mapping (a functor) between a category of differentiable functions and a category of "learners." This formalizes how local error signals are propagated globally.
- The Lens Pattern: The bidirectional flow of information—data moving forward and errors moving backward—is an instance of a "Lens," a concept borrowed from functional programming.
- Equivariance as Naturality: The success of Convolutional Neural Networks (CNNs) stems from translation invariance. CT describes these symmetries as natural transformations, ensuring predictable output changes under input transformations.
Conclusion and Future Directions
The primary contribution of this work is the synthesis of disparate research into a coherent map. It demonstrates that "Learners" can be defined as 1-cells in a specific bicategory, Para(Lens(C)), and suggests that Bayesian and gradient updates are both instances of Optics.
However, challenges remain. Current categorical models are often "simply-typed" and struggle with the complex convergence proofs of stochastic calculus. Future work may leverage Kan extensions to understand how models find optimal solutions to abstract problems, potentially bridging the gap between high-level categorical abstraction and low-level implementation details.
Summary updated