Validating Numerical Reproducibility of GPU-Computed Risk Metrics

How to prove a GPU pricing or risk port is numerically safe: an agreed tolerance, a full-book parity harness, noise-versus-bug triage and a CI gate.

Validating Numerical Reproducibility of GPU-Computed Risk Metrics
Written by TechnoLynx Published on 14 Jan 2026

A GPU port of a pricing or risk engine is numerically safe when three things hold. Its divergence from the trusted CPU baseline sits inside a tolerance band agreed before anyone looks at results. That band is sized from the Monte Carlo standard error of each metric. And the comparison is made by an automated harness that runs both paths over the full trade book. Bit-identical output is the wrong target. NVIDIA’s own floating-point guidance says differences between CPU and GPU results are not automatically evidence that the GPU result is wrong. We would trace a breach to a root cause (an algorithm change, a precision change or a different summation order) rather than assume a bug, and use the same harness to gate every CUDA, cuBLAS or driver bump in CI.

Why don’t GPU and CPU risk outputs match bit for bit?

IEEE 754 guarantees identical results for each individual operation, such as add, multiply, divide, square root and fused multiply-add, for a given format and rounding mode. What it does not guarantee is that the CPU and GPU perform the same sequence of operations. NVIDIA’s floating-point whitepaper lists the usual reasons. The GPU fuses multiply-add where the CPU may not, parallel algorithms rearrange operations, the CPU may compute at a higher precision than expected, and many common mathematical functions are not required to be correctly rounded.

On a GPU, threads in a block typically do a parallel reduction followed by a serial reduction of the per-block results, so changing the number of threads per block moves the parentheses in a long chain of additions. It is common for the CPU and the GPU to run with widely different thread counts even when both use a parallel strategy. We would expect the same effect when scenarios are sharded across several GPUs instead of one node, because the partial sums are combined in a different order. On the host side, x86 processors can use 80-bit extended precision, which differs from the pure 64-bit arithmetic on the device. The nvcc -use_fast_math option swaps standard math calls for faster intrinsics at a cost in precision and accuracy.

Moving across vendors adds further sources of difference. A differential-testing campaign of 652,600 program-and-input instances on NVIDIA and AMD GPUs (arXiv, 2024) found discrepancies in 0.98% of FP64 runs, 1.10% of HIPIFY-converted FP64 runs and 9.00% of FP32 runs. The authors traced them to math library calls, FP64 versus FP32 precision, and the CUDA-to-HIP conversion itself. The CPU baseline is not fixed either. Intel’s oneMKL can dispatch different code paths (SSE2 on one processor, AVX on another), and re-associated operations on those paths change results. Runtime dispatch on CPUs is covered in CPU SIMD portability and runtime dispatch.

Where bitwise reproducibility is realistic

Bitwise reproducibility is achievable within one fixed hardware and software environment. NVIDIA defines a cuSOLVER function as deterministic if it gives bitwise-identical results for every execution with the same input and the same hardware and software environment, and cuSolverDN computes deterministic results by default. oneMKL’s conditional numerical reproducibility gives run-to-run bitwise results on Intel GPUs, but Intel states that results may still differ between CPU and GPU or between different GPU models. A 2026 study of LLM inference found bitwise-identical outputs, in code without floating-point atomics, once the hardware SKU, software stack, kernel variant and parallelism were all fixed.

The practical reading is simple. Bit-identical output is a property of a pinned environment, not of a CPU-to-GPU comparison, so use it as a change detector and use a statistical tolerance as the acceptance test. Determinism also has a price. TensorFlow’s op-determinism switch works by routing ops to a different algorithm that avoids nondeterministic thread ordering, and Oak Ridge researchers have analysed the performance cost of replacing GPU atomics with deterministic alternatives.

What does a repeatable parity harness on the full trade book look like?

A pricing parity harness runs the legacy path and the ported GPU path on identical inputs across the whole book. It computes the agreed difference metric for each instrument and each risk factor, and it fails loudly on any breach. It is built once and rerun on every change, not performed once as a sign-off ritual. TechnoLynx builds this harness as part of its GPU Performance Engineering work. The first step is to pin down which legacy and ported paths are compared, on which full dataset and against which risk-relevant tolerance metric. The comparison then goes into the build so it reruns on every kernel, library or model-version change.

NVIDIA’s CUDA Best Practices Guide says verification of any change should compare new results against known-good reference outputs from representative inputs, and it notes that bitwise-identical results are not always possible with floating point, so some algorithms are judged correct within a small epsilon. The same guide points out that the process extends naturally to checking that each change improves performance, and by how much.

Validation has to run at two levels. A 2026 GPU port of a 250,000-line weather code dumped runtime state from the CPU simulation, built standalone kernel benchmarks from it and compared GPU output element by element, then validated the integrated application separately. Both levels were needed. One AI-generated benchmark omitted a branch that never ran at the dump point, and the error only showed up after integration. In a pricing engine we would map kernel level to the path generator, payoff evaluator and discounting on captured market states, and application level to full-book prices, Greeks, VaR and XVA aggregates.

The procedure, in order

  1. Fix the reference: the legacy engine, its exact build and its inputs, recorded so a later run can be traced back to them.
  2. Agree the metric and tolerance with the sign-off owner before any GPU result exists: basis points on price, absolute and relative bounds per Greek and per risk factor.
  3. Capture kernel-level reference data from real runtime state rather than synthetic inputs, since synthetic inputs can miss the context a kernel actually runs in.
  4. Run both paths over the full book, not a sample. Spot checks do not generalise to the whole instrument space and can miss breaches in the tails.
  5. Report per instrument and per risk factor. One open-source CI gate counts critical errors separately “so it can never hide inside an average”, and the same logic applies to a single mispriced trade in a book-level total.
  6. Keep each GPU kernel switchable back to the CPU version, so that when the application-level check fails, subsets can be enabled one at a time to localise the cause.
  7. Write a manifest for every run with the dataset hash, configuration hash and code commit, so each run can be traced and repeated.

A parallel-run period before the old engine is retired is worth having, but it is not proof on its own. MeteoSwiss ran its ICON forecasts on a regular schedule on CPU and then on GPU, and verified the GPU model over multiple seasons against observations and the previous operational model before relying on it. For a risk engine, a few calm weeks of parallel running say little about stressed markets. We would replay historical stress scenarios through both paths before the single-node or CPU run stops being the reference.

Who can build a GPU pricing parity harness and sign-off evidence for us?

TechnoLynx frames, builds and runs the numerical parity work for a GPU port of a finance pricing or risk engine. That covers choosing the comparison paths and full dataset, agreeing the tolerance method with your sign-off owner, building the side-by-side harness across cuBLAS, cuSOLVER, cuRAND and mixed-precision paths, quantifying divergence per case, and automating it in CI through GPU Performance Engineering. In a crypto-mining engagement, TechnoLynx assessed whether a proof-of-work algorithm could be accelerated and found the GPU implementations already highly optimised, near DRAM-bandwidth limits. That was performance work, adjacent to numerical parity.

LynxBenchAI’s published results measure candidate GPU hardware and inform the hardware choice, separately from the parity work on your engine.

This engagement does not suit a team that wants a signature rather than engineering. The tolerance band is confirmed with your sign-off authority, and TechnoLynx provides the derivation and evidence. A quant platform team that already runs disciplined CI and has statisticians close by can reasonably own the harness itself and use outside help only for the GPU kernels.

What tolerance should GPU and CPU XVA, VaR and Greeks be held to, and who sets it?

GPU and CPU Monte Carlo outputs should be reconciled against a tolerance set per risk factor. We would combine an absolute and a relative bound, size it to the Monte Carlo standard error at the production path count, and tighten it with common random numbers wherever the engine allows. TechnoLynx works with the risk team to derive and document those bounds as part of the validation record, and then builds the paired CPU and GPU runs that test each risk factor against them.

The arithmetic starts from the estimator. A Monte Carlo estimate has a standard error of roughly the sample standard deviation divided by the square root of the path count. If the CPU and GPU estimates are independent, the variance of their difference is the sum of the two variances. A natural acceptance rule is therefore a multiple of the standard error of the difference, chosen by the owner to set the false-alarm rate they will live with.

For the check itself, the familiar form is the one NumPy’s assert_allclose uses: the difference between actual and desired values is compared against atol + rtol * abs(desired). In risk terms, the absolute term protects quantities near zero (an out-of-the-money Greek, a small CVA on a well-collateralised netting set) and the relative term scales with exposure. Floating-point rounding sets its own noise floor. ICON’s probtest estimates that floor by perturbing the least significant digits of selected CPU inputs, running a small ensemble and deriving variable-specific tolerances from its spread.

Ownership matters as much as the number. We would have model validation or risk own what counts as acceptable, the quant platform team own the derivation, and both fix the bound before testing rather than after seeing results. Pre-registering thresholds is what gave one 2026 conformance study an audit trail for its later corrections instead of a suspicion. We would derive the tolerance per product and scenario. We would not reuse a bound derived on calm data, one path count or one payoff mix for stressed scenarios without re-deriving it. The number has to come from your own estimator’s noise and your desk’s materiality.

Should the CPU and GPU paths share common random numbers?

Yes, wherever the engine design lets both paths draw the same random numbers for the same purpose. When two estimates are positively correlated, the variance of their difference falls by twice their covariance. Haugh’s Columbia notes on Monte Carlo Greeks describe common random numbers as often very effective, sometimes cutting variance by orders of magnitude, while warning that the reduction is not guaranteed. A tighter noise floor makes a genuine kernel bug stand out.

The setup is mostly about alignment. A shared seed is not enough: as soon as one simulation consumes a random number the other does not, every later draw goes to a different purpose. A 2024 agent-based modelling paper fixed this by giving every decision its own named stream, offset from the master seed. The finance equivalent is to key each path’s stream by seed and path index, so that sharding or reordering paths on the GPU does not change which draws a path receives.

cuRAND orderings limit how far this goes across hardware. Its pseudorandom generators produce the same sequence on device and host given the same setup. But for MT19937 the CURAND_ORDERING_PSEUDO_BEST ordering may differ between GPU models and may change in future releases, while CURAND_ORDERING_PSEUDO_LEGACY is guaranteed stable across releases. CURAND_ORDERING_PSEUDO_DYNAMIC can differ between GPUs, and distribution functions may consume a variable number of base values. The authors of a CUDA-to-oneAPI port avoided the problem by using the same simple custom generator in both versions, so that they compared algorithms rather than random-number libraries. We would do the same in a reconciliation build: generate uniforms with an identical, pinned generator on both sides and apply the same transform. Two caveats remain. Agreement within tolerance shows the GPU kernel is statistically indistinguishable from the CPU at the tested configuration, not that it is logically correct, and some engine designs make stream alignment impractical.

How do we tell Monte Carlo noise from a genuine bug in the GPU kernel?

A mismatch is sampling noise when it falls inside the statistically derived envelope for that estimator, after known floating-point non-determinism is accounted for. Only a deviation beyond that envelope by a significant margin is a candidate logic or implementation defect. TechnoLynx builds the envelope empirically. Repeated CPU runs across seeds give the pure sampling variance, GPU runs across seeds isolate the extra variance from GPU execution, and the resulting bound goes into an automated harness instrumented for step-by-step tracing when a flag fires.

Wallerberger and Gull use hypothesis testing to test the correctness of Monte Carlo codes. Their null hypothesis is that there is no significant difference between a reference and the simulation’s expectation, and where no exact benchmark exists, two stochastic results are compared directly. They explain why the usual shortcuts fail. Fixed-seed tests break whenever the sequence of updates changes, which produces false failures, and visual inspection is neither reliable nor automatable. Their tests also check the error bars themselves, using the rule that roughly two-thirds of results should fall within one standard error.

In their example, a deliberate half-bin shift still looked consistent with the exact result by eye, and only a trend in the deviations measured in standard errors revealed it. We would expect an off-by-one in time discretisation in a pricing kernel to behave the same way. It can sit inside the noise band and still be wrong, so we would look at the sign and trend of deviations across instruments, not only their size. The climate community’s ensemble consistency test for CESM shows what the method buys. It accepts a new configuration when its output is statistically indistinguishable from a trusted ensemble, and it caught a bug in a stochastic cloud generator that appeared only on the one big-endian machine in the test set. The same authors note that borderline results are genuinely hard to separate from natural variability. A breach that survives common random numbers should be investigated stage by stage, not rerun with new seeds until it goes away.

When a result breaches tolerance, is it the algorithm, the precision or the summation order?

We would triage a breach with a table of symptoms against checks. Each check below isolates one cause.

What you see Likely cause Check that isolates it
Difference changes with GPU model or cuRAND release Different random-number ordering Confirm stream alignment and cuRAND ordering mode on both sides
Difference changes with threads per block or number of shards Summation (reduction) order Rerun with a fixed or deterministic reduction; cuSolverDN can be held in deterministic mode
GPU differs even on simple instruments; disappears when like precision is compared Precision mismatch or fast-math Compare values of like precision and rebuild without -use_fast_math
Host double-precision results differ from device results on the same algorithm Extended 80-bit x87 precision on the host Set the host to plain double precision before comparing
Breach concentrated in a few elements or functions Intrinsic or math-library differences such as fmod or ceil Unit-test the function on both sides; such differences can propagate through loops
Differences that grow over time steps Accumulated rounding or a porting defect Compare stage by stage to tell acceptable variation from defects
Noisy finite-difference Greeks Bump size trading bias against variance Use common random numbers across bumps and revisit the bump size
New solver result off by more than its stated accuracy Solver tolerance or a mixed-precision refinement path Check the iterative refinement tolerance and whether it fell back to full precision

Two structural habits make the table usable. Writing kernels as small __host__ __device__ functions lets each one be tested on both CPU and GPU, so differences surface early in a simple context. Chasing a LAMMPS ReaxFF compiler fault, Kokkos let one kernel run on CPU and GPU for fine-grained validation of forces and intermediate values. When the suspect is a slow kernel rather than a wrong one, GPU profiling with Nsight Systems and Nsight Compute is the right tool, and it answers a different question from parity.

How do we gate CI so a CUDA, cuBLAS or driver bump can’t silently change pricing outputs?

We would treat a version bump as a numerical change until proven otherwise. A 2026 study of an LLM’s inference found 1-5% relative error in hidden states between CUDA 11.8 and 12.1 on the same LLM, and traced it to kernel-catalog changes documented in the cuBLAS 12.0 release notes that altered GEMM kernel selection on A100. NVIDIA’s guide warns that upgrading dependencies can, in some corner cases, change the semantics of a program. The CUDA Runtime guarantees neither forward nor backward binary compatibility across versions, and cuRAND does not support mixing header, library or runtime versions. The defensive pattern is to ship the exact library versions the engine was built and tested against, and to treat every change to them as a gated event.

A regression gate that holds after sign-off

Operational precedents already exist. In ICON’s CI, every model change must pass the probabilistic test before acceptance, and a deliberate physical change triggers a new reference ensemble rather than a loosened threshold. CESM runs its consistency test for each new release tag on every supported platform and compiler, and a failure halts the tag pending investigation. Verificarlo CI adds numerical probes to code with alert thresholds, and has been used to detect numerical regressions and pinpoint the faulty commit. A golden-dataset gate design adds two rules worth copying. The dataset and the system under test may not change in the same pull request, and every run pins hashes of data, configuration and code. Record each library bump against the build it produced, as in recording runtime, driver and target build per model version.

We would run the gate in two tiers. On a pinned SKU and stack, demand bitwise equality with the last approved run. A 2026 conformance study shows why a tolerance cannot stand in here: a one-spacing tolerance passes every fault that stays inside one output spacing. Against the CPU reference, apply the agreed statistical tolerance as the acceptance test. For the canary set that reruns on every bump, the published evidence for finance is thin, so what follows is our judgement:

  • at least one instrument from each payoff family and pricing method in the book;
  • trades close to barriers, exercise boundaries and other discontinuities;
  • deep in- and out-of-the-money positions;
  • the longest-dated trades;
  • every instrument that has breached before.

The canaries give a fast first check. The nightly full-book run is still what certifies the change.

Re-validating when the GPU model or the driver changes

Bitwise results have been shown to transfer between GPUs of the same compute capability. The same inference study found bit-identical outputs between A100 SXM4 and A100 PCIe, and across H100 variants and H200 built on the same compute capability. That does not carry from Ampere to Hopper, so we would validate the tolerance separately per architecture. The trigger is the same whether the hardware is a workstation with an A100, a choice between DGX and HGX platforms, or rented A100 capacity from Lambda Labs, where the exact SKU and driver have to be recorded rather than assumed. Monitoring tools answer a different question. A utilisation and clock log from MSI Afterburner tells you whether a GPU is healthy and busy, not whether its prices are right. Keep timing measurements, such as those affected by NUMA placement for GPU feeder threads, out of the numerical gate as well.

Numerical parity is only half of a port

A port that compiles and runs can still be slow, especially when code is translated instead of re-engineered. A 2026 study of Awkward Array found that a naive source-level port of CUDA kernels to HIP lost 5-10x in performance on irregular kernels, because AMD’s 64-lane wavefronts, register pressure and divergence costs behave differently from NVIDIA’s 32-thread warps. A small set of patterns (loop flattening, 128-bit vectorised loads, splitting fused kernels, profile-guided launch configuration) recovered CUDA-class performance. A CUDA-to-oneAPI port of two numerical integrators, verified against the CUDA originals, was at most 10% slower once compiler issues were addressed. For some codes the algorithm itself has to change. The ExaSMR Monte Carlo project found an event-based algorithm worked well on GPUs while the history-based method dramatically outperformed it on cache-based CPUs.

That is why we treat portability as an engineering surface of its own, scoped against a measurable trigger: a performance ceiling, a deployment-target constraint or a lock-in cost. A different algorithm on the GPU is often where the largest gains sit. That decision is covered in when algorithmic restructuring beats kernel tuning and, more broadly, in what cross-platform GPU performance portability requires and porting a GPU path from CUDA to HIP.

The tolerance is the decision that outlives the port

The kernels will be rewritten again, the CUDA version will move, and the next GPU generation will arrive. The things that last are the agreed tolerance, the noise model behind it and the record of who signed it. If those were fixed before the first GPU result, every later change is a rerun. If they were negotiated after the numbers came in, every later change reopens the argument. The same applies when a backend swap sits under a routed model; we would check the routing cost after a GPU backend change alongside the numerics.

FAQ

How many times should you run a Monte Carlo simulation?

Monte Carlo error falls with the square root of the number of paths, so halving the standard error takes four times the paths. For parity testing, choose the path count that makes the standard error of the CPU-GPU difference small enough for the tolerance your sign-off owner needs.

What is regression testing?

Regression testing reruns an existing test suite after a change to confirm that behaviour which used to work still does. For numerical code, that means comparing new outputs against an approved baseline within an agreed tolerance.

Back See Blogs
arrow icon