arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2204.09992cs.CV
收藏

任意位宽网络:一种联合分层Quantization和自适应推理方法

Arbitrary Bit-width Network: A Joint Layer-Wise Quantization and Adaptive Inference Approach

Tsinghua University(清华大学);Shanghai Jiao Tong University(上海交通大学)

Chen Tang, Haoyu Zhai, Kai Ouyang, Zhi Wang, Yifei Zhu, Wenwu Zhu

摘要:

传统的模型量化方法对不同的数据样本采用固定的量化方案,忽略了不同样本之间固有的“识别难度”差异。我们建议饲料不同的数据样本与不同的量化方案,以实现数据相关的动态推理,在细粒度的层次。然而,利用可变的逐层量化方案实现这种自适应推理是具有挑战性的,因为位宽和层的组合呈指数增长,使得在如此广阔的搜索空间中训练单个模型并将其用于实践是极其困难的。为了解决这个问题,我们提出了任意位宽网络(ABN),其中单个深度网络的位宽可以在运行时针对不同的数据样本以逐层粒度改变。具体来说,首先我们建立一个权重共享的逐层量化的“超级网络”,其中每一层都可以分配多个位宽,从而根据需要进行不同的量化。超级网络提供了相当大数量的位宽和层的组合,每个组合都可以在推理过程中使用,而无需重新训练或存储无数的模型。其次,基于训练良好的超网络,每一层的运行时位宽选择决策建模为马尔可夫决策过程(MDP),并相应地解决了自适应推理策略。实验表明,该超网络可以在不降低精度的情况下构建,并且可以动态调整各层的位宽分配以处理各种输入。在ImageNet分类上,我们实现了1.1%的top1精度提升,同时节省了36.2%的BitOps。

英文摘要:

Conventional model quantization methods use a fixed quantization scheme to different data samples, which ignores the inherent "recognition difficulty" differences between various samples. We propose to feed different data samples with varying quantization schemes to achieve a data-dependent dynamic inference, at a fine-grained layer level. However, enabling this adaptive inference with changeable layer-wise quantization schemes is challenging because the combination of bit-widths and layers is growing exponentially, making it extremely difficult to train a single model in such a vast searching space and use it in practice. To solve this problem, we present the Arbitrary Bit-width Network (ABN), where the bit-widths of a single deep network can change at runtime for different data samples, with a layer-wise granularity. Specifically, first we build a weight-shared layer-wise quantizable "super-network" in which each layer can be allocated with multiple bit-widths and thus quantized differently on demand. The super-network provides a considerably large number of combinations of bit-widths and layers, each of which can be used during inference without retraining or storing myriad models. Second, based on the well-trained super-network, each layer's runtime bit-width selection decision is modeled as a Markov Decision Process (MDP) and solved by an adaptive inference strategy accordingly. Experiments show that the super-network can be built without accuracy degradation, and the bit-widths allocation of each layer can be adjusted to deal with various inputs on the fly. On ImageNet classification, we achieve 1.1% top1 accuracy improvement while saving 36.2% BitOps.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑