How LLMs Work (for Engineers)
Tokens, embeddings, attention, the context window, sampling, training, reasoning and hallucination, each built by hand with small numbers.
You do not need to train a model to build with one, but you do need a working picture of what happens inside the box. This phase builds that picture from small pieces you can run: a tokenizer that merges letters into pieces, three-number embeddings and cosine similarity, attention weights on three tokens, a context window that overflows, and a sampler with a temperature knob.
Each mechanism is explained by the engineering question it answers. Why is the bill counted in tokens? Why can a model not count letters? Why does the same prompt give different answers? Why does a long chat forget its beginning? Why does a model say something false in a confident voice? Knowing the cause tells you which fix to reach for in later phases.
Every example prints the same output in Python, Java and JavaScript, and the real-model labs let you see temperature and reasoning tokens on a real hosted model. The phase ends with a cheat sheet of recipes: a token budget helper, temperature defaults per task and a hallucination-risk checklist.
Practise this phase
Hands-on exercises: write the code, run it, and press Check to have it tested automatically.