Elmo Contextual Embeddings

NLP interview question · Medium difficulty

What was ELMo, and why was it an important step toward modern LLMs?medium

Status
✓
Type
conceptual
Topic
elmo-contextual-embeddings
Frequency
common
Tags
ELMo, contextual-embeddings, bidirectional-LSTM, history
Answer

ELMo introduced contextual word embeddings using bidirectional LSTM language models — a genuine shift from Word2Vec's one-word-one-vector approach to a vector that's a function of the entire sentence. "Bank" in "I deposited money in the bank" and "I sat near the river bank" gets different ELMo representations, solving the polysemy problem Word2Vec couldn't.

Explanation

ELMo reads text in both directions — a forward LSTM (I → deposited → money → in → the → bank) and a backward LSTM (bank → the → in → money → deposited → I) — then combines both directions' representations, letting the model use both left and right context to disambiguate a word. For "The bat flew at night" versus "He swung the bat," ELMo produces different representations depending on whether the sentence is about the animal or the sporting object. Before ELMo, an embedding was a fixed lookup vector for a word; after ELMo, an embedding became a function of the entire sentence. That reframing was a genuine bridge on the path to modern LLMs. ELMo still inherited LSTM's limitations though — sequential computation, weaker parallelization, and difficulty scaling to very long context — which is exactly what Transformers and self-attention solved next.

Follow-upWhy does reading both forward and backward help disambiguate a word like 'bat'?
Follow-upWhat specifically did Transformers fix that ELMo's bidirectional LSTM approach still struggled with?
Follow-upIs ELMo's contextual embedding conceptually the same thing as a token's hidden state after passing through a Transformer's self-attention layers?