Abstract
Latent Relation Language Models (LRLMs) improve text generation by dynamically consulting a knowledge graph (KG) to fill in facts and entities. By treating the choice of which relationship to mention as a hidden (latent) variable, the model can generate multi-word entity spans more accurately than standard models and provide a "reasoning" trace for why it chose specific information.
Introduction
Standard neural language models (LMs) are highly effective at learning the grammar and syntax of language but often struggle with factual accuracy and rare words. Because they operate within a limited parameter budget, they frequently fail to accurately predict specific entities—such as a person's birth date or a specific job title—unless those facts appear frequently in the training data.
Previous attempts to incorporate Knowledge Graphs (KGs) often forced models to predict entities word-by-word. This approach frequently led to "hallucinations," where a model might start a name correctly but finish it with the wrong surname or get stuck in repetitive loops. LRLMs address this by treating entities as cohesive units (spans) and understanding the underlying relationship (e.g., "this word is the occupation of the subject") rather than treating them as mere strings of characters.
Methodology
The core innovation of the LRLM is a dual-path generation process that interleaves standard language modeling with structured knowledge retrieval:
- The "Word" Path: For common words (like "is", "the", and "and"), the model uses a standard vocabulary.
- The "Relation" Path: When the model decides to mention a fact, it consults a local subgraph of a Knowledge Graph centered on the topic. It selects a relation (like
<nationality>) and then selects a surface form (an alias like "American") to insert into the text.
Technical Components
- Latent Variables: Since training text does not come with explicit relation labels, the model treats these assignments as latent. It uses the Forward-Backward algorithm to marginalize over all possible ways a sentence could have been generated, allowing it to learn from raw text.
- Span-based Generation: Unlike word-level models, LRLMs can generate an entire multi-word phrase (e.g., "United States of America") in a single step if it is linked to a KG relation, preventing "broken mentions."
- Parameterization: The model utilizes state-of-the-art architectures like Transformer-XL as its backbone, combined with KG embeddings to provide semantic context for the entities.
Datasets and Evaluation
The researchers evaluated the model on two main benchmarks:
- WikiFacts: A dataset focused on the film and actor domain, where text is closely tied to structured facts in Freebase.
- WikiText-F/S: New, larger-scale open-domain datasets created by linking Wikipedia articles to Wikidata, creating a "star-shaped" subgraph of facts for each article topic.
Key Results and Insights
The LRLM consistently outperformed standard LMs and previous state-of-the-art KG-informed models across all datasets.
- Perplexity Reduction: On the WikiFacts dataset, the LRLM achieved a perplexity of 79.35, a significant improvement over the Vanilla LM's 167.91.
- Factual Consistency: Qualitative analysis showed that while other models might repeat entities or switch them mid-sentence, the LRLM maintained consistency by adhering to the KG's defined aliases.
- Zero-Shot Linking: The model successfully learned to identify relations like
<performer>or<lyrics by>in text with high confidence (often >90%) without explicit supervision during training. - KG Richness: Performance improved significantly as the number of available relations in the knowledge graph increased, suggesting LRLMs are particularly effective at leveraging dense structured knowledge.
Limitations and Future Work
Currently, the model requires a pre-defined "topic entity" to build its local knowledge subgraph, making it less flexible for documents that drift between many unrelated topics. Additionally, the study was limited to "star-shaped" subgraphs (direct neighbors). Future research could involve traversing deeper into the KG to capture more complex contextual relationships and reducing the computational cost associated with marginalizing over all possible text spans.
Summary updated