Data-free quantization (DFQ) recovers the performance of quantized network (Q) without the original data, but generates the fake sample via a generator (G) by learning from full-precision network (P), which, however, is totally independent of Q, overlooking the adaptability of the knowledge from generated samples, i.e., informative or not to the learning process of Q, resulting into the overflow of generalization error. Building on this, several critical questions -- how to measure the sample adaptability to Q under varied bit-width scenarios? whether the largest adaptability is the best? how to generate the samples with adaptive adaptability to improve Q's generalization? To answer the above questions, in this paper, we propose an Adaptive Data-Free Quantization (AdaDFQ) method, which revisits DFQ from a zero-sum game perspective upon the sample adaptability between two players -- a generator and a quantized network. Following this viewpoint, we further define the disagreement and agreement samples to form two boundaries, where the margin is optimized to adaptively regulate the adaptability of generated samples to Q, so as to address the over-and-under fitting issues. Our AdaDFQ reveals: 1) the largest adaptability is NOT the best for sample generation to benefit Q's generalization; 2) the knowledge of the generated sample should not be informative to Q only, but also related to the category and distribution information of the training data for P. The theoretical and empirical analysis validate the advantages of AdaDFQ over the state-of-the-arts. Our code is available at https://github.com/hfutqian/AdaDFQ.
翻译:无数据量化(DFQ)无需原始数据即可恢复量化网络(Q)的性能,但通过从全精度网络(P)中学习,利用生成器(G)生成伪样本。然而,这一过程完全独立于Q,忽略了生成样本知识对Q学习过程的适应性(即样本信息对Q学习是否有益),导致泛化误差超限。基于此,本文提出若干关键问题:如何度量样本在不同位宽场景下对Q的适应性?最大适应性是否最优?如何生成具有自适应适应性的样本以提升Q的泛化能力?为回答上述问题,本文提出自适应无数据量化方法(AdaDFQ),从生成器与量化网络这两个博弈方之间样本适应性的零和博弈视角重新审视DFQ。基于这一视角,我们进一步定义分歧样本与一致样本以形成两个边界,通过优化边距自适应调控生成样本对Q的适应性,从而解决过拟合与欠拟合问题。我们的AdaDFQ揭示:1)样本生成中最大适应性并非最优选择以提升Q的泛化能力;2)生成样本的知识不仅应对Q具有信息性,还需关联P训练数据的类别与分布信息。理论与实证分析验证了AdaDFQ相较于现有最优方法的优势。我们的代码开源于https://github.com/hfutqian/AdaDFQ。