Empirical evidence · 04 / 09

Parity function

A two-class problem with a well-defined logic that similarity-based models cannot generalise. Test accuracy 98.63% for the logic replicant against 0.20% for the random forest.

The switchboard puzzle. The logic replicant scores 98.6% on unseen panels; the random forest scores 0.2%.

For dummiesPlain-language view: everyday words, no equations. The full version is one click away.

What happened

Eight switches, and the answer says whether an odd number of them are on. Flip any one switch and the answer flips. The random forest memorised every example it saw and then got almost every new one wrong: 0.2% correct, worse than guessing, because it assumed that similar panels share an answer, and here they never do. The small neural network reached 57%, barely better than a coin toss. The logic replicant, using just 32 adjustable numbers, scored 98.6% on panels it had never seen. It had found the rule.

The rule, drawn

Parity examples on the learned map: nine parallel streaks alternating between the two answers. The vortices of the parity replicant sitting on the streaks.
Figure 6. Left: all 256 panels on the learned map form nine neat streaks, one for each possible count of switches that are on, alternating light and dark answers. The model rediscovered that only the count matters. Right: the vortices claiming those streaks.

Numbers

ModelAccur. (train)Accur. (test)Precis. (test)Recall (test)Configuration
Replicant99.80%98.63%98.67%98.60%\(S=0, R=0, D=1, |V|=8\)
RF100.00%0.20%0.21%0.18%100 estim., all features
MLP95.66%57.25%42.61%59.72%20 neurons, 1 hidden layer
SOM64.68%24.71%24.71%18.39%256 neurons (16×16)
XGBoost64.00%5.10%4.74%5.27%100 estim., max depth 6

Analysis

This is the experiment where the models differ most. The random forest memorises the entire training set (100%) and its test accuracy falls to 0.20%: its inductive bias, memorising and grouping similar instances, is exactly wrong when changing one bit changes the class, because no two cases can share a node and there is no possibility of extrapolation. XGBoost fails the same way, 64% in training and 5.10% in test. The MLP's gap is smaller, 95.66% to 57.25%, barely above the 50% baseline of this balanced two-class problem: it found a heuristic that slightly improves on a random model but could not replicate the logic. The SOM drops from 64.68% to 24.71%, understandable since the closest node to an instance is one bit away and belongs to the other class, so its strategy accumulates systematic errors.

The logic replicant, with the minimal configuration \(S=0\), \(R=0\), \(D=1\), \(|V|=8\), learns the logic (99.80% training) and extrapolates to unseen inputs with a small loss, 98.63%. Its inductive bias exploits compact logics with well-defined rules and almost no exceptions. It is the only model that replicated the logic of the problem rather than memorising instances or forming a partial understanding.

The logic, made visible

Parity instances in a 2-D Q-space: nine parallel diagonal streaks alternating between output 0 and 1. Vortex scalar field of the parity replicant showing bright spots along the streaks.
Figure 6. Parity function projected to a two-dimensional \(Q\) by a replicant configured with \(S=0, R=0, D=2\) and 4 vortices per class. (a) Instances. (b) Vortices.

Despite being a single logic, the replicant groups instances with the same number of zeros and ones: values with the same output that share the configuration, because the parity function is symmetric and permuting two input bits produces the same output. The 256 instances form 9 groups, 5 for class 0 and 4 for class 1. The vortices in (b) match those subgroups, which helps generalisation: as only a few cases shape each group and its vortex, they can still be used to classify new instances correctly.