Bring the mental model from Scaled Dot-Product Attention & Transformer Layers; this page will reuse it instead of restarting from zero.
Representation Learning & Embedding Geometry
How models turn inputs into vectors whose geometry can expose useful factors, contextual meaning, and similarity structure.
01
Intuition
Build the mental picture first so the rest of the page has something to attach to.
A model can only "think" in the space it uses internally. In deep learning, that internal space is usually a vector space: an embedding.
A common goal of representation learning is to make learned features expose useful factors of variation. We want vectors where:
- things that "mean the same" are close,
- things that are different point in different directions,
- and simple operations (dot products, distances, averages) line up with useful questions (retrieval, clustering, analogy, control).
When this works, embeddings become an interface. Depending on the model and training objective, they are often used for similarity search, lightweight classifiers, or analyses of directions in representation space. When it fails, vectors collapse into weird shapes (anisotropy, degenerate norms) and similarity becomes noisy.
Context matters too. A static word vector gives one vector to a word type, but a contextual representation lets the token "bank" move depending on whether the surrounding sentence is about rivers or money. That is the ELMo lesson: the useful feature is not only the token identity, but the token identity as interpreted through its context.
Copy-only prompts — each action copies a page-grounded prompt to your clipboard. Nothing is sent by this site.
02
Math
Translate the story into symbols, assumptions, and a derivation you can inspect.
Let an encoder map inputs to vectors. If a simple downstream predictor can recover a useful factor from the vector, the representation has made that factor easier to extract. For contextual word representations, the token vector can depend on the whole sentence:
Here a is a useful factor or label we hope is easy to read from z, gψ is a simple extractor such as a classifier or probe, and hk,jLM is the bidirectional language-model state for token position k at layer j. Peters et al. use task-specific softmax weights sjtask and scale γtask to combine the biLM layers, so the same token position can receive a different vector in a different sentence.
Similarity as a dot product (often cosine)
A common choice is cosine similarity, which is just a dot product of normalized vectors:
Normalization matters because it makes similarity depend on direction instead of length.
Contrastive learning (InfoNCE)
Suppose we have "positive pairs" (xi,yi) (two views of the same thing: two crops of an image, two versions of a sentence, etc.). Encode them:
InfoNCE treats (zi,ui) as the correct match among a batch of candidates:
- τ>0 is the temperature: smaller τ makes the softmax sharper (harder negatives, bigger gradients).
- In contrastive-learning setups, this kind of objective scores the intended pair above other candidates.
A useful geometry sanity check: anisotropy
Embeddings often become anisotropic (many points bunch along a few dominant directions). A practical check is the covariance of normalized embeddings:
If a few eigenvalues dominate, the embedding cloud is highly directional, which can affect cosine-based comparisons. Normalization or whitening-style preprocessing can change this geometry.
Copy-only prompts — each action copies a page-grounded prompt to your clipboard. Nothing is sent by this site.
03
Code
Keep the implementation aligned with the notation so the algorithm is legible.
import numpy as np
def unit(v):
return v / (np.linalg.norm(v) + 1e-9)
# Toy handcrafted features: axis 0 = water-vs-finance context,
# axis 1 = the token identity "bank", axis 2 = filler.
feat = {
"river": np.array([1.0, 0.0, 0.0]),
"shore": np.array([1.0, 0.0, 0.0]),
"money": np.array([-1.0, 0.0, 0.0]),
"loan": np.array([-1.0, 0.0, 0.0]),
"bank": np.array([0.0, 1.0, 0.0]),
}
def contextual(left, token, right):
return unit(0.55 * feat[token] + 0.35 * (feat[left] + feat[right]))
static_bank = unit(feat["bank"])
river_bank = contextual("river", "bank", "shore")
money_bank = contextual("money", "bank", "loan")
water_probe = unit(np.array([1.0, 0.0, 0.0]))
def water_score(z):
return float(z @ water_probe)
print("static bank:", round(water_score(static_bank), 3))
print("river bank: ", round(water_score(river_bank), 3))
print("money bank: ", round(water_score(money_bank), 3))
assert water_score(river_bank) > water_score(static_bank) > water_score(money_bank)
assert np.linalg.norm(river_bank - money_bank) > 1.4
Copy-only prompts — each action copies a page-grounded prompt to your clipboard. Nothing is sent by this site.
04
Interactive Demo
Use direct manipulation to connect the explanation to a moving system.
Live Concept Demo
Explore Representation Learning & Embedding Geometry
The stage is code-native and interactive. Use it to test the explanation against the mechanism.
Manipulate one control and predict the visible change.
Choose what to inspect in Representation Learning & Embedding Geometry. This shared fallback is an observation guide, not evidence of learning.
Use the demos to build geometric intuition:
- how normalization changes similarity (direction vs length),
- how "directions" in representation space can encode behaviors (task vectors),
- and how geometric constraints like equivariance preserve structure.
Copy-only prompts — each action copies a page-grounded prompt to your clipboard. Nothing is sent by this site.
Concept: Representation Learning & Embedding Geometry
What is the smallest example that makes Representation Learning & Embedding Geometry click without losing the math?
Object contextRepresentation Learning
concept:representation-learning/representationsRepresentation Learning & Embedding Geometry
What is the smallest example that makes Representation Learning & Embedding Geometry click without losing the math?
Start with the prediction checkpoint, then compare the reveal to the mental model.
Take this moveStudy modes
Keep the object fixed; change the lens.Route back through the notebook
Carry the same object through intuition, math, code, and demo.
How models turn inputs into vectors whose geometry can expose useful factors, contextual meaning, and similarity structure.
The next edge should feel earned: use the demo prediction here before following superposition.
After The First Pass
Turn the concept into an inspected object.
The lower panels are one second act: keep the object fixed, inspect it visually, check source boundaries, practice transfer, then attach the research question.Mechanism Storyboard
See the idea move before the page explains it
How models turn inputs into vectors whose geometry can expose useful factors, contextual meaning, and similarity structure.

Start with the picture, metaphor, or geometric mechanism.
Before reading further, choose the kind of change Representation Learning & Embedding Geometry should make visible.
Visual Inquiry
Make the image answer a mathematical question
How models turn inputs into vectors whose geometry can expose useful factors, contextual meaning, and similarity structure.
Which visible object should carry the first intuition?
Pick the cue that should make Representation Learning & Embedding Geometry easier to reason about before the page gives the answer.
Source Grounding
Canonical references for the mechanism on this page.
What is the smallest example that makes Representation Learning & Embedding Geometry click without losing the math?
concept:representation-learning/representationssources: bengio-2013-representation-learning, peters-2018-elmo, oord-2018-cpc
Open the closest source note before trusting the local explanation.
3 selected-object sources shown first; 3 references total.
Audit the claim boundary, then ask from the same selected object.
Grounds representation learning as learning useful explanatory factors and feature geometry.
Bengio et al. frame representation learning as learning transformations that expose useful explanatory factors and make useful information easier to extract. Peters et al. introduce ELMo...
Checks only useful-factor extraction and ELMo-style contextual token dependence. It does not certify InfoNCE, retrieval quality, task vectors, anisotropy fixes, equivariance, parallel tra...
Grounds contextual embeddings as representations whose meaning changes with surrounding context.
Bengio et al. frame representation learning as learning transformations that expose useful explanatory factors and make useful information easier to extract. Peters et al. introduce ELMo...
Checks only useful-factor extraction and ELMo-style contextual token dependence. It does not certify InfoNCE, retrieval quality, task vectors, anisotropy fixes, equivariance, parallel tra...
Grounds contrastive predictive coding and InfoNCE-style losses that score positive pairs against negative samples.
The selected object cites this source; inspect the exact claim before treating it as support.
Attached source metadata is a review boundary, not proof of the local explanation.
Claim Review
How models turn inputs into vectors whose geometry can expose useful factors, contextual meaning, and similarity structure.
What is the smallest example that makes Representation Learning & Embedding Geometry click without losing the math?
concept:representation-learning/representationssources: bengio-2013-representation-learning, peters-2018-elmo, oord-2018-cpc
Treat every claim as provisional until source support and a local witness agree.
1 structured claim check on this concept.
Run the prediction or practice transfer before asking for a grounded review.
Publisher-side editorial review is not independent replication. Claims without it still need exact source-support review. 3 references and 3 local witnesses are available for inspection.
Bengio et al. frame representation learning as learning transformations that expose useful explanatory factors and make useful information easier to extract. Peters et al. introduce ELMo contextual word repr...
Checks only useful-factor extraction and ELMo-style contextual token dependence. It does not certify InfoNCE, retrieval quality, task vectors, anisotropy fixes, equivariance, parallel transport, or all repre...
Bengio et al. support representation learning as learned features that make useful information or explanatory factors easier for predictors to extract. Peters et al. support ELMo as sentence-contextual token representations from biLM layer states, including task-specific layer weighting and polysemy disambiguation. Local math and code witness this bounded claim; broader geometry demos stay out of scope.
Reviewer: codex+oracle+codex-5.3; reviewed 2026-05-08Practice notebook
Use the idea, then test it somewhere new
How models turn inputs into vectors whose geometry can expose useful factors, contextual meaning, and similarity structure.
What is the smallest example that makes Representation Learning & Embedding Geometry click without losing the math?
concept:representation-learning/representationssources: bengio-2013-representation-learning, peters-2018-elmo, oord-2018-cpc
Use one state from Representation Learning & Embedding Geometry to explain what changes, why it changes, and which assumption the explanation needs.
No learner move yet; no learning state is inferred.
Write first, use only the help you need, then try a new case without it.
Use one state from Representation Learning & Embedding Geometry to explain what changes, why it changes, and which assumption the explanation needs.
Reveal when your model needs a nudge.
Reveal when your model needs a nudge.
Reveal when your model needs a nudge.
Write an attempt before asking the companion.
0 of 3 progressive hints opened.
This draft and any AI response do not establish mastery; a later unassisted case can.
- ObjectConceptRepresentation Learning & Embedding Geometry
- PredictBefore revealRepresentation Learning & Embedding Geometry prediction
- WitnessCompare codeRepresentation Learning & Embedding Geometry code witness 1
- RoomAsk groundedChecking local snapshot
Research Room
Attach the question to an exact object
Pick the concept, equation, source, code witness, claim, misconception, or demo state before asking for help. The handoff stays grounded to that object.Open the draft below to save one note and next action in this browser.
Representation Learning & Embedding Geometry
What is the smallest example that makes Representation Learning & Embedding Geometry click without losing the math?
These are fixed, deterministic perspectives derived from the selected object. They do not represent people, community contributions, or independent review.
Source ids bengio-2013-representation-learning, peters-2018-elmo, oord-2018-cpc must support the exact object, not just the surrounding topic.
Treat this as a mechanism object: connect the definition to one equation, code witness, or demo before broadening the discussion.
Ask the learner to perturb one representation, then check whether the same invariant survives in math, code, and demo.
The learner can state the mechanism in their own words
Local action draftNo local draft saved yetExpand only when ready to capture one local next action
This draft stays locally in this browser for concept:representation-learning/representations.
- Source ids to inspect: bengio-2013-representation-learning, peters-2018-elmo, oord-2018-cpc
- Definition, prerequisite, and contrast concept links
- The equation or code witness that makes the concept operational
- One demo state that shows the invariant instead of a slogan
- The learner can state the mechanism in their own words
- The learner can name the prerequisite that would repair confusion
- The learner can predict how the mechanism changes under one perturbation
I am working in Continuous Function's research reading room. Object: concept - Representation Learning & Embedding Geometry Object key: concept:representation-learning/representations Context: Representation Learning Anchor id: concept/concept-notebook/representation-learning/representations Open question: What is the smallest example that makes Representation Learning & Embedding Geometry click without losing the math? Evidence to inspect: - Source ids to inspect: bengio-2013-representation-learning, peters-2018-elmo, oord-2018-cpc - Definition, prerequisite, and contrast concept links - The equation or code witness that makes the concept operational - One demo state that shows the invariant instead of a slogan Deterministic role lenses for this object: - Boundary: fixed perspectives, not people, community contributions, or independent review - Source-checking summary: Treat this as a mechanism object: connect the definition to one equation, code witness, or demo before broadening the discussion. - Proposed experiment: Ask the learner to perturb one representation, then check whether the same invariant survives in math, code, and demo. - Teach/transfer move: Turn the mechanism into one sentence that predicts a neighboring concept. - Assumptions: - Source ids bengio-2013-representation-learning, peters-2018-elmo, oord-2018-cpc must support the exact object, not just the surrounding topic. - The stable content-object key lets local drafts, prompts, and route memory attach without changing the source page. - The concept explanation is local atlas prose until checked against its math, code, and source support. - Prerequisite gaps should become a repair route, not a reason to leave the object vague. - Role-lens requests: - Learner: ask for "Ask what would make "Representation Learning & Embedding Geometry" feel predictable rather than familiar." | assumption: Source ids bengio-2013-representation-learning, peters-2018-elmo, oord-2018-cpc must support the exact object, not just the surrounding topic. | next action: The learner can state the mechanism in their own words - Researcher: ask for "Source ids to inspect: bengio-2013-representation-learning, peters-2018-elmo, oord-2018-cpc" | assumption: The stable content-object key lets local drafts, prompts, and route memory attach without changing the source page. | next action: The learner can name the prerequisite that would repair confusion - Experimenter: ask for "Choose one variable or condition to perturb before asking for an explanation." | assumption: The concept explanation is local atlas prose until checked against its math, code, and source support. | next action: The learner can predict how the mechanism changes under one perturbation - Professor: ask for "Find the smallest transferable rule a learner could reuse without the AI." | assumption: Prerequisite gaps should become a repair route, not a reason to leave the object vague. | next action: Teach or transfer: Turn the mechanism into one sentence that predicts a neighboring concept. What would resolve this: - The learner can state the mechanism in their own words - The learner can name the prerequisite that would repair confusion - The learner can predict how the mechanism changes under one perturbation Answer as a careful research tutor: stay source-grounded, separate verified evidence from assumptions, name the relevant math objects, and end with one next action. Current deterministic role lens for this object: - Role lens: Learner - Evidence request: Ask what would make "Representation Learning & Embedding Geometry" feel predictable rather than familiar. - Assumption to keep visible: Source ids bengio-2013-representation-learning, peters-2018-elmo, oord-2018-cpc must support the exact object, not just the surrounding topic. - Proposed experiment: Ask the learner to perturb one representation, then check whether the same invariant survives in math, code, and demo. - Next action: The learner can state the mechanism in their own words
concept/concept-notebook/representation-learning/representations
concept:representation-learning/representations