GVR V2: Benchmark Methodology and Figure Reproduction#

This companion to GVR V2: Self-Sampling and Multi-Thresholding for Faster Exact Top-K contains the observations and definitions needed to reproduce the article’s performance figures, plus the scope of its supplied temporal-overlap illustration and statistics. The article focuses on the algorithm and its performance; this document records the measurement boundaries.

Regenerate the Figures#

With NumPy and Matplotlib installed, run from the repository root:

python docs/source/blogs/media/gvr_v2/plot_results.py

The script regenerates summary.json and ten SVGs: speedup.svg, evolution.svg, candidate_work.svg, algorithm.svg, gpu_sampling.svg, radix_cuda_map.svg, gvr_v1_map.svg, latency.svg, roofline.svg, and integration.svg. It requires no GPU. The algorithm diagrams are schematic; every performance panel uses the bundled timing observations.

The remaining figure, temporal_overlap.svg, is an author-supplied illustration converted directly from its standalone PDF. Its labels, axes, and plotted contents are preserved. It is not generated by plot_results.py or derived from the kernel-timing CSVs.

GPU Sampling Implementation#

gpu_sampling.svg illustrates the public device implementation at the measured PR #19076 revision. It is schematic and adds no measured performance claim.

Both streaming families use packed/vectorized current-row windows. Let d = SS2 be the integer stride in window units and SMP the number of windows. The score offsets below are relative to the aligned sampling base, with 0 <= j < SMP:

Family

Window start

Loads and logical ownership

main

8*j*d

Work item j loads two adjacent float4 vectors, covering eight FP32 scores

clus

16*j*d

Work item j loads the lower eight scores and j + SMP loads the upper eight, using two float4 vectors each

The clustered work items need not be adjacent lanes or distinct physical threads when the logical sample exceeds the CTA size. In both families, physical threads stride through additional work items in CTA-sized increments. Vector loads use ld.global.nc.v4.f32; the stride and count guards keep them inside the permitted interval. Prefill substitutes a valid score for leading alignment lanes before histogramming. The initial two vectors remain available for the sample histogram; extra work items are reloaded after sample extrema establish the bin scale. Eight retained sample scores are not the kernel’s total register count.

The CUDA Best Practices Guide documents 32-byte access granularity and the cost of sparse or misaligned accesses. A 32-byte-aligned eight-score window occupies one sector and a similarly aligned sixteen-score window occupies two. The supported API guarantees vector alignment, not universal 32/64-byte row alignment; a window offset by 16 bytes touches two or three sectors respectively. Cache reuse, warp issue patterns, and replay can further affect traffic. A 64-byte window is a software grouping, not a claim about cache-line size or a single memory instruction.

The locality/coverage and register-lifetime explanation is an engineering interpretation of this implementation, not a measured 8-versus-16 ablation or evidence that either width is universally optimal. At fixed total sample count, the larger window has fewer distinct locations. Correlated values within a window do not supply independent random observations.

The runtime geometry starts with a route-dependent budget proportional to N / aim, clamps the requested score count between 256 scores and half the row, then derives the integer window stride and count. Targets use the actual S = SMP*8 or S = SMP*16 population after rounding. For desired candidate population A = aim, the descending target ranks are approximately A*S/N, K*S/N, and 2*A*S/N; the third target is implemented as twice the first integer target. The 256-score budget floor and 256 histogram bins are separate tuning parameters.

Sample extrema reduce within each warp, pass through shared memory, and combine across warps after a CTA barrier to establish the 256 sample bins. Workers increment shared-memory counters, then synchronize before warp 0 calls scan_cross0. Each lane scans eight counters using two vector shared-memory loads and warp shuffles. This single scan extracts up to three rank crossings and clears the counters; a caller-side barrier publishes its results.

Sample-bin lower edges define the primary threshold T near rank A*S/N, the upper anchor T_K near rank K*S/N, and the lower anchor T_3 near rank 2*A*S/N. For sample-bin width w, sampled main sets HIC = max(T + 4*max(T_K - T, 0), T + 8*w): fourfold extrapolation of the nonnegative upper gap with at least eight bin widths of headroom. In clus, when a valid lower anchor satisfies T_3 < T, the upper gap is first capped at 2*(T - T_3) before applying that same extrapolation and headroom. HIC tightens the classification bound; scores above it saturate into the top bin and remain candidates.

Where enabled and valid, T_3 supplies the lower admission floor TSH. Non-split streaming can retry with this floor after an aggressive primary threshold; the gated split-row route can stage down to the floor during its scan so the merged histogram already includes that wider admitted set. Sample misses, incomplete staging, and degenerate brackets still require exact verification or recovery. Non-sampled short-row and register routes retain their separate initialization policies.

In variable-length main, warp 0 derives sampling geometry and publishes it through shared memory while the other warps issue register-free L2 prefetch hints for their CTA’s upcoming row slice. Later register preloads and L2 hints are placed after the sample-reduction publication barrier, limiting overlap between live sample-reduction state and prefetched values. Cluster ranks repeat an identical full-row sample and prime their row slices after the corresponding barrier. Their sample histograms are CTA-local; subsequent verification histograms may be merged across the cluster. The prefetch placement is an implementation detail, not an independently measured contribution to speedup.

Candidate-Work Illustration#

candidate_work.svg is a schematic, independent of the timing observations. For a finite-score row with K-th-largest boundary \(\tau\) and \(q\le\tau\), the admitted population obeys \(C_p=C(q)=K+E+D(q,\tau)\). Here \(E=C(\tau)-K\) counts excess boundary ties and \(D\) counts entries with \(q\le x_i\lt\tau\). The simplified curve labels the three population segments directly, and the matching bar explains their roles without numerical ratios. Their proportions are illustrative, not benchmark measurements.

Both panels are computed from the same finite synthetic row in plot_results.py. The tail-count axis is linear, and the stacked bar is proportional to population size. At the exact boundary, the filled marker includes ties and the open marker excludes them; their difference is the entire tied population, of which only the excess contributes to E.

The admission band requires \(K\le C(q)\le B_r\). A large tie plateau can leave no threshold in this band; the exact recovery path still applies. In V2, the admitted count describes candidate handling, while only the crossing bin requires the remaining exact selection. The illustration does not imply that every execution family materializes the same buffer or that candidate count alone predicts latency. The tail-count curve explains threshold admission; it does not prescribe a scalar search or a particular number of verification thresholds.

Temporal-Overlap Illustration#

Figure 2 shows SWE-bench-64K decode traces for DeepSeek-V3.2 and DeepSeek-V4 Pro. The temporal-hint index mapping shifts each prior index by +1 for V3.2 and leaves each compressed-bin index unchanged for V4 Pro. Overlap is the fraction of current Top-K indices covered by that mapped prior. Blue points are current selections matched by the mapped hint; orange points are current selections it misses. For V3.2, +1 predicts a one-position shift as decoding advances; this evaluates a prediction rule, not retention at identical token indices. The top panels show selected 1,024-position crops for layer 60. The bottom panels use the full index domain over 298 transitions per trace, without smoothing, for V3.2 layers 0/20/60 and Pro layers 2/22/60. Parenthesized legend values are mean overlaps.

The figure illustrates temporal-hint variability, not kernel speedup. Its source Top-K streams are separate from the timing observations bundled below. provenance.json records the supplied SVG’s checksum without private source paths or submission metadata.

Temporal-Overlap Statistics#

The table following Figure 2 uses author-supplied near-64K overlap summaries. Layer IDs are matched between SWE-bench and random-token inputs within each indexer. First average the adjacent-step hit ratio after temporal-hint index mapping over time for each layer; then compute statistics across those layer means, with equal weight per layer despite unequal decode durations. P10 and P90 are linearly interpolated empirical quantiles. V3.2 maps prior indices by +1; V4 retains the same compressed-bin indices.

Indexer

Input

Layers

Mean

Median

P10

P90

Min–max

V4 Pro

SWE-bench

30

71.5%

70.5%

60.3%

82.6%

57.1–85.0%

V4 Pro

Random tokens

30

57.9%

58.1%

33.6%

80.4%

28.4–86.7%

V4 Flash

SWE-bench

21

62.8%

61.5%

53.4%

73.3%

53.2–83.7%

V4 Flash

Random tokens

21

52.8%

49.2%

30.7%

74.7%

25.9–81.3%

V3.2

SWE-bench

61

47.4%

47.8%

37.9%

59.7%

5.7–70.7%

V3.2

Random tokens

61

46.0%

46.5%

33.1%

62.2%

6.0–67.9%

These percentages preserve the supplied summaries’ precision. They are independent of the timing CSVs and are not regenerated by plot_results.py. They summarize per-layer means, not individual-step extremes or the selected traces in Figure 2. Different K values and index-mapping rules make this evidence of hint variability, not a controlled ranking of models or a universal causal effect of prompt type. Low overlap concerns prediction quality and execution cost; exact verification and recovery preserve selection correctness.

Published Data#

File

Contents

flash_timings.csv.gz

2,079 DeepSeek-V4 Flash cases

pro_timings.csv.gz

2,970 DeepSeek-V4 Pro cases

v32_timings.csv.gz

4,697 DeepSeek-V3.2 cases

temporal_comparison.csv.gz

One GVR V1 observation for each of the same 9,746 cases

provenance.json

Published-file checksums, implementation labels, pairing, and roofline constants

summary.json

Recomputed statistics

plot_results.py

Figure generation

The CSVs begin with a copyright comment. cell, model, isl_bucket, and layer identify a workload. batch, n, and k specify its dimensions. Columns ending in _us contain case-level mean kernel durations in microseconds. Join the temporal supplement by (cell, batch). Blank entries indicate missing or unsupported measurements, never zero latency. The loader maps blanks to None in both timing sources; statistics exclude missing observations, and complete-case comparisons exclude rows with any missing comparison timing. The full figure-regeneration command requires the bundled complete grid for all three implementations and rejects missing timings before writing outputs, preserving the article’s common-coverage claims.

The files contain kernel timings and workload dimensions. They do not contain input scores, prompt contents, or individual timing repetitions. They reproduce the published statistics and charts; repeating the GPU experiment requires suitable score inputs and a benchmark harness.

Measurement and Comparison Scope#

Measurements use NVIDIA B200, FP32 indexer scores, and batch sizes from 1 to 1,024. The GVR V2 reference covers 886 row geometries and 9,746 workload/batch cases, all passing tie-aware exactness checks. Each published GVR time is the arithmetic mean of 10 cold-L2 repetitions, rounded to 0.001 µs; five warm-L2 repetitions are excluded from these figures. A 512 MiB cache eviction runs outside the timed region. Compilation, input preparation, allocation during setup, and Python launch overhead are excluded; required device kernels remain timed.

Each workload/batch case repeats one captured layer/step score row into distinct batch rows. This controls the input distribution and valid width while measuring batch scaling; it is not a heterogeneous batch of independent serving requests. GVR uses next_n=1 and sets max_seq_len to that case’s valid row length times its compression ratio. A serving graph may use a larger stable envelope and choose a different execution plan. The bundled grid does not independently benchmark ragged mixed-length batches, MTP, or prefill.

The primary reference is the hint-free GVR V2 run_varlen implementation from PR #19076, measured at its final public revision. Its FP32 comparisons with GVR V1 and TensorRT LLM radix CUDA match observations from separate runs by workload identity and batch size, with shape metadata checked where available. All three implementations cover the same 9,746 cases. Baseline times are retained as measured; no aggregate correction factor is applied. These comparisons describe the bundled kernel implementations and workloads, rather than the performance of entire serving frameworks.

The device kernel and host dispatcher at the main revision audited on September 17, 2026 are byte-identical to those measured for the reference. This establishes source continuity for those files, not a new whole-framework performance measurement.

Figures 1, 3, and 7–10 and their numerical summaries all use this PR #19076 reference. B300 measurements are outside the B200 comparison. Historical serving experiments retain their original implementation scope, as described below.

Implementation

Relevant comparison contract

GVR V2

FP32 scores, valid row lengths, unordered INT32 indices

GVR V1

Temporal-prior pivot/rescue admission; complete implementation paired by workload and batch

TensorRT LLM radix CUDA

Production dispatcher, including short-row insertion and long-row split-work paths

The GVR V1 implementation reference appears below. Complete build revisions for the historical radix observations are unavailable in the timing export.

GVR V1 and Algorithm Evolution#

The GVR V1 baseline is the tiered temporal implementation from public PR #16877, recorded in the temporal_tiered_us column. It already uses multi-threshold admission: sampled ladder counts choose a pivot and rescue rung, then a fused count/collect pass verifies both exactly. Its short-row and register routes have different execution strategies; Figure 3 sketches the streaming comparison, while its bars measure complete implementations.

V2 changes calibration to packed/vectorized current-row windows and couples it to dense verification-bin counts and crossing-bin refinement; multi-thresholding itself is not a V2-only contribution. The GVR V1 comparison spans full implementations, including scheduling and integration; it is not an isolated self-sampling ablation. The public source at the article’s implementation reference is the GVR V1 kernel.

The prior contract depends on the selected engine. At the measured revision, TopK.needs_gvr_prior is true only for the temporal GVR path. V2 decode calls the self-sampling run_varlen, whose public signature has no pre_idx. The V1 tiered_topk dispatcher retains its required prior input. The self-sampling launcher fills an internal kernel argument slot named pre_idx with the output-index tensor; its hint-free kernels do not read that slot. This internal ABI slot is not a previous-step input to the V2 public entry point.

Figure 3 computes each implementation’s speedup directly from its paired radix times. The geometric means are 3.471858× for GVR V1 and 5.051864× for V2. The direct GVR V1/V2 time ratio is 1.455089×. summary.json records these under evolution_vs_radix and temporal_vs_v2.

The direct V2 comparison also exposes the lower end of the measured speedup distribution:

Baseline

V2 speedup, geometric mean

V2 speedup, P5

V2 wins / cases

V2 win rate

GVR V1

1.455089×

1.095922×

9,704 / 9,746

99.569054%

The P5 value is the fifth percentile across per-case temporal_tiered_us / gvr_v2_us mean-time ratios, not a runtime tail latency or a percentile of individual timing repetitions. It describes the bundled case distribution and does not establish a worst-case latency guarantee.

Aggregation and Coverage#

Speedup is the geometric mean of per-case baseline_us / gvr_v2_us ratios. Every case has equal weight. A win is a ratio strictly above one; minima and percentiles also use individual ratios of case-level mean durations. _stats in plot_results.py calls numpy.percentile without a method override, using its default linear interpolation between adjacent sorted ratios at fractional index (cases - 1)*p/100 for percentile p. No slower case is discarded.

Figure 1 uses the same cases for all three implementations within each model: 2,079 Flash, 2,970 Pro, and 4,697 V3.2 cases, totaling 9,746. V2 is fixed at 1.00; shorter bars mean less time. These values are recorded under comparison_common_cases. The article’s overall and per-model tables use this same full paired coverage.

The latency and roofline curves use arithmetic-mean durations over all captured layers at each row-length/batch point: 21 layers for Flash, 30 for Pro, and 61 for V3.2. All layers at each plotted point have the same valid width. The radix CUDA comparison heatmap (Figure 7) instead geometrically averages per-layer radix_cuda_us / gvr_v2_us ratios at each shape, using the same layers. It contains 275 cells: 99 each for Flash and Pro, and 77 for V3.2, covering all 11 batch sizes. The panels share a 1–21× color scale with parity at 1.0, and cell labels round to one decimal place. The cell values range from 1.522571× to 20.182551×, with no clipping by the color scale. A shape average can hide variation among individual cases.

The GVR V1 comparison heatmap (Figure 8) uses the same 275 shapes and layer weights, with per-layer temporal_tiered_us / gvr_v2_us ratios. Its shared 1–3× scale is separate from the radix heatmap’s scale; cell labels round to two decimal places. Shape averages range from 1.053828× to 2.865232× without clipping. Per-model minima/maxima are 1.058428×/2.865232× for Flash, 1.053828×/2.828985× for Pro, and 1.100878×/1.862122× for V3.2.

All shape averages exceed one, but 15 shapes contain at least one slower constituent layer: one for Flash, six for Pro, and eight for V3.2. An orange corner identifies these cells using the unrounded per-layer ratios and a strict below-one comparison. There are 41 individual regressing cases overall; the markers indicate their presence, not their count or magnitude, and do not claim statistical significance. At Pro N=131,075 and B=512, the 30-layer geometric mean is 1.053828× while the minimum layer ratio is 0.688535×. These are the same observations used in the article’s overall comparison.

Correctness compares selected value multisets with torch.topk, allowing tied indices to differ. The capture-grid checks do not establish NaN ordering parity or a universal tie order. The linked implementation PRs additionally cover padding, variable lengths, exceptional values, and graph replay.

Additional Numerical Views#

The article uses Figure 1 for the model-level comparison. The following table uses the same full paired coverage and reports geometric-mean speedups of V2 over each baseline.

Baseline

V4 Flash, \(K=512\)

V4 Pro, \(K=1024\)

V3.2, \(K=2048\)

GVR V1

1.53×

1.54×

1.37×

TensorRT LLM radix CUDA

4.88×

4.87×

5.25×

Each model column uses the same workloads for both baselines.

For a concrete large-batch slice, the following times are at \(B=1024\) and \(N\approx131{,}072\), averaged over the same layers as Figure 9:

Model

GVR V2

GVR V1

Radix CUDA

V4 Flash

113.1 µs

138.4 µs

461.3 µs

V4 Pro

132.8 µs

146.1 µs

477.7 µs

V3.2

123.9 µs

166.0 µs

496.7 µs

Roofline Definitions#

The logical work is W = B*N abstract comparisons and the minimum traffic is Q_min = 4*B*(N+K) bytes, accounting for FP32 score reads and INT32 index writes. Operational intensity is I = W/Q_min; measured useful throughput is P = B*N/(time_us*1e6) Tcompare/s. Every kernel uses this same normalization. Temporal-prior accesses, padding, staging, repeated scans, and synchronization remain in measured time but do not enlarge the ideal work or minimum-traffic terms. The plotted throughput is not a hardware instruction rate or measured DRAM bandwidth.

The full model is min(R, BW*I). The theoretical parameters are R=37.224960 Tcompare/s and BW=8 TB/s; calibrated parameters are R=37.047490 Tcompare/s and BW=6.912116 TB/s. Their knees are 4.65312 and approximately 5.35979 compare/byte, above Top-K’s ideal [0.125, 0.25) intensity range. The semantic comparison convention counts two binary comparisons per FMNMX3 result; it is not FP32 FLOPS.

Figure 10B uses linear axes at B=1024. In this article, a Pareto curve denotes each operator’s measured intensity–throughput trace across row lengths at that fixed batch. The points connect in intensity order; the curve is not a computed nondominated frontier or a search over configurations. Figure 9 also shows B=1, and the heatmaps in Figures 7–8 cover all 11 batches.

Reachable rate is 100 * P / min(R, BW*I) percent, using the calibrated roof. Compute each point from the arithmetic-mean duration across the same 21/30/61 layers used in Figure 10B for Flash/Pro/V3.2. The average reachable rate is the unweighted arithmetic mean of these point-level percentages, and the peak is their maximum. Flash and Pro each contribute nine intensity points; V3.2 contributes seven. The average is not weighted by row length or serving frequency. summary.json records the point counts and average/peak percentages under roofline_reachable_rate.

Every plotted point lies on the bandwidth branch of the roof. With elapsed time t and consistent units, the fractional reachable rate simplifies to (W/t)/(BW*W/Q_min) = Q_min/(BW*t); multiply by 100 for percent. This is the ideal minimum-traffic time Q_min/BW divided by measured time. The cancellation of W explains why the comparison convention does not change the reachable rate on this branch. Additional traffic and kernel work remain in t, so the rate does not measure actual DRAM bytes transferred or bandwidth utilization.

The read-dominated roof is optimistic; mixed read/write behavior and additional kernel work can lower achievable throughput. Reachable rate describes useful selection work relative to this model, not measured DRAM bandwidth utilization.

The input-read term applies to nontrivial selection with more valid scores than output slots. Short-row identity/padding paths can skip score reads; they are outside the measured grid and should not be evaluated against this traffic bound.

Serving Results#

Decode TPOT results come from public PR #18410; prefill results come from public PR #18702. These are separate historical serving experiments, not transformations of the operator speedups or measurements of the current complete framework. The 1.84–2.61× prefill-kernel range compares aggregate rank-0 Top-K kernel durations within measured Flash/Pro prefill windows; it is not the latency of a single Top-K invocation. The 2.9–4.5% throughput increase isolates adding V2 prefill to a deployment already using V2 decode on the tested long-input, batched configurations. It is not the throughput gain of replacing radix in both phases.