Papers › Nested Hierarchical Transformer: Towards Accurate, Data-Efficient and Interpretable...

Nested Hierarchical Transformer: Towards Accurate, Data-Efficient and Interpretable Visual Understanding

26 May 2021arXiv:2105.12723archive 2025-07-28

Zizhao Zhang, Han Zhang, Long Zhao, Ting Chen, Sercan O. Arik, Tomas Pfister

Hierarchical structures are popular in recent vision transformers, however, they require sophisticated designs and massive datasets to work well. In this paper, we explore the idea of nesting basic local transformers on non-overlapping image blocks and aggregating them in a hierarchical way. We find that the block aggregation function plays a critical role in enabling cross-block non-local information communication. This observation leads us to design a simplified architecture that requires minor code changes upon the original vision transformer. The benefits of the proposed judiciously-selected design are threefold: (1) NesT converges faster and requires much less training data to achieve good generalization on both ImageNet and small datasets like CIFAR; (2) when extending our key ideas to image generation, NesT leads to a strong decoder that is 8× faster than previous transformer-based generators; and (3) we show that decoupling the feature learning and abstraction processes via this nested hierarchy in our design enables constructing a novel method (named GradCAT) for visually interpreting the learned model. Source code is available https://github.com/google-research/nested-transformer.

PaperPDFCodeCode Syntology ran

In Syntology Open this paper in Syntology's Atlas, the map of the papers in Syntology's graph and their citations.

For agents, Syntology's MCP tool lists every function and class Syntology harvested from this paper and whether it ran (how to connect): get_harvested_code_for_paper(arxiv_id="2105.12723")

Code

Syntology Ran 7 of 26 code samples harvested from 3 repositories linked to this paper; 19 have no recorded run. Of those that ran: 1 ran · honoured contract; 1 ran · violated contract; 1 ran · fixture could not drive it; 4 ran with no contract checked.

By repository: official repository: 12 samples from 1 repository, 1 ran; community (archive-listed): 14 samples from 2 repositories, 6 ran. The run record, sample by sample. “Ran” means executed on a synthesized input, not that the code is correct or reproduces the paper.

google-research/nested-transformer officialmentioned in papermentioned on GitHubjaxApache-2.0 report
ahmedelmahy/myownvit mentioned on GitHubpytorch report
conceptofmind/NesT-flax mentioned on GitHubjaxMIT report
freder-chen/vitp mentioned on GitHubpytorchApache-2.0 report
rwightman/pytorch-image-models mentioned on GitHubpytorch report
ttt496/vit-pytorch mentioned on GitHubpytorch report

Repository list and official/mentioned flags are the archive's, frozen 2025-07-28. Reachability, where shown, is from one Syntology probe window (2026-09-16 to 2026-09-18); repositories not probed show nothing. GitHub stars are not tracked.

Code Syntology ran Syntology

26 samples harvested; 7 ran; 1 honoured the contract we drafted; 19 have no recorded run. Read from Syntology's graph 2026-09-24; that is when this build read the record, not when the samples ran.

1ran · honoured contract
1ran · violated contract
1ran · fixture could not drive it
4ran
19unverified

Licence: 0 of the 26 samples are pointer only, meaning Syntology does not serve that copy's text. This page shows no code text for any sample; each one links to its file in the repository.

Harvested from 3 repositories linked to this paper, official or community; each sample names its own and says which. “Ran” means the sample executed on a synthesized input. It does not mean the output is correct, and nothing here reproduces the paper's results. “Honoured” and “violated” refer to a contract Syntology drafted from the code itself; “our draft was wrong” and “fixture could not drive it” are failures of Syntology's instrument, not of the code.

Each sample ends with its code_sha256, Syntology's identity for that exact code. An agent fetches the stored sample with Syntology's MCP tool get_code(code_sha256="…") (how to connect); click an identity to copy that call.

Repository labels, per sample. official repository: The archive marks this repository official for the paper. named in the paper: The archive records that the paper mentions this repository; it is not marked official. community (archive-listed): In the archive's code links for this paper, not marked official and not recorded as mentioned in the paper. found in paper text by Syntology: Syntology found this repository in the paper's own text; whether it is the authors' implementation is not asserted. community: Not in the archive's code links for this paper; a community repository Syntology harvested. Samples from a repository marked official are listed first. Licence labels name the repository's licence as recorded at harvest. “Pointer only” means Syntology does not serve that copy's text, for one of four reasons: no licence file was found; the licence was not identified; the licence is recorded as permissive but that copy's record is not marked cleared; or the licence is outside the permissive list Syntology serves text under (MIT, Apache-2.0, BSD and similar). Some licences outside that list permit redistribution, such as WTFPL, and GPL-3.0 under its conditions; they are simply not on the list. Hover a licence label for the reason. File links open the file on GitHub at the default branch, which may have changed since the harvest.

get_hyper google-research/nested-transformer/configs/resnet50_imagenet.py official repository ran Apache-2.0 (permissive) · ffc38a27fd9393ba · report
activation google-research/nested-transformer/models/wide_resnet.py official repository unverified Apache-2.0 (permissive) · 3523de76ecdc1efc · report
apply_label_smoothing google-research/nested-transformer/libml/losses.py official repository unverified Apache-2.0 (permissive) · 08baacad242c29f2 · report
apply_weights google-research/nested-transformer/libml/losses.py official repository unverified Apache-2.0 (permissive) · d6d5db4678e1915c · report
create_model google-research/nested-transformer/models/resnet_v1.py official repository unverified Apache-2.0 (permissive) · 796c65138aa563c7 · report
create_model google-research/nested-transformer/models/wide_resnet.py official repository unverified Apache-2.0 (permissive) · 13ce18ddacc0988a · report
dense_layer_init_fn google-research/nested-transformer/models/wide_resnet.py official repository unverified Apache-2.0 (permissive) · 6f6b06fdb24a7472 · report
random_apply google-research/nested-transformer/augment/color_util.py official repository unverified Apache-2.0 (permissive) · d04f187058cb2a9c · report
random_brightness google-research/nested-transformer/augment/color_util.py official repository unverified Apache-2.0 (permissive) · e1aaf77a8784526a · report
register google-research/nested-transformer/models/nest_net.py official repository unverified Apache-2.0 (permissive) · 103f46a75894451d · report
to_grayscale google-research/nested-transformer/augment/color_util.py official repository unverified Apache-2.0 (permissive) · 49c827442d2fb761 · report
weighted_unnormalized_softmax_cross_entropy google-research/nested-transformer/libml/losses.py official repository unverified Apache-2.0 (permissive) · a70cd69707274f4d · report
adjust_learning_rate freder-chen/vitp/util/lr_sched.py community (archive-listed) ran · honoured contract Apache-2.0 (permissive) · bd3578806ecf5ac2 · report
all_reduce_mean freder-chen/vitp/util/misc.py community (archive-listed) ran fingerprinted Apache-2.0 (permissive) · 3dc19396537db789 · report
cast_tuple conceptofmind/NesT-flax/nest_flax.py/nest_flax.py community (archive-listed) ran · violated contract fingerprinted MIT (permissive) · 1f7c550e65142ef8 · report
get_layer_id_for_vit freder-chen/vitp/util/lr_decay.py community (archive-listed) ran fingerprinted Apache-2.0 (permissive) · 89edf5372214b57d · report
param_groups_lrd freder-chen/vitp/util/lr_decay.py community (archive-listed) ran Apache-2.0 (permissive) · 8baf25cef41cba16 · report
resize_pos_embed freder-chen/vitp/models/swelling_vit.py community (archive-listed) ran · fixture could not drive it Apache-2.0 (permissive) · 191b2735955d18f4 · report
adjust_mask_ratio freder-chen/vitp/engine/scratch.py community (archive-listed) unverified Apache-2.0 (permissive) · d83a787ef8a41d29 · report
build_dataset freder-chen/vitp/util/datasets.py community (archive-listed) unverified Apache-2.0 (permissive) · 11d1d6883016bc0a · report
build_transform freder-chen/vitp/util/datasets.py community (archive-listed) unverified Apache-2.0 (permissive) · b86ebb0fa1909e0d · report
checkpoint_filter_fn freder-chen/vitp/models/swelling_vit.py community (archive-listed) unverified Apache-2.0 (permissive) · 6d8a1f8a0697180f · report
generate_list freder-chen/vitp/models/swelling_vit.py community (archive-listed) unverified Apache-2.0 (permissive) · 202b055d01574c6b · report
get_1d_sincos_pos_embed_from_grid freder-chen/vitp/util/pos_embed.py community (archive-listed) unverified Apache-2.0 (permissive) · 12035a2f77d8016c · report
get_2d_sincos_pos_embed freder-chen/vitp/util/pos_embed.py community (archive-listed) unverified Apache-2.0 (permissive) · 3185afc3e87293ed · report
get_2d_sincos_pos_embed_from_grid freder-chen/vitp/util/pos_embed.py community (archive-listed) unverified Apache-2.0 (permissive) · f10004e059714d42 · report

Tasks

DecoderImage ClassificationImage Generation

Results from the paper archive 2025-07-28

TaskDatasetModelMetricValueRank at snapshotLeaderboardReport
Image Classification CIFAR-10 Transformer local-attention (NesT-B) Percentage correct 97.2 #90 of 265 Archive leaderboard report
Image Classification CIFAR-100 Transformer local-attention (NesT-B) Percentage correct 82.56 #103 of 211 Archive leaderboard report
Image Classification ImageNet Transformer local-attention (NesT-B) GFLOPs 17.9 #390 of 1060 Archive leaderboard report
Image Classification ImageNet Transformer local-attention (NesT-B) Number of params 68M #390 of 1060 Archive leaderboard report
Image Classification ImageNet Transformer local-attention (NesT-B) Top 1 Accuracy 83.8% #390 of 1060 Archive leaderboard report
Image Classification ImageNet Transformer local-attention (NesT-S) GFLOPs 10.4 #441 of 1060 Archive leaderboard report
Image Classification ImageNet Transformer local-attention (NesT-S) Number of params 38M #441 of 1060 Archive leaderboard report
Image Classification ImageNet Transformer local-attention (NesT-S) Top 1 Accuracy 83.3% #441 of 1060 Archive leaderboard report
Image Classification ImageNet Transformer local-attention (NesT-T) GFLOPs 5.8 #635 of 1060 Archive leaderboard report
Image Classification ImageNet Transformer local-attention (NesT-T) Number of params 17M #635 of 1060 Archive leaderboard report
Image Classification ImageNet Transformer local-attention (NesT-T) Top 1 Accuracy 81.5% #635 of 1060 Archive leaderboard report

Ranks are positions in the archive's leaderboards as they stood at the 2025-07-28 snapshot. Results published since then are not among these rows, so a rank here is not a current standing.

Methods

Introduced by this paper: NesT

AttentionDense ConnectionsLayer NormalizationLinear LayerMulti-Head AttentionNesTResidual ConnectionSoftmaxVision Transformer

Report a problem or propose a change · a person checks every report against the paper or source before anything changes; decisions are listed on /corrections