Differentiating Through Simulations with Mutable State
The article discusses the challenges of differentiating through physics simulations with mutable state in popular tools like JAX, Zygote, and hand-coded adjoints. It introduces a new programming language called Meridian that solves this problem using a compiler technique called SSA transformation.
Why it matters
Differentiating through simulations with mutable state is a common challenge in computational science, and Meridian provides a novel solution to this problem.
Key Points
- 1JAX, Zygote, and hand-coded adjoints struggle to handle simulations with mutable state
- 2Meridian, a new programming language, can differentiate through simulations with mutation
- 3Meridian uses SSA (Static Single Assignment) transformation to handle mutable state
Details
The author works in computational science and writes simulations with time-stepping loops where the state updates on each iteration. When trying to optimize parameters, they need gradients through these simulations. However, popular tools like JAX, Zygote, and hand-coded adjoints struggle to handle the mutable state in these simulations. JAX requires pure functions with no mutation, Zygote produces silent incorrect gradients, and hand-coding the adjoint pass is labor-intensive. To solve this problem, the author built a new programming language called Meridian that can differentiate through simulations with mutable state using a compiler technique called SSA transformation. This allows the user to write their simulation naturally with mutation, and then call the 'grad' function to get the gradients.
No comments yet
Be the first to comment