MARLIN: Mixed-Precision Auto-Regressive Parallel Inference on Large Language Models

Elias Frantar, Roberto L. Castro, Jiale Chen, Torsten Hoefler, Dan Alistarh

TL;DR

MARLIN is a high-performance GPU kernel designed to make Large Language Model (LLM) inference significantly faster by using 4-bit weight quantization. Unlike previous methods that lose efficiency when serving multiple users at once, MARLIN maintains near-theoretical 4x speedups for batch sizes up to 32 and introduces a sparse variant that pushes performance even further.

What Problem Does This Paper Address?

LLM inference is notoriously "memory-bound." This means the processor spends more time waiting for model weights to move from memory to the compute units than it does actually performing calculations. Quantization—compressing weights from 16-bit (FP16) to 4-bit (INT4)—is a popular solution because it reduces the amount of data to move.

However, there is a catch: batching. In real-world serving (like ChatGPT), systems process many user requests simultaneously to maximize throughput. As the batch size increases, the "arithmetic intensity" rises—the GPU has to do more math for every byte of data it reads. Existing quantization kernels often fail to provide significant speedups in these batched settings because they aren't optimized to handle the increased compute load while simultaneously hiding memory latency. MARLIN aims to bridge this gap, providing "near-optimal" performance for both single-user and multi-user scenarios.

Methods

The authors developed MARLIN (Mixed-precision Auto-Regressive LINear kernels) specifically for NVIDIA Ampere GPUs. Their approach relies on several low-level optimizations:

  • Asynchronous Memory Pipelining: Using hardware features like cp.async to load data from Global Memory directly to Shared Memory, bypassing intermediate registers. They implement a 4-stage pipeline to ensure that while one set of data is being computed, the next three are already being fetched.
  • Striped Partitioning: Standard matrix partitioning often leaves some GPU cores (SMs) idle if the matrix shape isn't a perfect multiple of the core count. MARLIN uses a "striped" strategy that distributes work more evenly across the GPU, which is critical for the diverse layer shapes found in models like Llama or Falcon.
  • Fast Dequantization: Instead of slow type-casting, MARLIN uses clever bit-manipulation and floating-point math tricks to decompress 4-bit weights into 16-bit values directly in the GPU registers.
  • Sparse-MARLIN: The authors extended the kernel to support NVIDIA’s 2:4 structured sparsity, where 50% of the weights are zeroed out in a specific pattern. This allows the kernel to leverage "Sparse Tensor Cores" for even higher throughput.

Datasets

The researchers evaluated MARLIN using:

  • Model Architectures: Llama-2 (7B, 13B, 70B), Falcon-180B, and Yi-34B.
  • Accuracy Benchmarks: To ensure quantization didn't break the models, they tested on MMLU, WinoGrande, and ARC-Challenge.
  • Performance Benchmarks: They measured "Time Per Output Token" (TPOT) and "Time To First Token" (TTFT) using the popular vLLM serving engine.

Key Insights and Ideas

  • The "Memory-Bound" Threshold is Higher Than Thought: A key insight is that even at batch sizes of 16 or 32, 4-bit LLM inference remains memory-bound on modern GPUs. This means there is still a massive opportunity for speedups that previous kernels were leaving on the table.
  • Compiler Brittleness: The authors noted that modern GPU compilers are "brittle." Small changes in how scales are loaded can cause a 10–20% slowdown. MARLIN is hand-optimized to ensure the compiler maintains a perfect instruction pipeline.
  • Global Reduction Efficiency: For very large models sharded across multiple GPUs, MARLIN’s striped partitioning minimizes the overhead of "global reductions" (combining results from different cores), making it highly scalable.

Key Results

  • Near-Theoretical Speedup: On an NVIDIA A10 GPU, MARLIN achieves a ~3.9x speedup (out of a theoretical 4x) for 4-bit weights at batch sizes up to 32.
  • End-to-End Gains: When integrated into the vLLM serving engine, MARLIN delivered up to 2.8x faster token generation for Llama-2-7B.
  • Sparsity Bonus: Sparse-MARLIN provided an additional 65% speedup over the dense version, reaching up to 3.2x end-to-end speedup compared to standard 16-bit baselines.
  • Robustness: MARLIN maintains its performance even when GPU clock speeds are throttled, whereas competing kernels (like AWQ or ExLlamaV2) see their relative speedups drop significantly.

Limitations and Future Work

  • Hardware Specificity: The current implementation is heavily optimized for NVIDIA's Ampere architecture (e.g., A10, A100, RTX 30-series). While it works on newer Hopper (H100) cards, it doesn't yet use H100-specific features like the Tensor Memory Accelerator (TMA).
  • Weight-Only Quantization: MARLIN focuses on quantizing weights. It does not currently address "activation quantization" (quantizing the data flowing through the model), which becomes necessary for very large batch sizes (e.g., >128) where the system becomes compute-bound.
  • Future Directions: The authors suggest extending MARLIN to support "extreme" compression (like 2-bit quantization) and exploring how to integrate activation sparsity.

Summary updated

BibTeX
@inproceedings{frantar2025marlin,
  author = {Elias Frantar and Roberto L. Castro and Jiale Chen and Torsten Hoefler and Dan Alistarh},
  title = {{MARLIN: Mixed-Precision Auto-Regressive Parallel Inference on Large Language Models}},
  booktitle = {PPoPP},
  year = {2025},
  doi = {10.1145/3710848.3710871},
}
Figure