Skip to main content
QUICK REVIEW

[论文解读] Accelerating Framework of Transformer by Hardware Design and Model Compression Co-Optimization

Panjie Qi, Edwin H.‐M. Sha|arXiv (Cornell University)|Oct 19, 2021
Advanced Data Compression Techniques被引用 4
一句话总结

本文提出了一种软硬件协同优化的框架,通过分层剪枝(HP)与FPGA专用硬件加速的联合设计,共同加速Transformer推理。该框架可根据延迟和精度约束自动选择最优设备,在实现高达98%稀疏度和高效内存使用的同时,相较于CPU实现最高37倍的加速,相较于GPU实现1.9倍的加速,采用自定义稀疏矩阵存储方式实现高效内存管理。

ABSTRACT

State-of-the-art Transformer-based models, with gigantic parameters, are difficult to be accommodated on resource constrained embedded devices. Moreover, with the development of technology, more and more embedded devices are available to run a Transformer model. For a Transformer model with different constraints (tight or loose), it can be deployed onto devices with different computing power. However, in previous work, designers did not choose the best device among multiple devices. Instead, they just used an existing device to deploy model, which was not necessarily the best fit and may lead to underutilization of resources. To address the deployment challenge of Transformer and the problem to select the best device, we propose an algorithm & hardware closed-loop acceleration framework. Given a dataset, a model, latency constraint LC and accuracy constraint AC, our framework can provide a best device satisfying both constraints. In order to generate a compressed model with high sparsity ratio, we propose a novel pruning technique, hierarchical pruning (HP). We optimize the sparse matrix storage format for HP matrix to further reduce memory usage for FPGA implementation. We design a accelerator that takes advantage of HP to solve the problem of concurrent random access. Experiments on Transformer and TinyBert model show that our framework can find different devices for various LC and AC, covering from low-end devices to high-end devices. Our HP can achieve higher sparsity ratio and is more flexible than other sparsity pattern. Our framework can achieve 37x, 1.9x, 1.7x speedup compared to CPU, GPU and FPGA, respectively.

研究动机与目标

  • 解决在资源受限的嵌入式设备上部署大规模Transformer模型、且性能需求各异的挑战。
  • 克服以往顺序化设计流程中模型压缩与硬件选择未协同优化的低效问题。
  • 根据用户指定的延迟和精度约束,实现从多样化硬件平台(如FPGA、移动设备)中自动选择最优设备。
  • 开发一种高稀疏度、灵活的剪枝方法(分层剪枝),支持高效的稀疏矩阵存储与硬件映射。
  • 设计一种硬件加速器,利用HP的稀疏模式减少内存访问开销,提升吞吐量。

提出的方法

  • 提出一种算法⇄硬件闭环框架,在用户定义的延迟(LC)和精度(AC)约束下,协同优化模型稀疏度与硬件部署。
  • 引入分层剪枝(HP),一种新型结构化剪枝技术,可在不同层实现高达98%的稀疏度,并支持灵活的块级稀疏模式。
  • 设计一种针对HP稀疏模式优化的自定义稀疏矩阵存储格式,以最小化FPGA上的内存占用。
  • 开发专用FPGA加速器,支持对稀疏权重的并发随机访问,提升内存带宽利用率。
  • 采用强化学习(RL)探索稀疏度比例与设备配置的搜索空间,受LC和AC约束引导。
  • 使用FLOPS和资源利用率作为指标,评估并比较CPU、GPU和FPGA平台的性能表现。

实验结果

研究问题

  • RQ1在特定延迟和精度约束下,部署Transformer模型的最佳硬件平台是什么?
  • RQ2如何协同设计模型压缩与硬件加速,以最大化推理速度与资源利用率?
  • RQ3与现有结构化剪枝方法相比,分层剪枝策略是否能在保持模型精度的同时实现更高的稀疏度?
  • RQ4所提出的稀疏存储格式如何降低FPGA上的内存占用并提升性能?
  • RQ5该框架能否自动从异构硬件平台集合(如ZCU102、Alveo U200)中为不同约束集选择最优设备?

主要发现

  • 该框架成功识别出在不同LC和AC约束下(从低端FPGA如ZCU102到高端设备如Alveo U200)的最优设备,实现了在多样化嵌入式平台上的可移植部署。
  • 分层剪枝实现了高达98%的稀疏度,显著超过现有方法(如VW)的90%上限,在高稀疏度下仍保持更好的精度保留能力。
  • FPGA加速器相较CPU实现37倍加速,相较GPU实现1.9倍加速,相较先前FPGA实现(FTRANS)实现1.7倍加速,展现出卓越的效率。
  • 在相同约束条件(如50ms、80%精度)下,通过模型压缩,框架可映射至更低端的FPGA(如ZCU102),实现跨应用场景的复用。
  • RL引导的搜索将解集中在目标约束附近(26ms、96%),并以资源利用率为决胜指标,选择最具成本效益的设备。
  • 当稀疏度为88%时,40%参数量的骨干网络模型达到96.4%的精度,优于60%和70%参数量的骨干网络,表明在高密度压缩下,初始稀疏度较低的模型更能保持精度。

更好的研究,从现在开始

从阅读论文到最终审阅,大幅缩短您的研究时间。

无需绑定信用卡

本解读由 AI 生成,并经人工编辑审核。