mac-cell-sair

Model overview

This is a single learned recurrent primitive β€” a 2-layer unidirectional GRU cell (~654K parameters) β€” implementing cell(state, m, digit) = (state * R + m * digit) mod p entirely through trained weights, with no hand-coded modulus reduction against the challenge prime anywhere in the inference path. The cell is run over a fixed, hand-designed two-phase schedule (a form of Horner's method): phase 1 streams operand a's base-R digits with m = 1 to compute a mod p; phase 2 resets the explicit state accumulator and streams b's digits with m set to phase 1's final state, producing (a * b) mod p. State and m are kept as explicit base-R digit arrays (not opaque latent vectors) and fed back autoregressively at inference time; the prime p is provided as a bit-encoded conditioning input at every step. Only per-argument base-R/base-2 digit decomposition, embeddings, a GRU, a linear head, and argmax appear anywhere in this repository's inference path.

The model implements the challenge's ModularMultiplicationModel interface and is evaluated with the official modchallenge harness.

Training and provenance

All parameters were trained by the author from random initialization; no external pretrained weights were used at any point. Supervision is per-step: oracle intermediate Horner states are computed offline for training labels only (never on the inference path). Training primes are drawn by replicating the harness's own value-uniform prime sampling within each tier's range.

Scope

Operand encoding is fixed at 64 bits, covering tiers 1–3 of the challenge. Tiers requiring wider operands are out of scope for this submission: their operands are truncated on input, and they score only on trivial edge cases there.

Prior work

  • Marcos Costa Santos Carreira's formulation, posted on the competition's Zulip on 2026-07-15 β€” cell(acc, m, digit) = (acc * R + m * digit) mod p, phase 1 reducing a with m = 1, phase 2 combining b with m = a_red β€” closely matches this submission's architecture. This submission was developed after, and informed by, that public discussion and the organizer clarifications in the same channel; the architectural formulation should not be read as independently conceived.
  • NeuralHorner (Robert Sneiderman): a related, independently developed entry to the same challenge, using a bidirectional bit-serial GRU cell under a fixed Horner-style schedule (confirmed from the referenced commit's model/model.py: nn.GRU(..., num_layers=2, bidirectional=True)). Repository: https://github.com/Robby955/neural-horner, referenced at commit 4997f9a. This submission differs architecturally: unidirectional, digit-serial (base-R, not bit-serial) with an explicit two-phase schedule and an explicit digit-array state fed back autoregressively (this submission keeps the computation-step axis strictly causal because it feeds its own predicted state back at inference).
  • The official dlp_grokking example from the competition organizers' repository: https://github.com/SAIRcompetition/modular-arithmetic-challenge/tree/main/examples/dlp_grokking, referenced at commit 1aa5668. It targets the same task with an unrelated inductive bias: a Transformer encoder maps each residue to an embedding, combines them with an additive discrete-log-style bottleneck (z = e_a + e_b), and a decoder reads off the answer digits β€” a different structural bet (additive, log-space combination) from this submission's explicit digit-recurrent Horner schedule.

No code, weights, or text from any reference above is copied anywhere in this repository (class names, method bodies, and file structure were compared directly; only the harness-mandated interface method names β€” preprocess_a, predict_digits_batch, etc., required of every submission β€” coincide, which is interface conformance, not shared code). The entries above are recorded as academic attribution, not a license obligation.

License

MIT License, Copyright (c) 2026 suii0x. See LICENSE.

Downloads last month

-

Downloads are not tracked for this model. How to track
Inference Providers NEW
This model isn't deployed by any Inference Provider. πŸ™‹ Ask for provider support