What is the difference between a token and an embedding in an LLM?
A token is a discrete unit of text produced by the tokenizer, typically a subword piece (via BPE, WordPiece, or SentencePiece) represented as an integer ID from a fixed vocabulary. Tokens are symbolic: ID 1234 carries no inherent meaning. An embedding is the dense, continuous vector (e.g. 4096 floats) that the model looks up for each token ID from its embedding matrix. Embeddings live in a learned geometric space where semantically related concepts sit near each other, so the model can compute with meaning rather than opaque IDs. In short: tokenization maps text to token IDs, and the embedding layer maps each ID to a vector. Every transformer layer then transforms these vectors into increasingly contextual representations. 'Embeddings' can also refer to the final pooled sentence/document vectors used for search and RAG.