arXivDaily arXiv每日学术速递 周一至周五更新
北美退伍军人节(Veterans Day),12 日无更新
arXiv 2404.01650cs.LG
收藏

仅使用前向传播的测试时模型自适应

Test-Time Model Adaptation with Only Forward Passes

College of Computing and Data Science, Nanyang Technological University(南洋理工大学计算与数据科学学院);Joint NTU-WeBank Research Centre on Fintech(南洋理工大学-微众银行金融科技联合研究中心);Joint NTU-UBC Research Centre of Excellence in Active Living for the Elderly (LILY)(南洋理工大学-不列颠哥伦比亚大学老年人积极生活联合卓越研究中心);Tencent AI Lab(腾讯AI实验室)

Shuaicheng Niu, Chunyan Miao, Guohao Chen, Pengcheng Wu, Peilin Zhao

AI总结:

针对资源受限设备上量化模型难以进行反向传播的问题,提出测试时前向优化自适应方法(FOA),通过无导数进化策略学习提示词并设计激活偏移方案,在无反向传播下优于梯度方法且大幅降低内存。

摘要:

测试时自适应已被证明能有效将给定的已训练模型适应到具有潜在分布偏移的未见测试样本上。然而,在现实场景中,模型通常部署在资源受限的设备上(例如 FPGA),并且为了加速经常被量化且硬编码为不可修改的参数。有鉴于此,现有方法通常是不可行的,因为它们严重依赖计算密集型的反向传播来更新模型,而这可能得不到支持。为了解决这一问题,我们提出了一种测试时前向优化自适应(FOA)方法。在 FOA 中,我们寻求通过无导数协方差矩阵自适应进化策略,仅学习一个新添加的提示词(作为模型输入)。为了使该策略在我们的在线无监督设置下稳定工作,我们通过测量测试-训练统计量差异和模型预测熵,设计了一种新颖的适应度函数。此外,我们设计了一种激活偏移方案,直接针对偏移的测试样本调整模型激活,使其与源训练域对齐,从而进一步增强自适应性能。在无需使用任何反向传播且不改变模型权重的情况下,运行于量化 8-bit ViT 上的 FOA 优于在全精度 32-bit ViT 上基于梯度的 TENT,同时在 ImageNet-C 上实现了高达 24 倍的内存减少。

英文摘要:

Test-time adaptation has proven effective in adapting a given trained model to unseen test samples with potential distribution shifts. However, in real-world scenarios, models are usually deployed on resource-limited devices, e.g., FPGAs, and are often quantized and hard-coded with non-modifiable parameters for acceleration. In light of this, existing methods are often infeasible since they heavily depend on computation-intensive backpropagation for model updating that may be not supported. To address this, we propose a test-time Forward-Optimization Adaptation (FOA) method. In FOA, we seek to solely learn a newly added prompt (as model's input) via a derivative-free covariance matrix adaptation evolution strategy. To make this strategy work stably under our online unsupervised setting, we devise a novel fitness function by measuring test-training statistic discrepancy and model prediction entropy. Moreover, we design an activation shifting scheme that directly tunes the model activations for shifted test samples, making them align with the source training domain, thereby further enhancing adaptation performance. Without using any backpropagation and altering model weights, FOA runs on quantized 8-bit ViT outperforms gradient-based TENT on full-precision 32-bit ViT, while achieving an up to 24-fold memory reduction on ImageNet-C.

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

↑