轻量化Transformer推理框架,让大模型在边缘设备高效运行。
EdgeFlex-Transformer: Transformer Inference for Edge Devices
- 通过激活统计与结构化剪枝压缩ViT模型,降低内存占用。
- 结合混合精度与感知量化,实现76%内存减少、6倍以上速度提升。
- 无需重训练,适合资源受限的边缘部署场景。
在边缘设备上部署大规模Transformer模型面临内存、算力和延迟的严格限制。本文提出一种轻量级多阶段优化流程,用于压缩与加速视觉Transformer(ViTs)在资源受限环境中的推理。方法结合激活分析、内存感知剪枝、选择性混合精度执行及激活感知量化(AWQ),在不需昂贵重训练或任务特定微调的情况下降低模型内存开销。以拥有6.32亿参数的ViT-Huge为基础,先通过前向钩子收集激活统计信息识别低重要性通道,再进行结构化剪枝以缩减MLP层;随后对部分组件进行FP16转换,并利用AWQ将剩余权重与激活量化至INT8,仅造成极小精度损失。在CIFAR-10上的实验表明,优化后模型峰值内存降低76%,延迟降低超过6倍,且准确率相比原始FP32基线保持或提升。该框架为边缘平台高效Transformer推理提供了实用路径,并为未来集成动态稀疏性与专家混合(MoE)架构以扩展性能开辟新方向。
原文摘要 · Abstract (English)
Deploying large-scale transformer models on edge devices presents significant challenges due to strict constraints on memory, compute, and latency. In this work, we propose a lightweight yet effective multi-stage optimization pipeline designed to compress and accelerate Vision Transformers (ViTs) for deployment in resource-constrained environments. Our methodology combines activation profiling, memory-aware pruning, selective mixed-precision execution, and activation-aware quantization (AWQ) to reduce the model's memory footprint without requiring costly retraining or task-specific fine-tuning. Starting from a ViT-Huge backbone with 632 million parameters, we first identify low-importance channels using activation statistics collected via forward hooks, followed by structured pruning to shrink the MLP layers under a target memory budget. We further apply FP16 conversion to selected components and leverage AWQ to quantize the remaining model weights and activations to INT8 with minimal accuracy degradation. Our experiments on CIFAR-10 demonstrate that the fully optimized model achieves a 76% reduction in peak memory usage and over 6x lower latency, while retaining or even improving accuracy compared to the original FP32 baseline. This framework offers a practical path toward efficient transformer inference on edge platforms, and opens future avenues for integrating dynamic sparsity and Mixture-of-Experts (MoE) architectures to further scale performance across diverse tasks.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。