WorksComputer Science
Anchors That Move Without Collapsing: Exclusive-Region Anchor Routing for Vision Transformers
Abstract
Anchor tokens let a vision transformer exchange global information through a few summaries, but nothing forces different anchors to summarise different things. On one shared backbone we show that a Perceiver-style pathway and an AnchorFormer pathway collapse to a single summary, the latter despite its mass normalisation (pooling-map similarity 0.99), while other soft pathways, including Representative Attention, stay partly redundant (0.59-0.79). These results concern the routing modules inside our block, not the full published models. An exclusive partition of the patch grid cannot collapse by construction, and matched component by component it is 2.4-3.6 points more accurate than Representative Attention on CIFAR-100. We then propose focus anchors, which place most anchors at the peaks of a learned importance map while all anchors keep one exclusive Voronoi partition. Focus anchors beat a fixed partition on a cluttered canvas (+1.5 points, 95% CI [0.5, 2.6]) but not on full-HD traffic-sign recognition. There, both variants match dense attention with local windows at about a fifth of its FLOPs, and the fixed partition also trains 1.5x faster per step than dense attention with FlashAttention, though both use more memory; a ViT on a downsampled input loses half its mean average precision. Hard exclusive assignment is the only region assignment we tested that is both stable and most accurate: softmax and Sinkhorn relaxations diverge, and Gumbel-softmax trains but is less accurate. We also report the limits: a ResNet-18 is more accurate on every task we trained it on in this from-scratch regime, and anchors train faster than FlashAttention only from about 1536x1536 pixels and never use less memory.
Introduction
Global self-attention in a vision transformer (ViT) [11] costs in the number of patches . A common remedy is to route global information through a small set of anchor (or latent, inducing, meta, representative) tokens: patches write into the anchors, the anchors attend to each other, and the anchors write back [25, 17, 13, 20, 33, 26].
The bottleneck only helps if the anchors carry different information. In our first anchor model, 32 anchors with learned queries converged to near-identical vectors (pairwise cosine similarity 0.987–0.995 in every block) and each pooled from almost all 196 patches (attention entropy 5.272 against a maximum of 5.278); Appendix § 11 gives the setup. The model had paid for 32 global summaries and received one. We call this anchor collapse.
This paper asks how to prevent collapse while still letting anchors concentrate on image content, and where such anchors help. Our contributions:
A controlled comparison of six anchor pathways on one backbone (§ 4), including AnchorFormer and Representative Attention implemented from their papers with their stabilisers. The Perceiver-style and AnchorFormer pathways collapse, AnchorFormer even with mass normalisation; the other soft pathways stay partly redundant. An exclusive partition cannot collapse, and a component-
matched ablation shows it is more accurate than Representative Attention, with or without the same local convolution.
Focus anchors (Sec. 3.3): coverage anchors on a coarse fixed grid plus anchors placed at the peaks of a learned importance map, all sharing one exclusive Voronoi partition.
An evaluation on four tasks with paired confidence intervals (Secs. 5 and 6). Focus anchors beat the fixed partition on Cluttered CIFAR-10 (and, not significantly, on a Tiny ImageNet canvas), but not on Megapixel MNIST or full-HD traffic signs. On full-HD images both anchor variants match dense attention at a fifth of its compute, while downsampling halves accuracy.
A study of what makes moving anchors trainable (Sec. 8): hard exclusive assignment against softmax, Sinkhorn and Gumbel-softmax relaxations, with a gradient-magnitude argument for the difference; reading from several anchors; placement hyperparameters; and a reproducible instability with its fix.
A cost comparison against dense attention with FlashAttention [10] from to (Sec. 7), with the negative results that follow from it.
Related work
Latent and anchor bottlenecks. Set Transformer inducing points [25] and the Perceiver [17] cross-attend from a learned latent array to the input; TokenLearner [32] learns a few spatial attention maps that pool tokens; Slot Attention [28] makes slots compete for inputs with a softmax over slots. In ViTs, PaCa-ViT [13] attends from patches to learned clusters, LeMeViT [20] uses learnable meta tokens, GPViT (Yang et al., 2023) propagates information through group tokens, and AnchorFormer [33] and Representative Attention [26] gather into anchors and distribute back, Representative Attention with interaction among its representatives. These methods route with soft, similarity-based weights, and several normalise the mass each representative receives to keep all representatives in use. None assigns each patch to exactly one anchor. We test AnchorFormer and Representative Attention, implemented from their papers, in Sec. 4. VECA (Song et al., 2026) also routes global information only through a small set of learned cores, trained so that the number of cores can vary at inference, and reports cores that organise semantically without supervision.
Regional tokens and partitions. RegionViT [6] attaches one regional token to each fixed window of local tokens and lets the regional tokens attend globally; our fixed partition is close to this design, and we do not claim it as new. Swin [27] and PVT (Wang et al., 2022) reduce attention cost with windows and spatial reduction. Super tokens [15] and token clustering (Zeng et al., 2022; 2024) adapt regions to the image but do not keep a fixed number of exclusive regions with explicit positions. Bi-level routing attention (Zhu et al., 2023) selects regions per query before token-level attention, and DeBiFormer [1] adds deformable agent queries. We do not compare with these methods or with VECA empirically.
Learned movement and selection. Deformable attention (Xia et al., 2022) and progressive sampling (Yue et al., 2021) learn where to sample keys or tokens; recurrent attention [29] and spatial transformers [16] learn where to look. For high-resolution inputs under a memory budget, attention sampling [21] and differentiable or iterative patch selection [8, 3] process only selected patches. Token pruning and merging [30, 4], SparseViT [7], mixture-of-depths [31], A-ViT (Yin et al., 2022) and ATS [12] skip computation for some tokens. Focus anchors move where global summaries are formed, not which patches exist. In multimodal language models, Lens [19] scores each visual token’s relevance to the question and softens low-relevance tokens with learned noise instead of removing them; focus anchors also weight patches by a learned importance, but use it to decide where global summaries are formed.
Method
Local–global–local block
An image is split into a grid of patches with embeddings and centre coordinates , normalised by the long side of the grid. The model keeps anchors with features () and positions . Each of the blocks applies (Figure 1): (1) attention within non-overlapping windows; (2) gather: each anchor pools the patches of its own region with attention restricted to , and the pooled vector is added to ; (3) global: anchors attend to each other, , the only long-range interaction; (4) scatter: each patch reads its own anchor through a sigmoid gate, ; (5) an FFN. Images are classified from the mean of the final patch tokens, or their maximum where stated (§ 6).

Figure 1. One block. Patches communicate locally inside windows and globally only through their own anchor; the attention of a ViT is replaced by attention among anchors.
Exclusive regions
Every patch belongs to its nearest anchor, , which partitions the grid into Voronoi regions . The forward pass uses the hard assignment with the gradient of the soft assignment , (straight-through ([2])): . Anchor forms queries from , with a small MLP, and pools its region with logits :
A non-empty region always sums to at least 1, because its best patch contributes , so the clamp at 1 acts only on empty regions, which occur when two moving anchors meet. With the usual clamp, empty regions produced straight-through gradients of order that made the first focus models diverge.
With anchors fixed on a grid, this block is the fixed partition (FIXED). Because the regions are disjoint, two anchors never pool the same patch, whatever the weights. This holds by construction, so zero map overlap is not by itself evidence that anchors carry useful, different information; we judge that by accuracy and by the spread of the pooled content (Eq. (2)).
Focus anchors
A fixed partition gives the empty background as many anchors as the object. Focus anchors let most anchors move to content while the partition stays exclusive. A linear head gives each patch a score and importance . In every block:
Coverage anchors. anchors stay on a fixed grid, , so every part of the image keeps a summary.
Focus anchors. The remaining anchors are placed one at a time by a soft-argmax over the scores, . After each placement the scores around are suppressed, , so the next anchor goes elsewhere (, patches). The prior pulls each focus anchor weakly towards a spread-out home position () and breaks ties early in training.
Importance in pooling. Gather logits are offset by , so anchors pool important patches more strongly; this also trains the importance head from the task loss.
All anchors then share the single Voronoi partition above: focus anchors can crowd onto content, making their regions small, but never share a patch.
Anchor collapse across anchor designs
Setup. CIFAR-100 ([22]) at (196 patches), 16 anchors, windows, 10 epochs, three seeds; every pathway sits in the same block, and only the anchor pathway changes. PERCEIVER: learned anchor queries, softmax over patches (the pilot design). COMPETITIVE: the same with a softmax over anchors, as in slot attention. ANCHORFORMER: AnchorFormer’s per-head learned anchors, softmax over anchors and mass-normalised round trip , its only described stabiliser. RPATTENTION: Representative Attention’s slot-mass-normalised gather, latent self-attention, query-driven distribution and depth-wise convolution bypass. PACA: an MLP cluster assignment. FIXED: the exclusive partition. A DENSE pathway replaces the anchors with global attention among all patches (local windows kept). Neither AnchorFormer nor Representative Attention has released code; we implemented both from their equations, with matched width and heads, as the global pathway of our block rather than as the full published models (Appendix § 13).
Metrics. For one image and block, let be anchor ’s pooling distribution and the summary it pools. We report
averaged over 1,024 test images and the 6 blocks. Similarity 1 means all anchors pool the same patches; spread is the share of the summaries’ energy that differs between anchors (0 = all anchors carry the same vector). Unlike map similarity, spread is not fixed by the partition.
Results. Table 1 and Figure 2. The PERCEIVER and ANCHORFORMER pathways collapse almost completely: map similarity 0.990–0.998 and near-zero spread, AnchorFormer despite its mass normalisation. The COMPETITIVE, PACA and RPATTENTION pathways stay partly diverse (0.59–0.79), but their summaries grow more similar with depth; Representative Attention’s stabilisers prevent full collapse, yet its summaries are far less distinct than the partition’s (spread 0.27 against 0.60).
| Pathway | Test accuracy (%) | Map similarity | Spread |
| PERCEIVER | 0.998 | 0.00 | |
| ANCHORFORMER | 0.990 | 0.06 | |
| COMPETITIVE | 0.792 | 0.22 | |
| PACA | 0.592 | 0.18 | |
| RPATTENTION (with its conv) | 0.683 | 0.27 | |
| DENSE (no anchors) | – | – | |
| FIXED | 0.000 | 0.60 | |
| RPATTENTION without conv | 0.687 | 0.28 | |
| FIXED with conv | 0.000 | 0.59 |
Table 1. Anchor collapse on CIFAR-100 at (16 anchors, 10 epochs). Mean std over seeds 42/43/44; similarity and spread averaged over blocks and seeds. Bottom: the depth-wise convolution bypass of Representative Attention removed from it, or added to the partition.

Figure 2. Collapse metrics per block (seed 42), trained (solid) and at initialisation (dashed), for the pathways of the original comparison. The PERCEIVER and ANCHORFORMER pathways converge to the same summary; the fixed partition keeps zero map similarity and the highest spread.
Our data do not single out one cause. AnchorFormer and Representative Attention route almost identically: both score each key against learned prototypes shared by all images, take a softmax over them and normalise each prototype’s mass. They differ after gathering: Representative Attention’s representatives attend to each other, and patches read them by attention over their keys, whereas AnchorFormer reads back through the same assignment in reverse (). A read-back by attention alone does not prevent collapse, however: the PERCEIVER pathway also reads back by attention, and it collapses. We have not isolated which combination of competition between anchors, interaction among them and the form of the read-back keeps anchors distinct; the exclusive partition avoids the question by construction. These results describe the routing modules in our block, trained from scratch on CIFAR-100. They do not show that the published AnchorFormer or Representative Attention models collapse or underperform as designed; both papers report results on ImageNet and dense-prediction benchmarks, which we did not reproduce.
Representative Attention is more accurate than the plain partition (+1.23 points, 95% CI [+0.02, +2.45]), but it also has a depth-wise convolution that the other pathways lack. Removing it costs Representative Attention 4.9 points ([+1.0, +8.7]); adding the same convolution to the partition gains 3.6 ([+1.3, +5.9]). Matched in this component, the exclusive partition is ahead by 2.39 points with the convolution ([+0.86, +3.91]) and by 3.63 without it ([+0.14, +7.11]), and ahead of the dense pathway by 5.4. In our setting, exclusive routing gives the most distinct summaries and the best accuracy of the anchor designs we tested; a cheap local convolution helps every pathway.
Focus anchors on cluttered canvases
Tasks. In Cluttered CIFAR-10, a CIFAR-10 image is upsampled to and pasted at a random position on a black canvas among 8 distractor fragments (random crops of other training images, upsampled to ); the object covers 6.25% of the canvas. In the Tiny ImageNet canvas, a Tiny ImageNet ([23]) image (200 classes) is pasted without resizing among 8 native crops, so downsampling the canvas also removes real detail. Seeds change initialisation, data order and canvas layouts; test canvases use a fixed layout seed.
Models. Besides FOCUS and FIXED, we train a dense ViT of the same width and depth (global attention in every block, no windows) on the full canvas and on area-downsampled and inputs, DENSE-WIN (our blocks with the anchor pathway replaced by global attention among all patches, local windows kept), and, from outside our family, PVTv2-B0 ((Wang et al., 2022)) and ResNet-18 ([14]) (no pretraining). Training recipes are in Appendix § 12. Experiments in this section have no validation split; every setting was fixed in advance except the 30-epoch learning rate. At about one in six 30-epoch runs diverged, and we chose , the DeiT scaling rule ((Touvron et al., 2021)), after comparing the test accuracy of one run at each rate at epoch 15. That rate was used for every model, and ResNet-18’s better of two rates is reported, so these numbers are slightly optimistic for all models alike.
Focus against fixed. Table 2 and Figure 4. At 10 epochs focus anchors beat the fixed partition in all six paired runs (4 and 16 anchors; per-seed values in Appendix § 14). At 30 epochs they win in all three seeds (+1.1 to +1.8 points), and the interval excludes zero. On the Tiny ImageNet canvas focus is ahead in all three seeds, but the interval includes zero.
| Model | Params | GFLOPs | Cluttered CIFAR-10 10 ep. | Cluttered CIFAR-10 30 ep. | Tiny IN 15 ep. |
| FOCUS-16 | 11.4M | 5.49 | 49.84 ± 0.26 | 66.82 ± 0.66 | 17.68 ± 0.33 |
| FOCUS-4 | 11.4M | 5.45 | 47.52 ± 1.11 | 64.67 ± 0.26 | – |
| FIXED-16 | 11.4M | 5.49 | 46.71 ± 1.72 | 65.29 ± 0.94 | 16.73 ± 0.46 |
| DENSE-WIN | 12.8M | 7.25 | – | 65.10 ± 0.45 | 20.50 ± 0.29 |
| ViT, | 9.3M | 5.28 | 46.74 ± 0.42 | 61.99 ± 0.54 | 18.25 ± 0.33 |
| ViT, | 9.2M | 1.21 | 43.20 ± 0.22 | 55.05 ± 0.26 | 12.49 ± 0.28 |
| ViT, , patch 8 | 9.0M | 1.18 | 42.39 ± 0.41 | – | 13.01 ± 0.39 |
| PVTv2-B0 | 3.4M | 1.51 | 71.83 ± 0.30 | 75.07 ± 0.25 | – |
| ResNet-18 | 11.2M | 4.74 | – | 86.11 ± 0.26 | 37.07 ± 0.28 |
| Paired gap | Cluttered, 30 ep. | Tiny IN, 15 ep. | |||
| FOCUS-16 − FIXED-16 | +1.54 [+0.53, +2.55] | +0.95 [−0.93, +2.83] | |||
| FOCUS-16 − DENSE-WIN | +1.72 [−0.80, +4.25] | −2.82 [−3.99, −1.66] | |||
| FIXED-16 − DENSE-WIN | +0.19 [−2.71, +3.08] | −3.77 [−4.65, −2.90] | |||
| FOCUS-16 − ViT | +11.77 [+9.73, +13.82] | +5.19 [+4.43, +5.95] |
Table 2. Cluttered CIFAR-10 and Tiny ImageNet canvas: test accuracy (%), mean ± std over 3 seeds. GFLOPs per image include attention. Bottom: paired gaps, mean [95% CI].
Figure 4. Test accuracy during training, mean over 3 seeds (band: min–max; omitted for ResNet-18, whose per-epoch test accuracy fluctuates strongly). Anchor models solid, baselines dashed or dotted.
Against dense attention. Dense attention with the same local windows (DENSE-WIN) closes the anchors’ lead over the plain dense ViT on Cluttered CIFAR-10: the fixed partition is level with it (+0.19), and focus anchors are ahead in every seed without a significant gap (+1.72 [−0.80, +4.25]), at 5.49 against 7.25 GFLOPs. On the Tiny ImageNet canvas DENSE-WIN is the best transformer, 2.8 points ahead of focus anchors. So the anchors’ earlier advantage over the dense ViT was largely locality, and global attention among all patches is better when the whole object carries fine detail.
Against downsampling and established models. Focus anchors beat a ViT on a or input by 4.7–11.8 points on both tasks. PVTv2-B0 and ResNet-18 are far more accurate (75.1% and 86.1% against 66.8% on Cluttered CIFAR-10); trained from scratch on 50k–100k images for 15–30 epochs, the convolutional bias of these models matters more than how a plain transformer routes global information. Our claims are about anchor routing within transformers of this kind.
Where the anchors go. Figure 3: focus anchors gather on all image content, the object and the distractors, and leave the empty background to a few large coverage regions. The importance map learns where there is content, not where the class object is, which is what we expect when the distractors are real image fragments. Conditioning the importance on a query, as question-conditioned relevance scoring does in multimodal models [19], might steer anchors to the object; we have not tested this. With 4 anchors, the share whose region contains the object rises from 0.44 in the first block to 0.57 in the last, against 0.39 for the fixed partition. Moving anchors that take one importance-weighted Lloyd step inside their own region per block find the object in their importance map but move only about one patch, because a Lloyd step cannot leave its region: placement must be global, then partitioned.

Figure 3. Final-block regions (colours) and anchor positions in each block (dots, darker = later) of FOCUS-16 on four test canvases; the white box is the object.
High-resolution images
Tasks. Megapixel MNIST (Karhathpoulos & Fleuret, 2019): five native MNIST [24] digits, three of the target class and two of another, among 12 stroke-like noise patches on a canvas; the label is the majority digit. Training layouts are drawn afresh every epoch (10,000 per epoch); validation and test use 1,000 fixed layouts each, with digits from held-out MNIST training images and from the MNIST test set. DFG traffic signs (Tabernik & Skočaj, 2020): 1920 × 1080 street scenes; we recognise which of the 20 most frequent sign types are present (multi-label, mean average precision over classes, chance 3.1%). The official split is kept (4,480 training, 774 validation from blocks of consecutive frames, 1,703 test frames); the median sign is 134 pixels wide and 10% are under 45. Both tasks have validation splits and settings fixed in advance (AdamW, learning rate , batch 32, gradient clipping and warmup; ResNet-18 at ); 30 and 20 epochs. Anchor models use 64 anchors (16 coverage, 48 focus) on rectangular patch grids, with positions in units of the long side.
Pooling. With average pooling over the final tokens, every model stayed near chance on DFG (8–12 mAP), including an ImageNet-pretrained ResNet-18 (8.7). We checked the pipeline (Appendix § 17): the metric matches a reference implementation, boxes align with signs, and a pretrained ResNet-18 memorises 64 training frames to 100 mAP. With max pooling the same pretrained ResNet-18 reaches 47.8 mAP in 6 epochs: averaging over a full-HD frame washes out signs that cover under 1% of it. All DFG results below use max-pooled heads for every model.
Results. Table 3. On DFG, downsampling halves accuracy: a ViT on a 480-pixel-wide input reaches 15.8 mAP against 28.6–30.3 for the anchor models and both dense models at full resolution (fixed − downsampled ViT +13.8 [+12.6, +15.1]). Both anchor models match dense attention at about a fifth of its FLOPs: focus − dense-win +0.00 [−4.2, +4.2], fixed − dense ViT +1.0 [−1.1, +3.1]. Focus and fixed anchors are not distinguishable (+0.67 [−1.90, +3.23]). The official split interleaves frames from the same video sequences, so test images can be near-duplicates of training images; on our validation split, which holds out whole blocks of frames, every conclusion is the same (downsampled ViT 18.7 against 38.9–40.0 at full resolution, anchors level with dense attention, ResNet-18 best), and the near-duplicates are shared by all models alike. On
Table 3: High-resolution tasks, mean std over 3 seeds. Megapixel MNIST: test accuracy (%); focus anchors over seeds 43 and 44 (seed 42: § 8). DFG: mAP with max-pooled heads on the official test split and on our validation split, which holds out blocks of consecutive frames; GFLOPs per DFG image.
| Model | Megapixel MNIST, , test | DFG, , test | DFG, , validation | GFLOPs |
| FOCUS-64 | 91.15 0.92 | 30.28 0.88 | 38.89 1.52 | 187 |
| FIXED-64 | 91.87 0.35 | 29.62 0.20 | 40.00 1.30 | 187 |
| DENSE-WIN | 91.40 0.20 | 30.28 0.85 | 38.92 1.65 | 912 |
| Dense ViT, full resolution | 86.10 0.96 | 28.60 0.64 | 39.54 0.88 | 846 |
| ViT, / 256-wide | 93.37 2.40 | – | – | – |
| ViT, / 480-wide | 87.50 1.90 | 15.80 0.67 | 18.66 0.05 | 13 |
| PVTv2-B0 | 97.43 0.21 | 19.50 1.75 | 22.29 3.29 | 195 |
| ResNet-18 | 99.30 0.26 | 36.51 1.65 | 44.48 0.54 | 160 |
Table 3.
Megapixel MNIST the anchor models and DENSE-WIN are level (fixed − DENSE-WIN +0.47 [−0.25, +1.18]) and 5.3–5.8 points above the dense ViT without windows. At the digits remain legible at half resolution, and the ViT is not significantly different from the anchors (+1.50 [−3.6, +6.6]); only at (digits of 7 pixels) does downsampling cost accuracy (fixed − ViT +4.37 [+0.47, +8.27]). ResNet-18 is best on both tasks; PVTv2 is strong on Megapixel MNIST but weak on DFG, where its early spatial reduction may lose small signs.
Taken with § 5: moving the anchors paid off only on Cluttered CIFAR-10, a single object among real image fragments, and not on Megapixel MNIST’s several digits among strokes; at high resolution the value of anchors is keeping full resolution at a fraction of the cost of dense attention, not better accuracy than it.
Cost
Table 4. Against plain attention, whose memory grows quadratically, the anchor models are much cheaper and the dense ViT runs out of memory from . Against FlashAttention (Dao et al., [10]), the fair comparison, the picture is narrower. The fixed partition trains faster from about : at full HD and at . Focus anchors only overtake it at , because placing 48 anchors one at a time adds 56–161 ms per step that does not shrink with resolution. Both anchor models always use more training memory than FlashAttention (18.5–20.2 against 11.1 GB at ): our masked gather and scatter are not fused into memory-efficient kernels. At (Appendix § 18) dense attention is cheap and the anchors are 1.9–3.1 slower. Established efficient transformers are faster still: in an earlier inference measurement at , PVTv2-B1 and EfficientViT-B2 (Cai et al., [5]) were and faster than the fixed partition.
Table 4: Training step at batch 8 in ms (peak training memory in GB), untrained models, one A100, bf16, measured alone. Dense ViT with the fused FlashAttention kernel or with plain attention.
| Resolution | Dense ViT, FlashAttention | Dense ViT, plain | FIXED-64 | FOCUS-64 |
| 11.5 (0.9) | 44.8 (2.6) | 44.7 (1.4) | 196.9 (1.5) | |
| 58.9 (3.0) | 548.6 (30.0) | 68.5 (4.8) | 196.7 (5.3) | |
| 198.4 (6.3) | out of memory | 134.9 (10.5) | 296.2 (11.5) | |
| 533.6 (11.1) | out of memory | 232.1 (18.5) | 288.2 (20.2) | |
| 187.9 (6.4) | out of memory | 128.0 (10.4) | 204.2 (11.3) |
Table 4.
What makes moving anchors trainable
Hard against soft assignment. Table 5. Replacing the hard straight-through assignment by its softmax relaxation diverged in every seed, with gradient norms up to . Balancing the soft assignment with three log-domain Sinkhorn iterations Cuturi [9], so that every anchor receives the same mass, delays but does not prevent divergence. Gumbel-softmax Jang et al. [18] with a temperature annealed from 1.0 to 0.1 is the only soft variant that trains: in two seeds it ends 2.5 and 4.3 points below the hard reference, and in the third it trained normally to epoch 8 and diverged as the temperature approached 0.1. The closer the soft assignment gets to hard, the larger its gradients; the straight-through hard assignment has the hard forward pass without that instability. Hard exclusive assignment is the only region assignment we tested that is both stable and most accurate.
Why the straight-through assignment stays stable. A gradient-magnitude argument explains part of this. Under the straight-through assignment the forward pass uses only the hard regions, and the gradient reaches an anchor position only through the soft assignment at the fixed temperature :
since , in normalised coordinates, and . The pooling weights of Eq. (1) divide by a denominator of at least 1 and use , so each derivative is at most 2 in magnitude, and the factor that multiplies this Jacobian is bounded by a small multiple of the loss gradient on the pooled values. Neither factor depends on how sharp the partition is or on how close two anchors are. A relaxation that uses the soft assignment in the forward pass at temperature has the same Jacobian with replaced by , so its bound grows as , and it must sharpen () to approach the hard partition that performs best. This matches the Gumbel-softmax runs, which trained normally while was large and diverged in one seed as approached 0.1, a tenfold larger bound. The argument does not explain why the plain softmax relaxation also diverges at ; there the forward pass mixes neighbouring regions, and focus anchors pulled towards the same content keep many patches near region boundaries, where is largest, but we have not isolated this mechanism.
Reading from several anchors. If each patch reads from its nearest anchors, weighted by the distance softmax, while gathering stays exclusive, changes nothing and is ahead in all three seeds by +0.83 points without a significant gap. Exclusivity matters on the gather side; the scatter side can be relaxed.
Placement. Suppression does not change accuracy once training is stabilised, but without clipping one of three runs without suppression diverged; the home prior adds 2.6 points in the original recipe; the coverage grid makes no measurable difference. Placement is robust within about a factor of two of , and , and breaks when suppression is much stronger (, −4.4 points) or wider ( patches, training stalls near 20%) (Appendix § 15).
A reproducible instability. On Megapixel MNIST at learning rate , focus anchors trained cleanly for seeds 43 and 44 (90.5% and 91.8%), but seed 42 became unstable at epoch 13: the median gradient norm rose from about 5 to over 1,000, clipping kept the run from diverging, and it ended at 79.0%. Training is deterministic for a seed and schedule; a rerun reproduced the run exactly. The largest gradients appeared first in the patch embedding and the first block’s local attention, with the importance head among them. At learning rate the same seed trained without a single gradient spike (88.7%); with 16 instead of 64 anchors at it was worse (64.4%). In this case the instability depended on the step size rather than on the number of focus anchors; we recommend the lower rate for focus anchors at this scale, but have tested it on this one seed only.
Limitations
All models are trained from scratch for 10–30 epochs on at most 100k images; we have no pretraining or ImageNet-scale results, and a ResNet-18 is more accurate on every task we trained it on. Three seeds give wide intervals; the sensitivity sweep and several skipping rows use one or two seeds. § 4–§ 5 have no validation split and one learning rate was chosen on test accuracy; § 6 uses validation splits and settings fixed in advance. AnchorFormer and Representative Attention are implemented from their papers, without official code, and used as the global pathway of our block rather than as the full published models; the PaCa-style pathway is simplified. Our conclusion that hard assignment is the most stable and accurate holds for the relaxations we tested (softmax, Sinkhorn, Gumbel-softmax); we did not test diversity or orthogonality regularisers on soft anchors, nor routing methods such as BiFormer, DeBiFormer or VECA. DFG’s official split interleaves frames from the same video sequences (our block-held-out validation split gives the same conclusions), and its image-level labels make it a weakly supervised task; we needed max pooling for any model to learn it. The importance map marks content in general rather than the class object, and it does not choose patches for computation better than random (Appendix § 16). Our implementation is not fused: below about it is slower than FlashAttention, and it never uses less memory.
Conclusion
Anchor bottlenecks only pay off if the anchors stay different. Perceiver-style and AnchorFormer anchors collapse to a single summary, the latter even with mass normalisation; other soft pathways, Representative Attention included, stay partly redundant, and we could not tie the difference to a single design choice. An exclusive partition prevents collapse by construction and, matched component by component, routes most accurately among the designs we tested. Focus anchors keep that guarantee while moving to image content; they beat a fixed partition on a cluttered CIFAR-10 canvas, though not on our high-resolution tasks, and on full-HD images both keep full resolution at a fifth of the cost of dense attention, where downsampling halves accuracy. Hard exclusive assignment is what makes moving anchors trainable. The gains are within transformers trained from scratch; next steps are fused kernels and parallel placement, pretrained backbones, tasks that need long-range relations between distant small objects, and video, where most tokens are uninformative.
Broader Impact Statement
This work studies an architectural component of vision transformers on public benchmarks (CIFAR, Tiny ImageNet, MNIST, DFG traffic signs). We do not foresee direct negative impacts beyond those of image recognition models in general. Traffic-sign recognition is safety-relevant; our models are research prototypes far from the accuracy required for deployment.
Code availability. Code, per-run logs and result files for every experiment: https://github.com/ARRY7686/Partitioned-Residual-Anchor-Routing-Transformer.
The pilot model
The pilot (RART-32) is the block of Figure 1 with PERCEIVER routing (32 learned anchor queries, softmax over patches, standard read-back), embedding width 384, anchor width 128, depth 6, on CIFAR-100 at 224² (14 14 patches), trained for 10 epochs with AdamW (learning rate 3 10, cosine schedule), one seed. It reached 39.73% test accuracy, against 45.44% for a ViT of the same width and depth and 42.21% for the same model with 16 anchors. The anchors’ pairwise cosine similarity in blocks 1–6 was 0.9887, 0.9865, 0.9900, 0.9920, 0.9935 and 0.9950, the mean attention entropy over patches 5.272 (maximum 5.278 for 196 patches), and the mean similarity between anchor attention maps 0.9995.
| Collapse | Cluttered, 10 ep. | Cluttered, 30 ep. | Tiny IN | High resolution | |
| Data | CIFAR-100 | CIFAR-10 canvas | CIFAR-10 canvas | Tiny IN canvas | MMNIST / DFG |
| Epochs | 10 | 10 | 30 | 15 | 30 / 20 |
| Batch | 128 | 128 | 128 | 128 | 32 |
| Learning rate | |||||
| Clip / warmup | – | –* | |||
| Augmentation | flip | flip | flip | flip | none |
| Precision | fp16 | fp16 / bf16 | bf16 | bf16 | bf16 |
Table 6. Training settings. All runs: AdamW, weight decay 0.05, cosine schedule, from scratch. “Clip”: gradient-norm clipping; “warmup”: linear, in epochs.
*Clip 1.0 / warmup 2 for the variants of Table 5 and the skipping runs marked “clip”. ResNet-18: learning rate for the 30-epoch, Tiny ImageNet and high-resolution runs.
| Variant | Test accuracy (%) | Note |
| Reference: hard assignment, own anchor | 53.78 ± 0.09 | |
| Soft (softmax) assignment | 10.00 / 10.00 / 10.00 | diverged in all seeds |
| Soft + Sinkhorn balancing | 9.98 / 10.00 / 12.44 | peaked at 26–39%, then diverged |
| Soft Gumbel-softmax, annealed | 22.08 / 49.53 / 51.30 | seed 42 diverged at epoch 9 |
| Read from 2 nearest anchors | 53.76 ± 0.19 | −0.03 [−0.35, +0.30] |
| Read from 3 nearest anchors | 54.61 ± 0.55 | +0.83 [−0.55, +2.20] |
| No suppression | 53.57 ± 0.43 | −0.21 [−1.51, +1.08] |
Table 5. Routing variants of FOCUS-16 on Cluttered CIFAR-10, 10 epochs, gradient clipping 1.0 and 2-epoch warmup, seeds 42/43/44. Paired gaps against the reference, mean [95% CI].
Training recipes
Reimplementing AnchorFormer and Representative Attention
Neither method has released code (the Representative Attention repository contained only a README and figures in November 2026). AnchorFormer (Shan et al., [33]): keys and values are projected per head; learned anchors per head score every key, ; with the output is (their Eqs. 11–13), heads concatenated and projected. The mass normalisation is the only stabiliser the paper describes. Representative Attention (Li et al., [26]): per-head learned representatives ; assignments , unscaled as in their appendix Eq. 14; slot-mass normalisation , ; latent keys and values , , layer-normalised; residual self-attention among the latents with queries, keys and values derived from the normalised latent values; patches read the refined latents by query attention over the normalised latent keys; and a depth-wise convolution on the patch values is added before the output projection (their Eqs. (2)–10, kernel size 3). Both modules use width 128 and 4 heads like the other pathways (10.1M and 10.5M parameters in total, against 11.3M for the partition) and replace only the anchor pathway of our block; the published models use them as the only attention.
Per-seed results
| seed 42 | seed 43 | seed 44 | mean | 95% CI | |
| 4 anchors | +1.71 | +1.23 | +1.51 | +1.48 | [+0.88, +2.08] |
| 16 anchors | +1.53 | +2.90 | +4.96 | +3.13 | [−1.16, +7.42] |
Table 7. Paired gaps FOCUS − FIXED on Cluttered CIFAR-10 at 10 epochs.
Individual seeds of every run are listed in the repository’s result files and summary.
Placement sensitivity
In the original 10-epoch recipe (no clipping), removing the home prior cost 2.6 points (47.23 ± 1.17 against 49.84 ± 0.26), removing the coverage grid or using a grid made no measurable difference (49.63 and 49.40), and removing suppression diverged in one of three seeds.
Table 8: FOCUS-16 on Cluttered CIFAR-10, 10 epochs, clip and warmup, seed 42; one parameter changed at a time from , patches, (reference 53.68).
| Setting | Test accuracy (%) | |
| 53.98 | +0.30 | |
| 49.33 | −4.35 | |
| 53.59 | −0.09 | |
| 21.88 | −31.80 | |
| 52.90 | −0.78 | |
| 52.26 | −1.42 |
Table 8.
Skipping per-patch computation
From block 3 on, only a fraction of patches go through the FFN; the others skip it but have already received their anchor’s global update. Keeping 25% of patches removes 25% of the linear-layer FLOPs (5.31 to 3.96 GFLOPs). With clipping and warmup, random selection costs −0.38 points ([−1.48, +0.71]; 53.40 ± 0.35 against 53.78 ± 0.09). Selecting by the learned importance map is not better than random or token-norm selection (seed 42: 49.25 against 50.49 and 50.87), and training through a straight-through importance gate is fragile: a ratio gate destabilised training at 50% kept (38.25%), and a bounded gate diverged in every run, also with clipping.
DFG pipeline checks
Before trusting the near-chance DFG scores with average pooling (Table 9) we checked the pipeline: our mean average precision equals scikit-learn’s on random data (57.850 both); rendered frames show the label boxes on the signs; the labels have 39–392 positive training images per class; and an ImageNet-pretrained ResNet-18 memorises 64 training frames to 100 mAP in 30 passes. The same pretrained network fine-tuned on all frames for 6 epochs reaches 8.74 mAP with average pooling and 47.76 with max pooling. A first
Table 9: DFG with average-pooled heads, seed 42, 20 epochs, test mAP (chance 3.1).
| FOCUS-64 | FIXED-64 | DENSE-WIN | Dense ViT | ViT 480-wide | ResNet-18 | |
| mAP | 8.10 | 8.14 | 12.35 | 11.02 | 8.76 | 8.33 |
Table 9.
Megapixel MNIST setting, canvases with 50 noise patches and 5,000 fixed training layouts, did not train: focus anchors stayed at chance (11.6% after 10 epochs, training loss at ). The setting with fresh layouts was chosen after a 3-epoch probe.
Cost at
Table 10: Cost at on one A100 (bf16, untrained, measured alone), training step at batch 128.
| Model | GFLOPs | Train step | Train memory | Inference |
| FOCUS-16 | 5.49 | 99.3 ms | 4.53 GB | 5,259 img/s |
| FOCUS-4 | 5.45 | 70.8 ms | 4.24 GB | 6,207 img/s |
| FIXED-16 | 5.49 | 60.7 ms | 4.31 GB | 6,408 img/s |
| ViT, | 5.28 | 32.4 ms | 3.11 GB | 11,176 img/s |
| ViT, | 1.21 | 20.6 ms | 1.17 GB | 39,339 img/s |
| PVTv2-B0 | 1.51 | 52.4 ms | 4.94 GB | 6,310 img/s |
Table 10.
References
- [1]NguyenHuu BaoLong, Chenyu Zhang, Yuzhi Shi, Tsubasa Hirakawa, Takayoshi Yamashita, Tohgoroh Matsui, and Hironobu Fujiyoshi. DeBiFormer: Vision transformer with deformable agent bi-level routing attention. In Asian Conference on Computer Vision (ACCV), pp. 445–462, 2024.arxiv.org/abs/2410.08582
- [2]Yoshua Bengio, Nicholas Léonard, and Aaron Courville. Estimating or propagating gradients through stochastic neurons for conditional computation. arXiv:1308.3432, 2013.arxiv.org/abs/1308.3432
- [3]Benjamin Bergner, Christoph Lippert, and Aravindh Mahendran. Iterative patch selection for high-resolution image recognition. In International Conference on Learning Representations (ICLR), 2023.arxiv.org/abs/2210.13007
- [4]Daniel Bolya, Cheng-Yang Fu, Xiaoliang Dai, Peizhao Zhang, Christoph Feichtenhofer, and Judy Hoffman. Token merging: Your ViT but faster. In International Conference on Learning Representations (ICLR), 2023.arxiv.org/abs/2210.09461
- [5]Han Cai, Junyan Li, Muyan Hu, Chuang Gan, and Song Han. EfficientViT: Lightweight multi-scale attention for high-resolution dense prediction. In IEEE/CVF International Conference on Computer Vision (ICCV), 2023.DOI
- [6]Chun-Fu Chen, Rameswar Panda, and Quanfu Fan. RegionViT: Regional-to-local attention for vision transformers. In International Conference on Learning Representations (ICLR), 2022.arxiv.org/abs/2106.02689
- [7]Xuanyao Chen, Zhijian Liu, Haotian Tang, Li Yi, Hang Zhao, and Song Han. SparseViT: Revisiting activation sparsity for efficient high-resolution vision transformer. In IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), 2023.arxiv.org/abs/2303.17605
- [8]Jean-Baptiste Cordonnier, Aravindh Mahendran, Alexey Dosovitskiy, Dirk Weissenborn, Jakob Uszkoreit, and Thomas Unterthiner. Differentiable patch selection for image recognition. In IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), 2021.arxiv.org/abs/2104.03059
- [9]Marco Cuturi. Sinkhorn distances: Lightspeed computation of optimal transport. In Advances in Neural Information Processing Systems, 2013.
- [10]Tri Dao, Daniel Y. Fu, Stefano Ermon, Atri Rudra, and Christopher Ré. FlashAttention: Fast and memory-efficient exact attention with IO-awareness. In Advances in Neural Information Processing Systems, 2022.arxiv.org/abs/2205.14135
- [11]Alexey Dosovitskiy, Lucas Beyer, Alexander Kolesnikov, Dirk Weissenborn, Xiaohua Zhai, Thomas Unterthiner, Mostafa Dehghani, Matthias Minderer, Georg Heigold, Sylvain Gelly, Jakob Uszkoreit, and Neil Houlsby. An image is worth 16x16 words: Transformers for image recognition at scale. In International Conference on Learning Representations (ICLR), 2021.
- [12]Mohsen Fayyaz, Soroush Abbasi Koohpayegani, Farnoush Rezaei Jafari, Sunando Sengupta, Hamid Reza Vaezi Joze, Eric Sommerlade, Hamed Pirsiavash, and Jürgen Gall. Adaptive token sampling for efficient vision transformers. In European Conference on Computer Vision (ECCV), LNCS, pp. 396–414, 2022.
- [13]Ryan Grainger, Thomas Paniagua, Xi Song, Naresh Cuntoor, Mun Wai Lee, and Tianfu Wu. PaCa-ViT: Learning patch-to-cluster attention in vision transformers. In IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), 2023.arxiv.org/abs/2203.11987
- [14]Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Deep residual learning for image recognition. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition (CVPR), pp. 770–778, 2016.arxiv.org/abs/1512.03385
- [15]Huaibo Huang, Xiaoqiang Zhou, Jie Cao, Ran He, and Tieniu Tan. Vision transformer with super token sampling. In IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), 2023.arxiv.org/abs/2211.11167
- [16]Max Jaderberg, Karen Simonyan, Andrew Zisserman, and Koray Kavukcuoglu. Spatial transformer networks. In Advances in Neural Information Processing Systems (NeurIPS), 2015.arxiv.org/abs/1506.02025
- [17]Andrew Jaegle, Felix Gimeno, Andy Brock, Andrew Zisserman, Oriol Vinyals, and Joao Carreira. Perceiver: General perception with iterative attention. In International Conference on Machine Learning (ICML), 2021.arxiv.org/abs/2103.03206
- [18]Eric Jang, Shixiang Gu, and Ben Poole. Categorical reparameterization with Gumbel-softmax. In International Conference on Learning Representations, 2017.arxiv.org/abs/1611.01144
- [19]Kai Jiang, Ruishu Zhu, Siqi Huang, Hongyuan Zhang, and Xuelong Li. Latent noise mask for reducing visual redundancy in multimodal large language models. arXiv:2606.30168, 2026.
- [20]Wentao Jiang, Jing Zhang, Di Wang, Qiming Zhang, Zengmao Wang, and Bo Du. LeMeViT: Efficient vision transformer with learnable meta tokens for remote sensing image interpretation. In International Joint Conference on Artificial Intelligence (IJCAI), 2024.
- [21]Angelos Katharopoulos and François Fleuret. Processing megapixel images with deep attention-sampling models. In International Conference on Machine Learning (ICML), 2019.arxiv.org/abs/1905.03711
- [22]Alex Krizhevsky. Learning multiple layers of features from tiny images. Technical report, University of Toronto, 2009.
- [23]Ya Le and Xuan Yang. Tiny ImageNet visual recognition challenge. Technical report, Stanford University, CS231N course report, 2015.
- [24]Yann LeCun, Léon Bottou, Yoshua Bengio, and Patrick Haffner. Gradient-based learning applied to document recognition. Proceedings of the IEEE, 86(11):2278–2324, 1998.
- [25]Juho Lee, Yoonho Lee, Jungtaek Kim, Adam Kosiorek, Seungjin Choi, and Yee Whye Teh. Set transformer: A framework for attention-based permutation-invariant neural networks. In International Conference on Machine Learning (ICML), 2019.
- [26]Yuntong Li, Hainuo Wang, Hengxing Liu, Mingjia Li, and Xiaojie Guo. Representative attention for vision transformers. arXiv:2605.14913, 2026.arxiv.org/abs/2605.14913
- [27]Ze Liu, Yutong Lin, Yue Cao, Han Hu, Yixuan Wei, Zheng Zhang, Stephen Lin, and Baining Guo. Swin transformer: Hierarchical vision transformer using shifted windows. In IEEE/CVF International Conference on Computer Vision (ICCV), 2021.
- [28]Francesco Locatello, Dirk Weissenborn, Thomas Unterthiner, Aravindh Mahendran, Georg Heigold, Jakob Uszkoreit, Alexey Dosovitskiy, and Thomas Kipf. Object-centric learning with slot attention. In Advances in Neural Information Processing Systems (NeurIPS), 2020.arxiv.org/abs/2006.15055
- [29]Volodymyr Mnih, Nicolas Heess, Alex Graves, and Koray Kavukcuoglu. Recurrent models of visual attention. In Advances in Neural Information Processing Systems (NeurIPS), 2014.arxiv.org/abs/1406.6247
- [30]Yongming Rao, Wenliang Zhao, Benlin Liu, Jiwen Lu, Jie Zhou, and Cho-Jui Hsieh. DynamicViT: Efficient vision transformers with dynamic token sparsification. In Advances in Neural Information Processing Systems (NeurIPS), 2021.
- [31]David Raposo, Sam Ritter, Blake Richards, Timothy Lillicrap, Peter Conway Humphreys, and Adam Santoro. Mixture-of-depths: Dynamically allocating compute in transformer-based language models. arXiv:2404.02258, 2024.
- [32]Michael S. Ryoo, AJ Piergiovanni, Anurag Arnab, Mostafa Dehghani, and Anelia Angelova. TokenLearner: Adaptive space-time tokenization for videos. In Advances in Neural Information Processing Systems (NeurIPS), 2021.
- [33]Jiquan Shan, Junxiao Wang, Lifeng Zhao, Liang Cai, Hongyuan Zhang, and Ioannis Liritzis. AnchorFormer: Differentiable anchor attention for efficient vision transformer. arXiv:2505.16463, 2025.
