Skip to content

Glossary

Definitions of the vocabulary used across this project. The goal is that code, documentation, and conversation all use the same word for the same thing (a ubiquitous language). For background on the terms, see What is a DLGN? and Taxonomy and lineage.

Academic lineage Implementation in this library
──────────────── ──────────────────────────────
difflogic (2022) griffith_logic
│ 2 inputs fixed, softmax │ generalized to N inputs (N=2,4,6)
├─ DLGN ← fully connected ├─ LutLayer (fully connected)
├─ CDDLGN ← convolutional ├─ LutConv2d (convolution)
├─ RDDLGN ← RNN ├─ RDDLGN (seq2seq)
├─ LDDLGN ← lightweight ├─ iwp parameterization
├─ WARP ← WH transform ├─ warp parameterization
└─ CAGE ← better training └─ Hard-ST + temperature scheduler
BinaryBrain ─ independent parameterization ─→ independent / raw parameterization

1. Architecture names (from the literature)

Section titled “1. Architecture names (from the literature)”
TermFull nameSourceMeaning
DLGNDeep Differentiable Logic Gate NetworksPetersen et al., NeurIPS 2022A fully connected network that makes two-input logic gates differentiable via softmax. This library generalizes it to N inputs, so it is not DLGN itself
difflogic—same (the reference implementation’s name)The name of the official DLGN implementation repository. “difflogic-compatible” = N=2 + softmax mode
CDDLGNConvolutional DDLGNPetersen et al., NeurIPS 2024Convolution built from logic-gate trees. The design LutConv2d follows
RDDLGNRecurrent DDLGNBuhrer et al., 2025The RNN / seq2seq extension of DLGN
LDDLGNLight DDLGNRuttgers et al., 2025Lightweight variant using per-input parameterization (IWP)
WARPWAlsh Relaxation for Probabilistic LNNsGerlach et al., 2025Unconstrained optimization via the Walsh-Hadamard transform. Stable at N=4, 6
CAGEAlign Forward, Adapt BackwardKim, 2026Hard-ST training + adaptive temperature scheduling
DWNDifferentiable Weightless Neural NetworksBacellar et al., ICML 20246-input LUTs + learned wiring. EFD gradients
LogicNets—Umuroglu et al., FPL 2020An “arithmetic DLGN”: enumerates truth tables from quantization and sparsification
LL-ViT—Nag et al., ICFPT 2025A hybrid that turns only the ViT MLP into LUTs
BinaryBrain—ImamuraA framework for training LUTs directly (C++). Origin of the independent / raw parameterizations
NameWhat it doesInput/output
LutLayerA fully connected layer of N-input LUT gates. The smallest building block(B, in_dim) → (B, out_dim), values in [0,1]
LutConv2dA convolutional layer built from logic-gate trees(B, C, H, W) → (B, C', H', W')
DWNLayerBinary inputs → N-input LUTs × n_luts → binary outputs (EFD gradients). An independent layer, not a LutLayer parameterization(B, in_bits) → (B, n_luts), values in {0,1}\{0,1\}
NameWhat it doesUsed for
GroupSumSplits neurons into k groups, sums each, divides by temperature τthe output layer for classification
SpatialGroupSumGroupSum that preserves the spatial dimensionsthe head for detection
OrPooling2dMax pooling (= logical OR pooling)downsampling inside a CNN
NameWhat it does
BinarizeForward binarizes at a threshold; backward is a HardTanh STE
RealToBinaryBinarizes real inputs at several thresholds and expands them along the batch dimension (binary modulation)
BinaryToRealAverages the modulation frames back into real values
DifferentiableLutBlockA composite layer of LutLayer(raw) + BatchNorm1d + Binarize (BinaryBrain-compatible)

How a LutLayer’s weights WW are turned into gate outputs.

SchemeOriginFormulaParameters/gateCharacter
softmax (default)DLGNw=softmax(W)w=\mathrm{softmax}(W)2N2^NEntries compete (they sum to 1). At N=2 this is 16-gate mode
independentBinaryBrainw=σ(W)w=\sigma(W)2N2^NEach entry is independent (the sum ≠ 1)
iwpLDDLGN∏j[pjxj+(1−pj)(1−xj)]\prod_j [p_j x_j + (1-p_j)(1-x_j)]NNOne parameter per input. About a tenth of the parameter count
rawBinaryBrainw=clamp(W,0,1)w=\mathrm{clamp}(W,0,1)2N2^NKeeps the weights directly in [0,1]; clamped after each optimizer step
warpWARPy=σ(∑kθkφkWH(1−2x)/τ)y=\sigma(\sum_k \theta_k \varphi_k^{WH}(1-2x)/\tau)2N2^NUnconstrained real parameters on the Walsh-Hadamard basis. Recommended for stable training at N=4, 6
SchemeforwardbackwardSelection gapOrigin
soft (default)softmax mixture (weighted sum of all gates)the analytic softmax Jacobian> 0 (training ≠ inference)DLGN
hard_stargmax (a single gate is selected)STE approximation via softmax(W/τb)\mathrm{softmax}(W/\tau_b)= 0 (training = inference)CAGE
NameApproachHow the gradient is made
BPPyTorch autogradautomatic differentiation (standard SGD / Adam)
AP (Akiho Propagation)manual updatesw += error × basis × lr (no backpropagation)
DFA (Direct Feedback Alignment)error sent directly through fixed random matricesno sequential dependency between layers
EGGROLLevolution strategiesgradient-free search

Learning rules can be mixed per layer (with_learning + HybridTrainer).

TermDefinition
LUT (look-up table)A truth table storing the output for each input bit pattern. The basic building block of FPGAs / ASICs
N-input LUT / LUT-NA LUT with N inputs, holding 2N2^N entries (N=2, 4, 6 are supported)
LUT6A six-input LUT. The standard primitive in current FPGAs; N=6 mode maps onto one cell directly
n_inputs / NThe number of LUT inputs (fan-in). The argument name in the code
n_entriesThe number of LUT entries, =2N=2^N. N=2→4, N=4→16, N=6→64
16-gate modeActive only for N=2 + softmax. A softmax over the 16 two-input Boolean functions (AND, OR, XOR, …), fully compatible with difflogic
TermDefinition
Butterfly basisAn efficient recursive algorithm for the LUT basis functions. O(N⋅2N)O(N\cdot 2^N) (the naive implementation is O(22N)O(2^{2N}))
Binary regularizationloss = mean(w × (1-w)), pushing weights toward 0/1
Residual initializationInitially selects the “pass-through” gate in a gate tree, preventing vanishing gradients
STE (straight-through estimator)Discretize in the forward pass, pass gradients through a continuous approximation in the backward pass
TermDefinitionIn code
soft modeTraining mode. Outputs are continuous values in [0,1] and gradients flowmodel.train()
hard modeInference mode. Outputs are discrete values in {0,1}\{0,1\} — a pure logic circuitmodel.eval()
Discretization gap / selection gapThe performance difference between soft and hard outputs, acc(soft) - acc(hard)can be driven to 0 with Hard-ST
Forward alignmentThe principle that the training forward pass and the inference forward pass must match (CAGE)achieved with Hard-ST
SchemeDefinition
randomEach neuron picks N inputs at random (with repetition). The default; some inputs may end up unused
uniqueGuarantees that every input is picked at least once
TermDefinition
IR (intermediate representation)JSON that freezes the trained circuit. Holds truth tables + wiring + shapes, and is the source of truth: everything downstream (HDL generation, the editor, resource estimates) looks only at the IR
loweringExpanding native nodes such as conv2d / or_pool2d into a sequence of lut_layer nodes. The stage before HDL generation
simulateThe golden model that runs the IR bit-exactly under numpy. The reference for equivalence checking
Three-way equivalence“PyTorch hard eval ⇔ simulate ⇔ HDL simulation” agreeing on every vector
Resource estimateA synthesizer-independent first-order count of LUTs, logic depth, and wires taken from the IR
TermDefinitionRelation to this project
Differentiable circuitRelaxing a circuit into something continuous and differentiable, then optimizing it by backpropagationThe core technology; LutLayer is its implementation
FPGAA reprogrammable logic device whose basic building block is the LUTA trained model in hard mode maps onto it directly
Sovereign AIAI that closes inside your own country or organization without depending on the cloudFPGA inference gives low cost, low power, and data sovereignty

“LUT-Network” vs. “DLGN”

LUT-NetworkDLGN
What it namesa general category of NNs built from LUTsthe specific method of Petersen et al. (2022)
Coverageincludes BinaryBrain, difflogic, and this librarytwo inputs + softmax + fully connected only
When to use itas a technical categoryas a citation

“difflogic” vs. “DLGN” — the former is an implementation (a repository name), the latter a method (a paper). Use difflogic when comparing code, DLGN in academic citations.

“softmax parameterization” vs. “DLGN” — the former is a flag in the code, the latter the whole method of “a fully connected architecture + softmax”.

“Hard-ST” vs. “CAGE” — the former is a gate selection scheme based on an STE (selection='hard_st'), the latter the whole training method of “Hard-ST + adaptive temperature scheduling”.