Deep Contextualized Word Representations

Matthew E. Peters, Mark Neumann, Mohit Iyyer, Matt Gardner, Christopher Clark, Kenton Lee, Luke Zettlemoyer

TL;DR

ELMo (Embeddings from Language Models) moves beyond static word vectors like Word2Vec by producing "contextualized" representations derived from the internal states of a deep bidirectional LSTM. By learning a task-specific weighted sum of these internal layers, ELMo achieved a clean sweep of state-of-the-art results across six major NLP benchmarks, proving that where a word sits in a sentence is just as important as the word itself.

What Problem Does This Paper Address?

Before this paper, the NLP world relied heavily on "static" word embeddings like Word2Vec or GloVe. In these models, a word like "bank" has exactly one vector representation, regardless of whether the sentence is about a river bank or a financial bank. This is known as the polysemy problem.

Furthermore, high-quality representations should ideally capture both complex syntactic patterns (how words relate structurally) and deep semantic nuances (what words mean in specific instances). Traditional embeddings struggled to capture this multi-layered information simultaneously. The authors sought a way to create word vectors that are functions of the entire input sentence, allowing the same word to have different vectors in different contexts.

Methods

The authors introduce ELMo, which stands for Embeddings from Language Models. The core architecture is a Bidirectional Language Model (biLM):

  1. The Architecture: It consists of two deep LSTMs—one reading the sentence forward and one reading it backward. Unlike previous models that only used the top layer, ELMo looks at all internal layers.
  2. Character-Based Input: Instead of a fixed vocabulary of word tokens, ELMo uses a Convolutional Neural Network (CNN) over characters. This allows the model to form representations for "out-of-vocabulary" words and capture sub-word information like prefixes and suffixes.
  3. Task-Specific Weighting: This is the "secret sauce." For any specific downstream task (like Sentiment Analysis or Question Answering), the model learns a linear combination of the biLM’s internal layers.
  4. $ELMo_{task} = \gamma_{task} \sum s_j \cdot h_j$
    • Here, $s_j$ are softmax-normalized weights that let the task "choose" which layers are most useful, and $\gamma$ is a scaling factor.
  5. Integration: To use ELMo, you simply freeze the pre-trained biLM and concatenate the ELMo vector with the original word embeddings of your existing NLP model.

Datasets

  • Pre-training: The biLM was trained on the 1B Word Benchmark, containing approximately 800 million tokens of English news text.
  • Evaluation: The authors tested ELMo on six diverse "challenge" tasks: SQuAD (Question Answering), SNLI (Natural Language Inference), SRL (Semantic Role Labeling), Coref (Coreference Resolution), NER (Named Entity Recognition), and SST-5 (Sentiment Analysis).

Key Insights and Ideas

  • The Hierarchy of Language: One of the most striking findings is that different layers of the biLM capture different types of information. Lower layers are better at capturing syntax (like Part-of-Speech tagging), while higher layers are better at capturing semantics (like Word Sense Disambiguation).
  • Deep is Better than Wide: Using all layers of a deep model is significantly more effective than just using the top layer. By exposing the "internals," downstream models can mix signals to suit their specific needs.
  • Sample Efficiency: ELMo-enhanced models reach the same level of performance as baseline models using significantly less labeled data. For example, an SRL model with ELMo and only 1% of the training data performs as well as a baseline model with 10% of the data.
ELMo significantly improves sample efficiency, allowing models to reach baseline performance with a fraction of the training data.

Key Results

ELMo established a new state-of-the-art (SOTA) in every single task it was applied to, often by massive margins. In general, adding ELMo to a strong baseline resulted in relative error reductions ranging from 6% to 20%.

Comparison of ELMo-enhanced models against previous state-of-the-art results across six major NLP benchmarks.
  • SQuAD: Improved F1 score by 4.7% (from 81.1 to 85.8).
  • SRL: Achieved a 17.2% relative error reduction, jumping from 81.4 to 84.6 F1.
  • NER: Increased F1 from 90.15 to 92.22, outperforming previous complex systems with a simpler architecture.

Limitations and Future Work

While ELMo provides a massive performance boost, it requires running a deep biLSTM during both training and inference, which is more computationally expensive than using static lookup tables like GloVe. Additionally, while the biLM is trained on general news text, the authors note that fine-tuning the biLM on domain-specific data (like medical or financial texts) can lead to even further gains—a hint at the "transfer learning" era that would soon follow with models like BERT.

Summary updated

BibTeX
@inproceedings{peters2018deep,
  author = {Matthew E. Peters and Mark Neumann and Mohit Iyyer and Matt Gardner and Christopher Clark and Kenton Lee and Luke Zettlemoyer},
  title = {{Deep Contextualized Word Representations}},
  booktitle = {Conference of the North American Chapter of the Association for Computational Linguistics},
  year = {2018},
  doi = {10.18653/v1/n18-1202},
}
Figure