Skip to main content
QUICK REVIEW

[Paper Review] RPTQ: Reorder-based Post-training Quantization for Large Language Models

Zhihang Yuan, Lin Niu|arXiv (Cornell University)|Apr 3, 2023
Topic ModelingComputer Science20 citations
TL;DR

RPTQ introduces a reorder-based post-training quantization for activations in LLMs by clustering channels with similar value ranges and quantizing within clusters, fused with layer norm and restructured weights to avoid explicit reordering, enabling 3-bit activation quantization and substantial memory reduction.

ABSTRACT

Large-scale language models (LLMs) have demonstrated impressive performance, but their deployment presents challenges due to their significant memory usage. This issue can be alleviated through quantization. In this paper, we identify that the challenge in quantizing activations in LLMs arises from varying ranges across channels, rather than solely the presence of outliers. To address this challenge, we introduce a quantization method called RPTQ, which utilizes a reorder-based approach. By rearranging the channels and quantizing them in clusters, RPTQ effectively mitigates the impact of range differences between channels. To minimize the overhead of the reorder operation, we fuse it into the layer norm operation and weights in linear layers. In our experiments, RPTQ achieved a significant breakthrough by utilizing 3-bit activation in LLMs for the first time, resulting in a substantial reduction in memory usage. For instance, quantizing OPT-175b can lead to a memory consumption reduction of up to 80%.

Motivation & Objective

  • Motivate and address memory bottlenecks in deploying large language models (LLMs).
  • Investigate activation quantization challenges caused by per-channel range differences rather than just outliers.
  • Propose a reorder-based PTQ method (RPTQ) to reduce quantization errors while maintaining practicality.

Proposed method

  • Cluster activation channels by their per-channel min/max values using K-means into g clusters.
  • Reorder channels so that channels in the same cluster are grouped together.
  • Quantize activations within each cluster using cluster-specific quantization parameters (scale s and zero point z).
  • Fuse the reorder operation into layer norm to avoid explicit data movement during inference.
  • Reorder weights of linear layers to process reordered activations directly in batched matrix multiplications.
  • Ensure channel alignment to avoid misalignment in Q/K/Joint attention computations by sharing reorder indices across Q and K and avoiding reordering of certain outputs (e.g., residual paths).

Experimental results

Research questions

  • RQ1Can activation quantization for LLMs be significantly improved by clustering channels with similar value ranges rather than using per-tensor or per-channel uniform quantization?
  • RQ2How much memory reduction and accuracy loss occur when applying RPTQ to large OPT models, including alternatives that quantize key/value caches?
  • RQ3Does fusing reorder into layer norm and adapting weight matrices enable practical inference at low bit-widths (e.g., 3–4 bits) for activations?
  • RQ4What is the impact of the number of clusters on quantization error and model performance across model sizes?

Key findings

  • RPTQ enables 3-bit activation quantization for LLMs, achieving substantial memory reductions.
  • For OPT-175b, memory usage can be reduced by up to around 80% with acceptable perplexity impact under certain configurations (e.g., KV-focused quantization).
  • Quantizing key/value caches (KV) with low-bit activations (e.g., W4A4KV, W3A3KV) maintains closer-to-FP16 performance compared to full activation quantization.
  • Clustering channels into a small number of clusters reduces quantization error and improves accuracy, with ablation showing gains as cluster count increases.
  • Activation quantization memory savings are particularly pronounced for large sequence lengths and batch sizes, mitigating cache memory pressure in long-text tasks.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.