Index

Module 06 · AIGPT, built from scratch

The MLP Language Model

Tokens and Embeddings
Tokens and Embeddings · Open board

The Tokens and Embeddings board draws text turned into lists of numbers. This lesson learns one for every character: the third of six lessons that end with a small GPT built from scratch.

Before you start. A weight is one adjustable number inside a network; training nudges every weight, over and over, to shrink the loss, one number for how wrong the guesses were. Training finds, for every weight at once, which way to nudge it (Autograd by Hand builds the code that does this). In The Bigram Model a model read 3,000 returns-desk replies and guessed each next character from only the one before it, turning 51 scores (one per possible character) into chances with softmax; its loss on replies it never trained on was 1.97, where knowing nothing scores 3.93. From Tokens & Embeddings: an embedding is a short list of numbers that stands for one piece of text, kept as one row of a table and picked out by that piece’s id. From What a Neural Network Is: a hidden layer is a row of neurons between the input and the answer, each adding up its inputs times weights plus a bias, an extra adjustable number that shifts where the neuron fires. From Why the Loss Won't Go Down: the learning rate is how far each nudge goes, and the loss curve, the loss printed as training runs, shows whether it is right.

Continue reading with a plan

The first three lessons of every track are free. This lesson is included with a plan, which unlocks every lesson, board, video, lab and paper for one price.

View plans →Already a member? Sign in

Lab

One sentence, one tokenizer, a vocabulary you can grow. How many tokens does it cost?

Drag How many pieces it knows left to right, then open the tab Another script, and an emoji, and watch How many tokens.

Open Tokens and embeddings →

Related paper

Review AI →

Saved in this browser, and to your account when you sign in.