Back to paper library
Paper notesarXiv 2026ICML 2026

WBMM

Bigger Windows, Higher Speed

Original paper

WBMM: Windowed Batch Matrix Multiplication for Efficient Large Receptive Field Convolution

Paper authors

Wan Song · Wei Zhou · Rui Wang …

Show all 7 authors

Wan Song · Wei Zhou · Rui Wang · Jun Yu · Toru Kurihara · Jiajia Xu · Shu Zhan

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}
}
On this page

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

Figure 2 from the paper, with four panels. (a) A 5×5 depthwise convolution gathers values for a red output y from five rows of five cells, with thin red lines converging on y; each output collects 25 values from five noncontiguous rows. (b) WBMM's 4×4 windows divide an 8×8 feature map into four nonoverlapping colored regions W0 through W3; each window reads 16 values from one contiguous block. (c) Depthwise memory access has red boxes in rows 1 through 5 labeled fetch #1 through fetch #5, with notes for five independent reads, stride equal to width, a working set spanning multiple cache lines, and O(1) operations per byte: memory-bound. (d) WBMM takes four values from each of four rows in blue boxes, then window_partition and reshape arrange them into 16 contiguous cells requiring only fetch #1, with contiguous addresses, an L1-cache-sized window, and O(w²) operations per byte: compute-bound.
Figure 2 from Song et al., taken from PDF page 2. The original caption is omitted.

Memory access is the issue. Feature maps are stored row by row. Each depthwise-convolution output gathers kk values from each of kk surrounding rows. Those values are not contiguous in memory: the kk 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.
Figure 1 from Song et al., taken from PDF page 1. The original caption is omitted.

WBMM (Windowed Batch Matrix Multiplication) has three steps:

  1. Partition windows: split the feature map into nonoverlapping w×ww\times w windows, such as 7×7. Flatten each into 49 values arranged contiguously in memory.
  2. Look up weights: each channel has a relative-position table RR of size (2w−1)2(2w-1)^2. A 7×7 window uses 13×13 = 169 parameters. The weight used by window position ii for position jj depends only on their relative position; look it up to form a 49×49 matrix MM.
  3. Batched matrix multiplication: all windows within a channel share MM. Use channels as the batch dimension, and one bmm computes 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:

Python
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}")
Text
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 w×ww\times w window reads w2w^2 values and performs w4w^4 multiply-adds, giving w2w^2 operations per value read. Larger windows raise the computation-to-read ratio and keep the GPU busier. The weight matrix MM has w4w^4 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:

Table: from the paper's Table 1; values are WBMM speed relative to 5×5 depthwise convolution.
Batch size14×14 feature map28×2856×56112×112224×224
40.45×0.37×1.41×1.64×2.02×
160.62×1.56×1.80×2.00×2.07×
641.86×1.85×2.01×2.01×2.03×
1283.17×2.00×2.06×1.97×2.01×
2563.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 MM 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

Table: selected rows from the paper's Table 5. Eight A800s.
ModelTraining time per epochTraining memorytop-1
WBMM-T6:1815.0 GB83.2%
UniRepLKNet-T (with LKA)9:0316.6 GB83.2%
UniRepLKNet-T (without LKA)11:0316.6 GB83.2%
WBMM-S8:3520.4 GB83.9%
UniRepLKNet-S (with LKA)12:1022.3 GB83.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:

Table: selected rows from the paper's Table 8, all Tiny-sized with the same architecture.
Spatial operatorTime per epochtop-1ADE20K mIoUInference (images/s)
WBMM (7×7 windows)6:2083.0%48.31833
WBMM (14×14 hierarchical)6:3183.2%48.81842
13×13 depthwise + LKA6:4383.1%48.31662
13×13 depthwise (without LKA)9:1183.1%48.31305
13×13 depthwise + reparameterization + LKA10:2183.2%48.71662
Original SLaK22:0383.3%47.4549
7×7 window attention8:3883.3%48.11245

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

Table: from the paper's Tables 6 and 7. ADE20K uses UperNet; COCO uses Cascade Mask R-CNN.
MethodADE20K mIoU (single-scale)COCO box APCOCO mask AP
UniRepLKNet-T48.651.844.9
WBMM-T (7×7)48.351.644.8
WBMM-T (hierarchical)48.851.945.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 MM 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.