Year: 2019

Abstract:
Attention operators have been applied on both 1-D data like texts and higher-order data such as images and videos. Use of attention operators on high-order data requires flattening of the spatial or spatial-temporal dimensions into a vector, which is assumed to follow a multivariate normal distribution. This not only incurs excessive requirements on computational resources, but also fails to preserve structures in data. In this work, we propose to avoid flattening by developing Kronecker attention operators (KAOs) that operate on high-order tensor data directly. KAOs lead to dramatic reductions in computational resources. Moreover, we analyze KAOs theoretically from a probabilistic perspective and point out that KAOs assume the data follow matrix-variate normal distributions. Experimental results show that KAOs reduce the amount of required computational resources by a factor of hundreds, with larger factors for higher-dimensional and higher-order data. Results also show that networks with KAOs outperform models without attention, while achieving competitive performance as those with original attention operators.

heading: 1 INTRODUCTION
text: Deep learning networks with attention operators have demonstrated great capabilities of solving challenging problems in various tasks such as computer vision (Xu et al., 2015; Lu et al., 2016), natural language processing (Bahdanau et al., 2015; Vaswani et al., 2017), and network embedding (Veličković et al., 2017). Attention operators are capable of capturing long-range relationships and brings significant performance boosts (Li et al., 2018; Malinowski et al., 2018). The application scenarios of attention operators range from 1-D data like texts to high-order and high-dimensional data such as images and videos. However, attention operators suffer from the excessive usage of computational resources when applied on high-order or high-dimensional data. The memory and computational cost increases dramatically with the increase of input orders and dimensions. This prevents attention operators from being applied in broader scenarios. To address this limitation, some studies focus on reducing spatial sizes of inputs such as down-sampling input data (Wang et al., 2018) or attending selected part of data (Huang et al., 2018). However, such kind of methods inevitably results in information and performance loss.
In this work, we propose novel and efficient attention operators, known as Kronecker attention operators (KAOs), for high-order data, which avoid flattening and operate on high-order data directly. Experimental results show that KAOs are as effective as original attention operators, while dramatically reducing the amount of required computational resources. In particular, we employ KAOs to design a family of efficient modules, leading to our compact deep models known as Kronecker attention networks (KANets). KANets significantly outperform prior compact models on the image classification task, with fewer parameters and less computational cost. We also investigate the above problem from a probabilistic perspective. Specifically, regular attention operators flatten the data and assume the flattened data follow multivariate normal distributions. This assumption not only results in high computational cost and memory usage, but also fails to preserve the spatial or spatial-temporal structures of data. Our KAOs, instead, use matrix-variate normal distributions to model the data, where the Kronecker covariance structure is able to capture relationships among spatial or spatial-temporal dimensions.

heading: 2 BACKGROUND AND RELATED WORK
text: In this section, we describe the attention and related non-local operators.

heading: 2.1 ATTENTION OPERATOR
text: The inputs to an attention operator include a query matrix Q = [q1,q2,⋯,qm] ∈ Rd×m, a key matrix K = [k1,k2,⋯,kn] ∈ Rd×n, and a value matrix V = [v1,v2,⋯,vn] ∈ Rp×n. The attention operation computes the responses of a query vector qi by attending it to all key vectors in K and uses the results to take a weighted sum over value vectors in V . The layer-wise forward-propagation operation of an attention operator can be expressed asO = V softmax(KTQ). Matrix multiplication betweenKT andQ results in a coefficient matrixE =KTQ, in which each element eij is calculated by the inner product between kTi and qj . This coefficient matrix E computes similarity scores between every query vector qi, and every key vector kj and is normalized by a column-wise softmax operator to make every column sum to 1. The outputO ∈ Rp×m is obtained by multiplying V with the normalized E. In self-attention operators (Vaswani et al., 2017), we have Q = K = V . The computational cost in attention operator is O(m × n × (d + p)). The memory required for storing the intermediate coefficient matrix E is O(mn). If d = p and m = n, the time and space complexities become O(m2 × d) and O(m2), respectively. There are several other ways to compute E fromQ andK, including Gaussian function, dot product, concatenation, and embedded Gaussian function. It has been shown that dot product is the simplest but most effective one (Wang et al., 2018). Therefore, we focus on the dot product similarity function in this work. In practice, we can first perform separate linear transformations on each input matrix, resulting in the following attention operator: O =W V V Softmax((WKK)TWQQ), whereW V ∈ Rp ′×p,WK ∈ Rd ′×d, andWQ ∈ Rd
′×d. For notational simplicity, we omit linear transformations in the following discussion.
2.2 NON-LOCAL OPERATOR
Non-local operators (Wang et al., 2018) apply self-attention operators on higher-order data such as images and videos. Taking 2-D data as an example, the input to the non-local operator is a third-order tensor X ∈ Rh×w×c, where h, w, and c denote the height, width, and number of channels, respectively. The tensor is first converted into a matrixX(3) ∈ Rc×hw by unfolding along mode-3 (Kolda & Bader, 2009), as illus-
trated in Figure 1. Then we perform the attention operation by setting Q = K = V = X(3). The output of the attention operator is converted back to a third-order tensor as the final output. One practical challenge of the non-local operator is its excessive usage of computational resources. If h = w, the computational cost of a 2-D non-local operator is O(h4×c). The memory used to store the coefficient matrix incurs O(h4) space complexity. The time and space complexities are prohibitively high for high-dimensional and high-order data.

heading: 3 KRONECKER ATTENTION NETWORKS
text: In this section, we describe our proposed Kronecker attention operators, which are efficient and effective attention operators on high-order data.

heading: 3.1 KRONECKER ATTENTION OPERATORS
text: We describe the Kronecker attention operators (KAO) in the context of self-attention on 2-D data, but they can be easily generalized to generic attentions. In this case, the input to the `th layer is a third-order tensor X(`) ∈ Rh×w×c. We propose to use horizontal and lateral average matrices to represent original mode-3 unfolding without much information loss. The horizontal average matrix H and the lateral average matrix L are computed as
H = 1 h
h
∑ i=1 X
(`) i∶∶ ∈ R w×c, L = 1 w
w
∑ j=1 X
(`) ∶j∶ ∈ R h×c, (1)
where X(`)i∶∶ and X (`) ∶j∶ are the horizontal and lateral slices (Kolda & Bader, 2009) of tensor X (`), respectively. We then form a matrix C by juxtaposingHT and LT as C = [HT ,LT ] ∈ Rc×(h+w).
Based on the horizontal and lateral average matrices contained in C, we propose two Kronecker attention operators (KAOs), i.e., KAOKV and KAOQKV . In KAOKV as shown in Figure 2 (b), we useX(`)(3) as the query matrix and C as the key and value matrices as
O = attn(X(`)(3),C,C) ∈ R c×hw. (2)
Note that the number of columns in O depends on the number of query vectors. Thus, we obtain hw output vectors from the attention operation. Similar to the regular attention operator,O is folded back to a third-order tensor Y(`) ∈ Rh×w×c by considering the column vectors inO as mode-3 fibers of Y(`). KAOKV uses Y
(`) as the output of layer `. If h = w, the time and space complexities of KAOKV are O(hw × c × (h + w)) = O(h3 × c) and O(hw × (h + w)) = O(h3), respectively. Compared to the original local operator on 2-D data, KAOKV reduces time and space complexities by a factor of h.
In order to reduce the time and space complexities further, we propose another operator known as KAOQKV . In KAOQKV as shown in Figure 2(c), we use C as the query, key, and value matrices as
[H̃ h̄ , L̃ ® w
] =O = attn(C,C,C) ∈ Rc×(h+w). (3)
The final output tensor Y(`) ∈ Rh×w×c is obtained as Y (`)∶∶i = H̃ T i∶ | L̃Ti∶ , where H̃i∶ and L̃i∶ are the ith rows of the corresponding matrices. That is, the ith frontal slice of Y(`) is obtained by computing the outer sum of the ith rows of H̃ and L̃. If h = w, the time and space complexities of KAOQKV are O((h +w) × c × (h +w)) = O(h2 × c) and O((h +w) × (h +w)) = O(h2), respectively. Thus, the time and space complexities have been reduced by a factor of h2 as compared to the original local operator, and by a factor of h as compared to KAOKV . Note that we do not consider linear transformations in our description, but they can be applied to all three input matrices in KAOKV and KAOQKV as shown in Figure 2.

heading: 3.2 KRONECKER ATTENTION MODULES AND NETWORKS
text: Attention models have not been used in compact deep models to date, primarily due to their high computational cost. In this section, we design a family of efficient Kronecker attention modules based on KAOs as illustrated in Figure 3 in the appendix.
BaseModule: MobileNetV2 (Sandler et al., 2018) is mainly composed of bottleneck blocks with inverted residuals. Each bottleneck block consists of three convolutional layers; those are, 1 × 1 convolutional layer, 3 × 3 depth-wise convolutional layer, and another 1 × 1 convolutional layer. Suppose the expansion factor is r and stride is s. Given input X(`) ∈ Rh×w×c for the `th block, the first 1× 1 convolutional layer outputs rc feature maps X̃ (`) ∈ Rh×w×rc. The depth-wise convolutional layer uses a stride of s and outputs rc feature maps X̄ (`) ∈ Rhs ×ws ×rc. The last 1 × 1 convolutional layer produces d feature maps Y(`) ∈ Rhs ×ws ×d. When s = 1 and c = d, a skip connection is added between X(`) and Y(`).
BaseSkipModule: To facilitate feature reuse and gradient back-propagation in deep models, we improve the BaseModule by adding a skip connection. Given input X(`), we use an expansion factor of r − 1 for the first 1× 1 convolutional layer, instead of r as in BaseModule. We then concatenate the output with the original input, resulting in X̃ (`) ∈ Rh×w×rc. The other parts of the BaseSkipModule are the same as those of the BaseModule. Compared to the BaseModule, the BaseSkipModule reduces the number of parameters by c × c and computational cost by h ×w × c. It achieves better feature reuse and gradient back-propagation.
AttnModule: We propose to add an attention operator into the BaseModule to enable the capture of global features. We reduce the expansion factor of the BaseModule by 1 and add a new parallel path with an attention operator that outputs c feature maps. Concretely, after the depth-wise convolutional layer, the original path outputs X̄ (`) a ∈ R h s × w s ×(r−1)c. The attention operator, optionally followed by an average pooling of stride s if s > 1, produces X̄(`)b ∈ R h s × w s ×c. Concatenating them gives X̄ (`) ∈ Rhs ×ws ×rc. The final 1 × 1 convolutional layer remains the same. Within the attention operator, we only apply the linear transformation on the value matrix V to limit the number of parameters and required computational resources. In this module, the original path acts as locality-based feature extractors, while the new path with an attention operator computes global features. This enables the module to incorporate both local and global information. Note that we can use any attention operator in this module, including the regular attention operator and our KAOs.
AttnSkipModule: We propose to add an additional skip connection in the AttnModule. This skip connection can always be added unless s > 1. The AttnSkipModule has the same amount of parameters and computational cost as the AttnModule.
In the following sections, we perform some theoretical analysis on the proposed methods.

heading: 3.3 FROM MULTIVARIATE TO MATRIX-VARIATE DISTRIBUTIONS
text: We analyze our solutions for attention operators on high-order data from a probabilistic perspective. We take the non-local operator on 2-D data as an example. Formally, consider a self-attention operator withQ =K = V =X(3), whereX(3) ∈ Rc×hw is the mode-3 unfolding of a third-order input tensor X ∈ Rh×w×c, as illustrated in Figure 1. The ith row of X(3) corresponds to vec(X∶∶i)T ∈ Rhw, whereX∶∶i ∈ Rh×w denotes the ith frontal slice of X (Kolda & Bader, 2009), and vec(⋅) denotes the vectorization of a matrix by concatenating its columns (Gupta & Nagar, 2018).
The frontal slicesX∶∶1,X∶∶2, . . . ,X∶∶c ∈ Rh×w of X are usually known as c feature maps. In this view, the mode-3 unfolding is equivalent to the vectorization of each feature map independently. It is worth noting that, in addition to vec(⋅), any other operation that transforms each feature map into a vector leads to the same output from the non-local operator, as long as a corresponding reverse operation is performed to fold the output into a tensor. This fact indicates that unfolding of X in local operators ignores the structural information within each feature map, i.e., the relationships among rows and columns. In addition, such unfolding results in excessive requirements on computational resources, as explained in Section 2.2.
In the following discussions, we focus on one feature mapX ∈ {X∶∶1,X∶∶2, . . . ,X∶∶c} by assuming feature maps are conditionally independent of each other, given feature maps of previous layers. This assumption is shared by many deep learning techniques that process each feature map independently, including the unfolding mentioned above, batch normalization, instance normalization (Ulyanov et al., 2016), and pooling operations (LeCun et al., 1998). To view the problem above from a probabilistic perspective (Ioffe & Szegedy, 2015; Ulyanov et al., 2016), the unfolding yields the assumption that vec(X) follows a multivariate normal distribution as vec(X) ∼ Nhw(µ,Ω), where µ ∈ Rhw and Ω ∈ Rhw×hw. Apparently, the multivariate normal distribution does not explicitly model relationships among rows and columns in X . To address this limitation, we propose to model X using a matrix-variate normal distribution (Gupta & Nagar, 2018), defined as below.
Definition 1. A random matrix A ∈ Rm×n is said to follow a matrix-variate normal distribution MNm×n(M ,Ω ⊗ Ψ) with mean matrix M ∈ Rm×n and covariance matrix Ω ⊗ Ψ, where Ω ∈ Rm×m ≻ 0 and Ψ ∈ Rn×n ≻ 0, if vec(AT ) ∼ Nmn(vec(MT ),Ω ⊗ Ψ). Here, ⊗ denotes the Kronecker product (Van Loan, 2000; Graham, 2018).
The matrix-variate normal distribution has separate covariance matrices for rows and columns. They interact through the Kronecker product to produce the covariance matrix for the original distribution. Specifically, for two elements Xij and Xi′j′ from different rows and columns inX , the relationship between Xij and Xi′j′ is modeled by the interactions between the ith and i′th rows and the jth and j′th columns. Therefore, the matrix-variate normal distribution can incorporate relationships among rows and columns.

heading: 3.4 THE PROPOSED MEAN AND COVARIANCE STRUCTURES
text: In machine learning, (Kalaitzis et al., 2013) proposed to use the Kronecker sum to form covariance matrices, instead of the Kronecker product. Based on the above observations and studies, we propose to model X as X ∼MN h×w(M ,Ω ⊕Ψ), where M ∈ Rh×w, Ω ∈ Rh×h ≻ 0, Ψ ∈ Rw×w ≻ 0, ⊕ denotes the Kronecker sum (Kalaitzis et al., 2013), defined as Ω⊕Ψ = Ω⊗ I[w] + I[h] ⊗Ψ, and I[n] denotes an n × n identity matrix. Covariance matrices following the Kronecker sum structure can still capture the relationships among rows and columns (Kalaitzis et al., 2013). It also follows from (Allen & Tibshirani, 2010; Wang et al., 2017) that constraining the mean matrixM allows a more direct modeling of the structural information within a feature map. Following these studies, we assumeX follows a variant of the matrix-variate normal distribution as
X ∼MN h×w(M ,Ω⊕Ψ), (4)
where the mean matrix M ∈ Rh×w is restricted to be the outer sum of two vectors, defined as M = µ| υ = µ1T[w] + 1[h]υ T , where µ ∈ Rh, υ ∈ Rw, and 1[n] denotes an all-one vector of size n.
Under this model, the marginal distributions of rows and columns are both multivariate normal (Allen & Tibshirani, 2010). Specifically, the ith row vectorXi∶ ∈ R1×w followsXTi∶ ∼ Nw(µi+υT ,Ωii+Ψ), and the jth column vectorX∶j ∈ Rh×1 followsX∶j ∼ Nh(υi+µ,Ψii+Ω). In the following discussion, we assume that Ω and Ψ are diagonal, implying that any pair of variables in X are uncorrelated. Note that, although the variables in X are independent, their covariance matrix still follows the Kronecker covariance structure, thus capturing the relationships among rows and columns (Allen & Tibshirani, 2010; Wang et al., 2017).

heading: 3.5 MAIN TECHNICAL RESULTS
text: LetXrow = (∑hi=1XTi∶ )/h ∈ Rw andXcol = (∑ w j=1X∶j)/w ∈ Rh be the average of row and column vectors, respectively. Under the assumption above, Xrow and Xcol follow multivariate normal distributions as
Xrow ∼ Nw(µ + υ, Ω +Ψ h ) (5) Xcol ∼ Nh(υ +µ, Ψ +Ω w ), (6)
where µ = (∑hi=1 µi)/h, Ω = (∑ h i=1 Ωii)/h, υ = (∑ w j=1 υj)/w, and Ψ = (∑ w j=1 Ψjj)/w. Our main technical results can be summarized in the following theorem.
Theorem 1. Given the multivariate normal distributions in Eqs. (5) and (6) with diagonal Ω and Ψ, if (a) r1, r2, . . . , rh are independent and identically distributed (i.i.d.) random vectors that follow the distribution in Eq. (5), (b) c1,c2, . . . ,cw are i.i.d. random vectors that follow the distribution in Eq. (6), (c) r1, r2, . . . , rh and c1,c2, . . . ,cw are independent, we have X̃ ∼MN h×w (M̃ , Ψ+Ωw ⊕ Ω+Ψ h
), where X̃ = [r1, r2, . . . , rh]T + [c1,c2, . . . ,cw], M̃ = (µ|υ)+ (µ+υ). In particular, if h = w, the covariance matrix satisfies tr (Ψ+Ω
w ⊕ Ω+Ψ h ) = 2 h tr (Ω⊕Ψ), where tr(⋅) denotes matrix trace.
The proof of Theorem 1 can be found in the appendix. With certain normalization on X , we can have µ + υ = 0, resulting in M̃ = µ| υ. As the trace of a covariance matrix measures the total variation, Theorem 1 implies that X̃ follows a matrix-variate normal distribution with the same mean and scaled covariance as the distribution ofX in Eq. (4). We build KAOs based on this conclusion and the process to obtain X̃ fromX .

heading: 4 EXPERIMENTAL STUDIES
text: In this section, we evaluate our methods and networks on image classification and segmentation tasks.

heading: 4.1 COMPARISON OF COMPUTATIONAL EFFICIENCY
text: According to the theoretical analysis in Section 3.1, our KAOs have efficiency advantages over regular attention operators on high-order data, especially for inputs with large spatial sizes. We conduct simulated experiments to evaluate the theoretical results. To reduce the influence of external factors, we build networks composed of a single attention operator, and apply the TensorFlow profile tool (Abadi et al., 2016) to report the multiply-adds (MAdd), required memory, and time consumed on 2-D simulated data. For the simulated input data, we set the batch size and number of channels both to 8, and test three spatial sizes; those are, 56 × 56, 28 × 28, and 14 × 14. The number of output channels is also set to 8. Table 1 summarizes the comparison results. On simulated data of spatial sizes 56 × 56, our KAOKV and KAOQKV achieve 31.1 and 305.8 times speedup, and 96.18% and 99.73% memory saving compared to the regular attention operator, respectively. Our proposed KAOs show significant improvements over regular attention operators in terms of computational resources, which is consistent with the theoretical analysis. In particular, the amount of improvement increases as the spatial sizes increase. These results show that the proposed KAOs are efficient attention operators on high-dimensional and high-order data.

heading: 4.2 RESULTS ON IMAGE CLASSIFICATION
text: With the high efficiency of our KAOs, we have proposed several efficient Kronecker attention modules for compact CNNs in Section 3.2. To further show the effectiveness of KAOs and the modules, we build novel compact CNNs known as Kronecker attention networks (KANets). Following the practices in (Wang et al., 2018), we apply these modules on inputs of spatial sizes 28×28, 14×14, and 7×7. The detailed network architecture is described in Table 6 in the appendix due to space constraint. We compare KANets with other CNNs on the ImageNet ILSVRC 2012 image classification dataset, which serves as the benchmark for compact CNNs (Howard et al., 2017; Zhang et al., 2017; Gao et al., 2018; Sandler et al., 2018). Details of the experimental setups are provided in the appendix.
The comparison results between our KANets and other CNNs in terms of the top-1 accuracy, number of parameters, and MAdd are reported in Table 2. SqueezeNet (Iandola et al., 2016) has the least number of parameters, but uses the most MAdd and does not obtain competitive performance as compared to other compact CNNs. Among compact CNNs, MobileNetV2 (Sandler et al., 2018) is the previous state-of-theart model, which achieves the best trade-off between effectiveness and efficiency. According to the results, our KANets significantly outperform MobileNetV2 with 0.03 million fewer parameters. Specifically, our KANetKV and KANetQKV outperform MobileNetV2 by margins of 0.9% and 0.8%, respectively. More importantly, our KANets has the least computational cost. These results demonstrate the effectiveness and efficiency of our proposed KAOs.
The performance of KANets indicates that our proposed methods are promising, since we only make small modifications to the architecture of MobileNetV2 to include KAOs. Compared to modules with the regular convolutional layers only, our proposed modules with KAOs achieve better performance without using excessive computational resources. Thus, our methods can be used widely for designing compact deep models. Next, we show that our proposed KAOs are as effective as regular attention operators.

heading: 4.3 COMPARISON WITH REGULAR ATTENTION OPERATORS
text: We perform experiments to compare our proposed KAOs with regular attention operators. We consider the regular attention operator and the one with a pooling operation in (Wang et al., 2018). For the attention operator with pooling operation, the spatial sizes of the key matrixK and value matrix V are reduced by 2×2 pooling operations to save computation cost. To compare these operators in fair settings, we replace all KAOs in KANets with regular attention operators and regular attention operators with a pooling operation, denoted as AttnNet and AttnNet+Pool, respectively.
The comparison results are summarized in Table 3. Note that all these models have the same number of parameters. We can see that KANetKV and KANetQKV achieve similar performance as AttnNet and AttnNet+Pool with dramatic reductions of computational cost. The results indicate that our proposed KAOs are as effective as regular attention operators while being much more efficient. In addition, our KAOs are better than regular attention operators that uses a pooling operation to increase efficiency in (Wang et al., 2018).
4.4 ABLATION STUDIES
Table 4: Comparisons among KANetKV , MobileNetV2, MobileNetV2 with KAOsKV (MobileNetV2+KAOKV ), and KANet without KAO (KANet w/o KAO) in terms of the top-1 accuracy on the ImageNet validation set, the number of total parameters, and MAdd.
Model Top-1 Params MAdd MobileNetV2 0.720 3.47m 300m MobileNetV2+KAO 0.726 3.46m 298m KANetKV 0.729 3.44m 288m KANet w/o KAO 0.721 3.46m 298m
To show how our KAOs benefit entire networks in different settings, we conduct ablation studies on MobileNetV2 and KANetKV . For MobileNetV2, we replace BaseModules with AttnModules as described in Section 3.2, resulting in a new model denoted as MobileNetV2+KAO. On the contrary, based on KANetKV , we replace all AttnSkipModules by BaseModules. The resulting model is denoted as KANet w/o KAO.
Table 4 reports the comparison results. By employing KAOKV , MobileNetV2+KAO gains a performance boost of 0.6% with fewer parameters than MobileNetV2. On the other hand, KANetKV outperforms KANet w/o KAO by a margin of 0.8%, while KANet w/o KAO has more parameters than KANetKV . KANetKV achieves the best performance while costing the least computational resources. The results indicate that our proposed KAOs are effective and efficient, which is independent of specific network architectures.

heading: 4.5 RESULTS ON IMAGE SEGMENTATION
text: In order to show the efficiency and effectiveness of our KAOs in broader application scenarios, we perform additional experiments on image segmentation tasks using the PASCAL 2012 dataset (Everingham et al., 2010). With the extra annotations provided by (Hariharan et al., 2011), the augmented dataset contains 10,582 training, 1,449 validation, and 1,456 testing images. Each pixel of the images is labeled by one of 21 classes with 20 foreground classes and 1 background class. We re-implement the DeepLabV2 model (Chen et al., 2018) as our baseline. Following (Wang & Ji, 2018), using attention operators as the output layer, instead
of atrous spatial pyramid pooling (ASPP), results in a significant performance improvement. In our experiments, we replace ASPP with the regular attention operator and our proposed KAOs, respectively, and compare the results. For all attention operators, linear transformations are applied onQ,K, and V . Details of the experimental setups are provided in the appendix.
Table 5 shows the evaluation results in terms of pixel accuracy and mean intersection over union (IoU) on the PASCAL VOC 2012 validation set. Clearly, models with attention operators outperform the baseline model with ASPP. Compared with the regular attention operator, KAOs result in similar pixel-wise accuracy but slightly lower mean IoU. From the pixel-wise accuracy, results indicate that KAOs are as effective as the regular attention operator. The decrease in mean IoU may be caused by the strong structural assumption behind KAOs. Overall, the experimental results demonstrate the efficiency and effectiveness of our KAOs in broader application scenarios.

heading: 5 CONCLUSIONS
text: In this work, we propose Kronecker attention operators to address the practical challenge of applying attention operators on high-order data. We investigate the problem from a probabilistic perspective and use matrix-variate normal distributions with Kronecker covariance structure. Experimental results show that our KAOs reduce the amount of required computational resources by a factor of hundreds, with larger factors for higher-dimensional and higher-order data. We employ KAOs to design a family of efficient modules, leading to our KANets. KANets significantly outperform the previous state-of-the-art compact models on image classification tasks, with fewer parameters and less computational cost.

heading: 1 EXPERIMENTAL SETUP FOR IMAGE CLASSIFICATION
text: As a common practice on this dataset, we use the same data augmentation scheme in (He et al., 2016). Specifically, during training, we scale each image to 256 × 256 and then randomly crop a 224 × 224 patch. During inference, the center-cropped patches are used. We train our KANets using the same settings as MobileNetV2 (Sandler et al., 2018) with minor changes. We perform batch normalization (Ioffe & Szegedy, 2015) on the coefficient matrices in KAOs to stabilize the training. All trainable parameters are initialized with the Xavier initialization (Glorot & Bengio, 2010). We use the standard stochastic gradient descent optimizer with a momentum of 0.9 (Sutskever et al., 2013) to train models for 150 epochs in total. The initial learning rate is 0.1 and it decays by 0.1 at the 80th, 105th, and 120th epoch. Dropout (Srivastava et al., 2014) with a keep rate of 0.8 is applied after the global average pooling layer. We use 8 TITAN Xp GPUs and a batch size of 512 for training, which takes about 1.5 days. Since labels of the test dataset are not available, we train our networks on training dataset and report accuracies on the validation dataset.

heading: 2 EXPERIMENTAL SETUP FOR IMAGE SEGMENTATION
text: We train all the models with randomly cropped patches of size 321 × 321 and a batch size of 8. Data augmentation by randomly scaling the inputs for training is employed. We adopt the “poly” learning rate policy (Liu et al., 2015) with power = 0.9, and set the initial learning rate to 0.00025. Following DeepLabV2, we use the ResNet-101 model pre-trained on ImageNet (Deng et al., 2009) and MS-COCO (Lin et al., 2014) for initialization. The models are then trained for 25,000 iterations with a momentum of 0.9 and a weight decay of 0.0005. We perform no post-processing such as conditional random fields and do not use multi-scale inputs due to limited GPU memory. All the models are trained on the training set and evaluated on the validation set.

heading: 3 ILLUSTRATION OF KRONECKER ATTENTION MODULES

heading: 4 THE KANETS ARCHITECTURE
text: Table 6 describes the detailed KANets architecture. We use KAOs in every AttnSkipModule. In KAOs, we use multi-head attention with 4 heads and concatenate results for output. The linear
transformation is only performed on the value matrix V to limit the number of parameters and computational resources.

heading: 5 PROOF OF THEOREM 1
text: The fact that Ω and Ψ are diagonal implies independence in the case of multivariate normal distributions. Therefore, it follows from assumptions (a) and (b) that
[r1, r2, . . . , rh]T ∼MN h×w (Mr,I[h] ⊗ Ω +Ψ h ) , (7)
whereMr = µ + [υ,υ, . . . ,υ]T = µ + 1[h]υT , and
[c1,c2, . . . ,cw] ∼MN h×w (Mc, Ψ +Ω w ⊗ I[w]) , (8)
whereMc = υ + [µ,µ, . . . ,µ] = υ +µ1T[w].
Given assumption (c) and X̃ = [r1, r2, . . . , rh]T + [c1,c2, . . . ,cw], we have
X̃ ∼MN h×w (M̃ , Ψ +Ω w ⊕ Ω +Ψ h ) , (9)
where M̃ =Mr +Mc = (µ| υ) + (µ + υ). If h = w, we have
tr(Ω⊕Ψ) = h (∑Ωii +∑Ψjj) , (10)
and
tr(Ψ +Ω w ⊕ Ω +Ψ h )
= tr( 1 h (Ω⊕Ψ) + 1 h (Ψ +Ω))
= (∑Ωii +∑Ψjj) + h(Ψ +Ω) = 2(∑Ωii +∑Ψjj)
= 2 h ⋅ tr (Ω⊕Ψ) . (11)
This completes the proof of the theorem.

Review summaries:
Akin to previous work introducing tensor regression layers to leverage the tensor/multimodal structure of inputs [Kossaifi et al., 2017], this paper proposes a Kronecker structured attention operator for self attention models acting on tensor data. The proposed operators enforce various constraints on the query key and value matrices of the attention module, where some (or all) of these matrices are obtained as horizontal and lateral averages of the query matrix; in this context, the query matrix is actually the flattening of a 3rd order tensor, whose slices are referred to as "feature maps". A theoretical analysis investigates the properties of imposing a Kronecker structured covariance matrix on the feature maps. The main theorem provides a way to efficiently construct feature maps satisfying this covariance structure. Experiments on image classification and segmentation are given where the proposed approach shows competitive performances while maintaining a number of parameters on par with efficient architectures such as neural nets.