A transformer trained from scratch to do 3-digit addition.
Generates 50k addition problems (e.g. 123 + 456 = 579), tokenizes them as sequences, and trains a small transformer encoder to predict the answer token by token.
python main.pyType any 3 digit addition problem and it'll answer. quit to exit.
python main.py --retrain- PyTorch
- Custom tokenizer + dataset
- 3-layer transformer encoder, 4 heads, 64 embed dim