Papers › Efficient Training of Visual Transformers with Small Datasets

Efficient Training of Visual Transformers with Small Datasets

7 Jun 2021NeurIPS 2021 12arXiv:2106.03746archive 2025-07-28

Yahui Liu, Enver Sangineto, Wei Bi, Nicu Sebe, Bruno Lepri, Marco De Nadai

Visual Transformers (VTs) are emerging as an architectural paradigm alternative to Convolutional networks (CNNs). Differently from CNNs, VTs can capture global relations between image elements and they potentially have a larger representation capacity. However, the lack of the typical convolutional inductive bias makes these models more data-hungry than common CNNs. In fact, some local properties of the visual domain which are embedded in the CNN architectural design, in VTs should be learned from samples. In this paper, we empirically analyse different VTs, comparing their robustness in a small training-set regime, and we show that, despite having a comparable accuracy when trained on ImageNet, their performance on smaller datasets can be largely different. Moreover, we propose a self-supervised task which can extract additional information from images with only a negligible computational overhead. This task encourages the VTs to learn spatial relations within an image and makes the VT training much more robust when training data are scarce. Our task is used jointly with the standard (supervised) training and it does not depend on specific architectural choices, thus it can be easily plugged in the existing VTs. Using an extensive evaluation with different VTs and datasets, we show that our method can improve (sometimes dramatically) the final accuracy of the VTs. Our code is available at: https://github.com/yhlleo/VTs-Drloc.

PaperPDFConference PDFCodeCode 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 19 code samples harvested from 1 repository linked to this paper: 16 ran (of which 0 constructed an object rather than computing a result; 11 with no instrument failure: 1 honoured, 2 violated, 8 with no contract checked; 5 where Syntology's instrument failed) · 3 unverified. Where Syntology's instrument failed: 4 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: 19 samples from 1 repository, 16 ran (11 with no instrument failure; 5 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.

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

yhlleo/VTs-Drloc officialmentioned in papermentioned on GitHubpytorchMITSyntology: 19 samples, 16 ran (5 instrument-failed) · 3 unverified 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

19 samples harvested: 16 ran (of which 0 constructed an object rather than computing a result; 11 with no instrument failure: 1 honoured, 2 violated, 8 with no contract checked; 5 where Syntology's instrument failed) · 3 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.

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

Licence: 19 of the 19 samples are pointer only, meaning Syntology does not serve that copy's text. For 8 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 yhlleo/VTs-Drloc. “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.

yhlleo/VTs-Drloc official repository 19 samples, 16 ran (5 instrument-failed) · 3 unverified
window_partition in 377 papers
census: 13 implementations from 17 papers, 5 distinct outputs across 3 buckets, one shared input per bucket
models/swin.py ran; the contract check could not run (RAISES) · metamorphic tier: invariant fingerprinted MIT recorded; this copy not marked cleared · pointer only · 144d10b49baeb8a6 · report fixture: signature x:Tensor/4/float, window_size:int/0/int · returned Tensor · level recorded, date not recorded
build_optimizer in 83 papers optimizer.py ran MIT recorded; this copy not marked cleared · pointer only · e35a4b2e4114b1a5 · report fixture: signature config:Config/0/?, model:callable/0/? · returned AdamW · level recorded 2026-09-24
build_scheduler in 56 papers lr_scheduler.py ran MIT recorded; this copy not marked cleared · pointer only · c02cc4e0b5720211 · report fixture: signature config:Config/0/?, optimizer:SGD/0/?, n_iter_per_epoch:int/0/int · returned LinearLRScheduler · level recorded 2026-09-25
check_keywords_in_name in 32 papers optimizer.py ran · violated contract MIT recorded; this copy not marked cleared · pointer only · b0a5beb34716d5a6 · report fixture: signature name:str/0/str, keywords:tuple/1/str · returned bool · level recorded 2026-09-25
collect_samples_faster drloc/aux_modules.py ran MIT (permissive) here; the stored copy is pointer only · d50eceebc1eabdc2 · report fixture: signature feats:Tensor/4/float, pxy:Tensor/3/int, batch_size:int/0/int · returned Tensor · level recorded 2026-09-24
create_logger in 172 papers logger.py ran · our draft was wrong MIT recorded; this copy not marked cleared · pointer only · 80450600f7f09b0a · report fixture: signature output_dir:str/0/str, dist_rank:int/0/int, name:str/0/str · returned Logger · level recorded 2026-09-25
get_sinusoid_encoding in 24 papers models/t2t.py ran · honoured contract fingerprinted MIT recorded; this copy not marked cleared · pointer only · ced6bc2bfdfe0059 · report fixture: signature n_position:int/0/int, d_hid:int/0/int · returned Tensor · level recorded 2026-09-22
group_by_key_prefix_and_remove_prefix models/cvt.py ran · our draft was wrong MIT (permissive) here; the stored copy is pointer only · ca4faa49da53bd5c · report fixture: signature prefix:str/0/str, d:dict/0/? · returned tuple · level recorded 2026-09-22
group_dict_by_key models/cvt.py ran · our draft was wrong MIT (permissive) here; the stored copy is pointer only · afcf8f2954675d55 · report fixture: signature cond:callable/0/?, d:dict/0/? · returned tuple · level recorded 2026-09-22
pair in 101 papers models/vit.py ran · violated contract fingerprinted MIT recorded; this copy not marked cleared · pointer only · 6ba8cee9f5daea41 · report fixture: signature t:int/0/int · returned tuple · level recorded, date not recorded
randn_sampling drloc/aux_modules.py ran MIT (permissive) here; the stored copy is pointer only · a09531f2a3bed5f5 · report fixture: signature maxint:int/0/int, sample_size:int/0/int, batch_size:int/0/int · returned Tensor · level recorded 2026-09-24
relative_constraint_ce drloc/losses.py ran MIT (permissive) here; the stored copy is pointer only · 8872e7b986aa6d2e · report fixture: signature deltaxy:Tensor/2/int, predxy:Tensor/3/float · returned Tensor · level recorded 2026-09-24
relative_constraint_l1 drloc/losses.py ran fingerprinted MIT (permissive) here; the stored copy is pointer only · 7f1b680d6aa88b99 · report fixture: signature deltaxy:Tensor/2/float, predxy:Tensor/2/float · returned Tensor · level recorded 2026-09-24
set_weight_decay in 32 papers optimizer.py ran MIT recorded; this copy not marked cleared · pointer only · b33222a09fc93bec · report fixture: signature model:callable/0/?, skip_list:tuple/1/empty, skip_keywords:tuple/1/empty · returned list · level recorded 2026-09-24
variance_aware_regression drloc/losses.py ran MIT (permissive) here; the stored copy is pointer only · 2fc56b43da8a500b · report fixture: signature pred:Tensor/1/float, beta:Tensor/2/float, target:Tensor/1/float, labels:Tensor/2/float, lambda_var:float/0/float · returned Tensor · level recorded 2026-09-24
window_reverse in 296 papers models/swin.py ran · our draft was wrong MIT recorded; this copy not marked cleared · pointer only · 61bf152e6a42a184 · report fixture: signature windows:Tensor/4/float, window_size:int/0/int, H:int/0/int, W:int/0/int · returned Tensor · level recorded, date not recorded
build_model in 469 papers models/build.py unverified MIT recorded; this copy not marked cleared · pointer only · 6b79b63bd6d3342e · report
collect_samples drloc/aux_modules.py unverified MIT (permissive) here; the stored copy is pointer only · e52fbbea05ecc1fb · report
get_config in 203 papers config.py unverified MIT recorded; this copy not marked cleared · pointer only · 8a6a17f0fb1092f7 · report

Tasks

Inductive Bias

Results from the paper archive 2025-07-28

No leaderboard rows for this paper in the archive.

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