Squat: Quant Small Language Models on the Edge

Fuente: arXiv
Enregistré dans:
Détails bibliographiques
Auteurs principaux: Shen, Xuan, Dong, Peiyan, Kong, Zhenglun, Gong, Yifan, Yang, Changdi, Han, Zhaoyang, Xie, Yanyue, Lu, Lei, Lyu, Cheng, Wu, Chao, Wang, Yanzhi, Zhao, Pu
Format: Preprint
Publié: 2024
Sujets:
Accès en ligne:
Tags: Ajouter un tag
Pas de tags, Soyez le premier à ajouter un tag!
_version_ 1866911032566349824
author Shen, Xuan
Dong, Peiyan
Kong, Zhenglun
Gong, Yifan
Yang, Changdi
Han, Zhaoyang
Xie, Yanyue
Lu, Lei
Lyu, Cheng
Wu, Chao
Wang, Yanzhi
Zhao, Pu
author_facet Shen, Xuan
Dong, Peiyan
Kong, Zhenglun
Gong, Yifan
Yang, Changdi
Han, Zhaoyang
Xie, Yanyue
Lu, Lei
Lyu, Cheng
Wu, Chao
Wang, Yanzhi
Zhao, Pu
contents A growing trend has emerged in designing high-quality Small Language Models (SLMs) with a few million parameters. This trend is driven by the increasing concerns over cloud costs, privacy, and latency. Considering that full parameter training is feasible for SLMs on mobile devices, Quantization-Aware Training (QAT) is employed to improve efficiency by reducing computational overhead and memory footprint. However, previous QAT works adopt fine-grained quantization methods to compress models with billions of parameters on GPUs, incompatible with current commodity hardware, such as mobile and edge devices, which relies on Single Instruction Multiple Data (SIMD) instructions. Thus, the generalization of these methods to SLMs on mobile devices is limited. In this paper, we propose Squat method, an effective QAT framework with deployable quantization for SLMs on mobile devices. Specifically, we propose entropy-guided and distribution-aligned distillation to mitigate the distortion of attention information from quantization. Besides, we employ sub-8-bit token adaptive quantization, assigning varying bit widths to different tokens based on their importance. Furthermore, we develop a SIMD-based Multi-Kernel Mixed-Precision (MKMP) multiplier to support sub-8-bit mixed-precision MAC on mobile devices. Our extensive experiments verify the substantial improvements of our method compared to other QAT methods across various datasets. Furthermore, we achieve an on-device speedup of up to 2.37x compared with its FP16 counterparts, signaling a great advancement. Code: https://github.com/shawnricecake/squant
format Preprint
id arxiv_https___arxiv_org_abs_2402_10787
institution arXiv
publishDate 2024
record_format arxiv
spellingShingle Squat: Quant Small Language Models on the Edge
Shen, Xuan
Dong, Peiyan
Kong, Zhenglun
Gong, Yifan
Yang, Changdi
Han, Zhaoyang
Xie, Yanyue
Lu, Lei
Lyu, Cheng
Wu, Chao
Wang, Yanzhi
Zhao, Pu
Machine Learning
Artificial Intelligence
Computation and Language
A growing trend has emerged in designing high-quality Small Language Models (SLMs) with a few million parameters. This trend is driven by the increasing concerns over cloud costs, privacy, and latency. Considering that full parameter training is feasible for SLMs on mobile devices, Quantization-Aware Training (QAT) is employed to improve efficiency by reducing computational overhead and memory footprint. However, previous QAT works adopt fine-grained quantization methods to compress models with billions of parameters on GPUs, incompatible with current commodity hardware, such as mobile and edge devices, which relies on Single Instruction Multiple Data (SIMD) instructions. Thus, the generalization of these methods to SLMs on mobile devices is limited. In this paper, we propose Squat method, an effective QAT framework with deployable quantization for SLMs on mobile devices. Specifically, we propose entropy-guided and distribution-aligned distillation to mitigate the distortion of attention information from quantization. Besides, we employ sub-8-bit token adaptive quantization, assigning varying bit widths to different tokens based on their importance. Furthermore, we develop a SIMD-based Multi-Kernel Mixed-Precision (MKMP) multiplier to support sub-8-bit mixed-precision MAC on mobile devices. Our extensive experiments verify the substantial improvements of our method compared to other QAT methods across various datasets. Furthermore, we achieve an on-device speedup of up to 2.37x compared with its FP16 counterparts, signaling a great advancement. Code: https://github.com/shawnricecake/squant
title Squat: Quant Small Language Models on the Edge
topic Machine Learning
Artificial Intelligence
Computation and Language
url https://arxiv.org/abs/2402.10787