Learned Embeddings
P10.text-representation.06 · Audience: Guest, IT/ML learner, Language professional · Prerequisites: Embeddings
Where next?
Later in Text Representation
Go up a level
P10.text-representation.06 · Audience: Guest, IT/ML learner, Language professional · Prerequisites: Embeddings
Later in Text Representation
Go up a level
The embedding table we built from co-occurrence counts is frozen: every word keeps one fixed vector forever, whatever sentence it appears in, and no feedback ever improves it. Modern models take the opposite approach and learn the table by training on a task, hiding a word and then nudging every weight that failed to predict it. This module traces one such BERT-style training step end to end with real numbers, from masking a token to the gradient that rewrites the masked word's row of the embedding table.
Why it matters — The leap from static (P10.text-representation.03) to learned + contextual is the leap from LSA-era NLP to BERT and GPT.
Reference: Devlin et al. 2018 — BERT
Reads /api/text-representation/mlm/step — loading
Computing…
Between counting and BERT sits a predictive road to one fixed vector per word, whatever its sentence: Word2vec, step by step (P10.text-representation.07) learns those vectors by guessing each word's neighbours, and traces each guess through both of its weight matrices.
BERT vs GPT pretraining. BERT masks 15% of tokens (with the 80/10/10 trick: 80% [MASK], 10% random token, 10% unchanged) and predicts them bidirectionally; GPT predicts every next token left-to-right. GPT's objective yields a loss signal at every position (dense), BERT's only at masked ones (sparse) — one reason autoregressive scaling proved so effective. This page's variant feeds the true token (CBOW-with-attention) so the gradient reaches the true row directly — same dynamic, no special-token bookkeeping.
Self-check
What three components sum to form the BERT input embedding?
Self-check
Why does dL/dlogits sum to exactly zero?
Self-check
What happens to the update if you raise the learning rate from 0.01 to 0.5?
Practise this lesson's 3 self-checks
One per screen: you reveal each answer and mark it yourself. Nothing is recorded.
Ask a question about this content. The mentor explains and grounds its answer in what you are studying; asking is recorded as a learning signal, not a grade.
Off by default. The mentor always gets your file; this only decides whether your own copy stays here. Copies live in this browser only - they do not follow you to another device, and clearing site data removes them.
A scratch console for this page's ideas — ungraded, nothing you run here is recorded.
Scratch console
A scratch console with the scientific stack (pandas, numpy, scikit-learn). Runs on the server — no network, resource-limited and measured.
Output appears here.
Loading your notes...