Manuscript Offprint

arXiv:2610.09274

Hardware-aware Calibrated Clustered Attention for Efficient Visual Geometric Transformers

Weitian Wang, Shubham Rai, Cecilia De La Parra, Akash Kumar

Weitian Wang 1,2^{1,2}, Rai Shubham 1^{1}, Cecilia De La Parra 1^{1}, Akash Kumar 2^{2}

1^{1}Robert Bosch GmbH, Germany, 2^{2}Ruhr University Bochum, Germany

Abstract—The Visual Geometry Grounded Transformer (VGGT) marks a significant leap forward in 3D scene reconstruction, as it is the first model that directly infers all key 3D attributes (camera poses, depths, and dense geometry) jointly in one pass. However, this joint inference mechanism requires global attention layers with extremely long sequences that causes a significant latency bottleneck. In this paper, we propose blockwise clustered attention (BC attention) to accelerate the global attention layers in VGGT. By limiting the clustering within HW-friendly neighborhood blocks, BC attention reduces the computation overhead of query clustering as well as the costly data movement between on- and off-chip memory. This enables BC attention to scale to long sequences and deliver practical latency improvements on GPUs. Moreover, we introduce a hashing hyperplane calibration method and a threshold-based error compensation method to reduce clustering errors efficiently, which is a bottleneck in the current clustered attention mechanism. Overall, our experiments on GPU demonstrate that calibrated BC attention accelerates the global attention layers by 2.10−2.63×2.10-2.63\times and the whole backbone by 1.77−2.35×1.77-2.35\times with negligible loss (1%) for large scenes. With a small performance loss (<5%), calibrated BC attention further achieves a 2.26−2.87×2.26-2.87\times latency improvement on the global attention layers and a 1.90−2.55×1.90-2.55\times improvement on the backbone.

I. INTRODUCTION

The Visual Geometry Grounded Transformer (VGGT) [1] is a recently proposed feed-forward transformer model that directly infers all key 3D attributes of a scene from a variable number of views. By this direct inference, VGGT can outperform state-of-the-art methods while avoiding costly visual-geometry post-processing methods, marking an important breakthrough in 3D computer vision.

As shown in Fig 1, one of the key designs of VGGT is its alternating frame-wise and global attention. In the global attention layers, all tokens from different views participate in the multi-head attention computation. In practice, this approach results in extremely long token sequences (more than 20k tokens) even for small scenes. Thus, the global attention layers become the main latency bottleneck of VGGT, limiting its efficiency on medium and large scene reconstruction.

Motivated by the development of long-context large language models (LLMs) and vision language models (VLMs), many methods [2], [3] have been proposed to ease the high computational costs of long-sequence attention layers. These methods are mainly sparsity-based methods that exploit the pattern that the attention scores of LLMs and VLMs tend

Figure

Fig. 1: Architecture overview of VGGT [1]. The global attention layers that perform attention computations across tokens from all views cause a significant latency bottleneck.

to concentrate on a small part of tokens. However, unlike LLMs and VLMs, the attention distributions of VGGT's global attention layers are non-sparse (rare drastic attention scores as shown in Fig. 2), making these sparsity-based methods not ideal.

On the other hand, this non-drastic attention distribution pattern favors similarity-based methods as the attention weight distributions don’t change largely from token to token. Clustered attention [4] was originally proposed to accelerate the attention layers of BERT [5]. Utilizing the similarity between queries, it approximates attention computation by grouping similar queries into clusters and computing attentions only for the cluster centroids; we further refer to this work as vanilla clustered attention. Despite its novelty, accelerating modern large vision transformers like VGGT on GPUs with vanilla clustered attention faces several challenges, including large computational and memory access overheads, as well as incompatibility with modern highly efficient attention kernels like FlashAttention [6].

To address these challenges, we propose blockwise clustered attention (BC attention) that revisits the idea of clustered attention for VGGT. With hardware-aware algorithmic co-design and optimized GPU implementation, BC attention achieves practical latency improvements on VGGT with negligible performance loss. While our experiments are demonstrated on NVIDIA GPUs, our method is applicable across most types of NVIDIA architectures and can be extended to other accelerator

Emails: {weitian.wang, shubham.rai, cecilia.delaparra}@bosch.com, akash.kumar@ruhr-uni-bochum.de systems. Our main contributions are summarized as follows:

  • We introduce a hardware-aware blockwise clustering design that lowers the computation overhead and costly on-and off-chip data movement of vanilla clustered attention, enabling practical latency improvements on GPUs for long token sequences.

  • We propose a novel gradient-based hashing hyperplanes calibration method using differentiable surrogates. Compared with randomly sampled hyperplanes used in vanilla clustered attention, adopting calibrated hyperplanes in the BC attention gives robust results that are more representative of the accurate attention results.

  • We replace the unstructured top-k error compensation in vanilla clustered attention with a structured threshold-based error compensation method that effectively compensates the clustering error. Unlike unstructured attention, these threshold-based structured attention can be efficiently leveraged by high-performance attention kernels such as FlashAttention [6].

References (28)