Learning Semantic Textual Similarity from Conversations

Yinfei Yang, Steve Yuan, Daniel Cer, Sheng-yi Kong, Noah Constant, Petr Pilar, Heming Ge, Yun-Hsuan Sung, Brian Strope, Ray Kurzweil

Introduction

Semantic Textual Similarity (STS) is a fundamental challenge in Natural Language Processing (NLP), requiring models to determine if two sentences convey the same meaning. Traditional methods often rely on word overlap, which fails to capture nuances where different words share meanings (e.g., "How old are you?" vs. "What is your age?") or similar words diverge (e.g., "How are you?" vs. "How old are you?"). While supervised deep learning has improved performance, it is constrained by the high cost of human-labeled datasets. This paper explores a scalable alternative: leveraging massive, unlabeled conversational data to learn deep semantic representations.

The Core Intuition: Responses as Semantic Proxies

The authors propose that the "meaning" of a sentence can be effectively modeled by the reactions it elicits in a conversation. The central hypothesis is that semantically similar inputs will share a similar distribution of potential responses. For instance, both "How old are you?" and "What is your age?" are likely to be followed by a response stating a number of years. Conversely, "How are you?" elicits a completely different set of responses, such as "Great" or "I'm doing well."

Semantically similar inputs elicit similar responses, providing a signal for learning sentence meaning.

By training a model to predict these responses, the system learns to group similar questions together in a high-dimensional vector space, even without explicit labels.

Model Architecture: The Dual-Encoder Framework

To implement this idea, the researchers utilized a dual-encoder architecture. This framework consists of two encoders that transform the input sentence and the candidate response into fixed-length vectors, denoted as $u$ and $v$, respectively.

The dual-encoder architecture scores input-response pairs using a dot product of their vector representations.

As shown in the architecture diagram, the encoders share parameters. To account for the inherent asymmetry between a question and its answer, the response vector $v$ is passed through an additional Deep Neural Network (DNN) layer to produce $v'$. The compatibility between the input and the response is then calculated using the dot product $(u^T \cdot v')$. During training, the model learns to maximize this score for correct pairs while minimizing it for incorrect ones.

Encoder Variations and Multitask Learning

The study compared two primary encoder types:

  1. Deep Averaging Network (DAN): A computationally efficient model that averages word and bigram embeddings.
  2. Transformer: A more sophisticated architecture that uses self-attention to capture context and word order.

The Transformer encoder significantly outperformed the DAN, achieving a 65.7% Precision at 1 (P@1) in response selection compared to the DAN's 56.1%. This suggests that capturing long-range dependencies and contextual nuances is critical for understanding conversational semantics.

Furthermore, the authors employed a multitask learning strategy. The model was trained simultaneously on the unsupervised Reddit dataset (600 million pairs) and the supervised Stanford Natural Language Inference (SNLI) dataset. This combination allowed the model to benefit from both the broad "common sense" knowledge found in social media conversations and the rigorous logical signals provided by NLI tasks.

Results and Evaluation

The performance of the resulting embeddings was evaluated on the STS Benchmark, a gold-standard dataset for sentence similarity. The multitask "Reddit+SNLI" model achieved a Pearson’s $r$ of 0.808, setting a new state-of-the-art for neural-only models at the time.

The model also demonstrated impressive "zero-shot" capabilities. On the Community Question Answering (CQA) task, the Reddit-trained model was highly competitive without any task-specific fine-tuning. This indicates that the learned embeddings are robust and generalize well across different domains.

Conclusion

By treating conversational responses as proxies for semantic meaning, this research provides a powerful method for training high-quality sentence embeddings at scale. The success of the dual-encoder Transformer, especially when augmented with logical inference data, highlights the potential of using the vast, naturally occurring data on the web to solve core NLP challenges. Future work may extend this approach to multi-modal data and a wider variety of languages.

Summary updated

BibTeX
@inproceedings{yang2018learning,
  author = {Yinfei Yang and Steve Yuan and Daniel Cer and Sheng-yi Kong and Noah Constant and Petr Pilar and Heming Ge and Yun-Hsuan Sung and Brian Strope and Ray Kurzweil},
  title = {{Learning Semantic Textual Similarity from Conversations}},
  booktitle = {Rep4NLP @ ACL},
  year = {2018},
  doi = {10.18653/v1/w18-3022},
}
Figure