about
Electra: Pre-Training Text Encoders as Discriminators Rather Than Generators (2020) (arxiv.org)
65 points by luu on Jul 16, 2024 | hide | past | pdf | 9 comments on HN

In plain words: Instead of hiding words and guessing them back, a helper network swaps in fake words and the model checks every word for swaps. At equal size and compute it beats BERT-style training; a one-GPU model beat GPT, which used 30 times more compute.

Abstract · ELECTRA: Pre-training Text Encoders as Discriminators Rather Than Generators

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.

Kevin Clark, Minh-Thang Luong, Quoc V. Le, Christopher D. Manning
arXiv:2003.10555 · cs.CL · submitted Mar 23, 2020
abstract · pdf · html · ICLR 2020

add comment on HN

LOL, I was reading the abstract and remembering there used to be a paper like that. Then I look at the title and see it was from 2020. For a moment I thought someone plagiarised the original paper.

Unfortunately BERT models are dead. Even the cross between BERT and GPT - the T5 architecture (encode-decoder) is rarely used.

The issue with BERT is that you need to modify the network to adapt it to any task by creating a prediction head, while decoder models (GPT style) do every task with tokens and never need to modify the network. Their advantage is that they have a single format for everything. BERT's advantage is the bidirectional attention, but apparently large size decoders don't have an issue with unidirectionality.

BERT and T5 models are slowly consuming the computational biology field, so they certainly aren't dead to all.
It helps that you can pretty easily frame a bidirectional task in a directional way. For example, fill in the middle tasks.

You can have a bidirectional model directly fill in the middle...

Or you could just frame that as a causal task by giving the decoder llm a command to fill in the blanks, and the entire document with the sections to fill replaced by a special token/identifier all as input, and the model is trained to output the middle sections along with their identifier.

There we go, now we have a causal decoder transformer that can perform a traditionally bidirectional task.

BERT is alive and well for most commercial uses of NLP.

If you're running 100k QPS through the model with a budget of 0.1 cents per query, you aren't going to be using a GPT model for classification.

BERT isn't dead for smaller tasks (think NER, Sentiment Analysis) where low latency is needed.
There’s also articles for pre-training BERT models on hardware resources a small lab could afford. Those are still useful, too, even if not highly competitive. So, they could still have value for low-cost, small, model development.
Good work by well-known reputable authors.

The gains in training efficiency and compute cost versus widely used text-encoding models like RoBERTa and XLNet are significant.

Thank you for sharing this on HN!

(2020)
Reminds somewhat parallel from the classic expert systems - human experts shine at discrimination, and that is one of the most efficient methods of knowledge eliciting from them.