

Category Theory for Tiny ML in Rust — Workshop 3
Make the Arrows Explicit
In Workshop 2, we made ML objects explicit as Rust types.
We stopped treating everything as raw numbers and began encoding concepts such as:
Input
Weight
Prediction
Target
Loss
Gradient
LearningRate
ModelState
as distinct Rust types.
In Workshop 3, we go one step further.
We make the transformations explicit.
Instead of only asking:
“What are the meaningful things in this ML pipeline?”
we now ask:
“How does one meaningful thing transform into another?”
We will look at a tiny neural network pipeline as a sequence of typed transformations:
Input → Logit
Logit → Probability
Prediction × Target → Loss
Loss → Gradient
Neuron → Updated Neuron
This is where category theory becomes practical.
Objects become Rust types.
Morphisms become functions and methods.
Composition becomes the training pipeline.
An optimizer step becomes an endomorphism over model state.
The goal is not to replace Python.
The goal is not to use category theory as decoration.
The goal is to make a small ML system easier to reason about by making its structure executable.
We will continue working with a tiny neuron in Rust and refine the design from Workshop 2:
making transformations more explicit
separating raw numbers from meaningful concepts
improving the role of
Logit,Probability,Prediction,Loss, andGradientdiscussing when a function should be standalone versus attached to a type
connecting Rust functions to category-theoretic morphisms
using the compiler to catch conceptual confusion earlier
You do not need to be a Rust expert.
You do not need to be an ML expert.
You do not need to be a category theory expert.
If you are curious about how small AI systems can become more explicit, composable, and understandable, this workshop is for you.
Not abstraction cosplay.
Executable structure.