An exhaustive map of layer-subset selection in a pretrained ViT
Removing whole blocks reduces the parameter count and FLOPs of a pretrained transformer without requiring sparse kernels. We exhaustively evaluate all 212−1 = 4095 nonempty block subsets of a 12-block vision foundation model (DINOv3 ViT-S/16) after three-epoch end-to-end finetuning on ImageNet-1k. Under this protocol, top-1 accuracy varies by as much as 28.6 percentage points among subsets of the same block budget.
A common baseline, prefix truncation, simply retains the first k blocks. Its accuracy falls below the mean of all subsets at every pruned depth k ∈ {1,…,11}, so a uniformly selected subset has higher expected accuracy. The value of a block is also budget-dependent: early and late blocks exchange importance as the budget increases, while the final block remains beneficial throughout. Modest local search on the complete landscape approaches the best observed subsets and outperforms random search. We release the complete measured landscape as a benchmark for budget-conditional structured on-device compression.
Every subset with k blocks has the same deployed size, 0.68M + 1.77M·k parameters, and the same block-level FLOPs. Yet the spread between the best and worst k-block model grows from 7.3 points at k=2 to 28.6 at k=6 before shrinking to 2.4 at k=11. The best 4-block network (52.09%, 7.8M parameters) beats the worst 7-block network (50.36%, 13.1M) with 41% fewer parameters.
Hover a point to see its blocks; click to load it into the picker above. Points are spread horizontally within each k for legibility only.
Keeping the first k blocks is the obvious static rule, and early-exit methods implicitly use it. In this model it ranks below the subset mean at every pruned depth. At least 94% of subsets beat it for k ∈ {7,8,9}, and every other subset beats it at k ∈ {10,11}.
Percentage of the C(12,k) subsets scoring strictly below truncation. The dashed line is the median: below it, truncation is worse than a coin flip over subsets.
For every k from 3 to 11 the best observed subset keeps blocks 3, 4 and 12 and drops block 1. At intermediate depths it adds a run of later blocks (7–8 at k=5, 7–11 at k=8). In 4 of the 11 steps from k to k+1, the best subset swaps a block out, so no procedure that only adds or only removes blocks recovers the best subset at every budget.
Right column: gain of the best subset over truncation (pp). Click a row to load it.
Cell = mean accuracy of k-block subsets that contain the block minus the mean of those that omit it (pp). Red is positive, blue negative. Only block 12 stays positive at every budget.
At k=4, subsets containing block 3 average 45.96% against 42.52% for those without it, so m3(4) = +3.45. At k=8 the same contrast is −0.61. A ranking computed at one budget need not transfer to another, which is a problem for methods that score blocks once on the full model and reuse that ranking. Keeping block 12 alone is not enough either: the first k−1 blocks plus block 12 beat truncation at every budget but still sit below the subset mean for every k ≥ 5.
Deleting a single block and finetuning the remaining 11 costs between 0.66 points (block 1) and 3.10 points (block 12). The cost generally grows with depth, the opposite of LLM pruning practice, which tends to drop deeper blocks. If those costs added up, deleting blocks i and j would cost di+dj. Instead every one of the 66 pairs costs more than the sum, and the resulting additive predictor ranks subsets backwards at tight budgets.
Top-1 after deleting one block and finetuning the other 11. The line marks the full model (80.96%).
Each dot is a deleted pair. x: sum of the two single-deletion changes; y: measured change. Every dot sits below the identity line (super-additive).
Spearman ρ between Â(S) = A − Σi∉S di and measured accuracy within each k. Negative means the predictor tends to rank better subsets lower.
Best accuracy found minus best observed, averaged over k ∈ {3,…,9} and 300 trials. Bands: 10th–90th percentile across trials. Recomputed in your browser from the released landscape.
Because every subset is measured, a search strategy can be replayed by lookup, with no training. Each lookup is charged against a budget B; in a new setting each one would cost a 3-epoch ImageNet finetune (36–80 GPU-minutes on an RTX 8000 for k = 3 to 9). Local search starts from a random subset, tries swapping one kept block for one dropped block in random order, moves on the first improvement, and restarts when stuck. In the paper's 300-trial replay it comes within 0.18 points of the best observed subset at B=50 and 0.02 at B=100; uniform sampling leaves 0.79 and 0.50. Truncation and the additive predictor fall short by 8.5 and 15.4 points.
Best-so-far accuracy against evaluations used. The dashed line is the best observed subset at this k; the orange line is truncation, which needs no search.
The 4,095 three-epoch runs took 4,034 GPU-hours on NVIDIA RTX 8000s, one GPU per candidate. A search with B=50 at k = 3, 6 or 9 would cost roughly 30, 48 or 66 GPU-hours. Random-search candidates train independently; local search can run restarts or neighbour evaluations in parallel.
Median and interquartile runtime per candidate; search cost = B × median runtime at that depth.
For 160 subsets the authors also finetuned for 30 epochs. Their 3-epoch and 30-epoch accuracies agree closely in rank (Spearman ρ = 0.99), which supports the short protocol for screening. Freezing the backbone is not an option: removing a single block with a frozen backbone costs between 7.6 and 74.9 points more than finetuning the same subset.
Color: number of retained blocks, light (few) to dark (many). Dashed: least-squares fit.
| Model | facebook/dinov3-vits16-pretrain-lvd1689m · 12 blocks, width 384, patch 16. Kept blocks are copied into a compact encoder in their original order; patch embedding, special tokens, RoPE and final norm are retained. |
| Head | Freshly initialised linear classifier (1,000 classes) on the normalised CLS token. |
| Training | AdamW, lr 1e-3 head / 1e-4 backbone, weight decay 0.05, batch 256, 3 epochs, seed 42; random resized crop 224 + flip. |
| Metric | Best ImageNet-1k validation top-1 over the three epochs (resize 256, center crop 224). |
@inproceedings{jung2026blocks,
title = {Which Transformer Blocks Should You Keep? An Exhaustive Map of
Layer-Subset Selection in a Pretrained ViT},
author = {Jung, Steffen and Keuper, Margret},
booktitle = {NeurIPS 2026 Workshop on On-Device Intelligence: Foundation
Models under Real-World Constraints},
year = {2026},
url = {https://openreview.net/forum?id=YOQiEN1fCo}
}