Embeddings vs Tokens

You will understand what tokens and embeddings are, why they are different tools built for different jobs, and how EngineerPrep uses both to power semantic question search and lesson generation.

Why This Matters

Imagine you're on the EngineerPrep team. Your task: when a learner searches for a coding concept, surface the three most relevant practice questions from the database — even if they use completely different words. You write a SQL LIKE query. It works great when the learner types the exact phrase. It falls apart the moment they don't. 'Binary search' finds nothing when someone types 'halving a sorted array.' 'Graph traversal' finds nothing when someone types 'BFS and DFS.' The problem isn't your SQL. The problem is that matching text by characters can't understand meaning . Two sentences can mean the same thing while sharing zero words. So the real question is: how do you teach a computer what words mean , not just what letters they contain? Tokens and embeddings are the two-part answer.

The Simple Idea

Think about a physical library. Every book has two things: a title on the spine (the words), and a location on a shelf (a coordinate — row 3, shelf 2, position 14). Finding a book by its exact title is fast but brittle. But if books about the same topic are shelved close together, you can find related books just by walking to the right neighborhood of the shelf — even if their titles are completely different. That's the core idea behind tokens and embeddings. Tokens are the words (or pieces of words). They are the raw text, broken into small chunks that a language model can process. A token is just a small unit of text — typically a word, a common sub-word fragment, or a punctuation mark, depending on the tokenizer. Embeddings are the shelf coordinates. An embedding is a list of numbers that represents the meaning of a piece of text.…

See It in Action

Step 1 — Raw text arrives. A learner types: how do I reverse a linked list This is just a string of characters. The computer sees no meaning yet — only letters and spaces. --- Step 2 — Tokenization splits the text. The text is chopped into tokens. Picture scissors snipping the sentence at natural boundaries: "how" "do" "I" "reverse" "a" "linked" "list" Each token is assigned a number from a vocabulary table — like a dictionary where every word has a page number. So 'reverse' might become token 14823. These numbers are what the AI model actually reads. Without this step, the model has nothing to process. What changed: unstructured text became a numbered sequence the model can work with. --- Step 3 — The model produces an embedding. Now imagine those token numbers are fed into the AI model. The model reads the whole sequence and outputs a single list of numbers…