Minimal Automatic Differentiation Engine in Rust
2025-06-20
This is a minimal automatic differentiation engine written in Rust. It can train a tiny Multi-Layer Perceptron to learn the XOR function and render a computation graph of a single Perceptron to graph.html. The core is the Scalar struct, storing value, optional gradient, and an Edge describing the operation that produced it. Operator overloads and helper functions build a directed acyclic graph, caching the local derivative for every edge. `backward()` recursively propagates gradients from the output node, accumulating them into leaf nodes created with `Scalar::new_grad`. The graph can be visualized with `plot::dump_graph`.
Development
Automatic Differentiation