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

面向硬件友好型训练后量化的数据生成

Data Generation for Hardware-Friendly Post-Training Quantization

Sony Semiconductor Israel(索尼半导体以色列公司)

Lior Dikstein, Ariel Lapid, Arnon Netzer, Hai Victor Habi

AI总结:

本文提出DGH方法,通过联合优化全部合成图像、模拟数据增强预处理和分布拉伸损失,解决硬件友好型零样本量化中合成数据与真实数据的分布差距,在分类与检测任务上准确率最高提升30%。

摘要:

使用合成数据的零样本量化(ZSQ)是在隐私与安全约束下进行训练后量化(PTQ)的关键方法。然而,现有数据生成方法往往难以有效生成适用于硬件友好型量化的数据,在这种量化中模型的所有层都被量化。我们分析了现有基于批归一化(BN)匹配的数据生成方法,并识别出合成数据与真实数据之间的若干差距:1)当前的生成算法并未同时优化整个合成数据集;2)训练过程中应用的数据增强常常被忽视;3)由于最后几层模型中没有BN,最终模型层中出现了分布偏移。这些差距对ZSQ性能产生了负面影响,尤其是在硬件友好型量化场景中。在这项工作中,我们提出了面向硬件友好型量化的数据生成(DGH),这是一种解决上述差距的新方法。DGH联合优化所有生成的图像,不受图像集大小或GPU内存限制的影响。为解决数据增强不匹配的问题,DGH包含一个预处理阶段,该阶段模拟增强过程,并通过引入自然图像先验来提升图像质量。最后,我们提出了一种新的分布拉伸损失,用于对齐真实数据与合成数据之间特征图分布的支撑集。该损失应用于模型输出,并可适配于各种任务。DGH在多个任务上展示了量化性能的显著提升,在分类和目标检测的硬件友好型ZSQ中准确率提升最高可达30%,其表现通常与使用真实数据相当。

英文摘要:

Zero-shot quantization (ZSQ) using synthetic data is a key approach for post-training quantization (PTQ) under privacy and security constraints. However, existing data generation methods often struggle to effectively generate data suitable for hardware-friendly quantization, where all model layers are quantized. We analyze existing data generation methods based on batch normalization (BN) matching and identify several gaps between synthetic and real data: 1) Current generation algorithms do not optimize the entire synthetic dataset simultaneously; 2) Data augmentations applied during training are often overlooked; and 3) A distribution shift occurs in the final model layers due to the absence of BN in those layers. These gaps negatively impact ZSQ performance, particularly in hardware-friendly quantization scenarios. In this work, we propose Data Generation for Hardware-friendly quantization (DGH), a novel method that addresses these gaps. DGH jointly optimizes all generated images, regardless of the image set size or GPU memory constraints. To address data augmentation mismatches, DGH includes a preprocessing stage that mimics the augmentation process and enhances image quality by incorporating natural image priors. Finally, we propose a new distribution-stretching loss that aligns the support of the feature map distribution between real and synthetic data. This loss is applied to the model's output and can be adapted to various tasks. DGH demonstrates significant improvements in quantization performance across multiple tasks, achieving up to a 30% increase in accuracy for hardware-friendly ZSQ in both classification and object detection, often performing on par with real data.

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

↑