concept:embeddings

Embeddings

Embeddings in the context of production machine-learning systems.

13

Lessons

Formal explanations, examples, simulations, and checkpoints.

Unsupervised learning, anomalies & retrieval

PCA and representation geometry

PCA preserves dominant geometric variation, not automatically the information your decision needs.

Unsupervised learning, anomalies & retrieval

Clustering as an operational hypothesis

A cluster becomes knowledge only when stable geometry connects to a repeatable human or system action.

Unsupervised learning, anomalies & retrieval

Density clusters and novel anomalies

Density methods flag what is locally disconnected; people and outcomes determine what is truly novel and important.

Unsupervised learning, anomalies & retrieval

Embeddings and similarity

Similarity is a modeling choice: the same vectors tell different stories under cosine and dot product.

Unsupervised learning, anomalies & retrieval

Approximate retrieval under latency

Approximate retrieval is an explicit recall–latency contract, not a transparent substitute for exact search.

Recommendation, search & ranking

From corpus to slate: retrieve, score, re-rank

Diagnose recommendation quality stage by stage: coverage first, ordering second, slate policy third.

Recommendation, search & ranking

Clicks are not labels

A click is an exposed, policy-shaped outcome—not a universal relevance label.

Recommendation, search & ranking

BM25, factorization, two towers, and ANN

Hybrid retrieval works because lexical, collaborative, and content representations fail in different places.

Recommendation, search & ranking

Pointwise, pairwise, and listwise ranking

Pointwise learns values, pairwise learns preferences, and listwise learns positions—choose the supervision that matches the slate.

Recommendation, search & ranking

Serving freshness, diversity, and experiments

A recommendation ships only when relevance, freshness, diversity, and system guardrails succeed together.

Build a transformer from scratch

Text to tensors: tokenization, embeddings, position

Tokenizer and position scheme are not preprocessing trivia; together they define what symbols and order the transformer can represent.

Build a transformer from scratch

Scaled dot-product self-attention by hand

Attention is a masked, normalized lookup: queries score keys, softmax allocates influence, and values carry the information.

Build a transformer from scratch

Heads, norms, residuals, and MLPs

Attention mixes tokens, the MLP mixes channels, and normalized residual paths let both transformations accumulate without losing the original stream.

0

Casebook

Reported facts and course reconstructions.