notes
← back to notes

scaling sparse ngram embedding tables needs new infra

Hyperstition came out with a nanogpt speedrun world record this week that was pretty historic - you can now train nanogpt in 39.9 seconds. very cool!

I wanted to unpack the ngram optimizations made here.

What is n-gram

What is a Bigram & Trigram table?

I love machine learning

I love machine learning
I love
"I love"
love machine
"love machine"
machine learning
"machine learning"
Bigram embedding look up table
Bigram pair Embedding vector
("I", "love") [0.4, -0.3, ...]
("love", "machine") [0.9, 0.1, ...]
("machine", "learning") [-0.2, 0.8, ...]

What was wrong with the original bigram table:

Hashing

Adding a Trigram table

What this means

Do we need new infra??