Papers
Topics
Authors
Recent
Search
2000 character limit reached

ELECTRA Base Discriminator Architecture

Updated 31 May 2026
  • The paper introduces replaced token detection, leveraging all tokens to boost sample efficiency compared to traditional masked language modeling.
  • ELECTRA Base mirrors BERT-Base’s architecture with 12 Transformer layers and specific hyperparameters while employing a novel discriminative pre-training objective.
  • Empirical results demonstrate faster convergence and competitive GLUE/SQuAD scores at lower computational costs relative to conventional models.

ELECTRA Base Discriminator is a Transformer-based neural architecture introduced for discriminative pre-training through replaced token detection rather than masked language modeling. Analogous in depth and capacity to BERT-Base, the discriminator’s innovation is in its pre-training objective: it classifies each input token as “real” (unaltered) or “fake” (replaced by the generator), providing pre-training signals for all tokens instead of a masked subset. The architecture and workflows, matching BERT-Base in most respects, produce more sample-efficient self-supervised training and substantially improved downstream task performance under comparable compute budgets (Clark et al., 2020).

1. Model Hyperparameters and Configuration

ELECTRA-Base Discriminator adopts the standard BERT-Base architectural template, differing only in the pre-training task. The core configuration is as follows:

Parameter Value Notes
Number of layers (LL) 12 Transformer blocks
Hidden size (HH) 768 per position
FFN inner size (HffH_{ff}) 3072
Attention heads (AA) 12 dk=H/A=64d_k = H/A = 64 each
Max sequence length 512 tokens
Vocabulary size (V|V|) 30,522 WordPiece tokens
Dropout (attention) 0.1
Dropout (hidden/FFN output) 0.1
Dropout (embeddings) 0.1

This configuration is designed to maintain parity in representational power with BERT-Base, ensuring fair comparison of task and efficiency (Clark et al., 2020).

2. Embedding Layer Construction

The embedding layer integrates three sources:

  • Token Embeddings: Lookup table ERV×HE \in \mathbb{R}^{|V| \times H} maps each WordPiece token xtx_t to a 768-dimensional vector.
  • Positional Embeddings: Learned vectors PR512×768P \in \mathbb{R}^{512 \times 768} are added element-wise to indicate position within the 512-token bound.
  • Segment (Token-Type) Embeddings: Two learned $768$-dimensional vectors HH0 distinguish sentence A/B membership.

The summed embedding passes to:

HH1

where HH2 specifies the segment. Dropout rate is fixed at HH3 for all three embedding categories (Clark et al., 2020).

3. Transformer Block Architecture

Each of the twelve stacked Transformer blocks is organized identically:

  • Multi-head Self-Attention:
    • For each head HH4, queries, keys, and values are computed: HH5, HH6, HH7.
    • Attention is HH8, with output HH9.
    • All heads concatenated: HffH_{ff}0.
    • Output passes through post-norm residual block: HffH_{ff}1.
  • Feed-Forward Network (FFN):
    • FFN for each position: HffH_{ff}2, where HffH_{ff}3, HffH_{ff}4 and HffH_{ff}5 is the Gaussian Error Linear Unit.
    • Output: HffH_{ff}6.

This structure, including the residual/LayerNorm “post-norm” pattern and hidden/intermediate dimensionalities, is retained directly from BERT-Base (Clark et al., 2020).

4. Discriminator Output, Loss, and Training Signal

Upon completion of HffH_{ff}7 layers, HffH_{ff}8 encodes all positions. The discriminator head applies a sigmoid classifier:

HffH_{ff}9

where AA0, AA1. Each AA2 predicts the “real” probability for input token AA3.

For ground-truth construction, let AA4 be the original, AA5 the corrupted sequence (masker and generator applied). Let AA6 if AA7 (“fake”), otherwise AA8 (“real”). The replaced token detection (RTD) objective:

AA9

Importantly, even if the generator accidentally resamples the original token, that position remains “real.” The overall pre-training loss combines RTD and a much-downweighted generator MLM loss (dk=H/A=64d_k = H/A = 640, scale dk=H/A=64d_k = H/A = 641), but only the discriminator is used for downstream transfer (Clark et al., 2020).

5. Weight Initialization and Optimization

Weights for attention, FFN, and output heads are initialized identically to BERT: truncated normal (mean dk=H/A=64d_k = H/A = 642, std dk=H/A=64d_k = H/A = 643). The optimizer is Adam with dk=H/A=64d_k = H/A = 644, dk=H/A=64d_k = H/A = 645, dk=H/A=64d_k = H/A = 646, and weight decay dk=H/A=64d_k = H/A = 647. The peak learning rate is dk=H/A=64d_k = H/A = 648, with a linear warmup (dk=H/A=64d_k = H/A = 649 steps) followed by linear decay to zero (Clark et al., 2020).

6. Pre-training Regimen and Data

Pre-training employs:

  • Batch size: 256 sequences (max length 512), V|V|0 million tokens/step.
  • Masking rate: 15% of tokens selected uniformly for corruption.
  • Discriminator steps: 766,000 (V|V|1 million updates).

This regimen, matching BERT-Base in batch and token count, but differing in objective and loss, supports direct empirical comparison (Clark et al., 2020).

7. Empirical Outcomes and Design Rationale

ELECTRA-Base, via replaced token detection, utilizes all tokens in the loss computation, in contrast to BERT’s restriction to V|V|2 masked positions. This leads to greater sample efficiency and improved representation quality. Reported experiments show consistently faster convergence and improved GLUE/SQuAD results relative to BERT-Base, and strong GLUE performance even under modest computational budgets. When scaled, the approach achieves competitive or superior accuracy to RoBERTa and XLNet at substantially lower compute cost—less than one fourth when matching downstream performance. The architecture’s discriminative training principle is thus empirically validated as a more efficient pre-training paradigm within the BERT capacity envelope (Clark et al., 2020).

Definition Search Book Streamline Icon: https://streamlinehq.com
References (1)

Topic to Video (Beta)

No one has generated a video about this topic yet.

Whiteboard

No one has generated a whiteboard explanation for this topic yet.

Follow Topic

Get notified by email when new papers are published related to ELECTRA Base Discriminator Architecture.