← All projects
Learning resources

Hands-On Large Language Models

The code examples for an illustrated book that teaches how AI language models work and how to use them.

What it does

This repository holds all the code from the O'Reilly book "Hands-On Large Language Models". The book uses almost 300 custom illustrations to explain the ideas behind large language models, the technology behind chatbots like ChatGPT.

There's a notebook (an interactive document mixing text and code) for each of the 12 chapters. Topics include how models read text, how they work inside, sorting and grouping text, writing good prompts, searching documents, models that understand images, and fine-tuning.

The authors suggest running the examples in Google Colab, a free online service that provides the computing power needed.

Who it's for

Readers of the book, and anyone with some programming background who wants a practical, visual introduction to language models.

Can I use it without coding?

Developers only. The notebooks are Python code, though they can run free in your browser through Google Colab. New to this? Start here.

Can I run it?

Cost
FreeNothing to pay or sign up for.
Runs on
Web browser
Computer
An ordinary computer is fine
Privacy
Your choice: run it on your device or use an online service
API key
Not needed

Try it

  1. Open the chapter examples in Google Colab, which offers a free graphics card.
  2. Or follow the setup folder's guide to install everything on your own computer.

Using Claude Code, Cursor or another AI coding assistant? Paste the prompt and it will walk you through the setup.New to this?

Before you install

  • Only download from the official GitHub page. Copies with similar names exist for many popular projects.
  • License (Apache-2.0): Permissive: free to use, change and share, including for business.
  • More on staying safe

Where people are talking about it