Abstract
Semantic textual similarity (STS), a cornerstone task in NLP, measures the degree of similarity between a pair of sentences, and has broad application in fields such as information retrieval and natural language understanding. However, sentence similarity can be inherently ambiguous, depending on the specific aspect of interest. We resolve this ambiguity by proposing a novel task called Conditional STS (C-STS) which measures sentences' similarity conditioned on an feature described in natural language (hereon, condition). As an example, the similarity between the sentences "The NBA player shoots a three-pointer." and "A man throws a tennis ball into the air to serve." is higher for the condition "The motion of the ball" (both upward) and lower for "The size of the ball" (one large and one small). C-STS's advantages are two-fold: (1) it reduces the subjectivity and ambiguity of STS and (2) enables fine-grained language model evaluation through diverse natural language conditions. We put several state-of-the-art models to the test, and even those performing well on STS (e.g. SimCSE, Flan-T5, and GPT-4) find C-STS challenging; all with Spearman correlation scores below 50. To encourage a more comprehensive evaluation of semantic similarity and natural language understanding, we make nearly 19K C-STS examples and code available for others to train and test their models.
The Problem: Ambiguity in Similarity
Standard Semantic Textual Similarity (STS) often becomes a "guessing game" because similarity is fundamentally subjective. In traditional NLP, STS measures how "alike" two sentences are on a fixed scale. However, the authors argue that this task is inherently ill-defined without context.
Consider these two sentences:
- “The NBA player shoots a three-pointer.”
- “A man throws a tennis ball into the air to serve.”
Are they similar? If the focus is on the motion of the ball (upward trajectory), they are highly similar. If the focus is on the size of the ball, they are very different. Standard STS forces models to collapse these distinct facets into a single average score, leading to high subjectivity and limiting fine-grained evaluation. C-STS resolves this by providing a natural language "condition" that specifies the aspect of interest.
Methodology and Data Collection
The C-STS task uses quadruplets $(s_1, s_2, c, y)$, where $s_1$ and $s_2$ are the sentences, $c$ is the free-form natural language condition, and $y$ is the similarity score.
Data Collection Pipeline
The authors introduced the C-STS-2023 dataset, containing 18,908 instances sourced from image-captioning datasets like MS COCO and Flickr30K. The collection process involved a multi-stage pipeline designed to find sentence pairs that describe similar scenes but differ in specific details.
Modeling Architectures and Loss Functions
The researchers explored several architectures to handle the conditional input:
- Cross-Encoders: Concatenating $(s_1, s_2, c)$ into a single string.
- Bi-Encoders: Encoding $(s_1, c)$ and $(s_2, c)$ separately before computing cosine similarity.
- Tri-Encoders: A novel approach encoding $s_1$, $s_2$, and $c$ entirely separately, then using a transformation function to condition the sentence embeddings.
To improve training, they introduced a Quadruplet Contrastive Margin Loss. This leverages the dataset's structure—where each sentence pair often has one "high-similarity" condition and one "low-similarity" condition—forcing the model to distinguish between them.
Key Insights and Results
The study revealed several critical gaps in current language model capabilities:
- Zero-Shot Failure: Models that excel at standard STS (e.g., SimCSE-Large) perform near random on C-STS in zero-shot settings. This suggests that current models are over-fit to a general, unconditional notion of similarity.
- The Difficulty of Conditioning: Even after fine-tuning, models struggle to surpass a Spearman correlation of 50. The best-performing model, a fine-tuned SimCSE-Large Bi-encoder, achieved a score of 47.5.
- Early vs. Late Interaction: Bi-encoders outperformed Tri-encoders, suggesting that "early interaction"—where the model processes the condition alongside the sentence—is more effective than "late interaction" via pre-computed embeddings.
- LLM Benchmarking: GPT-4 achieved a Spearman score of 43.6 in a 4-shot setting. While strong for a general-purpose model, it still lags behind specialized, fine-tuned encoders.
Conclusion
C-STS provides a more rigorous and less subjective benchmark for semantic understanding. While current results show that models struggle with multi-faceted reasoning, the performance scales linearly with data, suggesting that larger datasets and better architectural designs for condition injection could bridge the gap. Future work aims to expand the dataset beyond visual scene descriptions into more abstract domains like legal or scientific text.
Summary updated