A Theoretical Explanation of Activation Sparsity through Flat Minima and Adversarial Robustness
State Key Laboratory for Novel Software Technology(计算机软件新技术全国重点实验室);Nanjing University(南京大学);School of Computer Science and Engineering(计算机科学与工程学院);Southeast University(东南大学)
最近在MLP模块中观察到的激活稀疏性现象(Li et al., 2022b)为大幅降低计算成本提供了机会。尽管已有工作将其归因于训练动态,但现有的激活稀疏性理论解释仅限于浅层网络、少量训练步数和特殊训练方式,而激活稀疏性实际上出现在经过大量步数标准训练的深度模型中。为填补这些空白,我们提出梯度稀疏性的概念,将其作为激活稀疏性的一个来源,并基于此给出理论解释:稀疏性被视为相对于隐藏特征和参数实现对抗鲁棒性的必要步骤,而这种鲁棒性近似于学习良好模型的极小值平坦性。该理论适用于经过标准训练的带有LayerNorm的MLP,并进一步适用于Transformer或其他使用权重噪声训练的架构。在排除除稀疏性之外的其他平坦性来源后,我们发现权重矩阵的最大与最小非零奇异值之比很小的现象。在讨论这种谱集中现象的出现时,我们使用随机矩阵理论(RMT)作为分析随机梯度噪声的有力工具。我们进行了验证性实验来检验基于梯度稀疏性的解释。我们提出了两个即插即用模块,分别用于训练和微调以促进稀疏性。在ImageNet-1k和C4上的实验表明它们实现了50%的稀疏性提升,表明在训练和推理中进一步降低成本的潜力。
英文摘要:
A recent empirical observation (Li et al., 2022b) of activation sparsity in MLP blocks offers an opportunity to drastically reduce computation costs for free. Although having attributed it to training dynamics, existing theoretical explanations of activation sparsity are restricted to shallow networks, small training steps and special training, despite its emergence in deep models standardly trained for a large number of steps. To fill these gaps, we propose the notion of gradient sparsity as one source of activation sparsity and a theoretical explanation based on it that sees sparsity a necessary step to adversarial robustness w.r.t. hidden features and parameters, which is approximately the flatness of minima for well-learned models. The theory applies to standardly trained LayerNorm-ed MLPs, and further to Transformers or other architectures trained with weight noises. Eliminating other sources of flatness except for sparsity, we discover the phenomenon that the ratio between the largest and smallest non-zero singular values of weight matrices is small. When discussing the emergence of this spectral concentration, we use random matrix theory (RMT) as a powerful tool to analyze stochastic gradient noises. Validational experiments are conducted to verify our gradient-sparsity-based explanation. We propose two plug-and-play modules for both training and finetuning for sparsity. Experiments on ImageNet-1k and C4 demonstrate their 50% sparsity improvements, indicating further potential cost reduction in both training and inference.
Resting Neurons, Active Insights: Robustifying Activation Sparsity in LLMs via Spontaneity
IBM Thomas J. Watson Research Center, Yorktown Heights, USA(IBM 托马斯·J·沃森研究中心,美国Yorktown Heights);Halıcıoğlu Data Science Institute, UC San Diego, La Jolla, USA(哈利奇欧数据科学研究所,美国UC圣地亚哥La Jolla);Stony Brook University, Stony Brook, USA(史泰文·布鲁克大学,美国Stony Brook)
Overfitting is one of the fundamental challenges when training convolutional neural networks and is usually identified by a diverging training and test loss. The underlying dynamics of how the flow of activations induce overfitting is however poorly understood. In this study we introduce a perplexity-based sparsity definition to derive and visualise layer-wise activation measures. These novel explainable AI strategies reveal a surprising relationship between activation sparsity and overfitting, namely an increase in sparsity in the feature extraction layers shortly before the test loss starts …
Towards the Connection between Activation Sparsity and Flat Minima
State Key Laboratory for Novel Software Technology, Nanjing University(南京大学新型软件技术国家重点实验室);Institute of Brain-Machine Interface, Nanjing University(南京大学脑机接口研究院);School of Computer Science and Engineering, Southeast University(东南大学计算机科学与工程学院)
Activation sparsity improves compute efficiency and resource utilization in sparsity-aware neural network accelerators. As the predominant operation in DNNs is multiply-accumulate (MAC) of activations with weights to compute inner products, skipping operations where (at least) one of the two operands is zero can make inference more efficient in terms of latency and power. Spatial sparsification of activations is a popular topic in DNN literature and several methods have already been established to bias a DNN for it. On the other hand, temporal sparsity is an inherent feature of bio-inspired sp…
Duke University(杜克大学);Black Sesame Technologies(黑芝麻科技)
To improve the execution speed and efficiency of neural networks in embedded systems, it is crucial to decrease the model size and computational complexity. In addition to conventional compression techniques, e.g., weight pruning and quantization, removing unimportant activations can reduce the amount of data communication and the computation cost. Unlike weight parameters, the pattern of activations is directly related to input data and thereby changes dynamically. To regulate the dynamic activation sparsity (DAS), in this work, we propose a generic low-cost approach based on winners-take-all…
Motivating Next-Gen Accelerators with Flexible (N:M) Activation Sparsity via Benchmarking Lightweight Post-Training Sparsification Approaches
Applied AI(应用人工智能);Artificial Intelligence Research Institute(人工智能研究所);HSE University(俄罗斯高等经济大学);Sb AI Lab(Sb人工智能实验室);MWS AI(MWS人工智能);Yandex;Independent Researcher(独立研究者)
Dropout is commonly used to help reduce overfitting in deep neural networks. Sparsity is a potentially important property of neural networks, but is not explicitly controlled by Dropout-based regularization. In this work, we propose Sparseout a simple and efficient variant of Dropout that can be used to control the sparsity of the activations in a neural network. We theoretically prove that Sparseout is equivalent to an $L_q$ penalty on the features of a generalized linear model and that Dropout is a special case of Sparseout for neural networks. We empirically demonstrate that Sparseout is co…
Adversarial attacks have exposed serious vulnerabilities in Deep Neural Networks (DNNs) through their ability to force misclassifications through human-imperceptible perturbations to DNN inputs. We explore a new direction in the field of adversarial attacks by suggesting attacks that aim to degrade the computational efficiency of DNNs rather than their classification accuracy. Specifically, we propose and demonstrate sparsity attacks, which adversarial modify a DNN's inputs so as to reduce sparsity (or the presence of zero values) in its internal activation values. In resource-constrained syst…
Machine/deep-learning (ML/DL) based techniques are emerging as a driving force behind many cutting-edge technologies, achieving high accuracy on computer vision workloads such as image classification and object detection. However, training these models involving large parameters is both time-consuming and energy-hogging. In this regard, several prior works have advocated for sparsity to speed up the of DL training and more so, the inference phase. This work begins with the observation that during training, sparsity in the forward and backward passes are correlated. In that context, we investig…
Popular deep learning frameworks require users to fine-tune their memory usage so that the training data of a deep neural network (DNN) fits within the GPU physical memory. Prior work tries to address this restriction by virtualizing the memory usage of DNNs, enabling both CPU and GPU memory to be utilized for memory allocations. Despite its merits, virtualizing memory can incur significant performance overheads when the time needed to copy data back and forth from CPU memory is higher than the latency to perform the computations required for DNN forward and backward propagation. We introduce …
Overfitting is one of the most common problems when training deep neural networks on comparatively small datasets. Here, we demonstrate that neural network activation sparsity is a reliable indicator for overfitting which we utilize to propose novel targeted sparsity visualization and regularization strategies. Based on these strategies we are able to understand and counteract overfitting caused by activation sparsity and filter correlation in a targeted layer-by-layer manner. Our results demonstrate that targeted sparsity regularization can efficiently be used to regularize well-known dataset…
SURGEON: Memory-Adaptive Fully Test-Time Adaptation via Dynamic Activation Sparsity
Northwestern Polytechnical University(西北工业大学);Tsinghua University(清华大学);The Hong Kong University of Science and Technology(香港科技大学);Beijing Jiaotong University(北京交通大学);Harbin Engineering University(哈尔滨工程大学)
Vanderbilt University(范德堡大学);University of California, Davis(加州大学戴维斯分校);Johns Hopkins University(约翰斯·霍普金斯大学)
Continual/lifelong learning from a non-stationary input data stream is a cornerstone of intelligence. Despite their phenomenal performance in a wide variety of applications, deep neural networks are prone to forgetting their previously learned information upon learning new ones. This phenomenon is called "catastrophic forgetting" and is deeply rooted in the stability-plasticity dilemma. Overcoming catastrophic forgetting in deep neural networks has become an active field of research in recent years. In particular, gradient projection-based methods have recently shown exceptional performance at…
Concerns about interpretability, computational resources, and principled inductive priors have motivated efforts to engineer sparse neural models for NLP tasks. If sparsity is important for NLP, might well-trained neural models naturally become roughly sparse? Using the Taxi-Euclidean norm to measure sparsity, we find that frequent input words are associated with concentrated or sparse activations, while frequent target words are associated with dispersed activations but concentrated gradients. We find that gradients associated with function words are more concentrated than the gradients of co…
ReLU$^2$ Wins: Discovering Efficient Activation Functions for Sparse LLMs
Tsinghua University(清华大学);Shanghai Jiao Tong University(上海交通大学);Institute of Computing Technology, Chinese Academy of Sciences(中国科学院计算技术研究所);Renmin University of China(中国人民大学)
In principle, sparse neural networks should be significantly more efficient than traditional dense networks. Neurons in the brain exhibit two types of sparsity; they are sparsely interconnected and sparsely active. These two types of sparsity, called weight sparsity and activation sparsity, when combined, offer the potential to reduce the computational cost of neural networks by two orders of magnitude. Despite this potential, today's neural networks deliver only modest performance benefits using just weight sparsity, because traditional computing hardware cannot efficiently process sparse net…
Technion — Israel Institute of Technology(以色列理工学院);Ruppin Academic Center(鲁平学术中心)
Quantization is a technique used in deep neural networks (DNNs) to increase execution performance and hardware efficiency. Uniform post-training quantization (PTQ) methods are common, since they can be implemented efficiently in hardware and do not require extensive hardware resources or a training set. Mapping FP32 models to INT8 using uniform PTQ yields models with negligible accuracy degradation; however, reducing precision below 8 bits with PTQ is challenging, as accuracy degradation becomes noticeable, due to the increase in quantization noise. In this paper, we propose a sparsity-aware q…