Lesson 4: Fine-tuning DistilBERT to route the inbox
57 min read·14 Oct 2026
Module 7 · Lesson 4 · About 60 minutes · Needs: basic Python; Module 5 Lesson 1 (macro F1 and report()); Lesson 3 of this module (tokenisers and task heads) helps. A Colab T4 is recommended; the CPU path finishes in under a minute on the course's test machineThe situation
It is Monday 19 October 2026, project week 7. Rosa has Module 5's number: the TF-IDF router scores macro F1 0.562 on HARD_TEST, the 80 hand-written messages. "Everyone says transformers read like people do. Does one beat our model, on our messages?"
Ines brings the message the router keeps getting wrong, HT38: "cheers for sorting the refund so quick, really appreciate it". It is praise. TF-IDF sees "refund" and sends it to returns_refund. This lesson fine-tunes DistilBERT on Tidewell's messages and scores it the same way (simulated data throughout).