# Training my first model — source, logs, and checkpoints

A snapshot of the `imdb` project folder, taken 2026-11-08. Local paths are replaced with `~`. Nothing else was changed for the website.

Live demo: https://huggingface.co/spaces/mthynk/imdb-movie-review-sorter
Published model: https://huggingface.co/mthynk/imdb-movie-review-sorter

## Read this first

`JOURNEY.md` is the full account: the five failed runs, what broke, and what each fix was. `RUN_RESULT.txt` is the output of the one successful run, pasted exactly as Kaggle printed it.

## What the post claims, and where to check it

1. **22,500 training reviews, 2,500 check reviews, 24,877 exam reviews, 123 duplicates removed.**
   Download the public ACL IMDb set, extract it so the folder is `aclImdb/train/pos`, `aclImdb/test/neg`, and so on, then run:

   ```sh
   python3 make_splits.py
   ```

   Expected: `learn.jsonl 22500`, `check.jsonl 2500`, `test_inputs.jsonl 24877`, `test_answers.tsv 24877`, `dropped from exam 123`. The seed is fixed at 42, so the split is the same every time.

2. **The split files are the ones used.**
   `splits.sha256` lists the SHA-256 of each file the script produced. After rebuilding, copy it into the new `splits/` folder and compare:

   ```sh
   shasum -a 256 -c splits.sha256
   ```

   I rebuilt from the public archive while writing this page: all four hashes matched.

3. **50.5% before training, 91.3% after.**
   `RUN_RESULT.txt` holds both numbers and the per-class counts: 11,520 of 12,472 positive reviews and 11,185 of 12,405 negative reviews correct.

4. **The check loss got worse after the first pass while training loss kept falling.**
   `kaggle-output/checkpoints/checkpoint-1408/trainer_state.json` is the trainer's own record. Search for `eval_accuracy`: 0.9088 after pass 1, 0.91 after pass 2. `eval_loss` rises from 0.4469 to 0.4675 while training loss keeps falling. The published model is this earlier run's pass-2 checkpoint, which is why the model card says 91.0%, not 91.3%.

5. **The training code.**
   `kaggle_one_cell_fixed.py` is the exact script. It needs a GPU; on a free Kaggle T4 the run took about 30 minutes.

## What is deliberately not included

- The 64 MB of split files. They rebuild exactly from public data with step 1, and the hashes above let you confirm it.
- The 268 MB model. It is public on Hugging Face, linked above.
- The browser build (ONNX, 8-bit, 67 MB). The Space files are in `space/`.

## What this cannot prove

- One run, one dataset, one model. A second run with a different seed would be a stronger result.
- The 90.5% browser score came from a 200-review sample tested in a throwaway script that was not kept. Only the 91.0% checkpoint score is backed by a file here.
- `RUN_RESULT.txt` is a pasted console record, not a signed log. The saved trainer state and split hashes are the independent parts.
