modularai / manifest.json
ryanpanda007's picture
Neural bignum ALU submission
3ff7219 verified
Raw
History Blame Contribute Delete
2.44 kB
{
"entry_class": "model.NeuralBignumModel",
"output_base": 256,
"framework": "pytorch",
"model_description": "Router over two trained specialists selected by the bit-length of p. (1) Tiers 1-2 (p < 256): a ~10.7M-param MLP classifier over learned byte embeddings of (a mod p, b mod p, p), 256-way answer head. (2) Tiers 3-10 (p up to 2048 bits): a 'neural bignum' pipeline composing four small trained cells - mul8: (byte,byte)->(hi,lo); add2: (byte,byte,carry)->(byte,carry); subb: (byte,byte,borrow)->(byte,borrow); sel: (overflow,borrow)->select-bit - each an embedding+MLP applied across byte limbs by a fixed loop. Operands enter as the residues a mod p, b mod p (two-operand reductions inside predict_digits, as in the reference models), decomposed into byte limbs; the product a*b is formed by the mul8+add2 cells and reduced mod p by Barrett reduction, which uses a single p-derived constant mu = floor(256^(2k)/p) (k = byte-limb count of p) supplied per-argument by preprocess_p. No operand is pre-scaled and no modular product is formed outside the trained cells; every arithmetic value at inference is a cell output, and the surrounding code only moves data (slice/pad/concat/select) and decodes. Output: base-256 digits, MSB-first. Problems outside range (p > 2048 bits, Mersenne diagnostics) fall back to [0].",
"training_description": "All parameters trained from random initialization with AdamW; no hand-set weights anywhere. Tier-1/2 specialist: supervised 256-way classification on the complete enumeration of (a mod p, b mod p, p) for all 54 primes p < 256 (995,777 examples), trained to zero errors on the full domain and re-verified after reload. Arithmetic cells (mul8, add2, subb, sel): supervised classification on the complete enumeration of each cell's finite input domain (65,536 pairs for mul8; 131,072 triples for add2 and subb; 4 for sel), each trained to exhaustively-verified 100% accuracy over its whole domain at training time. The composition (Barrett reduction dataflow) is fixed architecture; the arithmetic is entirely in the trained weights - randomizing any cell collapses end-to-end accuracy (mul8/add2 to 0%; subb/sel gate the conditional subtractions), and randomizing all weights yields 0%. At load time each cell's fused fast-path is re-verified for exact equivalence to the unfused trained cell over its full domain. Training code, logs, and seeds retained and available on request."
}