In machine learning, we often want to capture interactions between features. A simple linear model looks at features individually, but a second-order model looks at pairs, and a $q$-th order model looks at tuples of $q$ features. Mathematically, these interactions are represented by the tensor product (or outer product) of feature vectors.
The problem is the "dimensionality explosion." If your input vector has $d$ dimensions, its second-order interaction has $d^2$ dimensions, and its $q$-th order interaction has $d^q$. For a modest vector of 1,000 elements, a 3rd-order interaction already requires a billion dimensions—far too large to store in memory, let alone train on.
Tensor Sketching is a technique that allows us to work with these high-order interactions in near-linear time and constant memory. It enables powerful non-linear methods, like polynomial kernels and bilinear pooling, to scale to massive datasets.
The Sketching Shortcut
The core idea, pioneered by Ninh Pham and Rasmus Pagh in Fast and scalable polynomial kernels via explicit feature maps, is to avoid computing the full tensor product entirely. Instead, we compute a "sketch"—a compressed, low-dimensional representation—of the high-dimensional interaction.
To do this, we use a Count Sketch, a randomized dimensionality reduction tool. Normally, to sketch a tensor product $x \otimes y$, you would first compute the $d^2$ entries of the product and then project them down to a smaller dimension $m$. Tensor Sketching flips this: it allows you to compute the sketch of the product directly from the sketches of the individual vectors.
From Tensor Products to Circular Convolutions
The "Aha!" moment of Tensor Sketching is a mathematical equivalence: the sketch of a tensor product is approximately equal to the circular convolution of the sketches of its constituent vectors.
$$ \text{Sketch}(x \otimes y) \approx \text{Sketch}(x) * \text{Sketch}(y) $$
In Compact Bilinear Pooling, Yang Gao and colleagues used this property to compress the millions of features generated by bilinear layers in Convolutional Neural Networks (CNNs). By treating the interaction as a convolution, they reduced the feature size by two orders of magnitude with almost no loss in accuracy.
This works because the indices in a circular convolution naturally "bin" the products of the original vector entries in a way that mimics the behavior of a randomized projection. As Thomas D. Ahle and Jakob Bæk Tejs Knudsen show in Almost Optimal Tensor Sketch, this recursive sketching strategy can be extended to very high orders without the exponential overhead that usually plagues tensor methods.
Speeding up with the FFT
While circular convolution is more efficient than a full tensor product, it can still be slow if the sketch size $m$ is large. This is where the Fast Fourier Transform (FFT) comes in.
According to the Convolution Theorem, a convolution in the spatial domain is equivalent to element-wise multiplication in the frequency domain. To compute the sketch of a high-order interaction, we:
- Sketch the input vectors.
- Transform the sketches into the frequency domain using FFT.
- Multiply the transformed sketches element-wise.
- Transform the result back using the Inverse FFT.
This reduces the complexity from $O(d^q)$ to $O(q \cdot m \log m)$, where $m$ is the sketch size. Yining Wang and Anima Anandkumar demonstrated in Fast and Guaranteed Tensor Decomposition via Sketching that this approach can speed up tensor decomposition by 10x to 100x while maintaining rigorous accuracy guarantees.
Applications Across Domains
Because Tensor Sketching is differentiable, it has been integrated into various deep learning architectures to capture complex relationships:
- Computer Vision: Yin Cui and others developed Kernel Pooling for Convolutional Neural Networks, which uses sketching to allow CNNs to learn non-linear kernels (like Gaussian RBF) end-to-end.
- Recommendation Systems: In Holographic Factorization Machines for Recommendation, Yi Tay replaced standard dot products with circular convolutions to model rich, vector-valued interactions between users and items.
- Sequential Data: Recent work by Danilo Jr Dela Cruz and Harald Oberhauser in A User's Guide to KSig uses tensor sketching to approximate "signature kernels," which capture the geometric essence of time-series data without the usual computational wall.
By transforming the "curse of dimensionality" into a series of efficient Fourier-domain operations, Tensor Sketching makes high-order feature interaction a practical tool for large-scale machine learning.