One-shot and few-shot learning of word embeddings

Andrew K. Lampinen, James L. McClellandarXiv 2017

Abstract

Deep learning models typically require massive datasets to learn new concepts, a stark contrast to human language acquisition. This paper introduces a biologically inspired method for one-shot and few-shot learning of word embeddings. By freezing the pre-trained network and optimizing only the new word's embeddings using a replay buffer, the model can rapidly integrate new vocabulary. This approach significantly improves prediction accuracy for new words in context while maintaining the integrity of the existing vocabulary.

Introduction

Standard natural language processing (NLP) systems learn continuous word representations (embeddings) by training on massive text corpora. However, once a model is trained, integrating a new word is surprisingly difficult. Current solutions often involve either computationally expensive full-model retraining or simple heuristics like averaging surrounding word embeddings, which often fail to capture complex semantics.

In contrast, humans excel at few-shot learning. We can instantly infer the approximate meaning and part of speech of a novel word from just a few contexts. This research explores how to enable a trained neural network to dynamically learn useful representations for new words from 1 to 10 sentences without causing catastrophic interference with existing knowledge.

Methodology

The proposed method draws inspiration from Complementary Learning Systems (CLS) theory, which suggests humans learn via a slow-learning system for deep structural features and a fast-learning system for rapid memorization.

To implement this in an LSTM-based language model, the authors employ a targeted backpropagation technique:

  1. Network Freezing: All weights in the pre-trained network are frozen, except for the input and output embeddings of the new word.
  2. Initialization: The new word's embedding is initialized using the centroid (average) of the embeddings of surrounding words.
  3. Targeted Optimization: The model is trained for 100 epochs, updating only the new word's embeddings based on the limited available sentences.
  4. Replay Buffer: To maintain base-rate calibration and prevent the model from over-predicting the new word, training is interleaved with "negative" sentences from the original corpus that do not contain the new word.

Results and Analysis

The study utilized the Penn Treebank (PTB) dataset, identifying words with low frequency to simulate new word learning.

Performance Gains

Active optimization of the embedding via backpropagation through the frozen network yields performance vastly superior to simple heuristic baselines.

Perplexity reduction on new word test data across different optimization approaches.

Optimizing from the centroid improved perplexity on new-word test sentences by an average of 64% over the baseline centroid method. Remarkably, this few-shot optimization method performs comparably to a model fully trained on the entire corpus including the new word's sentences.

The Role of Output Embeddings

A key finding is that learning is primarily driven by the output embedding. Updating the output embedding (predicting the new word given context) accounted for almost all performance gains, whereas updating the input embedding (predicting context given the new word) had minimal impact.

Comparison of learning gains when optimizing input vs. output embeddings.

Stability and Calibration

The use of a replay buffer proved essential. Without it, the model tended to over-predict the new word, degrading overall corpus perplexity. With interleaved negative samples, interference on the rest of the PTB dataset was negligible, with a maximum perplexity increase of only 0.06%.

Conclusion

This targeted optimization approach demonstrates that neural networks can achieve human-like few-shot learning of new vocabulary by leveraging frozen structural knowledge. While the method currently relies on schema-consistent contexts, it opens doors for more sophisticated NLP tasks like grounded language learning and question answering, where rapid vocabulary expansion is critical.

Summary updated

BibTeX
@misc{lampinen2017one,
  author = {Andrew K. Lampinen and James L. McClelland},
  title = {{One-shot and few-shot learning of word embeddings}},
  year = {2017},
  eprint = {1710.10280},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/1710.10280},
}
Figure