All models

electra

An ELECTRA text encoder, pre-trained to detect which input tokens were replaced.

Language · 304 operations Checked

100%

Showing the top corner; full diagram not loaded yetShowing a small copy; full diagram not loaded yetLarge diagram, not loaded yet

Open SVG

Loading diagram (28 KB)

Open in a new tab

Click or tap a spot to read it up close. Scroll or drag inside the diagram to move through it. Zoom with + and − or Ctrl and scroll. Press 0 for the whole graph. Swipe inside the diagram to move through it. Use + and − to zoom.

At a glance

Family
ELECTRA
Parameters
13.5M
Operations
304
Framework
PyTorch
Recurrent
No
Published
ICLR 2020
Cited by
3,072 (as of 9 November 2026)
Authors
Kevin Clark, Minh-Thang Luong, Quoc V. Le, Christopher D. Manning
License
Apache-2.0
Checked
Passed: the trace was replayed operation by operation and matched the model's own output for this input.

Files

The diagram is a drawing of a TorchLens trace of the source code. It contains no code or weights.

Details
Stable ID
m4636
Graph hash
65af273509de8e965d92b6813456bc49fd2e009f57f63595cd055144677d2c9d
Skeleton hash
13c5dbadde845affa0fc1995022c849f7ffa4e7f50077c9d5af16ac2b594f011
Architecture hash
d1c6e7075eedbe60c353cf1b7cbd5460be307df64bc2798fd0b556f27e6966a8
Diagram SHA-256
51d2c69815ae31fa6c45023146693c61a0926f7db4111c7714c95cedc69e1b3d
TorchLens version
2.36.0
Renderer
graphviz 2.43.0+pyvips 3.2.0+libvips 8.18.7+render-opts@06c1f0d3
Check
Forward pass replayed in PyTorch

How this diagram was made

transformers.AutoModelForMaskedLM.from_config()

What it is

This model is ELECTRA with a masked language modeling head; in the paper, the generator is usually a small masked language model that is trained jointly with the discriminator.

About this model's family

ELECTRA is a method for pre-training text encoders with a task called replaced token detection. Instead of masking the input, it corrupts the text by replacing some tokens with plausible alternatives sampled from a small generator network. A discriminator then predicts, for each token, whether it was replaced by a generator sample or not. The paper argues this is more efficient than masked language modeling (MLM) because the task is defined over all input tokens rather than just the small subset that was masked out.

The name stands for Efficiently Learning an Encoder that Classifies Token Replacements Accurately. Although the two networks are structured like a GAN, the generator is trained with maximum likelihood rather than adversarially. After pre-training, the generator is thrown out and only the discriminator is fine-tuned on downstream tasks.

The paper reports that a model trained on one GPU for 4 days outperforms GPT on the GLUE natural language understanding benchmark. At scale, it reports performing comparably to RoBERTa and XLNet while using less than 1/4 of their compute.

Key idea. The paper replaces masked language modeling with replaced token detection, training a discriminator to tell original tokens from ones substituted by a small generator network.

  • electra
  • replaced token detection
  • text encoder
  • discriminator pre-training
  • banglabert
  • koelectra
  • ruelectra
  • bangla
  • korean
  • russian

AI-written summary, based on the paper and checked automatically against it; not reviewed by a person. Corrections welcome.

Cite the paper

@misc{clark2020electrapretrainingtextencoders,
      title={ELECTRA: Pre-training Text Encoders as Discriminators Rather Than Generators}, 
      author={Kevin Clark and Minh-Thang Luong and Quoc V. Le and Christopher D. Manning},
      year={2020},
      eprint={2003.10555},
      archivePrefix={arXiv},
      primaryClass={cs.CL},
      url={https://arxiv.org/abs/2003.10555}, 
}