Bigger&Faster: Two-stage Neural Architecture Search for Quantized Transformer Models

Yuji Chai, Luke Bailey, Yunho Jin, Matthew Karle, Glenn G. Ko · OpenReview

Abstract

While research in the field of transformer models has primarily focused on enhancing performance metrics such as accuracy and perplexity, practical applications in industry often necessitate a rigorous consideration of inference latency constraints. Addressing this challenge, we introduce SpeedLimit, a novel Neural Architecture Search (NAS) technique that optimizes accuracy whilst adhering to an upper-bound latency constraint. Our method incorporates 8-bit integer quantization in the search process to outperform the current state-of-the-art technique. Our results underline the feasibility and efficacy of seeking an optimal balance between performance and latency, providing new avenues for deploying state-of-the-art transformer models in latency-sensitive environments.

Introduction

Transformer models have revolutionized artificial intelligence, but their substantial computational requirements pose significant challenges for real-world deployment on edge devices or in real-time applications. To address these constraints, 8-bit integer (int8) quantization is frequently employed to reduce model size and accelerate inference. However, existing Neural Architecture Search (NAS) frameworks, such as AutoTinyBERT, typically optimize for 32-bit floating-point (float32) performance and apply quantization as a post-processing step.

This approach overlooks the "quantization gap"—the phenomenon where float32 latency does not perfectly correlate with int8 latency. SpeedLimit addresses this gap by making int8 awareness a core component of the search process, ensuring that the resulting architectures are truly optimized for the target hardware.

Methodology

SpeedLimit utilizes a two-stage NAS approach to efficiently explore the vast architecture search space:

  1. Supermodel Training: A single "Supermodel" is trained using knowledge distillation from a large BERT-base teacher. This Supermodel contains numerous subnetworks that share weights, allowing for the efficient evaluation of diverse architectures without the need for individual training.
  2. Evolutionary Search with Latency Prediction: To avoid the prohibitive cost of benchmarking every candidate, a Multi-Layer Perceptron (MLP) is trained as a Latency Predictor to estimate int8 latency. An evolutionary algorithm then navigates the search space, starting with architectures that meet the specified latency constraints and iteratively evolving the most accurate candidates through mutation and sampling.

The search space focuses on three critical hyperparameters: the number of encoder layers, the hidden dimension size, and the feed-forward network size.

Key Insights: The Quantization Gap

A primary motivation for SpeedLimit is the observation that architectures with identical float32 latencies can exhibit vastly different performance profiles after quantization. As illustrated in the figure below, there can be a 50% discrepancy in latency between two models that appear identical in the float32 domain.

Scatter plot showing the 50% latency discrepancy between float32 and int8 models.

This finding proves that traditional NAS, which ignores quantization during the search, is inherently suboptimal. By searching directly in the int8 space, SpeedLimit identifies architectures that leverage the specific strengths of quantized hardware, often finding "wider" or "deeper" models that outperform their float32-optimized counterparts.

Results

SpeedLimit was evaluated on the General Language Understanding Evaluation (GLUE) benchmark, comparing its performance against the state-of-the-art AutoTinyBERT.

Accuracy vs. Latency performance of SpeedLimit compared to AutoTinyBERT across GLUE tasks.

The experimental results demonstrate:

  • Superior Accuracy: SpeedLimit consistently outperformed AutoTinyBERT across all tested latency targets, notably achieving a 2.7% accuracy gain on the MNLI task.
  • Significant Compression: Models discovered by SpeedLimit were, on average, 3.4x smaller in memory footprint than those found by AutoTinyBERT.
  • Pareto Frontier Advancement: SpeedLimit effectively pushed the Pareto frontier further than previous methods, offering a better trade-off between speed and accuracy.

Conclusion and Future Work

SpeedLimit establishes a new benchmark for efficient Transformer deployment by integrating quantization directly into the NAS loop. While the current study focused on homogeneous architectures and dynamic quantization on Intel Ice Lake CPUs with AVX-VNNI extensions, the methodology is broadly applicable. Future research will explore heterogeneous designs, advanced quantization-aware training (QAT) techniques, and broader architecture families such as GPT and T5.

Summary updated

Abstract

While research in the field of transformer models has primarily focused on enhancing performance metrics such as accuracy and perplexity, practical applications in industry often necessitate a rigorous consideration of inference latency constraints. Addressing this challenge, we introduce SpeedLimit, a novel Neural Architecture Search (NAS) technique that optimizes accuracy whilst adhering to an upper-bound latency constraint. Our method incorporates 8-bit integer quantization in the search process to outperform the current state-of-the-art technique. Our results underline the feasibility and efficacy of seeking an optimal balance between performance and latency, providing new avenues for deploying state-of-the-art transformer models in latency-sensitive environments.
BibTeX
@inproceedings{chai2023bigger,
  author = {Yuji Chai and Luke Bailey and Yunho Jin and Matthew Karle and Glenn G. Ko},
  title = {{Bigger\&Faster: Two-stage Neural Architecture Search for Quantized Transformer Models}},
  booktitle = {ES-FoMO @ ICML},
  year = {2023},
  url = {https://openreview.net/forum?id=RZnYYl9s7o},
}
Figure