Flash-SD-KDE §5 — fused Laplace kernel: signed equivalence and cost

Reproduction of arXiv:2602.10378v1 (Epstein, Dwaraknath, Winnicki) against the authors' code at commit acaf8712. 1D toy mixture, 2048-point grid on [−6,6], ntrain 128–4096, 3 data replicates.

Verified

The claim holds, within stated scope. Fusing the Laplace-corrected kernel leaves the signed estimator unchanged — fused and non-fused densities agree to 1.1e-16 (float64) and 8.9e-8 (float32 and Triton), with zero sign disagreements in 18 runs — while cutting GPU runtime by 1.93×–6.20×. The corrected estimator stays distinct from empirical SD-KDE: negative mass 1.69e-3 vs exactly 0 at n=4096. No fixed speedup and no nonnegative-density claim follows.

Paper's number vs number obtained — the paper tabulates nothing for 1D, so several cells are "figure only"

QuantityPaper (Sec. 5 / 6.1, Figs. 3–4)This reproduction
Fused vs non-fused 1D error curves"the fused Flash-Laplace-KDE curve overlaps the non-fused implementation" — figure only, no numbersmax |Δdensity| 6.0e-8…8.9e-8 (float32, Triton); 1.1e-16 (float64); 0 sign disagreements; ΔMISE < 1e-9
1D fused speedupFig. 4 right panel, ≈2–8× band; not tabulated1.93× (n=128) → 2.42× (1024) → 6.20× (4096) on A10G; second run 1.99×–6.47×
1D MISE / MIAEFig. 3, log-log curves only, no tabletable below; e.g. n=4096 LC 1.1142e-3 / 6.5009e-2 vs emp SD-KDE 2.8013e-3 / 9.7414e-2
Integrated negative mass"logged as a diagnostic", no value reported1.0205e-2 (n=128) → 1.6873e-3 (n=4096); empirical SD-KDE exactly 0
Kernel identityKLC = Kh(1 + d/2 − ‖x‖²/2h²), stated analyticallyequals Kh − (h²/2)ΔKh to 4.4e-16; ∫KLC = 1, 2nd moment 0, 4th moment −3h⁴, sign flip at √3·h
16-D numbers (Table 1: 2.11 ms, 1.57×, 7.99×)reportednot tested — out of scope for the §5 1-D claim

MISE vs ntrain

mean of 3 per-replicate ISE, signed density

MIAE vs ntrain

mean of 3 per-replicate IAE, signed density

Runtime vs ntrain

A10G, 1 warmup + 3 CUDA-event repeats

plain KDE fused Laplace (Flash-Laplace-KDE) non-fused Laplace (dashed — overlaps fused) empirical SD-KDE

Signed error, declared config — mean of 3 per-replicate ISE/IAE, trapezoid, no clipping

ntrainmethodMISEMIAE∫neg massmin p̂∫|p̂|

Laplace-corrected estimator integrates to 1.0000 but is signed (min −0.00419, ∫|p̂| 1.00337 at n=4096); empirical SD-KDE has min 0.0 and ∫|p̂| 1.0. MISE/MIAE here are the mean of per-replicate ISE/IAE; computing ISE of the replicate-averaged density instead would give 0.710× (10 replicates) / 0.799× (3) the reported value.

Fused vs non-fused runtime — authors' protocol, A10G (paper: RTX A6000)

ntrainKDE msfused msnon-fused msnon-fused / fusedmax |fused − non-fused|

The fused kernel is flat at ~0.19 ms (launch-bound over this range) while the non-fused path pays a second pass that scales with n — so the ratio is a function of n, not a constant. On CPU in NumPy the fused form is slower (0.1137 s vs 0.1013 s at n=4096): the throughput claim is about the fused GPU kernel, not the algebra. A second complete run of run.py on the same flavor gave fused 0.1838–0.1857 ms and ratios 1.99×–6.47× — run-to-run variation of a few percent, so what reproduces is the shape of the ratio, not its exact value.

Environment

python  3.12.16
numpy   2.5.5
torch   2.15.0+cu132   (pip: torch==2.15.0, CUDA build)
triton  3.9.0
CUDA    13.2           GPU: NVIDIA A10G, 80 SMs, 23.9 GB
OS      Linux (HF Jobs a10g-small sandbox)
repo    github.com/Elliotepsteino/Flash-SD-KDE @ acaf8712f8c146c837e1d1dcccb56ce6322962bc

Pinned in requirements.txt. The static Space only serves this page; run.py is the script that executes the experiment (needs a CUDA device for stage 3, --skip-gpu for stages 1–2).

Files

run.py requirements.txt logs/run_full.log results/run_full.json logs/run_cpu.log logs/gpu_a10g.log results/run_cpu.json results/gpu_a10g.json logs/agent_trace.md data card (dataset)

Logs, including failures

Verdict and scope

Verified. All three parts of the claim survive an independent implementation: the kernel algebra is right, fusion does not perturb the estimator beyond float32 round-off, fusion is faster on GPU, and the Laplace estimator is statistically distinct from empirical SD-KDE (and signed, with non-zero negative mass).

What this does not establish. (1) No universal speedup: 1.93×–6.20× depends on n, on this A10G (80 SMs vs the paper's A6000 at 84) and on the launch-bound 1-D regime; no CPU speedup exists. (2) No nonnegative probability density: the estimator integrates to 1 but has negative values and negative mass. (3) "Distinct" is an estimator-class statement supported by a consistent ordering at all six n, not a significance test at 3 replicates. (4) In 1-D the Laplace estimator also wins MIAE, whereas the paper's 16-D text reports Flash-SD-KDE best on MIAE — a dimension-dependent ordering, not a contradiction. (5) Deviations: A10G not A6000; float64 gold pass added; 10 replicates run with the first 3 being the declared config; authors' gitbud plumbing bypassed while their timing code was copied verbatim.