Entity Contrastive Learning in a Large-Scale Virtual Assistant System

Jonathan Rubin, Jason Crowley, George Leung, Morteza Ziyadi, Maria MinakovaACL 2023

Introduction

In large-scale virtual assistants like Alexa or Siri, Natural Language Understanding (NLU) typically hinges on two primary tasks: Intent Classification (IC) and Named Entity Recognition (NER). IC determines the user's goal (e.g., "Play music"), while NER identifies specific parameters or "slots" (e.g., "David Bowie" as an artist). A significant challenge in these systems is that NER errors often propagate downstream, causing system failures and user frustration. Standard training methods frequently struggle to create well-separated internal representations for different entity types. This research addresses these issues by introducing entity contrastive learning to create more robust and discriminative representation spaces in multi-domain production environments.

Methodology

The researchers propose a joint IC-NER model architecture that incorporates a novel third training component: Entity Contrastive Loss ($\ell_{ENT}$).

Model architecture showing the joint IC-NER framework with the added Entity Contrastive component.

The architecture utilizes a BERT-style Transformer encoder. Sub-word token embeddings are combined with features from a large-scale Gazetteer via an element-wise product. A key innovation is the use of Gaussian Embeddings, where tokens are mapped to diagonal Gaussian distributions (means and variances) rather than simple point vectors. This allows the model to explicitly capture representation uncertainty.

During training, the entity contrastive loss pulls tokens with the same entity label closer together in the representation space using Kullback-Leibler (KL) divergence, while pushing dissimilar entities apart. The final objective function is a weighted sum of Cross-Entropy loss (for intents), Conditional Random Field (CRF) loss (for NER), and the new Entity Contrastive loss.

Key Insights: Alignment and Visual Evidence

A core finding of this work is that contrastive learning significantly improves alignment—the proximity of similar items in the latent space—even if it slightly reduces overall uniformity.

t-SNE visualizations comparing baseline and contrastive models across four domains, showing improved entity clustering.

As shown in the t-SNE visualizations above, the baseline model often results in scattered entity representations. In contrast, the model trained with entity contrastive loss produces tight, distinct clusters for various entity types (e.g., "Song Names" or "Dates"). This improved separation makes the downstream classification tasks significantly more reliable.

Experimental Results

The system was evaluated at an industrial scale across 11 domains, using a dataset of over 8.2 million training instances.

Offline Performance

The entity contrastive model consistently outperformed the baseline. For voice-only devices (Profile 1), the researchers observed a 12.7% relative improvement in Semantic Error Rate (SEMER) and a 17.5% improvement in Intent Classification Error Rate (ICER). Quantitative alignment scores improved by 70% to 90% across most entity slots.

Online A/B Testing

In a live A/B test involving 10% of customer traffic over two weeks, the proposed model achieved a 0.79% reduction in overall user dissatisfaction. This result demonstrates that the improvements in representation learning translate directly to a better user experience in a high-volume production environment.

Conclusion and Future Work

While highly effective, the model's performance varied by domain. It struggled in the "Sports" domain due to data sparsity and showed some regression in "Cinema Show Times," suggesting that contrastive learning effectiveness may depend on a certain threshold of data density and entity variety. Future research will explore dynamic weighting of the loss components and the application of these techniques to multi-turn conversational contexts.

Summary updated

BibTeX
@inproceedings{rubin2023entity,
  author = {Jonathan Rubin and Jason Crowley and George Leung and Morteza Ziyadi and Maria Minakova},
  title = {{Entity Contrastive Learning in a Large-Scale Virtual Assistant System}},
  booktitle = {Annual Meeting of the Association for Computational Linguistics},
  year = {2023},
  doi = {10.18653/v1/2023.acl-industry.17},
}
Figure