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

Efficient Jacobian Vector Products using ForwardDiff.jl #1007

Open
13 of 15 tasks
avik-pal opened this issue Sep 14, 2023 · 0 comments
Open
13 of 15 tasks

Efficient Jacobian Vector Products using ForwardDiff.jl #1007

avik-pal opened this issue Sep 14, 2023 · 0 comments
Labels
enhancement New feature or request luxlib

Comments

@avik-pal
Copy link
Member

avik-pal commented Sep 14, 2023

NOTE: I am aware of the twice VJP trick https://j-towns.github.io/2017/06/12/A-new-trick.html. Unfortunately, none of the NN-optimized AD Tools in Julia verse are well suited for nested AD. Enzyme & ReverseDiff might work here, but their rules are a different story.

Quite a few SciML Applications require JVPs (e.g. Deep Equilibrium Models if using JFNK). However, currently, ForwardDiff tries to differentiate through most of the DL Kernels, which is terrible for performance due to:

  1. Hitting the CPU / non-specialized dispatches on different architectures
  2. Not using CUDNN / MIOpen altogether

List of operations we should be supporting at the bare minimum:

  • Convolutions
    • Regular
    • Depthwise
    • Grouped Convolution
    • Cross-Correlation
  • Pooling
    • Max Pooling
    • Mean Pooling
  • Conv Transpose
    • Rules for ∇conv_data and ∇conv_filter
  • Normalization
    • GroupNorm
    • BatchNorm
  • Softmax
  • LogSoftmax

Another benefit we get from writing forward-mode AD rules is the batched Jacobian construction. Since ForwardDiff Chunks the Jacobian Computation, we can construct Multiple Columns of the Jacobian in one go.

@avik-pal avik-pal added the enhancement New feature or request label Sep 14, 2023
@avik-pal avik-pal changed the title Efficient Jacobian Vector Products Efficient Jacobian Vector Products using ForwardDiff.jl Sep 14, 2023
@avik-pal avik-pal transferred this issue from LuxDL/LuxLib.jl Nov 3, 2024
@avik-pal avik-pal added the luxlib label Nov 3, 2024
@avik-pal avik-pal linked a pull request Dec 31, 2024 that will close this issue
6 tasks
@avik-pal avik-pal removed a link to a pull request Dec 31, 2024
6 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request luxlib
Projects
None yet
Development

No branches or pull requests

1 participant