Language Modeling Using Tensor Trains

Zhan Su, Yuqin Zhou, Benyou Wang, Qiuchi Li, Jakob Grue SimonsenICLR 2023

Abstract: We propose a novel tensor network language model based on the simplest tensor network (i.e., tensor trains), called 'Tensor Train Language Model' (TTLM). TTLM represents sentences in an exponential space constructed by the tensor product of words, but computing the probabilities of sentences in a low-dimensional fashion. We demonstrate that the architectures of Second-order RNNs, Recurrent Arithmetic Circuits (RACs), and Multiplicative Integration RNNs are, essentially, special cases of TTLM. Experimental evaluations on real language modeling tasks show that the proposed variants of TTLM (i.e., TTLM-Large and TTLM-Tiny) outperform the vanilla Recurrent Neural Networks (RNNs) with low-scale of hidden units.

Introduction

Human language is characterized by complex, long-range correlations that often follow a power law. Traditional models like LSTMs and vanilla RNNs frequently struggle to capture these higher-order statistics because their internal mechanisms are primarily additive. While tensor network language models have been proposed in theoretical physics and mathematics as a solution—due to their inherent ability to model power-law decay—they have historically been impractical for real-world NLP. Previous attempts were either purely theoretical or limited to "toy" datasets because they struggled with the computational complexity of large vocabularies and probability normalization. TTLM aims to bridge this gap, making tensor network language modeling practical for standard benchmarks.

The TTLM Framework

The core innovation of TTLM is representing a sentence as a tensor product of its word vectors. To avoid the "curse of dimensionality," where the state space grows exponentially with sentence length, the model employs Tensor Train (TT) decomposition. This technique breaks a massive, high-dimensional tensor into a chain of smaller, manageable "cores."

Graphical notation for tensors and tensor contraction.

TTLM functions similarly to a Recurrent Neural Network (RNN) by passing information forward as a hidden state, but it calculates conditional probabilities recursively through tensor contractions. The authors introduce two primary variants to balance expressivity and robustness:

  • TTLM-Tiny: A streamlined version designed to prevent overfitting by using a more direct interaction between inputs and hidden states.
  • TTLM-Large: A more expressive version that incorporates an additional parameter tensor ($W^{eh}$) to model complex interactions.
Architectural comparison of the general TTLM, TTLM-Tiny, and TTLM-Large.

Beyond these specific models, the paper provides a unified theoretical framework, mathematically proving that several existing multiplicative architectures—such as Second-order RNNs, Recurrent Arithmetic Circuits (RACs), and Multiplicative Integration RNNs (MI-RNNs)—are actually special cases of the TTLM framework.

Experimental Evaluation

The models were evaluated on two standard word-level language modeling benchmarks, moving beyond the toy datasets used in prior tensor research:

  1. Penn Treebank (PTB): A classic dataset with ~929k training tokens and a 10k vocabulary.
  2. WikiText-2: A modern dataset featuring ~2088k tokens and a vocabulary of over 30k types.

Performance was measured using Perplexity (PPL), where lower scores indicate higher predictive accuracy. TTLM demonstrated significant advantages in "low-scale" regimes (small numbers of hidden units/ranks):

  • WikiText-2: TTLM-Large reduced perplexity by 14.3 points compared to Vanilla RNNs.
  • PTB: TTLM-Large reduced perplexity by 16.0 points compared to Vanilla RNNs, achieving a PPL of 99.3 (outperforming the best baseline, Second-order RNN, at 108.2).

Key Insights and Limitations

The primary advantage of TTLM lies in its multiplicative (bilinear) interaction between the hidden state and the input. This allows the model to capture richer feature interactions than the additive gates found in standard RNNs. However, the researchers noted that TTLM-Large is more prone to overfitting as the rank increases, whereas TTLM-Tiny remains more stable.

While TTLM excels with a small number of hidden units, its relative advantage over vanilla RNNs diminishes as the model scale increases significantly. Future work will focus on exploring normalization functions specifically designed for tensor spaces and conducting benchmarks to quantify the model's long-range memory retention compared to Transformers.

Summary updated

BibTeX
@inproceedings{su2023language,
  author = {Zhan Su and Yuqin Zhou and Benyou Wang and Qiuchi Li and Jakob Grue Simonsen},
  title = {{Language Modeling Using Tensor Trains}},
  booktitle = {International Conference on Learning Representations},
  year = {2023},
  url = {https://openreview.net/forum?id=TqCHPi7xlV},
}
Figure