Have you ever wondered how language models generate text? In this interactive lesson, you'll explore how this works for simple probabilistic language models, such as those used for predictive text, and for large language models (LLMs), such as those used for AI chatbots. You will examine how a model’s training corpus shapes its output, break sentences into tokens, and generate text using unigram, bigram, and trigram models. You will then investigate how large language models represent words as positions in an embedding space, how self-attention helps them represent words based on context, and how bias in training data influences what a model learns.