You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
AD/performance: avoid nested runtime differentiation for Hull-White forward rates #285
_hw_forward_rate(curve, t) computes the instantaneous forward by invoking DifferentiationInterface.derivative(..., AutoForwardDiff(), t) at runtime.
Hull-White fitting can therefore nest ForwardDiff: the outer derivative traces model parameters while the inner derivative traces time. Hull-White simulation also repeats this operation across the entire alpha grid. This adds compilation/runtime cost and couples this path to one AD backend.
Proposed direction
Introduce an instantaneous_forward(curve, t) interface with analytic or specialized implementations for built-in curves. Keep numerical differentiation only as a fallback. Consider preparing/caching the fallback derivative and precomputing the forward grid once for simulation.
A custom differentiation rule may be appropriate for any remaining fallback.
Acceptance criteria
Built-in Hull-White curve types do not invoke nested runtime ForwardDiff for forward-rate evaluation.
Hull-White fitting remains differentiable with respect to model and curve parameters.
Simulation computes the forward/alpha grid without repeated AD setup.
Numerical agreement with the current implementation is tested for flat and non-flat curves.
Review update against FinanceModels v7.0.0 (6cb71714), 2026-10-11.
Mostly implemented; medium priority for a narrower remainder. v7 has Yield.instantaneous_forward/Yield.force_of_interest, specialized forwards for many built-in curves, and a cached Hull–White α grid. Simulation does not rebuild that grid for every scenario.
Smith-Wilson still selects the generic ForwardDiff fallback, so the acceptance criterion that every built-in Hull–White curve avoids nested runtime AD is not fully satisfied. A parameter-derivative probe through Hull–White with a fitted Smith-Wilson curve remained finite.
See cached grid. Narrow the issue to missing specialized built-in forwards, particularly Smith-Wilson, and measure their compilation/runtime cost. Retain the generic fallback for user-defined curves.
Activity
Compute short-end limits and instantaneous forwards in closed form
Compute short-end limits and instantaneous forwards in closed form
alecloudenback commentedon Oct 11, 2026
Review update against FinanceModels v7.0.0 (
6cb71714), 2026-10-11.Mostly implemented; medium priority for a narrower remainder. v7 has
Yield.instantaneous_forward/Yield.force_of_interest, specialized forwards for many built-in curves, and a cached Hull–White α grid. Simulation does not rebuild that grid for every scenario.Smith-Wilson still selects the generic ForwardDiff fallback, so the acceptance criterion that every built-in Hull–White curve avoids nested runtime AD is not fully satisfied. A parameter-derivative probe through Hull–White with a fitted Smith-Wilson curve remained finite.
See cached grid. Narrow the issue to missing specialized built-in forwards, particularly Smith-Wilson, and measure their compilation/runtime cost. Retain the generic fallback for user-defined curves.