Skip to main content
arXiv is now an independent nonprofit! Learn more
archive
Search Submit Donate Log in
Press Enter to search · Advanced search

Computer Science > Programming Languages

arXiv:2204.10923 (cs)
[Submitted on 22 Apr 2022 (v1), last revised 6 Dec 2022 (this version, v2)]

Title:You Only Linearize Once: Tangents Transpose to Gradients

Authors:Alexey Radul, Adam Paszke, Roy Frostig, Matthew Johnson, Dougal Maclaurin
View a PDF of the paper titled You Only Linearize Once: Tangents Transpose to Gradients, by Alexey Radul and 4 other authors
View PDF
Abstract:Automatic differentiation (AD) is conventionally understood as a family of distinct algorithms, rooted in two "modes" -- forward and reverse -- which are typically presented (and implemented) separately. Can there be only one? Following up on the AD systems developed in the JAX and Dex projects, we formalize a decomposition of reverse-mode AD into (i) forward-mode AD followed by (ii) unzipping the linear and non-linear parts and then (iii) transposition of the linear part.
To that end, we define a (substructurally) linear type system that can prove a class of functions are (algebraically) linear. Our main results are that forward-mode AD produces such linear functions, and that we can unzip and transpose any such linear function, conserving cost, size, and linearity. Composing these three transformations recovers reverse-mode AD. This decomposition also sheds light on checkpointing, which emerges naturally from a free choice in unzipping `let` expressions. As a corollary, checkpointing techniques are applicable to general-purpose partial evaluation, not just AD.
We hope that our formalization will lead to a deeper understanding of automatic differentiation and that it will simplify implementations, by separating the concerns of differentiation proper from the concerns of gaining efficiency (namely, separating the derivative computation from the act of running it backward).
Subjects: Programming Languages (cs.PL)
Cite as: arXiv:2204.10923 [cs.PL]
  (or arXiv:2204.10923v2 [cs.PL] for this version)
  https://doi.org/10.48550/arXiv.2204.10923
arXiv-issued DOI via DataCite

Submission history

From: Roy Frostig [view email]
[v1] Fri, 22 Apr 2022 20:37:36 UTC (107 KB)
[v2] Tue, 6 Dec 2022 16:46:59 UTC (114 KB)
Full-text links:

Access Paper:

    View a PDF of the paper titled You Only Linearize Once: Tangents Transpose to Gradients, by Alexey Radul and 4 other authors
  • View PDF
  • TeX Source
view license

Current browse context:

cs.PL
< prev   |   next >
new | recent | 2022-04
Change to browse by:
cs

References & Citations

  • NASA ADS
  • Google Scholar
  • Semantic Scholar
Loading...

BibTeX formatted citation

Data provided by:

Bookmark

BibSonomy Reddit

Bibliographic and Citation Tools

Bibliographic Explorer (What is the Explorer?)
Connected Papers (What is Connected Papers?)
Litmaps (What is Litmaps?)
scite Smart Citations (What are Smart Citations?)

Code, Data and Media Associated with this Article

alphaXiv (What is alphaXiv?)
CatalyzeX Code Finder for Papers (What is CatalyzeX?)
DagsHub (What is DagsHub?)
Gotit.pub (What is GotitPub?)
Hugging Face (What is Huggingface?)
ScienceCast (What is ScienceCast?)

Demos

Replicate (What is Replicate?)
Hugging Face Spaces (What is Spaces?)
TXYZ.AI (What is TXYZ.AI?)

Recommenders and Search Tools

Influence Flower (What are Influence Flowers?)
CORE Recommender (What is CORE?)
  • Author
  • Venue
  • Institution
  • Topic

arXivLabs: experimental projects with community collaborators

arXivLabs is a framework that allows collaborators to develop and share new arXiv features directly on our website.

Both individuals and organizations that work with arXivLabs have embraced and accepted our values of openness, community, excellence, and user data privacy. arXiv is committed to these values and only works with partners that adhere to them.

Have an idea for a project that will add value for arXiv's community? Learn more about arXivLabs.

Which authors of this paper are endorsers? | Disable MathJax (What is MathJax?)
We gratefully acknowledge support from our major funders, member institutions, , and all contributors.
About · Help · Contact · Subscribe · Copyright · Privacy · Accessibility · Operational Status (opens in new tab)
Major funding support from
Simons Foundation Simons Foundation International Schmidt Sciences