Higher Order Transformers With Kronecker-Structured Attention

Soroush Omranpour, Guillaume Rabusseau, Reihaneh Rabbany

Abstract

Modern datasets are increasingly high-dimensional and multiway, often represented as tensor-valued data with multi-indexed variables. While Transformers excel in sequence modeling and high-dimensional tasks, their direct application to multiway data is computationally prohibitive due to the quadratic cost of dot-product attention and the need to flatten inputs, which disrupts tensor structure and cross-dimensional dependencies. We propose the Higher-Order Transformer (HOT), a novel factorized attention framework that represents multiway attention as sums of Kronecker products or sums of mode-wise attention matrices. HOT efficiently captures dense and sparse relationships across dimensions while preserving tensor structure. Theoretically, HOT retains the expressiveness of full high-order attention and allows complexity control via factorization rank. Experiments on 2D and 3D datasets show that HOT achieves competitive performance in multivariate time series forecasting and image classification, with significantly reduced computational and memory costs. Visualizations of mode-wise attention matrices further reveal interpretable high-order dependencies learned by HOT, demonstrating its versatility for complex multiway data across diverse domains.

Introduction

Modern datasets are increasingly "multiway"—encompassing 3D medical scans, videos, or multi-variable climate data. While Transformers are the gold standard for sequence modeling, they face significant hurdles when applied to such high-dimensional data. First, standard Transformers require "flattening" a tensor into a 1D vector, which destroys natural spatial or temporal relationships. Second, the quadratic complexity of self-attention relative to the number of tokens creates a "quadratic wall." For instance, a $128^3$ volume results in over 2 million tokens, making standard attention computationally infeasible.

The Higher-Order Transformer (HOT) addresses these challenges by treating data as multi-dimensional tensors. By factorizing high-order attention into sums of Kronecker products, HOT captures complex cross-dimensional dependencies with significantly lower computational and memory costs.

Methodology: Kronecker-Structured Attention

The core innovation of HOT is the replacement of standard attention with a factorized mechanism. Instead of computing one massive attention matrix for a flattened input, HOT computes smaller mode-wise attention matrices for each dimension (e.g., X, Y, and Z axes).

The Higher-Order Transformer architecture featuring Kronecker Factorized Multihead Attention.

These smaller matrices are combined using Kronecker-structured formulations. The paper introduces two primary variants:

  1. HOT (product): Represents the full attention matrix as a Kronecker product of mode-wise matrices.
  2. HOT (sum): Represents the attention as a normalized Kronecker sum.

By exploiting the mathematical properties of Kronecker products, the model applies attention to the value tensor mode-by-mode. This avoids the explicit construction of the massive full attention matrix, reducing complexity from $O(N^2)$ to near-linear relative to the total number of elements.

Mathematical representation of a high-order attention matrix S as a sum of Kronecker products of mode-wise matrices.

The authors provide a theoretical guarantee showing that a sum of Kronecker products can approximate any high-order attention matrix, ensuring that HOT remains as expressive as a full Transformer. Furthermore, the Kronecker sum variant is shown to be more robust against "rank collapse"—a common issue where model representations become redundant.

Experimental Evaluation

The authors evaluated HOT across three distinct high-dimensional domains: Long-range Time-series Forecasting (ECL, Traffic, Weather), 3D Medical Image Classification (MedMNIST3D), and Multispectral Image Segmentation (SSL4EO-L).

Key Results

  • Efficiency: On 3D medical tasks, HOT required only 0.21 GB of GPU memory, a drastic reduction from the 0.74 GB needed by a standard Vision Transformer (ViT).
  • Performance: In multivariate forecasting, HOT matched the accuracy of full Transformers while utilizing only one-third of the GFLOPS.
  • State-of-the-Art: HOT (product) achieved state-of-the-art results on several MedMNIST3D tasks, outperforming specialized models like ResNet-3D and MedNet.
  • Interpretability: Because HOT learns separate matrices for each dimension, the attention maps are inherently interpretable. For example, temporal attention maps in time-series data revealed learned periodic cycles (daily/weekly).

Discussion and Future Work

While HOT demonstrates significant gains in efficiency and performance for encoder-based tasks, several avenues for future research remain. The current study focuses primarily on the Transformer encoder; extending HOT to auto-regressive, decoder-only settings for generative tasks is a logical next step. Additionally, the authors suggest that more sophisticated pooling functions for creating mode-wise queries and keys could further enhance performance. Future work will also explore integrating HOT with other tensor decomposition techniques, such as Tucker or Tensor Train, to model even higher-order relationships in domains like large-scale video processing.

Summary updated

BibTeX
@article{omranpour2025higher,
  author = {Soroush Omranpour and Guillaume Rabusseau and Reihaneh Rabbany},
  title = {{Higher Order Transformers With Kronecker-Structured Attention}},
  journal = {Accepted by TMLR},
  year = {2025},
  url = {https://openreview.net/forum?id=QN0aXcKFkT},
}
Figure