Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Maybe AbstractDifferentiation should shrink to a collection of names? #129

Open
gdalle opened this issue Feb 5, 2024 · 1 comment
Open

Comments

@gdalle
Copy link
Member

gdalle commented Feb 5, 2024

I increasingly feel like all the heavy lifting should be done by backends, and AbstractDifferentiation.jl should just define common names.

Whenever we do something that a backend does not support, or when we recode it instead of letting the package do it, we introduce correctness, readability or performance issues. Some examples:

Moreover, the complexity of the package also makes it very hard to push Enzyme support over the finish line (#84), which is arguably the biggest missing feature.

@adrhill and I are working on a prototype to play with this idea:

https://github.com/gdalle/DifferentiationInterface.jl

It may or may not be merged into AbstractDifferentiation, depending on what the team here thinks. The main caveat I see is that higher order cannot be well supported with an empty shell, but for gradients and JVPs/VJPs it should be close to optimal.

@devmotion
Copy link
Member

devmotion commented Feb 5, 2024

I agree mostly, I think. Basically, as eg. mentioned in some other issues, my take is that I think AbstractDifferentiation should provide 1) a consistent interface for AD systems and 2) reasonable default implementations for eg jacobian based on pullback etc - but I think each backend (or currently extension) should define the interface explicitly without magic defaults. What I mean is that you should explicitly define whether to use an AbstractDifferentation default for a function or another existing functionality. I assume that backends might want to switch some of their existing functionality to such defaults if they treat AbstractDifferentiation as a first class dependency at some point; and the defaults are useful in early development stage if a package does not want to re-implement jacobian etc functionality. But currently we should try to be as consistent as possible with the AD packages and use their APIs whenever possible.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants