压缩深度网络:再见SVD,你好稳健的低秩近似
Compressed Deep Networks: Goodbye SVD, Hello Robust Low-Rank Approximation
摘要:
用于压缩神经网络的常见技术是计算对应于全连接层(或嵌入层)的矩阵$A\in\mathbb{R}^{n\times d}$的$k$ -秩$\ell_2$近似$A_{k,2}$。这里,$d$是该层中神经元的数量,$n$是下一层中的数量,$A_{k,2}$可以存储在$O((n+d)k)$存储器中而不是$O(nd)$中。该$\ell_2$近似最小化秩为$k$的每个矩阵$A_{k,2}\in\mathbb{R}^{n\times d}$中的矩阵$A - A_{k,2}$中的每个条目的$p=2$的幂的总和。虽然它可以通过SVD有效地计算,但已知$\ell_2$近似对离群值(“遥远”行)非常敏感。因此,机器学习使用例如Lasso回归、$\ell_1$ -正则化和使用$\ell_1$ -范数的$\ell_1$ -SVM。本文建议用$\ell_p$代替$k$ -秩$\ell_2$近似,对$p\in [1,2]$ .然后,我们提供实用和可证明的近似算法来计算它的任何$p\geq1$,基于现代技术的计算几何。在GLUE基准上压缩BERT、DistilBERT、XLNet和RoBERTa的大量实验结果证实了这一理论优势。例如,我们的方法实现了RoBERTa的嵌入层的$28\%$压缩,与使用现有的$\ell_2$近似的$11\%$下降相比,在GLUE中的所有任务的平均准确度中只有$0.63\%$添加剂下降(没有微调)。开放的代码提供复制和扩展我们的结果。
英文摘要:
A common technique for compressing a neural network is to compute the $k$-rank $\ell_2$ approximation $A_{k,2}$ of the matrix $A\in\mathbb{R}^{n\times d}$ that corresponds to a fully connected layer (or embedding layer). Here, $d$ is the number of the neurons in the layer, $n$ is the number in the next one, and $A_{k,2}$ can be stored in $O((n+d)k)$ memory instead of $O(nd)$. This $\ell_2$-approximation minimizes the sum over every entry to the power of $p=2$ in the matrix $A - A_{k,2}$, among every matrix $A_{k,2}\in\mathbb{R}^{n\times d}$ whose rank is $k$. While it can be computed efficiently via SVD, the $\ell_2$-approximation is known to be very sensitive to outliers ("far-away" rows). Hence, machine learning uses e.g. Lasso Regression, $\ell_1$-regularization, and $\ell_1$-SVM that use the $\ell_1$-norm. This paper suggests to replace the $k$-rank $\ell_2$ approximation by $\ell_p$, for $p\in [1,2]$. We then provide practical and provable approximation algorithms to compute it for any $p\geq1$, based on modern techniques in computational geometry. Extensive experimental results on the GLUE benchmark for compressing BERT, DistilBERT, XLNet, and RoBERTa confirm this theoretical advantage. For example, our approach achieves $28\%$ compression of RoBERTa's embedding layer with only $0.63\%$ additive drop in the accuracy (without fine-tuning) in average over all tasks in GLUE, compared to $11\%$ drop using the existing $\ell_2$-approximation. Open code is provided for reproducing and extending our results.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。