Dialogue Response Generation via Contrastive Latent Representation Learning

Shuyang Dai, Guoyin Wang, Sunghyun Park, Sung‐Jin Lee2021 · DOI

Abstract

Large-scale auto-regressive models have achieved great success in dialogue response generation with the help of Transformer layers. However, these models often fail to learn a representative latent space of the sentence distribution, making it difficult to control generation and capture the high-level semantic relationships between speakers. In this work, we construct a robust sentence representation learning model specifically designed for dialogue response generation, utilizing a Transformer-based encoder-decoder structure and contrastive learning.

Introduction: Beyond Token-Matching

While large-scale auto-regressive (AR) models like GPT-2 are incredibly fluent, they often struggle with the underlying logic of a conversation. They are prone to "copy-catting"—generating responses that use similar words to the input context but lack semantic coherence. This occurs because these models focus on predicting the next word rather than understanding the high-level relationship between utterances.

Furthermore, standard AR models lack a structured latent space—a mathematical "map" of sentence meanings. Without this, it is difficult to control the generation process or ensure that the model captures the underlying intent of a conversation. Existing attempts to address this using Variational Autoencoders (VAEs) often rely on shallower architectures or fail to fully exploit the rich context-response patterns found in dialogue datasets.

Methodology: Transformer-based CVAE and Contrastive Learning

The proposed framework addresses these limitations by combining the fluency of Transformer models with the structured latent space of a Conditional Variational Autoencoder (CVAE).

The proposed Transformer-based CVAE architecture, illustrating the training (blue) and inference (yellow) pathways.

1. Transformer-based CVAE Backbone

The model uses a BERT-based encoder to map the conversation context into a latent representation (a vector representing the "meaning" of the dialogue) and a GPT-2 decoder to generate a natural language response from that vector.

2. Utterance-level Contrastive Learning (CL)

To ensure the latent space is truly predictive, the authors incorporate a contrastive loss. The model is trained to ensure that the latent representation of the current context is "closer" to the representation of the actual next response than it is to other, unrelated responses. This forces the model to "plan" the meaning of the response before generating it.

3. Hard Negative Sampling (HNS)

Contrastive learning is enhanced through Hard Negative Sampling. Instead of random distractors, the authors use a pretrained Multi-hop Selector Network (MSN) to find "hard negatives"—sentences that appear semantically relevant but are logically incorrect responses. This forces the model to learn the fine-grained nuances of logical consistency.

Experimental Setup

The model was evaluated on two popular multi-turn dialogue benchmarks:

  • DailyDialog: A high-quality dataset of 13,000 daily conversations, known for its low noise levels.
  • PersonaChat: A dataset of 11,000 dialogues where participants maintain specific assigned personas.

Key Results

The proposed CVAE + CL model consistently outperformed strong baselines, including standard GPT-2 and PLATO, across several key dimensions.

Quantitative results on the PersonaChat dataset, demonstrating the CVAE + CL model's superior performance in BLEU-F1 and diversity (Distinct) metrics.
  • Improved Logic and Fluency: On the PersonaChat dataset, the model achieved a BLEU-F1 score of 0.323, significantly higher than GPT-2 (0.215).
  • Increased Diversity: The model showed much higher "Distinct" scores (dist-1/dist-2), indicating a wider variety of unique words and phrases and a reduction in repetitive loops.
  • Human-like Evaluation: Using automated "reference-free" metrics (like DialogRPT) that correlate with human preference, the CVAE + CL model consistently scored higher in categories like conversation "width" and "depth" compared to standard auto-regressive models.

Conclusion and Future Work

This work demonstrates that the structured latent space of a VAE and the powerful generation of a Transformer can be effectively hybridized for dialogue. By distinguishing between "good" responses and "plausible-looking but wrong" responses via Hard Negative Sampling, the authors significantly reduced the "copy-cat" behavior seen in standard models.

Future research could scale this framework to even larger pretrained models or adapt it for specialized tasks like emotional support or task-oriented dialogue, where logical consistency is paramount. However, the model's dependency on the quality of the pretrained MSN selector remains a potential limitation for future refinement.

Summary updated

Abstract

Large-scale auto-regressive models have achieved great success in dialogue response generation, with the help of Transformer layers. However, these models do not learn a representative latent space of the sentence distribution, making it hard to control the generation. Recent works have tried to learn sentence representations using Transformerbased framework, but do not model the context-response relationship embedded in the dialogue datasets. In this work, we aim to construct a robust sentence representation learning model, that is specifically designed for dialogue response generation, with Transformer-based encoder-decoder structure.
BibTeX
@misc{dai2021dialogue,
  author = {Shuyang Dai and Guoyin Wang and Sunghyun Park and Sung‐Jin Lee},
  title = {{Dialogue Response Generation via Contrastive Latent Representation Learning}},
  year = {2021},
  doi = {10.18653/v1/2021.nlp4convai-1.18},
}

Loading related content...

Figure