Repository navigation
Use DEFAULT_CALLBACK const in OptimJL/Optimisers __init - #1407
ChrisRackauckas-Claude wants to merge 2 commits into
Conversation
Anonymous `(args...) -> (false)` defaults get a fresh type when kwargs trigger the kw sorter, so a second solve with maxiters recompiles the whole chain. Point at the shared NullCallback const instead. Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com> Co-Authored-By: Cursor Agent <noreply@cursor.com> Agent-Harness: Cursor Agent 2026.10.01-14929f9 Agent-Model: unknown (Cursor auto) Agent-Session: local session, transcript /home/crackauc/sandbox/goals/performance/jobs/opt/opt-defcb/log.txt on amdci2
Independent review (Devin CLI 3000.11.3, model fusion-claude-opus-5-5-high-sidekick-swe-2-medium): CHANGES, risk low. Full reviewVERDICT: CHANGES The change is correct, and it does what the PR body says. On master, the anonymous Blocking findings
Non-blocking findings
What I ranAll runs used
What I did not verify
🤖 Posted by an AI agent — harness: Devin CLI 3000.11.3 (review), Claude Code 2.1.285 (posting) · model: fusion-claude-opus-5-5-high-sidekick-swe-2-medium |
Bare DEFAULT_CALLBACK breaks once SciML#1392/SciML#1397 replace blanket `using OptimizationBase` with an explicit import list. Match PRIMA/ODE. Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com> Co-Authored-By: Cursor Agent <noreply@cursor.com> Agent-Harness: Cursor Agent 2026.10.01-14929f9 Agent-Model: unknown (Cursor auto) Agent-Session: local session, transcript /home/crackauc/sandbox/goals/performance/jobs/opt/opt-defcb/log.txt on amdci2
Independent review (Devin CLI 3000.11.3, model fusion-claude-opus-5-5-high-sidekick-swe-2-medium): MERGE, risk low. Full reviewVERDICT: MERGE PR: #1407 (no linked issue; Blocking findingsNone. Non-blocking findings
What I ranAll runs were local on macOS, Julia 1.11 (default juliaup channel), with TMPDIR set to the review tmp dir.
What I did not verify
🤖 Posted by an AI agent — harness: Devin CLI 3000.11.3 (review), Claude Code 2.1.285 (posting) · model: fusion-claude-opus-5-5-high-sidekick-swe-2-medium |
Summary
OptimizationOptimJLandOptimizationOptimisersdefaultedcallbackto a fresh anonymous(args...) -> (false)in__init. When the call goes through Julia's keyword sorter (any kwargs), that default is evaluated again and gets a different type, sotypeof(init(prob, LBFGS())) != typeof(init(prob, LBFGS(); maxiters=100))and a secondsolvethat adds a kwarg recompiles the whole chain. Both packages alreadyusing OptimizationBase, which exports the publicDEFAULT_CALLBACK(NullCallback,(args...) -> false); point the defaults at that const instead (same pattern as MadNLP/ODE/PRIMA).Measurements (amdci2, process CPU via
/proc/self/statutime+stime,OPENBLAS_NUM_THREADS=1,JULIA_NUM_THREADS=1,taskset -c 2, 5 alternating master/PR fresh processes)OptimizationOptimJL Rosenbrock +
Optim.LBFGS+ ForwardDiff:maxiters=100First-solve: no clear regression beyond noise on remeasure (medians 6.36 vs 6.38; one noisy PR outlier at 7.68 and one master at 7.10). The auditor's earlier 5.91→6.06–6.20 bump did not reproduce as a stable effect here. Second-solve with kwargs: clear win (~0.95 → ~0.14 s CPU).
OptimizationOptimisers: regression test confirms the same
inittype mismatch on master;solvealways requiresmaxiters/epochs, so the no-kwargs→kwargs TTFS pattern is OptimJL-specific. Fix kept forinittype stability + consistency.Other
lib/Optimization*/srcsites still using anonymous(args...) -> (false)(Sophia, SciPy, NLopt, Metaheuristics): left alone — same pattern, not TTFS-measured in this PR.Regression test
typeof(init(...)) == typeof(init(...; maxiters=100))in each sublib'stest/core_tests.jl.var"#6#7"vsvar"#8#9"callback types (before.txt)after.txt); also PASS on Julia 1.10.12Test-group tails
Core | 6970 Pass; tests passedCore | 49 Pass, 1 Broken; tests passedQuality Assurance | 54 Pass, 1 Broken; tests passedQuality Assurance | 80 Pass, 1 Broken; tests passedtest/qa):Quality Assurance | 21 PassNot verified
@benchmark(this is a compile-time / type-stability fix; numbers are process CPU)Pkg.testextras env (Enzyme/GPU) — used dedicatedtest/qaproject for GROUP=QAReviewer pushback
maxiters/epochsforsolve— is the Optimisers half of the diff justified oninittype stability alone?Please ignore until reviewed by @ChrisRackauckas.
Risk assessment
Independent review: pending
🤖 Generated with Cursor Agent 2026.10.01-14929f9 (model: unknown (Cursor auto)), transcript /home/crackauc/sandbox/goals/performance/jobs/opt/opt-defcb/log.txt on amdci2; orchestrated by Claude Code (claude-opus-5-5[1m]) https://claude.ai/code/session_01LPHREnnonfLg1VcE1EJovv
Made with Cursor
Independent review: Devin Fusion (fusion-claude-opus-5-5-high-sidekick-swe-2-medium) rated it low, verdict MERGE: #1407 (comment)