Skip to main content
QUICK REVIEW

[Paper Review] Few-shot Sequence Learning with Transformers

Lajanugen Logeswaran, Ann Lee|arXiv (Cornell University)|Dec 17, 2020
Domain Adaptation and Few-Shot LearningComputer Science32 references5 citations
TL;DR

This paper proposes Task-Adaptive Memory (TAM), a simple yet effective few-shot learning method for sequence modeling using Transformers. By optimizing task-specific embeddings via first-order gradient descent instead of second-order methods, TAM achieves performance comparable to or better than meta-learning baselines like CAVIA and MAML, while being significantly more computationally efficient, especially in low-shot settings with discrete sequences.

ABSTRACT

Few-shot algorithms aim at learning new tasks provided only a handful of training examples. In this work we investigate few-shot learning in the setting where the data points are sequences of tokens and propose an efficient learning algorithm based on Transformers. In the simplest setting, we append a token to an input sequence which represents the particular task to be undertaken, and show that the embedding of this token can be optimized on the fly given few labeled examples. Our approach does not require complicated changes to the model architecture such as adapter layers nor computing second order derivatives as is currently popular in the meta-learning and few-shot learning literature. We demonstrate our approach on a variety of tasks, and analyze the generalization properties of several model variants and baseline approaches. In particular, we show that compositional task descriptors can improve performance. Experiments show that our approach works at least as well as other methods, while being more computationally efficient.

Motivation & Objective

  • To address the challenge of few-shot sequence learning in natural language processing and reinforcement learning, where only a few labeled examples are available per task.
  • To develop a method that enables efficient adaptation of pre-trained Transformers to new tasks without architectural modifications or complex meta-learning components.
  • To demonstrate that first-order optimization of task embeddings can match or exceed the performance of second-order meta-learning approaches like MAML and CAVIA.
  • To evaluate the effectiveness of compositional task descriptors and input conditioning via task embeddings in improving generalization across diverse sequence tasks.

Proposed method

  • The method introduces a task embedding vector z that is appended to the input sequence as a conditional prompt, allowing the model to adapt to new tasks without changing shared parameters.
  • Task embeddings are optimized via first-order gradient descent during inference or fine-tuning, using only a few labeled examples per task, avoiding the need for second-order derivatives.
  • For sequence classification, a transformer encoder with a classification head is used, where the [CLS] token is replaced by the task embedding z.
  • For sequence transduction, a transformer decoder is used, and the log-likelihood of the output sequence is computed conditionally on input x and task embedding z.
  • The training procedure alternates between updating shared model parameters θ and optimizing task embeddings z using gradient descent, forming an alternating minimization scheme.
  • Compositional task descriptors are explored by combining multiple task embedding vectors to represent complex or hierarchical tasks.

Experimental results

Research questions

  • RQ1Can first-order optimization of task embeddings achieve competitive few-shot performance on sequence modeling tasks without requiring second-order gradients or architectural adapters?
  • RQ2How does input conditioning via task embeddings compare to other few-shot adaptation mechanisms in terms of accuracy and efficiency?
  • RQ3Does the use of compositional task descriptors improve generalization in few-shot sequence learning?
  • RQ4How does the proposed method scale with respect to the number of few-shot examples (k) and training data per task?
  • RQ5Can the method be effectively applied to both sequence classification and sequence transduction tasks with minimal architectural changes?

Key findings

  • TAM achieves state-of-the-art performance on synthetic sequence classification and transduction benchmarks, outperforming MAML and matching or exceeding CAVIA in accuracy while being significantly more computationally efficient.
  • On the path-finding task, TAM achieves a perplexity of 1.3 with 2.7 hours of training time, compared to CAVIA’s 1.5 perplexity in 3.7 hours, demonstrating superior efficiency.
  • The method consistently outperforms the multitask baseline, which achieves only 67.4% accuracy and 7.2 perplexity, showing that task-specific adaptation is essential for few-shot performance.
  • Compositional task descriptors improve performance by enabling the model to generalize across structured task variations, as shown in ablation studies.
  • The transformer-based TAM model outperforms a bidirectional LSTM baseline in both accuracy and perplexity, confirming the effectiveness of the architecture in conjunction with the method.
  • First-order optimization of task embeddings is sufficient for strong performance when combined with sufficient training data per task and multiple inner loop updates, challenging the assumption that second-order methods are necessary for good few-shot generalization.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.