LLM Mechanics

How large language models work, and how to study them

Nine lessons, from the artificial neuron to hands-on interpretability experiments on GPT-2. Lessons 1–8 explain the ideas with interactive figures; Lesson 9 applies the methods to a real model, with MATLAB scripts that reproduce every result.

The code (Matlab code, Python code) and the instructions for running it are in the repository github.com/sotmasman/LLM-mechanics; see its README.

Lessons and code are released under the MIT License.