Title: LookHere: Vision Transformers with Directed Attention Generalize and Extrapolate
Venue: NeurIPS 2024
Accepted: yes
Keywords: vision transformers

position encoding

computer vision
Abstract: 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^2$ px and tested at $1024^2$ px. Additionally, we release a high-resolution test set to improve the evaluation of high-resolution image classifiers, called ImageNet-HR.


Peer reviews:
comments: SUMMARY:
This paper proproses LookHere, a novel positional encoding method for Vision Transformers for dealing with high-resolution images. Specifically, LookHere explicitly constratin attention heads to attend certain directions via 2D masks. With comprehensive experiments. LookHere demonstrates strong performance across different benchmarks. It also achieves better performance than existing positional encoding methods on high-res images.

STRENGTHS:
1. The idea is very clear. High-res images introduce new challenges on positoinal encoding due to the mismatch between the training and inference time. By introducing 2D attention masks, we can assign different heads a direction, such that they obtain explicit bias and will know how to attend on high-res images. 
2. The experiemnts are very comprehensive and strong, which well demonstrate the effectiveness of the proposed method. 
3. This paper is well-written and in a very good shape.

WEAKNESSES:
1. Actually the authors have clearly dicussed the weakness of their method, e.g. hand-designed masks, single scale of ViT. Beside that, have the authors considered a discussion with ConViT [50]? ConViT introduces convolutional bias to attention head, which also restricts the head to only attend to certain areas.
2. (Minor) It would be more promising to see if this technique can be applied into multi-modal LLMs.

QUESTIONS:
See the weakness.

LIMITATIONS:
Yes
TITLE: Official Review
SOUNDNESS_CORRECTNESS: 4
DATE: 2024-07-03

{"IS_META_REVIEW": false, "comments": "SUMMARY:\nThis paper introduces Lookhere, a novel mask-based positional encoding designed to address the performance degradation of ViT when resolution changes. Lookhere restricts the receptive field of each head in the attention mechanism and enhances the diversity of information perceived by each head. Extensive experiments have demonstrated the effectiveness of Lookhere. Compared to other positional encodings, Lookhere has significantly better resolution scalability.\n\nSTRENGTHS:\n1. The author's writing and illustrations are very clear, making it easy to understand and follow the method.\n2. The authors conducted numerous experiments, thoroughly validating the effectiveness of Lookhere.\n3. The issue explored by the authors, namely the resolution generalization of vision models, is a very important but rarely investigated area. The authors' work could potentially guide future research in this direction.\n\nWEAKNESSES:\nIn summary, I believe this is a very solid work with no obvious issues. I have only one personal concern. From Figure 6, it can be observed that the essence of the proposed positional encoding seems to be limiting the receptive field of each token, so that when the resolution changes, the number of tokens each token attends to does not change too drastically. However, this approach seems to reduce the model's overall receptive field. As a result, the fine-tuning results at a resolution of 384 do not show a particularly significant advantage compared to other positional encodings. I suspect that as the fine-tuning time increases, this advantage may disappear or even be worse than RoPE. Could the authors fine-tune for a longer period (for example, 30 epochs) to verify that this approach does not negatively impact the model's accuracy?\n\nQUESTIONS:\nPlease refer to the weakness\n\nLIMITATIONS:\nN/A", "TITLE": "Official Review", "RECOMMENDATION": 7, "REVIEWER_CONFIDENCE": 5, "SOUNDNESS_CORRECTNESS": 3, "DATE": "2024-07-09"}

{"IS_META_REVIEW": false, "comments": "SUMMARY:\nThe authors explore an alternative to existing positional encoding methods for vision transformers. Within attention operations, 2D attention masks (subtracted from attention matrix i.e. key-query inner product, prior to softmax) limits feature mixing to fixed fields of view pointed in different directions. ViTs resulting from proposed method exhibit improved performance across diverse tasks, especially when extrapolating to input image dimensions larger than the train data. The authors also contribute a new high-resolution ImageNet dataset variant for evaluation.\n\nSTRENGTHS:\n1. The paper is well written with clear motivation, thorough discussion of prior works, and detailed explanation of methodology. \n2. The proposed method is simple and elegant, providing better OOD performance to ViTs. This can be highly useful to the community.   \n3. Rigorous experimentation including hyper-parameter tuning to all prior works on a common training setup. \n4. Extensive evaluations and ablations to establish usefulness of proposed method and to highlight its various interesting aspects.\n5. Useful high-res ImageNet dataset that is already released anonymously (in appendix)\n\nWEAKNESSES:\n1. **Translation Equivariance:** Authors claim this to be a result of proposed method. However, this is not proved theoretically or demonstrated through experiments. Please explain this in method section, compare to CNNs, and provide experiments to quantify this is possible. In case I missed something related from appendix, please highlight it better in main paper. \n\n2. **[Minor] Adversarial Attacks:** Only FGSM - maybe try newer methods like AutoAttack?\n\nQUESTIONS:\n1. **Learning Parameters**: Have you tried learning the slope values? And maybe even the entire attention masks? These could be learned using some SSL setup like MAE.\n\nLIMITATIONS:\nDiscussed.", "TITLE": "Official Review", "RECOMMENDATION": 8, "REVIEWER_CONFIDENCE": 3, "SOUNDNESS_CORRECTNESS": 3, "DATE": "2024-07-11"}

{"IS_META_REVIEW": false, "comments": "SUMMARY:\nVision transformer is known for its constrained scalability across various image resolutions and this work is designed to address the generalization ability of ViT at high-resolution images. Specifically, the authors propose LookHere, a drop-in replacement for the positional encoding of standard ViTs, which restricts attention heads to fixed fields of view oriented in different directions using 2D attention masks. It offers translation-equivariance, guarantees attention head diversity, and minimizes the distribution shift encountered by attention heads during extrapolation. Extensive experiments validate the effectiveness of the proposed method.\n\nSTRENGTHS:\n1. Evaluation is extensive. The authors provide validations across different datasets, and tasks, and offer detailed analysis to demonstrate the effectiveness of the proposed approach.\n\n2. The results seem promising. LookHere exhibits the best performance compared to other baseline methods.\n\n3. The presentation is clear and the paper is easy to follow.\n\nWEAKNESSES:\n1. The generalization ability of LookHere to smaller-scale images remains unverified. Although the authors particularly focus on testing at high-resolution images, it would be better if LookHere could be generalized to smaller images as well.\n\n2. The ablation study on the design choices seems missing. Although the authors provide abundant experiments and analysis, the ablation study on the specific designs is missing and their efficacy is unverified.\n\n3. The size of the proposed ImageNet-HR is too small (5 images per class). The limited number of images in each class may not be representative enough and could have a strong bias implicitly.\n\nQUESTIONS:\nApart from the questions in weakness, the reviewer has one additional question:\n\nIs there a particular reason that the authors did not compare LookHere with NaViT, which can also be tested at higher resolutions?\n\nLIMITATIONS:\nN/A", "TITLE": "Official Review", "RECOMMENDATION": 6, "REVIEWER_CONFIDENCE": 4, "SOUNDNESS_CORRECTNESS": 3, "DATE": "2024-07-12"}