Two-Level Supervised Contrastive Learning for Response Selection in Multi-Turn Dialogue

Wentao Zhang, Shuang Xu, Haoran HuangarXiv 2022 · DOI

Abstract

This paper introduces a "Two-Level" supervised contrastive learning framework designed to improve response selection in retrieval-based chatbots. By combining token-level and sentence-level data augmentation with a specialized contrastive loss function, the authors achieve new state-of-the-art results on major multi-turn dialogue benchmarks, including Ubuntu, Douban, and E-Commerce datasets.

Introduction

In retrieval-based dialogue systems, the objective is to select the most appropriate response from a pool of candidates based on the preceding conversation history. Traditionally, these models are trained using cross-entropy loss. However, this approach suffers from two primary weaknesses: sensitivity to noise and the failure to create a sufficiently large "margin" in the embedding space between correct (positive) and incorrect (negative) responses. Without a clear separation, models struggle to capture the fine-grained features necessary to distinguish contextually relevant responses from irrelevant ones.

Methodology

The proposed framework integrates Supervised Contrastive Learning (SCL) into the fine-tuning process of a pre-trained language model, such as BERT. The approach relies on three main components:

1. Two-Level Data Augmentation

To create diverse "positive" views of a dialogue for contrastive learning, the authors employ two distinct techniques:

  • Sentence Token Shuffling (STS): Randomly selecting an utterance and shuffling its tokens to ensure robustness against local permutations.
  • Sentence Reordering (SR): Randomly swapping the positions of two utterances in the history (excluding the final utterance) to help the model learn global conversational structure.
Illustration of data augmentation strategies: Original Dialogue, Utterance Reorder, Utterance Token Shuffle, and Negative Example generation.

2. Hard Negative Leveraging

Rather than relying solely on random batch negatives, the authors utilize high-quality "hard" negatives—mismatched candidates that are semantically related but incorrect. A penalty factor ($\alpha$) is introduced to the similarity scores of these hard negatives, forcing the model to sharpen the decision boundary.

3. Hybrid Loss Function

The final objective function combines Supervised Contrastive Loss ($L_{SCL}$) with standard Binary Cross-Entropy Loss ($L_{CE}$): $$L = L_{SCL} + \lambda L_{CE}$$ This hybrid approach leverages the clustering benefits of contrastive learning while maintaining the classification stability of cross-entropy.

Experimental Results

The model, designated BERT$_{TL}^+$, was evaluated on three major benchmarks: Ubuntu Dialogue Corpus V1, Douban Corpus, and the E-Commerce Dialogue Corpus.

Comprehensive performance comparison of BERT$_{TL}^+$ against non-PrLM-based and PrLM-based state-of-the-art models across three datasets.

As shown in the results table, BERT$_{TL}^+$ significantly outperformed previous state-of-the-art (SOTA) methods:

  • E-Commerce: Achieved a 5.7% absolute improvement in Recall10@1 compared to the previous best model.
  • Douban: Improved Mean Average Precision (MAP) by 3.1% and Mean Reciprocal Rank (MRR) by 3.8%.
  • Ablation Studies: The "Two-Level" augmentation strategy consistently outperformed simpler strategies like standard Dropout. On the Douban corpus, the two-level approach improved MAP and MRR by nearly 1% over single-level strategies.

Key Insights

  • Structural vs. Token Invariance: Combining STS and SR allows the model to learn that dialogue meaning is invariant to noise at different scales. Sentence-level reordering proved particularly effective for multi-turn settings.
  • Hard Negative Penalty: Treating all negative examples as equal is suboptimal; the penalty factor is a simple yet effective way to improve embedding separation.
  • Domain Adaptation: Performing "Domain Adaptive Post-Training" before contrastive fine-tuning is a critical prerequisite to ensure the model is familiar with dataset-specific vocabulary.

Conclusion and Future Work

The Two-Level Supervised Contrastive Learning framework sets a new benchmark for multi-turn response selection. While highly effective, future research may address hyperparameter sensitivity and the computational overhead associated with contrastive learning. The authors also plan to investigate the generalizability of this method to other tasks such as reading comprehension and intent classification.

Summary updated

BibTeX
@misc{zhang2022two,
  author = {Wentao Zhang and Shuang Xu and Haoran Huang},
  title = {{Two-Level Supervised Contrastive Learning for Response Selection in Multi-Turn Dialogue}},
  year = {2022},
  eprint = {2203.00793},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2203.00793},
}
Figure