liveBook · Manning

Embedding factorization

As explained in Transfer Learning for Natural Language Processing

Embedding factorization represents a vocabulary-to-hidden-layer projection using two matrices separated by a smaller intermediate embedding dimension.

Embedding factorization splits a vocabulary-to-hidden-layer projection into two smaller matrices. In ALBERT, it helps make transformer-based language models more parameter-efficient while allowing the embedding size and hidden-layer size to vary independently. section 10.1 section 10.4

Let V be the vocabulary size, E the embedding dimension, and H the hidden-layer dimension. A token can be represented by a one-hot vector of size V. Instead of projecting it directly to H with a V × H matrix, factorization uses a V × E matrix followed by an E × H matrix. The token first enters an intermediate embedding space, then the hidden layers. section 10.1

The factorized matrices contain V × E + E × H weights, compared with V × H for the direct projection. Choosing a sufficiently small E reduces the embedding projection’s parameter count. It also lets H grow without forcing the input embedding dimension to grow with it. section 10.1

The split reflects different jobs: input embeddings learn context-independent representations, while hidden layers learn context-dependent representations. ALBERT combines factorization with cross-layer parameter sharing; these are separate strategies for making the model more efficient. section 10.1 section 10.0

Sentiment analysis with ALBERT

A practical use is to fine-tune a pretrained ALBERT model on Amazon book reviews from the Multi-Domain Sentiment Dataset. The transformers library provides an implementation, so the experiment can focus on adapting the model to a custom English corpus rather than constructing the factorized projection from scratch. section 10.1

How Transfer Learning for Natural Language Processing covers it

How deep it goes
Explains the one-hot projection, matrix dimensions, and rationale for separating embedding and hidden-layer sizes.
Examples
Uses Amazon book reviews from the Multi-Domain Sentiment Dataset as a custom corpus for ALBERT fine-tuning.
What you can do after
Apply it via the transformers library by fine-tuning a pretrained ALBERT model on a custom corpus.
How it connects
Connects embedding factorization to cross-layer parameter sharing, contextual representations, and fine-tuning.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Transfer Learning for Natural Language Processing. The section links point to the parts of the book it draws on.