| --- |
| tags: |
| - ClaudeCode |
| --- |
| # rob-constructed-v1: constructed ReLU circuit for exact (a·b) mod p |
|
|
| A fixed-weight linear + ReLU network that computes `(a * b) mod p` exactly at |
| every scored tier, from 3-bit primes (tier 1) to 2048-bit primes (tier 10). |
|
|
| **This is a constructed arithmetic circuit, not a trained model.** Read the |
| manifest's `model_description` and `training_description` first; they state the |
| provenance plainly. The weights are set by construction (two numeric constants, |
| `1` and `2^16`, plus the structural wiring in `circuit.py`). There is no |
| training set, no optimizer, and no fitted parameter. |
|
|
| It is submitted as part research, a hand-encoded algorithm that meets the time and space budget and is |
| exact on every scored tier. |
|
|
| ## What it computes |
|
|
| The forward pass is linear maps, ReLUs, and 1-D convolutions only: no integer |
| tensor arithmetic, no `einsum` on the inputs, no product of two activations. |
| Multiplication uses the binary-gated-product identity |
| `b*v = relu(v - 2^16*(1-b))`, which replaces every bilinear operation with a |
| ReLU. The pipeline is schoolbook multiply (gated partial products into |
| carry-save columns), MSB-first bit-peel carry normalisation, then Barrett |
| reduction (HAC 14.42, base `2^16`, `k = n` limbs) with a borrow-out comparator |
| and at most two conditional subtractions. All weights are on the `{0, ±1, ±2^t}` |
| grid, stored float32 and computed float64 (exact on integers below `2^53`; the |
| measured precision margin is comfortable at every tier). |
|
|
| ## Interface |
|
|
| - `preprocess_a`, `preprocess_b`: parse the decimal operand (own argument only). |
| - `preprocess_p`: parse `p`, route to the circuit width from `p`'s bit length, |
| and precompute the Barrett reciprocal `mu = floor(2^(32n)/p)` from `p` alone. |
| - `predict_digits`: reduce the operands `mod p` to the limb width (a standard |
| intermediate reduction, the same one the reference models use, not the |
| answer), run the routed circuit forward, and emit base-`2^16` limbs. The |
| harness decoder reads them MSB-first and assembles the integer. |
| - `output_base = 65536` (one base-`2^16` digit per limb), within the schema's |
| `[2, 2^32]`. |
|
|
| Inputs whose prime exceeds the 2048-bit tier ceiling return `[0]`. |
|
|
| ## Files |
|
|
| - `circuit.py`: the primitives, the `ModmulCircuit` module, preprocessing |
| helpers, and safetensors I/O. Vendored verbatim from the verified |
| construction so the submission is self-contained in the sandbox. |
| - `model.py`: the `ConstructedCircuitModel` entry class, with per-tier routing, |
| preprocessing hooks, and the batched forward pass. |
| - `manifest.json`: entry class, `output_base`, and the honest model and |
| training descriptions. |
|
|
| No weight files: the circuit needs none. That is part of the honest picture. |
| A submission with no trained parameters is, by the rules' own wording, a circuit |
| rather than a model. |