Introduced at NeurIPS 2022, HorNet is a new family of vision backbones that bridges the gap between Convolutional Neural Networks (CNNs) and Vision Transformers (ViTs). By rethinking spatial interactions through a recursive lens, the authors demonstrate that the "secret sauce" of Transformers can be implemented more efficiently using convolutions.
TL;DR
HorNet introduces Recursive Gated Convolutions ($g^n$Conv), a novel operation that enables high-order spatial interactions—the key advantage of Transformers—within a purely convolutional framework. It outperforms state-of-the-art models like Swin Transformers and ConvNeXt across classification, detection, and segmentation tasks while maintaining the efficiency and inductive biases of CNNs.
The Core Problem: CNNs vs. ViTs
For the past few years, the computer vision community has been torn between two primary architectures:
- CNNs: Efficient and translation-equivariant (they "understand" that an object is the same regardless of its position), but often limited by static weights and local receptive fields.
- Vision Transformers (ViTs): Powerful because of their "input-adaptive" nature and "high-order" spatial interactions (via self-attention), but computationally expensive (quadratic complexity) and lacking some of the useful inductive biases of CNNs.
The authors identify that the primary advantage of ViTs isn't necessarily the attention mechanism itself, but the high-order spatial interactions it enables. In a standard convolution, features don't "talk" to each other in complex ways; in self-attention, the interaction between Query, Key, and Value creates a "second-order" interaction. The authors set out to achieve these complex interactions (and even higher-order ones) using only efficient convolutional building blocks.
Methods: Recursive Gated Convolutions
The core innovation is the Recursive Gated Convolution ($g^n$Conv).
Standard gated convolution is a first-order interaction: you take a feature map, split it, perform a depth-wise convolution on one half, and multiply it by the other. $g^n$Conv takes this further by performing this gating operation recursively.
- Recursive Design: By nesting these gated operations $n$ times, the model achieves $n$-order interactions. While self-attention is a 2nd-order interaction, $g^n$Conv can easily scale to 3rd, 4th, or 5th order without a massive explosion in parameters.
- Efficiency: To keep the computational cost (FLOPs) bounded, the authors progressively increase the channel width during the recursion. This "coarse-to-fine" approach ensures that the high-order interactions don't make the model too slow.
- Long-range Modeling: To match the global reach of Transformers, HorNet uses either large-kernel convolutions (e.g., 7x7) or Global Filters (GF) in the frequency domain to ensure the model sees the "big picture."
Key Insights
- Generalizing Interaction Order: The paper provides a formal way to think about "order." A standard CNN is 0-order (static). Dynamic CNNs are 1st-order. Self-attention is 2nd-order. $g^n$Conv makes "order" a tunable hyperparameter.
- The Best of Both Worlds: Because it's built on convolutions, HorNet inherits translation equivariance. Unlike Transformers, which can struggle with varying input resolutions, HorNet handles them naturally.
- Input Adaptivity: Like Transformers, the weights in $g^n$Conv are effectively "input-adaptive." The gating mechanism means the way spatial information is mixed depends entirely on the specific image being processed.
- HorFPN: The authors also showed that $g^n$Conv can be used as a "plug-and-play" module in Feature Pyramid Networks (FPNs), significantly boosting performance in dense prediction tasks.
Key Results
HorNet was rigorously evaluated on standard benchmarks (ImageNet, COCO, ADE20K) and consistently outperformed the two most popular baselines, Swin Transformer and ConvNeXt.
- ImageNet Classification: HorNet-T (Tiny) achieved 83.0% top-1 accuracy, surpassing Swin-T (81.3%) and ConvNeXt-T (82.1%). When scaled up and pre-trained on ImageNet-22K, HorNet-L reached 87.7% accuracy.
- Object Detection: On COCO, HorNet-based models outperformed ConvNeXt by a margin of 1.2 to 2.0 box AP, showing that high-order interactions are particularly useful for complex spatial tasks.
- Semantic Segmentation: On ADE20K, HorNet-L achieved a state-of-the-art 57.9% mIoU.
Limitations and Future Work
The authors honestly note a "hardware gap." While HorNet has lower or similar FLOPs (theoretical operations) compared to ConvNeXt, it is currently slightly slower in terms of actual GPU latency.
This is because the recursive gating structure is more complex than a simple stack of convolutions, and current deep learning libraries (like PyTorch/CUDA) are highly optimized for standard convolutions but less so for recursive gating. Developing more hardware-friendly implementations of high-order interactions remains a key direction for future research.
Summary updated