AI from scratch

Start here

This is a book, not a reference manual.

It starts from nothing. You do not need to know what a transformer is, or what "weights" are, or what people mean when they say a model is thinking. You do need to be able to read code. If you know what an array is, and what a function is, you have enough.

The model we are walking toward is Qwen3.8. Alibaba released it as an API on August 3, 2026. The open weights landed on August 12. The downloadable checkpoint is called Qwen3.8-2.4T-A95B. The hosted product is called Qwen3.8-Max. They are related but they are not the same thing. We will get to that.

The first half is what the model is. The second half is why making one is a warehouse problem — the stuff people at xAI or DeepSeek actually fight, once the architecture diagram is boring.

How to read it

Read the chapters in order. Each one assumes the ones before it.

Do not skim the early chapters because they look basic. The later chapters only make sense if the early ones are sitting in your head as pictures, not as vocabulary.

If a chapter has a diagram, look at the diagram after you have read the paragraph that introduces it, not before.

There is a phone-friendly version at ai-from-scratch-c9c.pages.dev.

The chapters

  1. It's not a program
  2. Tokens
  3. The only trick
  4. Vectors
  5. Attention
  6. One layer
  7. Picking the next word
  8. Memory
  9. Experts
  10. Two kinds of attention
  11. How they train it
  12. Teaching it to think
  13. The Qwen3.8 machine
  14. One request
  15. Open weights
  16. What this is not

Part II — the hard parts

  1. Why one GPU dies
  2. Cutting the model up
  3. All-to-all
  4. When the math breaks
  5. A warehouse that thinks
  6. Long context is a tax
  7. Serving is another model
  8. RL is a factory
  9. The data is the model
  10. What labs still hide

There is also a glossary, a sources page, and how to write a book like this. The glossary is for looking things up later. It is a bad place to start. The writing system is how this book was made.

If the first half felt easy, start at 17. That is the intended reaction.

What this book is careful about

A lot of writing about new models is recap of recap. This one is not.

The numbers for Qwen3.8 come from the official Hugging Face model card and the config.json that shipped with the weights. The story of how Qwen trains models comes from the Qwen3 technical report, which is the last time they published the full recipe in public. The hybrid attention design comes from the Qwen3-Next writeup, which is the architecture Qwen3.5 and Qwen3.8 sit on.

When something is a vendor claim and not a measured fact, the book says so. xAI in particular publishes cluster size, not training recipes. Those chapters say so.