NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

SpanFormer: Multi-Level Adaptive Sparsity for Object Detection in High-Resolution Wide Shots

Xiang Li, Chen Zhang, Wenxi Li, Yuetong Wang, Chenyang Lyu, Haozhe Lin, Fan Zhang, Guiguang Ding, Yuchen GuoNeurIPS 2026

TL;DR

Finding pedestrians in gigapixel, kilometer-wide images is literally a needle-in-a-haystack problem—most of the image is empty, yet existing sparse vision transformers waste massive compute staring at rustling leaves and brick walls. SpanFormer fixes this by teaching the network what actual objects look like, adjusting how much of each image to process based on crowd size, and allowing nearby object clusters to talk to each other. The result is higher detection accuracy at less than a quarter of the backbone compute cost.

What Problem Does This Paper Address?

Imagine looking down from a blimp at a sprawling city plaza with a billion-pixel camera. Unlike standard close-up datasets (like MS COCO), these High-Resolution Wide (HRW) shots have three quirks: targets occupy less than 5% of the pixels, crowd density swings from five people to five thousand across scenes, and groups of objects can stretch across thousands of pixels.

To survive the massive resolution, state-of-the-art detectors (like SparseFormer) chop images into small $7\times7$ windows and only process a fixed fraction ($top\text{-}k$) of them. However, their selection recipe has three blind spots:

  1. Texture obsession: They rank windows using hand-crafted pixel variance (high-frequency residuals). Busy, object-free backgrounds like foliage or patterned roofs look "interesting" and steal compute from actual targets.
  2. Rigid budgets: A fixed $top\text{-}k$ keep-ratio wastes compute on empty plazas and drops real people in crowded stadiums.
  3. Tunnel vision: Kept windows only attend internally within their tiny $7\times7$ grid, blinding the model to broader crowd context.
Figure 1: SpanFormer broadens the computational span at three complementary granularities. (a) Input Image. (b) Prototype Scoring: per-window similarity to our learned prototypes (the redder, the more similar to the foreground prototype; the bluer, the more similar to the background prototype), suppressing textured background such as foliage and patterned facades. (c) Selected Windows & Clusters: after Dynamic Top-k pruning (white = pruned), the kept windows are tinted by their union-find cluster id (Cluster Memory Attention).

Methods

SpanFormer drops into standard hierarchical vision backbones (preserving standard Swin-style shifted windows and global summary tokens) and replaces the naive selection-and-attention pipeline with three lightweight modules that add less than 1% extra parameters:

  • Prototype Routing (Semantic Span): Instead of measuring raw texture variance, each stage maintains two learnable template vectors—a foreground prototype and a background prototype. Window summaries are scored via cosine similarity against these templates to learn true "objectness." An anti-collapse hinge loss ($\mathcal{L}_{\text{bal}}$) ensures both prototypes stay active rather than collapsing into a single mode.
  • Dynamic Top-$k$ (Compute Span): A tiny two-layer MLP looks at a pooled $3\times3$ grid of the scene and predicts a custom keep-ratio $r \in (0, 1)$ per image. Because sorting ($top\text{-}k$) isn't cleanly differentiable, the MLP is supervised directly against the ground-truth fraction of object-containing windows ($\mathcal{L}_{\text{dynk}}$).
  • Cluster Memory Attention / CMA (Attention Span): On the GPU, SpanFormer links kept windows into clusters on-the-fly using Union-Find if they are both semantically similar (cosine similarity $> 0.85$) and spatially close (Chebyshev distance $\le 2$). During local self-attention, a window's Keys and Values are augmented with single-token summaries from its cluster siblings. Crucially, CMA reuses the local branch's $W_K$ and $W_V$ projection matrices, expanding the receptive field at zero added projection parameter cost.
Figure 2: SpanFormer pipeline. Top: a 4-stage hierarchical backbone with Patch Partition, Linear Embedding and Patch Merging; SpanFormer modules sit inside every stage’s Global Block and Local Block (the left panels below). Global Block (left top): per-window features are first average-pooled and then refreshed by global self-attention (the flame icon marks this attention update), producing window representatives ¯xi that are scored against two learned prototypes (Blue = foreground-like, light = background-like). Local Block (left bottom): Dynamic Top-k sets a per-image keep ratio: k=0.76 in a dense scene, k=0.22 in a sparse one. Cluster Memory Attention (right): Cluster Build groups the kept windows by union-find on ¯xi; we mark one representative per cluster (diamond and 4-pointed star) and unfold its Augmented Self-Attention, where Query Tokens plus Memory Tokens are projected by shared WK, WV (and a window-only WQ) and the right Memory K, V strip widens with cluster size. In the resulting Updated Window, the flame icon again denotes that the window has been refreshed by attention, and the yellow arrows trace the cluster siblings each query attends to.

Datasets

  • PANDA: The primary evaluation benchmark, featuring gigapixel-level, human-centric wide-angle scenes. Images are tiled into $1280\times800$ patches for training and evaluated via standard COCO Average Precision (AP) protocols.
  • DOTA: An aerial object detection dataset (referenced by the authors as additional validation in the appendices). No new datasets are introduced.

Key Insights and Ideas

  • Variance is a terrible proxy for objectness: Simply swapping hand-crafted texture statistics for two learnable prototype vectors immediately boosts $\text{AP}_{50}$ by +1.0% while cutting FLOPs by nearly 24%, proving how much compute prior models wasted on trees and facades.
  • Unconstrained adaptive budgets get "lazy": Ablations show that if you remove the ground-truth fraction supervision ($\mathcal{L}_{\text{dynk}}$), the dynamic selector refuses to prune—drifting toward keeping almost everything and ballooning compute from 17.5 GFLOPs to 91.4 GFLOPs for zero accuracy gain.
  • Long-range context doesn't require heavy parameters: By routing compact window summaries rather than full $7\times7$ token grids—and sharing local $K/V$ weights—CMA connects sprawling crowds across windows while adding just 0.8 milliseconds of latency per patch.

Key Results

Plugged into the DINO detector on PANDA, SpanFormer establishes a new accuracy–efficiency Pareto frontier:

  • Accuracy & Compute: Reaches 80.3% $\text{AP}_{50}$ at 17.53 backbone GFLOPs—beating the SparseFormer baseline (78.0% at 75.71 GFLOPs, a >75% FLOPs reduction) and outperforming the recent Mixture-of-Experts GigaMoE (79.1% at 51.24 GFLOPs, a >65% FLOPs reduction). Similar gains hold with a Dynamic-Head detector (78.6% $\text{AP}_{50}$ at 17.04 GFLOPs).
  • Real-World Speed: On an RTX 3090 (batch size 16), backbone latency drops from 22.2 ms to 12.5 ms per patch ($1.78\times$ speedup) while lowering peak memory from 5.67 GB to 5.05 GB.
Figure 3: Accuracy–efficiency Pareto on PANDA. AP50 versus backbone GFLOPs; bubble area is proportional to backbone FLOPs. SpanFormer (red) sits alone in the upper-left, achieving the highest AP50 at the smallest compute among all sparse-processing detectors.

Limitations and Future Work

While the authors do not include a dedicated limitations section in the main text, a clear practical bottleneck emerges in their timing experiments: Amdahl's Law at the detection head. While SpanFormer accelerates the backbone by $1.78\times$, end-to-end DINO detector latency only improves by $1.13\times$ (from 61.1 ms to 54.2 ms per patch at batch size 3). Why? Because the unmodified DINO detection head eats up a fixed ~38 ms of runtime. Future work in gigapixel detection will likely need to extend this multi-level adaptive sparsity out of the backbone and directly into the heavy encoder/decoder detection heads.

Summary updated

BibTeX
@inproceedings{li2026spanformer,
  author = {Xiang Li and Chen Zhang and Wenxi Li and Yuetong Wang and Chenyang Lyu and Haozhe Lin and Fan Zhang and Guiguang Ding and Yuchen Guo},
  title = {{SpanFormer: Multi-Level Adaptive Sparsity for Object Detection in High-Resolution Wide Shots}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2026},
  url = {https://openreview.net/forum?id=2VF28peAaM},
}
Figure