Doom_Learn: A Nueral Network Library
02/blog-post

Basically wanted to learn how nueral networks work and also was pulled in by those cool visuals made in 3brown1blues video

Back to Blog
17 May 2026RustML

All started from a ML hackathon at out college called NumiNova, we were joking about how all ts could be solved by just a machine.learn() command. The main inspiration was to have a fast enough function that could make a nueral network just from one function call. Rust was the obvious choice for this project since it is a systems programming language and it is also very fast (and i had js learned it)

Also, I should probably mention that I was pretty new to Rust when I started this, and I wasnt exactly a huge fan of the math behind neural networks either(nothing shld be this complex). Stuff like gradients, backpropagation and tensors (big words) sounded way more complicated than sum i wanted to deal with (but i was js too lazy to use numpy). But that was kind of the point of the project

The idea is basically to build a tiny version of PyTorch from scratch in Rust, implementing just enough to eventually build and train a neural network using the framework itself.Avoided using CUDA cuz I really didnt wanna mess with gpu stuff, so as of now it is only CPU based and it works fast enough to have a simple nueral network (so that dream of machine.learn() woudl work)

The coolest part so far has probably been working the computational graph and automatic differentiation. Every time an operation happens, like adding or multiplying two tensors, the result needs to remember how it was created and which tensors were involved. Calling backward() then means walking backwards through that graph and using the chain rule to calculate how each value contributed to the final result. Doing this in Rust also introduced me to stuff like Rc and RefCell way earlier than I expected, because tensors can be used by multiple operations while their gradients still need to be updated later. Right now Doom_Learn can create and manipulate tensors, handle broadcasting, perform matrix operations, build a computational graph, calculate gradients automatically and run data through a Linear layer. It still can't properly train anything yet, but activation functions, loss functions and an optimizer are next. I'm not trying to compete with PyTorch(or actually well coded modules) Doom_Learn will probably be so much slower and have a fraction of the features(only enough to larp about writing this) but maybe one day ill finish this and it will be good enough for actual data :pray: