What this book is¶
Type the word Bakersfield into a language model and it does not see a city. It sees three
pieces, ['B', 'akers', 'field'], and it looks each one up in a table. That table is over a
quarter of the whole model. You can open it, count it, and print it.
This is the coursebook for MATH 3219 at California State University, Bakersfield. It is a free, open coursebook: you can read it on a laptop or a phone, search it, copy its code, and keep it after the semester ends. Nothing in it is behind a paywall.
The course is about the small language models you can run on your own machine, and it treats
one of them as a physical object you are allowed to take apart. The smallest model in the
course, Qwen2.5-0.5B-Instruct, is 494,032,768 numbers and 0.988 gigabytes in half precision.
Every week you run it, watch what it does, explain the arithmetic that made it do that, and
then write down what the run cost.
You do not need to have programmed before. You do not need calculus. The Python in this book is a tool the course hands you, never a prerequisite.
The question the course is built on¶
A model small enough to be cheap to run is also a model cheap enough for a public university to put on every student’s laptop. Those are not two facts; they are one fact seen twice. Small models are where sustainability and access meet, and both of them can be measured.
That claim is testable, so the course tests it. When you shrink a model in Week 7, you measure several things about the same change: how many bytes it saves, how much faster it answers, how much accuracy it gives up, and what it draws from the wall. The environmental argument and the access argument run on the same measurements, in the same units, from the same lab.
This is why the course grades a fourth beat every week. The rhythm is run, observe, explain, cost it. The last one is not decoration. It is on the rubric.
How every idea is built¶
Every concept in this book arrives in the same three steps, in the same order:
Read them in that order. Do not skip to the formula; the intuition is what makes the formula stick. And do not stop at the formula, because the code is where the claim gets checked.
If you have forgotten your algebra¶
You probably have. Most people have. It is the normal condition of an adult who last sat in a maths class years ago, and it says nothing about whether you can do this.
So this book assumes it. Not “no calculus”, which is what most books mean when they say a course is accessible. This book assumes you are not certain what means, that you have not thought about what an exponent is in a long time, and that you would like someone to say plainly whether is a real number or a typo.
Three things follow from that, and they hold everywhere in this book.
Every formula is introduced six ways. First a plain English sentence with no symbols in it at all. Then the formula. Then a table defining every symbol in it, including the ones you think you are supposed to already know. Then a line telling you how to read the whole formula out loud. Then a worked example with every arithmetic step written out, small enough to check on your phone. Then a way to tell whether you got it right.
There is a Math Toolkit. It starts at “what does it mean when a letter stands for a number” and builds from there through exponents, , logarithms, square roots, , percentages, graphs, vectors, and the Greek letters this book uses. Every chapter links into it at the exact point a symbol first appears. Read it first if you like, or follow the links when you hit one. It is at The Math Toolkit.
Nothing is called easy. If a step is genuinely hard, this book says so. Week 4 is the hinge of the whole course and most people need two passes at it. That is not a sign you are behind. It is what that week is like.
Where the numbers come from¶
That rule has teeth, and you will watch it bite. Some of the numbers in this book are embarrassing. In Chapter 12 a model scores 5 out of 20 on a statistics quiz, which is 25.0 per cent, which is exactly chance; the honest 95 per cent interval around it runs from 6.0 per cent to 44.0 per cent. In Chapter 13 that same model, on those same twenty questions, scores 25.0, 35.0 or 15.0 per cent depending only on which defensible scoring procedure you use. None of those numbers were tidied. Rounding a result until it looks cleaner than it is would be the same offence as inventing it.
If you find a number in this book that you cannot trace back to a script, that is a bug. Tell your instructor.
What you need¶
A browser. That is the floor. Every figure, every table, and every interactive simulation in this book runs in a browser with nothing installed. The simulations are self-contained: no account, no server, and no network request once the page has loaded.
Optionally, a laptop that can run a 1 GB model. If you want to run the models yourself rather than read our measurements of them, you need roughly a gigabyte of free memory and a machine built in the last few years. The course’s smallest model is 0.988 gigabytes in half precision. It runs without a dedicated graphics card, only more slowly. Slow is fine; this course measures speed rather than demanding it.
There is a no-install path for every lab. Nobody in this course is required to buy hardware. A course whose thesis is about access would be a poor thing if it gated itself behind a graphics card.
How to use this book¶
Read with Python open, or at least with the simulations open:
Start with the opening scene. Every chapter begins with something real, usually something in Kern County, and lands that opening on a number the chapter computes in front of you.
Read intuition, then formula, then Python, in order.
Take the simulations apart. Drag the sliders past where they are comfortable. The temperature simulation in Chapter 5 is more convincing once you push it to 2.0 and watch the model stop committing to anything.
Do the worked example before the practice problems. Every new skill is demonstrated once, start to finish, before you are asked to use it.
Do the “Try it” boxes as you reach them. Each has a complete solution in a dropdown directly below it. Attempt it honestly first.
Use the appendices. A formula summary, a Python quick reference, a dataset index, a cost model, a glossary, and answers to the odd-numbered problems are all in the back.
Follow the Weekly Reading Map. It gives one row per week: what you run, what you learn, and what is due.
Accessibility¶
This book is built to be usable by everyone:
Every figure has meaningful alt text describing what the figure shows, not only that a figure exists.
Colour is never the only signal. Plots use the colourblind-safe Okabe-Ito palette, and every distinction carried by colour is also carried by position, shape, or a printed label.
Tables have proper headers, and text and background colours are chosen for readable contrast.
The layout is responsive, so the book reads cleanly on a phone, and the site has full-text search.
If you use a screen reader or other assistive technology and hit a barrier in this book, that is a bug worth fixing. Tell your instructor so it can be reported to the CSUB Department of Mathematics.
Attribution¶
Part of this course’s lab sequence is adapted from Small_Models_SP26, an open curriculum
from UC Berkeley Data Science Modules, begun by Eric Van Dusen and built by eleven
contributors. It is used under the BSD 3-Clause License, copyright 2026 UC Berkeley Data
Science Modules. That licence requires the copyright notice, the list of conditions, and the
disclaimer to travel with the material, so all three are reproduced in full and unaltered in
THIRD_PARTY_NOTICES.md in this book’s repository. Individual notebooks carry their own
upstream credit where the original supplied one.
Neither UC Berkeley Data Science Modules nor its contributors endorse this course. The adaptations, the errors, and the parts of the course that go past the source are ours.
Licensing, in one sentence¶
The writing is free to reuse and adapt under CC BY-SA 4.0, and the code is MIT.
Welcome to MATH 3219. Open the first chapter, start a model on the machine in front of you, and find out what it cost.