#130 · Primary category: Deep Learning Frameworks

magnetron

artificial-intelligence cpp cuda high-performance-computing machine-learning neuronal-network python pytorch research-project tensorflow tiny

A zero-dependency ML framework in C with a modern Python API for full control over execution and memory.

Project last updated:08/28/26

GitHub Stars

707

Forks

37

Contributors

5

License

Apache-2.0

Why we included this project

Magnetron is a machine learning runtime written from scratch in C, with a thin Python layer on top. It implements its own tensor system, operator set, autograd engine, and execution model, so nothing is hidden behind a large framework. If you want to trace how a tensor operation reaches a kernel or how autograd walks the graph during backward, the whole path is open to read and modify. It is also practical rather than a toy: the examples include Qwen3 inference, GPT-2 with KV caching, and training loops for an autoencoder and a simple MLP. The CPU backend detects hardware at runtime, with compile-time optimized kernels covering SSE through AVX-512 and ARM NEON, and a memory-mapped .mag format loads models without copying. That makes it a good fit for systems programmers and researchers who want to port workloads to unusual hardware or change execution internals without wrestling a layered stack.

Articles for this project

No articles for this project yet.

To suggest a topic or contribute an article, contact us.

Related projects in this category