NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

A Common Interface for Automatic Differentiation

Guillaume Dalle, Adrian Hill

TL;DR

The Julia package DifferentiationInterface.jl (DI) provides a unified, high-performance frontend for over a dozen different Automatic Differentiation (AD) backends. By introducing a standardized "preparation" phase to amortize one-time costs, it allows researchers to easily swap, compare, and combine AD tools without sacrificing execution speed.

What Problem Does This Paper Address?

In the world of machine learning and scientific computing, Automatic Differentiation (AD) is the engine under the hood. However, not all AD engines are built the same. Some excel at small, dense problems; others are optimized for massive, sparse systems or code with complex control flows (like loops and branches).

In the Python ecosystem, users typically pick a framework (like PyTorch or JAX) and stay within its boundaries. In Julia, the AD landscape is much more diverse and fragmented. While this diversity is a strength—offering specialized tools like Enzyme.jl for high-performance C-like code or Zygote.jl for high-level source transformation—it creates a "compatibility tax." Switching from one AD library to another often requires rewriting significant portions of code. This makes it difficult for researchers to "shop around" for the most efficient tool for their specific scientific model.

Methods

The authors introduce DifferentiationInterface.jl (DI), a common API that abstracts away the implementation details of various Julia AD libraries. Key components include:

  • Backends as Objects: DI treats AD libraries as first-class objects. A user can switch from forward-mode to reverse-mode AD simply by changing a single argument.
  • Standardized Operators: It provides a set of 8 core operators (e.g., gradient, jacobian, hessian, pushforward, pullback) with consistent in-place and out-of-place variants.
  • The Preparation Mechanism: This is the paper’s most significant technical contribution. Many AD systems require a "warm-up" (like recording an execution tape or pre-allocating memory). DI formalizes this into a prepare_ function. This allows the expensive setup to happen once, while the actual differentiation happens at peak speed inside tight loops.
  • Backend Composition: DI allows users to "stack" backends. For example, one can use a SecondOrder object to combine a forward-mode backend with a reverse-mode backend to compute Hessians more efficiently.

Datasets

As a software and methods paper, it does not use traditional training datasets. Instead, it evaluates performance using:

  • Synthetic Benchmarks: Specifically, the squared Euclidean norm ($f: x \to \|x\|^2$) and sparse Hessian computations.
  • DifferentiationInterfaceTest.jl: A sibling package introduced by the authors to standardize benchmarking and correctness testing across all supported backends.

Key Insights and Ideas

  • Preparation is the Performance Unlock: The authors argue that "preparation" is the key novelty. Without it, a unified interface would be too slow for production use. By exposing the preparation step, DI allows backends like ReverseDiff.jl or Mooncake.jl to compete with "tape-less" backends by amortizing their overhead.
  • Sparsity Made Easy: Handling sparse Jacobians and Hessians is notoriously difficult for users. DI integrates sparsity detection and matrix coloring into the preparation phase, making efficient sparse AD almost transparent to the end-user.
  • The "Shopping" Advantage: The paper demonstrates that for non-standard tasks (like scientific machine learning), the "best" AD system isn't always obvious. DI enables a "write once, test everywhere" workflow, allowing developers to find the optimal backend for their specific physics simulation or optimization problem.

Key Results

  • Ecosystem Simplification: The paper illustrates how DI collapses a complex web of package-specific bindings into a single, clean interface (see Figure 1 in the paper).
  • Quantifiable Speedups: In benchmarks (Figure 2), the "With preparation" versions of several backends showed dramatic performance improvements—sometimes by orders of magnitude—compared to the "Without preparation" versions, especially as input dimensions increased.
  • Feature Parity: DI provides "fallbacks." If a specific AD package doesn't natively support a Hessian, DI can automatically construct it using the package's existing gradient or pushforward rules.

Limitations and Future Work

  • GPU Support: While DI works with some GPU-backed arrays, the authors acknowledge that more work is needed to fully optimize and test the interface for large-scale GPU workloads.
  • Custom Rules: Currently, defining "custom rules" (telling the AD how to differentiate a specific function) is still somewhat backend-dependent. The authors aim to move toward a backend-agnostic way to define these rules.
  • Parallelism: Achieving high performance in scientific ML often requires complex parallelism, which remains a challenge for standardization across different AD architectures.

Summary updated

BibTeX
@article{dalle2026common,
  author = {Guillaume Dalle and Adrian Hill},
  title = {{A Common Interface for Automatic Differentiation}},
  journal = {J. Mach. Learn. Res.},
  year = {2026},
}
Figure