WBMM: Windowed Batch Matrix Multiplication for Efficient Large Receptive Field Convolution
- Publication
- ICML 2026Conference
- First submitted to arXiv
- arXiv:2607.02097
Cite this paper · BibTeX
The citation identifies the linked source version. It cites the original paper and its authors.
@misc{classiccnnswbmm2026,
title = {{WBMM: Windowed Batch Matrix Multiplication for Efficient Large Receptive Field Convolution}},
author = {Wan Song and Wei Zhou and Rui Wang and Jun Yu and Toru Kurihara and Jiajia Xu and Shu Zhan},
year = {2026},
eprint = {2607.02097},
archivePrefix = {arXiv},
url = {https://arxiv.org/abs/2607.02097}
}
Convolution kernels keep growing. ConvNeXt uses 7×7, RepLKNet reaches 31×31, SLaK reaches 51×51, and UniRepLKNet settles back at 13×13. Accuracy keeps improving, while speed remains a problem.
Depthwise convolution has few FLOPs, yet it slows rapidly as kernels grow. The authors measure a 71% to 78% throughput drop when standard depthwise convolution expands from 5×5 to 13×13, and 92% to 94% at 27×27. Results are similar across batch sizes and feature-map sizes.
RepLKNet and UniRepLKNet address this with a custom CUDA operator, called LKA (Large Kernel Acceleration) in this paper. It helps on small feature maps but becomes slower on large ones. At 224×224 and batch size 128, LKA with 7×7 is 80% slower than unaccelerated 5×5, and with 13×13 it is 89% slower. Detection, segmentation, and super-resolution all need large feature maps.
This paper comes from Hefei University of Technology, Lingyang Industrial Internet, and Kochi University of Technology in Japan. It takes a different direction: compute convolution with matrix multiplication.
Defining the Problem
Convolution Waits for Data

Memory access is the issue. Feature maps are stored row by row. Each depthwise-convolution output gathers values from each of surrounding rows. Those values are not contiguous in memory: the values within a row are adjacent, but reaching the next row requires a stride equal to the full row width.
Larger kernels visit more rows and put more pressure on caches. Each value read supports just one multiply-add. GPU arithmetic capacity stays idle while data arrives.
Solving the Problem
Write Convolution as Matrix Multiplication
![Figure 1 from the paper: (a) depthwise convolution on the left shows input X as a large grid, with an orange 7×7 region around red cell (i, j), convolved with a 7×7 kernel W. An arrow says to gather 7² = 49 neighbors to produce y[i, j]. (b) WBMM on the right divides X into four colored 7×7 windows. A light-blue relative-position table R above has size C × (2·7 − 1)² = C × 169; an index arrow forms matrix M of size C × 49 × 49. A green Batched MatMul arrow multiplies input windows by M, producing output Y with the same window partition.](/content/papers/assets/5c20ec217f297d24ad8ce71ca79936d0599f7b460167e3bb89f52515ff1347ee.png)
WBMM (Windowed Batch Matrix Multiplication) has three steps:
- Partition windows: split the feature map into nonoverlapping windows, such as 7×7. Flatten each into 49 values arranged contiguously in memory.
- Look up weights: each channel has a relative-position table of size . A 7×7 window uses 13×13 = 169 parameters. The weight used by window position for position depends only on their relative position; look it up to form a 49×49 matrix .
- Batched matrix multiplication: all windows within a channel share . Use channels as the batch dimension, and one
bmmcomputes every window.
Weights depend only on relative position, just as in convolution. The paper's Theorem 3.2 proves that on a bounded feature map, depthwise convolution can be written exactly as matrix multiplication with relative-position weights. Applied within each window, WBMM is equivalent to a 13×13 depthwise convolution with everything outside the window set to 0. Implement it and compare against a 13×13 convolution run window by window:
import torch
import torch.nn.functional as F
torch.manual_seed(0)
C, H, W, w = 4, 14, 14, 7 # 4 channels, 14×14 feature map, 7×7 windows
d = w * w # 49 positions per window
R = torch.randn(C, (2 * w - 1) ** 2) # Relative-position table: 13×13 = 169 parameters per channel
# Relative-position index: which table entry connects window position i to j
pos = torch.stack(torch.meshgrid(torch.arange(w), torch.arange(w), indexing="ij")).flatten(1) # 2 × 49
rel = pos[:, None, :] - pos[:, :, None] + (w - 1) # 2 × 49 × 49
index = rel[0] * (2 * w - 1) + rel[1]
M = R[:, index] # C × 49 × 49: form the weight matrix by lookup
# Split the feature map into nonoverlapping windows, arranged as (C, window count, 49)
x = torch.randn(1, C, H, W)
nh, nw = H // w, W // w
windows = x.view(C, nh, w, nw, w).permute(0, 1, 3, 2, 4).reshape(C, nh * nw, d)
y = torch.bmm(windows, M.transpose(1, 2)) # One batched matrix multiplication computes every window per channel
y = y.view(C, nh, nw, w, w).permute(0, 1, 3, 2, 4).reshape(1, C, H, W)
# Reference: 13×13 depthwise convolution, one window at a time, with zeros outside each window
kernel = R.view(C, 1, 2 * w - 1, 2 * w - 1)
ref = torch.zeros_like(x)
for i in range(nh):
for j in range(nw):
patch = x[..., i * w:(i + 1) * w, j * w:(j + 1) * w]
ref[..., i * w:(i + 1) * w, j * w:(j + 1) * w] = F.conv2d(patch, kernel, padding=w - 1, groups=C)
print("Weight matrix:", tuple(M.shape), ", formed by lookup from", R.shape[1], "parameters")
print("Maximum difference from within-window 13×13 depthwise convolution:", f"{(y - ref).abs().max():.1e}")
Weight matrix: (4, 49, 49) , formed by lookup from 169 parameters
Maximum difference from within-window 13×13 depthwise convolution: 2.9e-06
The results agree up to floating-point error. What differs is memory behavior: convolution gathers scattered neighbors one by one; WBMM reads a contiguous window and hands it to the GPU's highly optimized matrix multiplication.
Bigger Windows Run Faster
This brings a counterintuitive property. Larger depthwise kernels run slower, but larger WBMM windows run faster.
A window reads values and performs multiply-adds, giving operations per value read. Larger windows raise the computation-to-read ratio and keep the GPU busier. The weight matrix has entries, but every window in the batch shares it, amortizing the read.
With 14×14 windows, each output takes 196 multiply-adds, nearly 8 times a 5×5 depthwise convolution, and sees 7.8 times the area. The operator benchmark uses an A800, FP32, and 256 channels. Comparing WBMM with 14×14 windows against standard 5×5 depthwise convolution:
| Batch size | 14×14 feature map | 28×28 | 56×56 | 112×112 | 224×224 |
|---|---|---|---|---|---|
| 4 | 0.45× | 0.37× | 1.41× | 1.64× | 2.02× |
| 16 | 0.62× | 1.56× | 1.80× | 2.00× | 2.07× |
| 64 | 1.86× | 1.85× | 2.01× | 2.01× | 2.03× |
| 128 | 3.17× | 2.00× | 2.06× | 1.97× | 2.01× |
| 256 | 3.72× | 2.02× | 2.02× | 1.95× | — |
With sufficiently large feature maps and batches, WBMM is about twice as fast. Small batches and small maps can be slower: at batch size 4 and 28×28, it runs at just 0.37×.
This differs greatly from window attention. Swin computes an input-dependent matrix and softmax for each sample and window. WBMM's is input-independent and shared across the batch; at inference, it can be precomputed and stored.
Let Windows Exchange Information
Nonoverlapping windows trap information inside each window. The authors interleave standard 3×3 depthwise convolutions between WBMM blocks to exchange information across neighboring windows.
For multiscale tasks such as segmentation, they also use hierarchical window reparameterization. During training, one large 14×14 window and four small 7×7 windows each have relative-position tables. Before inference, add the small-window matrices into diagonal blocks of the large-window matrix, producing one matrix at no extra inference cost. The idea parallels UniRepLKNet's merging of small kernels into a large one.
The full model starts from UniRepLKNet, replaces large kernels with WBMM, and adjusts the arrangement of WBMM and 3×3 blocks within each stage.
Discussion
ImageNet
| Model | Training time per epoch | Training memory | top-1 |
|---|---|---|---|
| WBMM-T | 6:18 | 15.0 GB | 83.2% |
| UniRepLKNet-T (with LKA) | 9:03 | 16.6 GB | 83.2% |
| UniRepLKNet-T (without LKA) | 11:03 | 16.6 GB | 83.2% |
| WBMM-S | 8:35 | 20.4 GB | 83.9% |
| UniRepLKNet-S (with LKA) | 12:10 | 22.3 GB | 83.9% |
Accuracy is identical, with training more than 1.4 times as fast. Without LKA, the gap is larger. Across four model sizes, training speedups range from 1.31 to 1.88 times—the numbers in the abstract.
This compares against the entire UniRepLKNet, though, including several small dilated reparameterization branches during training. An appendix table makes a fairer comparison, keeping everything fixed except the spatial operator:
| Spatial operator | Time per epoch | top-1 | ADE20K mIoU | Inference (images/s) |
|---|---|---|---|---|
| WBMM (7×7 windows) | 6:20 | 83.0% | 48.3 | 1833 |
| WBMM (14×14 hierarchical) | 6:31 | 83.2% | 48.8 | 1842 |
| 13×13 depthwise + LKA | 6:43 | 83.1% | 48.3 | 1662 |
| 13×13 depthwise (without LKA) | 9:11 | 83.1% | 48.3 | 1305 |
| 13×13 depthwise + reparameterization + LKA | 10:21 | 83.2% | 48.7 | 1662 |
| Original SLaK | 22:03 | 83.3% | 47.4 | 549 |
| 7×7 window attention | 8:38 | 83.3% | 48.1 | 1245 |
Against plain 13×13 depthwise convolution with LKA, WBMM gives only 6% faster training and 10% faster inference. Much of the previous table's 1.4× gain comes from removing UniRepLKNet's multibranch reparameterization: 10:21 becomes 6:20. Against depthwise convolution without LKA, WBMM is more than 1.4 times as fast.
WBMM's real value is reaching or exceeding LKA speed without writing a custom CUDA operator.
Detection and Segmentation
| Method | ADE20K mIoU (single-scale) | COCO box AP | COCO mask AP |
|---|---|---|---|
| UniRepLKNet-T | 48.6 | 51.8 | 44.9 |
| WBMM-T (7×7) | 48.3 | 51.6 | 44.8 |
| WBMM-T (hierarchical) | 48.8 | 51.9 | 45.1 |
The plain 7×7-window variant trails UniRepLKNet by 0.1 to 0.3. Hierarchical reparameterization brings it 0.1 to 0.2 ahead, also adding 3M to 4M parameters. Detection and segmentation performance is roughly tied; WBMM's gain is speed.
Other Hardware
The authors also measure other devices. On an A800, WBMM runs 1.01 to 1.28 times as fast as UniRepLKNet with LKA. On an Intel i7-13700K CPU, where LKA is unavailable, BLAS gives WBMM a 1.03 to 1.48× speedup. On Jetson Orin Nano, the GPU gets 1.19 to 3.12× in FP16, and the CPU 1.33 to 2.44× in INT8. Every hardware platform optimizes matrix multiplication, making this especially useful on edge devices.
Limitations
The appendix lists several limitations. The weight matrix grows with the fourth power of window side length. At 14×14, a 256-channel layer takes about 37.5 MB; beyond 28×28 it no longer fits. Window size also depends on the task: plain 14×14 performs worse than plain 7×7 on ADE20K. Input-independent weights may be insufficient for tasks needing content adaptation.
Conclusion
WBMM preserves what the model sees. Within each window, it is a 13×13 depthwise convolution; the change is how data is arranged in memory and which operator computes it. Batched matrix multiplication turns time spent waiting for data into time spent computing, so larger windows can run faster.
Read the tables with the baseline in mind. The abstract's 1.31 to 1.88× compares against the full UniRepLKNet. Changing only the operator gives 6% faster training than depthwise convolution with LKA. The real saving is the custom CUDA implementation.
If high-resolution speed is holding back your large-kernel model, try this approach. PyTorch's bmm is enough. The first half of the demonstration contains the full core logic, with no CUDA extension to compile.