Sam Newby
← Learning ML

language models

I've trained my first Transformer

Back in October, I set myself the goal of training a 30-million-parameter TypeScript language model before my 30th birthday. Today I trained my first decoder-only Transformer. It’s considerably smaller than the model I eventually want to build, with 15,296 parameters and a context window of just 16 bytes.

ROMAN Tiny is built using PyTorch and learns to predict the next byte of TypeScript source code. After 5,000 training steps, its validation loss fell from 5.63 to 2.74. The generated output is still largely incoherent, with the occasional recognisable fragment of code, so there’s plenty of work ahead before it can produce anything useful.

Only a few weeks ago I was working through backpropagation by hand, and now I’ve implemented and trained my own Transformer architecture. Being able to understand how the individual components work together has made reaching this milestone particularly rewarding. I’m looking forward to seeing how far I can take ROMAN from here.