XenonStack Glossary: AI, Data and Cloud Terms Explained

ELMo Explained: Embeddings from Language Models

Written by Dr. Jagreet Kaur | 17 Mar 2023

ELMo, short for Embeddings from Language Models, is a method that represents each word with a vector computed from the whole sentence it appears in, using the internal states of a deep bidirectional language model. The same word therefore gets a different vector in different contexts, which helps with words that have more than one meaning.

This page is for data scientists, NLP engineers and technology leaders who want a clear definition of ELMo. It covers how the representations are produced, how they differ from static word embeddings and from BERT, where they are used, and how they relate to AI agents.

What is ELMo and why does it matter?

The ELMo paper, titled Deep contextualized word representations and written by Matthew Peters and colleagues, introduces word vectors that are learned functions of the internal states of a deep bidirectional language model (biLM) pre-trained on a large text corpus.

The representations capture characteristics of word use, such as syntax and semantics, and how those uses change across contexts. That addresses polysemy, where one word has several meanings. The authors report that adding these representations to existing models significantly improved results on six NLP problems, including question answering, textual entailment and sentiment analysis.

How do ELMo embeddings work?

In a traditional word embedding, each word has one fixed vector. In ELMo, the vector assigned to a token is a function of the whole sentence in which the word is used. The same word can therefore receive different vectors in different sentences.

The paper argues that exposing the deep internal layers of the pre-trained network is crucial, because it lets downstream models combine different types of semi-supervision signals. In practice, a task model takes the ELMo vectors as additional input features alongside its usual word inputs.

How do ELMo embeddings differ from static word embeddings and BERT?

ApproachVector for a wordHow it is used
Static word embeddingsOne fixed vector per word, whatever the contextLooked up as input to a task model
ELMoA function of the whole sentence, from a deep bidirectional language modelAdded to an existing task model as features
BERTContextual representations from Transformer encodersThe pre-trained model itself is fine-tuned for each task

ELMo and BERT both produce context-dependent representations. See our glossary pages on BERT and universal language model fine-tuning for the related approaches.

What is ELMo used for?

The paper reports gains on question answering, textual entailment and sentiment analysis, among six NLP problems. Because ELMo plugs into an existing model as extra features, a working system can be extended without being redesigned.

How does ELMo relate to AI agents?

Agents that read language need representations that reflect meaning in context, so that a word such as bank is understood from the sentence around it. Contextual embeddings such as ELMo are one way to supply that. For teams building and running agents, ElixirClaw is XenonStack's AI agents computing platform.

What should you do first?

  1. Identify where ambiguous words limit your current text model.
  2. Test contextual embeddings as extra features on a small sample.
  3. Compare the result with a fine-tuned pre-trained model such as BERT.
  4. Keep the approach that performs best on your own text.

To map one decision your agents make from language input, and the data and policy it depends on, book a Context Workshop. See what happens in the workshop.

Frequently asked questions

What does ELMo stand for?

ELMo stands for Embeddings from Language Models. It produces context-aware word representations from a deep bidirectional language model.

How is ELMo different from traditional word embeddings?

A traditional embedding gives each word one fixed vector. ELMo assigns a vector that is a function of the whole sentence, so the same word can have different vectors in different contexts.

What problem does ELMo help with?

It helps with polysemy, where a word has several meanings, because its representation changes with the context in which the word is used.

What tasks can ELMo be used for?

The paper reports improvements on six NLP problems, including question answering, textual entailment and sentiment analysis.

How is ELMo different from BERT?

ELMo adds context-aware vectors from a bidirectional language model to an existing task model. BERT is built from Transformer encoders and is itself fine-tuned for each task.