A Manifold Representation of the Key in Vision Transformers

Li Meng, Morten Goodwin, Anis Yazidi, Paal Engelstad · DOI

Abstract

Vision Transformers (ViTs) typically generate Query (Q), Key (K), and Value (V) vectors through a shared linear transformation of input tokens. This paper proposes a fundamental rethink of this mechanism by disentangling the Key from the Query and Value, representing it as a complex manifold composed of multiple "charts." By treating the Key as a multifaceted meta-label rather than a simple linear projection, the model achieves superior information retrieval and background suppression. Experimental results on ImageNet-1K and COCO demonstrate significant performance gains across various ViT architectures, including ViT-B and Swin-T.

Introduction

In the standard self-attention mechanism, the Query, Key, and Value components are derived from a single linear projection of the input. While effective, this approach overlooks the distinct functional roles of these vectors. Specifically, while the Value represents the content to be retrieved, the Key serves as an indexing system—a set of abstract descriptors that guide the Query.

Researchers from the University of Oslo and the University of Agder argue that a simple linear projection limits the model's ability to capture the complex, global relationships inherent in visual data. They propose a "Manifold Key" architecture that expands the Key's representation into a manifold structure, allowing for more nuanced and abstract indexing without resorting to brute-force parameter increases.

Methodology: The Manifold Key

The core innovation lies in expanding the input into multiple "charts" that collectively form a manifold representation of the Key. This process involves four primary stages:

  1. Expansion: The dimensionality of the Key is increased by introducing a new coordinate corresponding to the number of charts.
  2. Diversity: To ensure that each chart captures distinct features, a trainable parameter ($\Gamma$) is used for element-wise multiplication, similar to the LayerScale approach.
  3. Processing: Each chart is processed independently using group-wise 1D convolutions (kernel size 1), functioning as a channel-mixing MLP.
  4. Aggregation (Unification): The independent charts are unified back into a single meta-representation.
The Manifold Key architecture: expanding input into multiple charts, processing them via MLPs, and unifying them into a final Key representation.

The authors explored several variants for the aggregation step: SpatialK (linear reshaping), SimpleK (1D convolution), KUA (spatial interaction via Context Broadcasting), and VanillaK (averaging with Context Broadcasting).

Experimental Results

The proposed methods were evaluated on ImageNet-1K for image classification and the COCO dataset for object detection and instance segmentation.

Performance Gains

The manifold representation consistently outperformed baseline models across different architectures. For instance, the ViT-B model achieved an 0.87% increase in top-1 accuracy on ImageNet-1K using the VanillaK method. Similarly, the Swin-T backbone saw a 0.52% boost. In object detection tasks on COCO, the SpatialK method improved Box AP by 0.5% and Mask AP by 0.3% over the standard Swin-T baseline.

Performance comparison of various Manifold Key methods (SpatialK, KUA, SimpleK, VanillaK) against baseline ViT and Swin models on ImageNet-1K.

Insights and Efficiency

A key finding was that different architectures favor different aggregation methods. ViT models performed best with the simple averaging of VanillaK, whereas Swin Transformers benefited most from the linear-based SpatialK. Furthermore, visualization of attention maps revealed that the manifold representation significantly improves the model's ability to suppress irrelevant background noise (e.g., snow or water), allowing it to focus more accurately on primary objects.

Discussion and Future Work

While the Manifold Key offers clear performance benefits, it introduces computational overhead. For example, the ViT-B model's parameter count increased from 87M to 140M when utilizing eight charts. The authors also noted that "inappropriate expansion"—such as using too many charts or an suboptimal structure—can lead to performance degradation, highlighting the importance of structural quality over sheer quantity.

Future research will focus on improving the efficiency of manifold implementations to reduce parameter and FLOP counts. Additionally, exploring layer-specific strategies—where manifold structures vary in complexity across the network's depth—presents a promising avenue for further optimization.

Summary updated

Empirical ResultsBrowse all benchmarks →

BenchmarkMethodMetricScoreProtocol / Evidence
ImageNet-1KViT-B/16 +VanillaKtop-1 accuracy80.31%fine-tuned · charts=8 · epochs=300 · backbone=ViT-B/16
Source quote
L132: +VanillaK │ 140 │ 30.4 │ 80.31 │ 94.54
ImageNet-1KSwin-T +SpatialKtop-1 accuracy81.51%+0.52 vs baselinefine-tuned · charts=8 · epochs=300 · backbone=Swin-T
Source quote
L134: +SpatialK │ 61 │ 10.4 │ 81.51 │ 95.69
COCOSwin-T +SpatialKAP^b (object detection)45.5%+0.5 vs baselinefine-tuned · model=Mask R-CNN with FPN · charts=8 · epochs=36 · backbone=Swin-T
Source quote
L197: +SpatialK │ 45.5 │ 67.3 │ 49.9 │ 41 │ 64.3 │ 44.1
Reported baseline / comparator measurements (3)
BenchmarkMethodMetricScoreProtocol / Evidence
ImageNet-1KViT-B/16 baseline baselinetop-1 accuracy79.44%fine-tuned · epochs=300 · backbone=ViT-B/16
Source quote
L128: ViT-B/16 │ 87 │ 17.7 │ 79.44 │ 93.91
ImageNet-1KSwin-T baseline baselinetop-1 accuracy80.99%fine-tuned · epochs=300 · backbone=Swin-T
Source quote
L133: Swin-T │ 28 │ 4.6 │ 80.99 │ 95.5
COCOSwin-T baseline baselineAP^b (object detection)45%fine-tuned · model=Mask R-CNN with FPN · epochs=36 · backbone=Swin-T
Source quote
L196: Swin-T │ 45 │ 67.1 │ 49.5 │ 40.7 │ 63.8 │ 43.6
BibTeX
@inproceedings{meng2024manifold,
  author = {Li Meng and Morten Goodwin and Anis Yazidi and Paal Engelstad},
  title = {{A Manifold Representation of the Key in Vision Transformers}},
  booktitle = {CGI},
  year = {2024},
  doi = {10.1007/978-3-031-82021-2\_22},
}
Figure