Papers › ELECTRA: Pre-training Text Encoders as Discriminators Rather Than Generators
ELECTRA: Pre-training Text Encoders as Discriminators Rather Than Generators
Kevin Clark, Minh-Thang Luong, Quoc V. Le, Christopher D. Manning
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.
In Syntology View this paper on Syntology, its page in Syntology's graph. That page adds which of its functions are also present in other papers' code Syntology holds, with dates, and its dated run record as JSON and a README badge. It also lists the repositories linked to the paper, the abstract and the calls for agents.
Open this paper in Syntology's Atlas, the map of the papers in Syntology's graph and their citations.
For agents, on Syntology's MCP service (how to connect):
get_harvested_code_for_paper(arxiv_id="2003.10555")get_code(code_sha256="…")with a sample'scode_sha256from the list belowget_citation_path(paper_1="2003.10555", paper_2="…")with another paper's arXiv id or titleget_concepts_for_paper(arxiv_id="2003.10555")
Code
The archive's official repository (google-research/electra) was not harvested; the 36 samples below come from 9 community repositories, and 4 more are identical to code Syntology harvested from another paper's repository.
Syntology 40 code samples: 36 from 9 repositories linked to this paper, 4 identical to code harvested from another paper's repository. Across all 40: 31 ran (of which 7 constructed an object rather than computing a result; 18 with no instrument failure: 2 honoured, 2 violated, 14 with no contract checked; 13 where Syntology's instrument failed) · 9 unverified. Where Syntology's instrument failed: 11 where our contract draft was wrong; 2 where the contract check could not run; failures of Syntology's instrument, not of the code.
By repository: community (archive-listed): 36 samples from 9 repositories, 27 ran (15 with no instrument failure; 12 where Syntology's instrument failed); 4 identical to code first harvested elsewhere. The run record, sample by sample. “Ran” means executed on a synthesized input, not that the code is correct or reproduces the paper.
No sample is linked to this paper from 3 of its repositories that Syntology harvested for other papers:
- huggingface/transformers, community (archive-listed): harvested for 4 other papers, listed under the repository
- PaddlePaddle/PaddleNLP, community (archive-listed): harvested for another paper, listed under the repository
- tensorflow/models, community (archive-listed): harvested for 4 other papers, listed under the repository
Levels written between 2026-09-22 and 2026-09-26 (UTC): the dates Syntology's graph wrote each sample's verification level, not when the code executed. 7 of the 31 samples that ran have no recorded date.
19 repositories listed; official and paper-mentioned ones first.
Repository list and official/mentioned flags are the archive's, frozen 2025-07-28. Reachability, where shown, is from one Syntology probe window (2026-09-16 to 2026-09-18); repositories not probed show nothing. GitHub stars are not tracked.
A paper named beside a repository with no sample linked to this paper is shown with that paper's own run record, not this paper's: “ran” means executed on a synthesized input, not that the code is correct, and “where Syntology's instrument failed” counts failures of Syntology's instrument, not of the code. Papers are listed in arXiv-id order, at most three per repository.
Code Syntology ran Syntology
40 samples harvested: 31 ran (of which 7 constructed an object rather than computing a result; 18 with no instrument failure: 2 honoured, 2 violated, 14 with no contract checked; 13 where Syntology's instrument failed) · 9 unverified. “Where Syntology's instrument failed” counts failures of Syntology's instrument, not of the code. Syntology's record for this page has not changed since , the first build that kept a record date for it; when this build read Syntology's graph is in the build record. That date is not when the samples ran.
Licence: 10 of the 40 samples are pointer only, meaning Syntology does not serve that copy's text. This page shows no code text for any sample; each one links to its file in the repository.
Harvested from 9 repositories linked to this paper, official or community; the list below is grouped by repository, each group headed by its name and what it is to the paper. 4 samples are listed last, in a group without a repository. “Ran” means the sample executed on a synthesized input. It does not mean the output is correct, and nothing here reproduces the paper's results. A line beginning “fixture:” under a sample that ran gives the arguments Syntology's fixture called the sample with, each as name:type/rank/element kind (? where none was recorded), and the type of what the fixture's run returned, exactly as the harness recorded them; the arguments and the returned type were recorded by two separate runs of the same fixture. No output value is shown, and a returned type says nothing about whether the output was right. “Level recorded” gives the UTC date when Syntology's graph wrote the sample's verification level, not when the code executed; where the level was written before Syntology's graph kept that date, the row says “level recorded, date not recorded”. For 2 samples that ran, the graph records a signature this page does not show: for a class the fixture built without calling, the harness called the object with inputs it made up itself, so the recorded signature is the harness's probe, not the fixture's arguments. “Honoured” and “violated” refer to a contract Syntology drafted from the code itself. “Our draft was wrong” and “the contract check could not run” are failures of Syntology's instrument, not of the code: the sample ran on Syntology's synthesized input, and then the drafted contract did not describe it, or the check itself raised an error (RAISES), lacked a dependency (DEP_MISSING) or ran out of time (TIMEOUT); hover the label for which. A metamorphic tier, where shown, is evidence of the output's shape, not that the sample implements the method.
Each sample ends with its code_sha256. A sample's code_sha256 is Syntology's identity for that exact code. It is printed in full (16 hexadecimal characters for every sample in this build), and get_code(code_sha256="…") takes it exactly as printed. An agent calls it on Syntology's MCP service (how to connect); click an identity to copy that call.
Repository labels, per sample. official repository: The archive marks this repository official for the paper. named in the paper: The archive records that the paper mentions this repository; it is not marked official. community (archive-listed): In the archive's code links for this paper, not marked official and not recorded as mentioned in the paper. found in paper text by Syntology: Syntology found this repository in the paper's own text; whether it is the authors' implementation is not asserted. community: Not in the archive's code links for this paper; a community repository Syntology harvested. Samples are grouped by repository: a repository marked official first, then by how directly the repository is tied to the paper, then in the archive's order; never by how many ran. Licence labels name the repository's licence as recorded at harvest. “Pointer only” means Syntology does not serve that copy's text, for one of six reasons: no licence file was found; the licence was not identified; the licence is recorded as permissive but that copy's record is not marked cleared; the licence is outside the permissive list Syntology serves text under (MIT, Apache-2.0, BSD and similar); this paper's copy was not located, so its licence is not recorded; or this paper's copy is cleared, but the stored copy of the same code that Syntology serves is not. Some licences outside that list permit redistribution, such as WTFPL, and GPL-3.0 under its conditions; they are simply not on the list. Hover a licence label for the reason. File links open the file on GitHub at the default branch, which may have changed since the harvest.
A function or class name links to its page when the name occurs in the harvested code of at least 5 papers; the name is a string, not an identity. A census tag appears when Syntology's census ran implementations with that name on one shared input per bucket: it gives how many were compared, from how many papers, and how many distinct outputs they produced, and names this sample's bucket when this sample was one of them.
b03d45af664a39e3 · report
fixture: signature values:list/1/int · returned Feature · level recorded 2026-09-26 c8b43ae9d1268761 · report
fixture: signature h_d:int/0/int, l_d:int/0/int, h_g:int/0/int, l_g:int/0/int, batch_size:int/0/int, train_steps:int/0/int, tied_embeddings:bool/0/bool, e:int/0/int, s:int/0/int, output_frac:float/0/float · returned float · level recorded 2026-09-24 746db01cb1933bb5 · report
fixture: returned ELECITY · level recorded 2026-09-22 0e085ca2f3d4bb62 · report
fixture: returned Trainer · level recorded 2026-09-22 ac6da27d75f60e2b · report
fixture: signature pred_list:list/1/int, topk:int/0/int · returned tuple · level recorded 2026-09-22 20b7c6470df6e0be · report
fixture: signature k:int/0/int · returned float · level recorded 2026-09-22 8667036db81df043 · report
fixture: signature actual:list/1/list, predicted:list/1/list, topk:int/0/int · returned float · level recorded 2026-09-22 a7d3c6223f6b59ea · report
fixture: signature actual:list/1/list, predicted:list/1/list, topk:int/0/int · returned float · level recorded 2026-09-22 fe88c97941ebd49b · report
fixture: returned Classifier · level recorded 2026-09-22 31adaef1bf068638 · report
fixture: returned CustomElectraClassifier · level recorded 2026-09-22 7b1e3bc29ddcc47d · report
fixture: returned PoolingLayer · level recorded 2026-09-22 476517c90ed9ae4c · report
fixture: signature x:Tensor/2/float · returned Tensor · level recorded 2026-09-24 census: 6 implementations from 5 papers, 2 distinct outputs on one shared input this sample: bucket 1 of 1, arg 1: rank 2, kind float, dtype float32 electra_pytorch/electra_pytorch.py ran · our draft was wrong fingerprinted MIT (permissive) ·
3f0491e137c5b556 · report
fixture: signature t:Tensor/2/float · returned Tensor · level recorded, date not recorded 05b426304336430b · report
fixture: returned Electra · level recorded 2026-09-22 0e623ffa58c046a7 · report
fixture: returned HiddenLayerExtractor · level recorded 2026-09-22 759bed040fc319f3 · report
fixture: signature file:str/0/str · returned str · level recorded, date not recorded 626e63a150cc746f · report
fixture: signature exp_id:str/0/str · returned str · level recorded, date not recorded census: 6 implementations from 5 papers, 2 distinct outputs on one shared input this sample: bucket 1 of 1, arg 1: rank 2, kind float, dtype float32 electra_pytorch/electra_pytorch.py ran · our draft was wrong fingerprinted MIT (permissive) ·
983767b34d11c495 · report
fixture: signature t:Tensor/2/float · returned Tensor · level recorded 2026-09-22 census: 6 implementations from 5 papers, 2 distinct outputs on one shared input this sample: bucket 1 of 1, arg 1: rank 2, kind float, dtype float32 electra_pytorch/electra_pytorch.py ran · our draft was wrong fingerprinted MIT (permissive) ·
00982897fc3374b0 · report
fixture: signature t:Tensor/2/float, temperature:float/0/float · returned Tensor · level recorded, date not recorded census: 6 implementations from 5 papers, 2 distinct outputs on one shared input this sample: bucket 1 of 1, arg 1: rank 2, kind float, dtype float32 electra_pytorch/electra_pytorch.py ran · our draft was wrong fingerprinted MIT (permissive) ·
340d3b3d2515a22b · report
fixture: signature t:Tensor/2/float, temperature:float/0/float · returned Tensor · level recorded 2026-09-22 census: 10 implementations from 16 papers, 7 distinct outputs on one shared input this sample: bucket 1 of 1, arg 1: rank 2, kind float, dtype float32 electra_pytorch/electra_pytorch.py ran · our draft was wrong fingerprinted MIT (permissive) ·
c01e5c8df433613c · report
fixture: signature t:Tensor/2/float, eps:float/0/float · returned Tensor · level recorded, date not recorded fe0cfcdd4f533d4a · report
fixture: signature s:str/0/str · returned str · level recorded 2026-09-24 8b5c77d9bafa4f74 · report
fixture: signature _:NoneType/0/?, change:MockChange/0/? · returned dict · level recorded 2026-09-24 dbc5cf3cd537a793 · report
fixture: signature target_list:list/1/str, target_dicts:dict/0/? · returned tuple · level recorded 2026-09-24 290ce73f2b0467c1 · report
3a45861a4eafa4d4 · report
9a9a0f483cc08e79 · report
b38ac6cb5ce30811 · report
3942a8afb86f96db · report
b9dd04206384eff8 · report
24796fea5f721e97 · report
f8d14e7b22f1d071 · report
de0fde92ce293206 · report
fixture: signature model:callable/0/?, submod_name:str/0/str · returned list · level recorded, date not recorded b195c0bc58a304ad · report
fixture: signature inputs:Tensor/2/int, mask_token_index:int/0/int, vocab_size:int/0/int, special_token_indices:list/1/int, mlm_probability:float/0/float, replace_prob:float/0/float, orginal_prob:float/0/float, ignore_index:int/0/int · returned tuple · level recorded, date not recorded eeccb8777414a81a · report
fixture: signature input:Tensor/2/int · returned Results · level recorded 2026-09-24 3cc9d01eacec4925 · report
4 samples are identical to code Syntology harvested from another paper's repository; this paper's own copy was not located, so no repository is named and no licence is recorded.
e33ada12822bb56c · report
fixture: signature mask:Tensor/2/bool, prob:float/0/float · returned Tensor · level recorded 2026-09-22 census: 10 implementations from 16 papers, 7 distinct outputs on one shared input this sample: bucket 1 of 1, arg 1: rank 2, kind float, dtype float32 repository not located ran · honoured contract fingerprinted licence of this copy not recorded ·
6269424d608eba34 · report
fixture: signature t:Tensor/2/float, eps:float/0/float · returned Tensor · level recorded 2026-09-22 5573a79bdc0a0a09 · report
fixture: signature t:Tensor/2/int, token_ids:list/1/int · returned Tensor · level recorded 2026-09-22 0a27e49623646a01 · report
fixture: signature t:Tensor/2/float, prob:float/0/float · returned Tensor · level recorded 2026-09-22 Method as code Syntology
What Syntology's graph records as this paper's claimed method, lifted into code: each assembly names its bricks (functions and classes), each with its own role and its own verification level. An assembly is not a check that the code implements the method correctly or reproduces the paper's results. Levels are each brick's own verification level in Syntology's graph (level 0: no recorded run), listed brick by brick and never combined into one level; “ran” means the brick executed on a synthesized input, not that its output is correct, and the instrument figure counts failures of Syntology's instrument, not of the code. Where a model read the code against the paper's claim, each assembly's label verdict is one model's judgement, kept in this page's JSON twin; it is not calibrated, so no card prints it. Siblings are assemblies lifted from this paper in the same batch for the same method: alternative readings kept side by side; none replaces or supersedes another.
6 assemblies on this paper: 6 harvested, 0 generated, listed in 1 groups (siblings lifted in one batch form one group).
6 sibling assemblies for ELECTRA (harvested), lifted in the same batch on 2026-09-09: alternative readings kept side by side; none replaces or supersedes another.
harvested Assembly for ELECTRA (graph method: ELECTRA). 6 bricks; individually on a fixture: 6 ran (of which 2 constructed an object rather than computing a result; 3 with no instrument failure: 1 honoured, 0 violated, 2 with no contract checked; 3 where Syntology's instrument failed) · 0 unverified. The assembly has not been run end-to-end.
one of 6 siblings
- ELECITY entry · level 1 · ran ·
746db01cb1933bb5 - Trainer helper · level 1 · ran ·
0e085ca2f3d4bb62 - get_metric helper · level 1 · ran; the contract check could not run (RAISES) ·
ac6da27d75f60e2b - ndcg_k helper · level 1 · ran; the contract check could not run (RAISES) ·
8667036db81df043 - recall_at_k helper · level 1 · ran · our draft was wrong ·
a7d3c6223f6b59ea - idcg_k helper · level 1 · ran · honoured contract ·
20b7c6470df6e0be
harvested Assembly for ELECTRA (graph method: ELECTRA). 4 bricks; individually on a fixture: 4 ran (of which 3 constructed an object rather than computing a result; 4 with no instrument failure: 0 honoured, 0 violated, 4 with no contract checked; 0 where Syntology's instrument failed) · 0 unverified. The assembly has not been run end-to-end.
one of 6 siblings
- CustomElectraClassifier entry · level 1 · ran ·
31adaef1bf068638 - Classifier helper · level 1 · ran ·
fe88c97941ebd49b - PoolingLayer helper · level 1 · ran ·
7b1e3bc29ddcc47d - SwishGLU helper · level 1 · ran ·
476517c90ed9ae4c
harvested Assembly for ELECTRA (graph method: ELECTRA). 1 brick; individually on a fixture: 0 ran · 1 unverified. The assembly has not been run end-to-end.
one of 6 siblings
- ElectraQAService entry · level 0 · unverified ·
f8d14e7b22f1d071
harvested Assembly for ELECTRA (graph method: ELECTRA). 8 bricks; individually on a fixture: 8 ran (of which 2 constructed an object rather than computing a result; 5 with no instrument failure: 1 honoured, 2 violated, 2 with no contract checked; 3 where Syntology's instrument failed) · 0 unverified. The assembly has not been run end-to-end.
one of 6 siblings
- Electra entry · level 1 · ran ·
05b426304336430b - HiddenLayerExtractor helper · level 1 · ran ·
0e623ffa58c046a7 - get_mask_subset_with_prob helper · level 1 · ran · violated contract ·
e33ada12822bb56c - gumbel_sample helper · level 1 · ran · our draft was wrong ·
340d3b3d2515a22b - mask_with_tokens helper · level 1 · ran · violated contract ·
5573a79bdc0a0a09 - prob_mask_like helper · level 1 · ran · our draft was wrong ·
0a27e49623646a01 - gumbel_noise helper · level 1 · ran · our draft was wrong ·
983767b34d11c495 - log helper · level 1 · ran · honoured contract ·
6269424d608eba34
harvested Assembly for ELECTRA (graph method: ELECTRA). 1 brick; individually on a fixture: 0 ran · 1 unverified. The assembly has not been run end-to-end.
one of 6 siblings
- ElectraForSequenceClassification entry · level 0 · unverified ·
3cc9d01eacec4925
harvested Assembly for ELECTRA (graph method: ELECTRA). 8 bricks; individually on a fixture: 8 ran (of which 1 constructed an object rather than computing a result; 5 with no instrument failure: 1 honoured, 2 violated, 2 with no contract checked; 3 where Syntology's instrument failed) · 0 unverified. The assembly has not been run end-to-end.
one of 6 siblings
- Electra entry · level 1 · ran ·
eeccb8777414a81a - HiddenLayerExtractor helper · level 1 · ran ·
0e623ffa58c046a7 - get_mask_subset_with_prob helper · level 1 · ran · violated contract ·
e33ada12822bb56c - gumbel_sample helper · level 1 · ran · our draft was wrong ·
340d3b3d2515a22b - mask_with_tokens helper · level 1 · ran · violated contract ·
5573a79bdc0a0a09 - prob_mask_like helper · level 1 · ran · our draft was wrong ·
0a27e49623646a01 - gumbel_noise helper · level 1 · ran · our draft was wrong ·
983767b34d11c495 - log helper · level 1 · ran · honoured contract ·
6269424d608eba34
Each brick ends with its code_sha256, Syntology's identity for that exact code; click one to copy the get_code call that returns it. For agents, on Syntology's MCP service: assembly(arxiv_id="2003.10555") returns these assemblies with each brick's role and wiring (how to connect).
Tasks
1 archive task tag without a task page not shown.
Results from the paper archive 2025-07-28
| Task | Dataset | Model | Metric | Value | Rank at snapshot | Leaderboard | Report |
|---|---|---|---|---|---|---|---|
| Question Answering | Quora Question Pairs | ELECTRA | Accuracy | 90.1% | #8 of 19 | Archive leaderboard | report |
| Sentiment Analysis | SST-2 Binary classification | ELECTRA | Accuracy | 96.9 | #8 of 87 | Archive leaderboard | report |
Ranks are positions in the archive's leaderboards as they stood at the 2025-07-28 snapshot. Results published since then are not among these rows, so a rank here is not a current standing.
Methods
Report a problem or propose a change · a person checks every report against the paper or source before anything changes; decisions are listed on /corrections