etwk commited on
Commit Β·
70d0ebc
1
Parent(s): 86c5a17
Tier 8 saturated at 0.92: highest_tier 7->8, overall 0.769->0.788
Browse filesweights512.pt re-promoted to the 0.92 cell (gradient-accumulation run, eff.
batch ~2300; eps floor 7e-4 -> 1.3e-4, 512-step chain 0.73 -> 0.92). Full
benchmark: highest_tier_above_90 = 8, overall 0.788, tier 8 = 0.92, det=True.
Compliance 0.92@s0 -> 0.04@s0.25, untrained 0.00. README/manifest updated:
saturates tiers 1-8 / up to 2^512.
- README.md +13 -11
- manifest.json +2 -2
- model.py +4 -4
- weights512.pt +2 -2
README.md
CHANGED
|
@@ -16,12 +16,13 @@ A compliant **bit-sequential RNN** that computes `(a Β· b) mod p` for primes `p`
|
|
| 16 |
multiplication tables. Entry for the
|
| 17 |
[Modular Arithmetic Challenge](https://github.com/SAIRcompetition/modular-arithmetic-challenge).
|
| 18 |
|
| 19 |
-
- **Saturates tiers 1β
|
| 20 |
-
- **overall_accuracy 0.
|
| 21 |
- The 128/256/512-bit (tier 6/7/8) cells are **carry-aware TCNs** (weight-shared dilated
|
| 22 |
convolutions over the bit-positions, ~4β6M params each) β a far better inductive bias for long
|
| 23 |
carry chains than the MLP, and the key to the per-step precision a 128/256/512-step chain demands.
|
| 24 |
-
The per-step error floor rises with width, so
|
|
|
|
| 25 |
- Verifiably **generalises to primes never seen in training** (held-out-prime validation
|
| 26 |
accuracy tracks training accuracy β no memorisation gap)
|
| 27 |
|
|
@@ -59,7 +60,7 @@ holds the prime:
|
|
| 59 |
| `weights64.pt` | 64-bit | `< 2βΆβ΄` | 5 | MLP, 4096 / 7, residual | ~236M | tier 5 = 0.98 |
|
| 60 |
| `weights128.pt` | 128-bit | `< 2ΒΉΒ²βΈ` | 6 | **carry-aware TCN**, 256ch / 10 blocks, dilations 1β64 | ~3.9M | **tier 6 = 0.97** |
|
| 61 |
| `weights256.pt` | 256-bit | `< 2Β²β΅βΆ` | 7 | **carry-aware TCN**, 256ch / 12 blocks, dilations 1β128 | ~4.7M | **tier 7 = 0.98** |
|
| 62 |
-
| `weights512.pt` | 512-bit | `< 2β΅ΒΉΒ²` | 8 | **carry-aware TCN**, 256ch / 14 blocks, dilations 1β256 | ~5.5M | tier 8 = 0.
|
| 63 |
|
| 64 |
The 128/256/512-bit cells switch architecture: instead of a full-width MLP each is a **non-causal
|
| 65 |
dilated 1-D convolutional network over the bit-positions** (128, 256, 512 respectively). Carry
|
|
@@ -70,8 +71,9 @@ position-function per bit. This inductive bias drives the per-step error roughly
|
|
| 70 |
same-task MLP β the difference between a 128/256-step chain landing at ~0.26 and at **0.97 / 0.98** β
|
| 71 |
in cells **~60Γ smaller** than the wide MLPs (16β22 MB each vs ~950 MB). The receptive field of each
|
| 72 |
TCN spans its full width in both carry directions, so a carry can propagate across the entire word.
|
| 73 |
-
The per-step error floor *rises* with bit-width, though: the 512-bit cell
|
| 74 |
-
|
|
|
|
| 75 |
|
| 76 |
The 64-bit cell needs **depth and residual connections** the narrower cells do not: a 64-bit
|
| 77 |
modular Horner step hides two long carry chains (the `2t + bitΒ·b` addition and the
|
|
@@ -131,7 +133,7 @@ cell is *at* the floor. The capability therefore resides in the trained paramete
|
|
| 131 |
| tier 5 (64-bit cell) | 0.98 | 0.95 | 0.65 | 0.03 | 0.01 | 0.00 |
|
| 132 |
| tier 6 (128-bit TCN) | 0.97 | 0.96 | 0.98 | 0.19 | 0.02 | 0.00 |
|
| 133 |
| tier 7 (256-bit TCN) | 0.98 | 0.97 | 0.99 | 0.06 | 0.02 | 0.00 |
|
| 134 |
-
| tier 8 (512-bit TCN) | 0.
|
| 135 |
|
| 136 |
Generalisation against memorisation: 10% of primes at each bit-width were held out of
|
| 137 |
training entirely; chain accuracy on them matches the training primes.
|
|
@@ -152,10 +154,10 @@ short run. The 256-bit (tier-7) cell is the same carry-aware TCN scaled to 256 b
|
|
| 152 |
(dilations cycling 1β128), trained identically on true-trajectory single steps over distinct
|
| 153 |
252β256 bit primes; its per-step error is low enough that the 256-step chain holds at **tier 7 =
|
| 154 |
0.98**. The 512-bit (tier-8) cell is again the same TCN (dilations 1β256) trained on distinct
|
| 155 |
-
510β512 bit primes
|
| 156 |
-
**
|
| 157 |
-
|
| 158 |
-
metadata / challenge leaderboard).
|
| 159 |
|
| 160 |
## License
|
| 161 |
|
|
|
|
| 16 |
multiplication tables. Entry for the
|
| 17 |
[Modular Arithmetic Challenge](https://github.com/SAIRcompetition/modular-arithmetic-challenge).
|
| 18 |
|
| 19 |
+
- **Saturates tiers 1β8** (all primes `< 2β΅ΒΉΒ²`): tiers 1β3 = 100%, tier 4 = 99%, tier 5 = 98%, tier 6 = 97%, tier 7 = 98%, **tier 8 = 92%** (512-bit)
|
| 20 |
+
- **overall_accuracy 0.788**, `highest_tier_above_90 = 8`
|
| 21 |
- The 128/256/512-bit (tier 6/7/8) cells are **carry-aware TCNs** (weight-shared dilated
|
| 22 |
convolutions over the bit-positions, ~4β6M params each) β a far better inductive bias for long
|
| 23 |
carry chains than the MLP, and the key to the per-step precision a 128/256/512-step chain demands.
|
| 24 |
+
The per-step error floor rises with width, so the 512-bit cell additionally uses **gradient
|
| 25 |
+
accumulation** (a large effective batch lowers the per-step noise floor) to reach tier 8 = 0.92
|
| 26 |
- Verifiably **generalises to primes never seen in training** (held-out-prime validation
|
| 27 |
accuracy tracks training accuracy β no memorisation gap)
|
| 28 |
|
|
|
|
| 60 |
| `weights64.pt` | 64-bit | `< 2βΆβ΄` | 5 | MLP, 4096 / 7, residual | ~236M | tier 5 = 0.98 |
|
| 61 |
| `weights128.pt` | 128-bit | `< 2ΒΉΒ²βΈ` | 6 | **carry-aware TCN**, 256ch / 10 blocks, dilations 1β64 | ~3.9M | **tier 6 = 0.97** |
|
| 62 |
| `weights256.pt` | 256-bit | `< 2Β²β΅βΆ` | 7 | **carry-aware TCN**, 256ch / 12 blocks, dilations 1β128 | ~4.7M | **tier 7 = 0.98** |
|
| 63 |
+
| `weights512.pt` | 512-bit | `< 2β΅ΒΉΒ²` | 8 | **carry-aware TCN**, 256ch / 14 blocks, dilations 1β256 | ~5.5M | **tier 8 = 0.92** |
|
| 64 |
|
| 65 |
The 128/256/512-bit cells switch architecture: instead of a full-width MLP each is a **non-causal
|
| 66 |
dilated 1-D convolutional network over the bit-positions** (128, 256, 512 respectively). Carry
|
|
|
|
| 71 |
same-task MLP β the difference between a 128/256-step chain landing at ~0.26 and at **0.97 / 0.98** β
|
| 72 |
in cells **~60Γ smaller** than the wide MLPs (16β22 MB each vs ~950 MB). The receptive field of each
|
| 73 |
TCN spans its full width in both carry directions, so a carry can propagate across the entire word.
|
| 74 |
+
The per-step error floor *rises* with bit-width, though: the 512-bit cell needed **gradient accumulation**
|
| 75 |
+
(a large effective batch to lower the per-step noise floor) to push its 512-step chain over the line to
|
| 76 |
+
**tier 8 = 0.92**.
|
| 77 |
|
| 78 |
The 64-bit cell needs **depth and residual connections** the narrower cells do not: a 64-bit
|
| 79 |
modular Horner step hides two long carry chains (the `2t + bitΒ·b` addition and the
|
|
|
|
| 133 |
| tier 5 (64-bit cell) | 0.98 | 0.95 | 0.65 | 0.03 | 0.01 | 0.00 |
|
| 134 |
| tier 6 (128-bit TCN) | 0.97 | 0.96 | 0.98 | 0.19 | 0.02 | 0.00 |
|
| 135 |
| tier 7 (256-bit TCN) | 0.98 | 0.97 | 0.99 | 0.06 | 0.02 | 0.00 |
|
| 136 |
+
| tier 8 (512-bit TCN) | 0.92 | 0.91 | 0.77 | 0.04 | 0.03 | 0.00 |
|
| 137 |
|
| 138 |
Generalisation against memorisation: 10% of primes at each bit-width were held out of
|
| 139 |
training entirely; chain accuracy on them matches the training primes.
|
|
|
|
| 154 |
(dilations cycling 1β128), trained identically on true-trajectory single steps over distinct
|
| 155 |
252β256 bit primes; its per-step error is low enough that the 256-step chain holds at **tier 7 =
|
| 156 |
0.98**. The 512-bit (tier-8) cell is again the same TCN (dilations 1β256) trained on distinct
|
| 157 |
+
510β512 bit primes; because the per-step error floor rises with width, it additionally uses
|
| 158 |
+
**gradient accumulation** (a large effective batch lowers the gradient-noise floor on the per-step
|
| 159 |
+
error without extra memory), which drives the 512-step chain to **tier 8 = 0.92**. Training code and
|
| 160 |
+
the full write-up live in the solutions repo (link in the model card metadata / challenge leaderboard).
|
| 161 |
|
| 162 |
## License
|
| 163 |
|
manifest.json
CHANGED
|
@@ -2,6 +2,6 @@
|
|
| 2 |
"entry_class": "model.HornerRNN",
|
| 3 |
"output_base": 2,
|
| 4 |
"framework": "pytorch",
|
| 5 |
-
"model_description": "Bit-sequential RNN (~415M params across six cells) for primes up to 2^512. Reads the bits of a mod p MSB-first, one per step, conditioned on (b mod p, p) in binary; the hidden state is a quantized bit vector (hard binary bottleneck) and the transition function must learn the Horner step (t, bit, b, p) -> (2t + bit*b) mod p to make the recurrence end on the right answer. Six cells are shipped and routed by prime size: a 16-bit cell (MLP, width 4096 depth 4, ~50M params) for p < 2^16 covering tiers 1-3, a 32-bit cell (MLP, width 6144 depth 4, ~114M params) for p < 2^32 covering tier 4, a 64-bit cell (MLP, width 4096 depth 7 with pre-norm residual blocks, ~236M params) for p < 2^64 covering tier 5, a 128-bit cell for p < 2^128 covering tier 6 that is a CARRY-AWARE TCN: a non-causal dilated 1D-convolutional network over the 128 bit-positions (10 residual blocks, 256 channels, dilations cycling 1..64 so the receptive field spans all 128 bits, ~3.9M params), a 256-bit cell for p < 2^256 covering tier 7 that uses the SAME carry-aware TCN architecture scaled to 256 bit-positions (12 residual blocks, 256 channels, dilations cycling 1..128, ~4.7M params) reaching tier 7 = 0.98, and a 512-bit cell for p < 2^512 that is the same carry-aware TCN scaled to 512 bit-positions (14 residual blocks, 256 channels, dilations cycling 1..256, ~5.5M params) reaching tier 8 = 0.
|
| 6 |
-
"training_description": "Each transition cell trained from random init on (t, bit, b, p) -> (2t + bit*b) mod p single-step examples over its prime range (16-bit: all primes < 2^16; 32-bit and 64-bit: random primes sampled uniform-by-value in [2^16, 2^32) and [2^33, 2^64) to match the test generator's randrange+nextprime distribution), with half of each batch mined near the comparison boundary (2t + bit*b within +/-2 of a multiple of p) where errors concentrate. BCE per state bit, AdamW + cosine decay + gradient clipping + LR warmup, EMA weights checkpointed by full-chain validation accuracy on a held-out 10% of primes never seen in training β val accuracy tracks train accuracy, i.e. the cells generalise across primes rather than memorising them. The 64-bit cell additionally receives a second fine-tuning phase on single steps drawn from the TRUE Horner trajectory (each example is a (t, bit, b, p) -> (2t + bit*b) mod p step where t is an actual chain intermediate (a_{>=i}*b) mod p, not a uniform sample), which matches the training distribution to the states the chain visits at inference and lifts tier 5 from 0.74 to 0.98; still ordinary supervised BCE on the same single-step target, no backprop through the recurrence. The 128-bit (tier-6) cell is the carry-aware TCN, trained the same way β single-step BCE on TRUE Horner-trajectory states (t, bit, b, p) -> (2t + bit*b) mod p β from random init over a high-diversity pool of thousands of distinct 124-128 bit primes (so it generalises across primes rather than memorising the conditional subtraction for a few). Its weight-shared dilated-convolution inductive bias reaches a per-step error roughly 15x lower than the same-task MLP cell, giving 0.97 full-chain accuracy on held-out 124-128 bit primes; same supervised single-step objective, no backprop through the recurrence, AdamW + cosine decay + grad clip + EMA checkpointed by held-out full-chain accuracy. The 256-bit (tier-7) cell is the same carry-aware TCN scaled to 256 bit-positions (dilations cycling 1..128), trained identically β single-step BCE on TRUE Horner-trajectory states over a high-diversity pool of distinct 252-256 bit primes β reaching a per-step error low enough that the 256-step chain holds at 0.98 full-chain accuracy on held-out 252-256 bit primes. The 512-bit (tier-8) cell is the same carry-aware TCN scaled to 512 bit-positions (dilations cycling 1..256), trained
|
| 7 |
}
|
|
|
|
| 2 |
"entry_class": "model.HornerRNN",
|
| 3 |
"output_base": 2,
|
| 4 |
"framework": "pytorch",
|
| 5 |
+
"model_description": "Bit-sequential RNN (~415M params across six cells) for primes up to 2^512. Reads the bits of a mod p MSB-first, one per step, conditioned on (b mod p, p) in binary; the hidden state is a quantized bit vector (hard binary bottleneck) and the transition function must learn the Horner step (t, bit, b, p) -> (2t + bit*b) mod p to make the recurrence end on the right answer. Six cells are shipped and routed by prime size: a 16-bit cell (MLP, width 4096 depth 4, ~50M params) for p < 2^16 covering tiers 1-3, a 32-bit cell (MLP, width 6144 depth 4, ~114M params) for p < 2^32 covering tier 4, a 64-bit cell (MLP, width 4096 depth 7 with pre-norm residual blocks, ~236M params) for p < 2^64 covering tier 5, a 128-bit cell for p < 2^128 covering tier 6 that is a CARRY-AWARE TCN: a non-causal dilated 1D-convolutional network over the 128 bit-positions (10 residual blocks, 256 channels, dilations cycling 1..64 so the receptive field spans all 128 bits, ~3.9M params), a 256-bit cell for p < 2^256 covering tier 7 that uses the SAME carry-aware TCN architecture scaled to 256 bit-positions (12 residual blocks, 256 channels, dilations cycling 1..128, ~4.7M params) reaching tier 7 = 0.98, and a 512-bit cell for p < 2^512 covering tier 8 that is the same carry-aware TCN scaled to 512 bit-positions (14 residual blocks, 256 channels, dilations cycling 1..256, ~5.5M params) reaching tier 8 = 0.92. The per-step error floor rises with bit-width, so this cell was trained with gradient accumulation (a large effective batch lowers the per-step error noise floor) to recover the precision a 512-step chain needs to clear 0.90. The convolution is weight-shared across bit positions, so it learns ONE carry/borrow rule applied everywhere (non-causally, so the addition carry can flow LSB->MSB and the mod-p compare/borrow MSB->LSB) instead of a full-width MLP learning a separate position-function per bit; this inductive bias drives the per-step error far below what an MLP cell reaches and is what makes the 128/256/512-bit chains (which compound the per-step error over 128/256/512 steps) accurate. Final state bits are emitted MSB-first as the base-2 answer. For p >= 2^512 emits the honest [0] fallback without invoking the network.",
|
| 6 |
+
"training_description": "Each transition cell trained from random init on (t, bit, b, p) -> (2t + bit*b) mod p single-step examples over its prime range (16-bit: all primes < 2^16; 32-bit and 64-bit: random primes sampled uniform-by-value in [2^16, 2^32) and [2^33, 2^64) to match the test generator's randrange+nextprime distribution), with half of each batch mined near the comparison boundary (2t + bit*b within +/-2 of a multiple of p) where errors concentrate. BCE per state bit, AdamW + cosine decay + gradient clipping + LR warmup, EMA weights checkpointed by full-chain validation accuracy on a held-out 10% of primes never seen in training β val accuracy tracks train accuracy, i.e. the cells generalise across primes rather than memorising them. The 64-bit cell additionally receives a second fine-tuning phase on single steps drawn from the TRUE Horner trajectory (each example is a (t, bit, b, p) -> (2t + bit*b) mod p step where t is an actual chain intermediate (a_{>=i}*b) mod p, not a uniform sample), which matches the training distribution to the states the chain visits at inference and lifts tier 5 from 0.74 to 0.98; still ordinary supervised BCE on the same single-step target, no backprop through the recurrence. The 128-bit (tier-6) cell is the carry-aware TCN, trained the same way β single-step BCE on TRUE Horner-trajectory states (t, bit, b, p) -> (2t + bit*b) mod p β from random init over a high-diversity pool of thousands of distinct 124-128 bit primes (so it generalises across primes rather than memorising the conditional subtraction for a few). Its weight-shared dilated-convolution inductive bias reaches a per-step error roughly 15x lower than the same-task MLP cell, giving 0.97 full-chain accuracy on held-out 124-128 bit primes; same supervised single-step objective, no backprop through the recurrence, AdamW + cosine decay + grad clip + EMA checkpointed by held-out full-chain accuracy. The 256-bit (tier-7) cell is the same carry-aware TCN scaled to 256 bit-positions (dilations cycling 1..128), trained identically β single-step BCE on TRUE Horner-trajectory states over a high-diversity pool of distinct 252-256 bit primes β reaching a per-step error low enough that the 256-step chain holds at 0.98 full-chain accuracy on held-out 252-256 bit primes. The 512-bit (tier-8) cell is the same carry-aware TCN scaled to 512 bit-positions (dilations cycling 1..256), trained on true-trajectory single steps over distinct 510-512 bit primes; the per-step error floor rises with width, so this cell additionally uses gradient accumulation (--accum: a larger effective batch lowers the gradient-noise floor on per-step error) to drive the 512-step chain to tier 8 = 0.92. Weight-perturbation compliance (exploration/compliance_perturb.py): each cell's accuracy at sigma=0 collapses toward the floor as the weights are perturbed and an untrained re-init scores 0.00 β e.g. tier 6 0.97 -> 0.19 (sigma=0.25), tier 7 0.98 -> 0.06 (sigma=0.25), tier 8 0.92 -> 0.04 (sigma=0.25), untrained 0.00 for all β so the arithmetic resides in the trained parameters. Training scripts: train.py (16-bit), exploration/train_horner32.py (32-bit), exploration/train_horner64.py (64-bit phase 1, --residual) then exploration/train_horner64_traj.py (64-bit phase 2, trajectory), exploration/train_horner128_bigru.py --arch tcn (128-bit carry-aware TCN), exploration/train_horner_tcn.py --bits 256 / --bits 512 --accum 2 (256- and 512-bit carry-aware TCN)."
|
| 7 |
}
|
model.py
CHANGED
|
@@ -31,10 +31,10 @@ The two-operand reductions ``a mod p`` / ``b mod p`` in ``predict_digits`` are
|
|
| 31 |
the same legal input normalisation every other reference model uses.
|
| 32 |
|
| 33 |
The model ships one cell per bit-width (16 -> tiers 1-3, 32 -> tier 4, 64 ->
|
| 34 |
-
tier 5, 128 -> tier 6, 256 -> tier 7, and 512 -> tier 8
|
| 35 |
-
|
| 36 |
-
|
| 37 |
-
|
| 38 |
"""
|
| 39 |
|
| 40 |
from __future__ import annotations
|
|
|
|
| 31 |
the same legal input normalisation every other reference model uses.
|
| 32 |
|
| 33 |
The model ships one cell per bit-width (16 -> tiers 1-3, 32 -> tier 4, 64 ->
|
| 34 |
+
tier 5, 128 -> tier 6, 256 -> tier 7, and 512 -> tier 8 when present) and routes
|
| 35 |
+
each problem to the narrowest cell whose state holds the prime. For primes wider
|
| 36 |
+
than the widest trained cell it emits the honest ``[0]`` fallback without
|
| 37 |
+
invoking the network.
|
| 38 |
"""
|
| 39 |
|
| 40 |
from __future__ import annotations
|
weights512.pt
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
-
size
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:7127108f38773e73b201d73f6834fef9cdb41610fd7ea776080670f94a1c7b7a
|
| 3 |
+
size 22114947
|