Skip to content

Skip missing_second_order_ad when analytical second-order derivatives are supplied - #1285

Closed
niy-ati wants to merge 1 commit into
SciML:masterfrom
niy-ati:fix-1240-analytical-hess-warning
Closed

Skip missing_second_order_ad when analytical second-order derivatives are supplied#1285
niy-ati wants to merge 1 commit into
SciML:masterfrom
niy-ati:fix-1240-analytical-hess-warning

Conversation

@niy-ati

@niy-ati niy-ati commented Jul 26, 2026

Copy link
Copy Markdown

Summary

  • OptimizationCache emitted missing_second_order_ad whenever a Hessian-requiring optimizer was used without a SecondOrder AD type, even if OptimizationFunction already supplied analytical hess / fgh / hv (or cons_h / lag_h).
  • That contradicts instantiate_function / DI paths, which use user second-order callbacks when present, and generate_adtype(NoAD), which does not build a SecondOrder fallback.
  • Gate the warning (and the AutoZygote sibling) on those callbacks actually being missing.

Fixes #1240

Test plan

  • Added second_order_warning_test.jl: analytical hess + NoAD → no warn; missing hess → warn
  • CI OptimizationBase tests

… are supplied.

The cache warning only inspected adtype, so OptimizationFunction(..., hess=...) with NoAD still emitted a false positive even though instantiate_function uses the user Hessian and NoAD does not build a SecondOrder fallback. Gate the warning on missing hess/fgh/hv/cons_h/lag_h. Fixes SciML#1240.
@niy-ati niy-ati closed this Jul 26, 2026
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

Successfully merging this pull request may close these issues.

missing_second_order_ad warning fires even when an analytical Hessian is supplied via OptimizationFunction(f; hess = ...)

2 participants