LUKE: Deep Contextualized Entity Representations with Entity-aware Self-attention

Ikuya Yamada, Akari Asai, Hiroyuki Shindo, Hideaki Takeda, Yuji Matsumoto

Abstract

Entity representations are useful in natural language tasks involving entities. In this paper, we propose new pretrained contextualized representations of words and entities based on the bidirectional transformer. The proposed model treats words and entities in a given text as independent tokens, and outputs contextualized representations of them. Our model is trained using a new pretraining task based on the masked language model of BERT. The task involves predicting randomly masked words and entities in a large entity-annotated corpus retrieved from Wikipedia. We also propose an entity-aware self-attention mechanism that is an extension of the self-attention mechanism of the transformer, and considers the types of tokens (words or entities) when computing attention scores. The proposed model achieves impressive empirical performance on a wide range of entity-related tasks. In particular, it obtains state-of-the-art results on five well-known datasets: Open Entity (entity typing), TACRED (relation classification), CoNLL-2003 (named entity recognition), ReCoRD (cloze-style question answering), and SQuAD 1.1 (extractive question answering).

Introduction: The Entity Problem

While models like BERT and RoBERTa have revolutionized NLP, they face a fundamental "entity problem." Standard contextualized word representations (CWRs) treat text as a sequence of subword tokens, which is suboptimal for entity-centric tasks for three main reasons:

  1. Fragmentation: Entities are often split into multiple subwords (e.g., "Beyoncé" becomes "Bey," "on," "cé"), making it difficult for the model to learn a single, cohesive representation.
  2. Reasoning Difficulty: Tasks like relation classification require reasoning between entities. When entities are fragmented, the self-attention mechanism must work harder to capture these relationships.
  3. Easy Pretraining: Predicting a single masked subword within an entity (e.g., "Lord of the [MASK]") is often trivial, failing to force the model to learn complex relational knowledge.

The LUKE Architecture

LUKE (Language Understanding with Knowledge-based Embeddings) addresses these issues by treating entities as "first-class citizens," representing them as independent tokens alongside words.

The LUKE architecture for pretraining and downstream entity-related tasks.

The core architectural innovation is entity-aware self-attention. Instead of a single query matrix, LUKE uses four specialized query matrices ($Q_{w2w}, Q_{w2e}, Q_{e2w}, Q_{e2e}$) based on whether the "attending" and "attended" tokens are words or entities. This allows the model to specialize its attention patterns according to token types. To maintain efficiency, entity embeddings are decomposed into two smaller matrices ($B$ and $U$).

LUKE is pretrained on a massive Wikipedia corpus using a modified Masked Language Model (MLM) objective. It must predict not only randomly masked words but also randomly masked entities, using Wikipedia hyperlinks as ground-truth annotations. This "harder" pretraining task forces the model to rely on global context and relational knowledge stored in its weights.

Key Results and Performance

LUKE achieved state-of-the-art (SOTA) results on five major NLP benchmarks. Notably, it reached 95.4 F1 on SQuAD 1.1, outperforming XLNet and RoBERTa. On the CoNLL-2003 NER dataset, it achieved a significant jump to 94.3 F1.

Performance comparison on the CoNLL-2003 NER dataset.

Ablation studies confirmed the importance of explicit entity tokens; removing them dropped NER performance by 1.4 F1 points. The entity-aware attention mechanism also consistently improved performance across tasks, suggesting that the logic required to relate different token types is fundamentally distinct.

Conclusion

LUKE demonstrates that treating entities as independent tokens and using type-aware attention significantly enhances a model's ability to handle entity-centric tasks. While currently dependent on Wikipedia's knowledge base and computationally intensive, LUKE sets a new standard for contextualized representations. Future work may involve applying this architecture to specialized domains like medicine or law where technical entities are highly prevalent.

Summary updated

BibTeX
@inproceedings{yamada2020luke,
  author = {Ikuya Yamada and Akari Asai and Hiroyuki Shindo and Hideaki Takeda and Yuji Matsumoto},
  title = {{LUKE: Deep Contextualized Entity Representations with Entity-aware Self-attention}},
  booktitle = {Conference on Empirical Methods in Natural Language Processing},
  year = {2020},
  url = {https://openreview.net/forum?id=Ea5kLZafh_N},
}
Figure