ZipServ Guide: Lossless BF16 Compression for Fast LLMs

Deploying frontier large language models (LLMs) such as LLaMA-3.1, Qwen-2.5, and Mistral at scale requires immense hardware capital expenditure. A single 70-billion-parameter foundation model stored in standard BFloat16 (BF16) precision demands approximately 140 Gigabytes of physical memory just to hold its static model weights—completely independent of the dynamic memory required for KV-cache activation states. In production serving clusters, high-bandwidth GPU memory (HBM) capacity and memory bus bandwidth constitute the primary bottlenecks governing inference throughput and serving economics.
To mitigate this memory wall, the industry has overwhelmingly relied on lossy model compression, primarily post-training quantization techniques such as GPTQ, AWQ, and FP4/FP8 microscaling formats. While aggressive lossy quantization compresses model footprints into 4-bit or 8-bit integer encodings, it introduces unavoidable numerical degradation. In complex multi-step reasoning, mathematical theorem proving, syntax-sensitive code generation, and multi-turn agent loops, quantized approximations frequently cause catastrophic degradation. Benchmarks reveal that 4-bit quantization (such as MXFP4) slashes code generation pass rates from 56.0% down to 36.2% on LiveCodeBench, while even 8-bit quantization degrades long-context reasoning by over 11%.
In mission-critical, legal, scientific, and enterprise domains, organizations demand bit-exact numerical reproducibility. In these environments, lossy approximations cannot be tolerated.
Lossless model compression provides an ideal theoretical alternative: shrinking parameter storage without altering a single floating-point bit. Historically, however, lossless compression was restricted strictly to disk checkpoints or model distribution archives. When integrated into real-time GPU inference pipelines, existing lossless techniques (such as Huffman-based DFloat11 or ANS-based DietGPU) result in devastating runtime slowdowns—requiring 1.5x to 3.5x more wall-clock time just to decompress weights than to compute the neural network forward pass itself!
Presented at the 31st ACM International Conference on Architectural Support for Programming Languages and Operating Systems (ASPLOS 2026) by researchers from the Hong Kong University of Science and Technology (HKUST), ZipServ shatters this long-standing trade-off. By identifying the statistical phenomenon of BF16 exponent contiguity and co-designing compression formats with NVIDIA Tensor Core microarchitectures, ZipServ introduces Tensor-Core-Aware Triple Bitmap Encoding (TCA-TBE) and the fused ZipGEMM kernel.
ZipServ delivers up to 30% lossless model compression, achieves up to 2.21x kernel speedup over NVIDIA cuBLAS, and accelerates end-to-end serving by an average of 1.22x over vLLM—constituting the first practical demonstration in computer systems history that lossless compression can directly accelerate GPU inference.
In this deep architectural guide, we dissect the hardware-software mismatches of legacy lossless codecs, unpack the mathematical foundations of exponent contiguity, construct fused Tensor Core decompression kernels in CUDA, benchmark performance against merchant baselines, and outline production deployment strategies for bit-exact AI inference.
Problem: The Accuracy-Efficiency Dilemma of Lossy Quantization
To appreciate why ZipServ represents an essential systems breakthrough, we must examine why lossy quantization fails safety-critical applications and why previous lossless compression frameworks caused crippling inference slowdowns.
The Hidden Accuracy Collapse of Quantized Models
Modern foundation models rely on BFloat16 precision ($1\text{ sign bit}, 8\text{ exponent bits}, 7\text{ mantissa bits}$) because its dynamic range matches standard IEEE FP32 ($2^{-126}\text{ to }2^{127}$), preventing arithmetic underflow and overflow across hundreds of deep transformer layers.
When serving teams apply lossy post-training quantization (PTQ) to fit models onto consumer or tier-2 enterprise GPUs, they compress floating-point weights into low-bit representations:
+-----------------------------------------------------------------------------+
| THE QUANTIZATION ACCURACY PENALTY TAX |
+-------------------+--------------------+------------------+-----------------+
| Model Precision | Memory Footprint | Benchmark Task | Empirical Loss |
+-------------------+--------------------+------------------+-----------------+
| BF16 (Exact) | 140 GB (70B Model) | LiveCodeBench | 56.0% Pass@1 |
| MXFP4 (Lossy 4b) | 35 GB (70B Model) | LiveCodeBench | 36.2% Pass@1 |
| GPTQ-INT8 (Lossy) | 70 GB (70B Model) | NOCHA Long-Ctx | 11.1% Acc Drop |
| INT4-AWQ (Lossy) | 35 GB (70B Model) | Math Proofs | Divergent Logic |
+-------------------+--------------------+------------------+-----------------+ While lossy quantization delivers substantial memory savings, its accuracy penalties are unpredictable:
- Outlier Sensitivity: Neural network weights contain a small fraction of high-magnitude activation and weight outliers that govern model reasoning. Clamping these outliers into low-bit buckets induces irreversible representation collapse.
- Compounding Errors in Long Contexts: In 128K+ token context windows, quantization noise compounds exponentially across attention layers, causing retrieval failure in needle-in-a-haystack tasks.
- Zero Tolerance in Regulated Sectors: Financial modeling, autonomous driving, medical diagnostics, and enterprise compliance systems mandate bit-exact numerical validation. In these domains, lossy approximations violate governance policies.
The Kernel-Level Failure of Variable-Length Entropy Codecs
Recognizing the need for exact precision, researchers attempted to apply classical entropy coding (such as Huffman coding in DFloat11 or Asymmetric Numeral Systems in DietGPU) to compress BF16 weights. However, entropy coding generates variable-length bitstreams: frequent symbols are assigned short bit sequences (e.g., 2 bits), while rare symbols receive long sequences (e.g., 9 bits).
When implemented on GPUs, variable-length bitstreams cause catastrophic performance collapse due to a fundamental mismatch with the Single Instruction, Multiple Threads (SIMT) execution model:
+-----------------------------------------------------------------------------+
| THE SIMT CONTROL-FLOW DIVERGENCE COLLAPSE IN HUFFMAN/ANS |
+-----------------------------------------------------------------------------+
| |
| Thread 0 (Symbol: 2 bits): [01] ──► Decodes instantly ──► STALLS WAITING! |
| Thread 1 (Symbol: 7 bits): [1101001] ──► Iterative Bit-Shifting Loops... |
| Thread 2 (Symbol: 4 bits): [1011] ──► Stalls for Thread 1... |
| Thread 3 (Symbol: 9 bits): [111100101] ──► Serial Table Lookups... |
| |
| Consequences on NVIDIA GPU SM: |
| 1. Massive Warp Divergence: Warp threads lockstep to the slowest symbol. |
| 2. Serialized Pointer Arithmetic: Threads cannot compute the memory offset |
| of symbol N+1 until symbol N has completed decoding. |
| 3. Memory Bandwidth Collapse: Achieves only 43% - 76% of peak HBM bus BW. |
| |
+-----------------------------------------------------------------------------+ - Warp Divergence: On modern GPUs, 32 threads in a warp execute in lockstep. When different threads decode symbols of varying bit lengths, faster threads are masked off, idling while the slowest thread finishes.
- Serialized Pointer Arithmetic: In variable-length bitstreams, the memory address of the next symbol depends on the bit length of the current symbol. Threads cannot compute downstream memory offsets in parallel; decoding is forced into a sequential, loop-carried dependency that destroys instruction-level parallelism (ILP).
The System-Level Inefficiency of Decoupled Pipelines
Even if a decompression kernel runs reasonably well, existing serving systems deploy it within a decoupled inference pipeline:
+-----------------------------------------------------------------------------+
| DECOUPLED PIPELINE ROOFLINE INEFFICIENCY |
+-----------------------------------------------------------------------------+
| |
| Global HBM Memory (Compressed Weights) |
| │ |
| ▼ (Memory Read Pass 1: Load Compressed Bitstream) |
| [ Dedicated Decompression Kernel ] |
| │ |
| ▼ (Memory Write Pass 2: Materialize Full Uncompressed BF16 Weights) |
| Global HBM Memory (Uncompressed Weights Buffer) |
| │ |
| ▼ (Memory Read Pass 3: Reload Weights into Tensor Cores) |
| [ Standard GEMM Compute Kernel (cuBLAS) ] ──► Output Activations |
| |
| Outcome: Consumes 3x the global memory bandwidth! |
| Compute Intensity drops by >60% on Roofline Model! |
| |
+-----------------------------------------------------------------------------+ In a decoupled pipeline, the serving framework launches an independent decompression kernel to unpack compressed weights from global memory into an intermediate uncompressed buffer in global DRAM. Next, it launches a standard cuBLAS GEMM kernel to read those uncompressed weights from global memory into Tensor Cores.
This staged execution results in three round-trips over the memory bus for every matrix multiplication. Applying the Roofline model to this decoupled workflow reveals that Compute Intensity (FLOPs per byte transferred over global memory) plummets by over 60%. The overhead of writing and reading intermediate uncompressed weights in global DRAM completely erases the bandwidth savings achieved by compression.
For enterprise environments running automated web scraping pipelines or continuous inference microservices, this trade-off was untenable: saving 30% memory doubled execution latency.
Solution: Hardware-Aware Lossless Compression with ZipServ
ZipServ resolves both the kernel-level and system-level mismatches by co-designing the compression representation directly around the microarchitectural execution patterns of NVIDIA Tensor Cores.
+-----------------------------------------------------------------------------+
| THE DUAL INNOVATIONS OF ZIPSERV |
+-----------------------------------------------------------------------------+
| |
| 1. TENSOR-CORE-AWARE TRIPLE BITMAP ENCODING (TCA-TBE): |
| - Replaces variable-length entropy codecs with a fixed-length 3-bit |
| codeword representation. |
| - Decomposes codewords into three independent 64-bit bit-planes |
| matching 8x8 FragTiles, guaranteeing zero branch divergence. |
| - Exploits mathematical Exponent Contiguity across 99.6% of LLM weights.|
| |
| 2. FUSED ZipGEMM KERNEL ("Load-Compressed, Compute-Decompressed"): |
| - Decompresses weights on-the-fly directly into Tensor Core registers. |
| - Eliminates intermediate global DRAM buffers entirely. |
| - Increases Compute Intensity by ~50% above uncompressed cuBLAS! |
| |
+-----------------------------------------------------------------------------+ The Discovery of BF16 Exponent Contiguity
The cornerstone of ZipServ is a profound empirical and mathematical discovery regarding the statistical distribution of neural network weights.
Analyzing over 3,875 weight matrices across LLaMA-3.1, Qwen-2.5, Mistral, and Gemma-3, the authors of ZipServ observed that the 8-bit exponent fields of BF16 weights exhibit extreme redundancy:
- Skewed Exponent Distribution: The top-3 most frequent exponent values account for more than 67% of all weights, and the top-7 exponents cover over 95% to 97.4% of all model parameters.
- Low Information Entropy: While the BF16 exponent field is allocated 8 bits, its actual empirical entropy measures only 2.57 to 2.74 bits, demonstrating that over 5 bits per weight are statistically redundant.
- The Contiguity Invariant: Crucially, in 99.6% of all evaluated weight matrices, the top-7 most frequent exponent values form a strictly contiguous numerical sequence: $$\mathcal{E}_{\text{top}} = { e^, e^+1, e^+2, e^+3, e^+4, e^+5, e^*+6 }$$
Because the high-frequency exponents form a contiguous window, ZipServ does not require complex, variable-length Huffman codebooks. Instead, any exponent in the top-7 can be represented as an offset relative to a single base value: $$\text{BaseExp} = \min(\mathcal{E}_{\text{top}}) - 1$$ $$\text{Codeword} = e - \text{BaseExp} \quad (\text{where } \text{Codeword} \in [1, 7])$$
A special codeword 000 is reserved as an escape fallback for the 3% to 4% of weights whose exponents fall outside the top-7 window, storing them in full 16-bit precision.
Information-Theoretic Limits and Exponent Entropy Bounds
The theoretical viability of ZipServ is rooted in Shannon information theory. For an 8-bit discrete random variable $ representing the exponent of neural network weight values, the Shannon entropy is defined as: 17252H(X) = -\sum_{i=0}^{255} P(x_i) \log_2 P(x_i)17252
In standard IEEE 754 representations of random noise, (X) pprox 8.0$ bits, indicating zero compressibility. However, backpropagation and weight decay algorithms during LLM pretraining force weight tensors into smooth, bell-shaped Gaussian-like distributions centered around zero. When transformed into floating-point sign, exponent, and mantissa fields, the magnitude distribution causes the exponent values to cluster tightly within a narrow range corresponding to standard deviation scaling factors.
Empirical measurements across LLaMA, Mistral, and Qwen confirm that (X)$ measures between 2.57 and 2.74 bits. Because the top-7 contiguous exponents cover over 96% of all parameter occurrences, allocating exactly 3 bits (^3 - 1 = 7$ states plus 1 fallback state) captures over 98% of the information-theoretic maximum compression ceiling while maintaining fixed-length alignment.
The Roofline Reversal: Compute-Decompressed Execution
By establishing a fixed 3-bit codeword length, ZipServ enables fused on-the-fly decompression. Instead of writing decompressed weights back to global DRAM, the fused ZipGEMM kernel streams compressed weights directly into on-chip SRAM (Shared Memory) and decodes them straight into Tensor Core register fragments (Ra0-Ra3).
+-----------------------------------------------------------------------------+
| ROOFLINE COMPUTE INTENSITY FORMULATION |
+-----------------------------------------------------------------------------+
| |
| Standard GEMM (cuBLAS): |
| CI_GEMM = (2 * M * N * K) / [ 2 * (M * K + K * N + M * N) ] |
| |
| Decoupled Lossless Pipeline (DFloat11): |
| CI_Decoupled = (2 * M * N * K) / [ M * K * (2/CR + 4) + 2*(KN + MN) ] |
| --> Drops by 62% due to intermediate memory round-trip! |
| |
| ZipServ Fused ZipGEMM: |
| CI_ZipServ = (2 * M * N * K) / [ M * K * (2/CR) + 2*(KN + MN) ] |
| --> Increases by ~50% above uncompressed cuBLAS! |
| |
+-----------------------------------------------------------------------------+ Under memory-bound autoregressive decoding (batch size $N \in [1, 16]$), inference execution time is strictly bounded by the volume of bytes read across the GPU memory bus. Because ZipServ reduces the weight bytes transferred from DRAM by a factor of $\text{CR} \approx 1.51\text{x}$ and eliminates all intermediate memory write-backs, its effective Compute Intensity surpasses that of standard uncompressed cuBLAS, directly accelerating end-to-end token generation.
For enterprise inference platforms—such as services ingesting high-frequency real-time data fetching feeds—ZipServ enables GPUs to serve bit-exact tokens at higher throughput without requiring cluster expansion.
Architecture: TCA-TBE Bitmaps and Fused ZipGEMM Microarchitecture
The ZipServ architecture couples a three-level hierarchical tiling representation (TCA-TBE) with an execution pipeline that maps directly to the hardware units of modern NVIDIA GPUs.
+-----------------------------------------------------------------------------+
| ZIPSERV SYSTEM ARCHITECTURE OVERVIEW |
+-----------------------------------------------------------------------------+
| |
| OFFLINE COMPRESSOR (AOT Compilation): |
| - Profiles Exponent Histograms across all model layers |
| - Extracts BaseExp and top-7 contiguous exponent windows |
| - Encodes weights into 8x8 FragTiles via 3-plane Bitmaps + Packed Buffers |
| |
| ONLINE INFERENCE ENGINE: |
| ┌─────────────────────────────────────────────────────────────────────┐ |
| │ 1. STAGE-AWARE EXECUTION ROUTER │ |
| │ - Prefill Phase: Decoupled High-Throughput Decompression │ |
| │ - Decode Phase: Fused ZipGEMM ("Load-Compressed, Compute-Reg") │ |
| └─────┬───────────────────────────────────────────────────────────────┘ |
| │ |
| ┌─────▼───────────────────────────────────────────────────────────────┐ |
| │ 2. FUSED ZipGEMM KERNEL │ |
| │ - Asynchronous TMA / cp.async Global-to-Shared Memory Pipeline │ |
| │ - Warp-Level Branch-Free Bitwise Decompression │ |
| │ - Direct Register Emission to mma.sync.m16n8k16 Tensor Cores │ |
| └─────────────────────────────────────────────────────────────────────┘ |
| |
+-----------------------------------------------------------------------------+ Three-Level Hierarchical Tiling Layout
To eliminate coordinate translation overhead during Tensor Core execution, TCA-TBE aligns its data structures with the physical tiling hierarchy of NVIDIA Hopper and Ada Lovelace GPUs:
+-----------------------------------------------------------------------------+
| TCA-TBE HIERARCHICAL TILING SCHEME |
+-------------------+----------------------+-------------------+--------------+
| Tiling Tier | Dimensions | Hardware Target | Role |
+-------------------+----------------------+-------------------+--------------+
| 1. FragTile (FT) | 8 x 8 Elements | Warp Sub-Fragment | Base unit |
| 2. TensorCoreTile | 16 x 16 (2x2 FTs) | mma.sync Tensor C.| Matrix tile |
| 3. BlockTile (BT) | 64 x 64 (4x4 TTs) | Thread Block / SM | Cooperative |
+-------------------+----------------------+-------------------+--------------+ - FragTile (FT - 8x8): The foundational atomic block. Contains 64 weights. Each FragTile is represented by:
- Three 64-bit unsigned integer bitmaps ($\mathcal{B}_1, \mathcal{B}_2, \mathcal{B}_3$), where each bitmap represents one bit-plane of the 3-bit codewords across all 64 elements.
- A
PackedSignMantissabuffer storing the 8-bit sign and mantissa for weights covered by the top-7 exponents. - A
Fallbackbuffer storing full 16-bit BF16 values for escape outliers.
- TensorCoreTile (TT - 16x16): Aggregates a 2x2 grid of FragTiles in column-major order, exactly matching the operand register fragment layout (
Ra0, Ra1, Ra2, Ra3) expected by the PTX instructionmma.sync.aligned.m16n8k16.row.col. - BlockTile (BT - 64x64): Aggregates multiple TensorCoreTiles and is processed cooperatively by a thread block using shared memory staging.
Decoupled Triple Bitmap Encoding Mechanics
Traditional bitstreams pack non-byte-aligned bits (e.g., 3-bit codes) sequentially into continuous byte streams, forcing words to cross 32-bit and 64-bit boundaries. When 32 GPU threads attempt to read non-aligned bits in parallel, memory transactions fragment and branch divergence stalls the warp.
TCA-TBE bypasses this failure mode by decomposing codewords across three separate bit-planes:
+-----------------------------------------------------------------------------+
| TRIPLE BITMAP BIT-PLANE DECOMPOSITION |
+-----------------------------------------------------------------------------+
| |
| Element Index: 0 1 2 3 4 5 ... 63 |
| Codeword: (001)(110)(011)(101)(111)(000) ... |
| |
| Bitmap 1 (Bit 0): 1 0 1 1 1 0 ... --> 64-bit uint64_t |
| Bitmap 2 (Bit 1): 0 1 1 0 1 0 ... --> 64-bit uint64_t |
| Bitmap 3 (Bit 2): 0 1 0 1 1 0 ... --> 64-bit uint64_t |
| |
| Extraction for Element i: |
| bit0 = (Bitmap1 >> i) & 1; |
| bit1 = (Bitmap2 >> i) & 1; |
| bit2 = (Bitmap3 >> i) & 1; |
| codeword = (bit2 << 2) | (bit1 << 1) | bit0; |
| |
+-----------------------------------------------------------------------------+ Because each bitmap is a single native 64-bit word (uint64_t), threads read bitmaps via standard 64-bit aligned memory instructions. Furthermore, extracting the 3-bit codeword requires only uniform, single-cycle bitwise shifts (>>) and bitwise ANDs (&). Every thread in the warp executes the exact same instruction sequence—guaranteeing 100% branch-free execution.
Asynchronous Hardware Acceleration: TMA and Warp Specialization
On modern NVIDIA GPU architectures—specifically Hopper (H100, H200) and Blackwell (B200, GB200)—the execution of memory-bound GEMM operations relies on specialized asynchronous data movement hardware:
- Tensor Memory Accelerator (TMA): Rather than having individual CUDA threads compute addresses and execute load instructions, TMA offloads multidimensional tensor transfers directly to hardware coprocessors. In ZipGEMM, TMA descriptors are programmed with the strided dimensions of the 8x8 FragTiles, transferring compressed bitmaps and packed mantissa arrays from global HBM directly into shared memory without consuming a single ALU instruction or register file on the Streaming Multiprocessor (SM).
- Warp-Specialized Producer-Consumer Pipelines: ZipGEMM partitions the warps within each thread block into specialized roles. Producer warps manage TMA descriptor submission and orchestrate circular shared memory barriers using . Consumer warps remain dedicated to bitwise register expansion and Tensor Core execution (). This architectural separation ensures that memory transfer latencies are fully overlapped with mathematical computation.
Fine-Grained Software Pipelining in ZipGEMM
The fused ZipGEMM kernel overlaps data movement, on-the-fly decompression, and Tensor Core computation across three asynchronous pipeline stages:
- Stage 1 (Global to Shared Memory): Uses asynchronous copy primitives (
cp.asyncor Hopper TMA) to load compressed bitmaps and packed mantissas into shared memory without stalling SM compute cores. - Stage 2 (Decompression into Registers): Warps read compressed tiles from shared memory, execute bitwise expansion in registers, and assemble full BF16 values directly into Tensor Core input registers (
Ra0-Ra3). - Stage 3 (Tensor Core Math): Warps issue
mma.syncinstructions, accumulating matrix products into FP32 accumulator registers (Dfrag).
Implementation: Writing Fused Tensor Core Decompression Kernels
Implementing ZipServ requires building the offline TCA-TBE compressor in Python and writing the high-performance CUDA decompression-GEMM kernel.
+-----------------------------------------------------------------------------+
| ZIPSERV SOFTWARE IMPLEMENTATION |
+-----------------------------------------------------------------------------+
| |
| 1. Offline Python Compressor: |
| - Computes layer exponent histogram and finds top-7 consecutive window |
| - Decomposes 8x8 FragTiles into 3x 64-bit bitmaps + sign/mantissa arrays|
| |
| 2. Online CUDA ZipGEMM Kernel: |
| - Vectorized 64-bit bitmap loading from Shared Memory |
| - Branchless exponent restoration: exp = BaseExp + codeword |
| - Immediate packing into __nv_bfloat162 registers for mma.sync |
| |
+-----------------------------------------------------------------------------+ Step 1: Offline TCA-TBE Compressor (tca_tbe_compressor.py)
The following Python script analyzes BF16 PyTorch weight tensors, identifies the optimal contiguous exponent window, and serializes the matrix into TCA-TBE format:
#!/usr/bin/env python3
# TCA-TBE Offline Compressor for BFloat16 Weight Matrices
# Encodes weights into 3-plane bitmaps and packed sign-mantissa arrays
import torch
import numpy as np
from typing import Tuple, Dict
def extract_bf16_fields(tensor: torch.Tensor) -> Tuple[np.ndarray, np.ndarray, np.ndarray]:
"""
Extracts sign (1-bit), exponent (8-bit), and mantissa (7-bit) from BF16 tensor.
"""
u16 = tensor.view(torch.int16).cpu().numpy().astype(np.uint16)
signs = (u16 >> 15) & 0x1
exponents = (u16 >> 7) & 0xFF
mantissas = u16 & 0x7F
return signs, exponents, mantissas
def compress_matrix_tca_tbe(weight_tensor: torch.Tensor) -> Dict:
M, K = weight_tensor.shape
assert M % 8 == 0 and K % 8 == 0, "Dimensions must be multiples of 8x8 FragTile"
signs, exponents, mantissas = extract_bf16_fields(weight_tensor)
# Step 1: Profile exponent frequency and identify optimal top-7 contiguous window
hist = np.bincount(exponents.flatten(), minlength=256)
best_coverage = -1
best_start = 0
for start in range(256 - 6):
coverage = np.sum(hist[start:start+7])
if coverage > best_coverage:
best_coverage = coverage
best_start = start
base_exp = best_start - 1
top7_set = set(range(best_start, best_start + 7))
print(f"[*] BaseExp: {base_exp} | Top-7 Range: [{best_start}, {best_start+6}] "
f"| Coverage: {best_coverage / exponents.size * 100:.2f}%")
# Step 2: Tile-based encoding (8x8 FragTiles)
num_tiles_m = M // 8
num_tiles_k = K // 8
bitmap1 = np.zeros((num_tiles_m, num_tiles_k), dtype=np.uint64)
bitmap2 = np.zeros((num_tiles_m, num_tiles_k), dtype=np.uint64)
bitmap3 = np.zeros((num_tiles_m, num_tiles_k), dtype=np.uint64)
packed_sign_mantissa = []
fallback_outliers = []
for tm in range(num_tiles_m):
for tk in range(num_tiles_k):
tile_exp = exponents[tm*8:(tm+1)*8, tk*8:(tk+1)*8].flatten()
tile_sign = signs[tm*8:(tm+1)*8, tk*8:(tk+1)*8].flatten()
tile_mant = mantissas[tm*8:(tm+1)*8, tk*8:(tk+1)*8].flatten()
b1, b2, b3 = np.uint64(0), np.uint64(0), np.uint64(0)
for i in range(64):
e = tile_exp[i]
if e in top7_set:
code = e - base_exp # Codeword in [1, 7]
b1 |= np.uint64((code & 1)) << np.uint64(i)
b2 |= np.uint64(((code >> 1) & 1)) << np.uint64(i)
b3 |= np.uint64(((code >> 2) & 1)) << np.uint64(i)
# Pack 1-bit sign and 7-bit mantissa into 1 byte
packed_byte = (tile_sign[i] << 7) | tile_mant[i]
packed_sign_mantissa.append(packed_byte)
else:
# Escape code 000 (bits remain 0)
full_val = (tile_sign[i] << 15) | (tile_exp[i] << 7) | tile_mant[i]
fallback_outliers.append(full_val)
bitmap1[tm, tk] = b1
bitmap2[tm, tk] = b2
bitmap3[tm, tk] = b3
orig_bytes = M * K * 2
comp_bytes = (bitmap1.nbytes * 3) + len(packed_sign_mantissa) + (len(fallback_outliers) * 2)
print(f"[+] Original: {orig_bytes / 1024:.1f} KB | Compressed: {comp_bytes / 1024:.1f} KB "
f"| Ratio: {orig_bytes / comp_bytes:.2f}x ({(1 - comp_bytes/orig_bytes)*100:.1f}% savings)")
return {
"base_exp": base_exp,
"bitmap1": bitmap1,
"bitmap2": bitmap2,
"bitmap3": bitmap3,
"packed_sm": np.array(packed_sign_mantissa, dtype=np.uint8),
"fallback": np.array(fallback_outliers, dtype=np.uint16)
}
if __name__ == "__main__":
dummy_weight = torch.randn(4096, 4096, dtype=torch.bfloat16)
compressed_data = compress_matrix_tca_tbe(dummy_weight) Step 2: Fused On-The-Fly Decompression CUDA Device Function
The following CUDA device function implements the branch-free register decompression engine within the inner loop of ZipGEMM. It restores 2 BF16 values per thread directly into register format ready for mma.sync:
#include <cuda_fp16.h>
#include <cuda_bf16.h>
#include <cstdint>
// Branch-free restoration of 2 BF16 values from TCA-TBE FragTile
__device__ __forceinline__ __nv_bfloat162 decode_tca_tbe_pair(
uint64_t b1, uint64_t b2, uint64_t b3,
int idx0, int idx1,
uint8_t sm0, uint8_t sm1,
uint8_t base_exp
) {
// Extract 3-bit codeword for element 0
uint32_t c0 = (((b3 >> idx0) & 1) << 2) |
(((b2 >> idx0) & 1) << 1) |
((b1 >> idx0) & 1);
// Extract 3-bit codeword for element 1
uint32_t c1 = (((b3 >> idx1) & 1) << 2) |
(((b2 >> idx1) & 1) << 1) |
((b1 >> idx1) & 1);
// Compute exponents via implicit lookup addition
uint32_t exp0 = base_exp + c0;
uint32_t exp1 = base_exp + c1;
// Unpack sign (bit 7) and mantissa (bits 0-6)
uint32_t sign0 = (sm0 >> 7) & 0x1;
uint32_t mant0 = sm0 & 0x7F;
uint32_t sign1 = (sm1 >> 7) & 0x1;
uint32_t mant1 = sm1 & 0x7F;
// Assemble raw 16-bit BF16 bit representations
uint16_t bf16_raw0 = (sign0 << 15) | (exp0 << 7) | mant0;
uint16_t bf16_raw1 = (sign1 << 15) | (exp1 << 7) | mant1;
__nv_bfloat162 result;
result.x = *reinterpret_cast<__nv_bfloat16*>(&bf16_raw0);
result.y = *reinterpret_cast<__nv_bfloat16*>(&bf16_raw1);
return result;
} Comparison: ZipServ vs cuBLAS vs DFloat11 vs DietGPU
To rigorously evaluate ZipServ, we compare it against state-of-the-art serving backends across three dimensions: uncompressed vendor libraries (NVIDIA cuBLAS), variable-length lossless systems (DFloat11 and DietGPU), and lossy quantization frameworks (AWQ and GPTQ).
+----------------------------------------------------------------------------------------------------+
| LLM COMPRESSION & INFERENCE COMPARISON |
+--------------------------+-----------------------+------------------------+------------------------+
| Feature / Metric | ZipServ (ASPLOS 2026) | DFloat11 (Huffman) | NVIDIA cuBLAS (Dense) |
+--------------------------+-----------------------+------------------------+------------------------+
| Compression Type | Lossless (Bit-Exact) | Lossless (Bit-Exact) | Uncompressed Baseline |
| Numerical Accuracy Loss | Exactly 0.00% | Exactly 0.00% | Exactly 0.00% |
| Storage Memory Footprint | ~ 70% of BF16 (1.51x) | ~ 68% of BF16 (1.53x) | 100% (No Compression) |
| Encoding Granularity | Fixed 3-bit Bitmaps | Variable-Length Bitst. | Native 16-bit BF16 |
| SIMT Warp Divergence | Zero (Branch-Free) | Severe (Data-Depend.) | Zero |
| Pipeline Architecture | Fused ZipGEMM (Regs) | Decoupled (DRAM Buffer)| Direct GEMM |
| Kernel Speedup vs cuBLAS | Up to 2.21x Faster | 0.40x (2.5x Slower!) | 1.00x (Baseline) |
| End-to-End Speedup (vLLM)| 1.22x Average Speedup | 0.55x (Slowdown) | 1.00x |
| Target Serving Phase | Prefill & Decode Opt. | Decoupled Prefill only | Standard Batches |
+--------------------------+-----------------------+------------------------+------------------------+ Key Performance Insights
- Kernel Speedup Over cuBLAS: In the memory-bandwidth-bound decode regime (small batch size $N \le 8$), fused ZipGEMM outperforms uncompressed NVIDIA cuBLAS by up to 2.21x. By reducing weight memory traffic across the HBM bus by ~30% and executing decompression directly in registers, ZipGEMM achieves what was previously thought impossible: accelerating dense floating-point matrix multiplication through lossless compression.
- Eliminating the Decoupled Penalty: Compared to DFloat11 (which is forced to stage uncompressed weights in global DRAM), ZipServ is up to 5.53x faster. While DFloat11 suffers from high-latency memory write-backs and SIMT warp divergence, ZipServ’s fixed-length bitmaps execute with constant-time efficiency.
- Accuracy Preservation vs Lossy Quantization: Unlike INT4-AWQ (which suffers noticeable accuracy drops in coding and mathematical benchmarks), ZipServ guarantees bit-exact identity to uncompressed FP16/BF16. Developers running complex enterprise AI text extraction workflows can deploy ZipServ to accelerate serving without re-evaluating model accuracy or fine-tuning reward verifiers.
Production: Stage-Aware Serving Strategies and Hardware Deployment
Deploying ZipServ in enterprise production environments requires aligning its execution paths with the distinct computational characteristics of the prefill and decode serving phases.
+-----------------------------------------------------------------------------+
| ZIPSERV STAGE-AWARE PRODUCTION EXECUTION PIPELINE |
+-----------------------------------------------------------------------------+
| |
| INCOMING INFERENCE REQUEST |
| │ |
| ├──────────────────────────────────┐ |
| ▼ ▼ |
| [ PREFILL STAGE (Prompt Ingestion) ] [ DECODE STAGE (Token Emission) ]|
| - Arithmetic Characteristic: - Arithmetic Characteristic: |
| Compute-Bound Matrix Multiplication Memory-Bandwidth Bound GEMV |
| - Execution Path: - Execution Path: |
| Decoupled Parallel Decompression Fused ZipGEMM ("Load-Comp, |
| into Shared HBM Scratchpad Compute-Reg") |
| - Amortization: Large prompt GEMM - Amortization: Eliminates DRAM |
| FLOPs completely hide decompress time. traffic, boosting CI by 50%. |
| |
+-----------------------------------------------------------------------------+ Stage-Aware Execution Routing
In LLM serving, prefill and decode exhibit diametrically opposed hardware bottlenecks:
- Prefill Phase (Compute-Bound): When processing hundreds to thousands of input prompt tokens simultaneously, arithmetic intensity is exceptionally high. During prefill, ZipServ uses a decoupled parallel decompressor: it unpacks compressed weights into a shared scratchpad buffer in GPU memory once, followed by standard high-throughput GEMM kernels. Because the prefill forward pass executes billions of FLOPs, the one-time decompression overhead accounts for less than 1.5% of execution time.
- Decode Phase (Memory-Bound): During autoregressive token generation, batch sizes are small and arithmetic intensity is low. In this regime, memory bandwidth is the primary constraint. ZipServ automatically routes decode steps to the fused ZipGEMM kernel, decompressing weights directly into Tensor Core registers and eliminating memory bus traffic.
Hardware Compatibility and Deployment Guidelines
When deploying ZipServ across enterprise infrastructure clusters, systems engineers should follow these sizing and configuration recommendations:
- Target Hardware Architectures: ZipServ natively targets NVIDIA Ada Lovelace (RTX 4090, L40S) and Blackwell / Hopper (RTX 5090, H100, H200) architectures. It utilizes standard
mma.sync.aligned.m16n8k16instructions supported across compute capability 8.0+. - Scratchpad Buffer Sizing: In the decoupled prefill engine, allocate a temporary scratchpad buffer equal to the largest single weight layer in the model (typically 500MB to 1.5GB for 70B models). This scratchpad is reused sequentially across layers, requiring negligible extra HBM.
- Weight Calibration Pipeline: Compress weights ahead-of-time (AOT) during model registration. Offline compression of a 70B parameter checkpoint takes less than 8 minutes on a standard host CPU and requires zero fine-tuning, backpropagation, or calibration data.
By resolving the long-standing algorithm-hardware mismatch between entropy coding and GPU SIMT execution, ZipServ establishes a revolutionary new paradigm for efficient, bit-exact foundation model serving.