Papers
Topics
Authors
Recent
Search
2000 character limit reached

HTTM: Head-Wise Temporal Token Merging

Updated 19 December 2025
  • The paper introduces HTTM, a training-free method that independently merges tokens per self-attention head, achieving up to 7× acceleration while preserving 3D reconstruction accuracy.
  • HTTM leverages spatio-temporal block-wise similarity and adaptive outlier filtering to significantly reduce computational cost without compromising quality.
  • Empirical results on benchmarks like 7Scenes and NRGBD demonstrate that HTTM efficiently scales global attention for long-sequence inputs in VGGT models.

Head-Wise Temporal Token Merging (HTTM) is a training-free method for accelerating global attention in the Visual Geometry Grounded Transformer (VGGT), centered on the 3D reconstruction of large scenes from multi-view or long-sequence inputs. HTTM performs token merging independently for each self-attention head, exploiting spatial–temporal patterns and redundancy within head-wise blocks, thereby circumventing the limitations of prior uniform or sparsity-based merging approaches. This yields a significant reduction in computational cost (up to 7× acceleration) with minimal degradation in 3D reconstruction accuracy in benchmarks such as 7Scenes and NRGBD (Wang et al., 26 Nov 2025).

1. Motivation and Rationale

VGGT’s global attention layers process all tokens from all input views, typically N20,000N \gg 20,000 for large scenes, leading to O(N2)O(N^2) time and memory complexity per layer. For lengthy sequences, this step becomes an inference bottleneck. Previous token merging techniques either merge tokens identically across all attention heads—thereby collapsing head-specific information and impairing representational power—or use uniform sparsity that fails to leverage VGGT’s inherent spatio-temporal redundancy. HTTM addresses both problems by merging tokens independently in each attention head (“head-wise”) and grouping tokens into small spatio-temporal blocks for block-wise similarity computation, enabling high merge ratios at reduced computational cost.

2. Formal Definition and Algorithm

Let XRN×dX \in \mathbb{R}^{N \times d} be the input token sequence, dd the embedding dimension, and hh the number of attention heads (dhead=d/hd_\mathrm{head} = d/h). After per-head projections, tokens are represented as queries, keys, and values:

Q,K,VRh×N×dhead,Q(i),K(i),V(i)RN×dheadQ,K,V \in \mathbb{R}^{h \times N \times d_\mathrm{head}}, \quad Q^{(i)},K^{(i)},V^{(i)} \in \mathbb{R}^{N \times d_\mathrm{head}}

2.1 Head-wise Temporal Merging Modules

For each head ii, two merging functions are defined:

Miq:RN×dheadRMi×dhead,Mik:RN×dheadRMi×dheadM_i^q : \mathbb{R}^{N \times d_\mathrm{head}} \to \mathbb{R}^{M_i \times d_\mathrm{head}}, \quad M_i^k : \mathbb{R}^{N \times d_\mathrm{head}} \to \mathbb{R}^{M_i \times d_\mathrm{head}}

which reduce the effective token count from NN to O(N2)O(N^2)0 per head. Values O(N2)O(N^2)1 are merged using the same index assignments as keys to preserve key–value consistency.

2.2 Spatio-temporal Block-wise Similarity and Merging

HTTM reorders tokens into O(N2)O(N^2)2 non-overlapping spatio-temporal blocks of size O(N2)O(N^2)3. Within each block for head O(N2)O(N^2)4 (O(N2)O(N^2)5), tokens are partitioned into destination O(N2)O(N^2)6 (size O(N2)O(N^2)7) and source O(N2)O(N^2)8 (size O(N2)O(N^2)9) sets, XRN×dX \in \mathbb{R}^{N \times d}0. The cosine similarity matrix within each block is:

XRN×dX \in \mathbb{R}^{N \times d}1

with XRN×dX \in \mathbb{R}^{N \times d}2 as the best matching index and XRN×dX \in \mathbb{R}^{N \times d}3 as the matching score for each source token.

Globally, the top XRN×dX \in \mathbb{R}^{N \times d}4 source tokens with the highest scores are merged into their matched destinations. For each destination token XRN×dX \in \mathbb{R}^{N \times d}5 receiving merges, the new merged token is the mean:

XRN×dX \in \mathbb{R}^{N \times d}6

These form the reduced per-head projected queries, keys, and values: XRN×dX \in \mathbb{R}^{N \times d}7, XRN×dX \in \mathbb{R}^{N \times d}8, and XRN×dX \in \mathbb{R}^{N \times d}9.

2.3 Merged Attention and Unmerging

Attention is computed as:

dd0

The final “unmerge” step recovers dd1 outputs per head by mapping each original token to the output of its merged cluster.

2.4 Adaptive Outlier Filtering (Optional)

L2 distance between each original token and its merged prototype is calculated, and a fraction dd2 of tokens with maximal deviation are designated “outliers” and excluded from merging. This step is critical for maintaining quality in blocks with low redundancy.

3. Pseudocode

The main steps can be structured as follows:

dhead=d/hd_\mathrm{head} = d/h4

4. Complexity and Computational Tradeoffs

The original global attention cost is dd3. For HTTM, dominant costs shift to:

  • Block-wise similarity computation: dd4.
  • Attention on the merged sequence (dd5): dd6.
  • Unmerging and projection: dd7.

The theoretical speedup dd8 is governed by the fraction dd9 of surviving tokens per head:

hh0

For hh1, the upper bound is hh2, though overall acceleration measured end-to-end reaches hh3–hh4 due to overheads.

5. Key Hyperparameters and Merging Strategy

  • Merge ratio per head (hh5): Lower values provide higher speedup at potential cost to reconstruction error.
  • Block size (hh6): Larger hh7 allows for improved global matching at hh8 cost. Typical hh9 balances quality and efficiency.
  • Source–destination split: E.g., 75% sources, 25% destinations.
  • Outlier-filtering rate (dhead=d/hd_\mathrm{head} = d/h0): Empirically, filtering the top 10% outliers (by L2 deviation) yields negligible drop in 3D accuracy.

Empirical findings show that for highly temporally continuous data, stacking in the temporal dimension (large dhead=d/hd_\mathrm{head} = d/h1) produces higher-quality merges, while for sparse-view scenarios, spatial grouping (large dhead=d/hd_\mathrm{head} = d/h2) is more beneficial. Hybrid spatio-temporal blocks generally outperform single-axis grouping.

6. Experimental Evaluation

On 7Scenes and NRGBD datasets, running on NVIDIA A100 with FlashAttention in bfloat16:

Method Q Ratio KV Ratio 7Scenes Acc. 7Scenes Comp. Time NRGBD Acc. NRGBD Comp. Time
VGGT* 1.00 1.00 0.019 0.021 9.1 s 0.010 0.010 13.9 s
FastVGGT 0.34 0.34 0.018 0.020 4.5 s 0.016 0.013 7.0 s
HTTM 0.20 0.30 0.020 0.023 4.3 s 0.012 0.010 6.8 s

End-to-end latency scales favorably as sequence length increases, with a 7× speedup demonstrated for 1000-frame NRGBD inputs. The majority of matching overhead (token matching) is substantially reduced in HTTM (0.12 s vs. 2.31 s for FastVGGT), while total aggregation remains efficient.

Ablation studies show the necessity of outlier filtering—without it, merging degrades reconstruction accuracy (dhead=d/hd_\mathrm{head} = d/h3 NRGBD Acc. as outlier filter increases to 10%). Mixing temporal and spatial block axes further improves merger quality over purely spatial approaches.

7. Limitations and Future Perspectives

HTTM is explicitly tailored to VGGT’s distinctive spatio-temporal redundancy (resulting from repeated Rotary-PE). Porting to alternative architectures may require retuning of block settings or merge ratios. The outlier filter is currently based on simple L2-thresholding; integration of learned gating or adaptive metrics could mitigate residual degradation. First-frame anchoring—protecting the initial frame’s tokens from merging—can further stabilize long-sequence global attention and is proposed for more systematic adoption.

Ongoing research directions include adaptive block sizes per head or layer, learned similarity projections beyond raw cosine metrics, and joint key–query merging under a global headwise budget (Wang et al., 26 Nov 2025).

Definition Search Book Streamline Icon: https://streamlinehq.com
References (1)

Topic to Video (Beta)

No one has generated a video about this topic yet.

Whiteboard

No one has generated a whiteboard explanation for this topic yet.

Follow Topic

Get notified by email when new papers are published related to Head-Wise Temporal Token Merging (HTTM).