#6565th of 171 in Learning and cookbooks

micrograd

Scalar-valued autograd engine and tiny neural net library in about 150 lines of Python

Stars
19.2k
License
MIT
Last commit
Aug 2026
Language
Jupyter Notebook
Stars, last 35 weeks+4,093
25 Mar 2026: 15,091 stars1 Apr 2026: 15,180 stars8 Apr 2026: 15,273 stars15 Apr 2026: 15,373 stars22 Apr 2026: 15,466 stars29 Apr 2026: 15,575 stars6 May 2026: 15,657 stars13 May 2026: 15,741 stars20 May 2026: 15,835 stars27 May 2026: 15,958 stars3 Jun 2026: 16,065 stars10 Jun 2026: 16,158 stars17 Jun 2026: 16,261 stars24 Jun 2026: 16,364 stars1 Jul 2026: 16,468 stars8 Jul 2026: 16,572 stars15 Jul 2026: 16,668 stars22 Jul 2026: 16,755 stars29 Jul 2026: 16,855 stars5 Aug 2026: 16,957 stars12 Aug 2026: 17,059 stars19 Aug 2026: 17,168 stars26 Aug 2026: 17,253 stars2 Sept 2026: 17,354 stars9 Sept 2026: 17,439 stars16 Sept 2026: 17,542 stars23 Sept 2026: 17,639 stars30 Sept 2026: 17,732 stars7 Oct 2026: 17,811 stars14 Oct 2026: 17,925 stars21 Oct 2026: 18,024 stars28 Oct 2026: 18,235 stars4 Nov 2026: 18,721 stars11 Nov 2026: 18,902 stars18 Nov 2026: 19,065 stars25 Nov 2026: 19,184 stars

15,091 on 25 Mar 202619,184 on 25 Nov 2026

From GitHub's daily star counts.

Checked on GitHub.

Overview

micrograd implements reverse-mode autodiff over a dynamically built DAG of scalar values, with a small PyTorch-like neural network module on top. The engine is about 100 lines and the nn library about 50. A demo notebook trains a 2-layer MLP with two 16-node hidden layers as a binary classifier on the moon dataset, using an SVM max-margin loss and SGD.

Who it is for: Students and engineers learning how backpropagation and autograd work

Strengths

  • Engine and nn library are about 100 and 50 lines, readable in one sitting
  • PyTorch-like API: Value, Neuron and MLP classes with backward()
  • Notebook demos training on the moon dataset and graphviz graph tracing
  • Unit tests check gradients against PyTorch as a reference

Weaknesses

  • Operates on scalars only, so no tensors and very slow for real models
  • No GPU support
  • Demo covers only binary classification with an SVM loss and SGD
  • Tests need PyTorch installed; no tagged releases

What it needs

  • no GPU
  • Needs PyTorch (tests only), graphviz (tracing notebook)

Also in Learning and cookbooks

See all 171
Also in Learning and cookbooks
RankProjectScore
#63agentcore-samplesSample code and tutorials for deploying agents on Amazon Bedrock AgentCore3.6k stars+72 (+2.1%) in 30 daysApache-2.054 out of 100
#64happy-llmChinese-language course on LLM theory and building a LLaMA2-style model Live demo ↗ (opens in a new tab)35.1k starscustom license53 out of 100
#66all-in-ragChinese-language RAG tutorial with code, from chunking to Graph RAG13.4k starsno license52 out of 100
#67tensorflow/examplesOfficial TensorFlow example notebooks, community samples and course material8.3k starsApache-2.052 out of 100
#68deep-rl-classHugging Face's free course on deep reinforcement learning, with notebooks5.1k starsApache-2.052 out of 100