You, as a vector.
u = fθ(history, context)
From a strawberry’s breakup to the algorithm that knows your next obsession. Let’s open the black box.
[0.82, −0.14, 0.63]A model learns from examples. Then it uses those patterns on something it hasn’t seen. That second part is the real test.
What comes next? Pick the rule you think fits.
16 fits “multiply by two.” But a short sequence can fit many rules. Models also make assumptions from limited data.
A computer doesn’t receive “a funny cat.” It receives numerical data. A model learns useful patterns within it.
Signals travel through weighted connections. Training changes the weights to reduce prediction error. A weight is a number, not a tiny thought.
One neuron learns from a positive example. The bigger network illustrates how many such operations connect.
A neuron computes z = Σwᵢxᵢ + b, then applies an activation function a = f(z). Backpropagation calculates how parameters contributed to loss; an optimizer updates them. Our one-neuron demo uses input x = 1 and no bias. Real training uses many varied examples and held-out evaluation. Memorizing training examples is overfitting, not mastery.
A vector is a list of numbers. An embedding is a learned vector that represents an item. Similarity becomes something we can calculate.
Drag the scene to rotate.
Related examples share a neighborhood.
Illustrative hand-positioned 3D vectors, not a trained embedding model. Real vectors can have hundreds or thousands of dimensions. Projections lose information; real dimensions usually mix learned patterns rather than correspond to named topics.
One strawberry breakup later, you’re emotionally invested. Try the feed and watch your toy interest vector change.
Interest is inferred from behavior. Enjoyment and attention aren’t always the same.
Fictional reel illustrations; creator names are audience-supplied examples, not endorsements or reproduced posts. Comments count as an action here; their text isn’t sentiment-analyzed or stored.One network represents the viewer. Another represents the video. Training makes useful matches score higher in a shared embedding space.
u = fθ(history, context)
v = gφ(video features)
Video vectors can be computed ahead of time. At request time, compute the user vector, then search a vector index for promising candidates. You don’t need an expensive joint model for every video on the platform.
Recent actions can change the input history and resulting user representation. Retraining the underlying network weights is a separate process, not necessarily something that happens after every tap.
Training pairs a user with an interacted-with video and contrasts it with sampled alternatives. One illustrative contrastive objective is:
v⁺ is the positive example; the denominator includes it and sampled alternatives. τ controls score sharpness. Gradient updates adjust both towers. Skipped content is ambiguous, and real sampling and objectives are more nuanced.
Architecture teaching model, not TikTok source code. Meta has documented two-tower retrieval for Instagram Explore. The feed above uses transparent, hand-written updates so you can inspect the math; it does not train two neural networks.
Retrieval finds candidates. Ranking predicts usefulness or engagement. Final selection can account for freshness, diversity and eligibility.
The remaining weight rewards novelty. Move the slider to see why the nearest vector doesn’t always come first.
Our teaching formula; not a platform’s production formula. Scores are not calibrated watch probabilities.
Recommendations consider viewing signals and satisfaction. Home and “Up next” use different contexts.
Read YouTube’s explanation ↗Watch time, interactions, content information and user context help personalize recommendations. Their exact architecture isn’t reproduced here.
Read TikTok’s explanation ↗Explore has a documented retrieval and ranking pipeline. Different Meta surfaces use different systems.
Read Meta’s engineering notes ↗A language model predicts a distribution over next tokens. A decoding strategy chooses one, appends it, and repeats.
Fixed toy logits, not a live language model. Temperature rescales logits: Pᵢ = exp(zᵢ/T) / Σⱼ exp(zⱼ/T). Lower values favor likely choices; higher values flatten the distribution. This does not make an answer more truthful.
RAG retrieves external information and gives it to a model as context. It’s an open-book workflow, not automatic retraining.
This workbench uses a small word-and-punctuation tokenizer, not a production subword tokenizer. IDs identify tokens; they are not embeddings. Overlap repeats boundary tokens so useful context is less likely to be split away.
Many language models use subword tokenization: common pieces get vocabulary IDs, while unfamiliar words split into smaller pieces. Byte-pair encoding (BPE) learns frequent merges; other tokenizers use different methods. Arabic, Latin-script Darija and emoji may split differently. Tokenization rules depend on the model. Token IDs go through an embedding lookup; they are not meaning scores. A chunk is a group of tokens, not a single token.
Smaller chunks can make retrieval more specific and fit within model context limits. Too small loses context; too large mixes topics. Overlap trades extra storage and repeated context for continuity. Real systems often respect sentences, headings, and document structure.
Encode the query and each chunk with compatible representations. Cosine similarity compares direction rather than vector length.
Real dense embeddings can capture semantic relationships without exact word overlap. This transparent demo uses term-frequency vectors so every number is inspectable; it is lexical retrieval, not a pretrained semantic model.
Cosine ranges from −1 to 1 for general vectors. These nonnegative word-count vectors produce 0 to 1. A score of 0.8 is not “80% chance of being correct.”
Select top-k relevant chunks, optionally rerank with a more expensive model, and provide them with the question to a generator. Ask for citations and an explicit “not found” when evidence is missing. Retrieval can fail; a generator can still misread evidence. Check the cited source.
The handbook is invented for this demo, not an actual 1337 / UM6P event announcement.
One last check. What does an embedding actually represent?