Two Quant Builds Against Their Baselines: A Rust Execution Kernel and gpu-lab

Research note · Rust, PyO3, PyTorch · 7 November 2026

Both projects asked whether a heavier tool earns its place next to a cheap one. The first compared a compiled Rust kernel with NumPy for Almgren–Chriss optimal execution. The second compared a trained generative model with free historical resampling for market scenarios. Rust won, but only after an algorithm change. The GAN lost overall and won in one narrow place.

I. ac-kernel: Almgren–Chriss in Rust

The kernel computes the optimal liquidation schedule from the 2000 Almgren–Chriss model and exposes it to Python through PyO3. The question was whether it beats NumPy, which already runs compiled loops.

The first version did not. With two transcendental calls per time step it ran at 0.37× NumPy's speed on the batched case and tied on a single order. The gain came from rewriting the closed form as a power recurrence, so each step costs a multiplication:

xj = X (qj − q2N−j) / (1 − q2N),   q = e−κτ

The denominator uses expm1, and the form stays finite at extreme urgency, where the textbook sinh ratio overflows. Times below are medians of 7 repeats, in microseconds.

CaseLinux VM: RustNumPyRatioWindows: RustNumPyRatio
One order, N=3902.29.14.22×0.86.37.55×
One order, N=130.67.712.10×0.54.28.96×
10k orders × N=782,543.96,021.12.37×1,806.58,478.64.69×
Same, NumPy given the recurrence2,616.47,679.92.94×1,726.48,272.84.79×
Frontier, 1,000 λ × N=3902,219.125,429.711.46×800.911,381.714.21×

Linux VM: 2 vCPU Xeon at 2.1 GHz, from the project README. Windows: Windows 11 machine, run on 7 November 2026, NumPy 2.5.4; a second run stayed within 4% on every ratio.

The ratios move a lot between machines, so they are not constants of the method. The baseline also deserves credit: at N=13, plain Python (1.3 µs on Windows) beats NumPy (4.2 µs), because array overhead dominates at that size.

The schedule matches a direct linear solve to 1e-9 relative error for N from 1 to 390, and 500 random perturbations of it all raised the objective. The limits are real. Impact is linear, with no participation caps or volume profile, and the batch path runs on one core. The kdb+/q bridge has been compiled and parse-checked but never run against a live q process. Saving microseconds also says nothing about whether the model reduces execution cost. The source is not public.

II. gpu-lab: Does a GAN Beat Resampling?

gpu-lab follows the earlier WGAN-GP project from return vectors to full paths, trained on an RTX 5070 Ti Laptop GPU. Each version committed its pass criteria before training.

  • Synthetic rough-volatility paths. The rBergomi engine passed 8 of 8 validation checks. The WGAN-GP failed the economic gate, pricing a vanilla call against the model that taught it, under three critics (|z| of 16.5, 24.2 and 15.8). The objective was the constraint, not critic capacity.
  • Two years of SPY. The generated paths passed structural checks but lost to free block resampling, with only 0.45 of the real variance.
  • Ten years of SPY. Dispersion rose from 0.45 through 0.58 to 0.95 across the training ladder. The model put about one day in 12,800 beyond the sample's largest move, which resampling cannot do by construction. Its low tail was 3.5× closer (0.30 against 1.07 percentage points), but the high tail missed its bar by 0.034 points.
  • Three fresh seeds. That miss turned out to be seed noise: high-tail margins were −0.40, −0.58 and +0.04 points. The low tail beat resampling at every seed. A tail-weighted critic passed the tail gates at 3 of 3 seeds, which bought consistency rather than a larger edge.
Two dot plots of margin against historical resampling at the 99.9th percentile. In the low tail all six seeds sit below zero, meaning closer than resampling. In the high tail five of six do, and one baseline seed sits just above zero.
Per-seed tail margins against historical resampling. Negative means the GAN was closer. "c" is the baseline recipe and "tailcrit" the tail-weighted critic. Source: gpu-lab v3 report.

The working rule from the project: resample for convenience, and train only when you need the crash tail closer than resampling can get, or probability beyond your sample's horizon. The repository's scenario_cli therefore uses resampling and prints that blind spot with every chart. A further lever, an auxiliary loss on the terminal distribution, is scaffolded but was never run.

III. What Was Rerun

On 7 November 2026 the ac-kernel test suites passed (4 Rust, 37 Python), the Windows benchmark above was run, and the 34 gpu-lab tests passed. The Linux VM timings and every gpu-lab training, gate and hardware result are reported from the projects' own records and were not reproduced for this post. GPU convolution training is not bit-deterministic, so a rerun would not match those numbers exactly.