What it is used for
ELECTRA is used for the same text-understanding work as the BERT and RoBERTa family: classifying writing such as reviews and incoming mail, finding answers inside documents, and judging similarity of meaning. Its advantage is its frugality. A team with limited computing power can train or tune a model whose quality matches models that cost far more to train, and its small size is light enough for everyday classification work in large volumes. It is a reasonable choice when the job is clearly bounded and the budget is narrow.
That frugality opens two uses that expensive models do not. First, small institutions, campuses, and research teams without a data centre can train their own reading model from the beginning on machines they own, not only tune a finished one, because its small form is designed to finish on a single graphics card. Second, classification work that runs continuously in very large volumes, such as filtering a daily stream of documents or reviews, can be served by a small model whose running cost is low, without sacrificing as much quality as its size would suggest. In both uses, what is bought is not the highest quality that exists, but nearly equal quality at a far more sensible price.
How to use it
A developer takes the already trained ELECTRA model, released openly together with its code, then tunes it with labelled examples from the intended job, just as one tunes BERT or RoBERTa. What is tuned is the discriminator, the replacement-judging model, because it is the one that understands the text; the small generator that helped it train is not used again after the initial training. Once tuned, the model receives new text and returns its class or answer together with a confidence score.
One practical lesson from its paper is worth carrying into any tuning work: tuning results on small example sets can shift a great deal with the random starting point, so much that its authors felt obliged to report the middle value of ten tuning runs for every figure they published. That means one tuning run that happens to be good or bad is no proof of the model's quality. A careful user tunes several times, judges on held back data that took no part in training, and only then decides from the middle value, exactly as this paper did with its own model.
Its three sizes
ELECTRA was published in three sizes with different stories. Its small size has 14 million parameters, only a twentieth of the parameters of the large BERT, and was trained on a single graphics card for four days with a hundred and thirty-fifth of the computing power used for the large BERT. Its GLUE score of 79.9 stands five points above a comparable small BERT trained with the same power, and above GPT, which has 117 million parameters and was trained for twenty-five days on eight cards. Its base size has 110 million parameters, equal to BERT base, and at the same computing power reaches a GLUE score of 85.1 against 82.2 for BERT base, even passing the large BERT's score of 84.0. Its large size has 335 million parameters: at 400,000 steps it matches RoBERTa and XLNet with less than a quarter of their computing power, and trained longer, to 1.75 million steps, it passes both on GLUE and sets a new best mark on SQuAD 2.0. The small and base sizes trained on the same data as BERT, while the large size trained on the larger data used by XLNet.
Practitioner level
Practitioners weigh ELECTRA by its frugality in two places: its short initial training for its quality, and its tuning, which can run on modest machines. Its base size is about 110 million parameters, equal to BERT base, and in its paper's tests it beat BERT base on GLUE by a clear margin. For English classification work on a small computing budget, it is often a more sensible choice than a larger reading model. What still holds, as with every reading model, is that the quality of the result is decided by the labelled examples used to tune it.
The small model's time ladder gives a useful picture for budgeting experiments: after six hours of training its GLUE score was already 74.1, after twelve hours 76.0, after one day 77.7, after two days 79.0, and after four days 79.9. Usable quality therefore arrives long before training finishes, and a small team can test an idea on a half finished model before deciding to spend the full four days. What must be remembered is that those figures are middle values of many runs, so a single experiment can land above or below them.
Expert level
Its technical idea is called replaced token detection. A small generator, a masked language model, is trained together with the discriminator and has the job of producing replacement words that are convincing enough; the discriminator receives a sentence whose contents have been partly swapped and outputs an original-or-replacement judgement for every word position. This arrangement resembles the generator and discriminator pair of adversarial networks, but its authors stress it is not a contest, because the generator is trained by ordinary maximum likelihood, not to defeat the discriminator. Its efficiency advantage is mathematical: the masking method gives a learning signal on only about 15 percent of words, while detection gives a signal on 100 percent of words, so every example read teaches more. At large scale this method reached the best results of its time on SQuAD 2.0 and the GLUE board, and it became a standard reference that the design of the training task matters as much as the size of the model.
The details of its design show that the frugality was engineered, not accidental. Its generator is deliberately kept small, a quarter to a half of the discriminator's size, because an overly strong generator proved harmful: the discriminator is forced to spend its capacity modelling the generator itself rather than modelling the data. The word arrangements of the two models are shared, and that sharing improves results, while sharing all weights helps only slightly. When the generator happens to produce the correct word, that word counts as original, and even this small rule measurably improves the final result. Its authors also tried the more attractive looking road of training the generator adversarially with reinforcement learning, as in a true adversarial network, and that road lost: its generator's accuracy on the masked lesson was only 58 percent against 65 percent for the ordinary way, and its replacement words were less varied. At large scale, its 400,000 step form used 33 billion pieces of text and reached a GLUE development score of 89.0 with less than a quarter of RoBERTa's computing power, while its longest trained form reached 89.4 on the GLUE test and 88.7 and 91.4 on the SQuAD 2.0 test, a new best mark of its time.
Limits and risks
ELECTRA is an English reading model from 2020: it does not write text, does not converse, and knows nothing after its training period. It cannot be used without labelled tuning for each job, and skewed tuning examples produce a skewed classifier. For many jobs, large modern generative models are now more accurate and easier to use directly, though far more expensive. ELECTRA's lasting position is as proof that efficiency can be designed into the training task itself, and as a light reading worker that still makes sense for clearly bounded classification work.
Its language limit is written in its own paper: all of its training and evaluation was done on English data, so use for other languages rests on descendants trained by others, not on this original model. Its frugality also has a condition: during initial training, two models are trained at once, so its cost per step is larger than training a single masked model, and the frugality wins only because its learning signal comes from every word. Finally, its quality figures carry the same uncertainty as other reading models: its authors report the middle of ten runs because a single run can stray far, above all on tasks with few examples.