sItô computes parameter and initial-value sensitivities by differentiating compiled Monte Carlo programs automatically. Here we compare the run time, compile time, memory footprint, and numerical accuracy of automatic differentiation against bump-and-revalue finite differences across three SDE families, input counts $n$ from 1 to 24, seven statistics, five discretization schemes, and both CPU and GPU backends, following the hardware and protocol of the simulation speed benchmark.

Benchmark models

Three SDE families were tested, each declaring parameters to differentiate alongside initial conditions. A model with $d$ states and $p$ declared parameters produces $n = d + p$ derivatives per scalar statistic. Both the coupled Ornstein–Uhlenbeck and Lorenz-96 systems use cyclic boundary indices:

$$ \begin{aligned} \text{Coupled OU:} \quad &\mathrm{d}X_i = \bigl[\theta_i(1 - X_i) + 0.1\,X_{i+1}\bigr]\,\mathrm{d}t + \sigma_i\,\mathrm{d}W_i \\ \text{Lorenz-96:} \quad &\mathrm{d}X_i = \bigl[(X_{i+1} - X_{i-2})X_{i-1} - X_i + F_i\bigr]\,\mathrm{d}t + \sigma_i\,\mathrm{d}W_i \\ \text{Heston:} \quad &\mathrm{d}S = rS\,\mathrm{d}t + \sqrt{v}\,S\,\mathrm{d}W_1 \\ &\mathrm{d}v = \kappa(\theta - v)\,\mathrm{d}t + \xi\sqrt{v}\,\bigl(\rho\,\mathrm{d}W_1 + \sqrt{1 - \rho^2}\,\mathrm{d}W_2\bigr) \end{aligned} $$
FamilyBaselineTested parameter sets
Ornstein–Uhlenbeck$\theta_i = 1$, $\sigma_i = 0.2$, $X_i(0) = 1$$\{\sigma_1\}$ for $d = 1$, $\{\theta_i, \sigma_i\}$ for $d = 2, 8$
Lorenz-96$F_i = 8$, $\sigma_i = 0.1$, $X_1(0) = 8.01$, $X_{i>1}(0) = 8$shared $F$ for $d = 4$, $\{F_i, \sigma_i\}$ on 2 of 4 and 8 of 8 states
Heston$r = 0.03$, $\kappa = 2$, $\theta = 0.04$, $\xi = 0.3$, $\rho = -0.7$, $S(0) = 1$, $v(0) = 0.04$$\{\xi\}$, $\{\kappa, \theta, \xi, \rho\}$, $\{\kappa, \theta, \xi, \rho, r\}$

Inside the Heston drift and diffusion, variance is floored inside $\sqrt{\max(v, 10^{-10})}$ because the derivative of $\sqrt{v}$ diverges at zero. Simulations integrate over $[0, 1]$ with 1,000 steps using $10^5$ paths for one- or two-dimensional noise, 50,000 paths for four noise dimensions, and 25,000 paths for eight so random variates stay within $2 \times 10^8$. Reported statistics are mean, standard deviation, variance, call payoff $\max(X - K, 0)$ with strike $K = 1, 8, 1$ across the three families, median, running maximum, and a batch of four combined statistics, always evaluated on the first state. Each relative cost factor divides the median derivative run time by the median plain run time of the identical model.

Automatic differentiation evaluates all $n$ derivatives simultaneously inside a single compiled pass. Bump and revalue runs the plain program once at baseline and once per input shifted multiplicatively by $1.001$ under common random numbers, dividing the finite difference by the perturbation.

Input scaling

Bump and revalue scales linearly as $n + 1$, matching 3.0 for $n = 2$, 6.0 for $n = 5$, and 9.0 for $n = 8$. Automatic differentiation grows far more slowly, taking 1.1 to 1.8 times the plain CPU run up to 8 inputs and 3.2 to 3.8 times at 24 inputs.

Run time of the derivative run divided by the run time of the plain run against the number of differentiated inputs, for automatic differentiation and for bump and revalue, for three families, on CPU and GPU. Run time of the derivative run divided by the run time of the plain run against the number of differentiated inputs, for automatic differentiation and for bump and revalue, for three families, on CPU and GPU.
Derivative run time relative to plain simulation for the Euler scheme and mean statistic; bump and revalue covers up to 8 inputs.
FamilyInputs $n$CPU, plain msADBumpGPU, plain msADBump
Ornstein–Uhlenbeck24751.13.08.01.43.0
Ornstein–Uhlenbeck61,1431.67.011.22.46.5
Ornstein–Uhlenbeck241,0253.212.36.0
Lorenz-9651,1091.66.011.12.35.5
Lorenz-9681,1101.79.011.03.08.3
Lorenz-96241,0293.813.56.0
Heston31,1071.54.011.12.33.8
Heston61,1031.77.011.12.96.4
Heston71,1021.711.23.1

Plain times vary across model sizes because path counts scale down as noise dimension rises, so relative factors apply within each row.

Plain GPU execution is 60 to 100 times faster than on the CPU. Relative automatic-differentiation overhead is larger on the GPU—6.0 at 24 inputs versus 3.2 to 3.8 on the CPU—yielding absolute wall-clock times of 74 ms for Ornstein–Uhlenbeck and 82 ms for Lorenz-96 on the GPU against 3.3 s and 3.9 s on the CPU.

Statistics

At the largest input counts, automatic differentiation cost varies by at most 20% across mean, standard deviation, variance, call payoff, running maximum, and multi-statistic runs on both platforms.

StatisticOU CPUOU GPULorenz CPULorenz GPUHeston CPUHeston GPU
mean3.26.03.86.01.73.1
std3.25.53.66.01.83.2
variance3.25.53.66.11.83.2
call3.26.04.06.31.93.2
median2.97.23.417.21.62.9
running maximum3.26.24.06.61.83.3
four statistics3.45.23.85.42.02.9

The single outlier is the sample median on Lorenz-96 at 24 inputs on the GPU, where automatic differentiation rises to 17.2 times plain run time. Bump and revalue cost is independent of statistic choice, holding at 9.0 to 9.1 across every Lorenz-96 statistic for 8 inputs on the CPU.

Cost of automatic differentiation relative to the plain run for each statistic and family on CPU and GPU, at the largest number of inputs. Cost of automatic differentiation relative to the plain run for each statistic and family on CPU and GPU, at the largest number of inputs.
Automatic differentiation overhead by statistic at 24 inputs for Ornstein–Uhlenbeck and Lorenz-96, and 7 inputs for Heston.

Schemes

Five discretization schemes were benchmarked on the same models: Euler, Milstein, weak Euler, and the weak and strong Itô–Taylor schemes of orders 2.0 and 1.5. On the CPU, relative derivative cost stays flat or slightly lower for higher-order Taylor schemes, at 2.3 against 3.2 on Ornstein–Uhlenbeck and 3.3 to 3.4 against 3.8 to 3.9 on Lorenz-96. On the GPU, higher-order Taylor schemes increase relative derivative overhead to 7.3 to 7.5 on Ornstein–Uhlenbeck, against 6.0 for Euler, and 21 to 22 on Lorenz-96.

Cost of automatic differentiation relative to the plain run for five schemes on two models, CPU and GPU. Cost of automatic differentiation relative to the plain run for five schemes on two models, CPU and GPU.
Automatic differentiation overhead by discretization scheme for the mean statistic at 24 inputs.

Because the two noise terms in Heston are correlated, Milstein and Itô–Taylor schemes require mixed iterated Wiener integrals that sItô does not evaluate, so Heston benchmarks cover Euler and weak Euler only.

Compile time and memory

Automatic differentiation adds modest compile-time and memory overhead. At 24 inputs on Ornstein–Uhlenbeck, compilation grows from 0.51 s plain to 0.65 s on the CPU and from 0.55 s to 0.73 s on the GPU, with a 0.01 s increment for a single input. Pre-generated noise dominates memory consumption, lifting CPU peak RSS from 3,388 to 3,421 MB and GPU device memory from 802 to 841 MB at 24 inputs. Bump and revalue compiles one plain kernel and uses plain memory.

Discrete barriers

Because unconditioned first-passage times diverge when any simulated path fails to reach the barrier, the benchmark measures the horizon-capped expectation $\mathbb{E}[\min(\tau, 1)]$, where $\tau$ is the first grid time below the barrier. Crossing events move in discrete multiples of $\Delta t$, leaving the pathwise derivative identically zero with respect to every input even though $\mathbb{E}[\min(\tau, 1)]$ varies smoothly in the parameters, just as with a digital option. Barrier thresholds and diffusion scales were calibrated from 12 candidates on each platform so substantial path fractions cross.

FamilyBarrierPaths crossingBump factor, 1 parameter, CPUBump factor, 4 parameters, CPUMax absolute bumped derivative
Ornstein–Uhlenbeck, $\sigma = 0.5$0.637%3.07.00.85
Lorenz-96, $\sigma = 0.5$-0.9970%5.99.10.49
Heston0.954%4.07.03.9

Automatic differentiation returns zero for every sensitivity while matching bump and revalue on the capped mean to within $6 \times 10^{-6}$ across CPU and GPU. Because every tangent evaluates identically to zero, the derivative pass runs in 1.0 times the plain duration on both platforms, reflecting a degenerate zero-tangent graph rather than nonzero automatic-differentiation cost.

Derivative accuracy

For chaotic trajectories such as Lorenz-96, forward finite differences with a $10^{-3}$ step miss the derivatives of nonlinear statistics with respect to $X_1(0)$, returning $-3.5$ instead of $1.249$ for standard deviation and $-47$ instead of $17.139$ for variance in float64 over 50,000 paths. Sweeping bump sizes from $10^{-2}$ down to $10^{-6}$ confirms that central finite differences at $10^{-5}$ and $10^{-6}$ match automatic differentiation—1.249 and 17.139—to three significant figures, while the linear mean derivative of 83.7 already agrees from $10^{-4}$ downward. In float32, the automatic standard-deviation derivative is 1.211 against 1.249 in float64.

Derivative of the standard deviation and of the variance of the Lorenz-96 model with respect to the first initial value against the bump size, forward and central, with the automatic derivative as a horizontal line. Derivative of the standard deviation and of the variance of the Lorenz-96 model with respect to the first initial value against the bump size, forward and central, with the automatic derivative as a horizontal line.
Derivative with respect to the first initial value in float64 over 50,000 paths; forward 0.001 bumps of $-3.5$ and $-47$ sit off the vertical scale.

Because raw pathwise differentiation of a sample median selects only the one or two rank-order paths at the middle quantile—so estimator variance fails to shrink with path count—sItô computes median sensitivities by averaging path derivatives near the sample median weighted by proximity to the quantile. This smoothed estimator matches float64 central bumps cleanly while leaving the remaining spread, 0.21 of the peak derivative on Lorenz-96 and 0.34 on 6-input Heston, solely where finite bumps swap path rank ordering.

Derivative of the medianAutomaticCentral bump
First initial value115.2110 to 116 at $10^{-3}$, $10^{-4}$, $10^{-6}$, and 94 at $10^{-5}$
$F$17.817.4 to 18.6 from $10^{-2}$ to $10^{-5}$

Measurement limits

Hardware limits match those of the simulation speed benchmark. Path counts differ across noise dimensions, so relative overhead factors compare within each table row only. Bump and revalue stops at 8 inputs because its $n + 1$ scaling is exact by construction, each automatic-differentiation timing and compile figure comes from one run, and Heston covers only the two schemes supporting correlated noise without mixed iterated integrals.