Lexicon Learning for Few-Shot Neural Sequence Modeling

Ekin Akyürek, Jacob Andreas

Abstract

Sequence-to-sequence transduction is the core problem in language processing applications as diverse as semantic parsing, machine translation, and instruction following. The neural network models that provide the dominant solution to these problems are brittle, especially in low-resource settings: they fail to generalize correctly or systematically from small datasets. Past work has shown that many failures of systematic generalization arise from neural models' inability to disentangle lexical phenomena from syntactic ones. To address this, we augment neural decoders with a lexical translation mechanism that generalizes existing copy mechanisms to incorporate learned, decontextualized, token-level translation rules. We describe how to initialize this mechanism using a variety of lexicon learning algorithms, and show that it improves systematic generalization on a diverse set of sequence modeling tasks drawn from cognitive science, formal semantics, and machine translation.

Introduction

Standard neural sequence-to-sequence models, such as LSTMs and Transformers, have achieved remarkable success in natural language tasks. However, they remain surprisingly brittle when faced with the need for "systematic generalization"—the ability to apply a newly learned word in a novel syntactic context. A classic failure mode is the conflation of lexical phenomena (what a word means) with syntactic ones (how words are arranged).

The Colors task: A few-shot learning benchmark testing systematic generalization.

Consider the "Colors" task illustrated above. If a model learns that the word "zup" translates to a yellow circle in a simple training example, it often fails to produce that yellow circle when "zup" appears in a long, complex sentence it hasn't seen before. Humans do not share this limitation; once we establish a mapping like "zup = yellow," we can apply it compositionally across any valid syntax. Neural models, by contrast, tend to overfit to specific sentence lengths or patterns seen during training. This research introduces a lexical translation mechanism to explicitly decouple word-level translation from sentence-level structure.

The Lexical Translation Mechanism

The proposed solution is a lexical translation mechanism, which generalizes the well-known "copy mechanism." While a standard copy mechanism allows a model to "point" at an input token and replicate it in the output, the lexical translation mechanism allows the model to point at an input token and translate it using a learned lexicon matrix ($L$).

Architecture of the lexical translation mechanism, featuring a learned gate to choose between standard generation and lexicon-based translation.

As shown in the architecture diagram, the model employs a learned "gate" ($p_{gate}$) at every decoding step. This gate determines whether the model should generate a word using its standard neural logic ($p_{write}$) or utilize the lexical translation path ($p_{lex}$). By offloading the "easy" task of word-to-word mapping to this dedicated module, the underlying neural network is freed to focus on learning complex syntax and structural transformations.

Lexicon Initialization

A critical component of this approach is how the lexicon matrix ($L$) is constructed. The authors explored several initialization methods:

  • Statistical Alignment: Utilizing classic IBM Model 2 translation logic.
  • Mutual Information (PMI): Relying on simple co-occurrence statistics between input and output tokens.
  • Bayesian Modeling: A cognitive-science-inspired approach to word learning.
  • The "Simple" Rule: A logic-based approach introduced in this work. It identifies pairs $(v, w)$ where the presence of input word $v$ is a "necessary and sufficient" condition for the presence of output word $w$ across the training set.

Interestingly, the "Simple" rule often outperformed more complex statistical methods. The neural model appears to benefit more from a small set of highly accurate, high-precision mappings than from a comprehensive but noisy dictionary.

Experimental Results

The mechanism was evaluated across four diverse datasets:

  1. Colors: A 14-example dataset testing human-like inductive biases. While a standard LSTM achieves 0% accuracy, the augmented model reached 79%, nearly matching the human average of 81%.
  2. SCAN: A benchmark for mapping navigation commands to action sequences.
  3. COGS: A large-scale semantic parsing dataset. The mechanism improved accuracy from 0.51 to 0.82, specifically helping the model handle verbs in novel syntactic roles, such as the passive voice.
  4. Tatoeba (English-Chinese): A low-resource machine translation task. The model saw a +1.5 BLEU improvement overall. On "one-shot" sentences containing words seen only once in training, the gain was over 2.2 BLEU, demonstrating superior "fast mapping" capabilities.

Discussion and Future Work

The success of this modular approach highlights that precision is often more valuable than recall for auxiliary lexical modules. Furthermore, the authors found that initializing the lexicon before training the neural network is essential; if learned simultaneously from scratch, the model often ignores the lexicon and reverts to brittle, purely neural patterns.

Despite these gains, limitations remain. The current mechanism is restricted to atomic 1-to-1 token translations and cannot yet handle multi-word expressions or complex structural transformations triggered by a single word (e.g., "thrice" implying a triple repetition). Additionally, while the model generalizes better to new contexts, generalizing to sequences significantly longer than those in the training set remains a challenge for future research.

Summary updated

BibTeX
@inproceedings{akyurek2021lexicon,
  author = {Ekin Akyürek and Jacob Andreas},
  title = {{Lexicon Learning for Few-Shot Neural Sequence Modeling}},
  booktitle = {Annual Meeting of the Association for Computational Linguistics},
  year = {2021},
  url = {https://openreview.net/forum?id=SYgw-n2H2DS},
}
Figure