Skip to content

Models from the experimental branches

Separately from the models that live in the package itself (= the first half of the Model Zoo), there are many configurations that only ever ran on experimental branches. This page is where they live. Unlike the mainline pages, the lead role here belongs to the negative results and the reason behind them. Nothing stops at “it did not help”: the purpose of this page is to record why it did not help, every single time.

The collection covers 11 families, 81 configurations (24 series if counted by experiment series ID). All of them were run from scripts under experiments/, and the metrics are logged in wandb.

1. Pure DLGN / input bypass — clever fixed wiring never won, not once

Section titled “1. Pure DLGN / input bypass — clever fixed wiring never won, not once”

What was tried: on the hypothesis that the weakness of pure DLGN (400-bit input → LutLayer×L → GroupSum, with only gate type being learned) lies in the random sparse connectivity of the input layer, wiring tricks that redistribute the raw input to every layer were tried across 5 rounds (R1–R5), about 30 runs. Conditions fixed at mnist20x20 (400 bits), n_inputs=2, τ=10, bs=128, seed 0, fixed wiring.

ConfigurationStructural ideaMNIST 20×20 hardWhat it showed
Pure DLGN (baseline)k1000×4 layers = 4,000 gates, random fixed wiring0.8994 (lr0.03 / 30k iter)Strongest under a matched budget. The initial baseline was 0.8939
concat-random bypasshidden-layer input becomes concat([h,x]) (output width unchanged)4 layers 0.9077 / 20 layers 0.7963Worse the deeper it goes. 17–44% of the fan-in is taken by raw input
IALGN-style spine+anchorslot0 = identity from the same index of the previous layer, only slot1 carries the original inputrandom 0.8724 / split 0.8663 / butterfly 0.8655 / coverage 0.8293The more evenly the input is spread, the worse it gets (coverage is last, −6.5pt)
OR residualh_new = OR(h_prev, lut_out)0.7654 (with residual_init) / 0.8416 (without)OR(h,h)=h collapses the layer into an identity, and it duplicates the role of the spine
XNOR residualh_new = XNOR(h_prev, lut_out)0.7731XNOR(h,h)=1 saturates to a constant
Cross-layer bypass prev2 / denseanchor points two layers back / to all preceding layers0.8779 / 0.8727Better than raw-input bypass, but still short of the baseline
Foundation sweepthermometer 2/4 levels, augment, τ30, gumbel, lr0.03only lr0.03 improves, at 0.8993. therm2 0.8885 / aug 0.8873 / gumbel 0.8494 / τ30 0.8299The only thing that helped was the learning rate (+0.54pt)
Going deeper (6 layers, 6,000 gates)lr0.03 + 2-level thermometer0.9095But 1.5× the gates. Under a matched budget, 0.8994 still wins
Matched-budget depth + partial spinetotal fixed at ≈4,000 gates: k660×6 / k500×8 / k400×10none: 0.8696 / 0.8477, spine50: 0.8429 / 0.8227 / 0.8012Monotonically worse the more layers are added. Width beats depth
Learning the anchor selectionsoftmax+STE over K=32 candidates for the anchor slot only0.8968Almost cancels the harm of the spine, but does not exceed it (−0.26pt)
Straight-through wiring selectionHard-ST / Gumbel-ST0.8875 / 0.8648Pushing discretization earlier is a disadvantage
mnist784 (the decisive evidence)784 inputs, no crop0.8683 (−3.11pt vs. 20×20)The higher the input dimension, the more sparse connectivity drops

Why it did not work: input bypass is a prescription for “the information is not arriving”, but the actual bottleneck was the input layer itself, not the wiring structure. Mixing raw input into a layer with a fan-in of only 2 costs exactly that many slots for receiving the previous layer’s features. The fixed logic residuals OR / XNOR, far from creating an identity path, collapse the layer via OR(h,h)=h / XNOR(h,h)=1 (and pairing them with residual initialization accelerates the degeneration). The fact that mnist784 got worse settled it, and the motivation moved to the hybrid family: “put a densely connected NN in front and rebuild the input layer”.

wandb group input-bypass-dlgn (tags input-bypass / series:BYPASS-*). Implemented in experiments/train_input_bypass.py.

2. Hybrids — front-end NN/CNN + binary interface + back-end DLGN

Section titled “2. Hybrids — front-end NN/CNN + binary interface + back-end DLGN”

What was tried: raise a bit interface of front-end NN (Linear+ReLU or Conv) → Sigmoid → Binarize(0.5, STE), and make everything behind it pure logic gates (a stack of LutLayer → GroupSum). Everything behind the interface drops straight into HDL. Six stages: front-end MLP (HYBRID-1), front-end CNN (HYBRID-2), back-end shape search (HYBRID-3), settling wiring and LUT6 (HYBRID-4/4b), and sweeping the GPU/FPGA boundary (HYBRID-5/6).

Structure (the actual sizes of the series best, h2-cnn-dlgn-expand = CIFAR-10 hard 0.7864)

graph LR
subgraph FRONT["Front end: a real-valued NN (runs on GPU; not burnable)"]
direction LR
IN["CIFAR-10<br/>3×32×32<br/>reals"]
CNN["Conv×4 + Pool×2<br/>721,088 parameters<br/>output: a real vector"]
LIN["Linear + Sigmoid<br/>→ 160 dims in [0,1]"]
IN --> CNN --> LIN
end
subgraph IFACE["Binary interface (the GPU / FPGA boundary)"]
direction LR
BIN["Binarize(threshold 0.5, STE)<br/>160 bits<br/>forward = step function<br/>backward = gradient passes through<br/>measured cost −0.01pt"]
end
subgraph BACK["Back end: pure logic gates (drops straight into HDL)"]
direction LR
L1["LutLayer 160<br/>160 gates"]
L2["LutLayer 320<br/>320 gates"]
L3["LutLayer 640<br/>640 gates"]
GS["GroupSum k=10<br/>640 wires into 64 × 10 groups"]
L1 --> L2 --> L3 --> GS
end
LIN --> BIN
BIN --> L1
BIN -.->|"bypass: the interface bits<br/>are also fed to every layer"| L2
BIN -.-> L3
GS --> OUT["10-class scores (reals)<br/>hard 0.7864"]
subgraph LEG["Legend"]
direction LR
LGR["orange = reals (GPU side; not burnable to an FPGA)"]
LGL["green = logic (0/1 bits; 1,120 gates in total)"]
LGB["blue = the interface (where reals become bits)"]
end
style IN fill:#f9731626,stroke:#f97316
style CNN fill:#f9731626,stroke:#f97316
style LIN fill:#f9731626,stroke:#f97316
style BIN fill:#38bdf826,stroke:#38bdf8
style L1 fill:#10b98126,stroke:#10b981
style L2 fill:#10b98126,stroke:#10b981
style L3 fill:#10b98126,stroke:#10b981
style GS fill:#f9731626,stroke:#f97316
style OUT fill:#f9731626,stroke:#f97316
style LGR fill:#f9731626,stroke:#f97316
style LGL fill:#10b98126,stroke:#10b981
style LGB fill:#38bdf826,stroke:#38bdf8

How to read it: only what is to the right of the interface (green) is 1,120 two-input LUTs that lower to Verilog. The left (orange) is an ordinary CNN and needs a GPU. Against the all-NN control (h2-cnn-mlp, 0.7425), the claim of this series is +4.39pt from swapping only the back end from MLP to DLGN while keeping the front end identical — and it is also why gate counts here cannot be laid side by side with papers whose networks are logic gates end to end.

ConfigurationFront-end NN → interfaceBack-end DLGNhardGates
m-front2-wide256,128 → 128 bits1000,10000.9714 (MNIST)2,000
m-front2-expand-bypass256,64 → 64 bits80,160,320 (bypass)0.9703560 (1/7 of pure DLGN)
m-front1-wide128 → 128 bits1000,10000.96162,000
m-front1-compress256 → 256 bits120,600.9556180 (1/22)
m-mlp-control (no back-end)256,64 → 64 bits—0.92030
c-front2-wide512,128 → 128 bits1000,10000.5446 (CIFAR-10)2,000
c-front2-compress512,256 → 256 bits200,1000.5057 (last)300

What it showed: the sparse-connectivity bottleneck is gone — +7.20pt over the matched-budget pure DLGN at 0.8994, and 0.9703 is reached with 560 gates (1/7 the size). With the same front-end and the same interface, the back-end DLGN contributes +5.00pt (0.9703 vs. the MLP control at 0.9203). The division-of-labour hypothesis, “compression = dense NN / expansion = sparse DLGN”, is supported by the compressing variant landing clearly last on CIFAR. On CIFAR, a separate learning rate for the front-end (--front-lr 1e-3) is mandatory.

2.2 Front-end CNN (HYBRID-2) — beating an “ordinary NN” head-on

Section titled “2.2 Front-end CNN (HYBRID-2) — beating an “ordinary NN” head-on”
runheadInterfaceBack-endCIFAR-10 hardGatesNN parameters
h2-cnn-dlgn-expanddlgn160 bits160,320,640 (bypass)0.78641,120721,088
h2-cnn-dlgn-widedlgn256 bits1000,10000.77752,0001,114,400
h2-cnn-dlgn-compressdlgn256 bits200,1000.75623001,114,400
h2-cnn-mlp-binmlp-bin256 bitsMLP(256)0.742601,182,762
h2-cnn-mlp (all-NN control)mlpreal-valued 256MLP(256)0.742501,182,762

What it showed: CNN+DLGN beat CNN+MLP by +4.39pt. The winner’s back-end is nothing but 1,120 two-input LUTs, and its front-end CNN is also 40% smaller than the control’s. The factor decomposition gives essentially zero cost for the binarizing interface (−0.01pt) and +4.38pt from the back-end DLGN. In throughput measurements the bottleneck is the GPU-side CNN front-end at every batch size, so the ratio against the all-NN model is 0.98–1.28× (= essentially no improvement), and 1.48–2.30× against running the same hybrid entirely on GPU. The FPGA back-end’s latency is 20ns (5 stages @200MHz).

2.3 Back-end shape (HYBRID-3) — shape dominates, depth is subordinate to shape

Section titled “2.3 Back-end shape (HYBRID-3) — shape dominates, depth is subordinate to shape”

Front-end fixed at “256,64” (64-bit interface); every run N=6, softmax.

rundlgn-widthsAxisMNIST hardLUTs
l6-expand80,160,320 (bypass)expanding, medium0.9703560
l6-deep-expand80,160,320,640expanding, deep0.96961,200
l6-flat-narrow250,250constant, shallow, small0.9618500
l6-compress120,60contracting, shallow0.9542180
l6-deep-narrow250,250,250,250constant, deep, small0.95061,000
l6-flat-wide1000,1000constant, shallow, large0.91782,000
l6-tiny60,30contracting, tiny0.855890
l6-deep-compress320,160,80,40contracting, deep0.6460 (soft 0.8185)600
(calibration) warp parameterization1000,1000—0.2027 (training collapsed)2,000

What it showed: there is a 32pt spread within the axis, so shape dominates (expanding ≫ constant > contracting). The sign of depth is subordinate to shape (expanding −0.07pt / constant −1.12pt / contracting −30.8pt), so “deeper is better” does not hold for any shape. Under a constant shape, width and accuracy are inversely correlated: 500 gates at 0.9618 beat 2,000 gates at 0.9178. l6-expand is exactly equal, ±0.00pt, to n=2, so in this setting LUT6’s expressiveness is not the bottleneck. LUT6’s value lies on the other side: “the same accuracy with fewer gates” (560 vs. 2,000 = a 3.6× reduction).

2.4 Settling wiring and LUT6 (HYBRID-4 / 4b)

Section titled “2.4 Settling wiring and LUT6 (HYBRID-4 / 4b)”

Front-end fixed at “256,120” (120-bit interface), back-end at “120,240,480” (840 LUTs).

runNWiringExtraMNIST hard
h4-n2-i1202bypass—0.9746
h4-l6-i1206bypass—0.9739 (best 0.9766)
h4-n2-balanced2balanced—0.9734
h4-l6-bypass-bb-nolast6bypassBB re-binarization (all but the last layer)0.9721
h4-l6-balanced6balanced—0.9646
h4-l6-i2406balanced240-bit interface, 1,680 LUTs0.9617
h4-l6-balanced-dwn6balancedDWN-style learned wiring in layer 10.9610
h4-l6-unique-i1206unique—0.9597
h4-l6-bb-nolast / -balanced-bb / -full6balancedBB re-binarization0.1135 / 0.0891 / 0.1010 (collapse)

Factor decomposition: cross-layer shortcuts +0.93pt > even coverage +0.49pt (which only helps LUT6) > interface 64→120 bits +0.36pt. Interface 120→240 bits is −0.29pt (saturated), and DWN-style learned wiring is −0.36pt.

Why it collapsed: BinaryBrain-style re-binarization between layers dies without a skip path. Combined with balanced wiring (previous layer only) it falls to hard 0.089–0.114, whereas with bypass it trains normally at 0.9721. Pushing gradients through many stages of STE with no detour makes them vanish.

HYBRID-4b (settled with 3 seeds + CIFAR): for MNIST legacy bypass, n=2 0.97430 vs. LUT6 0.97450 — the ranges overlap completely, so there is no difference. With balanced+bypass, n=2 0.97487 > LUT6 0.97300. On CIFAR-10, n=2 0.7864 > LUT6 (balanced+bypass) 0.78230 > LUT6 (legacy) 0.77555. In this hybrid configuration, “LUT6 > LUT2” does not hold (LUT6 is always at best equal, for 4× the parameters). The sign of balanced+bypass flips with the dataset (MNIST −0.150pt / CIFAR +0.675pt).

2.5 Sweeping the GPU/FPGA boundary and demonstrating the pipeline (HYBRID-5 / 6)

Section titled “2.5 Sweeping the GPU/FPGA boundary and demonstrating the pipeline (HYBRID-5 / 6)”

CIFAR-10, balanced+bypass, --front-lr 1e-3.

runBoundaryInterfaceBack-end DLGNhardGatesvs. all-NN (bs=1024)
h5-conv4-dlgnConv×4+Pool×2160 bits160,320,6400.77951,1201.01x
h5-conv2-dlgn-deepConv×2+Pool×1240 bits240,480,960,9600.71032,6401.66x
h5-conv2-dlgnConv×2+Pool×1240 bits240,480,9600.70511,6801.67x
h5-conv1-dlgn-wideConv×1+Pool×1360 bits360,720,14400.69572,5203.07x
h5-conv1-dlgnConv×1+Pool×1240 bits240,480,960,9600.69252,6403.40x (567,289 sps)
(reference) h5-fullnnall GPUreal-valued 256none0.742501.00x

What it showed: the sweet spots are “Conv1 for speed, Conv4 for accuracy”. The intermediate Conv2 gives 15× worse speed return per point of accuracy and is not worth buying. “One conv + one Linear + everything else DLGN” works if the goal is speed (3.40×) and fails if the goal is accuracy (−5.0pt vs. all-NN / −8.7pt vs. Conv4). The information lost by making the boundary shallower is recovered neither by back-end depth (+0.52pt) nor by interface width (+0.32pt). train_acc is 0.983–0.999 across every run, so the accuracy difference is generalization, not a capacity shortfall. The bottleneck is always the GPU side (against 5.1µs of FPGA and 9.1µs of PCIe, the GPU part is 1,805µs at its fastest).

HYBRID-6 demonstrated the theoretical 3.40× as an actual 3.23–3.41× using a double-buffered event-driven schedule, and latency improved 11.35× at bs=1 (0.939ms → 0.083ms). Even swinging T_fpga by a factor of 100, the bottleneck stays in the GPU front-end at all 15 configurations × 4 points = 60 points: making the FPGA faster does not make the system faster. The only two effective levers are “shrink the GPU front-end” and “amortize the fixed PCIe term (6–13µs) over large batches”. On an LLM proxy (d384 / L6 / vocab50k), going from k=1 to k=64 concurrent sequences moves the LM head’s share from 20% to 49%, and the FPGA offload gain on prefill goes from 1.25x to 1.95x.

wandb group hybrid-front-dlgn. Implemented in experiments/train_hybrid_front.py / train_hybrid_cnn.py / bench_hybrid_throughput.py / bench_pipeline_overlap.py.

3. Back-end scale (HS-1) — inverse scaling

Section titled “3. Back-end scale (HS-1) — inverse scaling”

What was tried: keeping HYBRID-2’s front-end CNN and interface fixed, sweep only the back-end DLGN’s gate count over four orders of magnitude, from 1,120 to 61,000,000. The point was to reach the same budget band as LogicTreeNet-B (16M) and -G (61M) in the literature and check directly whether “more gates” means “better”. CIFAR-10, seed 0.

Back-end gatesDepthbest hardEpochs
1,120 (control = the HYBRID-2 configuration)30.780620
100,0002 / 4 / 80.7793 / 0.7808 / 0.776220
1,000,0004 / 80.7724 / 0.767920
8,000,00080.762720
16,000,000 (= the LogicTreeNet-B budget)80.730510
61,000,000 (= the LogicTreeNet-G budget)80.60085 (cut short)

Why it did not scale: at an equal 20 epochs the numbers get monotonically worse — 0.7806 → 0.7808 → 0.7724 → 0.7627 — which is inverse scaling. On the footing set by the front-end CNN, the back-end saturates at roughly 1,000 gates. The effect of depth is zero-to-negative across every budget band (d4 ≧ d8 everywhere). That said, 61M at 0.6008 is not invalid capacity but insufficient training (at the point it was cut short it was still gaining +5–7pt per epoch: 0.293→0.396→0.479→0.548→0.601). The comparison target, LogicTreeNet-G at 86.29%, is the product of 700–1000 epochs, which shows that the real cost of a huge gate network is not gates but training. On the engineering side, 61M gates (980M parameters) peaks at 52GB on an A100-80GB at bs32, and the practical bottleneck turned out to be the Python path, where hard eval takes 10 minutes per point.

wandb group hybrid2-scale-v1. Implemented in experiments/train_hybrid2_scale.py.

4. Output-layer NN / reverse hybrid (HYBRID-R)

Section titled “4. Output-layer NN / reverse hybrid (HYBRID-R)”

What was tried: put the real-valued NN on the output side instead of the front. Replace pure DLGN’s readout, GroupSum, with a Linear / MLP head, and also try a sandwich with an NN at both ends. mnist20x20, 12,000 iters, seed 0, Modal A10G, DLGN k=1000 with random fixed wiring, separated learning rates (DLGN 0.03 / NN 1e-3).

The diagram below is the series-best sandwich configuration (MNIST hard 0.9731).

graph LR
subgraph A["① Front-end NN (rebuilds the sparse input layer)"]
direction LR
IN["MNIST 20×20<br/>400 reals"]
NN1["Linear + ReLU<br/>→ Sigmoid → Binarize(STE)<br/>120-bit interface"]
IN --> NN1
end
subgraph B["② The DLGN body (the only burnable part)"]
direction LR
D1["LutLayer k=1000<br/>1,000 gates / 2 inputs<br/>random fixed wiring"]
D2["LutLayer k=1000<br/>1,000 gates / 2 inputs"]
D1 --> D2
end
subgraph C["③ Output-side NN (lifts the GroupSum readout constraint)"]
direction LR
HD["MLP head<br/>1,000 bits → 10 classes"]
HD2["predicted label"]
HD --> HD2
end
NN1 --> D1
D2 -->|"1,000 bits"| HD
subgraph CMP["Control: pure DLGN (dlgn4-gs)"]
direction LR
Z1["raw input, 400 bits"] --> Z2["LutLayer ×4<br/>4,000 gates"] --> Z3["GroupSum k=10<br/>just counts 400 wires per class<br/>hard 0.8787"]
end
subgraph LEG["Legend"]
direction LR
LGR["orange = reals (the NNs; GPU / host side)"]
LGL["green = logic (0/1 bits)"]
LGB["blue = the binary interface"]
end
style IN fill:#f9731626,stroke:#f97316
style NN1 fill:#38bdf826,stroke:#38bdf8
style D1 fill:#10b98126,stroke:#10b981
style D2 fill:#10b98126,stroke:#10b981
style HD fill:#f9731626,stroke:#f97316
style HD2 fill:#f9731626,stroke:#f97316
style Z1 fill:#10b98126,stroke:#10b981
style Z2 fill:#10b98126,stroke:#10b981
style Z3 fill:#f9731626,stroke:#f97316
style LGR fill:#f9731626,stroke:#f97316
style LGL fill:#10b98126,stroke:#10b981
style LGB fill:#38bdf826,stroke:#38bdf8

How to read it: the only difference from the control (pure DLGN) below is whether one orange NN has been inserted at each end. Adding ③ alone takes 0.8787 → 0.954 (+7.5pt); adding ① alone gives 0.9714; adding both gives the sandwich at 0.9731. In other words the sparse input (which ① fixes) and the readout constraint (which ③ fixes) are separate bottlenecks, and ③ can be recovered with a single minimal Linear — which is the basis for the “FPGA front end + tiny NN head” deployment (the reverse hybrid).

ConfigurationStructurebest hardsoft–hard gap
sandwichNN front-end 120 bits + DLGN 2 layers + MLP head0.9731≈0
sandwich-4same, DLGN 4 layers0.9716≈0
dlgn4-mlp-n6LUT6 indep, lut-lr 0.15 + MLP head0.95490.033
dlgn2-mlpDLGN 2 layers + MLP head0.95480.024
dlgn4-linearDLGN 4 layers + Linear head0.95400.026
dlgn4-mlpDLGN 4 layers + MLP head0.95160.028
dlgn4-gs (control)pure DLGN + GroupSum0.87870.008

What it showed: simply adding an NN head is worth +7.5pt (0.8787→0.954), and it barely depends on the kind of head (Linear / MLP) or on the DLGN’s depth. In other words, the gain really is lifting the readout constraint imposed by GroupSum itself, and a single minimal Linear layer recovers it. On the other hand the ceiling of 0.955 does not reach the front-end-NN family’s 0.9714: sparse connectivity in the input layer cannot be filled in from the head (which re-confirms the conclusion of the input-bypass family from the opposite side). The sandwich, with an NN at both ends, is the family’s best at 0.9731 and a soft–hard gap of ≈0 — though at one seed, +0.17pt is inside the noise. For deployment the implication is that a reverse hybrid (FPGA front-end + a tiny NN head) works at 0.954 — putting all the heavy computation on the FPGA and leaving the host nothing but a 10-class readout lands on a practical line.

wandb group reverse-hybrid-v1. Implemented in experiments/train_reverse_hybrid.py.

5. Settling LUT6 vs. LUT2 (LUT6-1) — the real cause was the parameterization

Section titled “5. Settling LUT6 vs. LUT2 (LUT6-1) — the real cause was the parameterization”

What was tried: verify, footing by footing, whether a 6-input LUT is stronger than a 2-input LUT. First a five-minute diagnostic of output scale and gradients (in_dim=400, out_dim=1000, seed 0), then a comparison across four footings: pure DLGN, 1-layer / 2-layer, DWN, and hybrid.

Configurationout.meanmean |dL/dW|vs. N=2 softmax
N=2 softmax, continuous input0.501553.041e+001.0000
N=6 softmax, continuous input0.01562 (pinned at 1/64)6.817e-031/446
N=6 softmax, binary input0.015612.508e-021/121
N=6 independent, continuous input0.499218.266e-011/3.7
N=2 independent, continuous input0.497721.327e+014.3640

The real cause: N=6 softmax pins its output at 1/64 because of a double simplex constraint, ΣW=1 together with Σbasis=1. N=2 softmax is a difflogic-compatible 16-gate mode with a different structure, so it settles at ≈0.5 and the problem does not arise. The old hypothesis, “just correct the 1/16 basis decay with the learning rate”, was rejected (16× the learning rate is −3.05pt, monotonically worse).

TrackConfigurationhard
A: pure DLGN, 4,000 LUTs, 4 layerspA-n6-indep (independent, lr0.48)0.9565
pA-n2-base (softmax, 16 gates, lr0.03)0.8846
pA-n6-samelr / lr8x / lr16x (softmax)0.7961 / 0.7828 / 0.7656
pM: 1 layer2,000 LUT6 indep / 8,000 LUT2 softmax0.9496 / 0.9315
pM: 2 layerssame0.9697 / 0.9553
pM: seeds 0/1/2 (1 layer)2,000 LUT6 indep0.95040 [0.9496, 0.9519]
8,000 LUT2 softmax0.92920 [0.9272, 0.9315]
pD: DWN (EFD+Thermometer)n6 / n20.9312 / 0.9273
B: hybrid (840 LUTs)hB-n2-indep / hB-l6-lr16x / hB-l6-indep0.9764 / 0.9759 / 0.9683
hB-l6-indep-bb / bb-lr16x / bb-lr1x (re-binarization between layers)0.3910 / 0.3331 / 0.1771

When it holds: in pure DLGN with no front-end NN, using the independent (sigmoid) parameterization, random fixed wiring, shallow layers (1–2), and a quarter as many LUT6 as LUT2. Under that condition the three-seed mean is +2.12pt with no overlap between the ranges. The LUT parameter counts are exactly equal — 2000×64 = 8000×16 = 128,000 — so it is a win at a matched parameter count. With four layers at the same gate count it is +7.19pt.

When it does not hold: with softmax left in place, N=6 is disadvantaged in principle (the learning rate cannot make it up). In the hybrid with a front-end NN it stays level with LUT2 (0.9759 vs. 0.9764). In other words, the “LUT6 cannot win” seen in HYBRID-3 through 4b was not a matter of expressiveness but of an implementation choice: the softmax parameterization.

Implemented in experiments/diagnose_lut_output_scale.py / train_dwn_lut_compare.py.

6. Deep diffusion (DD-1 through DD-6) — an MECE decomposition of shape × bypass × wiring

Section titled “6. Deep diffusion (DD-1 through DD-6) — an MECE decomposition of shape × bypass × wiring”

What was tried: with a matched budget of 4,000 gates and the front-end NN fixed at “256,120” (120-bit interface), sweep back-end shape, bypass source and wiring rule exhaustively (mnist20x20, 4–6 way parallelism on MPS, single seed). The controls (the paper configuration, pure DLGN) are const d4 at 0.8956 (reproducing the known 0.8994) and const d8 at 0.7932 (going deep in pure DLGN costs −10pt).

The diagram below is the expand-bypass form: solid arrows are the main path, dashed are bypasses.

graph LR
IN["mnist20x20<br/>raw input, 400 bits"]
F["front-end NN 256,64<br/>+ Sigmoid + Binarize(STE)"]
IF["interface, 120 bits<br/>(the m-front2 family uses 64 bits)"]
IN --> F --> IF
subgraph STACK["Back-end DLGN (matched budget of 4,000 gates; width expands per layer)"]
direction LR
D0["layer 0<br/>80 gates"]
D1["layer 1<br/>160 gates"]
D2["layer 2<br/>320 gates"]
D3["layer 3<br/>640 gates"]
D0 -->|"output bits of the previous layer"| D1 -->|"same"| D2 -->|"same"| D3
end
IF --> D0
IF -.->|"iface bypass:<br/>the interface bits join<br/>the input pool of every layer"| D1
IF -.-> D2
IF -.-> D3
IN -.->|"raw bypass: replenish what the<br/>front-end NN discarded, from the raw 400 bits<br/>(alone it collapses at −4.0pt;<br/>only together with the interface is it +0.1 to +0.34pt)"| D2
D0 -.->|"phase bypass: connect to the layer<br/>in the same phase of the previous cycle<br/>(works better the deeper it gets: d9 +0.81pt)"| D3
D3 --> GS["GroupSum k=10"] --> OUT["10-class scores (reals)"]
subgraph LEG["Legend"]
direction LR
LGR["orange = reals (the front-end NN, GroupSum)"]
LGL["green = logic (0/1 bits)"]
LGB["blue = the binary interface"]
end
style IN fill:#10b98126,stroke:#10b981
style F fill:#f9731626,stroke:#f97316
style IF fill:#38bdf826,stroke:#38bdf8
style D0 fill:#10b98126,stroke:#10b981
style D1 fill:#10b98126,stroke:#10b981
style D2 fill:#10b98126,stroke:#10b981
style D3 fill:#10b98126,stroke:#10b981
style GS fill:#f9731626,stroke:#f97316
style OUT fill:#f9731626,stroke:#f97316
style LGR fill:#f9731626,stroke:#f97316
style LGL fill:#10b98126,stroke:#10b981
style LGB fill:#38bdf826,stroke:#38bdf8

How to read it: every gate has a fan-in of only 2, so “what gets mixed into the input pool” is literally how many slots for the previous layer’s features you give up. That is why raw-input bypass lost across the board in pure DLGN (§1): only once the 120 high-quality wires of the front-end NN’s interface dominate the pool does a bypass help, and then only marginally (+0.1 to +0.34pt). On the wiring side, making the dashed edges a deterministic shift-by-one (shift1) gives const+shift1 at 0.9828, on par with random wiring — deep diffusion does not need random wiring, which is the practical payoff for FPGA implementation.

First, varying only how the back-end DLGN’s width is distributed across layers.

ShapeStructural ideabest hard
constconstant width (same form as the paper configuration)0.9804 (with raw_iface, 0.9838 = best of all 56 runs). 0.9828 even with shift1 wiring
expand2width doubles per layer (63→2030)0.9811
expand4 / expand8steeper expansion0.9620 / 0.9689 (layer 0 is a width-10 bottleneck, 16.7% coverage)
shrink+input_allcontracting shape (2035→60)0.9723
cycle (cyc6/9/12)repeating small→medium→large (190→381→765)0.9822 / 0.9750 / 0.9704 (monotonic degradation)
cycle + phaseconnect to the same-phase layer of the previous cycle0.9831 (d9). Single-peaked: d6 0.9804 / d12 0.9800 / d15 0.9784
hourglassVAE-style large→small→large (1146→286→1140)0.9812–0.9829 (mirror + raw_iface / amplitude 8:2:1). All 6 configurations beat expand2
diamondsmall→large→small (286→1143→290)0.9780 / 0.9786 (mirror). The direction of the shape matters: hourglass > expand2 > diamond

Next, holding the shape fixed and varying where bypasses come from and how nets are assigned.

VariationWhat it isbest hardWhat it showed
chain / input_all / none / far_firstdifferent bypass sources from the interface bits0.9822 / 0.9820 / 0.9811 / 0.9800Within 0.2pt, so little significance
phaseconnect to the same phase of the previous cycled9 +0.81pt / d12 +0.96pt / d6 −0.18ptThe more repetitions, the more it helps = a mechanism that grants depth tolerance
mirrorU-Net style: later layers ← the mirrored earlier layer+0.08pt aloneWhat helped was combining it with raw_iface and increasing the amplitude
raw (raw-input bypass)replenish what the front-end NN discarded from the raw 400 bitsconst+raw_iface 0.9838A small gain, on the order of +0.1–0.34pt
raw only (replacing the interface)use only the raw input0.9418 (−4.0pt, collapse)The main information is the front-end NN’s interface bits; raw input is auxiliary
shift1deterministic wiring with a shift of 1const+shift1 0.9828 ≈ randomRandom wiring is unnecessary in deep diffusion (a gain for FPGA implementation)
shift1 + a wider poolcombined with raw_iface (520-bit pool)0.8810 (collapse at 10% coverage)The condition for applying it is “pool width ≤ gate count”

Scaling laws — both depth and budget saturate early

Section titled “Scaling laws — both depth and budget saturate early”

Depth (expand2+iface, fixed at 4k) gives d2 0.9816 / d4 0.9804 / d6 0.9820 / d8 0.9810 / d12 0.9814, i.e. completely flat (robust to depth, in contrast to pure DLGN’s −10pt collapse, but with zero gain too). Budget (cyc9-phase) gives 1k 0.9793 / 4k 0.9831 / 16k 0.9809 / 64k 0.9812, so it saturates at 4k (64k shows signs of overfitting). The conclusion is that with MNIST and a 120-bit interface, roughly 4,000 gates and 0.983 is the ceiling, and the bottleneck is not back-end capacity but the interface width or the front-end NN.

What happens when the front-end NN is removed (DD-6)

Section titled “What happens when the front-end NN is removed (DD-6)”

In the pure-DLGN version wired directly to the raw 400 bits, pure-hg-amp-mirror 0.8991 / pure-hg 0.8988 / pure-hg-mirror 0.8850 / pure-hg-mirror-inp 0.8688 / pure-exp2 0.8665 / pure-dia-mirror 0.7913. The hourglass is the best shape even in pure DLGN (footing-independent), but mirror bypass and raw-input bypass are counterproductive in pure DLGN (re-confirming the clean sweep of losses in the input-bypass family). The gain from mirroring presupposes a front-end NN (a compressing interface), and the roughly 9pt gap between the hybrid’s 0.9820 and the best pure run’s 0.8991 cannot be filled by shape or bypass.

As a calibration of execution efficiency, 4-way MPS parallelism cost zero it/s per run, and even 6-way stayed at −3 to −5% (63.5–65.6 it/s) — 26 runs in 42 minutes, 16 runs in 44 minutes.

wandb groups deep-diffusion-v1 through v6. Implemented in experiments/train_deep_diffusion.py.

7. Checkerboard hybrid conv (CHECKER-1/2/3) — the placement itself is what works

Section titled “7. Checkerboard hybrid conv (CHECKER-1/2/3) — the placement itself is what works”

What was tried: split the conv’s output positions into a checkerboard, with the even positions going through an ordinary Conv2d (GPU) and the odd positions through a conv-DLGN (a depth-3 logic tree, the fixed softmax16g, an STE interface + rezero + separate BN per half). CIFAR-10, Modal A10G, single seed.

Seen from above, one block’s output feature map looks like this.

Output position (i, j) is painted in two colors by (i + j) % 2, and each color is filled by a different compute unit. Below is the actual assignment over an 8×8 output map (the 50% checkerboard).

i \ j01234567
0🟧🟩🟧🟩🟧🟩🟧🟩
1🟩🟧🟩🟧🟩🟧🟩🟧
2🟧🟩🟧🟩🟧🟩🟧🟩
3🟩🟧🟩🟧🟩🟧🟩🟧
4🟧🟩🟧🟩🟧🟩🟧🟩
5🟩🟧🟩🟧🟩🟧🟩🟧
6🟧🟩🟧🟩🟧🟩🟧🟩
7🟩🟧🟩🟧🟩🟧🟩🟧

🟧 = ordinary Conv2d (real-valued, GPU) / 🟩 = conv-DLGN (a tree of logic gates). Both see the same input and fill different output positions (no overlap, no gaps). The GPU covers only half the positions, so conv_macs is 0.5. The “channel split” comparison is also 50%, but both fill every position and are separated along the feature dimension; that lands at the plain average (0.5766) — so what works is not mixing as such but the alternating spatial placement itself.

The implementation is experiments/train_checker_conv.py on the experiment branch; the diagram below sketches the components.

graph LR
X["input feature map<br/>(B, C, H, W) reals"]
subgraph EVEN["Even positions (i+j even)"]
direction LR
CV["Conv2d 3×3<br/>a real-valued inner product"]
BN1["BatchNorm (even half only)"]
CV --> BN1
end
subgraph ODD["Odd positions (i+j odd)"]
direction LR
STE["Sigmoid → Binarize(STE)<br/>= the interface that turns the input into bits"]
DL["conv-DLGN<br/>a depth-3 logic tree<br/>softmax16g (fixed version)"]
BN2["BatchNorm (odd half only)"]
RZ["ReZero: α × output<br/>α starts learning from 0<br/>(removing it costs −2.3pt)"]
STE --> DL --> BN2 --> RZ
end
X --> CV
X --> STE
BN1 --> MRG["checkerboard merge<br/>back into one (B, C', H, W)"]
RZ --> MRG
MRG --> NXT["to the next block"]
subgraph LEG["Legend"]
direction LR
LGR["orange = reals (Conv2d, BatchNorm)"]
LGL["green = logic (0/1 bits)"]
LGB["blue = the binary interface / a join with no learned parameters"]
end
style X fill:#f9731626,stroke:#f97316
style CV fill:#f9731626,stroke:#f97316
style BN1 fill:#f9731626,stroke:#f97316
style STE fill:#38bdf826,stroke:#38bdf8
style DL fill:#10b98126,stroke:#10b981
style BN2 fill:#f9731626,stroke:#f97316
style RZ fill:#f9731626,stroke:#f97316
style MRG fill:#38bdf826,stroke:#38bdf8
style NXT fill:#f9731626,stroke:#f97316
style LGR fill:#f9731626,stroke:#f97316
style LGL fill:#10b98126,stroke:#10b981
style LGB fill:#38bdf826,stroke:#38bdf8

BN is separated per half because a real-valued Conv and a logic tree have completely different output statistics. The learned-gate variant (gated) never discovered this checkerboard pattern (it converged to a smooth content mixture with a checkerboard score of ≈ 0.0001–0.0003, hard 0.6741). The checkerboard is a prior structure that lies outside the reachable region of gate learning and has to be supplied by hand.

CHECKER-1 — beating both the plain average and the all-CNN control

Section titled “CHECKER-1 — beating both the plain average and the all-CNN control”

First, comparing ways of mixing at 2 blocks and 20 epochs.

Configuration (CHECKER-1, 20ep, 2 blocks)best hardsoft–hard gap
checker (50% checkerboard)0.7173≈0
checker-norez (no rezero)0.69460.015
checker-75 (75% DLGN)0.68130.003
cnn (all-CNN control)0.67100
channel (50% channel split)0.57660.193
dlgn (all conv-DLGN)0.47400.173

The checkerboard beats the plain average (0.572) by +14.5pt and even beats the all-CNN control by +4.6pt — this is synergy, not interpolation. The channel split lands at roughly the plain average, which shows that what works is not “mixing” but the spatially alternating placement itself. checker-75 exceeds all-CNN with a quarter of the GPU computation. rezero is worth +2.3pt.

Next, checking whether any placement other than the checkerboard can win, across eight variants.

Placement variation (CHECKER-2)best hardconv_macs ratio
(reference) 50% checkerboard0.71730.5
cross (mutual injection)0.67781.72
gated (learned gate)0.67411.02
(reference) all-CNN0.67101.0
freq-swap (CNN = full resolution / DLGN = low resolution)0.65401.0
boost-half (dense addition at matched compute)0.65280.69
boost (dense addition)0.63501.0
freq (CNN = low frequency / DLGN = high frequency)0.55600.25

The fixed checkerboard wins across every placement, and the frequency-splitting hypothesis is rejected. What stands out is that the learned gate never discovers the checkerboard (it converges to a smooth content-wise mix, with a checkerboard-ness score of ≈0.0001–0.0003) — the checkerboard is a good structural prior that lies outside the reachable region of gate learning. Dense addition falls short even with compute equalized, so the source of the synergy really was the exclusive, spatially alternating placement itself.

CHECKER-3 — how far it goes when stacked deep

Section titled “CHECKER-3 — how far it goes when stacked deep”

Finally, with data augmentation, 30 epochs, and up to 9 blocks.

Going deeper (CHECKER-3, augment + 30ep)best hard
cyc6-phase-cnn (all-CNN, 6 blocks, cycle+phase)0.8525
cyc9-phase (checkerboard, 9 blocks, 3 cycles, +phase)0.8512
cyc6-phase (checkerboard, 6 blocks)0.8281
plain6 (checkerboard 6, monotonically growing channels)0.8267
cyc6-nophase (checkerboard 6, no skip)0.8247
base-aug (checkerboard, 2 blocks + aug)0.7660
cnn-aug (all-CNN, 2 blocks + aug)0.7118

The checkerboard’s CIFAR-10 mark of 0.8512 is a new record for the hybrid families (+6.48pt over HYBRID-2’s 0.7864, +13.39pt over CHECKER-1). In shallow configurations the checkerboard’s advantage persists (+5.42pt at 2 blocks), but in deep configurations the advantage disappears and it becomes even (checkerboard 9blk 0.8512 ≈ all-CNN 6blk 0.8525). The claim therefore has to move from “it wins” to “it reaches the same accuracy with half the GPU computation”. caveat: the 9-block all-CNN control was not measured, and this is a single seed.

wandb group checker-conv-v1. Implemented in experiments/train_checker_conv.py.

8. Inside a Transformer / ReZero (GPT-FFN-1/2, RES-LN-1/2)

Section titled “8. Inside a Transformer / ReZero (GPT-FFN-1/2, RES-LN-1/2)”

What was tried: two strands — (a) replace only nanoGPT’s FFN with a LUT network (attention, LayerNorm and the residual stay real-valued; a Linear+Sigmoid → Binarize(STE) interface is raised at the FFN’s entrance and converted back to real values at its exit before being added to the residual), and (b) on the vision side, separate the three hypotheses of residual, LayerNorm and zero-init.

GPT-FFN-1 — replacing the FFN with LUTs works

Section titled “GPT-FFN-1 — replacing the FFN with LUTs works”

First, replacing a language model’s FFN and comparing LUT2 against LUT6.

GPT-FFN-1 (shakespeare-char, d=128, 4 blocks, 5,000 iters)best val_pplparams (of which LUT)
MLP control4.62528k (0)
LUT2 (softmax, 128-256-128)6.94455k (24.6k)
LUT6 (independent, x1,x2,x1)9.01528k (98.3k)
LUT6 (independent, x2,x4,x2)8.90758k (197k)

Replacing the FFN with DLGN works in itself (no divergence, no NaN, monotone improvement). Doubling the width only moves 9.01 → 8.90, so capacity is not the bottleneck. Here LUT2 beats LUT6 by +2.07 ppl, the opposite sign from the pure-DLGN conclusion (the third example of “which of LUT6 and LUT2 wins flips with the footing”).

Next, isolating residual, LayerNorm, and zero-init one at a time on the vision side.

RES-LN-1 (mnist20x20, 8,000 iters)best hardgapRole
mlp-ctrl (an MLP block of the same structure, 1.37M parameters)0.98650An indication of the ceiling
rezero-n2 (residual + LN + α zero-init)0.95830.023Best in the family
seq-ln-n2 (sequential = no residual)0.94280.053H1 control
res-nonorm-n2 (residual, no norm)0.93350.050H2 control
res-ln-n2 (residual + LN, α=1)0.91060.086The straightforward port
rezero-n6 (LUT6 independent)0.89500.150
res-ln-n6 (LUT6, α=1)0.68490.294

Hypothesis verdicts: H1 (residual = a gradient highway) is conditionally rejected (a residual with α=1 loses to the sequential version by −3.2pt). H2 (LayerNorm helps) is rejected (−2.3pt). H3 (zero-init helps) is strongly supported (LUT2 +4.8pt / LUT6 +21.0pt, with the gap also halved from 0.294 to 0.150). The decisive corroboration is that the rescue is largest exactly for LUT6, whose initial output variance is largest. So what worked was neither the residual nor the LayerNorm, but the zero-init of α.

RES-LN-2 — decomposing LUT6’s disadvantage into two factors

Section titled “RES-LN-2 — decomposing LUT6’s disadvantage into two factors”

The sweep (RES-LN-2) decomposed LUT6’s disadvantage into two factors, “initial output noise” and “insufficient learning rate”, and treating both — rezero-n6 + lut-lr 0.05 — reached 0.9711 (gap 0.008), overturning LUT2’s best of 0.9658 (and effectively level with the directly connected hybrid at 0.9714). Depth and interface width, on the other hand, were counterproductive across the board, so “add rezero and you can stack deep” does not hold (rezero-n6-B8 is 0.8870, gap 0.145).

GPT-FFN-2 — ReZero works in language too

Section titled “GPT-FFN-2 — ReZero works in language too”

Finally, porting the ReZero recipe found on the vision side straight into the language domain.

GPT-FFN-2 (porting to the language domain)itersbest val_ppl
MLP control15,0004.21
LUT2 softmax + rezero15,0005.37
LUT2 softmax + rezero5,0005.85
LUT2 independent + rezero5,0006.13
LUT6 independent + rezero5,0006.61
LUT6 indep + rezero + double width5,0006.61
LUT2 independent (no rezero)5,0007.50
LUT6 softmax (no rezero)5,0008.22

ReZero holds in language too (LUT2 −1.09 / LUT6 −2.40, with the largest rescue at LUT6 — the same form as in vision), and at 15,000 iters the residual gap to the MLP control halves from 2.32 to 1.16 ppl. The rule of thumb “softmax for N=2, independent for N≥6” is supported in language as well. The ranking does not flip, though: in language LUT2 still wins.

wandb groups gpt-ffn-dlgn / residual-ln-v1 / residual-ln-v2. Implemented in experiments/train_nanogpt_ffn_dlgn.py / train_residual_dlgn.py.

9. Akiho Propagation (BP-free) and its interaction with skips (AP-1)

Section titled “9. Akiho Propagation (BP-free) and its interaction with skips (AP-1)”

What was tried: compare Akiho Propagation (AP) — a learning rule that distributes the error to every layer through a reachability map, without backprop — directly against BP on pure DLGN, with a matched gate budget of 4,000, 15,000 iters, mnist20x20. The interaction with connection structure (none / input_all / chain / OR residual) is examined too. Learning rates are bp=0.03 / ap=0.1, and the parameterization is bp=softmax (16 per gate) / ap=independent (4 per gate, as AP requires).

run-tagruledepthConnectionbest hardsoftgap
ap1-bp-d2bp2none0.91500.9147−0.0003
ap1-ap-d2ap2none0.84030.8593+0.0189
ap1-bp-d4bp4none0.89700.8976+0.0013
ap1-ap-d4ap4none0.81800.8362+0.0182
ap1-bp-d4-inpbp4input_all0.87750.8772−0.0003
ap1-ap-d4-inpap4input_all0.81850.8329+0.0144
ap1-ap-d4-chainap4chain0.81320.8246+0.0114
ap1-bp-d4-resbp4OR residual0.87760.8784+0.0008
ap1-ap-d4-resap4OR residual0.39120.4442+0.0530
ap1-ap-d2-inpap2input_all0.84300.8578+0.0147

What it showed: the gap between AP and BP is a stable −6 to −8pt regardless of configuration. Even so it learns from chance at 0.10 up to 0.82–0.84, so “BP-free still reaches a usable range” is re-confirmed. The value of skips does not change with the learning rule (input bypass is useless under both rules — endorsing deep diffusion’s DD-6 conclusion as learning-rule-independent).

The one interaction is the OR residual. With BP it costs only −1.9pt, but with AP it is a catastrophic −42.7pt. Because AP scatters the same output error value to every layer through the reachability map, an OR merge causes reachable paths to explode (the number of reachable pairs at layer 0 goes 7,987→26,714), so the error saturates and is counted multiple times. Depth is d2 > d4 under both rules. The soft–hard gap is ≈0 for BP but +0.011 to +0.019 for AP (+0.053 for the OR residual), so AP’s weights are somewhat less tolerant of binarization.

Note: the BP side uses softmax, so at the same gate count it has 4× the parameters (64,000 vs. 16,000); this is an equal-gate-budget comparison, not a matched-parameter one. Single seed. As a by-product, a problem was found and fixed where the Modal image was missing the figures extra (matplotlib/pillow), so any training script that emitted figures hit an ImportError.

wandb group ap-mnist-v1 (tags series:AP-1). Implemented in experiments/train_ap_mnist.py.

10. Extending to other tasks (U-Net / VAE / DenseNet)

Section titled “10. Extending to other tasks (U-Net / VAE / DenseNet)”

10.1 LogicUNet (UNET-1) — skips only help dense prediction

Section titled “10.1 LogicUNet (UNET-1) — skips only help dense prediction”

What was tried: build both encoder and decoder out of LutConv2d (zero real-valued arithmetic), with skips concatenating the encoder’s same-resolution output into the decoder. The classification variant swaps the head for “LUT conv → spatial sum → GroupSum (τ=√(head_group·H·W))”. Because LutConv2d’s parameter count does not depend on the number of input channels, the parameter count is unchanged with or without skips, so the ablation is automatically at a matched budget (15,745 / 15,745).

SegmentationDataskipepochbest IoUFinal test IoUtest Dice
u1-seg-mnistmnist-maskyes100.82030.81070.8955
u1-seg-mnist-noskipmnist-maskno100.65790.63920.7799
u1-seg-petpet64yes400.55120.51620.6809
u1-seg-pet-noskippet64no400.55800.46540.6352
u1-seg-pet-n6pet64yes (LUT6)400.58130.53640.6982
ClassificationDataConfigurationParametersbest test accsoft
u1-cls-mnist-unetMNISTU-Net (with skips)19,2100.68700.8652
u1-cls-mnist-noskipMNISTU-Net (no skips)19,2100.73480.8914
u1-cls-mnist-encMNISTencoder only19,2000.73880.7609
u1-cls-cifar-unetCIFAR-10U-Net (with skips)71,4340.25980.4517
u1-cls-cifar-noskipCIFAR-10U-Net (no skips)71,4340.24500.4837
u1-cls-cifar-encCIFAR-10encoder only71,4240.38140.4080

What it showed: a decoder plus skips “helps dense prediction”; it is not “a good structure in general”. With the same implementation and the same parameter count, the sign flips: +16.24pt on dense prediction, but −5.18pt on classification (MNIST) and −12.16pt (CIFAR). What skips carry is positional information, which is the answer itself in dense prediction and information you want to throw away in classification. On pet64 the effect of skips disappears (a 3.0pt spread, with the order reversed), and moving to LUT6 helped most instead (0.5813) — on harder data, expressiveness per gate matters more than structure. The 19pt soft–hard gap in CIFAR-10 classification remains unexplained. caveat: all 11 runs listed are single-seed (duplicate runs and runs that terminated early are not listed).

wandb group unet1 (tags series:UNET-1). Implemented in experiments/unet1_common.py / train_unet1_classify.py / train_unet1_seg.py (the library itself is untouched; only monkey-patched).

10.2 LogicVAE (VAE-1) — a binary latent is cheap, logic-izing the network is expensive

Section titled “10.2 LogicVAE (VAE-1) — a binary latent is cheap, logic-izing the network is expensive”

What was tried: input thermo4 → encoder, 3 LUT layers × 1024 → GroupSum → an ST-Bernoulli binary latent z∈1⁶⁴ → decoder, 3 LUT layers × 1024 → GroupSum → 784-pixel logits. Real-valued arithmetic appears only at the two GroupSums. It exploits the fact that sampling a Bernoulli latent, z = 1[q > u], is itself a comparator, which avoids the reparameterization μ+σ·ε (multiplication and square root) that suits logic circuits worst. binarized MNIST / Fashion-MNIST, 50ep, seed 0.

runConfigurationParameterstest ELBOreconKLactive bits
v1-float-gauss64real-valued MLP, continuous 64-dim latent1,953,68088.7671.9816.78—
v1-float-bernreal-valued MLP, Bernoulli latent1,920,84892.2174.9017.310.651
v1-float-gauss16real-valued MLP, continuous 16-dim latent1,879,85693.5477.7915.75—
v1-float-bern-matchreal-valued MLP, Bernoulli latent, matched parameter count208,550104.52 (seed1/2: 102.18 / 104.00)87.5416.020.692
v1-logic-n6LogicVAE, LUT6/independent, lr 0.05 (the winning prescription)828,240142.85 (seed1/2: 145.71 / 141.40)127.5515.300.719
v1-logic-baseLogicVAE, LUT2/softmax207,696218.47208.559.920.919
v1-logic-hgLogicVAE, hourglass shape224,080223.92214.489.440.929
v1-logic-lronlylr 0.05 only207,696233.01222.7810.230.915
v1-logic-n6onlyLUT6 + independent only828,240235.78225.859.930.931
v1-logic-beta4LUT2/softmax, beta=4207,696241.14231.659.490.941
v1-logic-fashionLogicVAE, Fashion-MNIST207,696274.56262.3912.170.851
v1-float-bern-fashionreal-valued MLP, Bernoulli latent, Fashion1,920,848136.16119.3116.850.665

What it showed: LUT6 + independent + a raised learning rate (the prescription obtained from the ReZero and LUT6 families) is decisive for generative models too (−75.63 nat, the largest improvement in the family). Factoring it out, neither n6 alone (235.78) nor lr alone (233.01) does anything: the combination is required. Also, the cost of binarizing the latent is small (gauss64 88.76 vs. bern 92.21 = +3.5 nat), whereas the cost of turning the network into logic gates is +38 to +39.75 nat at a matched parameter count and matched latent (bern-match 104.5 vs. logic-n6 142.8) — the main source of the gap is on the network side. The hourglass shape and β=4 are ineffective to harmful. On Fashion the gap widens (+138 nat). No run shows posterior collapse (active_bits 0.65–0.94). That said, in v1-logic-n6only all 64 cells of the prior generation are the same image, and the logged images are identical at the file level — a sign that the decoder is barely using the latent bits. As for novelty, a logic-gate VAE remains a world first as of 2026-09 (zero hits in a full-text arXiv search, plus unified-framework surveys corroborating the absence of generative models).

wandb group vae1 (16 runs). Implemented in experiments/train_vae1.py.

10.3 Logic-DenseNet (DENSE-1) — a footing where concat is free

Section titled “10.3 Logic-DenseNet (DENSE-1) — a footing where concat is free”

What was tried: input thermo → DenseBlock (3 layers, concat) → transition (1×1 + pool) → DenseBlock (3 layers, concat) → GroupSum, with bottleneck 1×1 → LUT conv 3×3 (growth rate k). The key to the footing is that in logic gates concat is completely free (it just bundles wires and consumes no gate at all), and the three arms — dense / plain / pyramid — were compared at a matched budget (±0.16%, with an assert on exact gate-count agreement).

tagBudgetbsReachedbest hardStatus
d1-mnist-pyr146,27212830ep0.9679Completed
d1-mnist-dense146,18612830ep0.9647Completed
d1-mnist-plain146,18612830ep0.7833Completed (a wide divergence: soft 0.9669 ⇔ hard 0.7543)
d1-cifar-pyr399,952128100ep0.5902Completed (−1.4pt vs. the literature’s 60.4%)
d1-cifar-dense400,2643261ep0.5671Cut short at 24h
d1-cifar-plain400,2643261ep0.3948Cut short at 24h. The best is at epoch 3, flat afterwards
d1-cifar-pyr-b2799,90464100ep0.6130Completed (13.7h)

What it showed: the effect of dense connections is real (MNIST plain 0.7833 → dense 0.9647 = +18.1pt, CIFAR 0.3948 → 0.5671 = +17.2pt). What the failure actually consists of is the divergence “soft can learn but it does not survive going hard”, and concat provides tolerance of discretization by acting as a highway for gradients and information (the same form as the bypass findings in the deep-diffusion family). Even so, at a matched budget it does not reach the pyramid (CDDLGN) type (−0.3pt on MNIST, −2.3pt on CIFAR). And if you are going to spend more budget, spend it on pyramid, not dense (0.40M dense 0.5671 vs. 0.80M pyr-b2 0.6130 = +4.6pt). caveat: dense / plain were cut short at 61ep by the 24h timeout (pyramid completed 100ep), so those are provisional values at unequal epochs; bs also differs between arms to avoid OOM (pyr 128 / dense, plain 32 / pyr-b2 64); single seed. Five of the 12 runs are effectively failed runs caused by OOM. The one remaining blank is dense-b2 (0.80M) — a direct comparison against pyr-b2 at a matched budget and matched bs.

wandb group logic_densenet. Implemented in experiments/train_logic_densenet.py.

11. FPGA gate budget and power (web survey)

Section titled “11. FPGA gate budget and power (web survey)”

What was tried: assuming the results above are to be put on an FPGA, survey the literature for the going rates on gate budget, packing and power (this is not measured).

QuestionConclusion
Can the CNN front-end fit on an FPGA?Yes. With hls4ml (7-bit QAT) a conv front-end of the same scale runs at 5.2µs / about 194k img/s, using 12.8% of the LUTs and 2.5% of the DSPs on a VU9P. The PCIe round trip disappears (first priority)
Can the CNN be turned into DLGN?It can, but at one million gates CIFAR-10 is ≈65% (interpolating LogicTreeNet). MNIST-class is 99.23% at 566K gates = within budget
The best move for budget efficiencyGoing to 6-LUT neurons. One million two-input gates ≈ 430k LUT6 equivalents, and FPGN-6-L reaches 76.72% on CIFAR-10 with 434k LUTs (+12pt over two-input)
Do one million gates physically fit?Spatially unrolled, an estimated 330k–500k LUTs → on a VU9P-class device (1.18M LUTs) no folding is needed. Folding is only required for edge deployment
Folding the conv stageEssentially free (the truth tables are already shared across spatial positions; even at 16M gates the unique count is 16k gates ≈ 5,500 LUTs. fold = H·W = 1024, about 195k img/s at 200MHz)
Folding the FC stageThe condition is “sharing wiring patterns across layers (going butterfly)”. Left as random wiring it breaks against a 44Mbit instruction-memory wall
The implementation cost of random wiringPost-P&R, HPWL is 3.5× and Fmax stops at 298MHz (structured wiring reaches 526MHz) = it multiplies the implementable frequency by 0.57
The trade-off formulaT·G ≤ f_clk · p · L / r (T = samples/s, G = gate count, p = packing rate [gate/LUT], L = LUT count, r = fold overhead)

As for the going rates in the literature, LogicTreeNet (two-input gates) gives 0.40M (S) 60.4% / 1.0M (interpolated) ≈64–66% / 3.08M (M) 71.0% / 16M (B) 80.2% / 61M (G) 86.3%. The mandatory techniques are residual init (−9% without it), or-pooling (−3.5% without it), and limiting kernel inputs to 2 channels + splitting into k/8 groups (to avoid routing congestion). For the first layer, thermometer encoding (R=8, 96ch) is the only option (an 8-bit first layer costs 6.2× the LUTs, 96× the DSPs and 33× the latency; with thermometer the accuracy loss is 0.0pt).

Priority order: ① co-locating the conv front-end on the FPGA (PCIe disappears, a three-order latency improvement) > ② positional folding of the conv-DLGN > ③ going 6-LUT. The limit: the packing rate p is an estimate, and every area estimate is provisional until the Verilog under export/ is synthesized with Vivado and measured.

Where we stand within the family: for CIFAR, accuracy against gate count has LogicTreeNet’s log-linear line as its baseline (+11.9pt per 10× gates), and both difflogic and the learned-wiring family sit about +2.9pt off it in extrapolation — nobody has broken the line by an order of magnitude yet. The only thing confirmed to move the line is going 6-LUT. Conversely, binary/quantized CNNs use 29–56× more gate-equivalents for the same accuracy, so on gate efficiency alone the logic-network side is clearly ahead. Speed splits into two clusters, the ns class (fully unrolled, II=1) and the µs class (folding / quantized CNNs / GPU), with the 10²–10⁴ ns range in between essentially empty. And our hybrids and checkerboards are on a different footing — only the back-end DLGN part goes on that horizontal axis, and as long as a real-valued NN front-end remains, they cannot in principle join the ns-class cluster. A head-on comparison with the pure-gate camp only becomes possible once “DLGN-izing the conv stage + going 6-LUT” puts us on the baseline.