QUIK: Towards End-to-end 4-Bit Inference on Generative Large Language Models
Paper · 2024 · Saleh Ashkboos, Ilia Markov, Elias Frantar et al.
Summary
When a language model processes a long prompt, it applies the same learned weights to many tokens at once. Storing those weights in a smaller format helps them fit in GPU memory and reduces the amount of data the GPU must fetch. The calculations can still take just as long if the weights are converted back to their original precision before multiplication. QUIK tackles that bottleneck by converting both the weights and the values they act on to low-precision integers. That lets the GPU use its faster integer arithmetic for much of the work. The paper studies this approach in large language models.
The obstacle is that some activation features regularly take much larger values than the rest. If every feature shares a narrow integer format, accommodating those large values leaves less room to represent ordinary ones. The authors use calibration text to identify features that need special treatment in each layer. At inference time, QUIK separates those features and their matching weights from the main computation and multiplies them at higher precision. Most other features use 4-bit arithmetic. The method also raises the precision of selected layers whose inputs remain difficult to represent after the split. GPU kernels combine operations around the integer multiplication to limit the time spent preparing inputs and reconstructing outputs.
On WikiText2, QUIK brings OPT-66B from a full-precision perplexity of 9.34 to 9.66. For LLaMA2-70B, the corresponding values are 3.20 and 3.74, with about 70% of linear-layer operations performed in 4-bit precision. The authors also compare full-precision and compressed versions of OPT and LLaMA-2 on zero-shot tasks and find that the average scores remain close. In the end-to-end prompt-processing benchmark, LLaMA2-70B reaches up to 3.4× the FP16 throughput, while its measured peak GPU memory goes from 147.1 GB to 49.1 GB. Those results describe the prompt pass with 2048 tokens. Separate tests show that shorter inputs can give the GPU too little arithmetic to offset the extra work imposed by quantization.
The paper also tests whether quantization can be combined with hardware-supported sparsity, which removes selected weights in a fixed pattern. On Falcon-180B, applying the pattern to attention projections while keeping the feed-forward layers dense preserves considerably more of the text-prediction quality than applying it throughout the network. Together, the experiments show where low-precision arithmetic can deliver a practical speedup and which parts of the network need more room to preserve accuracy.
Deep dive: QUIK: Towards End-to-end 4-Bit Inference on Generative Large Language Models
QUIK uses 4-bit integers for most linear-layer calculations to speed up prompt processing while preserving language model accuracy. · about 32 minutes to read
The problem and its context
What changes when a GPU handles more tokens
A generative system first processes the tokens already present in a prompt. This phase, called prefill, gives a linear layer a matrix with many input rows. After that, the system can generate a continuation by predicting a token and using it as part of the input to the next prediction. In the case of a single request being served on its own, this later phase can give the same layer very few new rows to process at each step. The weight matrix can be identical in both phases, while the work done with it differs substantially. This distinction matters for text generation and for how the paper approaches GPU computing.
A linear layer forms weighted sums. For each input row, it combines the input features with learned weights to produce a row of outputs. A long input gives the GPU many such rows over which to reuse the same weights. A short input gives it fewer. In the short case, fetching the weights can take enough time to dominate the operation. In the long case, the GPU has more calculations to perform for the weights it fetches, so the rate at which it can carry out arithmetic becomes more important. A batch of requests that each need their next token can also give the layer many rows to handle together.
The authors illustrate this change with a roofline analysis. A roofline associates the achievable speed of a calculation with the amount of arithmetic done for the data it moves. Its lower-intensity portion reflects the constraints of memory transfer. At higher intensity, the ceiling on arithmetic throughput becomes decisive. With 1 or 16 tokens, the profiled operation is on the memory-bound side. The paper places the transition to compute-bound execution around 64-128 tokens in its discussion. Those observations motivate the prefill experiments. The threshold describes the operation under study, since changing the layer dimensions or the GPU can change the balance.
This distinction also explains why the amount of memory saved and the amount of time saved need separate measurements. A smaller weight representation can help a network fit on fewer GPUs even if a particular operation takes as long as before. A faster multiplication can substantially reduce prefill time while offering a smaller benefit for isolated generation steps. To turn lower precision into a general-purpose linear-layer implementation, the authors have to consider both the stored representation and the work that happens when a new input arrives.
What weight compression leaves for integer arithmetic
Quantization replaces values drawn from a relatively fine numerical format with values from a coarser one. A scale tells the implementation how to interpret an integer code in the units of the original values. For weights, that representation can be prepared ahead of time. When a method quantizes weights alone, the GPU can fetch fewer bytes for those weights and convert them for use with floating-point activations. That addresses a major cost in the memory-bound case. The principal multiplication still uses its original arithmetic, and the conversion adds work. The paper discusses this line of research as part of efficient models and compression.
One of the methods QUIK builds on is GPTQ. In the paper’s account, GPTQ works through the weight matrix by input column. Once it has quantized a column, it adjusts the remaining columns to compensate for the error that the quantization introduced. The adjustment uses information about the inputs to estimate how changing the weights will affect the layer’s response. QUIK takes this approach to preparing weights and gives it an ordering suited to mixed precision. The earlier method is GPTQ.
To use an integer matrix-multiplication instruction for the main arithmetic, the implementation also needs integer activations. Activations are the input values generated by earlier layers for the current tokens. Their values become available during inference, so preparing them is part of the execution cost. The paper points to NVIDIA’s native support for INT8 and INT4 on the GPU architectures it discusses. Raw INT8 multiplication can provide throughput a little above 2x that of FP16 in the measurements cited by the authors, and INT4 comes close to doubling the INT8 throughput. Those measurements establish an opportunity for faster execution. Actual layer throughput also depends on the work required to use that arithmetic.
Why activation features need different treatment
When a row is represented with a single scale, large values can determine the spacing between the available integer codes. Values in the more densely occupied part of the row then have fewer distinct codes available to represent them. The paper reports that some activation columns can reach magnitudes up to 100x larger than others. A column is a feature shared across the rows, so a large feature can impose this cost across many tokens. The issue becomes particularly consequential at 4 bits, where there is less room to accommodate both the extremes and the smaller values.
LLM.int8() addresses large activation features by identifying them during the forward pass, then treating their contribution separately. QUIK adopts the idea of treating some features differently, with a change in when it decides which features qualify. The paper describes searching for them during execution as an additional cost. SmoothQuant supplies a reason that this search can be moved earlier. It found that the feature positions associated with large activations in a layer persist across datasets. A calibration run can therefore supply the indices for later use with new inputs. The earlier work is LLM.int8() and SmoothQuant.
Prior work on representing both activations and weights at lower precision had already made the arithmetic savings possible at 8 bits. For 4 bits, the authors describe substantial losses in prediction quality for earlier joint methods. Their question is whether a selective exception for difficult features can preserve enough of the quality while leaving enough operations on the faster path. The design has to satisfy both conditions at once. A numerically effective exception can still be expensive if it requires repeated scans or copies. A very fast implementation of the narrow format can also have limited value if its outputs damage the network’s predictions.
The method, step by step
The two contributions to a linear layer
Think of each output as a sum with one contribution from each input feature. If a few features have unusually large activations, their terms can be evaluated separately. The rest of the sum can use integers. Both sets of terms contribute to the same output, so QUIK restores the numerical scale of the integer result and adds it to the higher-precision result. The split runs across features rather than tokens. Every token processed by a given layer uses the same feature indices, while the integer scale for the ordinary features can change from token to token.
This arrangement also gives the offline weight preparation a clear division of labor. A weight is paired with a particular input feature by its position in the matrix. Once the authors decide that the activation in a given feature should remain in floating point, they keep its associated weights in floating point as well. The GPU can then compute a smaller floating-point multiplication and a larger integer multiplication. The integer branch normally uses INT4, with INT8 used for selected layers in the same overall design.
Preparing and running a QUIK linear layer
The steps in order.
The paper uses the linear-layer convention familiar from PyTorch.
Y = XWᵀ + b
Here Y is the output matrix, X is the activation matrix entering the layer, W is the weight matrix, and ᵀ denotes transposition. The product XWᵀ matches each input feature to its corresponding weight. The vector b holds the bias, which is added to each output row. Rows of X correspond to tokens, and columns correspond to input features. In W, a row holds the weights used to produce an output feature, so an input-feature column of W can be identified by the same index as the corresponding column of X.
The feature split is possible because reordering the terms of a sum leaves the sum unchanged when the weights and activations are reordered together. If an activation column were moved on its own, the layer would multiply the wrong values. This is why the positions recovered in calibration do double duty. They determine which weight columns are prepared for the floating-point branch and which values the GPU gathers from each new activation matrix.
Finding the feature indices before inference
The authors run calibration inputs through the pretrained network and collect information about each linear layer’s inputs. They rank feature columns by the ℓ∞ norm, which measures the largest absolute value in the column. The point is to find positions whose extreme values would have a large influence on the range used for quantization. The ranking is layer-specific. Layers take different inputs, so a protected position in one layer gives no general reason to protect that position in another.
The study uses 512 random sentences from the Pile to obtain these indices. The authors generally consider up to 5% of the input features for higher-precision treatment, with the choice depending on size and architecture. For the main OPT comparisons, they use 256 features in each linear module. The same count covers different shares of the input at different widths. The count used in evaluation is therefore part of the setup, along with the precision of the remaining branch. The calibration corpus is The Pile.
A fixed list of feature positions still leaves room for the activation quantizer to adapt to each input. The list records which coordinates go into the floating-point branch. It contains no prediction of their exact values for a future token and imposes no fixed activation scale on the rest of its features. Once the difficult positions have been set aside, the GPU finds a range for the remaining numbers in the current token. This division lets QUIK move the search for recurring outliers into calibration while keeping the numerical encoding responsive at inference time.
Preparing the weights and directing the error
The authors rearrange the input-feature columns of W so the ones associated with large activations are last. They apply the matching ordering to the second-order information GPTQ uses. The paper describes this information through a Hessian, a matrix that represents how changes in the weights interact in the error criterion. Ordering it consistently means GPTQ still associates its compensation with the correct features. It then quantizes the columns on the integer path and stops before the ones reserved for floating point.
The order matters because GPTQ accounts for an error by changing columns it has yet to process. As the algorithm moves through a matrix, each quantization can therefore influence the later weights. Putting the higher-precision columns at the end gives the process a place to leave compensating changes without subjecting those columns to another round of coarse rounding. The weights stored for the floating-point branch can thus contain adjustments made on behalf of the integer branch. They are the prepared weights for the split computation.
Leaving those columns out of the integer representation can also improve the numerical range of the retained weights. The decision about which indices to reserve comes from activation magnitudes. Any particularly large weights in the matching columns also leave the low-precision fit, where they would otherwise consume part of the representable range. These are distinct reasons for the same layout. The activation branch protects the large input features, and the weight preparation can use the reserved columns to absorb compensation and avoid scaling its base weights around the values that were removed.
For the GPTQ stage, the authors use 128 randomly selected C4 samples of sequence length 2048. These inputs support the weight adjustment, whereas the Pile sentences determine the activation feature indices. The weights use symmetric scaling, so the reconstruction needs a weight scale without a separate weight offset. The authors find clipping thresholds for weights by a linear search using squared error. Clipping can restrict the range that the scale must cover, at the price of approximating the values that exceed the threshold. According to the authors, it took under two hours to compress a 70B network using just one A100. This preparation adapts an existing checkpoint for inference. C4 is associated with the Text-to-Text Transfer Transformer paper.
Raising the precision of a sensitive projection
Some layers still have difficult inputs after the feature split. In the LLaMA-2 feed-forward block, the up projection and the gate projection start with the same input and make different weighted combinations of it. The gate output passes through a SiLU activation. The next input is formed by multiplying corresponding entries of the up and activated gate outputs. The down projection acts on that product. The authors observe substantially larger input variance for the down projection than for other layers and connect it to the pointwise multiplication that precedes the projection.
A set of protected feature positions is useful when the difficulty is concentrated in particular columns. Large variation in a projection’s input can also make the values remaining after the split hard to represent in INT4. QUIK responds by using INT8 for both operands of the base multiplication in the LLaMA-2 down projections. In Falcon, it gives the FC2 layers higher precision. The authors also reserve more floating-point features for these layers in proportion to their input width. The resulting configurations remain mixed precision across layers as well as within a layer.
This second choice leaves the forward-pass structure intact. The implementation still gathers the protected features, finds the current activation range for the remaining features, packs the base operands in the chosen integer format, and reconstructs the result. The change gives a sensitive layer a finer representation. The paper evaluates the cost and quality of this choice separately from the decision to reserve outlier features.
Encoding the activations during a forward pass
With the weights prepared, the GPU receives a matrix of floating-point activations. The protected columns are gathered using their stored indices. The rest of each input row supplies a minimum and maximum, from which the implementation obtains a scale and an offset. This is asymmetric quantization. The offset lets the code range follow the values in the current row rather than requiring the original interval to be centered on zero. The implementation maps the resulting values into a signed integer representation for the multiplication.
The paper’s pseudocode expresses the transform before packing as follows.
outFP = (elem − zeroAct) / scaleAct − halfRange
Here elem is a floating-point activation from the base part of the current input row. The row’s offset is zeroAct, and scaleAct sets the spacing between representable values. The slash denotes division. The quantity halfRange is the shift used to place the numerical codes in the signed range. The intermediate outFP is the value passed to packing, which produces the integer activation used by the kernel. Each row gets its own scale and offset, both calculated after the protected features have been set aside.
The base branch multiplies the packed activation rows against the prepared weight matrix. QUIK uses NVIDIA’s CUTLASS library to issue the appropriate tensor-core multiplication. Tensor cores are the GPU units the paper uses for this matrix arithmetic. The products are accumulated in INT32, giving the sums a wider representation than the inputs. Meanwhile, the gathered floating-point activations are multiplied by the corresponding floating-point weights. Both branches produce contributions for the same output positions.
Rescaling the integer sums
The integer accumulator contains products of encoded numbers. To recover the output in the units used by the surrounding network, the implementation must restore the scale of the inputs and weights. It must also account for the constant added back when reconstructing each activation. The paper explains the offset correction with a dot product.
y = ∑ᵢ wᵢ(xᵢ + z) = ∑ᵢ wᵢxᵢ + z · ∑ᵢ wᵢ
Here y is one output value, i indexes the input features belonging to the sum, wᵢ is the weight for feature i, and xᵢ is its activation value before adding a common offset. The symbol z denotes that offset. The summation symbol ∑ᵢ means to add the terms over those features, and the centered dot denotes multiplication. Since z is common across the row being encoded, its total effect is its product with the sum of the corresponding weights. Those weights are already known during preparation, so their sum can be stored.
The dequantization pseudocode first applies the scales to the accumulator for a particular output.
x = elem · scaleAct · scaleWeight
Here x is the rescaled contribution before adding the offset correction. In this stage, elem denotes an INT32 accumulator for one output position. The activation scale scaleAct belongs to its input token, and scaleWeight is the weight scale associated with its output coordinate. The centered dots denote multiplication. The result is in the numerical units needed for addition to the floating-point contribution.
The next expression reconstructs the constant shift in the activation values.
shift = zeroAct + halfRange · scaleAct
Here shift is the constant added in reconstructing each activation represented by the signed codes. The value zeroAct is the token’s activation offset. The term halfRange · scaleAct converts the change of signed representation back to the original units, using the same halfRange and scaleAct as the encoding step. This constant is shared across the integer-path features in the current row.
The correction then follows the dot-product identity.
shift = shift · wReduced
On the right, shift is the constant from the previous expression. The quantity wReduced is the precomputed sum of the relevant weights in the units needed for dequantization. On the left, the pseudocode reuses shift for the resulting output correction. The multiplication accounts for how the common activation offset contributes after weighting and summing across the base features.
The last step of that routine adds the correction to the scaled accumulator.
outElem = x + shift
Here outElem is the reconstructed floating-point element for the integer branch, x is the scaled product sum, and shift is the correction after multiplication by wReduced. The layer adds this reconstructed contribution to the corresponding result from the floating-point branch. For a reader following a particular output position, the scales undo the spacing of the quantized representations, the correction restores the activation offset, and the separate branch supplies the terms for the protected features.
Keeping the auxiliary GPU work small
A straightforward implementation of the split would move the base and outlier values into separate buffers, then make further passes to find the activation ranges and encode the base values. QUIK combines these jobs. The quantization kernel scans the base features to find the row’s range, uses it to pack the required values, and places the outlier features in their own buffer. The merged implementation avoids a standalone copy of the unpacked base features. It also avoids making separate trips through the row for the minimum and maximum. These changes reduce both memory traffic and the number of kernel launches.
The shape of the work left after fusion still affects throughput. Giving each row a separate CUDA block can incur avoidable overhead, while assigning too many rows to a block can make it harder to keep the GPU occupied. The authors tune the number of rows handled together for different matrix dimensions. They report using values typically between 8 and 32 rows per block and improving quantization speed by up to 30% through this tuning. This is a change to how work is assigned on the GPU. The feature indices and precision choices can stay the same while the scheduling changes.
QUIK also changes when the accumulator is converted. CUTLASS collects the sums in registers, which are storage local to the threads doing the calculation. An implementation could write those sums to GPU memory, launch a separate dequantization operation, and read them back. The authors put the conversion in a custom epilogue, the part of the multiplication kernel that runs after accumulation and before the final result is written. The epilogue applies the scales and correction and accumulates the result into the floating-point branch. The saving comes from avoiding a round trip through GPU memory for the intermediate integer result and combining operations that would otherwise need separate execution.
Experiments and results
Measuring prediction quality after quantization
The authors study OPT, LLaMA-2 and Falcon using the Hugging Face implementations and data-loading setup. The main language-prediction metric is perplexity on WikiText2. Perplexity summarizes how much probability the system assigns to the tokens that actually occur in the evaluation text. Lower values indicate better prediction on that text. The perplexity comparisons ask how much prediction quality is lost when a pretrained checkpoint is converted to a different representation. The OPT and LLaMA-2 families are described in OPT and Llama 2.
For the main OPT comparison, QUIK quantizes the linear backbone to 4 bits and retains 256 floating-point outlier features per module. The baselines include the original FP16 checkpoint and reported 4-bit results for SmoothQuant, RPTQ and OmniQuant. The authors take those competing quantization numbers from the OmniQuant study, including its improved RPTQ results. This provides a comparison with prior joint weight and activation quantization. The comparison is between complete configurations with different choices about precision. OmniQuant
OPT-66B configurations by WikiText2 perplexity
QUIK gives the closest perplexity to the FP16 checkpoint among the quantized configurations.
The numbers
| System or setting | perplexity |
|---|---|
| FP16 | 9.34 |
| SmoothQuant | 2.2e5 |
| RPTQ | 11.16 |
| OmniQuant | 10.29 |
| QUIK-4B (this paper) | 9.66 |
OPT-66B makes the relationship between the accuracy result and the precision budget concrete. The paper reports that the comparison schemes keep 0.71% of linear-layer operations in FP16, comprising the output head. QUIK keeps 2.78% in FP16 after allowing for its higher-precision feature contributions. The improvement shows that protecting selected terms can pay off even when most of the arithmetic stays compressed. It also means the quality comparison does not fix the share of floating-point operations across schemes. On the smaller OPT checkpoints in the main comparison, QUIK also comes closest to the FP16 result among those joint methods. For OPT-30B, it records 10.08 on WikiText2 alongside 9.56 in FP16 and 10.60 for OmniQuant.
The OPT appendix broadens the language-prediction tests to Penn Treebank and C4 and adds GPTQ-4B as a weight-only comparator. This shows what happens when the integer encoding extends to the activations. For OPT-66B on C4, the baseline perplexity is 10.28, GPTQ-4B gives 10.56, and QUIK with 256 outliers gives 10.635. On Penn Treebank for the same checkpoint, the scores are 11.36, 11.63 and 11.793, respectively. GPTQ still uses FP16 activations. Its result provides context for the cost in prediction quality when the baseline operation changes to one that can use integer multiplication for both operands.
On LLaMA-2, QUIK’s WikiText2 perplexities are 5.84 for 7B, 5.28 for 13B and 3.74 for 70B. For the corresponding uncompressed versions, the values are 5.47, 4.88 and 3.20. The configuration includes 8-bit down projections. The paper’s main table provides prior joint quantization results for the smaller LLaMA-2 checkpoints. Against QUIK’s 5.84 for LLaMA-2 7B, it reports 14.26 for OmniQuant and 83.12 for SmoothQuant. For 13B, the same comparison gives 5.28, 12.30 and 35.88. For LLaMA2-70B, the direct comparison in that table is between the proposed configuration and FP16.
In Falcon, the matching precision exception is the FC2 layer. On WikiText2, the Falcon-7B pair is 6.59 for FP16 and 6.90 for QUIK. Falcon 40B records 5.23 and 5.46, and Falcon-180B records 3.30 and 3.61. The Falcon results extend the evidence for the hybrid approach to a separate architecture. They also illustrate how the method can be adapted by changing which projection receives the higher-precision base branch. The table does not provide competing 4-bit results for those Falcon checkpoints.
The study reports separate WikiText2 results for the 8-bit version. For example, on LLaMA2-70B, the FP16 checkpoint scores 3.20, SmoothQuant scores 3.48, and QUIK-8B scores 3.33. On Falcon 40B, all of the FP16, SmoothQuant and QUIK-8B configurations score 5.23, 5.26 and 5.23, respectively. This experiment helps explain the accuracy option available when the hardware and memory budget allow more bits for the base branch. The settings belong to that particular benchmark. The layer timing comparison, for instance, uses a QUIK-8B variant without outliers, whereas the 8-bit accuracy table uses 256.
Zero-shot evaluation across tasks
The authors use the LM Evaluation Harness with its default parameters to assess zero-shot performance. A zero-shot evaluation here measures performance on a task without fitting the compressed checkpoint specifically to that task. The aggregate averages PIQA, HellaSwag, ARC Easy and ARC Challenge along with a separate benchmark, WinoGrande.
The average score for OPT-30B is 64.45 in FP16 and 63.34 with QUIK-4B. OPT-66B goes from 66.16 to 65.10. Among the two LLaMA-2 checkpoints tested, the corresponding averages are 71.70 and 70.49 for LLaMA2-13B and 76.57 and 74.97 for LLaMA2-70B. These evaluations ask a different question from WikiText2. They measure whether the compressed system continues to select useful answers across several tasks. The lower QUIK scores show a cost to the compression, with the size of the effect varying by task and checkpoint.
Individual scores give that variation some context. For OPT-66B, WinoGrande remains at 68.82 in both precision settings, while ARC Easy gives 67.26 in FP16 and 64.73 with QUIK-4B. For LLaMA2-70B, HellaSwag gives 83.81 in FP16 and 81.57 with QUIK-4B. PIQA for the same checkpoint gives 82.75 and 81.56. An unchanged score on one task can therefore coexist with a decline on another. The per-task values and the averages describe related but different aspects of the quality preserved in the evaluation.
Isolating the speed of a layer
The performance experiments distinguish raw multiplication from the complete quantized layer. The raw benchmark times the multiplication offered by CUTLASS for different precisions. With large enough matrices, the paper observes a speedup of almost 4x for INT4 relative to FP16. Since the operands are already in the requisite format for that comparison, it estimates what the hardware can deliver for the multiplication itself. The full QUIK layer includes the cost of gathering features, preparing the activation codes, computing the floating-point branch and reconstructing the integer output.
For complete layers with shapes drawn from LLaMA, the paper reports speedups slightly above 4× for some larger layers and over 2× for smaller layers on an RTX 3090. The layer experiment uses 256 protected features in QUIK-4B and compares against FP16 and the outlier-free QUIK-8B variant. The larger matrices give the GPU more arithmetic over which to spread the auxiliary work. The smaller matrices devote a greater share of their time to operations around the multiplication. A matching set of layer experiments on RTX 3080 also shows cases above 4x, extending that result to another GPU evaluated by the authors.
Prefill throughput and peak memory
For the end-to-end benchmarks, the authors replace the linear layers in the Hugging Face PyTorch implementations with QUIK layers. The reported software setup is PyTorch/1.13, CUDA/11.8 and Huggingface Transformers/4.34. The authors use FlashAttention for every LLaMA-2 configuration in this comparison, including the FP16 baseline, so the change being timed comes from the linear-layer replacements. The workload is a prefill pass for a single batch of 2048 tokens. The implementation builds on Hugging Face Transformers.
OPT-66B prefill throughput for 2048 tokens on RTX 3090 GPUs
Replacing the FP16 linear layers with QUIK increases prompt-processing throughput.
The numbers
| System or setting | tokens/s |
|---|---|
| FP16 | 439 |
| QUIK-4B (this paper) | 1343 |
The OPT-66B benchmark demonstrates the distinction between layer speed and whole-network speed. A prefill pass still includes attention, softmax, normalization and other work. When the projections are accelerated, these operations account for a larger share of the pass. The paper reports its largest end-to-end prefill speedup for LLaMA2-70B, up to 3.4× over the corresponding FP16 execution. Its precision breakdown reports about 70% of linear-layer operations in INT4 and about 27% in INT8. The share in INT8 reflects the decision to preserve sensitive down projections, so the throughput result includes the cost of that accuracy measure.
In the peak memory benchmark, OPT-66B uses 162.1 GB in FP16, 81.2 GB with QUIK-8B and 45.1 GB with QUIK-4B. The corresponding values for LLaMA2-70B are 147.1 GB, 99.3 GB and 49.1 GB. Peak usage measures the memory required during the benchmark, which includes memory beyond the compressed weight representation. The authors trace the larger relative cost for LLaMA2-70B to the higher precision of the down projections, additional floating-point outliers and auxiliary buffers. The outlier portions amount to 2.71 GB for OPT-66B and 4.06 GB for LLaMA2-70B in these configurations.
The Falcon-180B comparison uses a different procedure because of capacity. The full-precision version exceeds 360GB at peak, according to the paper’s account of the failed attempt to run it on 8xRTX3090 GPUs. With QUIK-4B, the checkpoint fits on the server and the authors measure 542 tokens/second for inference. They estimate the relative speedup against FP16 using the time for a single Transformer block. The Falcon figure therefore supports two distinct observations. The compressed run demonstrates that the server can execute the full network. Its FP16 comparison estimates prefill acceleration from a smaller unit of execution. The unit being timed for that estimate is a Transformer block.
What the ablations show
The down projection needs a different precision budget
The cleanest test of the layer-level exception changes the down projection precision in LLaMA-2 and evaluates prediction on the same WikiText2 benchmark. The standard QUIK-4B configuration uses INT8 for the base weights and activations in the down projections. The alternative uses INT4 there. Large degradation in the alternative would mean that selecting outlier features alone is insufficient for this layer. The direct comparison shows that this is the case at each of the LLaMA-2 sizes tested.
LLaMA2-70B down-projection settings by WikiText2 perplexity
Using higher precision in the down projection preserves substantially more of the baseline prediction quality.
The numbers
| System or setting | perplexity |
|---|---|
| FP16 checkpoint | 3.20 |
| QUIK with 4-bit down projection | 6.91 |
| QUIK with 8-bit down projection (this paper) | 3.74 |
The effect appears in the smaller checkpoints as well. LLaMA-2 13B with the base down projection at 4 bits scores 7.78 in the main ablation, while the standard QUIK configuration scores 5.28. The authors’ layer analysis connects this sensitivity to the inputs to the down projection, which are the products of the up and gate paths. The ablation tests a practical consequence of that analysis. Preserving more detail in the relevant matrix multiplication improves the resulting predictions. The measurements support the extra precision for these particular projections.
The appendix further separates choices about the two operands and the choice to clip weights. For LLaMA2-70B, 4-bit weights and 16-bit activations in the down projection give 3.98, while 4-bit weights and 8-bit activations give 4.0. With both operands at 8 bits and no clipping, the result is 3.87. Adding weight clipping to that configuration gives 3.74. The 16-bit activation variant shows that keeping more input precision can recover much of the loss while the weights remain in a smaller format. The comparison between the two 8-bit variants shows an additional benefit from the weight preparation itself. It also puts that benefit in context. The improvement associated with clipping is smaller than the change seen when the down projection moves out of the fully 4-bit configuration.
How many protected features make a difference
The outlier-count experiments offer a separate test of the feature-level choice. On LLaMA2-70B, preserving 128 outliers in ordinary layers and 448 in the down projection gives WikiText2 perplexity of 3.80. Using 256 and 896 gives 3.74. The settings with 512 and 1792 give 3.67, and the ones with 1024 and 3584 give 3.62. All of these preserve a larger number of features in the down projection to reflect its wider input. The sequence shows a continuing quality benefit as more features remain in FP16, with a relatively small gain over the counts used for the headline configuration.
The OPT results show why the authors first establish that the split is necessary before trying to optimize its size. For OPT-66B on WikiText2, the joint low-precision setting with 0 protected features gives a perplexity of 12k. At 64 outliers the score is 9.851, and at 256 it is 9.662. That result identifies a large penalty for forcing the whole activation row into the narrow format. It also shows that protecting a modest subset already recovers much of the quality in this case. On OPT-1.3b, the corresponding comparison is 15k with 0 outliers, 26.259 with 64, and 17.358 with 256, while the FP16 baseline gives 14.63. The split helps there as well, and a fixed count leaves different amounts of residual error for different checkpoints.
Increasing the count has separate implications for runtime and memory. In the authors’ layer timings, changing between non-zero counts has little effect across the tested sizes. The zero-outlier case can run faster because it avoids the gather and the floating-point multiplication altogether. This suggests that the cost of having the second branch can matter more to those timings than the exact size of the branch within the tested range. Memory still increases when additional weights are kept in the wider representation. The timing result therefore informs the choice of count alongside the accuracy and memory measurements.
When an entire layer can dispense with outliers
One strategy for avoiding the cost of the second branch is to use a threshold on a layer’s activation scale. In the paper’s experiment, a layer gets no protected features if its maximum scale is below the threshold. The rule is decided per layer. Allowing a higher threshold brings more layers into consideration for outlier-free execution and exposes how much each checkpoint relies on the mixed-precision split.
For LLaMA2-70B, the normal QUIK configuration gives 3.74 on WikiText2. With threshold 2.0, 10 layers dispense with outliers and the score is 3.75. With threshold 3.0, 30 layers dispense with them and the score is 3.85. Threshold 4.0 leaves 58 layers without the outlier path and raises perplexity to 5.15. These settings show a range where the branch can be skipped in some layers at a modest cost and a subsequent deterioration as the rule becomes more permissive.
Falcon-180B tolerates more extensive removal in the threshold experiment. With threshold 8.0, 115 of its 480 linear layers use no outliers and the result is 3.73, compared with 3.61 for the normal QUIK setting. That threshold for LLaMA2-70B puts 219 layers on the outlier-free path and gives 5.92. The appendix also shows that Falcon checkpoints vary within the family. At threshold 4.0, Falcon 40B goes from 5.46 in the standard configuration to 10.56, with 8 layers losing their outlier branches. A calibration statistic can help identify where the exception might be unnecessary. The observed quality outcomes give the authors reason to treat its threshold as checkpoint-specific.
Which GPU operations consume the savings
The authors break down the implementation into a version with separate quantization and dequantization, a version with fused quantization, and a version that also incorporates dequantization into the multiplication epilogue. In the RTX 3090 experiment with input size 2048 and 256 outliers, fusion gives especially large gains for smaller matrices, where the auxiliary work had made up a greater share of elapsed time. The authors report throughput improvement of up to 40% from fused quantization and an additional 10% speedup from the dequantization epilogue. These measurements isolate the contributions of operations around the multiplication. The low-precision arithmetic is available in all of the variants.
A different comparison on LLaMA2-70B uses versions that run direct 4-bit or 8-bit kernels as idealized performance references. These variants omit the accuracy-preserving machinery. The standard QUIK-4B configuration stays within 15% of the ideal 4-bit performance in that benchmark, even though it includes the floating-point outlier branch and the higher-precision down projections. The idealized 4-bit version has poor accuracy. Its value as a comparator is to show how much execution speed is left on the table by an accurate implementation. The comparison measures the combined cost of the exceptions, so it does not isolate the cost of the outlier multiplication from the cost of executing some layers in INT8.
The same analysis shows why enlarging the speedup of the arithmetic has a limit in the full network. Once the accelerated projections account for less of the runtime, attention, softmax and layer normalization become more prominent. Eliminating an intermediate write or avoiding a feature gather can be valuable in a single layer. In the prefill pass, the same savings are measured alongside the time spent in operators whose precision QUIK has left alone. The paper’s breakdown helps explain why the measured throughput of the full implementation is below the ideal for an isolated large integer multiplication.
The sequence-length tests expose a related tradeoff by changing the number of input rows. The authors vary input length from 1 to 8k in a layer benchmark and a single-block benchmark. For short inputs, smaller layers and checkpoints can run slower with QUIK because preparing and dequantizing the inputs and outputs takes more time than the integer multiplication saves. At larger layer and checkpoint sizes, the paper finds up to 2x speedup even with a single input token in the tested setup. At the longest input sizes, the relative performance also falls as the multiplication saturates. These results help explain why a prefill benchmark at a single length and a sweep over block input sizes answer different performance questions.
Sparsity depends on which projections are pruned
Falcon-180B offers a further test because the authors combine QUIK with the hardware-supported 2:4 pattern, which requires half the weights in each group to be zero. The authors report that simply pruning a checkpoint after quantizing it incurs a large accuracy cost. They instead extend SparseGPT so sparsification and quantization can be performed jointly, with the weights associated with the protected features kept dense in FP16. They also vary which layer types keep their dense weights. This comparison uses SparseGPT.
The dense QUIK-4B Falcon-180B configuration reaches 3.61 perplexity on WikiText2 at 38% of the FP16 peak memory. The configuration that applies the sparse pattern with no layer types kept dense gives 6.62 at 25% of FP16 peak memory. Keeping the feed-forward blocks dense and pruning the attention projections gives 3.93 at 36%. Keeping the attention blocks dense instead gives 6.34 at 26%. The difference between those two partial settings shows that the placement of the sparse pattern matters. For this checkpoint and evaluation, protecting the feed-forward projections preserves much more of the quality, with a smaller saving in peak memory.
The dense FP16 configuration gives 3.30 perplexity on the same dataset, while the FP16 configuration with full application of the pruning pattern gives 6.13. This makes it possible to see substantial damage from the pruning itself, even before adding 4-bit quantization. The paper’s broader INT8 experiments likewise associate much of the quality loss with sparsity. The result that supports a combined method is the selective case on Falcon-180B. It demonstrates that some projections can use structured sparsity together with quantization while retaining much of the prediction quality. The authors’ evidence for that combination is a quality and memory comparison under the reported sparsity settings.
Limitations
Limits stated by the authors
QUIK compresses the linear layers in the experiments. Attention calculations beyond the projections, the softmax, and other parts of the forward pass remain in their existing formats. The phrase “end-to-end” describes throughput measured for the full prefill pass after its linear layers have been replaced. The authors present compression of the attention computation and the key–value cache as compatible directions. The cache stores information from earlier tokens for use in later attention computations. Its precision and memory costs are outside the evaluated changes. FlexGen is cited in the paper’s discussion of complementary compression for inference. FlexGen
The authors also identify mixture-of-experts architectures and speculative decoding as future settings for evaluation. The experiments concern the reported OPT, LLaMA-2 and Falcon implementations. They establish the precision choices and timings for those architectures and the reported workloads. For speculative decoding, the paper identifies a potential combination, with measurements of that combined execution left open. Speculative Decoding
Limits of the comparisons
The clearest throughput result concerns prefill at 2048 tokens. The variable-length appendix tests individual layers and one Transformer block, which shows how some hot operations behave with other input lengths. A full generation run repeatedly executes additional work and can be limited by different resources. The sequence-length measurements therefore leave the end-to-end speed of token-by-token decoding, across request batches and context lengths, unresolved. The paper’s motivation includes batched generation, but its full throughput benchmark gives the strongest evidence for the prompt-processing workload it actually times.
Hardware and implementation also matter. The measured path relies on CUTLASS integer multiplication, a custom kernel for preparing activations and an epilogue that avoids writing the intermediate integer accumulators to memory. The RTX 3080 experiments provide another layer-level test, while the main full-network timings use RTX 3090 GPUs. A different GPU or kernel implementation can change the point at which the integer calculation saves enough time to cover the overhead. The ideal raw multiplication results show what the tested hardware can provide under favorable conditions, with the full QUIK timings supplying the measurement that includes the extra operations.
The Falcon-180B comparison is constrained by the very memory bottleneck that the method addresses. The compressed checkpoint runs on the server, and the paper reports its measured throughput. The corresponding FP16 run does not fit. Timing a single block gives a basis for an estimate of relative execution speed, but leaves unmeasured any costs that appear only when the baseline runs as a complete network. For that checkpoint, feasibility on the tested machine is established more directly than a same-machine throughput ratio.
The accuracy comparisons measure a hybrid design against baselines with different precision policies. The OPT comparison accounts for different shares of FP16 operations. For LLaMA-2 and Falcon, the results include special treatment for particular layer types and a larger number of protected input features in those layers. A comparison holding every precision budget fixed would answer a narrower question about the accuracy of the quantization procedure itself. The reported evaluation answers how well the complete QUIK configuration works when the authors can assign wider formats where needed.
Similarly, the small number of evaluation setups limits what can be concluded about the calibration rule. The fixed outlier indices work for the tested checkpoints, calibration samples and quality benchmarks. The threshold tests show that sensitivity varies across checkpoints, even within a family. Those results leave open how often the indices or thresholds would need to be revisited for other data or architectures. Perplexity and the zero-shot tasks quantify the effects the authors measured. They offer no direct measurement of whether a particular generated answer is preserved or whether a specialized application responds well to the same compression.
Finally, the sparsity experiment establishes a favorable selective setting for Falcon-180B on WikiText2. Applying the pattern more widely incurs a substantial perplexity cost. The paper reports memory and quality for the alternatives, so it gives evidence about the achievable tradeoff on that checkpoint. A throughput result comparing the different sparsity placements at similar prediction quality remains open in that experiment.
What came after
ARCQuant cites QUIK and addresses the related problem of preserving numerical quality in a 4-bit representation. Its stated direction is to improve NVFP4 quantization with augmented residual channels. The connection is the treatment of channels when a compact numerical format makes some of their contributions difficult to preserve. QUIK reserves selected input features and their matching weight columns for a separate, higher-precision multiplication. ARCQuant’s title identifies a different format and points to augmentation with residual channels as its intervention. ARCQuant
The citation and title establish that continuity in subject, while leaving the implementation relationship open. In particular, they do not establish whether ARCQuant uses the same calibration criterion, changes the order of weight quantization, or implements its channel treatment with the same division of GPU work. The links between the papers can therefore be drawn at the level of the numerical problem and the channel-level intervention. A comparison of their accuracy, memory use or speed would require measurements from ARCQuant.
Cite
Cite as Saleh Ashkboos, Ilia Markov, Elias Frantar, Tingxuan Zhong, Xincheng Wang, Jie Ren, Torsten Hoefler and Dan Alistarh. 2024. QUIK: Towards End-to-end 4-Bit Inference on Generative Large Language Models. Proceedings of the 2024 Conference on Empirical Methods in Natural Language Processing.
@inproceedings{ashkboos2024quik,
title = {{QUIK: Towards End-to-end 4-Bit Inference on Generative Large Language Models}},
author = {Saleh Ashkboos, Ilia Markov, Elias Frantar, Tingxuan Zhong, Xincheng Wang, Jie Ren, Torsten Hoefler and Dan Alistarh},
booktitle = {Proceedings of the 2024 Conference on Empirical Methods in Natural Language Processing},
year = {2024},
doi = {10.18653/v1/2024.emnlp-main.197},
url = {https://doi.org/10.18653/v1/2024.emnlp-main.197}
}This page in Markdown https://md.research.elamur.ai/free/en/papers/ashkboos-2024-quik-end-end-4-bit/