This is the best explanation of how language models like ChatGPT work. It demonstrates how models translate language into math, and it shows how models are trained.