Models, From the File Up

What a model is on disk, how to change one, and how to make one, safely.

After this course: You can read a model file and its licence, work out whether it fits your hardware, fine-tune a small model on your own data with LoRA, train a tiny one from nothing, and tell when it has learned rather than memorised.

10 lessons, 118 minutes of reading. $69, yours for good.

  1. A model is a file of numbers, and some files can run code (free): Someone downloads a model, it loads, it answers. To them a model is a name on a website and a command that works. Know what you are loading before you load it. Prefer safetensors, which holds only numbers and a small header, and treat any pickle (.pt, .pth, .bin, .ckpt) from a stranger as a program you are about to run.
  2. Parameters times bytes: the sum that decides what fits: A 3.8-billion-parameter model is chosen for fine-tuning on an 8 GB card because it is small for a modern model. The run dies with "out of memory" before the first training step. Do the arithmetic before you download: parameters × bytes per parameter is the floor, and training needs a good deal more on top. 16-bit is 2 bytes a parameter, 8-bit is 1, 4-bit is half a byte.
  3. Quantization: fewer bits, a smaller model, a measured cost: A 4-bit model answers almost as well as the full one in a quick test, so someone quantizes everything to the smallest size they can find and ships it. Quantize to fit, then measure on your own task. Pick the largest precision that fits your hardware with headroom, and compare it against the full model on questions you already know the answers to.
  4. Your graphics card decides more than the model card does: A training recipe from a popular guide uses bfloat16 and a fast fine-tuning library. On an older card the run is slow or misbehaves, and after an innocent package install the GPU stops working with PyTorch at all. Read your card's generation first, and pin your GPU libraries. A recipe is written for the author's hardware; check every setting it chose against yours, and never let an unrelated install change the version of PyTorch underneath you.
  5. The code is open; the weights may not be: A project's code is MIT-licensed, so a team builds a paid product on the model it ships. Months later someone reads the weights' own licence. Read three licences, not one: the code's, the weights', and the training data's. "Open weights" is not "open source"; some open licences come with use restrictions you are bound to pass on.
  6. Your own data, cleaned before it teaches anything: A team exports every log line and chat they have, formats it as question-and-answer pairs and starts a fine-tune that night. Harden the data before training, and report what you removed. Redact secrets, drop what failed, remove duplicates, set length limits, and keep a count of every row dropped and why.
  7. LoRA: teaching a model something new without rewriting it: Fine-tuning sounds like a data-centre job: change billions of numbers, need many GPUs, wait days. Freeze the base, train a small adapter, keep the two separate. The adapter is small, cheap to train, easy to throw away, and can be switched on and off over the same base model.
  8. The bug that taught the model to repeat the question: A fine-tune finishes with a falling loss curve. The model's answers are a little worse than expected and sometimes begin by echoing the instruction back. Train only on what you want the model to produce. Mask everything before the answer (set those labels to -100) so the loss counts the response alone.
  9. Train one from nothing, and watch it start to memorise: A tiny model trained on one document produces text that looks exactly like the document. It seems to have learned the writing perfectly. Always hold some data back and watch both curves. When training loss keeps falling and validation loss turns upward, the model has stopped learning the pattern and started storing the examples. Stop at the bottom of the validation curve.
  10. Shipping a model: evaluated, documented, and still safe: A fine-tuned model passes a few spot checks and goes live under the base model's name, with no record of what was changed. Ship a model the way you ship code: a version, a checksum, a card, a before/after evaluation including safety prompts, and the licence you give it. If you cannot show the evaluation, you have not finished.

Every course