chalk-lab/Mooncake.jl
Implementation of a language-level autograd compiler
What it solves
Mooncake.jl provides a high-performance automatic differentiation (AD) package written entirely in Julia. It aims to improve upon existing tools like ForwardDiff.jl, ReverseDiff.jl, and Zygote.jl by offering a more stable and correct approach to computing gradients and Hessians, particularly for numerical Julia code that involves mutation.
How it works
The library uses a caching mechanism to optimize repeated evaluations. Users first call a preparation function (such as prepare_gradient_cache) to set up a cache tied to the specific type and size of the inputs. Once this cache is prepared, subsequent calls to compute values, gradients, or Hessians (using functions like value_and_gradient!!) are fast and efficient.
Who it’s for
It is designed for researchers and developers working with numerical Julia code who need reliable, fast, and repeated gradient and Hessian evaluations, especially in contexts where direct support for mutation is required.
Highlights
- Full Julia Implementation: Written entirely in Julia for better integration and the language ecosystem.
- Mutation Support: Provides direct support for mutation, reducing the need for hand-written rules in most numerical code.
- Caching Strategy: Separates the preparation of the cache from the evaluation, enabling fast repeated computations.
- Strict Correctness: Prioritizes correctness and stability over open-ended feature expansion, requiring explicit rules where derivatives cannot be constructed soundly.
Related
- Project
- Project
- Project
- Project
- Project