Squat: Quant Small Language Models on the Edge

Xuan Shen, Peiyan Dong, Zhenglun Kong, Yifan Gong, Changdi Yang, Zhaoyang Han, Yanyue Xie, Lei Lu, Cheng Lyu, Chao Wu, Yanzhi Wang, Pu Zhao

Abstract

A growing trend has emerged in designing high-quality Small Language Models (SLMs) with a few million parameters, driven by concerns over cloud costs, privacy, and latency. While Quantization-Aware Training (QAT) can improve efficiency, existing methods often rely on fine-grained quantization incompatible with the Single Instruction Multiple Data (SIMD) instructions of commodity mobile hardware. We propose Squat, an effective QAT framework featuring entropy-guided and distribution-aligned distillation to mitigate attention distortion, sub-8-bit token adaptive quantization, and a SIMD-based Multi-Kernel Mixed-Precision (MKMP) multiplier. Our experiments demonstrate up to a 2.37x on-device speedup compared to FP16 counterparts with minimal accuracy loss.

Introduction

As Large Language Models (LLMs) continue to scale, a parallel movement is bringing intelligence to the edge via Small Language Models (SLMs). These models, typically under 1 billion parameters, are ideal for deployment on smartphones and IoT devices. However, achieving high performance on such hardware requires aggressive quantization. Standard methods often fail because they either sacrifice too much accuracy at low bit-widths or utilize complex scaling factors that mobile CPUs, which rely on SIMD instructions, cannot process efficiently.

The Squat Framework

The Squat framework addresses these challenges by co-designing quantization algorithms with hardware-level execution logic. It focuses on three primary pillars: specialized distillation, adaptive bit-widths, and a custom software kernel for mixed-precision math.

The Squat framework architecture, illustrating the flow from input tokens through quantized layers and the dual-loss distillation process.

1. Entropy-Guided & Distribution-Aligned Distillation

Quantizing the self-attention mechanism, specifically the Query (Q) and Key (K) matrices, is a major source of error. Squat employs a specialized distillation process that aligns the attention maps of the quantized model with those of a high-precision teacher model. By maximizing the information entropy of quantized values, the framework ensures that the model retains as much representational power as possible despite the reduced precision.

2. Token Adaptive Quantization

Not all tokens in a sequence contribute equally to the final output. Squat identifies "important" tokens—often those that the initial token of a sequence attends to most—and preserves them at 8-bit precision. Less critical tokens are compressed to 4-bit, significantly reducing the memory footprint without impacting overall linguistic understanding.

3. MKMP Multiplier

To translate these algorithmic gains into real-world speed, the authors developed the Multi-Kernel Mixed-Precision (MKMP) multiplier. This kernel leverages SIMD instructions to handle 4-bit and 8-bit operations simultaneously, allowing standard mobile processors to execute mixed-precision matrix multiplications at high speeds.

Key Insights: The Q & K Bottleneck

A critical finding of this research is the sensitivity of the attention mechanism. While MLP layers are relatively robust to quantization, the Query and Key matrices are highly sensitive.

Accuracy sensitivity analysis showing that quantizing Query (Q) and Key (K) matrices causes the most significant performance drop compared to other components.

As shown in the analysis, quantizing Q and K leads to a much sharper drop in accuracy than quantizing the MLP layers. This insight justifies Squat's focus on distribution-aligned distillation specifically for the attention mechanism.

Experimental Results

The framework was tested on LLaMA-58M and GPT2-97M models across benchmarks like BLiMP and GLUE.

  • Efficiency: On a OnePlus 11 (Snapdragon 8 Gen 2), Squat achieved a 2.37x speedup over FP16 models.
  • Accuracy: In a W4A8 (4-bit weight, 8-bit activation) setup, Squat maintained an average accuracy of 69.4% on BLiMP, nearly matching the 69.7% baseline of the uncompressed FP16 model.
  • Comparison: Squat consistently outperformed other QAT methods like LLM-QAT and PACT, particularly in aggressive 4-bit settings where other methods often suffer from accuracy collapse.

Conclusion

Squat demonstrates that SLMs can be both highly efficient and accurate on edge devices through hardware-algorithm co-design. By identifying the specific bottlenecks in the attention mechanism and providing a deployable mixed-precision multiplier, Squat paves the way for more sophisticated AI applications to run locally on mobile hardware. Future work will explore scaling these techniques to larger models in the 1B–7B parameter range.

Summary updated

BibTeX
@inproceedings{shen2024squat,
  author = {Xuan Shen and Peiyan Dong and Zhenglun Kong and Yifan Gong and Changdi Yang and Zhaoyang Han and Yanyue Xie and Lei Lu and Cheng Lyu and Chao Wu and Yanzhi Wang and Pu Zhao},
  title = {{Squat: Quant Small Language Models on the Edge}},
  booktitle = {ICCAD},
  year = {2024},
}
Figure