Blog

One shipped for AMD, one for NVIDIA, one had no code: we ported all three

UltraQuant shipped for AMD only, HyperQuant for NVIDIA only, and PearlQuant as a blog post with no code. We ported all three to AMD, NVIDIA and Intel GPUs, rebuilding PearlQuant from the post in 4 hours, and measured them against FP8, NVFP4, KIVI and TurboQuant.

Magni19 min read

Pearl Research’s post on PearlQuant describes an E8 lattice codec for the KV cache with a fused Blackwell kernel that decodes about as fast as NVFP4, but the code behind it was never released, and their GitHub organization has no repositories. So we rebuilt the codec from the post itself, filling every gap it leaves with a choice of our own, and benchmarked it in about 4 hours.

The reconstruction runs one decode-attention kernel on CUDA, HIP and SYCL, and it passes all 672 of its checks across seven device and backend pairs. Pearl’s rate-distortion figure reproduces closely, with 0.38 wasted bits per value at 2.75 bits against their 0.39. On Qwen3-8B our KL divergence is about twice what Pearl reports on GLM-5.3, and the kernel is slower than BF16 attention on every GPU we ran, so the post covers where it falls short as well.

PearlQuant wasn’t the only method stuck in one place. UltraQuant, a 4-bit KV-cache format whose vLLM backend is listed for ROCm only, and HyperQuant, whose released kernels target H100 and A100, went through the same process, so UltraQuant runs as native CUDA on five NVIDIA GPUs and as SYCL on Intel Arc, while HyperQuant’s kernels run through HIP on an MI300X and through SYCL on an Arc B390, an H100, a Xeon and the MI300X again. Each method has one CPU reference and one set of shared test vectors, and every backend had to match them before any of its timings counted.

The motivation is pretty simple. A quantization method is only as portable as its kernels, so a format that compresses the cache 4× on one vendor’s GPU, or only in a blog post, is unavailable everywhere else until someone writes and checks those kernels. We also wanted to know how each method holds up against the formats people already use, so we put them on one harness with FP8, NVFP4, KIVI, KVQuant, QServe and TurboQuant, and the answer isn’t always flattering.

PearlQuant, rebuilt from its blog post and benchmarked in about 4 hours. Our reconstruction passes 672 of 672 kernel checks on seven device and backend pairs and reproduces Pearl’s rate-distortion shape, while its KL on Qwen3-8B is about twice Pearl’s on GLM-5.3. HyperQuant passes 84 of 86 checks on six backends, failing the same two upstream bugs on each, and UltraQuant’s CUDA port ran 8,228 launches across five NVIDIA GPUs without a failure.

  • 672 of 672checks passed by our PearlQuant-style decode attention across seven device and backend pairs
  • 84 of 86HyperQuant kernel checks passed on every backend, the two failures being upstream bugs
  • 0 of 8,228UltraQuant CUDA launches that failed, every launchable configuration on every test vector
PearlQuant-style on H100 and B200 (CUDA), MI300X (HIP), Arc B390, Arc 140V, H100 and Xeon (SYCL). HyperQuant on H100 (CUDA), MI300X (HIP and SYCL), Arc B390, H100 and Xeon (SYCL). UltraQuant on A100, H100, L40S, B300 and RTX PRO 6000.

What does a KV-cache quantizer have to get right?

While a model generates text, it keeps the keys and values of every earlier token so that each new token can attend to them without recomputing the past. That store is the KV cache, and at long context it is most of what a decode step reads from memory, which is why storing it in 4 bits instead of 16 buys both capacity and, in principle, speed.

Speculative decoding adds a second pressure. The model checks K drafted tokens in one step, and a naive verify reads the whole cache once per drafted token, so the cost of checking grows with K and eats into the point of speculating. A fused verify kernel reads each page of the cache once and lets all K queries, and every query head that shares a KV head, use that one read.

Every method here also has to decode its compressed values on chip, and that turns out to be the part that decides speed. A format that saves bytes but costs more instructions to unpack than it saves in memory time is slower than the bigger format it replaces, and that happens more than once below.

How do you rebuild a codec from a blog post?

Pearl’s post says the codec is inspired by NestQuant, that it rotates each vector, rounds groups of eight values together to the E8 lattice and only gives indices to the lattice points a Gaussian is likely to hit. They report it on GLM-5.3 across eight B200s with a CuTe DSL kernel that decodes codewords straight into Blackwell tensor cores. The post doesn’t give the index assignment, the scale format, the split of bits between keys and values or how outliers are handled, so each of those had to be a choice of ours, and every one is written down next to what Pearl disclosed.

We rotate with random signs and a Walsh-Hadamard transform per 128-value head vector, and our codebook is the 2^b smallest-norm E8 points, indexed by leader, permutation rank and sign bits the way the AMR-WB+ and EVS speech codecs index theirs, so a kernel can decode it with a small table and integer arithmetic. Each vector carries one FP16 scale, which costs 0.125 bits per value, and K and V get 25 and 24, 18 and 17, or 16 and 16 bits per group of eight, which gives Pearl’s three rates as 3.188, 2.312 and 2.125 bits per value.

The first check was Pearl’s rate-distortion figure on Gaussian data, where the measure is how many bits per value a code spends beyond the theoretical minimum for its error. The shape reproduces, with 0.38 wasted bits at 2.75 bits per value against Pearl’s 0.39 when no side information is counted, though our 3.75-bit point is worse at 0.48 against 0.42. We don’t know which accounting Pearl used, and counting our FP16 scale moves those to 0.44 and 0.49.

Bits each code spends beyond the theoretical minimum

Wasted bits per value on Gaussian data, lower is better

  • HyperQuant, E8 with Rice codingvariable rate, interpolated at 2.75 bits0.30
  • PearlQuant-style, ours2.75 bits, no side information0.38
  • PearlQuant-style, ours, FP16 scale counted2.75 bits0.45
  • TurboQuant-MSE, our re-run3 bits0.56
  • NVFP4, our re-run4.5 bits1.11
  • FP8 E4M3, our re-run8 bits2.76
512K standard normal values. Pearl’s Fig. 5 reads 0.39 for their codec at 2.75 bits, 0.56 for TurboQuant-MSE, 1.15 for NVFP4 and 2.65 for FP8. HyperQuant is variable-rate, so it can’t be read at random like the others.

On a real model the gap to Pearl is larger. We measured how far each cache’s next-token distributions move from an FP8 cache, as KL divergence, on four PG-19 books of 16,384 tokens each with Qwen3-8B, since we couldn’t run GLM-5.3. Our KL is roughly twice Pearl’s at every rate, 0.098 against 0.057 at 3.2 bits, 0.264 against 0.122 at 2.3 and 0.440 against 0.207 at 2.1, on a different model with a different attention type and our own guess for every undisclosed choice.

Those numbers depend on a fix Pearl’s post doesn’t mention. Qwen3-8B’s keys share a large common component, worst in layer 0, and without removing it every low-bit rotated codec breaks at 16K context, so the 2.3-bit codec reaches a KL of 1.616 and TurboQuant-MSE at 3 bits reaches 1.091. Subtracting each layer and head’s mean key, taken from the first 256 prefill keys, shifts every logit of a query by the same constant, so the softmax is exactly unchanged and the kernel never sees it. With that centering the 2.3-bit codec falls to 0.264, and at about 3.2 bits the E8 codec beats a scalar Lloyd-Max codec at 3.125 bits, 0.098 against 0.150, with both centered.

KL divergence from an FP8 KV cache on Qwen3-8B, PG-19, four books of 16,384 tokens. Lower is better.
CacheBits per valueKLPerplexity
BF16160.00816.88
NVFP44.50.05517.47
INT4, group 324.50.11818.21
PearlQuant-style, centered3.1880.09817.93
TurboQuant-MSE, centered3.1250.15018.52
PearlQuant-style, centered2.3120.26420.10
PearlQuant-style, centered2.1250.44023.14
TurboQuant-MSE, centered2.1250.82732.04

The kernel is split-KV flash decoding that copies each 32-token tile of packed codes into shared memory, decodes every group of eight into exact INT8 lattice coordinates and dots the query against them. The query is rotated once per call and V is accumulated in the rotated domain and un-rotated once at the end, so no cached vector is ever inverse-rotated. A token’s K and V cost 102 bytes per KV head at 3.19 bits against 512 for BF16, and on the shared vectors the kernel passes 672 of 672 checks across seven device and backend pairs with a worst relative error of 1.1e-6.

The first version passed every check on the H100 and took 6,388 µs where the same skeleton reading BF16 took 733 µs, so the cost was in decoding each codeword rather than in bytes. On the Arc the first runs failed nondeterministically, partly because SYCL’s default queue is out of order and could run the reduction before the split kernel, and partly for a reason we never pinned down, since a serial softmax that passed on CUDA and HIP kept failing there until a rewrite parallelized it. The biggest single gain on the MI300X came from moving 22 KB of decode tables out of shared memory, where they limited each compute unit to one block, which took a call from 6,198 to 2,688 µs.

PearlQuant-style decode attention in microseconds per call, against the same kernel skeleton reading BF16 and FP8. Lower is better.
GPU and backendPearlQuant-style, 102 BBF16, 512 BFP8, 264 BVendor BF16
MI300X, HIP1,441952972not measured
H100, CUDA1,8625321,070357
B200, CUDA1,6725221,062221
H100, SYCL2,1656652,456not measured
Arc B390, SYCL10,0986,0957,408not measured

So the reconstructed cache is 5× smaller than BF16, but its kernel is slower than BF16 everywhere, because decoding codewords is integer work and with four query heads per KV head each decoded group feeds only four dot products. GLM-5.3’s MLA cache shares one latent across every head and Pearl’s kernel feeds tensor cores, and we didn’t reach their result of decoding about as fast as NVFP4. Pearl reports FP8 about 8% faster than their 3.2-bit codec on eight B200s at light load, while on our native backends at batch 8 our codec is 1.48× slower than our FP8 path on the MI300X and 1.74× on the H100.

UltraQuant was built for AMD. What does it take to move it?

UltraQuant stores each value as FP4 (E2M1) with one UE8M0 power-of-two scale per 32 channels. At head dimension 128 that’s 68 bytes per head per token for K or V, 3.76× smaller than FP16 and 1.88× smaller than FP8. Our starting point was a Triton kernel on the MI300X that does the fused verify, stacking the K queries and the GQA group into one tile, expanding FP4 to BF16 in registers, applying a causal mask per query and merging split-KV partial results with a log-sum-exp reduction.

The first CUDA port took our agent swarm about 2.5 hours to the five-GPU tables, roughly 1.5k lines of new code, and its first kernel was correct on the H100 and the B300. A second pass added two more designs, so the port has a mma.sync kernel for every GPU from sm_80, a warp-specialized wgmma kernel for the H100 at K of 4 or more, and a raw-PTX tcgen05 kernel that only wins on the B300 at K=8. Before any timing counted, the harness ran every launchable configuration on every test vector, which came to 8,228 launches across the five GPUs with no failures, and at the benchmark shape the error against an FP32 reference was at most 1.5e-4.

We also checked the port against the format as it ships upstream. The vLLM cache layout converts to ours by a byte permute with a byte-identical round trip, and our quantizer with the paper’s scale rule matches upstream bit for bit once the negative-zero code is canonicalized. Decode outputs on the upstream cache agree to BF16 rounding rather than bit for bit, because the accumulation order and query precision differ.

Fused verify attention per layer call in milliseconds, and its gain over running the same kernel K times. Lower time is better.
GPU and backendK=1K=2K=4K=8Gain at K=8
MI300X, Triton0.3610.3730.4530.5424.1×
B300, CUDA0.1390.1420.2550.3073.3×
H100, CUDA0.1630.1630.2140.2155.6×
A100, CUDA0.2560.2660.4650.7132.6×
RTX PRO 6000, CUDA0.2080.2100.2880.3812.7×
L40S, CUDA0.3910.3950.4310.4942.5×

One fused pass against K separate launches at K=8

Speedup of the fused kernel over the same kernel launched eight times

  • No gain: 1.0×
  • H100, CUDA5.6×
  • MI300X, Triton4.1×
  • B300, CUDA3.3×
  • RTX PRO 6000, CUDA2.7×
  • A100, CUDA2.6×
  • L40S, CUDA2.5×
Batch 8, 32,768-token context, 64 query heads and 8 KV heads at dimension 128, synthetic FP4 KV. H100 at K=8 uses the wgmma kernel and B300 at K=8 the tcgen05 kernel, the rest mma.sync.

Most of the H100 time went into finding where the kernel actually stalled. Our first two guesses, that FP4 dequantization was the bottleneck and that reading the block table was slow, were both wrong, since removing dequantization and the matrix multiplies entirely still left the B300 kernel at 0.143 ms and prefetching page ids changed nothing. Load-only and clock64 ablations found the real limit on the H100, a per-page barrier that serialized the two warpgroups doing dequantization. A dedicated producer warpgroup with a per-stage release barrier removed it, which took K=8 from 0.431 to 0.215 ms.

The SYCL port went onto an Arc B390 laptop GPU through a 372 MB DPC++ tarball, with no admin rights needed. The XMX joint_matrix path was correct on its first run, and an ESIMD path that keeps a byte-to-BF16 table in registers and computes the transposed score matrix on DPAS brought K=1 at 16K context from 2.62 to 1.72 ms and K=8 from 7.24 to 3.47 ms, against 4.90 and 5.81 ms for PyTorch’s FP16 attention on the same GPU. The strangest roadblock was the bandwidth ceiling. A read kernel over uniformly filled memory reported 430–455 GB/s because that data compresses on this GPU, while random bytes gave 105–113 GB/s, so the honest figure is 76% of a 108.6 GB/s ceiling at K=1 and 38% at K=8, where the kernel is bound by arithmetic. One quiet bug came from a 32-bit add of a scale exponent to a packed pair of BF16 values, which carried into the high half and biased the output by 0.6% until every scale add became a 16-bit lane add.

The port doesn’t make UltraQuant the fastest FP4 kernel on NVIDIA. On the B300, FlashInfer’s NVFP4 decode takes 0.066 ms at K=1 and 0.094 ms at K=8 against our 0.139 and 0.307 ms, 2.1× and 3.3× faster, and it already shares the read across queries. On the MI300X, which has no FP4 matrix instructions, the kernel decodes FP4 in software and reaches only 4–26% of HBM peak, so most of the 3.76× byte saving never becomes time.

HyperQuant only ran on NVIDIA. Could we even reproduce it?

HyperQuant rotates weights and KV values with a randomized Hadamard transform, rounds groups of eight to the E8 lattice and stores the result with Rice entropy coding. Its released code targets H100 and A100, builds with -arch=sm_90a, and its two public forks have no commits of their own, so before porting anything we reproduced the paper on an H100 to know what correct looked like.

The first thing to find was a 0.056 gap in the baseline. The usual way of joining WikiText-2 gives a BF16 perplexity of 7.2166, while dropping the empty rows before joining gives 7.1597, against the paper’s 7.1606. With that protocol the E8 weight rows at 3, 4 and 5 bits land within about 0.06 of the paper and most within 0.02, though only with the code’s default Hadamard size of 1024 rather than the tile of 128 the paper states. The KV “sweet spot” reproduces too, +0.252 perplexity at 3 bits against the paper’s +0.25. The long-context Qwen2.5-7B-Instruct-1M table reproduces as well, but only with the first and last blocks’ keys kept in BF16, because without that protection the model collapses to a perplexity of 10,318 even at 4 bits.

The HIP port is a re-runnable mechanical hipify plus a list of hand fixes, each with its reason, and the SYCL port is written by hand. Every backend has to produce bit-exact bitstreams, symbols and FP8, INT8 and BF16 outputs on the shared vectors, and all six pass the same 84 of 86 checks. The two failures are upstream bugs that the ports reproduce faithfully instead of silently fixing. The fused attention kernel accepts up to eight query heads per KV head but launches threads for only four, so for Qwen2.5-7B’s grouping 12 of 28 output rows come back as zeros, and the self-synchronizing decoder gets 326 of 65,536 symbols wrong when the Rice parameter is zero, a case the integration never uses.

End to end, the 4-bit Rice-coded Llama-3.1-8B gives a perplexity of 7.4019 on the MI300X through the HIP kernels and 7.4020 on the H100 through CUDA, from the same 4.088255 stored bits per weight.

Getting there meant learning where the vendors disagree about arithmetic. The MI300X’s native FP8 is E4M3-FNUZ rather than the OCP E4M3 that CUDA emits, so both ports convert in software to keep the stored bytes identical. On the Arc, three tests were one ulp off because SPIR-V’s FP32 division isn’t correctly rounded by default, which -foffload-fp32-prec-div fixed. The warp-specialized GEMM’s 64 threads are one wavefront on AMD, so its producer and consumer serialize there, still correct but with no overlap.

Running SYCL on the MI300X was its own detour. The DPC++ nightly ships no HIP adapter, and AdaptiveCpp wouldn’t build against the ROCm LLVM on the box, so we built it in a CPU-only container with upstream LLVM 20 and ROCm 7.0.2, whose HIP library matches the box, and shipped a 4.3 MB bundle that passes the same 84 of 86.

HyperQuant kernels on Llama-3.1-8B shapes at about 4 bits, the same bitstreams on every GPU. Lower is better.
KernelH100 CUDAMI300X HIPMI300X SYCLH100 SYCLArc B390 SYCL
Fused BF16 decode, ms1.1771.0331.0151.1876.547
Fused INT8 decode, ms1.1230.6590.6601.2034.522
GEMV, 32 layers, ms per token66.8103.8104.876.5488.1
Fused attention, 511 tokens, µs per layer17,37726,18229,81518,62024,754

The Rice decoders are latency-bound, decoding bits serially per thread at 20–45 GB/s of bitstream on GPUs that copy at 3–4 TB/s. The MI300X runs stand-alone decode at 0.59–0.94× the H100’s time in six of seven variants, while the fused GEMV is 1.1–2.2× slower, the warp-specialized GEMM 2.0–2.4× and the fused attention 1.5×. Splitting producer and consumer into separate wavefronts and shrinking the GEMV blocks gained at most 11%, which didn’t close that gap.

The paper’s throughput table doesn’t reproduce as stated. Its own conclusion holds, since Rice-coded weights decode 4–7× slower than BF16 on the H100, but its KV prefill row is close to BF16 only because, as far as we can tell, it didn’t encode the cache, since with the cache attached every 4-token chunk goes through the host at 259 tokens per second. The default INT8 path also keeps about 3 bytes per weight of decoder scratch in raw cudaMalloc, so it holds 24.2 GiB on the device against 15.0 GiB for BF16 while PyTorch reports 2.1 GiB. That’s one of seven upstream issues we documented, together with a fused attention hook that can’t run as shipped and weights and KV quantization that don’t compose.

How do they compare with FP8, KIVI and TurboQuant?

To make the comparison testable we gave every method a real fused decode kernel on one MI300X and ran them through one harness, with the same shapes, the same cold-cache timer and perplexity on Mistral-7B and Qwen3-8B. FP8, NVFP4, MXFP4, KIVI-4, QServe’s KV4, KVQuant-4, SpectralQuant and the 3-bit PlanarQuant, IsoQuant and RotorQuant are our ports, and TurboQuant-3 is our earlier AMD port, run unchanged. Each kernel was checked against the quantizer it reads before it was timed.

KV-cache formats with fused decode kernels on one MI300X, sorted by K=1 time. Time in milliseconds and perplexity change from FP16, lower is better.
MethodBytes per vectorK=1K=8Mistral-7BQwen3-8B
FP81280.2940.510+0.008+0.032
UltraQuant680.3610.551+0.139+0.562
MXFP4680.3890.538+0.190+0.482
QServe-int4680.3970.629+0.047+0.005
NVFP4720.4110.536+0.056+0.081
KIVI-4800.5400.784+0.010+0.026
RotorQuant-3520.7661.583+3.089+13.395
PlanarQuant-3520.7771.575+6.101+16.703
IsoQuant-3520.7901.584+2.537+13.870
KVQuant-4660.8221.644+0.220+1.064
TurboQuant-3521.1688.651+0.142+1.995
SpectralQuant48.51.4291.733+5.664+7.018

Against TurboQuant at 3 bits, UltraQuant is 3.2× faster at K=1 (0.361 against 1.168 ms) and 15.7× faster at K=8 (0.551 against 8.651 ms), because TurboQuant’s kernel has no multi-query mode and a verify has to call it eight times. The perplexity cost is the same on Mistral, +0.139 against +0.142, and much lower on Qwen3, +0.562 against +1.995, though TurboQuant stores 24% fewer bytes. Across 12 shapes in a separate head-to-head, UltraQuant was 2.8–6.1× faster at K=1 and 18–50× faster at K=8 than eight TurboQuant calls.

Against KIVI-4, the trade goes the other way. KIVI is clearly more accurate, +0.010 and +0.026, but its per-channel scales and BF16 residual window make it 1.5× slower at K=1 and 1.4× slower at K=8 for 80 bytes against 68. The dense path of KVQuant-4 is behind UltraQuant on both axes, 2.3× slower at K=1 and 3.0× at K=8 with +0.220 and +1.064, though that port leaves out KVQuant’s sparse outliers and attention-sink token, which would sit higher on accuracy.

Verifying eight speculative tokens on one MI300X

Milliseconds per layer call at K=8, lower is better

  • FP8128 bytes per vector0.510 ms
  • NVFP472 bytes0.536 ms
  • UltraQuant68 bytes0.551 ms
  • QServe-int468 bytes0.629 ms
  • KIVI-480 bytes0.784 ms
  • KVQuant-4, dense66 bytes1.644 ms
  • SpectralQuant48.5 bytes1.733 ms
  • TurboQuant-3, eight calls52 bytes8.651 ms
Batch 8, 32K context, 64 query heads and 8 KV heads, cold cache, one MI300X. Every kernel but TurboQuant’s, which has no multi-query mode, reads the cache once for all eight queries.

The table also shows where UltraQuant isn’t the best choice. QServe’s per-token INT4 is far more accurate at the same 68 bytes, with UltraQuant only 9–12% faster, and NVFP4 is more accurate for 4 more bytes while staying within 3% at K=8. FP8 is both more accurate and faster at K=1 on the MI300X, where 4-bit storage buys capacity rather than latency.

A 4-bit cache also lowers how often drafts survive verification. On Qwen3-8B, all eight verified tokens match FP16’s in 26.5% of cases with UltraQuant, against 82.5% with FP8 and 46.0% with NVFP4, while on Mistral-7B UltraQuant reaches 61.0%. That offsets part of the per-step gain, so a 4-bit cache has to be checked per model before it goes under a speculative decoder.

For the other two methods the comparison is about bits rather than milliseconds. HyperQuant’s entropy-coded E8 wastes fewer bits than any fixed-rate code we measured, but it can’t be read at random, so its decoders are serial and its attention runs at 1.5× the H100’s time on the MI300X. Our PearlQuant-style codec beats a scalar Lloyd-Max codec at about 3.2 bits once keys are centered, but its kernel is slower than BF16, so its case is capacity at 5× less memory per token.

What did it cost?

Most of the losses are already above, and they share one cause. On the MI300X and the Arc, which have no FP4 or lattice instructions, every method here unpacks its values in software, and that unpacking costs more issue slots than the smaller reads save at decode sizes. That’s why UltraQuant reaches 20% of the MI300X’s HBM peak at K=1 where FP8 reaches 47%, why the Rice decoders run at 20–45 GB/s, and why our PearlQuant-style kernel loses to BF16 while reading a fifth of the bytes.

None of the three ports is integrated into a serving engine. The serving run we have on the MI300X uses vLLM 0.33.0’s own ultraquant_4bit backend on Qwen3-8B, not our kernel, and it supports the capacity argument rather than a speed one. It held 2.89× the tokens of a BF16 cache and lifted an oversubscribed agent workload from 47.9 to 59.4 tokens per second, while plain decode fell from 1,052 to 767 tokens per second, RAG F1 dropped from 0.655 to 0.618 and greedy output left BF16’s after a median of 10 tokens, against 24 for FP8.

Where it stands

So no, none of these is the best KV-cache format, and none of the ports is the fastest kernel for its format on every GPU. FP8 and KIVI are more accurate, FlashInfer’s NVFP4 kernel is faster on Blackwell, and the PearlQuant reconstruction is our reading of a blog post on a different model, not Pearl’s codec.

But it is three methods that each lived on one vendor’s hardware, or on none, running on AMD, NVIDIA and Intel against one reference per method, with the bugs we found reproduced instead of hidden and every number traceable to a run.

The AllQuant repository has the kernels, the shared vectors, the porting logs and the raw results, and this article follows commit bc471375. The HyperQuant port and the PearlQuant reconstruction each have their own README, porting log and generated tables, and the design notes list every choice we made where Pearl’s post was silent.