Vibeleaderboard
← All Intel
Intel / article

A Component-by-Component Walkthrough of How Transformer LLMs Work

Source
deeplearning.ai
Author
Andrew Ng
Date

Context

How Transformer LLMs Work is a DeepLearning.AI short course that walks through a in the order text moves through it. Andrew Ng announced it on February 5, 2025. It is taught by Jay Alammar and Maarten Grootendorst, co-authors of the book "Hands-On Large Language Models." The course page lists it as a beginner course of about 1 hour 44 minutes, with 13 video lessons and 2 code examples. The transformer is the neural-network design introduced in the 2017 paper "Attention Is All You Need," and the course page notes that variants of it now power large language models from OpenAI, Google, Meta, Cohere and Anthropic.

The course follows three stages. First, tokenization breaks input text into tokens, which are words or pieces of words, and each token is mapped to an embedding, a list of numbers that represents it. Second, the tokens pass through a stack of transformer blocks. Inside each block, attention calculates relevance scores that let each word's representation take the surrounding words into account, and a feedforward layer adds information the model stored during training. Third, the language model head produces the output. Before reaching transformers, the course traces how text has been represented numerically, from Bag-of-Words, which only marks which words are present, through Word2Vec embeddings to representations that capture a word's meaning in . The code examples cover tokenizers and a model implementation in the Hugging Face Transformers library.

The later lessons deal with changes since the original design. The page lists caching of earlier calculations (the ) to make generation faster, multi-query, grouped-query and sparse attention, and , which Ng describes as using several sub-models with a router on each layer. The stated goal is that a student can read a paper describing a new model and follow its architecture. Alammar is a director and engineering fellow at Cohere and, as Ng notes in the announcement video, wrote the widely read 2018 article "The Illustrated Transformer"; Grootendorst is a senior clinical data scientist at the Netherlands Comprehensive Cancer Organization. This explanation is based on the course page, the announcement post and a transcript of its video; the lessons and code were not reviewed, so it describes what the course covers rather than how well it teaches it.

Terms in this piece · Glossary
  • Large language model — A model trained on large amounts of data to process and generate language.
  • Context and context window — Context is the information available for a generation; the context window is the capacity available to hold it.
  • KV cache — The memory a model keeps about text it has already read, so generating each new token doesn't require reprocessing the whole conversation.
  • mixture-of-experts — A model built from many specialist sub-networks where only a few activate per token, giving big-model capability at small-model running cost.

Get the Brief

A cited digest of what matters for people building with AI, every morning. Unsubscribe anytime. See today’s edition

Read the source www.deeplearning.ai
More from Andrew Ng
Recommended reads