Preserve despecialized parameters in adjoint VJPs - #1601
Draft
ChrisRackauckas-Claude wants to merge 1 commit into
Draft
Preserve despecialized parameters in adjoint VJPs#1601ChrisRackauckas-Claude wants to merge 1 commit into
ChrisRackauckas-Claude wants to merge 1 commit into
Conversation
Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com>
Member
Author
|
A fresh SciMLBase integration run on current dependency heads reproduces the same SciMLSensitivity
This is independent current-CI evidence for the paired owner fixes SciML/OrdinaryDiffEq.jl#4290 and this PR. CI job: https://github.com/SciML/SciMLBase.jl/actions/runs/32365988822/job/96415492868 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changed
Restore the parameter wrapper at SciMLSensitivity's central adjoint VJP entry points when the originating problem uses
DespecializedParameters. AD backends may transform the concrete parameter value before it reachesvecjacobian!/vecjacobian; rebuilding the public, idempotent wrapper keeps the adjoint caches and backend arguments type-consistent.This is required by ModelingToolkit's
AutoDespecializesupport in SciML/ModelingToolkit.jl#4919. The complementary transformed-call barrier fix is SciML/OrdinaryDiffEq.jl#4290.Ignore this PR until reviewed by @ChrisRackauckas.
Failing before / passing after
The regression differentiates a plain
ODEProblem{true, AutoDespecialize}usingGaussAdjoint(EnzymeVJP()).Before:
After, using registered DiffEqBase 7.15.0:
The gradient agrees with the analytic value
-exp(-0.5).Verification
The exact SciMLSensitivity
Core8downstream environment from SciML/ModelingToolkit.jl#4919 was run with this patch and SciML/OrdinaryDiffEq.jl#4290:Runic 1.8, added-line
typos, andgit diff --checkpass.Not verified
The full
Core8group was run with both owner fixes together; the new focused regression was additionally run with registered DiffEqBase 7.15.0 and passed independently. GPU and allowed-to-fail prerelease jobs were not run locally. No public API or documentation changed, so no docs build was required.