Papers › LookHere: Vision Transformers with Directed Attention Generalize and Extrapolate

LookHere: Vision Transformers with Directed Attention Generalize and Extrapolate

22 May 2024arXiv:2405.13985archive 2025-07-28

Anthony Fuller, Daniel G. Kyrollos, Yousef Yassin, James R. Green

High-resolution images offer more information about scenes that can improve model accuracy. However, the dominant model architecture in computer vision, the vision transformer (ViT), cannot effectively leverage larger images without finetuning -- ViTs poorly extrapolate to more patches at test time, although transformers offer sequence length flexibility. We attribute this shortcoming to the current patch position encoding methods, which create a distribution shift when extrapolating. We propose a drop-in replacement for the position encoding of plain ViTs that restricts attention heads to fixed fields of view, pointed in different directions, using 2D attention masks. Our novel method, called LookHere, provides translation-equivariance, ensures attention head diversity, and limits the distribution shift that attention heads face when extrapolating. We demonstrate that LookHere improves performance on classification (avg. 1.6%), against adversarial attack (avg. 5.4%), and decreases calibration error (avg. 1.5%) -- on ImageNet without extrapolation. With extrapolation, LookHere outperforms the current SoTA position encoding method, 2D-RoPE, by 21.7% on ImageNet when trained at 224² px and tested at 1024² px. Additionally, we release a high-resolution test set to improve the evaluation of high-resolution image classifiers, called ImageNet-HR.

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="2405.13985")

Code

Syntology Ran 8 of 12 code samples harvested from 1 repository linked to this paper; 4 have no recorded run. Of those that ran: 2 ran · honoured contract; 1 ran · our draft was wrong; 5 ran with no contract checked.

By repository: official repository: 12 samples from 1 repository, 8 ran. The run record, sample by sample. “Ran” means executed on a synthesized input, not that the code is correct or reproduces the paper.

greencubic/lookhere officialmentioned in papermentioned 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

12 samples harvested; 8 ran; 2 honoured the contract we drafted; 4 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.

2ran · honoured contract
1ran · our draft was wrong
5ran
4unverified

Licence: 0 of the 12 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 greencubic/lookhere. “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.

Attention greencubic/lookhere/lookhere.py official repository ran · metamorphic tier: deterministic MIT (permissive) · b35e50a694a6b62e · report
Block greencubic/lookhere/lookhere.py official repository ran · metamorphic tier: deterministic MIT (permissive) · 01c98d386037421d · report
BlockwithBiases greencubic/lookhere/lookhere.py official repository ran · metamorphic tier: deterministic MIT (permissive) · 3ccd89f9e4648dcc · report
LayerScale greencubic/lookhere/lookhere.py official repository ran · metamorphic tier: deterministic MIT (permissive) · 90611bff664a489e · report
VisionTransformer greencubic/lookhere/lookhere.py official repository ran · metamorphic tier: deterministic MIT (permissive) · 9b6612fb34289faa · report
create_lh_layer_tensor greencubic/lookhere/lookhere.py official repository ran · our draft was wrong MIT (permissive) · a5a0ece903d40b24 · report
get_none_slopes greencubic/lookhere/lookhere.py official repository ran · honoured contract fingerprinted MIT (permissive) · 1e0f3ec7d9de62a3 · report
get_slopes greencubic/lookhere/lookhere.py official repository ran · honoured contract fingerprinted MIT (permissive) · 219b1bd8df9afa74 · report
AttentionWithBiases greencubic/lookhere/lookhere.py official repository unverified MIT (permissive) · e0a1b4c82648a897 · report
LookHere greencubic/lookhere/lookhere.py official repository unverified MIT (permissive) · 90ab0aa30ee2a29d · report
create_lh_bias_tensor greencubic/lookhere/lookhere.py official repository unverified MIT (permissive) · 7cf9e59d0374ac7f · report
create_lh_bias_tensor greencubic/lookhere/lookhere.py official repository unverified MIT (permissive) · 1e6c2f5d71acb2c6 · report

Tasks

Adversarial AttackAttributeDiversity

2 archive task tags without a task page not shown.

Results from the paper archive 2025-07-28

No leaderboard rows for this paper in the archive.

Methods

AttentionDense ConnectionsLayer NormalizationLinear LayerMulti-Head AttentionResidual ConnectionSETSoftmaxVision 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