
Harvard NLP's line-by-line PyTorch implementation of the original Transformer paper.
“Puts the paper's text next to working code for every component (attention, positional encoding, encoder, decoder, training), so you see exactly how a Transformer is built.”
The best way to see a Transformer built line by line.
Every component implemented
Clear once you know PyTorch
From Harvard NLP
Runnable code
The original architecture
Updated 2022; architecture unchanged
Follows the paper
Free
Classic resource
Reviewed by the Hive editors on 3 Dec 2026 from 1 page read. High confidence.
Nobody has tagged this on X yet. Reply to a post about it and tag @resourcehivebot to be the first.
Picked by the Hive editors · Report a problem