JuliaDiff / JuliaDiff/ReverseDiff.jl
Nested differentiation of closures yields incorrect results. Any news on the fix?
Nobody has claimed this yet.
- Dominant language
- Julia
- Stars
- 393
- Forks
- 60
- Avg merge
- 18h 24m
- Merged PRs (30d)
- 8
Description
Indeed, nested differentiation of closures has been a well known problem for quite some time . In multiple places it is mentioned that a fix is on the works. Are there any news on this front?
At this point, this limitation essentially precludes the implementation of PINNs with ReverseDiff . Perhaps even worse is that recently I've found for some destructured Flux and Lux models it is actually possible possible to do ReverseDiff-over-ForwardDiff and obtain somewhat accurate results, but the gradients are ever-so-slightly wrong (see this discussion on Julia's discourse and this other issue). Likewise, reverse-over-reverse returns a zero gradient.
Has the root cause of this been identified? Would a fix necessarily involve overhauling the library with a tagging system? Is ForwardDiff currently the only AD library that can do nested AD with closures?
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the linked ReverseDiff limitations page, issue #222, and the Julia Discourse discussion about ReverseDiff-over-ForwardDiff with Lux networks. Trace the reported nested-closure, slightly incorrect-gradient, and zero-gradient cases; done means the root cause and a concrete fix path are identified and the affected behaviors can be validated.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- julia
- Domain
- machine-learning
- Issue type
- Bug
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100