---
title: Global Depthwise Convolution (GDConv)
url: https://www.emergentmind.com/topics/global-depthwise-convolution-gdconv
type: topic
---

# Global Depthwise Convolution (GDConv)

Global Depthwise Convolution (GDConv) commonly denotes a depthwise operator with **global spatial support**, such as an \(m \times m\) depthwise kernel spanning the full feature map. In the two arXiv works most directly relevant here, however, that operator is distinguished rather than introduced. "Accelerating Vision Foundation Models with Drop-in Depthwise Convolution" studies a **drop-in depthwise convolution replacement for selected self-attention heads** in pretrained Vision Transformers, but explicitly uses a **finite-kernel, local, static, content-independent depthwise convolution** rather than a true global one [2605.22132]. "Generalized Depthwise-Separable Convolutions for Adversarially Robust and Efficient Neural Networks" introduces **Generalized Depthwise-Separable (GDWS) convolution**, where "G" stands for **generalized**, not global; the method remains a factorization of **standard local \(K \times K\) convolution** rather than a full-spatial depthwise operator [2110.14871]. The resulting literature position is terminologically delicate: GDConv, in the strict global-spatial sense, is not the object implemented in either paper, but both works clarify neighboring regimes in which depthwise operators approximate either self-attention or standard convolution.

## 1. Terminological scope and formal distinction

The central distinction is between **global spatial support** and **local spatial support**. A true GDConv would typically use a kernel spanning the full feature map, such as \(m \times m\) depthwise kernels, so that spatial aggregation is globally supported but remains channelwise. By contrast, the Vision Transformer acceleration work replaces certain attention heads with a **local** operator defined on a neighborhood \(\Delta_k \subset \Delta_m\), with experiments fixing \(k=3\). The replacement is therefore neither global by kernel size nor global in the sense of a fully connected token mixer [2605.22132].

A second distinction concerns the meaning of the initialism itself. In the CNN approximation work, the term is **GDWS**, not GDConv, and its expansion is **Generalized Depthwise-Separable**. The operator allows each input channel to have multiple depthwise filters before a pointwise mixing stage, but the spatial kernels remain ordinary local \(K \times K\) kernels. There is no notion of full-image support or global filtering in that formulation [2110.14871].

This terminological separation matters because superficially similar names can conceal materially different operators. In one case, depthwise convolution is used as a **local surrogate** for selected self-attention heads; in the other, it is used as a **generalized factorization** of pretrained convolutional weights. Neither mechanism, as defined, is equivalent to GDConv in the full-spatial sense.

## 2. Attention as a precursor to convolutional structure

The transformer-based analysis begins from standard self-attention on a ViT token matrix \(X \in \mathbb{R}^{n \times d}\), with \(n=m^2\) patch tokens arranged on an \(m \times m\) grid. For head \(h\),
\[
Q^h = XW^Q_{[:,h,:]}, \qquad K^h = XW^K_{[:,h,:]}, \qquad V^h = XW^V_{[:,h,:]} .
\]
The attention output is
\[
Att(X)^h = E(X)^h V^h,
\]
with attention matrix
\[
E(X)^h = \operatorname{softmax}\!\left(\frac{Q^h {K^h}^{\top}}{\sqrt{d_h}}\right),
\]
and full multi-head output
\[
MhSA(X) = [Att^1(X)\,\|\,\dots\,\|\,Att^{n_h}(X)]W^O.
\]

After reshaping tokens to spatial form, the head output at location \((i,j)\) is written as
\[
Att(X)^h_{i,j} = \sum_{r,s \in \Delta_m} E^h(X)_{(i,j),(i+r,j+s)} \, V^h_{i+r,j+s}.
\]
This formulation exposes the bridge to convolution: attention is a weighted spatial aggregation over values. The crucial difference is that the weights depend on the input and on the query position. The proposed approximation replaces these input-dependent weights with a learned local kernel,
\[
Att(X)^h_{i,j} \;\approx\; \sum_{(r,s)\in\Delta_k} K^h_{r,s}\,V^h_{i+r,j+s},
\]
where \(K^h \in \mathbb{R}^{k\times k}\) and \(\Delta_k \subset \Delta_m\). This establishes a convolutional relation, but only over a truncated local support and with static rather than input-generated coefficients [2605.22132].

The paper formalizes when an attention head becomes convolution-like through three properties of the attention matrix \(E(X)^h\): locality, translation invariance, and input invariance. For a receptive field \(\Delta_k\),
\[
\text{(L)}:\quad E(X)^h_{(i,j),(u,v)} \neq 0 \;\; \text{only if } (u-i,v-j)\in\Delta_k,
\]
\[
\text{(TI)}:\quad E(X)^h_{(i,j),(i+s,j+r)} = E(X)^h_{(l,t),(l+s,t+r)} \quad \forall (i,j),(l,t),
\]
\[
\text{(II)}:\quad E(X)^h = E(Y)^h \quad \forall X,Y.
\]
Under these conditions, the head becomes equivalent to a fixed local operator on values. These conditions imply convolutional structure, but not global convolutional structure.

## 3. Local depthwise replacement inside pretrained Vision Transformers

The ViT acceleration method derives two convolutional realizations. A full convolution form folds the local kernel into the value projection:
\[
Att_C(X)^h = Conv(X, W^{Vh}),
\]
with
\[
W^{Vh}_{r,s} = K^h_{r,s}\, W^V_{[:,h,:]}, \qquad (r,s)\in\Delta_k,
\]
where \(W^{Vh}\in\mathbb{R}^{k\times k \times d_i \times d_h}\). This corresponds to a standard spatial convolution after merging value projection and local mixing.

The implemented replacement is the depthwise decomposition
\[
\boxed{Att_{DW}(X)^h = Conv_{DW}(V^h,\vec{K}^h)}
\]
with
\[
V^h = XW^V_{[:,h,:]},
\]
and
\[
\vec{K}^h \in \mathbb{R}^{k\times k\times 1\times d_h}.
\]
Each output channel within head \(h\) therefore receives its own \(k \times k\) spatial filter. In the reported experiments, \(k=3\), so the operational module is a **\(3 \times 3\) depthwise convolution on the value features of selected heads** [2605.22132].

This operator is static and content-independent: the kernel is a learned parameter rather than a function of the input. It is also explicitly local, since \(\Delta_k\) is a subset of the full attention support \(\Delta_m\). Any apparent relation to global mixing comes only from the fact that the module replaces a mechanism—self-attention—that originally had full token-to-token connectivity. The replacement itself remains a finite-kernel local DWConv.

Architecturally, the substitution occurs **inside a standard MHSA block at the head level**. The method does not remove the entire MHSA mechanism uniformly across the network. Instead, it replaces either selected heads across the model or all heads in selected blocks. The unensembled formulation preserves concatenation and output projection \(W^O\), while an ensembled variant merges multiple heads into one effective depthwise-convolution branch.

## 4. Selection criteria, head ensembling, and approximation regime

The viability of the replacement depends on identifying heads whose attention is already close to a static convolution. The selection criterion is based on the pointwise standard deviation of the attention matrix \(E(X)^h\) across data. For each head \(h\), an online estimate of the standard deviation tensor \(\sigma_{E^h}\) is computed across \(N_s\) samples using Welford’s algorithm, and summarized by
\[
\Sigma_h = \sum \sigma_{E^h}.
\]
For blockwise replacement,
\[
\Sigma_b = \frac{1}{n_h}\sum_{h\in[n_h]} \Sigma_h.
\]
Heads or blocks with the smallest scores are selected. Small \(\Sigma_h\) indicates that the attention pattern changes little across inputs and is interpreted as evidence for approximate input invariance [2605.22132].

This criterion does **not** test for global support. It tests whether a head is static across inputs. The conceptual target is therefore the opposite of a richly content-dependent global mixer: the replaceable heads are those that behave in a localized, nearly translation-like, and largely positional fashion. The paper explicitly motivates the approximation in terms of heads learning **highly localized, static patterns**.

The work also introduces a head-ensembling mechanism with learnable head weights \(\gamma\),
\[
W^{Ve} = \sum_{h=1}^{n_h} \sigma(\gamma_h)\, W^V_{[:,h,:]}, \qquad W^{Oe} = \sum_{h=1}^{n_h} \sigma(\gamma_h)\, W^O_{[:,h,:]} ,
\]
and defines
\[
MhSA^e_{DW}(X) = Conv_{DW}(V^e,\vec{K}^e) W^{Oe}, \qquad V^e = XW^{Ve}.
\]
The paper argues that SPViT corresponds to a special case under strong assumptions, but the resulting branch remains a local-kernel depthwise module rather than a GDConv. A stochastic-gating selection approach adapted from Differentiable Subset Pruning is also discussed, yet the simpler \(\Sigma_b\) criterion is reported to work better empirically.

## 5. Generalized depthwise-separable convolution and its non-global character

The second relevant operator is the **\((C,K,\mathbf{g},M)\) Generalized Depthwise-Separable (GDWS) convolution**. For input \(X \in \mathbb{R}^{C\times H\times W}\), output channels \(M\), and kernel size \(K \times K\), GDWS introduces a channel distribution vector
\[
\mathbf{g} \in \mathbb{Z}_+^C,\qquad g_c \ge 0,
\]
and consists of two stages: a **generalized depthwise convolution**, where input channel \(c\) is convolved with \(g_c\) depthwise filters, followed by a \(1 \times 1\) pointwise convolution mapping the resulting
\[
G=\sum_{c=1}^C g_c
\]
intermediate channels to the final output [2110.14871].

The method is most naturally understood through its matrix factorization. A standard convolution with vectorized filters \(\mathbf{W} \in \mathbb{R}^{M\times CK^2}\) is written as
\[
\mathbf{Y} = \mathbf{W}\Psi(X),
\]
with MAC complexity
\[
H'W'MCK^2.
\]
GDWS factorizes the weight matrix as
\[
\mathbf{W} = \mathbf{W}_{\text{P}}\mathbf{W}_{\text{D}},
\]
where \(\mathbf{W}_{\text{P}} \in \mathbb{R}^{M\times G}\) and \(\mathbf{W}_{\text{D}} \in \mathbb{R}^{G\times CK^2}\). Channelwise partitioning yields blocks \(\mathbf{W}_c \in \mathbb{R}^{M\times K^2}\), each satisfying
\[
\operatorname{rank}(\mathbf{W}_c)\le \min(g_c,K^2).
\]
This means GDWS approximates a standard convolution by independently low-rank approximating each channel block.

Several special cases are explicit. Setting
\[
g_c = 1 \qquad \forall c\in[C]
\]
reduces GDWS to standard MobileNet-style depthwise-separable convolution. Setting
\[
g_c=K^2 \qquad \forall c
\]
permits exact representation of any standard convolution. The construction remains local throughout: the novelty lies in generalized factorization and per-channel-block rank allocation, not in any global receptive field.

Approximation is optimized by truncated SVD. For fixed \(g_c\),
\[
\hat{\mathbf{W}}_c = \sum_{i=1}^{g_c}\sigma_{i,c}\mathbf{u}_{i,c}\mathbf{v}_{i,c}^T,
\]
with error
\[
\|\mathbf{W}_c-\hat{\mathbf{W}}_c\|_F = \sqrt{\sum_{i=g_c+1}^{r_c}\sigma_{i,c}^2}.
\]
The weighted objective is
\[
e(\mathbf{W},\mathbf{Q},\boldsymbol{\alpha}) = \sqrt{ \sum_{c=1}^C \alpha_c \|\mathbf{W}_c-\mathbf{Q}_c\|_F^2 }.
\]
The algorithms MEGO and LEGO solve, respectively, minimum-error approximation under a complexity budget and minimum-complexity approximation under an error budget. These results make GDWS a rigorously characterized post-training approximation of standard 2D convolution, but not a GDConv in the global-spatial sense.

## 6. Efficiency regimes, empirical behavior, and implications for GDConv research

The local DWConv replacement in pretrained ViTs is motivated partly by complexity. The full-convolution form has complexity \(O(k^2 d_i d_h)\), whereas the depthwise decomposition reduces this to
\[
O(d_i d_h + k^2 d_h).
\]
For a single MHSA block with \(n_h=16\) and \(24\times24\) tokens, the reported benchmarks are: standard MHSA at \(6.19\) GFLOPs, \(3.2\) ms, and \(47.2\) MB; full convolution replacement at \(12.08\) GFLOPs, \(3.71\) ms, and \(4.5\) MB; depthwise replacement at \(2.43\) GFLOPs, \(1.26\) ms, and \(6.75\) MB; SPViT-style at \(0.75\) GFLOPs and \(0.641\) ms; and Ens+DW at \(0.15\) GFLOPs and \(0.215\) ms [2605.22132].

At model scale, replacing 12 of 24 blocks in DINOv2-ViT-L reduces latency from \(161.4\) ms to \(133.6\) ms, a \(17.21\%\) speedup, with \(-0.08\) mIoU on COCO segmentation; replacing 16 of 24 blocks gives \(126.1\) ms, a \(21.85\%\) speedup, with \(-1.39\) mIoU. The reported method targets pretrained foundation models through a two-stage procedure: first fine-tune the original backbone on the target task with normal MHSA, then replace selected heads or blocks with convolutional layers, then fine-tune again for half the original number of epochs. The learned convolution kernels are introduced in the second phase, while \(W^V\) and \(W^O\) retain pretrained information.

The GDWS work presents a different efficiency profile. Its MAC count is
\[
H'W'G(K^2+M),
\]
compared with
\[
H'W'MCK^2
\]
for standard convolution. A central claim is improved **actual FPS on an NVIDIA Jetson Xavier NX**. Reported examples include ResNet-18 on CIFAR-10 from **28 FPS** to **104 FPS** with GDWS (\(\beta=0.005\)); VGG-16 on CIFAR-10 from **36 FPS** to **129 FPS** with GDWS (\(\beta=0.25\)); WRN-28-4 on CIFAR-10 from **17 FPS** to **65 FPS**; and ResNet-50 on ImageNet from **15 FPS** to **19 FPS** [2110.14871]. The same paper emphasizes that GDWS is a **post-training approximation** that **does not require any additional training** for its main results, and that adversarial robustness is usually preserved within about \(1\%\).

For GDConv research, the combined implication is narrow but useful. The transformer work provides evidence that many pretrained ViT heads can be replaced by **static depthwise spatial filtering**, yet the successful regime is explicitly **local** rather than global. The CNN work shows that depthwise factorization can be generalized and made provably optimal as a post-training approximation of local convolution, but again without any global-spatial operator. A plausible implication is that future work on strict GDConv would need to establish not only input invariance and translation-like behavior, but also sufficiently **broad spatial support** to justify full-map depthwise kernels. The evidence here addresses the easier and more hardware-friendly case: local depthwise operators that substitute for either selected attention heads or standard convolutions.

Source: https://www.emergentmind.com/topics/global-depthwise-convolution-gdconv