Join the conversation

Join the community of Machine Learners and AI enthusiasts.

Sign Up
Saccadic-AI 
posted an update 4 days ago
Post
4,182
One neural network. Five mathematical operations. Different learning times.



We trained a small mixture-of-experts transformer on addition, subtraction, multiplication, division, and exponentiation modulo 113.

The operations didn’t generalize together. Multiplication and division reached 90% held-out accuracy first, followed by exponentiation, subtraction, and finally addition.

Multiplication before addition—the reverse of what we expect from a schoolchild.

The accuracy chart in the linked article shows why a single overall accuracy number can hide an interesting learning story.

Measured with IRIS from Saccadic LLC. More figures and analysis: https://huggingface.co/blog/Saccadic-AI/accuracy-plateaued-the-model-kept-changing

Have you observed a similar ordering in multi-task grokking experiments?

The end state reads like the algebra, not the curriculum.

Mod 113, add and sub live in one group: Z_113, and sub is add with an inverse.
Mul and div live in another: the 112 nonzero residues form a cyclic group, so they are addition after a discrete log.
Exp is a^b = g^(b·log a): a discrete log, then a product mod 112. Neither group alone covers it.

Your final readings split the same way.
Pathways: add 97, sub 96 vs mul 242, div 229, exp 214.
Loss: add 3.7, sub 3.8 vs mul 5.0, div 5.4, exp 8.4.

Two things IRIS could settle directly:

  1. Do add and sub end up routed through the same experts, and mul and div through another set? If routing follows the group, that is a mechanism, not just a correlation.
  2. What is the dashed loss measured on? At ~99% held-out accuracy, cross-entropy on the answer token alone should sit well under ln 113 ≈ 4.73 nats, and exp ends at 8.4. Is it summed over the whole probe text, operands included?
·

Thank you for your thoughtful comment. Connecting the endpoint split to the algebraic families is a good way to frame it, and your question about the loss is an important distinction. You’re asking if those families share experts, and if the dashed losses are comparable with the reported answer accuracy. I hope I understand correctly.

First, there is direct support for the split in this same model. IRIS’s Expert–Domain Affinity figure at step 120,000 shows it most clearly in layer 2—the third layer, numbered from zero: addition and subtraction favor expert 1, while multiplication, division, and exponentiation favor expert 0. These bars pool all recorded probe-token positions.

fig7.6

I am not sure if my figure 7.6 will go above this or below - but in that figure you can see the domains per expert. In the 7.6 chart, orange=addition, dark blue=subtraction, light blue = division, gold=multiplication, and exponentiation = green. Each operations routing fraction is normalized per layer.

The trainer’s separate saved routing audit isolates the position that predicts the answer. Across 1,024 held-out examples per operation, layer 2 sends every addition/subtraction example to expert 1 and every multiplication/division/exponentiation example to expert 0.

The saved trainer-side knockout tests strengthen that observation: disabling expert 1 in layer 2 drops addition/subtraction accuracy to 2.1% and 1.6%, while the other operations stay at baseline. Disabling expert 0 drops multiplication/division/exponentiation to 6.9%, 7.2%, and 24.0%, while addition/subtraction stay at baseline. That supports functional specialization by family. Establishing that the model actually implements a discrete-log algorithm would require further circuit analysis.

Regarding your question on the dashed loss, you are correct that it is a scoring-scope issue. The dashed curve is mean next-token cross-entropy over the whole probe’s scored positions, not answer-only loss and not a sum. For [a, op, b, =, answer], it scores predictions of op, b, =, and the answer. The training objective supervises the answer position only, so the whole-probe metric includes positions the model was not trained to predict.

For comparison, the separately sampled answer-only validation cross-entropy at the final capture is about 0.036 nats overall. That is a different sample and an aggregate across operations, but it makes the distinction clear. We should have made those different scoring scopes explicit in the caption.

Separately, we checked saved follow-up runs with a second seed and weight-decay variants. The second seed also separates addition/subtraction from multiplication/division/exponentiation at the final layer, using different experts. At lower weight decay, exponentiation uses its own layer-2 expert. The zero-decay arm did not fully generalize within 120,000 steps. So there is recurring family organization, while its location and exact wiring vary; we would not claim one fixed circuit across runs.

Thank you for raising both points. They help us make the interpretation and the measurement clearer.

The knockouts are the strongest part, and one number in them looks like a lead.

Knock out expert 0 and mul falls to 6.9%, div to 7.2%, exp only to 24.0%.
Chance mod 113 is 0.9%.
If operands are uniform over 0..112, the trivial exp cases (a or b in {0, 1}) are 1 - (111/113)^2 = 3.5% of probes.
That leaves roughly 20 points of exp that survive without expert 0.
Your low-decay arm gives exp its own layer-2 expert. Is the 24% a partial version of that route at default decay?

On the loss, the scope gives a sharper reading than a caption fix.
The dashed value is a mean over 4 scored positions, and answer-only is about 0.036 nats.
Taking that as roughly per op, exp's other three positions average (4 x 8.4 - 0.04) / 3 = 11.2 nats.
That is more than twice ln 113 = 4.73, the cost of a uniform guess over the residues.
For add the same arithmetic gives 4.9, close to uniform.

So the family split in the loss panel lives in positions the objective never touched.
Those logits are free to drift, and op is in context when b is predicted, so they can drift per family.
The panel may be echoing the routing split, not the arithmetic.

Two cheap checks from saved runs:

  1. Exp accuracy under the expert 0 knockout, split by b. Is the 24% spread out, or sitting on a few exponents?
  2. The dashed curve on the answer position alone, per op. Does the family split survive?
·

Again, thank you for the good question!

We checked both questions at the saved step-120,000 checkpoint, without retraining.

Disabling layer-2 expert 0 drops exponentiation accuracy from 98.9% to 24.0%—a loss of 74.9 percentage points on the same 1,024 held-out examples. The intervention skips that expert’s contribution while leaving the router unchanged.

The surviving answers aren’t explained mainly by cases involving 0 or 1. Those account for only 20 of the 246 correct answers. Excluding every such input leaves 226/988 correct, or 22.9%.

We also checked all 8,974 held-out exponentiation examples from the same split. Accuracy after the knockout was 24.74%, with correct answers at every exponent from 0 through 112, but pronounced peaks and uneven performance. This larger sample includes the original subset; it isn’t an independent replication. It establishes broad survival without identifying the computation responsible.

For loss, we isolated the answer target on exactly the original 12 fixed probes per operation:
Operation Whole-probe loss Answer-only loss
Addition 3.72 0.00365
Subtraction 3.76 0.00362
Multiplication 5.03 0.000748
Division 5.35 0.00113
Exponentiation 8.37 0.0350
Values are mean cross-entropies in nats; lower is better.

The pairings remain visible, but their relative ordering reverses: multiplication/division have lower answer-only loss than addition/subtraction on these probes. Exponentiation remains highest. The whole-probe panel therefore shouldn’t be interpreted as a ranking of answer-prediction difficulty.

IRIS can record and plot measurements computed by user functions inside the training loop, without changing IRIS itself. We’ll use that capability in a new run to measure both the accuracy gap caused by the expert knockout and answer-only loss per operation. A follow-up post will show how these evolve throughout training.