It is possible to compute the Hessian using a Mooncake backward pass and a ForwardDiff forward pass? Or are there other efficient methods to compute the Hessian?
I tried using DifferentiationInterface.jl, but it crashes when computing the Hessian with the Mooncake backend.
Hello! Sadly it is not presently possible to use Mooncake for Hessian computation. There’s an open PR to add a forwards-mode AD to Mooncake itself, which will at some point let us use forwards-over-reverse to compute Hessians, but I don’t know when that will be completed.
@gdalle do you have an existing mechanism in DI that we could hook in to to just throw an informative error message if someone tries to use Mooncake to compute higher order stuff?
I’m afraid not. You’d have to manually overload all second-order operators for AutoMooncake to throw an error, and even then this would not take care of SecondOrder{AutoForwardDiff, AutoMooncake}.