TFMLab
0:00 / 0:00

Training a TFM, end to end #Training#Validation#Fine-tuning

5 Oct 2026Intermediate0:54Transaction foundation models from scratch · Ep 10

Pretrain, fine-tune in two phases, and choose the checkpoint on out-of-time data.

The timeline shows the usual recipe: a long self-supervised pretraining run, then a short phase training only the head on a frozen encoder, then a gentle full fine-tune at a much smaller learning rate. The checkpoint is chosen on a later time period than training, which is what production will look like.

Transcript

Training runs along a timeline, counted in relative months rather than calendar dates.

First, pretraining reads every event and predicts the next one, with no labels. The best checkpoint is the one with the lowest validation loss, not the last step.

Then fine-tuning on labelled data. The head trains first on a frozen encoder; once the encoder is unfrozen, the loss drops again.

Months eleven to fourteen are held out. Training never sees them, which makes them the honest test.

The model is scored there. These numbers are just an example: in-sample and out-of-time should be nearly equal. A large drop means it learned the months, not the behaviour.

The fine-tuning sample was enriched, so the loss is re-weighted and the score recalibrated. Pretrain broadly, fine-tune carefully, and judge on months the model never saw.