Skip to main content
QUICK REVIEW

[Paper Review] Situating Sentence Embedders with Nearest Neighbor Overlap

Lucy H. Lin, Noah A. Smith|arXiv (Cornell University)|Sep 24, 2019
Topic ModelingComputer Science27 references5 citations
TL;DR

This paper introduces Nearest Neighbor Overlap (N2O), a task-agnostic method to compare sentence embedders by measuring the overlap in their nearest neighbors across a corpus. N2O reveals that BERT and GPT embeddings are outliers in semantic similarity behavior, while subword modeling and averaging strategies significantly affect similarity alignment, with ELMo models showing strong paraphrase detection ability.

ABSTRACT

As distributed approaches to natural language semantics have developed and diversified, embedders for linguistic units larger than words have come to play an increasingly important role. To date, such embedders have been evaluated using benchmark tasks (e.g., GLUE) and linguistic probes. We propose a comparative approach, nearest neighbor overlap (N2O), that quantifies similarity between embedders in a task-agnostic manner. N2O requires only a collection of examples and is simple to understand: two embedders are more similar if, for the same set of inputs, there is greater overlap between the inputs' nearest neighbors. Though applicable to embedders of texts of any size, we focus on sentence embedders and use N2O to show the effects of different design choices and architectures.

Motivation & Objective

  • To develop a task-agnostic, corpus-based method for comparing sentence embedders without requiring annotations or downstream tasks.
  • To understand how architectural choices and training objectives influence the semantic similarity behavior of sentence embedders.
  • To evaluate the robustness of nearest neighbor overlap as a comparative metric across different corpus samples and sizes.
  • To explore whether embedders can reliably identify paraphrases in a corpus using nearest neighbor search.
  • To identify stable and unstable nearest neighbors across multiple embedders for improved interpretability.

Proposed method

  • N2O computes the average overlap in the k-nearest neighbors of a set of query sentences across two embedders, using a large unannotated corpus.
  • For each query sentence sampled from the corpus, the method retrieves the k nearest neighbors under each embedder and computes the Jaccard similarity of their neighbor sets.
  • The final N2O score is the mean overlap across all queries, normalized to [0,1], where 1 indicates perfect neighbor set agreement.
  • The method is applied to 21 sentence embedders across multiple architectures and training regimes, using a Gigaword-derived corpus for evaluation.
  • Additional analyses include identifying stable neighbors (consistent across embedders) and unstable neighbors (disagreement across models), and evaluating paraphrase detection via needle-in-a-haystack experiments.
  • The approach is validated for robustness across varying sample sizes and query sets, ensuring reliability in real-world settings.

Experimental results

Research questions

  • RQ1How do different sentence embedders compare in their nearest neighbor behavior across a real-world corpus?
  • RQ2To what extent do architectural choices such as subword modeling, pooling strategy, or model type (e.g., BERT vs. GPT) affect semantic similarity alignment?
  • RQ3How well can sentence embedders identify paraphrases in a corpus when using nearest neighbor search?
  • RQ4Which sentence neighbors are consistently retrieved across multiple embedders, and which are model-specific?
  • RQ5How robust is the N2O metric across different corpus samples and sizes?

Key findings

  • ELMo models, particularly the larger variants, achieve the highest mean reciprocal rank (MRR = 0.910) in identifying paraphrases from a haystack of sentences.
  • Averaged BERT and GPT embeddings outperform their [CLS] or last-token counterparts in paraphrase detection, consistent with their higher N2O scores.
  • BERT and GPT models are identified as outliers in N2O analysis, showing low similarity in nearest neighbor behavior compared to other embedders.
  • The use of subword information significantly increases similarity in nearest neighbor behavior across embedders, especially in models like fastText and ELMo.
  • Static word embeddings (e.g., GloVe, Word2Vec) show high similarity in nearest neighbor sets, indicating strong alignment in their semantic space.
  • The N2O metric is robust across different sample sizes and query sets, demonstrating stability for comparative evaluation.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.