ELMo & ULMFiT (2018) › The Solution
History of Language AIAll chapters ELMo & ULMFiT (2018) › The SolutionOne section · Sections in this chapter3 / 7 ↓
Reading tools Definitions & inline links
Choose your expertise level to adjust how many terms are explained. Beginners see more tooltips, experts see fewer to maintain reading flow. Hover over underlined terms for instant definitions.
Article links
Make inline references clickable
ELMo and ULMFiT addressed these challenges through complementary approaches that both used large-scale language model pre-training but applied this knowledge differently to downstream tasks. ELMo focused on creating rich contextual embeddings that varied based on context, while ULMFiT developed a fine-tuning methodology that could adapt pre-trained language models to specific tasks while preserving learned knowledge.
ELMo: Deep Contextualized Word Representations
ELMo's innovation was training deep bidirectional language models that produced contextual word representations. Unlike static word embeddings, ELMo generated different vector representations for the same word depending on its surrounding context. The model consisted of two independent language models, one processing text left-to-right and another processing right-to-left, that were trained jointly to predict the next word given previous context in each direction.
The bidirectional architecture enabled ELMo to capture rich contextual information from both preceding and following words. When processing a sentence, the forward language model encoded information about words that came before the current position, while the backward language model encoded information about words that came after. These two representations were combined to produce context-dependent embeddings that reflected the full sentential context around each word.
ELMo used a deep LSTM architecture with multiple layers, where each layer captured different types of linguistic information. Lower layers learned local syntactic patterns and part-of-speech information, while higher layers learned more abstract semantic and discourse-level properties. The final word representation was computed as a weighted combination of representations from all layers, allowing downstream models to use the level of linguistic abstraction their task required.
The key insight behind ELMo was that word meaning depends on context, and this context includes both preceding and following words. By training separate forward and backward language models and combining their representations, ELMo could encode information like "the word 'bank' appears before 'account' and after 'financial', so it likely means a financial institution rather than a river edge." This bidirectional encoding enabled much richer word representations than static embeddings or unidirectional language models.
The ELMo architecture produced embeddings that varied based on context while maintaining computational efficiency. During inference, a pre-trained ELMo model could process any text and produce contextual embeddings for each word. These embeddings could then be used in downstream models by simply concatenating them with existing word embeddings or replacing them entirely. This design made ELMo easy to integrate into existing NLP systems, as it required minimal changes to downstream architectures.
ULMFiT: Effective Fine-tuning of Language Models
ULMFiT took a different approach, focusing on how to effectively fine-tune pre-trained language models for specific downstream tasks. The method consisted of three main innovations: discriminative fine-tuning, gradual unfreezing, and slanted triangular learning rates. These techniques addressed the challenge of adapting large pre-trained models to new tasks without destroying the useful linguistic knowledge learned during pre-training.
Discriminative fine-tuning recognized that different layers in a pre-trained language model contain different types of information, and therefore should be fine-tuned at different learning rates. Lower layers learn general linguistic patterns like syntax and morphology that are useful across tasks, so they need only minor adjustments. Higher layers learn more task-specific and abstract representations that may require more substantial updates when adapting to a new task. ULMFiT applied different learning rates to different layers, using lower rates for earlier layers and higher rates for later layers.
Gradual unfreezing addressed the instability problem that occurs when fine-tuning all layers of a pre-trained model simultaneously. When all parameters are updated at once, early layers might experience large gradient updates that overwrite the carefully learned general linguistic knowledge. ULMFiT's gradual unfreezing strategy started by freezing all layers except the last one, fine-tuning only the top layer for several epochs. Then it progressively unfroze earlier layers one at a time, allowing each layer to adapt incrementally to the new task while preserving knowledge from earlier layers.
Slanted triangular learning rates provided a schedule that enabled rapid initial adaptation followed by careful refinement. The learning rate starts high, allowing the model to quickly adapt its representations to the new task. Then it gradually decreases, enabling fine-grained adjustments without overshooting optimal parameter values. This schedule helped the model balance between adapting to task-specific requirements and preserving general linguistic knowledge.
The fine-tuning challenge is like adjusting a complex machine: change too much too quickly, and you break the carefully tuned components that worked well before. ULMFiT's gradual unfreezing and discriminative fine-tuning are like making small, careful adjustments one component at a time, starting with the parts most likely to need change (higher layers) and preserving the foundational parts (lower layers) that encode general linguistic knowledge useful across tasks.
ULMFiT demonstrated that a single pre-trained language model could be fine-tuned for diverse tasks including sentiment analysis, text classification, and question classification. The method achieved strong performance even with limited labeled data, as the pre-trained model already contained extensive linguistic knowledge that reduced the need for task-specific training examples. This efficiency made ULMFiT particularly valuable for applications in specialized domains or low-resource settings where labeled data was scarce.
Complementary Approaches
While ELMo and ULMFiT used different mechanisms, they shared the principle of applying large-scale language model pre-training to downstream tasks. ELMo created contextual embeddings that downstream models could use as features, while ULMFiT showed how to adapt entire pre-trained models through careful fine-tuning. Both methods demonstrated that pre-training on unlabeled text could provide a foundation of linguistic knowledge that dramatically improved task performance.
The success of both approaches validated transfer learning as a viable paradigm for NLP. They showed that linguistic knowledge learned from massive text corpora could be extracted and applied to diverse downstream tasks, reducing the need for large labeled datasets and enabling more efficient model development. This principle would be extended and scaled by subsequent transformer-based models, but ELMo and ULMFiT established the foundational techniques that made this transfer learning revolution possible.