Hi Model, generating 'nice' instead of 'good' is not as bad as generating 'rice'! Towards Context and Semantic Infused Dialogue Generation Loss Function and Evaluation Metric

Abhisek Tiwari, Muhammed Sinan, Kaushik Roy, Amit Sheth, Sriparna Saha, Pushpak BhattacharyyaarXiv 2023

TL;DR

This paper introduces SemTextualLogue, a novel loss function for dialogue generation that moves beyond simple word-matching to incorporate semantic similarity and contextual relevance. By training models to prioritize meaning over exact lexical overlap, the authors achieve dialogue agents that align significantly better with human judgment, as measured by their new evaluation metric, Dialuation.

What Problem Does This Paper Address?

For years, dialogue models have been trained and evaluated using metrics borrowed from machine translation, such as Cross-Entropy (CE) loss and BLEU scores. These metrics rely on "lexical overlap"—essentially checking if the model's output matches the "gold" reference response word-for-word.

However, dialogue is inherently flexible. If a reference response is "That's good," a model generating "That's nice" is doing a great job, while one generating "That's rice" has failed completely. Traditional CE loss often penalizes both errors equally because neither matches the target exactly. Furthermore, these metrics ignore the dialogue context. A response might be perfectly relevant to the conversation history but get penalized simply because it doesn't match the specific phrasing chosen by the dataset creators.

Fig. 1. Illustration of the key limitation of cross entropy for dialogue generation. Some adequate responses (y1 and y2) are equally or more penalized as useless response (y2)

Methods

The authors propose a two-pronged approach to "infuse" semantics and context into the learning process:

  1. Contanic Score: This is a composite score calculated during training that combines Context Relevance (CR) and Semantic Similarity (SS). It uses BERT embeddings to measure how well a generated response fits the conversation history and how close its meaning is to the reference response.
  2. SemTextualLogue Loss: Instead of relying solely on CE, the authors introduce a multi-objective loss function. It includes a Baseline Estimator (BSE)—a small module that acts as a proxy for human perception, providing feedback to the generator. The final loss is a weighted combination of standard CE, a semantic/contextual loss (LSCL), and the baseline estimator's error (LBSE).
  3. Dialuation Metric: To better evaluate these models, they formulated "Dialuation," a metric that weights contextual relevance and semantic similarity. Unlike BLEU, it doesn't require an exact word match to give a high score.
Fig. 2. Proposed architecture of semantic and context-reinforced dialogue generation. The dia- logue generation model first generates a response based on dialogue context and current utter- ance. Subsequently, it calculates context and semantic relevance score (Contanic) and reinforces the feedback with the traditional cross-entropy loss

Datasets

The researchers tested their approach on two major benchmarks representing different dialogue styles:

  • MultiWoz 2.2: A large-scale multi-domain dataset for task-oriented dialogue (e.g., booking a hotel or finding a restaurant).
  • PersonaChat: A dataset focused on open-domain/chit-chat dialogue, where agents are assigned specific personas to maintain consistency.

They evaluated these using a variety of models, including standard Transformers, GPT-2, and LLaMA 7b.

Key Insights and Ideas

  • Meaning > Matching: The core "aha" moment is that for dialogue, semantic distance is a much more informative signal for a gradient than lexical distance. By softening the "fixed target" constraint, models learn to be more expressive and relevant.
  • The Context Gap: The authors highlight that even state-of-the-art metrics like BLEURT, while semantically aware, often ignore the preceding dialogue turns. Their results show that explicitly accounting for context relevance (CR) is vital for task-oriented scenarios where the response must strictly follow the user's constraints.
  • Human Alignment: A major finding was that while models trained with SemTextualLogue might sometimes score lower on traditional BLEU (because they use synonyms), they consistently score higher in human evaluations for adequacy, fluency, and coherence.

Key Results

The experimental results demonstrate that SemTextualLogue consistently outperforms traditional CE loss across several dimensions:

  • Semantic Metrics: On the MultiWoz dataset, models trained with the new loss saw significant gains in BERT Score (+1.46) and Dialuation (+5.01) compared to CE baselines.
  • Human Evaluation: In blind tests, human evaluators rated the SemTextualLogue-trained LLaMA 2 models higher across all metrics. On MultiWoz, the average human score rose from 3.96 (CE) to 4.26 (SemTextualLogue).
  • Metric Correlation: The new Dialuation metric showed a much stronger correlation with human judgment than BLEU or ROUGE, proving that it captures what humans actually value in a conversation.

Limitations and Future Work

The authors identify a few areas for improvement:

  • Negation Handling: Despite using semantic vectors, the model still struggles to distinguish between sentences where a single "not" flips the meaning (e.g., "I like it" vs. "I do not like it"), as their embeddings remain mathematically similar.
  • Computational Overhead: Training with SemTextualLogue is slightly slower. For example, one epoch took 6.3 hours compared to 5 hours for standard CE. However, there is no increase in inference time.
  • Hyperparameter Sensitivity: The balance between context and semantics ($\alpha$ and $\beta$) needs to be tuned differently for task-oriented vs. open-domain dialogue.
  • External Knowledge: Future work aims to incorporate global "world knowledge" into the loss function to further improve the factual accuracy of responses.

Summary updated

Abstract

Over the past two decades, dialogue modeling has made significant strides, moving from simple rule-based responses to personalized and persuasive response generation. However, despite these advancements, the objective functions and evaluation metrics for dialogue generation have remained stagnant. These lexical-based metrics, e.g., cross-entropy and BLEU, have two key limitations: (a) word-to-word matching without semantic consideration: It assigns the same credit for failure to generate "nice" and "rice" for "good", (b) missing context attribute for evaluating the generated response: Even if a generated response is relevant to the ongoing dialogue context, it may still be penalized for not matching the gold utterance provided in the corpus. In this paper, we first investigate these limitations comprehensively and propose a new loss function called Semantic Infused Contextualized diaLogue (SemTextualLogue) loss function. We also formulate an evaluation metric called Dialuation, incorporating both context and semantic relevance. We experimented with both non-pretrained and pre-trained models on two dialogue corpora, encompassing task-oriented and open-domain scenarios. We found that the dialogue generation models trained with SemTextualLogueloss attained superior performance compared to the traditional cross-entropy loss function. The findings establish that the effective training of a dialogue generation model hinges significantly on incorporating semantics and context. This pattern is also mirrored in the introduced Dialuation metric, where the consideration of both context and semantics correlates more strongly with human evaluation compared to traditional metrics.

Empirical ResultsBrowse all benchmarks →

BenchmarkMethodMetricScoreProtocol / Evidence
MultiWOZ · datasetLLaMA 2 w/ SemTextualLogue lossDialution62.62fine-tuned · loss=SemTextualLogue · backbone=LLaMA 2
Source quote
L264: \textbf{LLaMA 2 w/ {\em SemTextualLogue} loss} │ 65.38 │ 62.62
PersonaChat · datasetLLaMA 2 w/ SemTextualLogue lossDialution44.13fine-tuned · loss=SemTextualLogue · backbone=LLaMA 2
Source quote
L292: \textbf{LLaMA 2 w/ {\em SemTextualLogue} loss} │ 43.82 │ 44.13
BibTeX
@misc{tiwari2023hi,
  author = {Abhisek Tiwari and Muhammed Sinan and Kaushik Roy and Amit Sheth and Sriparna Saha and Pushpak Bhattacharyya},
  title = {{Hi Model, generating 'nice' instead of 'good' is not as bad as generating 'rice'! Towards Context and Semantic Infused Dialogue Generation Loss Function and Evaluation Metric}},
  year = {2023},
  eprint = {2309.05804},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2309.05804},
}

Loading related content...

Figure