Low-Rank Approximations of Second-Order Document Representations.

Jarkko Lagus, Janne Sinkkonen, Arto KlamiCoNLL 2019

Abstract

Document embeddings, created with methods ranging from simple heuristics to statistical and deep models, are widely applicable. Bag-of-vectors models for documents include the mean and quadratic approaches (Torki, 2018). We present evidence that quadratic statistics alone, without the mean information, can offer superior accuracy, fast document comparison, and compact document representations. In matching news articles to their comment threads, low-rank representations of only 3-4 times the size of the mean vector give most accurate matching, and in standard sentence comparison tasks, results are state of the art despite faster computation. Similarity measures are discussed, and the Frobenius product implicit in the proposed method is contrasted to Wasserstein or Bures metric from the transportation theory. We also shortly demonstrate matching of unordered word lists to documents, to measure topicality or sentiment of documents.

Introduction

Representing documents as single vectors is a cornerstone of natural language processing. Current approaches typically fall into two categories: simple heuristics like averaging word embeddings (fast but lossy) and deep learning models like BERT (accurate but computationally heavy). This paper identifies a "missing middle": representations that capture the descriptive power of word distributions without the overhead of massive transformers.

Word distributions in documents are often skewed, resembling a "comet" with multiple tails representing specific topics or sentiments. Simple averaging collapses these distributions into a single point, losing critical nuance. We propose using second-order statistics—specifically the covariance of word embeddings—to capture these structural details.

Methods

The core of our approach is the use of second-order document representations. If a document is represented by a matrix $D$ of word vectors, its second-order information is captured by the matrix $D^T D$. Comparing two documents involves the Frobenius inner product of these matrices.

To address the storage and computation costs of full covariance matrices (e.g., 90,000 elements for 300-dimensional embeddings), we employ Singular Value Decomposition (SVD) to find a low-rank approximation of rank $k$. By storing only the top $k$ principal vectors scaled by their eigenvalues, we create a compact representation that is only a few times larger than a standard mean vector.

Furthermore, we demonstrate that this "Frobenius cosine" similarity is mathematically related to the Wasserstein (or Bures) metric from optimal transport theory. However, our method is significantly faster to compute as it avoids the expensive matrix square roots and diagonalizations required by transport-based metrics.

Results

The method was evaluated on the SentEval benchmark (English STS tasks) and a large-scale Finnish news dataset consisting of 88,986 articles and their associated comment threads.

Compactness and Rank

A key finding is that most performance gains are realized at very low ranks. As shown in Figure 3, performance on STS tasks plateaus quickly, typically around $k=5$ to $k=10$. This suggests that a document can be accurately represented with a vector only 3-10 times the size of a standard word embedding.

Performance on STS tasks as a function of approximation rank k.

Benchmark Performance

On standard sentence similarity tasks, the low-rank Frobenius method outperformed almost all other unsupervised methods and remained competitive with semi-supervised models. Notably, even a rank-1 approximation often outperforms the standard mean vector approach, despite having similar computational complexity.

Comparison of the proposed Frobenius method against unsupervised and semi-supervised baselines on STS benchmarks.

Document Matching

In the Finnish news task, the quadratic approach significantly outperformed mean-based baselines, including those using SIF weighting. We observed that once second-order information is included, adding the mean vector back in provides negligible benefit, indicating that the covariance structure effectively subsumes the information in the mean.

Discussion

Our approach offers a "local" alternative to global models; it does not require corpus-wide pre-computation or massive model updates, making it suitable for streaming data. While it remains a "bag-of-vectors" approach that ignores word order, its efficiency and accuracy make it a powerful tool for retrieval and similarity tasks. Future work will explore higher-order moments and the theoretical underpinnings of SVD as a regularizer in this context.

Summary updated

Abstract

Document embeddings, created with methods ranging from simple heuristics to statistical and deep models, are widely applicable. Bag-of-vectors models for documents include the mean and quadratic approaches (Torki, 2018). We present evidence that quadratic statistics alone, without the mean information, can offer superior accuracy, fast document comparison, and compact document representations. In matching news articles to their comment threads, low-rank representations of only 3-4 times the size of the mean vector give most accurate matching, and in standard sentence comparison tasks, results are state of the art despite faster computation. Similarity measures are discussed, and the Frobenius product implicit in the proposed method is contrasted to Wasserstein or Bures metric from the transportation theory. We also shortly demonstrate matching of unordered word lists to documents, to measure topicality or sentiment of documents.
BibTeX
@inproceedings{lagus2019low,
  author = {Jarkko Lagus and Janne Sinkkonen and Arto Klami},
  title = {{Low-Rank Approximations of Second-Order Document Representations.}},
  booktitle = {CoNLL},
  year = {2019},
  url = {https://openreview.net/forum?id=ilDW0lYy5lg},
}
Figure