Reference-Aware Language Models

Zichao Yang, Phil Blunsom, Chris Dyer, Wang Ling

Abstract: We propose a general class of language models that treat reference as an explicit stochastic latent variable. This architecture allows models to create mentions of entities and their attributes by accessing external databases (required by, e.g., dialogue generation and recipe generation) and internal state (required by, e.g. language models which are aware of coreference). This facilitates the incorporation of information that can be accessed in predictable locations in databases or discourse context, even when the targets of the reference may be rare words. Experiments on three tasks show our model variants outperform models based on deterministic attention.

Introduction

In natural language, we frequently use Referring Expressions (REs)—nouns or pronouns that point to specific entities, such as "the restaurant" or "it." While standard language models (LMs) treat these as ordinary vocabulary items, this approach is insufficient for tasks requiring precise information retrieval from structured or contextual sources.

Standard architectures struggle with three primary scenarios:

  1. Structured Data: Generating instructions that must strictly adhere to a provided list (e.g., ingredients in a recipe).
  2. External Knowledge: Querying databases to provide factual answers in dialogue systems.
  3. Coreference: Tracking entities across long documents where the form of reference changes (e.g., from a proper name to a pronoun).
Figure 1: The three types of reference tasks addressed: (a) lists, (b) tables, and (c) document context.

The Reference-Aware Framework

The core innovation of this work is a framework where the probability of a word is conditioned on a discrete stochastic latent variable $z$. This variable acts as a "switch" or a "pointer" that determines whether the model should generate a common word from its standard vocabulary or refer to a specific entity in the context.

By treating these decisions as latent variables, the model can be trained to maximize the marginal probability of the text even without explicit labels for what is being referenced. This allows the model to learn the difference between a word used generically (e.g., "pour into a cup") and a word used as a reference to a specific item (e.g., "1 cup milk").

Specialized Reference Mechanisms

The authors instantiate this framework in three distinct ways to handle different data structures:

1. Reference to Lists

In recipe generation, the model uses a pointer switch to decide between generic instructional words and specific ingredients from a provided list. This prevents the model from hallucinating ingredients or failing to use the ones provided.

2. Reference to Databases (Table Pointers)

For task-oriented dialogue, the model must navigate 2D databases (rows and columns). The authors developed a Table Pointer mechanism that uses a multi-step attention process. It first identifies the relevant attribute (column), then the relevant row (entity), and finally the specific cell to copy into the dialogue.

Figure 4: The Table Pointer architecture uses hierarchical attention to select attributes, rows, and columns from a database.

3. Reference to Document Context

This variant maintains an "entity state" that updates as a document progresses. The model decides if the next word is an entity mention, identifies which entity it refers to, and determines the appropriate rendering (e.g., choosing between a proper name or a pronoun based on the discourse history).

Experimental Results

The models were evaluated on three datasets: 31,000 recipes from allrecipes.com, the DSTC2 dialogue dataset (augmented with TripAdvisor data), and 100,000 documents from the Xinhua News corpus.

  • Recipe Generation: The latent model outperformed standard Seq2Seq and basic Pointer models, achieving a perplexity of 4.97 and a BLEU score of 15.41.
  • Dialogue Systems: The Table Pointer was exceptionally effective at handling Out-of-Vocabulary (OOV) tokens. By "pointing" to database entries rather than relying on a fixed vocabulary, it reduced OOV perplexity from millions down to approximately 1360.
  • Coreference: Explicitly modeling coreference significantly improved the prediction of entity mentions, though the authors noted that careful initialization (starting with standard LM weights) was necessary to avoid local optima.

Conclusion

Reference-Aware Language Models demonstrate that treating reference as a latent decision-making process allows for more intelligent and accurate text generation. By moving beyond simple "copy-pasting" to structured reasoning over lists, tables, and entity states, these models can better handle the complexities of real-world data and discourse. Future work may explore Reinforcement Learning to further refine these discrete pointing actions based on global generation quality.

Summary updated

BibTeX
@inproceedings{yang2017reference,
  author = {Zichao Yang and Phil Blunsom and Chris Dyer and Wang Ling},
  title = {{Reference-Aware Language Models}},
  booktitle = {Conference on Empirical Methods in Natural Language Processing},
  year = {2017},
  url = {https://openreview.net/forum?id=BJ-xNGzubr},
}
Figure