Interpolation between Convolution and Attention via K-Nearest Neighbors
This paper argues that convolution and self-attention can be unified within a k-nearest neighbor aggregation framework, and introduces ConvNN, a unified framework that exactly recovers standard convolution and self-attention, enabling exploration of the continuous spectrum between local and global aggregation.
[2606.14725] Interpolation between Convolution and Attention via K-Nearest Neighbors
[Submitted on 31 May 2026]
Title:Interpolation between Convolution and Attention via K-Nearest Neighbors
View a PDF of the paper titled Interpolation between Convolution and Attention via K-Nearest Neighbors, by Mingi Kang
View PDF
Abstract:The shift from Convolutional Neural Networks to Transformers has reshaped computer vision, yet these two architectural families are typically viewed as fundamentally distinct. Convolutional Neural Networks are defined by spatially local convolution operations, while Transformers rely on global self-attention. We argue that convolution and self-attention, despite their apparent differences, can be unified within a single k-nearest neighbor aggregation framework. The critical insight is that both operations are special cases of neighbor selection and weighted aggregation. Convolution selects neighbors by spatial proximity while self-attention selects by feature similarity, revealing that they lie on a continuous spectrum rather than representing categorically different computations.
We introduce Convolutional Nearest Neighbors (ConvNN), a unified framework that formalizes this connection. ConvNN exactly recovers standard and depthwise convolution by restricting neighbor selection to normalized spatial coordinates, and exactly recovers self-attention and its sparse variants, including KVT-attention, by replacing spatial proximity with scaled dot-product similarity. Beyond these special cases, ConvNN serves as a drop-in replacement for both convolution and attention layers, enabling systematic exploration of the intermediate spectrum between local and global aggregation through configurable similarity functions, neighbor selection strategies, positional encodings, and aggregation kernels.
Comments: Undergraduate Thesis in Computer Science at Bowdoin College
Subjects:
Computer Vision and Pattern Recognition (cs.CV)
Cite as: arXiv:2606.14725 [cs.CV]
(or arXiv:2606.14725v1 [cs.CV] for this version)
https://doi.org/10.48550/arXiv.2606.14725
arXiv-issued DOI via DataCite
Submission history
From: Mingi Kang [view email] [v1] Sun, 31 May 2026 23:23:42 UTC (6,735 KB)
Full-text links:
Access Paper:
View a PDF of the paper titled Interpolation between Convolution and Attention via K-Nearest Neighbors, by Mingi Kang
View PDF
TeX Source
view license
Current browse context:
cs.CV
new | recent | 2026-06
Change to browse by:
cs
References & Citations
NASA ADS
Google Scholar
Semantic Scholar
Loading...
Data provided by:
Bibliographic Tools
Bibliographic and Citation Tools
Bibliographic Explorer Toggle
Bibliographic Explorer (What is the Explorer?)
Connected Papers Toggle
Connected Papers (What is Connected Papers?)
Litmaps Toggle
Litmaps (What is Litmaps?)
scite.ai Toggle
scite Smart Citations (What are Smart Citations?)
Code, Data, Media
Code, Data and Media Associated with this Article
alphaXiv Toggle
alphaXiv (What is alphaXiv?)
Links to Code Toggle
CatalyzeX Code Finder for Papers (What is CatalyzeX?)
DagsHub Toggle
DagsHub (What is DagsHub?)
GotitPub Toggle
Gotit.pub (What is GotitPub?)
Huggingface Toggle
Hugging Face (What is Huggingface?)
ScienceCast Toggle
ScienceCast (What is ScienceCast?)
Demos
Demos
Replicate Toggle
Replicate (What is Replicate?)
Spaces Toggle
Hugging Face Spaces (What is Spaces?)
Spaces Toggle
TXYZ.AI (What is TXYZ.AI?)
Related Papers
Recommenders and Search Tools
Link to Influence Flower
Influence Flower (What are Influence Flowers?)
Core recommender toggle
CORE Recommender (What is CORE?)
Author
Venue
Institution
Topic
About arXivLabs
arXivLabs: experimental projects with community collaborators
arXivLabs is a framework that allows collaborators to develop and share new arXiv features directly on our website.
Both individuals and organizations that work with arXivLabs have embraced and accepted our values of openness, community, excellence, and user data privacy. arXiv is committed to these values and only works with partners that adhere to them.
Have an idea for a project that will add value for arXiv's community? Learn more about arXivLabs.
Which authors of this paper are endorsers? | Disable MathJax (What is MathJax?)