atlas

Research map / Architectures and efficiency / Attention and transformers

LookHere: Vision Transformers with Directed Attention Generalize and Extrapolate

NeurIPS 2024 · Architectures and efficiency › Attention and transformers · approach: Hybrid and interpretable ViT designs · 0 citations (OpenAlex)

Read the paperCheck your idea against 108,967 papers

AI-extracted summary. Written by AI from the paper's full text. Numbers and claims can be wrong or missing context, so check the paper before you cite or build on it.

Proposes LookHere, a drop-in position encoding for plain ViTs that restricts attention heads to directional fields of view via 2D attention masks plus distance penalties, improving extrapolation to higher resolutions, and releases the ImageNet-HR test set.

Problem

Plain vision transformers extrapolate poorly to more patches at test time (higher resolutions than training) because current patch position encodings cause a distribution shift in attention heads.

Approach

Assign each attention head a direction and a fixed field of view via 2D attention masks, and penalize attention scores by Euclidean patch distance within that field, subtracted from learned attention logits before softmax; this hard-codes spatial algorithms and limits distribution shift when extrapolating.

Key results

Measured effects reported in the paper

What was changedWhereMeasuredEffect
Replace standard position encoding with LookHere directed attention masks and distance penaltiesViT-B/16 · ImageNet, tested at training resolutiontop-1 accuracy: +1.6% avg.Helped
Use LookHere instead of 2D-RoPEViT-B/16 · ImageNet, trained at 224² and tested at 1024²top-1 accuracy: 21.7%Helped
Add LookHere directed attention masks (ablation)LookHere · ImageNet extrapolationtop-1 accuracy: +9.5% on Val at 1024² pxHelped
Remove all distance penalties (ablation)LookHere · ImageNet extrapolationtop-1 accuracyHurt
Increase distance penalties with squared distance (ablation)LookHere · ImageNet extrapolationtop-1 accuracyHurt
Increase distance penalties with square-root distance (ablation)LookHere · ImageNet extrapolationtop-1 accuracyHurt
Vary the slope function (ablation)LookHere · ImageNettop-1 accuracyNo clear effect
Remove distance penalties on undirected heads (ablation)LookHere · ImageNettop-1 accuracyNo clear effect
Vary the global slope (ablation)LookHere · ImageNet extrapolationtop-1 accuracy: 0.15%No clear effect
Use different directional configurations (ablation)LookHere · ImageNettop-1 accuracyNo clear effect
Use narrower fields of view (ablation)LookHere · ImageNet extrapolation at 1024²top-1 accuracyHelped
Tune the global slope at test resolution (ablation)LookHere · ImageNet extrapolation at 512²top-1 accuracy: 0.15%No clear effect

Surprising findings

Limitations

Experimental setup

Datasets: ImageNet-1k ADE20k Cityscapes ImageNet-S ImageNet-A ImageNet-R ImageNet v2 ImageNet ReaL

Benchmarks: ImageNet Val ImageNet ReaL ImageNet v2 ImageNet-A ImageNet-R ImageNet-HR ADE20k Cityscapes ImageNet-S

Metrics: top-1 accuracy top-5 accuracy mIoU expected calibration error adversarial accuracy under FGSM generalized Jensen-Shannon divergence

Baselines: 1D-learn 2D-sincos Factorized Fourier RPE-learn 2D-ALiBi 2D-RoPE iRPE

Builds on: 2D-RoPE ALiBi FlexiViT RPE 3-Augment

Closest papers by meaning

Writing a paper in this area? scime draft is a free LaTeX editor with AI included, real-time co-authors and a check of your references and venue rules before you submit. It also imports OpenAI Prism projects.

Open scime draft

Get the next scime Dispatch and a monthly field update

Free. We send a confirmation link first; every email has a one-click unsubscribe. Privacy