After many moons of waiting, we are finally ready to cut the first public release of Diffractor.jl (v0.2), our Next-generation Automatic Differentiation package. Due to its close coupling with the Julia compiler, it has been difficult/impossible to commit to supporting a released version of Julia, however with the advent of Julia v1.10, we are now ready to release a Diffractor with forward-mode only enabled.
Last-time you heard about Diffractor, it was about a reverse-mode tool. A successor to Zygote, based on better codegen, with better support for nested AD. Through adventure and misadventure, we are releasing today a tool with a focus on forward-mode. We will be back for reverse mode soon, and heading for a glorious mixed-mode future.
What is the current status of Diffractor?
Diffractor is currently supported on Julia v1.10+. While the best performance is generally achieved by running on Julia nightly due to constant compiler improvements, the current release of Diffractor is guaranteed to work on Julia v1.10.
Currently, forward-mode is the only fully-functional mode and is now shipping in some closed source products. It is in a position to compete with ForwardDiff.jl, and with TaylorDiff.jl. It is not as battle-tested as ForwardDiff.jl, but it has several advantages: Primarily, as it is not an operator overloading AD, it frees one from the need to relax type-constants and worry about the types of containers. Furthermore, Like TaylorDiff.jl, it supports Taylor series based computation of higher order derviatives. It directly and efficiently uses ChainRules.jl’s frules
, no need for a wrapper macro to import them etc.
Mutation of arrays works, but mutable structs need a bit more work; expect updates on this soon.
Why is this happenning?
Diffractor is a core piece enabling functionality in other projects at JuliaHub, which gives us an excuse to build the compiler and tooling features required to make Diffractor work well.
We strongly believe that Julia has the promise to provide a truly robust and performant automatic differentiation environment.
Diffractor is a step closer to this reality, and a confluence of compiler and ecosystem tooling advances are clearing roadblocks between where we stand, and our vision of what Diffractor can become.
What is next for Diffractor?
- Mutation support (forward mode only): it should work right now for arrays, but not yet for mutable structs.
- Really fast jacobians: we have a couple of really cool ideas to make computing jacobians faster, they’re just not ready for public release yet. (If you have a cool problem that needs whole jacobians tell us more)
- Reviving reverse mode: which will fulfill its initial promise from a few years ago.
- Mixed mode: for even faster jacobians.
How do I use Diffractor?
As Diffractor requires Julia 1.10-alpha0, you need to be on that — or better yet 1.11-DEV. Yes its raw and alpha, but so is Diffractor. If you like to live on the edge and are ready to play with things with sharp edges, then 1.11-DEV and Diffractor will get you the best performance. If not, hold tight a bit.
With that said we are now doing a release and are committed to SemVer, so we won’t (intentionally) break things for you.
The interface is provided by conforming to AbstractDifferentiation.jl. We don’t have our own public API. We might in the future if we can’t expose things we want to through AbstractDifferentiation, but ideally we wouldn’t.
AbstractDifferentiation exposes all the usual derivative
, jacobian
etc. See our getting started in the docs.
How can I get involved?
We would love for you to try it out, and open bug reports etc. We don’t make promises for a particular timeline for fixing it, but we will be paying attention.
Adding support for your packages using ChainRules.jl frules where there are smart ways to compute forward derivatives.
We have plenty of open issues, and unless assigned to someone then they are open to be worked on.
They might be lacking details to work on them but you can ask for more if you don’t know, we’re happy to engage the community.
Furthermore a lot of the linked packages also have plenty of open issues to tackle, e.g. AbstractDifferentiation.jl, ChainRules.jl, ChainRulesCore.jl, so helping with those also is very appreciated (and they tend to have lower bars for entry)
Come say hi to Keno or Frames at Juliacon 2023, we’d love to chat with you about Diffractor and all things AD.