A model can only multiply and add numbers. Follow your sentence through six steps until it becomes the grid of numbers a model actually receives, and see where it first meets the model's weights.
This is the actual tokenizer used by GPT-4o, running in your browser. It learned its pieces from a huge amount of text, so common words are single tokens and rare words split into pieces. Try another language too.
Differences from the steps above: it keeps capitals ("River" and "river" are different tokens), and it stores the space in front of a word inside the token, shown as ·.
Every row of the embedding table starts as random numbers. Training uses the same task as the Tiny LLM Lab, predicting the next token, and nudges these numbers each time. Each row has 2 numbers, so each token can be drawn as a point: its two numbers are its position on this map.
The tokenizer learns its pieces from this text, and the embedding weights are trained on it.
A simplified model for understanding. Real tokenizers learn 50,000 to 200,000 pieces and work on bytes, so they can handle any language. Real embedding rows have hundreds to thousands of numbers instead of 2. Next: what the model does with this grid of numbers.