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 View this paper on Syntology, its page in Syntology's graph. That page adds which of its functions are also present in other papers' code Syntology holds, with dates, and its dated run record as JSON and a README badge. It also lists the repositories linked to the paper, the abstract and the calls for agents.

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

For agents, on Syntology's MCP service (how to connect):

Code

Syntology 26 code samples harvested from 3 repositories linked to this paper: 19 ran (of which 0 constructed an object rather than computing a result; 16 with no instrument failure: 3 honoured, 1 violated, 12 with no contract checked; 3 where Syntology's instrument failed) · 7 unverified. Where Syntology's instrument failed: 2 where our contract draft was wrong; 1 where the contract check could not run; failures of Syntology's instrument, not of the code.

By repository: official repository: 12 samples from 1 repository, 9 ran (9 with no instrument failure; 0 where Syntology's instrument failed); community (archive-listed): 14 samples from 2 repositories, 10 ran (7 with no instrument failure; 3 where Syntology's instrument failed). The run record, sample by sample. “Ran” means executed on a synthesized input, not that the code is correct or reproduces the paper.

No sample is linked to this paper from 3 of its repositories that Syntology harvested for other papers:

Levels written between 2026-09-22 and 2026-09-26 (UTC): the dates Syntology's graph wrote each sample's verification level, not when the code executed. 1 of the 19 samples that ran has no recorded date.

google-research/nested-transformer officialmentioned in papermentioned on GitHubjaxApache-2.0Syntology: 12 samples, 9 ran (0 instrument-failed) · 3 unverified report
ahmedelmahy/myownvit mentioned on GitHubpytorchSyntology: no sample linked to this paper (harvested for another paper). Syntology's graph links these samples to Tokens-to-Token ViT: Training Vision Transformers from Scratch on ImageNet (arXiv:2101.11986; that paper's own run record: 21 ran (of which 16 constructed an object rather than computing a result; 21 with no instrument failure: 1 honoured, 0 violated, 20 with no contract checked; 0 where Syntology's instrument failed) · 5 unverified), CrossViT: Cross-Attention Multi-Scale Vision Transformer for Image Classification (arXiv:2103.14899; that paper's own run record: 17 ran (of which 10 constructed an object rather than computing a result; 17 with no instrument failure: 0 honoured, 1 violated, 16 with no contract checked; 0 where Syntology's instrument failed) · 9 unverified), CvT: Introducing Convolutions to Vision Transformers (arXiv:2103.15808; that paper's own run record: 39 ran (of which 19 constructed an object rather than computing a result; 36 with no instrument failure: 2 honoured, 0 violated, 34 with no contract checked; 3 where Syntology's instrument failed) · 8 unverified) and 2 more (every one in this page's JSON twin); nothing checks that they implement this paper's method. report
conceptofmind/NesT-flax mentioned on GitHubjaxMITSyntology: 1 sample, 1 ran (0 instrument-failed) · 0 unverified report
freder-chen/vitp mentioned on GitHubpytorchApache-2.0Syntology: 13 samples, 9 ran (3 instrument-failed) · 4 unverified report
rwightman/pytorch-image-models mentioned on GitHubpytorchSyntology: no sample linked to this paper (harvested for another paper). Syntology's graph links these samples to AdamP: Slowing Down the Slowdown for Momentum Optimizers on Scale-invariant Weights (arXiv:2006.08217; that paper's own run record: 4 ran (of which 1 constructed an object rather than computing a result; 2 with no instrument failure: 1 honoured, 0 violated, 1 with no contract checked; 2 where Syntology's instrument failed) · 0 unverified); nothing checks that they implement this paper's method. report
ttt496/vit-pytorch mentioned on GitHubpytorchSyntology: no sample linked to this paper (harvested for another paper). Syntology's graph links these samples to Tokens-to-Token ViT: Training Vision Transformers from Scratch on ImageNet (arXiv:2101.11986; that paper's own run record: 21 ran (of which 16 constructed an object rather than computing a result; 21 with no instrument failure: 1 honoured, 0 violated, 20 with no contract checked; 0 where Syntology's instrument failed) · 5 unverified), Rethinking Spatial Dimensions of Vision Transformers (arXiv:2103.16302; that paper's own run record: 10 ran (of which 6 constructed an object rather than computing a result; 10 with no instrument failure: 2 honoured, 0 violated, 8 with no contract checked; 0 where Syntology's instrument failed) · 10 unverified) and LeViT: a Vision Transformer in ConvNet's Clothing for Faster Inference (arXiv:2104.01136; that paper's own run record: 23 ran (of which 16 constructed an object rather than computing a result; 21 with no instrument failure: 3 honoured, 1 violated, 17 with no contract checked; 2 where Syntology's instrument failed) · 7 unverified); nothing checks that they implement this paper's method. 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.

A paper named beside a repository with no sample linked to this paper is shown with that paper's own run record, not this paper's: “ran” means executed on a synthesized input, not that the code is correct, and “where Syntology's instrument failed” counts failures of Syntology's instrument, not of the code. Papers are listed in arXiv-id order, at most three per repository.

Code Syntology ran Syntology

26 samples harvested: 19 ran (of which 0 constructed an object rather than computing a result; 16 with no instrument failure: 3 honoured, 1 violated, 12 with no contract checked; 3 where Syntology's instrument failed) · 7 unverified. “Where Syntology's instrument failed” counts failures of Syntology's instrument, not of the code. Syntology's record for this page last changed ; when this build read Syntology's graph is in the build record. That date is not when the samples ran.

3ran · honoured contract
1ran · violated contract
2ran · our draft was wrong
1ran; the contract check could not run
12ran
7unverified

Licence: 6 of the 26 samples are pointer only, meaning Syntology does not serve that copy's text. For 6 of them, this paper's copy is under a permissive licence and cleared, but the stored copy of the same code that Syntology serves is not; the licence label's tooltip gives Syntology's recorded reason. 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; the list below is grouped by repository, each group headed by its name and what it is to the paper. “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. A line beginning “fixture:” under a sample that ran gives the arguments Syntology's fixture called the sample with, each as name:type/rank/element kind (? where none was recorded), and the type of what the fixture's run returned, exactly as the harness recorded them; the arguments and the returned type were recorded by two separate runs of the same fixture. No output value is shown, and a returned type says nothing about whether the output was right. “Level recorded” gives the UTC date when Syntology's graph wrote the sample's verification level, not when the code executed; where the level was written before Syntology's graph kept that date, the row says “level recorded, date not recorded”. “Honoured” and “violated” refer to a contract Syntology drafted from the code itself. “Our draft was wrong” and “the contract check could not run” are failures of Syntology's instrument, not of the code: the sample ran on Syntology's synthesized input, and then the drafted contract did not describe it, or the check itself raised an error (RAISES), lacked a dependency (DEP_MISSING) or ran out of time (TIMEOUT); hover the label for which. A metamorphic tier, where shown, is evidence of the output's shape, not that the sample implements the method.

Each sample ends with its code_sha256. A sample's code_sha256 is Syntology's identity for that exact code. It is printed in full (16 hexadecimal characters for every sample in this build), and get_code(code_sha256="…") takes it exactly as printed. An agent calls it on Syntology's MCP service (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 are grouped by repository: a repository marked official first, then by how directly the repository is tied to the paper, then in the archive's order; never by how many ran. 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 six 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; the licence is outside the permissive list Syntology serves text under (MIT, Apache-2.0, BSD and similar); this paper's copy was not located, so its licence is not recorded; or this paper's copy is cleared, but the stored copy of the same code that Syntology serves is not. 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.

A function or class name links to its page when the name occurs in the harvested code of at least 5 papers; the name is a string, not an identity. A census tag appears when Syntology's census ran implementations with that name on one shared input per bucket: it gives how many were compared, from how many papers, and how many distinct outputs they produced, and names this sample's bucket when this sample was one of them.

google-research/nested-transformer official repository 12 samples, 9 ran (0 instrument-failed) · 3 unverified
apply_label_smoothing in 5 papers libml/losses.py ran fingerprinted Apache-2.0 (permissive) · 08baacad242c29f2 · report fixture: signature one_hot_targets:Tensor/2/float, label_smoothing:float/0/float · returned Tensor · level recorded 2026-09-25
apply_weights libml/losses.py ran Apache-2.0 (permissive) · d6d5db4678e1915c · report fixture: signature output:ArrayImpl/3/float, weights:ArrayImpl/1/float · returned ArrayImpl · level recorded 2026-09-25
create_model in 163 papers models/resnet_v1.py ran Apache-2.0 (permissive) · 796c65138aa563c7 · report fixture: signature model_name:str/0/str, config:SimpleConfig/0/? · returned partial · level recorded 2026-09-25
dense_layer_init_fn models/wide_resnet.py ran Apache-2.0 (permissive) · 6f6b06fdb24a7472 · report fixture: signature key:ArrayImpl/1/int, shape:tuple/1/int, dtype:callable/0/? · returned ArrayImpl · level recorded 2026-09-25
get_hyper in 8 papers configs/resnet50_imagenet.py ran Apache-2.0 (permissive) · ffc38a27fd9393ba · report fixture: signature h:MockHyperparameter/0/? · returned list · level recorded 2026-09-24
random_apply in 8 papers augment/color_util.py ran Apache-2.0 (permissive) · d04f187058cb2a9c · report fixture: signature func:callable/0/?, p:float/0/float, x:SymbolicTensor/1/float · returned SymbolicTensor · level recorded 2026-09-25
random_brightness in 6 papers augment/color_util.py ran Apache-2.0 (permissive) · e1aaf77a8784526a · report fixture: signature image:SymbolicTensor/3/float, max_delta:float/0/float, impl:str/0/str · returned SymbolicTensor · level recorded 2026-09-26
register in 66 papers models/nest_net.py ran Apache-2.0 (permissive) · 103f46a75894451d · report fixture: signature f:callable/0/? · returned function · level recorded 2026-09-25
weighted_unnormalized_softmax_cross_entropy libml/losses.py ran Apache-2.0 (permissive) · a70cd69707274f4d · report fixture: signature logits:ArrayImpl/3/float, one_hot_targets:ArrayImpl/3/float, weights:ArrayImpl/2/float, label_smoothing:float/0/float, label_weights:ArrayImpl/1/float, logits_normalized:bool/0/bool · returned ArrayImpl · level recorded 2026-09-25
activation in 30 papers models/wide_resnet.py unverified Apache-2.0 (permissive) · 3523de76ecdc1efc · report
create_model in 163 papers models/wide_resnet.py unverified Apache-2.0 (permissive) · 13ce18ddacc0988a · report
to_grayscale in 7 papers augment/color_util.py unverified Apache-2.0 (permissive) · 49c827442d2fb761 · report
conceptofmind/NesT-flax community (archive-listed) 1 sample, 1 ran (0 instrument-failed) · 0 unverified
cast_tuple in 58 papers nest_flax.py/nest_flax.py ran · violated contract fingerprinted MIT (permissive) · 1f7c550e65142ef8 · report fixture: signature val:int/0/int, depth:int/0/int · returned tuple · level recorded 2026-09-22
freder-chen/vitp community (archive-listed) 13 samples, 9 ran (3 instrument-failed) · 4 unverified
adjust_learning_rate in 125 papers util/lr_sched.py ran · honoured contract Apache-2.0 (permissive) here; the stored copy is pointer only · bd3578806ecf5ac2 · report fixture: signature optimizer:SGD/0/?, epoch:int/0/int, args:Args/0/? · returned float · level recorded, date not recorded
adjust_mask_ratio engine/scratch.py ran fingerprinted Apache-2.0 (permissive) · d83a787ef8a41d29 · report fixture: signature epochs:int/0/int, epoch:int/0/int, early_off:int/0/int · returned float · level recorded 2026-09-24
all_reduce_mean in 27 papers util/misc.py ran · honoured contract fingerprinted Apache-2.0 (permissive) · 3dc19396537db789 · report fixture: signature x:float/0/float · returned float · level recorded 2026-09-24
build_transform in 170 papers util/datasets.py ran Apache-2.0 (permissive) · b86ebb0fa1909e0d · report fixture: signature is_train:bool/0/bool, args:ArgsStandIn/0/? · returned Compose · level recorded 2026-09-24
checkpoint_filter_fn in 80 papers models/swelling_vit.py ran · our draft was wrong Apache-2.0 (permissive) · 6d8a1f8a0697180f · report fixture: signature state_dict:dict/0/?, model:callable/0/? · returned dict · level recorded 2026-09-25
generate_list models/swelling_vit.py ran fingerprinted Apache-2.0 (permissive) · 202b055d01574c6b · report fixture: signature start:int/0/int, num:int/0/int, step:int/0/int · returned list · level recorded 2026-09-24
get_layer_id_for_vit in 25 papers util/lr_decay.py ran · honoured contract fingerprinted Apache-2.0 (permissive) here; the stored copy is pointer only · 89edf5372214b57d · report fixture: signature name:str/0/str, num_layers:int/0/int · returned int · level recorded 2026-09-24
param_groups_lrd in 22 papers util/lr_decay.py ran · our draft was wrong Apache-2.0 (permissive) here; the stored copy is pointer only · 8baf25cef41cba16 · report fixture: signature model:callable/0/?, weight_decay:float/0/float, no_weight_decay_list:list/1/str, layer_decay:float/0/float · returned list · level recorded 2026-09-24
resize_pos_embed in 102 papers models/swelling_vit.py ran; the contract check could not run (RAISES) · metamorphic tier: invariant Apache-2.0 (permissive) · 191b2735955d18f4 · report fixture: signature posemb:Tensor/3/float, posemb_new:Tensor/3/float, num_tokens:int/0/int, gs_new:list/1/int · returned Tensor · level recorded 2026-09-22
build_dataset in 151 papers util/datasets.py unverified Apache-2.0 (permissive) · 11d1d6883016bc0a · report
get_1d_sincos_pos_embed_from_grid in 75 papers
census: 8 implementations from 17 papers, 2 distinct outputs across 2 buckets, one shared input per bucket
util/pos_embed.py unverified Apache-2.0 (permissive) here; the stored copy is pointer only · 12035a2f77d8016c · report
get_2d_sincos_pos_embed in 170 papers util/pos_embed.py unverified Apache-2.0 (permissive) here; the stored copy is pointer only · 3185afc3e87293ed · report
get_2d_sincos_pos_embed_from_grid in 140 papers util/pos_embed.py unverified Apache-2.0 (permissive) here; the stored copy is pointer only · 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