ALBERT › ALBERT Model Configurations

Michael BrenndoerferUpdated July 19, 20255 min read
Language AI HandbookAll chapters
Part 24 of 67BERT and Variants
Chapter 174ALBERT › ALBERT Model Configurations
Reading section 10 of 18 · ALBERT Model Configurations · 5 minSection 10 of 18 · 5 min

Book contents

Section 10 of 18 · 5 min read

ALBERT › ALBERT Model ConfigurationsOne section · Sections in this chapter10 / 18 ↓
Reading tools Definitions & inline links

Choose your expertise level to adjust how many terms are explained. Beginners see more tooltips, experts see fewer to maintain reading flow. Hover over underlined terms for instant definitions.

Article links

Make inline references clickable

The original paper introduced four model sizes. Unlike BERT, which scaled parameters with layers, ALBERT scales the hidden dimension while keeping shared parameters.

In[34]:
Code
albert_configs = {
    "ALBERT-Base": {
        "embedding_dim": 128,
        "hidden_dim": 768,
        "num_heads": 12,
        "intermediate_dim": 3072,
        "num_layers": 12,
    },
    "ALBERT-Large": {
        "embedding_dim": 128,
        "hidden_dim": 1024,
        "num_heads": 16,
        "intermediate_dim": 4096,
        "num_layers": 24,
    },
    "ALBERT-xLarge": {
        "embedding_dim": 128,
        "hidden_dim": 2048,
        "num_heads": 16,
        "intermediate_dim": 8192,
        "num_layers": 24,
    },
    "ALBERT-xxLarge": {
        "embedding_dim": 128,
        "hidden_dim": 4096,
        "num_heads": 64,
        "intermediate_dim": 16384,
        "num_layers": 12,
    },
}


def estimate_albert_params(config, vocab_size=30522):
    """Estimate parameter count for an ALBERT configuration."""
    e = config["embedding_dim"]
    h = config["hidden_dim"]
    i = config["intermediate_dim"]
    heads = config["num_heads"]

    # Factorized embeddings
    embedding_params = (
        vocab_size * e + 512 * e + 2 * e
    )  # Token, position, segment
    projection_params = e * h  # Embed projection

    # Shared layer (only counted once)
    attention_params = 4 * h * h + 4 * h  # Q, K, V, O
    ffn_params = h * i + i + i * h + h  # Two layers with biases
    layer_params = attention_params + ffn_params + 4 * h  # Plus LayerNorms

    # Heads
    mlm_head = (
        h * e + e + 2 * e + vocab_size * e
    )  # Dense + norm + decoder (tied)
    sop_head = h * 2
    pooler = h * h + h

    total = (
        embedding_params
        + projection_params
        + layer_params
        + mlm_head
        + sop_head
        + pooler
    )

    return total
Out[35]:
Console
ALBERT Model Configurations:
---------------------------------------------------------------------------
Model              Hidden   Layers   Intermediate   Est. Params 
---------------------------------------------------------------------------
ALBERT-Base        768      12       3072               15.8M
ALBERT-Large       1024     24       4096               21.8M
ALBERT-xLarge      2048     24       8192               63.0M
ALBERT-xxLarge     4096     12       16384             227.1M

Notice how parameter counts grow much slower than hidden dimensions. ALBERT-xxLarge has a hidden dimension 5.3x larger than ALBERT-Base (4096 vs 768), but its parameter count is only about 20x larger. With BERT's approach, the parameter ratio would match the hidden dimension ratio squared, since attention parameters scale with H2H^2.

The largest model, ALBERT-xxLarge, uses only 12 layers but has a massive 4096-dimensional hidden space. This reflects the finding that wider models with shared parameters can match deeper models with unique parameters.

We can visualize how differently parameters scale between BERT's approach and ALBERT's:

Out[36]:
Visualization
Line plot comparing parameter growth for BERT-style vs ALBERT-style scaling across hidden dimensions.
Parameter scaling with hidden dimension. BERT-style models (dashed) scale quadratically with hidden dimension because each layer has unique attention weights. ALBERT (solid) grows much more slowly because only one layer's worth of attention parameters exists, regardless of depth.
Out[37]:
Visualization
Bar chart comparing hidden dimensions and estimated parameters across ALBERT model sizes.
ALBERT configuration comparison. While hidden dimension and intermediate size grow substantially across model sizes, the parameter count grows more slowly due to cross-layer sharing. ALBERT-xxLarge has the largest hidden dimension but uses only 12 layers.