Command Palette
Search for a command to run...
GAN-BERT:少数のラベル付き事例による頑健なテキスト分類のための敵対的生成学習
GAN-BERT:少数のラベル付き事例による頑健なテキスト分類のための敵対的生成学習
Danilo Croce Giuseppe Castellucci Roberto Basili
概要
近年のTransformerベースのアーキテクチャ(例:BERT)は、多くの自然言語処理タスクにおいて優れた成果を上げている。しかし、採用されているベンチマークの多くは(時に数十万規模の)事例から構成されている。現実の多くの場面では、高品質な注釈付きデータの取得は費用と時間を要する一方で、対象タスクを特徴づけるラベルなし事例は一般に容易に収集できる。半教師あり学習を可能にする有望な手法の一つが、画像処理分野において半教師あり敵対的生成ネットワークに基づき提案されている。本論文では、BERT系アーキテクチャのファインチューニングを、敵対的生成の枠組みにおいてラベルなしデータを用いて拡張するGAN-BERTを提案する。実験結果は、複数の文分類タスクにおいて良好な性能を維持しつつ、必要な注釈付き事例を大幅に削減できること(わずか50〜100件まで)を示している。
One-sentence Summary
Researchers from the University of Rome, Tor Vergata and Amazon propose GAN-BERT, which extends BERT-like fine-tuning with unlabeled data in a semi-supervised generative adversarial setting, reducing the required annotated examples to only 50–100 while maintaining good performance on several sentence classification tasks.
Key Contributions
- GAN-BERT extends BERT fine-tuning with a semi-supervised generative adversarial setting in which a generator produces fake examples and BERT serves as the discriminator.
- The method reduces annotation requirements, achieving good sentence classification performance with only 50 to 100 labeled examples and results comparable to fully supervised settings with fewer than 200 labeled examples.
- The semi-supervised adversarial schema consistently improves over BERT without adding inference cost, since the generator is used only during training.
Introduction
Transformer-based models such as BERT achieve strong NLP performance after fine-tuning on large annotated datasets, but their accuracy degrades significantly when only a few hundred labeled examples are available, especially for classification tasks with many categories. Since manual annotation is expensive, semi-supervised generative adversarial networks are an attractive alternative, yet their use in NLP has been limited to a kernel-based GAN that operates over fixed precomputed embeddings rather than updating the representation space. The authors introduce GAN-BERT, which places BERT in a semi-supervised GAN framework as the discriminator, uses unlabeled data to improve representations, and enables results comparable to fully supervised training with fewer than 200 labeled examples.
Method
The authors leverage Semi-supervised GANs (SS-GANs) to enable semi-supervised learning within a GAN framework. In this setup, a discriminator is trained over a (k+1)-class objective. True examples are classified into one of the target (1,…,k) classes, while generated samples are classified into the (k+1)-th class. Formally, let D and G denote the discriminator and generator, and pd and pG denote the real data distribution and the generated examples, respectively. The loss function of D is defined as LD=LDsup+LDunsup, where:
LDsup=−Ex,y∼pdlog[pm(y^=y∣x,y∈(1,…,k))]LDunsup=−Ex∼pdlog[1−pm(y^=y∣x,y=k+1)]−Ex∼Glog[pm(y^=y∣x,y=k+1)]LDsup measures the error in assigning the wrong class to a real example among the original k categories. LDunsup measures the error in incorrectly recognizing a real unlabeled example as fake and failing to recognize a fake example. The generator loss LG combines a feature matching loss and an unsupervised loss, encouraging G to produce examples whose intermediate representations are similar to real ones.
To adapt this for natural language processing, the authors introduce GAN-BERT, which extends a pre-trained BERT model by integrating SS-GAN layers during the fine-tuning stage. Given an input sentence, BERT produces vector representations, and the hCLS representation is adopted as the sentence embedding for target tasks.
As shown in the figure below:
The architecture adds a discriminator D for classifying examples and a generator G acting adversarially on top of BERT. The generator G is a Multi Layer Perceptron (MLP) that takes a 100-dimensional noise vector drawn from N(μ,σ2) as input and produces a vector hfake∈Rd. The discriminator is another MLP that receives a vector h∗∈Rd, which can be either hfake produced by the generator or hCLS for unlabeled or labeled examples from the real distribution. The last layer of D is a softmax-activated layer outputting a k+1 vector of logits.
During the training process, the system optimizes two competing losses, LD and LG. In the forward step, when real instances are sampled (h∗=hCLS), D classifies them into one of the k categories. When h∗=hfake, it classifies the example into the k+1 category. During back-propagation, unlabeled examples contribute only to LDunsup, meaning they are considered in the loss computation only if they are erroneously classified into the k+1 category; in all other cases, their contribution to the loss is masked out. Labeled examples contribute to the supervised loss LDsup. Examples generated by G contribute to both LD and LG. When updating D, the BERT weights are also modified to fine-tune its inner representations using both labeled and unlabeled data. After training, the generator G is discarded, retaining the original BERT model for inference without additional computational cost.
Experiment
The experiments compare GAN-BERT with a fine-tuned BERT-base model on topic classification, question classification, sentiment analysis, and natural language inference, using progressively larger labeled sets and additional unlabeled examples. GAN-BERT consistently improves over BERT when only few labeled examples are available, while BERT often diverges at 1% of labels, and the benefit is more pronounced for tasks with many categories. The advantage also appears on SST-5 and is systematic on MNLI up to about 0.5% of annotated examples, after which both models perform similarly.