Skip to content

How far logic gates get, architecture by architecture

Solving MNIST is only the starting point. This page lines up measurements of how far an architecture can go on logic gates alone, separating what works from what does not. Nothing has been cherry-picked to make the numbers look good: models that are not yet calibrated, and models that collapsed, appear in the same tables.

A one-line index that also covers the models from the experimental branches is in the Model Zoo.

ModelDatasethardConditions / environment
DLGN (softmax N=2, 6 layers × 8,000)MNIST 20×200.9784A10G, 200k iter, 2026-07-02
DLGN (Hard-ST selection, 6 layers × 64,000)MNIST 28×280.9802RunPod GPU, 50k iter, 2026-04-15
DLGN (softmax N=2, 6 layers × 16,000)MNIST 28×280.9774RTX 5090, 50ep, 2026-04-20
BinaryBrain style (raw+BN+Binarize, N=6)MNIST0.948314,516 gates, 10ep, 2026-04-20
Conv-DLGN (after the softmax16g fix)CIFAR-100.58080.4921 before the fix (+8.9pt), 2026-07-05
LogicMixer (a logic MLP-Mixer)MNISTsaturates at 0.67120k steps, needs calibration
LogicResNetMNIST0.113 (near chance)3ep, loss does decrease. Unresolved; treated as a τ/scaling calibration problem

CIFAR-10 falls well below the MNIST-class numbers. As task difficulty rises, both the gate budget and the architecture start to matter — that is where things stand, and it is recorded here without embellishment.

Conv-DLGN’s +8.9pt came from fixing a structural flaw in LutConv2d (a 4-entry simplex cannot express pass-through / OR / XOR, and the residual initialization was also decaying) by moving to softmax16g. It is a concrete case of missing expressiveness in a parameterization killing accuracy at the architecture level, and it matches The experiment behind the parameterization rule.

A “ladder” measuring, step by step, how much of a Transformer can be turned into a circuit, on a character-level language model over Tiny Shakespeare (vocab 65, T=64, 20k steps, A10G, seed=0).

RungWhat was turned into a circuithard ppl
L0nothing (all FP; establishes the ceiling)4.94
L0bFFN only≈7.9
L1+ q/k/v projections as circuits19.24
L2+ scores as XNOR-popcount19.39
L3-C+ normalization as an argmax MUX selector (attention fully circuit-ized)15.54
L3-C + Gumbelsame + Gumbel gate-selection noise13.31

Two things stand out.

  • The cost of circuit-ization is not monotone. L1/L2 fall to the 19s, then L3-C — which replaces normalization with a MUX — recovers to 15.5. Softmax flattening is not required, and attention works as a “learned multiplexer”. A controlled experiment on sequential MNIST agrees: MUX selection (entropy=0) matched softmax (entropy=2.7) in accuracy (0.8605 vs. 0.8606).
  • The gap to the FP ceiling (4.94) is still wide. hard ppl 13.31 shows a language model can run as a logic circuit, but it is not level with the FP implementation.

For the discretization-gap side of this, see The discretization gap in practice.

ModelTaskResultConditions
LogicLSTMdelayed copy (T=8)hard acc 100% (all seeds, ≤200 steps)An Elman-type model under the same conditions is ≈0.86 even at 800 steps
LogicReservoir (frozen random circuit)delayed bit recallhard acc 100% (all seeds) from training the readout alonethe circuit body is frozen and purely Boolean
DLGNAttentionTranslatorcopy (seq_len=16)soft 71.66% / hard 25.77%50,000 steps, 156,032 parameters / 9,352 gates
RDDLGN (reimplementation of prior work)copy (seq_len=16)soft 22.54% / hard 15.54%same conditions, 180,608 parameters / 10,888 gates

The Translator with cross-attention achieved 3.18× RDDLGN’s soft accuracy and 1.66× its hard accuracy with 13.6% fewer parameters (2026-04-21). That is evidence the information bottleneck of RDDLGN’s attention-free structure was really biting. Even so, hard 25.77% is not a practical level: seq2seq is currently the area most vulnerable to discretization.

On gating, tests guarantee that LogicLSTM’s gates discretize to {0,1} at eval time, collapsing into a strictly Boolean MUX circuit. Gating — as MUX / AND masking — is inherently compatible with Boolean operations, which is what the measurements show.

ModelTaskhardEnvironment
CenterNetLUTMulti-MNIST detection (96×96, 1 object)mAP 0.5425 (epoch 78, pre-fix figure, awaiting re-measurement)RTX 5090, 1,000ep, 11h45m, 13,944 parameters
LogicUNet8×8 toy segmentationIoU 0.875needs calibration
LogicUNetfull MNIST masksIoU 0.373needs calibration

CenterNetLUT peaks at epoch 78 and then becomes unstable. It is an unusual case where hard far exceeds soft (mAP 0.1791), and you will miss the peak unless model selection is based on the hard side.

ModelTaskResultConditions
LogicBinaryDiffusion (forward process, reverse process and denoiser all Boolean circuits)binary MNISTacc@t1 0.886, denoising margin +0.377 (passthrough baseline 0.499)4ep, 3,937 parameters total
LogicVAE (binary latent, ST Bernoulli)binary MNISTreconstruction 193.6 nat/image, KL 0.448, active_bits 0.99 (no posterior collapse)30ep
LutAutoencoder (LutLayer only)MNIST reconstructionTest MSE (hard) 0.0863 (best, epoch 63) / soft 0.0438 at epoch 65Apple M4 Pro (MPS), k=8,000, bottleneck=256, 65ep (stopped early), 30,784 gates
LogicGAN8×8 binary patternsdiverges without tuning; stabilization measures bring it to a standoffresearch problem (only structural-contract and dynamics smoke tests)

The diffusion model’s 3,937 parameters is a number worth noting. Because “sampling = comparator” and “adding noise = XOR”, the generative process closes entirely within logic circuits.

A LUT-based TextCNN on WRIME (sentiment analysis of Japanese social-media posts). All values are hard-side.

TaskResultComparison
binary classificationAccuracy 82%—
8-emotion binary classificationAccuracy 83.4% / mean F1 0.367DeBERTa-v3-base 87.0% / F1 0.630

The 8-emotion version uses about 2.08M parameters (1/88 of DeBERTa) for −3.6pt Accuracy and −0.263 F1. Accuracy comes close, but F1 lags badly. Minority classes are being dropped, and “close accuracy” is explicitly not “equivalent”. Training took about 15 minutes on GPU.

Can existing floating-point models be converted into logic gates (Track D)?

RouteResult
pruned transcription + STE fine-tune + int4 QAT + adder-tree lowering (MNIST)within −2% of the teacher (hard 0.9558, strict lowering). The circuit has 418k LUT outputs
the same recipe transferred to Fashion-MNIST0.8196 (passes with fan-in 48 + bits 6)
KD from a strong teacher (public ResNet18 on CIFAR-10, 0.9498)+2.3pt over scratch for a dense DLGN
native DLGN conversion from a weak teacher (MNIST)all 3 routes below scratch (a negative result)
KD from public DistilBERT to SST-2 sentiment classificationhard accuracy +7.3pt (73.4% → 80.7%, 88.4% recovery)
data-free distillation from public nanoGPT to a character LMRDDLGN actual BPC 2.71 (0.51 bit behind the teacher)

The central finding here is the scaling hypothesis: the gap in capability between teacher and student is the source of distillation’s gains. Conversion from a weak teacher loses to training from scratch. Conversely, the fact that language-generation conversion succeeded even with no training data (only teacher-generated text) points to a path when the original data is unavailable in production.

The results above are all GPU runs, but the site’s tutorials are written as scaled-down versions that finish on CPU alone, in minutes. The same phenomena reappear in miniature.

TutorialMeasuredTime
Train on MNISTsoft 0.8765 / hard 0.8670 (4,000 gates, 4,000 steps)about 10 min
DWN (thermometer encoding)test acc 0.9540, max soft–hard logit difference 0.0about 7 min
LSTM / GRULogicLSTM / LogicGRU hard 1.0000 vs. Elman 0.5781about 5 min
The logic ladderL0 1.000 / L1 0.746 / L2 1.000 / L3-C 0.990 (hard)about 8 min
Reservoirhard 1.0000 for parity k=1,2; 0.8223 at k=3; 0.5723 at k=4about 5 min
Object detectionmAP@0.5 = 0.3003 (679 gates, 500 steps)about 7 min

A full list of measured tutorial values is in Benchmarks.

  • Solidly working: image classification (MNIST class), recurrent tasks such as delayed copy, simple detection settings, generative models with binary latents, text classification.
  • Working, but short of FP: autoregressive language models (hard ppl 13.31 against an FP ceiling of 4.94), CIFAR-10-class image classification (0.5808).
  • Unachieved / under calibration: LogicResNet (≈chance), LogicMixer (saturates at 0.671), LogicUNet (IoU 0.373 on full MNIST), LogicGAN (stabilization is a research problem).
  • The common bottleneck is the discretization gap, and the current state of the remedies is collected in The discretization gap in practice.