Sublinear Time Approximation of Text Similarity Matrices

Archan Ray, Nicholas Monath, Andrew McCallum, Cameron Musco
12/17/2021
cs.LGcs.CL

Official code: archanray/approximate_similarities (0 stars, Python, last commit 2021-06-04).

Abstract

We study algorithms for approximating pairwise similarity matrices that arise in natural language processing. Generally, computing a similarity matrix for $n$ data points requires $Ω(n^2)$ similarity computations.

Show full abstract

This quadratic scaling is a significant bottleneck, especially when similarities are computed via expensive functions, e.g., via transformer models. Approximation methods reduce this quadratic complexity, often by using a small subset of exactly computed similarities to approximate the remainder of the complete pairwise similarity matrix. Significant work focuses on the efficient approximation of positive semidefinite (PSD) similarity matrices, which arise e.g., in kernel methods. However, much less is understood about indefinite (non-PSD) similarity matrices, which often arise in NLP. Motivated by the observation that many of these matrices are still somewhat close to PSD, we introduce a generalization of the popular Nyström method to the indefinite setting. Our algorithm can be applied to any similarity matrix and runs in sublinear time in the size of the matrix, producing a rank-$s$ approximation with just $O(ns)$ similarity computations. We show that our method, along with a simple variant of CUR decomposition, performs very well in approximating a variety of similarity matrices arising in NLP tasks. We demonstrate high accuracy of the approximated similarity matrices in the downstream tasks of document classification, sentence similarity, and cross-document coreference.

View on arXivView PDF

Code Implementations(1)

00Python, MATLABJun 3, 20215 years ago

Similar Papers

Cite this paper

@article{ray2021sublinear,
  title  = {Sublinear Time Approximation of Text Similarity Matrices},
  author = {Archan Ray and Nicholas Monath and Andrew McCallum and Cameron Musco},
  year   = {2021},
  eprint = {2112.09631},
  archivePrefix = {arXiv},
  url    = {https://arxiv.org/abs/2112.09631}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2112.09631.svg)](https://codeofpaper.com/paper/2112.09631)

Discussion