# karpathy/micrograd

A tiny scalar-valued autograd engine and a neural net library on top of it with PyTorch-like API

Repository: https://github.com/karpathy/micrograd
Canonical: https://ross.abutalabs.com/products/micrograd
Language: Jupyter Notebook
License: MIT
License Family: permissive
Last push: 2026-08-03T04:04:05+00:00

## Health v2 (maintenance only)
Score: 75/100 (v2, computed 2026-09-02T17:46:02.011165+00:00)
- activity 95, release rhythm 35, longevity 100
- inputs: {"age_days": 2333, "days_push": 30, "days_rel": null, "gap_med": null, "n_releases_24m": 0}
- flags: no_releases
- formula: round(0.45*activity + 0.35*rhythm + 0.20*longevity); archived -> min(score, 10)

## Adoption (not part of the score)
Stars 17273, forks 2760 (observed 2026-08-28T04:11:17.899443+00:00)

## What it is
A tiny scalar-valued autograd engine implementing reverse-mode automatic differentiation over a dynamically built DAG, with a small PyTorch-like neural network library on top. It is intentionally minimal (~150 lines total) and designed primarily for educational purposes to understand backpropagation and neural network training.

## Use cases
- learn how backpropagation works from scratch
- understand reverse-mode automatic differentiation
- train a small MLP binary classifier
- visualize computation graphs and gradients with graphviz
- teach a deep learning fundamentals course
- prototype scalar-valued gradient computations

## When to choose
- you want to learn or teach how autograd and backpropagation work internally
- you need a minimal, readable codebase to study rather than a production tool
- you're building tiny educational neural nets like binary classifiers on toy datasets
- you want a dependency-free starting point for understanding frameworks like PyTorch

## When to avoid
- you need performance or GPU acceleration for real training workloads
- you need tensor operations, batching, or vectorized computation - it only works on scalars
- you're building production machine learning systems - use PyTorch, JAX, or TensorFlow instead
- you need a full-featured neural network library with optimizers, layers, and data loaders

## Facets
- artifact type: library
- maturity: stable
- function: machine-learning, deep-learning
- domain: machine-learning, deep-learning, education, tutorials
- platform: python, cross-platform
- tags: autograd, backpropagation, neural-networks, educational, reverse-mode-autodiff, pytorch-like-api, education

## Member repositories
- karpathy/micrograd (main) score 75

## Provenance
- Observed fields: from GitHub, fetched 2026-08-28T04:11:17.899443+00:00.
- Health v2: computed from the inputs above; adoption is never an input.
- Inferred fields (summary, facets, guidance): AI-extracted, prompt v1, taxonomy v1, on 2026-08-29T17:03:26.306288+00:00, confidence not recorded.
  - readme: https://github.com/karpathy/micrograd (fetched 2026-08-28T04:11:17.899443+00:00, sha 3f9f597c6e63)
  - registry_pypi: https://pypi.org/pypi/micrograd/json (fetched 2026-08-29T08:01:14.224550+00:00, sha c05620590a85)
- Data as of 2026-08-30T08:39:29.467469+00:00.
