How a language model picks its next token
Logits, temperature, top-k and top-p — and why the same prompt gives different answers. With runnable Python.
Logits, temperature, top-k and top-p — and why the same prompt gives different answers. With runnable Python.
Queries, keys and values without the matrix fog — build self-attention in 20 lines of NumPy.
Chunking, embeddings, re-ranking — and the five failure cases worth logging before you blame the model.
Byte-pair encoding, how text becomes numbers, and the quirks it leaves behind.
Adapters, rank and the memory maths that make it fit — with a working Hugging Face recipe.
A 30-example test set tells you more about your use case than any leaderboard. Here is how to build one in Python.
The one NumPy rule behind every batch, every normalisation and every attention mask — explained with shapes.
Pre-training, instruction tuning and preference training — the three stages that turn a text predictor into an assistant.
Turn text into vectors, compare them with cosine similarity, and search by meaning instead of keywords.
A plain loop, two tools and no framework — the core pattern behind every AI agent.
Download an open-weight model, chat with it offline and call it from Python — in about ten minutes.
Plan first, work in small steps, keep tests green — habits that make AI-written code something you can ship.