# Tangent: Automatic Differentiation Using Source Code Transformation in Python

arXiv: https://arxiv.org/abs/1711.02712 · HTML: https://mlsanity.com/paper/1711.02712/

## Key facts

- Cited by 4 papers in the map (data through 14 Oct 2026).
- First posted on arXiv 7 Nov 2017.

## Built on by (most cited first, 4 of 4)

- [gradSim: Differentiable simulation for system identification and visuomotor control](https://mlsanity.com/paper/2104.02646/) (2021)
- [Generalized Neural Closure Models with Interpretability](https://mlsanity.com/paper/2301.06198/) (2023)
- [Variational encoder geostatistical analysis (VEGAS) with an application to large scale riverine bathymetry](https://mlsanity.com/paper/2111.11719/) (2021)
- [Hybrid twinning using PBDW and DeepONet for the effective state estimation and prediction on partially known systems](https://mlsanity.com/paper/2512.11834/) (2025)

## Abstract (arXiv)

Automatic differentiation (AD) is an essential primitive for machine learning programming systems. Tangent is a new library that performs AD using source code transformation (SCT) in Python. It takes numeric functions written in a syntactic subset of Python and NumPy as input, and generates new Python functions which calculate a derivative. This approach to automatic differentiation is different from existing packages popular in machine learning, such as TensorFlow and Autograd. Advantages are that Tangent generates gradient code in Python which is readable by the user, easy to understand and debug, and has no runtime overhead. Tangent also introduces abstractions for easily injecting logic into the generated gradient code, further improving usability.
