ELECTRA: Pre-training Text Encoders as Discriminators Rather Than Generators
打开互动全文版(逐段中英对照 + 图/公式 + 论文问答)→掩码语言建模(MLM)预训练方法(如 BERT)通过用[MASK]替换部分令牌来破坏输入,然后训练模型重建原始令牌。虽然这些方法在迁移到下游 NLP 任务时表现良好,但通常需要大量计算才能有效。作为替代,我们提出了一种更高效的预训练任务,称为替换令牌检测。我们的方法不是掩码输入,而是通过从小型生成器网络中采样合理的替代令牌来替换部分令牌,从而破坏输入。然后,我们不训练模型预测被破坏令牌的原始身份,而是训练一个判别模型,预测被破坏输入中的每个令牌是否被生成器样本替换。大量实验表明,这种新的预训练任务比 MLM 更高效,因为该任务定义在所有输入令牌上,而不仅仅是掩码掉的一小部分。因此,在相同模型大小、数据和计算量下,我们的方法学习到的上下文表示显著优于 BERT。对于小模型,增益尤为显著;例如,我们在一个 GPU 上训练 4 天的模型,在 GLUE 自然语言理解基准测试中超越了使用 30 倍计算量训练的 GPT。我们的方法在大规模下也表现良好,使用不到 1/4 的计算量即可与 RoBERTa 和 XLNet 相媲美,并在相同计算量下超越它们。
Masked language modeling (MLM) pre-training methods such as BERT corrupt the input by replacing some tokens with [MASK] and then train a model to reconstruct the original tokens. While they produce good results when transferred to downstream NLP tasks, they generally require large amounts of compute to be effective. As an alternative, we propose a more sample-efficient pre-training task called replaced token detection. Instead of masking the input, our approach corrupts it by replacing some tokens with plausible alternatives sampled from a small generator network. Then, instead of training a model that predicts the original identities of the corrupted tokens, we train a discriminative model that predicts whether each token in the corrupted input was replaced by a generator sample or not. Thorough experiments demonstrate this new pre-training task is more efficient than MLM because the task is defined over all input tokens rather than just the small subset that was masked out. As a result, the contextual representations learned by our approach substantially outperform the ones learned by BERT given the same model size, data, and compute. The gains are particularly strong for small models; for example, we train a model on one GPU for 4 days that outperforms GPT (trained using 30x more compute) on the GLUE natural language understanding benchmark. Our approach also works well at scale, where it performs comparably to RoBERTa and XLNet while using less than 1/4 of their compute and outperforms them when using the same amount of compute.