One mortgage-backed-security price on every machine
A desk prices a mortgage pool on one machine, a risk system re-prices it on another, a validation team re-runs it on a GPU. Whether the results are identical depends on compiler choices and summation order, and proving that a difference is harmless takes time in every reconciliation and audit. This paper computes the price and option-adjusted spread of a mortgage pass-through by Monte Carlo in exact integer arithmetic, so that every machine gives the same bits, measures what that costs against the fastest float baselines on the same GPUs, and amortizes 56 million mortgages in exact cents.
Abstract
On 1 December 2026 Riptide priced a synthetic $100 million, 30-year mortgage pass-through pool by Monte Carlo (262,144 Hull–White short-rate paths × 357 months, a prepayment S-curve and monthly pool cash flows) in exact integer fixed point, and solved for its option-adjusted spread (OAS) at par, on two NVIDIA GPUs (A10G, L40S) and three 64-vCPU AWS CPUs (Graviton4, Sapphire Rapids, EPYC Zen 4). The same machines, and an NVIDIA H100, amortized 56,000,000 synthetic 30-year fixed-rate mortgages, the size of Freddie Mac's Single-Family Loan-Level Dataset, in exact cents.
- One price, one set of bits. The exact price (106.260366722642 at zero spread; 103.332657184099 at 50 bp), the OAS (110.1654 bp) and all 262,144 per-path values are identical on all five machines, with 1 or 64 threads and with fused multiply-add contraction on or off. Float64 per-path values of the same model differ between GPUs and CPUs on 10% of paths, by up to 1.2 × 10⁻¹⁵ relative, because the compilers fuse multiply-adds differently. Those differences did not reach the float64 price, which was the same everywhere when summed pairwise or with a correctly rounded sum. The order of a naive sum alone moved it by 1.3 × 10⁻¹² points ($0.000000013 per $1 million face). Financially that is nothing. Exactness removes the need to show it on every new machine and build.
- Matched accuracy (update, version 2.1). Measured against a quad-precision reference of its own model, the float64 lane is off by 1.5 × 10⁻¹⁴ points, and the exact lane above, whose fixed-point discounting rounds more coarsely, by 3.3 × 10⁻⁶ points. A second exact lane with finer discounting (discount factor to 2⁻⁵⁰, 128-bit products) is off by 2 × 10⁻¹⁶ points, still bit-identical on all five machines. At that accuracy it takes 7.94 ms on the A10G and 4.25 ms on the L40S, 4.5× and 4.3× faster than the custom float64 kernel. On the CPUs it runs at 0.43–0.52× of float64.
- NVIDIA B200 (update, version 2.2). On a B200 both exact lanes return the same price sums, per-path hashes and OAS as the five machines above, and the 56 million schedules the same total and hash. The B200 runs float64 at full rate, so float64 is faster there: the custom float64 kernel takes 1.20 ms per price against 1.93 ms for the exact lane and 3.83 ms for the finer, matched-accuracy lane. PyTorch float64 at its fastest takes 2.23 ms (3.23 ms with its draws), so the exact lane is 1.16× faster than PyTorch and the finer lane 1.72× slower. For the 56 million schedules, exact takes 61.6 ms, a custom float64 kernel with the same precomputed payment 50.9 ms, and PyTorch float64 (torch.compile) 137 ms.
- Speed and error on GPUs. One exact price takes 3.70 ms on the A10G and 1.98 ms on the L40S. That is 9.6× and 9.3× faster than a custom float64 CUDA kernel of the same model and the same random numbers, whose price differs from exact by 8.1 × 10⁻⁶ points ($0.08 per $1 million face). It is 6.6× and 6.2× faster than PyTorch float64 at its fastest (torch.compile in max-autotune mode without its own CUDA graphs, with the whole loop captured in one CUDA graph; 10.5× and 9.7× counting its random draws), and 1.7× and 1.5× faster than PyTorch float32. PyTorch draws its own random numbers, so its prices differ from exact by Monte Carlo noise (0.9–1.5 standard errors). On an H100, whose float64 runs at full rate, the custom float64 kernel took 1.44 ms; the earlier exact kernel took 2.20 ms there; the corrected exact kernel was not rerun on the H100, and PyTorch failed on it with a CUDA-graph error and has no result.
- Speed on CPUs. On the three CPUs the exact price takes 27–55 ms, 0.66–0.70× the speed of the same model compiled in float64, and 62–102× faster than vectorised NumPy.
- 56 million mortgages. 20.16 billion loan-months in exact cents take 0.125 s (A10G), 0.060 s (L40S), 0.070 s (H100) and 1.31–1.78 s on a 64-vCPU CPU, with identical totals everywhere. A custom float64 kernel takes 2.48, 1.17 and 0.059 s on the three GPUs. On the A10G and L40S the exact schedules are 19.8× and 19.6× faster; on the H100 they run at 0.84× of float64. The exact kernel is given each loan's payment precomputed; the float64 kernel computes it with pow() inside the timed loop.
- Where float64 schedules differ, and why. A float64 schedule kept in dollars, with the same rounding rules, ends on a different total for 6,831,359 loans (12.2%; rounding half up) or 8,547,384 (15.3%; round-half-even as numpy.round), by up to $0.91 and $0.98. Every one first diverges in a month whose exact interest is exactly half a cent, which binary dollars store just below the half, and every diverging month is off by one cent. The $252,299.21 gap in the aggregate total is per-loan arithmetic, not summation: a naive sum of the per-loan totals adds $389, and pairwise or compensated summation removes it. A careful float64 implementation that keeps integer cents in a double matches the exact schedule on all 56 million loans.
The pool, the loans and the prepayment model are synthetic, and the model is a documented baseline, not a calibrated desk model. This paper is about reproducibility, speed and error, not about the value of any security. It is not investment advice, and not legal advice.
What this lets you do
- Re-run a valuation and get the same number. A price computed on a desk machine, a risk server, a cloud CPU or a GPU is the same integer, so a model-validation or audit re-run is checked by comparing two numbers for equality. A difference then means a change in the model or its inputs, never in the arithmetic, and nobody has to show that a last-digit difference is harmless.
- Move Monte Carlo onto the cheapest hardware that has it. The exact price runs on Arm and x86 CPUs and on GPUs from one source, and on GPUs with modest float64 throughput, such as the A10G and L40S, it is faster than float64. The price stays the same when the work moves.
- Amortize a whole agency-scale book in exact cents in a fraction of a second on a GPU, with every half-cent month decided the same way everywhere, without relying on each implementation to find the careful float formulation.
The kernels are Riptide prototypes and are not published. Evaluation builds are available through Request an evaluation.
Method
This section describes the methods at the level of the algorithm. The source is not published.
One price, one set of bits
Every exact lane in this study uses only integer additions, subtractions, multiplications, divisions and shifts on 64-bit integers. On the CPUs (C++20) their results are all defined by the language standard. The GPU build (C++17) also relies on right shifts of negative values being arithmetic, as they are on NVIDIA GPUs. No transcendental function, no floating-point operation and no order-dependent sum touches an exact result. The same source file is compiled by GCC for the CPUs and by NVRTC for the GPU, so each machine performs the same arithmetic on the same integers. A float64 version of the same model runs beside it on every machine, so the comparison is between one model in two kinds of arithmetic.
Random numbers
Each path's shocks come from Philox4x32-10 (Salmon et al. 2011), a counter-based generator: the draw for path p in month m is a pure function of (p, m) and a fixed key, so it does not depend on how paths are split across threads, cores or GPUs. Sixteen bits of each draw index a table of 65,536 standard-normal quantiles, Φ⁻¹((k + ½)/65,536), stored as integers in units of 2⁻²⁴. The table is computed once and shipped with the inputs, so every machine reads the same integer shock.
Short rates
Short rates follow a one-factor Hull–White model (Hull and White 1990), a = 0.03, σ = 1%, stepped monthly with the Euler scheme: r ← r + θₘΔt − aΔt·r + σ√Δt·z. The drift θₘ is fitted to the 27 November 2026 Treasury constant-maturity curve, read as continuously compounded zero rates and interpolated linearly in maturity (a simplification), with the discrete form on monthly forward rates. θₘΔt, aΔt and σ√Δt are stored as integers. Rates are annual rates in units of 2⁻⁴⁰, so a step is two integer products, two shifts and three additions.
Prepayment and pool cash flows
The pool is a 30-year fixed-rate pass-through: $100 million, gross coupon 7.00%, net coupon 6.50%, 357 months remaining, three months old. The prepayment model is a documented baseline, not a fitted one. The monthly prepayment rate is
where x is the gross coupon minus a mortgage-rate proxy, the short rate plus 2.94% (the 25 November 2026 Freddie Mac PMMS 30-year rate, 7.21%, less the 4.27% one-month bill). The S-curve is rational, so it needs no transcendental. Each month, in integer cents:
- the scheduled payment is the balance times the annuity factor i/(1 − (1 + i)⁻ⁿ) for the months left, stored in units of 2⁻⁴⁸ and floored;
- interest at the gross and the net coupon is rounded to the cent, halves up;
- prepaid principal is the balance after scheduled principal times the SMM, floored;
- the investor receives net interest plus scheduled and prepaid principal.
Discounting, the price and the spread
The discount factor is an integer in units of 2⁻³². Each month it is multiplied by k = 1/(1 + (r + OAS)/12), computed as round(2⁶¹ / (2³⁰ + y)) in units of 2⁻³¹ with y the monthly rate in units of 2⁻³⁰, and rounded back; the product is split into two 32-bit halves, so the factor may grow above 2 when rates turn negative. Each path's present value accumulates in units of 2⁻¹⁶ cent, with 64-bit partial products split so nothing overflows. The price is the sum over paths, an exact integer, divided by the number of paths and the balance. An integer sum does not depend on the order of addition, so threads, GPU blocks and machines all reach the same total.
The OAS is found by bisection on the integer spread to 0.01 bp: the smallest spread at which the exact price is at or below par. Every evaluation reuses the same random numbers, so every machine takes the same branch at every step.
Finer discounting (version 2.1)
The second exact lane carries the discount factor in units of 2⁻⁵⁰. The monthly factor, in units of 2⁻⁶², is k = round(12 · 2¹⁰² / (12 · 2⁴⁰ + R)), with R = r + OAS in units of 2⁻⁴⁰, so the rate is not quantised first. k is computed by exact long division in 17-bit steps, whose partial remainders stay below the divisor, so every step fits in 64 bits on CPU and GPU. Products of 64-bit integers are taken to 128 bits and rounded to nearest, and each month's present value is rounded to the nearest 2⁻¹⁶ cent instead of floored. The cash flows are unchanged.
Where float stays
Inputs (the curve fit, θ, the quantile table, the annuity factors) are computed once in float64 or rational arithmetic and stored as integers. The standard error, the printed decimals and the float lanes are floating point. No float value feeds back into an exact price. The exact model rounds cash flows to the cent and discounts in fixed point, and the float model does neither, so with the same random numbers their prices differ by 8.1 × 10⁻⁶ points (at most $0.37 per $1 million face on any one path): a model-definition difference far below the Monte Carlo standard error of 0.013.
Exact amortization at dataset scale
The schedules use the conventions of the earlier APR paper: the level payment rounded to the cent, halves up; each month's interest, balance × rate / 1,200,000 with the rate in thousandths of a percent, rounded to the cent, halves up, as ⌊(2·b·r + D)/(2D)⌋ with D = 1,200,000; the last payment clears the balance. The level payment needs (1 + i)³⁶⁰. It is computed in float64 and accepted when the payment in cents lies more than 10⁻⁵ cent from a half-cent boundary, far more than the float error; the loans closer than that (921 of 56,000,000) are recomputed with exact integers. A separate pass recomputed every payment with exact integers and found no disagreement.
Four float64 lanes run beside the exact one, with the same rules; the dollar lanes compute the payment in float64 as such code does (a variant with the exact payment isolates the payment formula), the cents lanes use the exact payment. Two keep dollars in a double, as most code does: one rounds half up as floor(100x + 0.5)/100, the other rounds to nearest-even on the binary value, as numpy.round does. Two keep integer cents in a double (exact below 2⁵³): one computes the interest as floor((2br + D)/(2D)) with a single float division; the other adds an exact remainder check. Per loan, the run records the months whose float interest differs from the exact cents, whether the first such month is a half-cent tie, and the difference in total paid. The aggregate total is then formed four ways from the per-loan float totals: a naive sum in dollars, a pairwise sum, a compensated (Neumaier) sum, and each loan rounded to integer cents and summed in 64-bit integers. On the GPUs, a custom float64 kernel (dollars, half up) and a PyTorch version (torch.compile) are timed against the exact kernel.
The loans
Freddie Mac's Single-Family Loan-Level Dataset covers about 56 million loans. Its terms allow public research results "solely for noncommercial purposes" and require a licence to distribute derived products, so this study does not use it. Instead, 56,000,000 synthetic 30-year fixed-rate loans are generated from the loan index with integer operations only, so the population is identical on every machine (its SHA-256 matched on every machine):
- origination months January 1999 to June 2026, spread evenly;
- the note rate is that month's average Freddie Mac PMMS 30-year rate, rounded to 1/8 point, plus an offset from −3/8 to +1/2 point;
- the amount is the year's FHFA one-unit baseline conforming limit times a lognormal fraction (median 0.55, σ 0.45, between 0.05 and 1), in whole dollars.
The population is not calibrated to the dataset's vintage mix, balances or rate spread.
Setup
| GPUs | AWS g5.xlarge (NVIDIA A10G, 24 GB), g6e.2xlarge (NVIDIA L40S, 48 GB); for the amortization run also a p5.48xlarge spot box (NVIDIA H100 80 GB HBM3, one of eight GPUs used); driver 620.70.06; and, for version 2.2, one NVIDIA B200 on RunPod (driver 595.112.07, PyTorch 2.9.1+cu128); CuPy 14.2.0 (cupy-cuda12x), kernels compiled by NVRTC (-std=c++17) with and without FMA contraction |
| CPUs | AWS c8g.16xlarge (Graviton4, Neoverse-V2), c7i.16xlarge (Xeon Platinum 8488C), c7a.16xlarge (EPYC 9R14); 64 vCPU each, us-east-1, Ubuntu 24.04, GCC 13.3, -O3 -march=native -fopenmp -std=c++20, with and without -ffp-contract=off |
| GPU baselines | Custom float64 CUDA kernels of the same model, same source, inputs and random numbers (one thread per path or loan); PyTorch 2.15.0 float64 and float32: eager, torch.compile (mode max-autotune-no-cudagraphs), the whole 357-month loop captured in one CUDA graph, and the compiled step inside that CUDA graph, with normal draws from PyTorch's own generator; CuPy 14.2.0 vectorised over paths |
| CPU baselines | The same model compiled in float64; NumPy 2.5.5 vectorised over paths; QuantLib 1.44 HullWhiteProcess + GaussianPathGenerator from Python for the rate paths (20,000 paths) |
| MBS run | 262,144 paths × 357 months; prices at zero spread and 50 bp; OAS at par by bisection (17 evaluations) |
| Amortization run | 56,000,000 loans × 360 months = 20.16 billion loan-months |
Timings are kernel wall time after a warm-up (GPU: CUDA events or synchronised wall clock; PyTorch: best of three); copies to the GPU are reported separately; all GPU figures come from one run per GPU. PyTorch draws its normal shocks before the loop; that time is reported separately and added where stated. The custom float64 kernels use the exact lane's random numbers, so their difference from exact measures arithmetic and model detail only. PyTorch, CuPy, NumPy and QuantLib draw their own normals. PyTorch discounts monthly by division, like the exact model. NumPy and CuPy discount with exp, which compounds continuously, and QuantLib simulates the rate in its own discretisation, so their prices also differ in model detail.
Results
The same bits everywhere
| Exact | Float64, default compiler flags | Float64, FMA contraction off | |
|---|---|---|---|
| Per-path values | identical on all five machines | 10% of paths differ between GPUs and CPUs (up to 1.2 × 10⁻¹⁵ relative) | identical on GPUs and CPUs; about half differ from the default build |
| Price, pairwise or correctly rounded sum | 106.260366722642 (exact integer sum) | 106.2603585879518 on every machine | 106.2603585879518 |
| Price, naive left-to-right sum | (integer sum) | 106.26035858795314 | same |
| OAS at par | 110.1654 bp | 110.1654 bp |
The exact results agree to the last bit on every machine and in every configuration. The float64 model's per-path values depend on where the compiler fuses a multiply and an add: GCC and NVRTC choose differently, and with contraction off everywhere the GPUs and CPUs agree bit for bit. Those per-path differences, about 10⁻¹⁵ relative, never reached the price: summed pairwise or with a correctly rounded sum, the float64 price was the same on every machine. The only price difference measured came from the order of summation itself (naive against pairwise, CPU threads against a GPU reduction): 1.3 × 10⁻¹² points, $0.000000013 per $1 million face and 2 × 10⁻¹¹ bp of OAS. Financially that is nothing. What the exact price adds is that equality is guaranteed by construction rather than established after the fact for each machine, compiler and build.
Speed and error on GPUs

| Exact | Custom float64 kernel | PyTorch float64 | PyTorch float32 | CuPy float64 | Exact, cost per price | |
|---|---|---|---|---|---|---|
| NVIDIA A10G | 3.70 | 35.7 | 24.3 (38.9) | 6.2 (7.2) | 239 | $0.0000010 |
| NVIDIA L40S | 1.98 | 18.4 | 12.2 (19.3) | 2.9 (3.7) | 198 | $0.0000012 |
| Baseline | Random numbers | Returned price | Error, points | bp of OAS | $ per $1M face | Standard errors |
|---|---|---|---|---|---|---|
| Custom float64 kernel (all five machines) | same as exact | 106.2603585879518 | −8.1 × 10⁻⁶ | −0.0001 | −0.08 | −0.0006 |
| PyTorch float64, A10G / L40S | own | 106.24114 / 106.24877 | −0.0192 / −0.0116 | −0.33 / −0.20 | −192 / −116 | −1.5 / −0.9 |
| PyTorch float32, A10G / L40S | own | 106.25202 / 106.25395 | −0.0083 / −0.0064 | −0.14 / −0.11 | −83 / −64 | −0.6 / −0.5 |
| CuPy float64, A10G / L40S | own, exp discounting | 106.18744 / 106.18753 | −0.073 | −1.25 / −1.24 | −729 / −728 | −5.6 |
| NumPy float64 (three CPUs) | own, exp discounting | 106.17131 | −0.089 | −1.52 | −891 | −6.9 |
| QuantLib rate paths + NumPy, 20,000 paths | own, own discretisation | 106.11120 | −0.149 | −2.55 | −1,492 | −11.5 (−3.2 of its own SE) |
With the same random numbers, the custom float64 kernel's price is 8.1 × 10⁻⁶ points below exact, and no single path differs by more than $0.37 per $1 million face. That gap is the model definition: the exact model rounds cash flows to the cent and discounts in fixed point. Its OAS agrees with the exact OAS to the bisection tolerance. PyTorch's prices lie within 1.5 standard errors, as expected from its own random draws. NumPy's and CuPy's lie 5.6–6.9 standard errors low because they discount continuously (exp) rather than monthly: a model difference of 0.07–0.09 points, not a float error.
The A10G and L40S run float64 at a small fraction of their integer rate, and there the exact price is the fastest implementation measured. It is 9.6× and 9.3× faster than the custom float64 kernel, and 6.6× and 6.2× faster than PyTorch float64 at its fastest (10.5× and 9.7× including its draws). It is 1.7× and 1.5× faster than PyTorch float32 (1.9× including draws). Eager PyTorch float64 is 5–8× slower than its compiled, graph-captured form. The OAS (17 exact evaluations) takes 90 ms on the A10G and 58 ms on the L40S. On an H100 the custom float64 kernel took 1.44 ms per price and the exact kernel, before the correction described under Reproduction notes, 2.20 ms; the corrected exact kernel was not rerun on the H100, and PyTorch failed there with a CUDA-graph error (an earlier version of the benchmark script) and has no result.
On an NVIDIA B200 (version 2.2)
| B200 | Time | Same bits as the five machines |
|---|---|---|
| Exact, standard lane | 1.93 ms | yes (price sums, per-path hash, OAS) |
| Exact, finer discounting (matched accuracy) | 3.83 ms | yes (price sums, per-path hash, OAS) |
| Custom float64 kernel | 1.20 ms | per-path hash matches the CPUs with FMA contraction off |
| PyTorch float64, torch.compile + CUDA graph | 2.23 ms (3.23) | not comparable (own draws) |
| PyTorch float32, torch.compile + CUDA graph | 2.32 ms (2.74) | not comparable (own draws) |
| 56M schedules, exact | 0.0616 s | yes (total 3,002,624,852,666,465 cents and hash) |
| 56M schedules, custom float64, precomputed payment | 0.0509 s | total 3,002,624,827,436,544 cents (−25,229,921 cents) |
| 56M schedules, PyTorch float64, torch.compile | 0.137 s | total 3,002,624,826,382,681 cents (−26,283,784 cents) |
The B200 runs float64 at full rate, and, as on the H100, the float64 kernel is the fastest implementation there: the standard exact lane runs at 0.62× of it and the finer, matched-accuracy lane at 0.32×. The exact lane is 1.16× faster than PyTorch float64 at its fastest (1.67× counting its draws) and 1.20× faster than PyTorch float32; the finer lane is 1.72× slower than PyTorch float64. The baselines returned the same prices on the B200 as on the other GPUs, so the error table above applies unchanged. For the schedules, exact runs at 0.83× of a custom float64 kernel given the same precomputed payment and 2.2× faster than PyTorch float64. On the B200 the exact engine's advantage is the same bits as every other machine, not speed.
Speed on CPUs
| Exact | Compiled float64 | NumPy float64 | Exact, cost per price | |
|---|---|---|---|---|
| Graviton4 (64 vCPU) | 27.2 ms | 18.0 ms | 2.77 s | $0.000019 |
| Sapphire Rapids (64 vCPU) | 54.8 ms | 38.1 ms | 3.40 s | $0.000043 |
| EPYC Zen 4 (64 vCPU) | 34.2 ms | 22.8 ms | 2.66 s | $0.000031 |
On the CPUs compiled float64 is faster: the exact price runs at 0.66–0.70× of it (single thread: 1.64–2.04 s against 1.14–1.35 s). Vectorised NumPy is 62–102× slower than the exact kernel. QuantLib's Hull–White path generator, driven from Python, took 3.9–4.9 s for 20,000 paths (0.19–0.24 ms per path for the rates alone). The OAS took 0.47–0.91 s.
56 million mortgages

Every machine produced the same total paid, 3,002,624,852,666,465 cents, and the same hash of every month's interest. The exact kernel took 0.125 s on the A10G, 0.060 s on the L40S and 0.070 s on the H100, and 1.31–1.78 s on the CPUs. Copying the 1.34 GB of loans to a GPU adds 1.4–1.7 s. A custom float64 kernel (dollars, half up) took 2.48, 1.17 and 0.059 s on the three GPUs, and PyTorch with torch.compile took 2.03 s (A10G) and 1.50 s (L40S). On the A10G and L40S the exact schedules are 16–25× faster than either; on the H100 they run at 0.84× of the float64 kernel. The exact kernel receives each loan's level payment precomputed on the host (computed once per loan, outside the timed region); the float64 kernel and PyTorch compute it with pow() inside the timed loop, once per loan against 360 months of schedule.
Where float64 schedules differ, and why
| float64 lane | Total returned, cents | Loans not equal | Months whose interest differs | First divergence at a half-cent tie | Cents per loan: max / median of differing loans / mean over all |
|---|---|---|---|---|---|
| Dollars, half up: floor(100x + 0.5)/100 | 3,002,624,827,436,544 | 6,831,359 (12.2%) | 25,229,921 | all | 91 / 2–9 / −0.45 |
| Dollars, round-half-even (numpy.round) | 3,002,624,815,659,363 | 8,547,384 (15.3%) | 37,007,102 | all | 98 / 2–9 / −0.66 |
| Integer cents in a double, one division | 3,002,624,852,666,465 | 0 | 0 | – | 0 |
| Integer cents in a double, with remainder check | 3,002,624,852,666,465 | 0 | 0 | – | 0 |
| GPU custom kernel, dollars half up (A10G, L40S, H100) | 3,002,624,827,436,544 | not recorded per loan | |||
| PyTorch torch.compile, dollars half up (A10G, L40S) | 3,002,624,826,382,681 | not recorded per loan |
25,667,336 months (0.127%) have exactly half a cent of interest, and 15,220,670 loans (27.2%) have at least one such month. In binary, a dollar amount of k + ½ cents is usually stored just below the half, so the dollar lanes round it down. Every diverging loan first diverges at such a month, and every diverging month is one cent low: 6.8 million first divergences and 18.4 million follow-on months from the changed balance. The float payment formula plays no part: with the exact payment the counts are the same. The GPU custom kernel returns the same total as the CPU half-up lane on all three GPUs. PyTorch's dollar lane returns a total $10,538.63 lower, which comes from a different float operation sequence; it was not broken down per loan. Keeping integer cents in a double removes the problem entirely: the quotient's fractional part is either zero or at least 1/(2D), far above float error, and that lane matched the exact schedule on every loan.
| Summation of per-loan totals | Half-up dollar lane | Gap to exact |
|---|---|---|
| Naive, dollars in a double | $30,026,248,274,754.996 | −$251,909.65 |
| Pairwise | $30,026,248,274,365.438 | −$252,299.21 |
| Compensated (Neumaier) | $30,026,248,274,365.438 | −$252,299.21 |
| Each loan to integer cents, 64-bit sum | $30,026,248,274,365.44 | −$252,299.21 |
The total is 3.0 × 10¹⁵ cents, below 2⁵³, and the $252,299.21 gap is exactly 25,229,921 one-cent months: it is per-loan arithmetic, not summation. Summation error appears only with the naive sum, which is $316 off even on the exact per-loan totals and $389 off on the float ones; pairwise and compensated sums are exact to the cent.
Matched accuracy: every engine against a high-precision reference (version 2.1)
The custom float64 kernel and both exact lanes are measured against a reference of their own model in IEEE quad precision (113-bit significand), with the same random numbers. R1 is the float model with every operation in quad, the reference for the float64 lane. R2 is the exact lane's integer cash flows, discounted in quad, the reference for the exact lanes. Their difference, 4.8 × 10⁻⁶ points, is the exact model's cent rounding: a model choice, not an error.
| Lane | Price | Error, points | Per path, $ per $1M face: median / max |
|---|---|---|---|
| Custom float64 kernel vs R1 | 106.2603585879518 | −1.5 × 10⁻¹⁴ | 7 × 10⁻¹⁰ / 4.9 × 10⁻⁹ |
| Exact, discount factor 2⁻³² (tables above) vs R2 | 106.260366722642 | +3.3 × 10⁻⁶ | 0.034 / 0.055 |
| Exact, discount factor 2⁻⁵⁰ vs R2 | 106.260363406391 | −2.1 × 10⁻¹⁶ | 5.8 × 10⁻⁹ / 4.1 × 10⁻⁸ |
The exact lane in the tables above is less accurate than float64 against its own model. Its coarser discounting together biases the price up by 3.3 × 10⁻⁶ points ($0.033 per $1 million face): the rate is floored to 2⁻³⁰ and divided by 12 before the discount step, the discount factor is held in 2⁻³², and each month's present value is floored. The finer lane removes all three: its price is within 2 × 10⁻¹⁶ points of the reference, closer than float64's 1.5 × 10⁻¹⁴. Per path it is within 4.1 × 10⁻⁸ $ per $1 million face, against float64's 4.9 × 10⁻⁹. Its price (106.260363406391), its sum over paths, its per-path values (compared by hash) at both spreads and its OAS (110.1654 bp) are identical on the three CPUs, the A10G and the L40S. The prices and per-path values are also identical with FMA contraction off, and on the CPUs with 1 thread at zero spread.
| Exact, 2⁻⁵⁰ | Exact, 2⁻³² | Custom float64 | 2⁻⁵⁰ exact vs float64 | |
|---|---|---|---|---|
| NVIDIA A10G | 7.94 | 3.69 | 35.7 | 4.5× faster |
| NVIDIA L40S | 4.25 | 1.99 | 18.4 | 4.3× faster |
| Graviton4 (64 vCPU) | 35.8 | 35.9 | 18.0 | 0.50× |
| Sapphire Rapids (64 vCPU) | 91.4 | 54.8 | 39.6 | 0.43× |
| EPYC Zen 4 (64 vCPU) | 44.2 | 34.0 | 22.8 | 0.52× |
On the A10G and L40S the finer exact lane is the fastest of the implementations measured whose price error is at or below float64's: 4.5× and 4.3× the custom float64 kernel. It is also 3.1× and 2.9× faster than PyTorch float64 at its fastest, 4.9× and 4.5× including its draws. Those PyTorch times come from the run above, and PyTorch float64's own error against a reference was not measured; the comparison assumes float64-level error. PyTorch float32 is faster, but its price differs from PyTorch float64's, with draws from the same seed, by 0.011 points on the A10G and 0.005 points on the L40S, so it is not at matched accuracy. On the CPUs the finer lane runs at 0.43–0.52× of float64 (single thread 0.40–0.52×). Its OAS took 163 ms on the A10G and 97 ms on the L40S.
For servicing and MBS desks
| One book of 56M schedules | Same, with the copy to the GPU | One MBS price (262,144 paths) | One OAS (17 prices) | |
|---|---|---|---|---|
| NVIDIA A10G (g5.xlarge, $1.006/h) | $0.000035 | $0.00052 | $0.0000010 | $0.000025 |
| NVIDIA L40S (g6e.2xlarge, $2.242/h) | $0.000037 | $0.00088 | $0.0000012 | $0.000036 |
| Graviton4 (c8g.16xlarge, $2.552/h) | $0.0010 | $0.000019 | $0.00033 | |
| EPYC Zen 4 (c7a.16xlarge, $3.284/h) | $0.0012 | $0.000031 | $0.00051 | |
| Sapphire Rapids (c7i.16xlarge, $2.856/h) | $0.0014 | $0.000043 | $0.00072 |
- Servicing reconciliation. Investor reporting, payoff statements and remittance need the same cents wherever a schedule is recomputed. A dollar-based float64 schedule misses those cents on 12–15% of loans, each differing month one cent low, starting at a half-cent month. The exact schedule is the same on every machine. A float64 schedule kept in integer cents also reconciles; the exact kernel needs no such care, and on an A10G or L40S it re-amortizes a 56-million-loan book in 0.06–0.13 s.
- Revaluation. A full re-amortization of the 56-million-loan book costs $0.00004 of GPU kernel time ($0.0005–0.0009 with the copy to the GPU), or $0.0010–0.0014 on a 64-vCPU CPU. One exact MBS price costs $0.0000010–0.0000012 on an A10G or L40S.
- Model validation. An exact price re-run on different hardware is checked by equality, with no tolerance to justify.
Limitations and next steps
The limits of these results, each with its cause and, where one is planned, the next step.
- On the B200, float64 is faster too. The custom float64 kernel takes 1.20 ms per price against 1.93 ms (exact) and 3.83 ms (finer lane), and 0.0509 s against 0.0616 s for the schedules. Cause: the B200 runs float64 at full rate, so the integer arithmetic of the exact lanes has no throughput edge there; the finer lane also does twice the 128-bit products. Next step: a faster finer lane (fewer 128-bit products per month).
- On the H100, float64 is faster. The exact schedules run at 0.84× of a custom float64 kernel (0.070 against 0.059 s), even though the float kernel computes each payment inside the timed loop and the exact kernel does not. The float64 MBS kernel took 1.44 ms, against 2.20 ms for the exact kernel before the correction below. Cause: under investigation. The corrected exact MBS kernel was not rerun on the H100: all 140 launch attempts during the rerun, in us-east-1, the one region with quota for H100 instances, returned no capacity. The PyTorch run there failed with a CUDA-graph error from an earlier version of the benchmark script. Next step: both runs on an H100.
- On the CPUs, compiled float64 is faster: the exact price runs at 0.66–0.70× of the same model in float64, and the finer, matched-accuracy lane at 0.43–0.52×. Cause: under investigation.
- The exact lane in the main tables is less accurate than float64 against its own model (3.3 × 10⁻⁶ against 1.5 × 10⁻¹⁴ points). Cause: its coarser discounting: the rate is floored to 2⁻³⁰ and divided by 12 before the discount step, the discount factor is held in 2⁻³², and each month's present value is floored. The quad reference and the finer lane, which removes all three together, show this; no run separates them. The finer lane closes the gap at 2.1–2.2× the time on the GPUs. Next step: use the finer lane by default.
- A careful float64 schedule is also exact. Float64 holding integer cents matched the exact schedule on all 56 million loans; only dollar-based float64 schedules differ. Cause: integer cents below 2⁵³ are exact in a double, and with them the interest quotient's fractional part is zero or at least 1/(2D), far above float error. The exact kernel's advantage for schedules is that it needs no such care and is faster on the A10G and L40S, not that float64 cannot be made right.
- Float64 MBS prices did not differ in a way that matters. Per-path float64 values differ between GPUs and CPUs by about 10⁻¹⁵ relative, and they did not reach the price; only the summation order moved it, by 10⁻¹² points. Cause: compilers fuse multiply-adds differently (with contraction off, CPUs and GPUs agree bit for bit), and a sum's last bits depend on its order. Exactness is a guarantee, not the correction of a material error.
- A baseline model, not a desk model. The prepayment curve is documented, not fitted; constant-maturity yields are treated as zero rates; one pool, no payment delay, Euler steps. Cause: the study measures reproducibility, speed and error of one well-defined model.
- Synthetic loans. The 56 million loans are generated, not Freddie Mac's. Cause: the dataset's terms allow public results only for noncommercial purposes and need a licence for derived products. Next step: run on the real dataset internally, and publish only with Freddie Mac's agreement.
- CPU and GPU together gave no gain on the GPU boxes: 8.1 s (A10G box) and 4.8 s (L40S box), against 7.4 s and 4.0 s for the GPU alone plus copying. The 4–8 vCPUs of each box took 2.5–3% of the work. Cause: under investigation.
- The QuantLib baseline covers the rate paths only. QuantLib generated the Hull–White paths and NumPy priced the cash flows. Cause: this study did not build a QuantLib mortgage-pool engine with this prepayment model.
Reproduction notes
A first run of this study, not published, had an overflow in the exact kernel: the discount factor was multiplied in one 64-bit product, which wrapped when the factor exceeded 2 on paths with deeply negative rates. Because the wrap was deterministic, every machine returned the same, slightly wrong, price (106.260365688639). The per-path error table exposed it (one path differed from float64 by $1,403 per $1 million face); the product is now split, the largest per-path difference is $0.37, and every MBS figure above comes from the corrected run. The amortization kernels were not affected.
Every number comes from the run's JSON records and machine files (CPU model, compiler, libraries, GPU driver). The inputs are integer tables computed once and shared by all machines: the normal-quantile table, θ, the annuity factors, the vintage table and the loan-amount and rate-offset tables. Treasury yields and the PMMS rate are from FRED (series DGS1MO … DGS30 and MORTGAGE30US); conforming limits are FHFA's one-unit baseline limits. The kernels are available for evaluation through Request an evaluation.
References
- J. K. Salmon, M. A. Moraes, R. O. Dror, D. E. Shaw. "Parallel random numbers: as easy as 1, 2, 3." Proceedings of SC11, 2011. doi:10.1145/2063384.2063405
- J. Hull, A. White. "Pricing interest-rate-derivative securities." Review of Financial Studies 3(4), 573–592, 1990. doi:10.1093/rfs/3.4.573
- Freddie Mac. Single-Family Loan-Level Dataset and its terms and conditions. freddiemac.com/research/datasets/sf-loanlevel-dataset
- Federal Reserve Bank of St. Louis, FRED: Treasury constant-maturity yields (DGS1MO–DGS30) and Freddie Mac PMMS 30-year fixed rate (MORTGAGE30US).
- Federal Housing Finance Agency. Conforming loan limit values.
- QuantLib 1.44. quantlib.org
- Riptide. "Exact mortgage APRs and amortization, checked against 1.2 million loans." 2026. /whitepapers/exact-mortgage-apr
Date and version
Version 2.2, 2 December 2026: adds one NVIDIA B200 (both exact lanes bit-identical with the five machines; float64 faster there). Version 2.1, 1 December 2026: adds each engine's error against a quad-precision reference and an exact lane with finer discounting, measured at matched accuracy. Version 2, 1 December 2026 (version 1 was not published).
Working with Riptide
Riptide works with a small number of teams. Each engagement starts with 4 weeks inside your systems, learning how your models, data and infrastructure work. Only then does Riptide apply its software to them. Contact samario@riptidecompute.com or riptidecompute.com/evaluate.