Real models, running in your browser.
Five hands-on tools for the ideas this course teaches. Everything runs on your device: open models from Hugging Face run with transformers.js on your GPU (WebGPU) or CPU, and nothing you type is sent to a server. Tools that need a model say how big it is and ask before downloading; your browser keeps it for next time.
- TokenizerModels don't read letters or words: they read tokens.
- Next token and samplingA real 135M-parameter model shows its probabilities for the next token.
- EmbeddingsEvery sentence becomes 384 numbers.
- RAG pipelineRetrieval-augmented generation with every stage visible.
- Agent loopA model, four tools and the loop between them.
Tokenizer
Models don't read letters or words: they read tokens. Type anything and watch real tokenizers cut it up.
Try this: Try the strawberry, Hindi and code presets, then switch tokenizers: the same text is a different number of tokens on each, which is why prices and context limits are per token. Read: Tokens and tokenizers →
Next token and sampling
A real 135M-parameter model shows its probabilities for the next token. Bend them with temperature, top-k and top-p, then let it write.
Try this: Generate at temperature 0 twice (identical), then at 1.5 (different every time, and stranger). Watch which tokens top-p cuts. Read: Sampling: temperature, top-p and top-k →
Embeddings
Every sentence becomes 384 numbers. Similar meanings land close together, even with no words in common.
Try this: Open “Same words, different meaning”: the two “bank” sentences share a word but sit far apart, while “central bank increased the cost of borrowing” lands next to “raised its interest rates”. Read: What embeddings are →
RAG pipeline
Retrieval-augmented generation with every stage visible. Chunking, vector and keyword search, fusion, reranking, the prompt and the answer.
Try this: Ask “Can I use Lumen on a Linux server?”: nothing in the documents answers it, so a good answer says it doesn't know. Change the chunk size and watch the hits change. Read: The RAG pipeline end to end →
Agent loop
A model, four tools and the loop between them. Step through it and watch the messages list grow on every call.
Try this: Step through the recorded runs first (a real Gemma 4 E4B model's choices, recorded on a Mac), then run the same task live with the tiny model in your browser and read what the automatic check at the end flags. Read: The agent loop in code →
Models: all-MiniLM-L6-v2 and ms-marco-MiniLM-L-6-v2 (sentence-transformers / cross-encoder, Apache 2.0), SmolLM2-135M-Instruct (Hugging Face, Apache 2.0), Qwen3-0.6B (Qwen, Apache 2.0). Downloads come from huggingface.co and the ONNX Runtime WebAssembly from cdn.jsdelivr.net. The documents in the RAG tool are a made-up app's help centre written for this Lab.