While Transformers have revolutionized natural language processing and computer vision, they have historically struggled to consistently beat "old-school" tree-based models like XGBoost on tabular data. A new paper from ICML 2024, "Polynomial-based Self-Attention for Table Representation Learning," identifies a key culprit for this performance gap: oversmoothing. To address this, the authors propose a clever fix inspired by graph signal processing that allows Transformers to finally gain the upper hand on structured data.
The Problem: Oversmoothing in Tabular Data
In tabular data representation, each column is typically treated as a "token." As a Transformer gets deeper, these token representations tend to become nearly identical—a phenomenon known as oversmoothing.
Standard self-attention acts as a low-pass filter. It aggregates information by taking weighted averages, which naturally smooths out the signals. While this is often fine for text or images where local context is highly redundant, tabular data relies on precise, often high-frequency relationships between disparate features. When a model oversmooths, it loses the discriminative power needed to tell features apart in the deeper layers of the network.
The Solution: TabPSA
To combat oversmoothing, the authors propose TabPSA (Table Representation using Polynomial-based Self-Attention). Instead of the standard attention operation ($AV$), they replace the attention layer with a matrix polynomial:
$$HV \approx \alpha_0 P_0(A)V + \alpha_1 P_1(A)V + \dots + \alpha_k P_k(A)V$$
Where $A$ is the attention matrix, $V$ is the value matrix, and $P_k(A)$ are polynomial terms with learnable coefficients $\alpha_k$.
Key Innovations
- Graph Signal Processing (GSP) Perspective: The authors treat the attention matrix as an adjacency matrix of a graph, and the self-attention mechanism as a graph filter. By using a polynomial of the matrix, they can design filters that capture both low- and high-frequency information, breaking the low-pass barrier.
- Jacobi Bases: Using simple powers ($A^k$) can lead to numerical instability. The authors use Jacobi polynomials (an orthogonal basis) to stabilize training. This allows the model to learn coefficients that effectively "boost" important signals.
- PageRank Convergence: They prove that attention matrices satisfy the conditions for PageRank convergence. This means the polynomial series converges very quickly, requiring only a small number of terms (usually $k=3$ or $5$) to achieve excellent results.
Key Insights and Results
The researchers evaluated TabPSA across 10 real-world tabular datasets covering binary classification, multi-class classification, and regression. These datasets varied significantly in size and feature types, providing a robust benchmark.
- Visualizing the Fix: In a standard TabTransformer, the cosine similarity between tokens approaches 1.0 as layers increase, indicating total oversmoothing. With TabPSA, the similarity remains much lower, proving the model successfully maintains distinct feature representations even in deep layers.
- State-of-the-Art Performance: TabPSA was integrated into three major models: TabTransformer, SAINT, and MET. In every case, it improved performance. For the MET model, TabPSA provided a 5.76% average improvement.
- Beating the Trees: In 6 out of 10 datasets, the TabPSA-equipped Transformers outperformed traditional heavyweights like XGBoost and Random Forest.
- Tabular Efficiency & Minimal Overhead: In NLP, the number of tokens can be in the thousands, making matrix polynomials expensive. In tabular data, the number of columns is usually small (tens or hundreds), making this approach highly scalable. Despite the extra matrix operations, training time only increased by about 1% to 25% depending on the base model, with negligible increases in memory usage.
Limitations and Future Work
While highly effective for tabular data, the $O(n^{2.37}d)$ complexity of matrix multiplication means this approach might struggle with the massive sequence lengths found in Large Language Models (LLMs) without further optimization. Additionally, the choice of polynomial type (Chebyshev vs. Legendre vs. Jacobi) and the order $k$ requires some hyperparameter tuning, though the model proved generally robust.
Interestingly, the authors briefly demonstrated success applying this method to BERT for text classification, suggesting that polynomial-based attention might serve as a general-purpose tool for fighting oversmoothing across various Transformer architectures in the future.
Summary updated