Fast Adaptation in Generative Models with Generative Matching Networks

Sergey Bartunov, Dmitry P. Vetrov

Overview

Generative Matching Networks (GMNs) introduce a paradigm shift in how deep generative models learn. By integrating an attention-based matching mechanism into a latent variable framework, GMNs allow models to learn and generate entirely new concepts—such as a character from an unseen alphabet—instantly from just a few examples. This approach effectively bypasses the need for slow, computationally expensive retraining when encountering new data.

The Challenge of Fast Adaptation

Traditional deep generative models, including Variational Autoencoders (VAEs) and Generative Adversarial Networks (GANs), are notoriously "slow learners." They typically require thousands of examples and extensive gradient-based training to accurately capture a data distribution. Once trained, these models remain rigid: teaching them a new category of data usually requires full retraining. This process is not only too slow for real-time applications but also risks "catastrophic interference," where the model forgets previously learned concepts.

Humans, by contrast, exhibit "one-shot" learning. We can see a single example of a new object and immediately imagine variations of it. This paper aims to bridge that gap by creating a model capable of fast adaptation—the ability to condition its generation on a small "support set" of new data provided dynamically at test time.

Methods: Generative Matching Networks

The authors introduce Generative Matching Networks (GMNs), drawing inspiration from the "Matching Networks" successfully used in discriminative few-shot learning tasks.

Generative Matching Network Architecture

The core architecture relies on a sophisticated interpolation engine built from several key components:

  • Conditioning Set ($X$): A small collection of images (e.g., 1–19 examples) provided to the model to define a new concept.
  • Matching Space ($\Phi_G$): Both the latent variable $z$ (sampled from a prior distribution) and the conditioning images $x \in X$ are mapped into a shared embedding space.
  • Attention Mechanism: The model computes an "attention kernel" that measures the similarity between the latent variable $z$ and each image in the conditioning set.
  • Prototype Interpolation: Conditioning images are transformed into "prototypes." The model then takes a weighted average of these prototypes—guided by the previously computed attention scores—to produce a context vector $r_G$.
  • The Decoder: Finally, this context vector $r_G$, alongside the latent variable $z$, is fed into a deconvolutional neural network to generate the final image.

The authors also detail a "Full Matching" procedure, which utilizes a recurrent controller to perform multiple attentional passes. This allows the model to develop a more nuanced, joint understanding of the conditioning set before generation.

Experimental Setup

The model was rigorously evaluated on the Omniglot dataset, which contains 1,623 different handwritten characters from 50 different alphabets. Because there are only 20 examples per character, Omniglot serves as the "gold standard" for few-shot learning research. It forces the model to learn the general underlying "process" of writing characters rather than simply memorizing specific pixel arrangements.

Key Insights

  • Generative as Retrieval: Instead of the model's weights storing every specific detail of every class, the weights learn a matching procedure. The model acts as a sophisticated interpolation engine that knows how to "flesh out" a concept based on a provided reference.
  • Breaking the Fixed Distribution: Unlike standard VAEs that learn a single fixed generative distribution, GMNs learn an adaptation mechanism. This allows the generative process to change dynamically based on the input context.
  • Attention is the Bridge: Using attention to link latent variables to a support set provides a differentiable way to "pick and choose" features from the examples, guiding the generation of a new, unique sample.

Key Results

Generated Omniglot Samples
  • Quantitative Improvement: The predictive performance, measured by Negative Log-Likelihood (NLL), improved significantly as more conditioning examples were provided. For a single-class test, the NLL dropped from ~89.7 (with 0 examples) to ~45.8 (with 19 examples).
  • Qualitative Success: As shown in the generated samples, the model successfully produced recognizable, novel variations of handwritten characters it had never seen during training, all while maintaining the stylistic essence of the provided examples.
  • Superiority over Baselines: GMNs outperformed standard VAEs and simpler "averaging" models. This proves that the specific attentional matching mechanism is crucial for achieving high-quality adaptation.

Limitations and Future Work

While GMNs represent a significant step forward, the authors noted a few limitations. There is a slight discrepancy where models producing the best numerical likelihoods do not always produce the most visually pleasing samples—a common "hallucination" issue in generative modeling. Furthermore, while successful on the 28x28 grayscale characters of Omniglot, it remains to be seen how well this architecture scales to complex, high-resolution natural images.

Looking ahead, the authors suggest these fast-adaptation techniques could be vital for Reinforcement Learning, where an agent must quickly adapt its behavior to a new environment based on very limited experience.

Summary updated

BibTeX
@inproceedings{bartunov2017fast,
  author = {Sergey Bartunov and Dmitry P. Vetrov},
  title = {{Fast Adaptation in Generative Models with Generative Matching Networks}},
  booktitle = {Workshops @ ICLR},
  year = {2017},
  url = {https://openreview.net/forum?id=y097qEQ-Gwe},
}
Figure