Skip to content

Instantly share code, notes, and snippets.

@JagNL
JagNL / tinyadder_1p.py
Created February 27, 2026 04:59
TinyAdder-1: 1-parameter hand-coded transformer for 10-digit addition (AdderBoard submission)
#!/usr/bin/env python3
"""
TinyAdder-1: 1-parameter hand-coded transformer for 10-digit addition.
AdderBoard submission — hand-coded weights (constructive proof).
Architecture: 2L decoder, d=5→16, 5h+1h, ALiBi slope=log(BASE).
The single parameter is BASE (=10), the number base.
All weights are deterministically derived from BASE:
K_WEIGHT = BASE × (BASE² − 4) = 960
@JagNL
JagNL / tinyadder_5p.py
Created February 27, 2026 04:33
TinyAdder-5: 5-parameter hand-coded transformer for 10-digit addition (AdderBoard submission)
#!/usr/bin/env python3
"""
TinyAdder-5: 5-parameter hand-coded transformer for 10-digit addition.
AdderBoard submission — hand-coded weights (constructive proof).
Architecture: 2L decoder, d=5→16, 5h+1h, ALiBi slope=log(10).
Unique parameters: BASE=10, K_WEIGHT=960, K_BIAS=-1000, V_W1=0.1, DIGIT_OFFSET=0.5
All other values (embedding, projections, FFN weights) are derived from these 5.
"""