Skip to content
Calcrivo

Embedding Layer Size Calculator

Calculate the parameter count and memory footprint of an embedding layer.

Inputs

Parameters

38,597,376

Memory

73.62MB

Step by step

  1. Parameters: vocab × dim

    50,257 × 768

    = 38,597,376

  2. Memory: params × bytes_per_param

    38,597,376 × 2 bytes

    = 73.62 MB

How it works

An embedding layer is a lookup table of shape (vocabulary_size × embedding_dimension). Each token in the vocabulary has its own dense vector. For GPT-2's 50,257 vocab with 768-dim embeddings, that's 38.6M parameters taking ~73 MB in FP16.

Formula

Embedding Size

params = vocab_size × embedding_dim; memory = params × bytes_per_param

vocab_size
Number of unique tokens in vocabulary
embedding_dim
Dimensionality of each token vector

Frequently Asked Questions

Are embedding parameters trainable?

Yes — embedding vectors are learned during training and encode semantic meaning. Similar words end up with similar embedding vectors (word2vec property).

Why do LLMs have such large embedding layers?

Large vocabularies (32K-100K+ tokens) combined with high embedding dimensions (4096+) mean embedding layers can have hundreds of millions of parameters — a significant fraction of smaller models.

You might also need