autograd
Efficiently computes derivatives of NumPy code.
What it is and what it does
Autograd is a library that automatically computes derivatives of Python and NumPy functions without requiring you to write gradient code by hand. It handles a large subset of Python's features—loops, conditionals, recursion, closures—and can differentiate functions multiple times over. The library supports both reverse-mode differentiation (efficient for scalar-valued functions with many inputs, as in neural networks) and forward-mode differentiation, and these can be composed arbitrarily.
The main use case is gradient-based optimization: you define a function in NumPy, wrap it with autograd's grad function, and get back a function that computes its gradient. This is particularly useful for training neural networks, Bayesian inference, and other machine learning tasks where you need gradients but don't want to manually implement backpropagation. Autograd provides a thin wrapper around NumPy that tracks operations for differentiation.
Use it for:
- Training neural networks by computing gradients for backpropagation without manual derivative code.
- Implementing Bayesian inference methods like HMC or variational inference that require gradients of log-probability functions.
- Optimizing functions where analytical gradients are tedious or error-prone to derive by hand.
- Computing higher-order derivatives (e.g., Hessians) for second-order optimization methods.
- Prototyping machine learning models in pure Python/NumPy with automatic gradient computation.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Autograd automatically computes derivatives of Python and NumPy code, supporting both reverse-mode (backpropagation) and forward-mode differentiation for gradient-based optimization.
Yes. Autograd is actively maintained, has no known vulnerabilities, installs with low friction, and is permissively licensed. It is a solid choice if you need automatic differentiation for NumPy-based code and prefer a lightweight, pure-Python solution over heavier frameworks.
Install
autograd on PyPI
pip
pip install autograduv
uv add autogradpoetry
poetry add autogradInstalling autograd
Before you install
Low friction install with a single runtime dependency (numpy). Actively maintained with recent releases; last commit 2026-08-10. Supports current Python versions (3.10–3.14).
License in practice
MIT license is permissive; you can use, modify, and distribute this package freely in proprietary and open-source projects with minimal restrictions.
Quickstart
pip install autograd
import autograd.numpy as np
from autograd import grad
def f(x):
return x**3
grad_f = grad(f)
print(grad_f(2.0)) # Computes df/dx at x=2.0
Verify before relying
- Whether SciPy integration (optional dependency) is required for your use case or only for specific features.
- Performance characteristics compared to other autodiff frameworks for your problem scale.
Package facts
| License | MIT (permissive) |
| Python support | supports the current Python release (>=3.10) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 1 — numpy |
| Maintenance | actively maintained — 43 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 5,606,457/month — #2,063 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: autograd-1.9.1-py3-none-any.whl
Keywords: Automatic differentiation, NumPy, Python, SciPy, backpropagation, gradients, machine learning, neural networks, optimization
Tags
More Scientific/Engineering packages
NumPy provides an N-dimensional array object…
permissive · top 100 on PyPI
pandaspandas provides fast, flexible data structures…
permissive · top 100 on PyPI
scipyscipy provides numerical algorithms for…
permissive · top 100 on PyPI
scikit-learnscikit-learn provides a comprehensive Python…
permissive · top 1,000 on PyPI
dilldill extends Python's pickle module to…
permissive · top 1,000 on PyPI
multiprocessMultiprocess is an enhanced fork of Python's…
permissive · top 1,000 on PyPI
autograd-gammaProvides autograd-compatible derivatives for…
permissive · top 5,000 on PyPI
numdifftoolsComputes numerical derivatives, gradients,…
permissive · top 15,000 on PyPI
torchPyTorch provides GPU-accelerated tensor…
permissive · top 1,000 on PyPI
findiffComputes finite difference numerical…
permissive · top 15,000 on PyPI
pytorch_revgradImplements a gradient reversal layer for…
permissive · top 15,000 on PyPI
jaxJAX is a Python library for automatic…
permissive · top 1,000 on PyPI
torchdiffeqProvides PyTorch-based ODE solvers with…
permissive · top 5,000 on PyPI
better-optimizeA wrapper around scipy's optimize.minimize and…
permissive · top 15,000 on PyPI
tinygradtinygrad is a minimal deep learning framework…
permissive · top 15,000 on PyPI
sparsediffpySparseDiffPy provides Python bindings to…
permissive · top 5,000 on PyPI