Weightless Classifiers Designed Around the Cost of Encrypted Lookups

When a client sends encrypted data to a cloud classifier, the server must compute on ciphertexts it cannot read. Under the encryption scheme best suited to this, TFHE (a lattice scheme whose ciphertexts hold small integers), the costs are lopsided. Adding ciphertexts is nearly free. Applying any non-linear function costs one programmable bootstrap: a heavy operation that evaluates an arbitrary small lookup table on an encrypted input while also clearing the noise that encryption accumulates. Weightless neural networks are classifiers built entirely from lookup tables. Groups of input bits form an address into a small memory, and the class scores are counts of the memories that fire. The match looks obvious: one memory lookup becomes one bootstrap, and counting becomes free addition.

Our claim is sharper than "port a weightless network to TFHE." Every existing weightless design was tuned for plaintext hardware, where adders are expensive and lookups are cheap. For that reason, Differentiable Weightless Neural Networks replace popcount summation with pyramids of learned reduction tables. Under TFHE the cost structure reverses: summation is close to free and every table costs a bootstrap. We propose to train lookup-table classifiers directly against a TFHE cost model. Each table's input width is capped at what one bootstrap can handle, all aggregation is done by ciphertext addition, and the model's real budget is the number and precision of bootstraps. The central test is whether such a network reaches higher accuracy per bootstrap than a binarized perceptron network given the same budget in the same library. Binarized networks are the established discrete approach for encrypted inference, as shown by TAPAS.

Core Claim and Why It Is Not Already Done

The research file contains no work that runs a WiSARD-style classifier (the classic weightless design: per-class sets of memories addressed by fixed groups of input bits, called n-tuples) inside homomorphic encryption. The two nearest works each stop short of it. Time-Memory Trade-off Algorithms for Homomorphically Evaluating Look-up Table in TFHE supplies the method. It decomposes large encrypted lookup tables into shared sub-functions and reports a 17.9x speedup for 8-bit Boolean functions via a conjunctive-normal-form decomposition. Its tables, however, are randomly generated functions with no classifier attached. TAPAS supplies the main competitor. It evaluates binarized dot products as encrypted XNOR gates followed by adder trees, and reaches 98.6% on MNIST with a 29x speedup over prior work. Its model remains a perceptron.

Our contribution is neither of these. It is a co-design argument with a falsifiable prediction. A TFHE bootstrap evaluates an arbitrary function of its few input bits, but a binarized neuron uses each bootstrap only for a threshold, which is a tiny subset of the functions it could compute. If accuracy is limited by how much non-linear computation each bootstrap does, lookup-table nodes should win at equal budget. If accuracy is limited by fan-in, meaning how many input bits each non-linear unit can see, binarized neurons should win, because their free weighted sum lets one bootstrap summarize many inputs. We do not know which effect dominates, and the experiment is designed to find out.

The cost model makes the tension explicit. Let layer $l$ use $m_l$ bootstraps at message precision $p_l$ bits, and let $t(p)$ be the measured wall-clock cost of one bootstrap at precision $p$. Then single-query latency on $P$ parallel cores is approximately

$$ T \approx \frac{1}{P}\sum_{l} m_l \, t(p_l). $$

The cost $t(p)$ rises steeply with $p$, because the ring dimension must grow to hold more message bits. This produces a second, less obvious constraint. Summation is free in compute but not in precision. Summing $k$ binary node outputs needs $\lceil \log_2(k+1) \rceil$ bits of message space, so very wide free sums force larger parameters and make every bootstrap in the circuit slower. Training against $T$ therefore means choosing tuple width, number of nodes, and how widely to sum before re-bootstrapping. None of these choices has been studied.

Two of the file's candidate gaps mostly disappear under this threat model, and we say so plainly. In prediction-as-a-service the server's tables are plaintext. Bleaching, which thresholds memory counts to break ties (wisardpkg), is applied to the table before it is used inside the bootstrap, so it costs nothing encrypted. Bloom-filter compression (Memory Efficient Weightless Neural Network using Bloom Filter) shrinks plaintext table memory. Under encryption it would require hashing encrypted addresses, which is costly. Capping tuple width at bootstrap precision makes tables small anyway, so we drop hashing rather than pursue it.

Research Program

The setting is non-interactive inference. The client encrypts its binarized input under its own TFHE key. The server holds the trained tables in plaintext and returns encrypted per-class scores, and the client decrypts and takes the argmax. We also measure a variant that takes the argmax under encryption, using comparison bootstraps decomposed with the Narisada et al. method, because some deployments must not reveal scores.

The work has three parts.

The first part builds the encrypted primitive. Each n-tuple's bits are combined into one encrypted integer by a free linear combination with powers of two. One bootstrap then returns that node's table output. Where all classes share an address, we evaluate the per-class tables of that node using shared-subfunction decomposition rather than one bootstrap per class.

The second part trains FHE-shaped networks. We use the differentiable training of DWNs, whose finite-difference gradients over discrete tables let multi-layer lookup networks be learned with backpropagation in plaintext, with three changes. Tuple width is capped at the bootstrap precision. Reduction pyramids are removed in favour of free encrypted sums. A penalty from the cost model above discourages layers whose summation width would force higher precision. The mapping from inputs to tuples, which DWN learns and then freezes, is kept.

The third part is a controlled comparison. TAPAS-style binarized networks, sweeping the same latency budget, are trained and run in the same library, on the same machine, under the same security level.

Encrypted training is out of scope here. Writing to an encrypted address requires touching every cell of a memory, which is a separate problem.

Baselines

The naive reference point has two parts. The first is a classic single-layer WiSARD with bleaching, ported directly: one bootstrap per node per class, tuple width chosen as in the plaintext literature. The second is its plaintext accuracy, which bounds what encryption can preserve. A useful anchor for the gap between weightless and conventional models is that uncompressed WiSARD reaches 91.7% on MNIST in plaintext according to Bloom WiSARD. Beating this baseline means matching its accuracy at lower encrypted latency, or exceeding its accuracy at equal latency.

The strongest competitor is a binarized perceptron network in the style of TAPAS. It is the established discrete design for encrypted prediction, and its weighted sums use exactly the free addition our method relies on. TAPAS reports 98.6% MNIST accuracy and 3.5-second encrypted predictions on UCI Cancer and Diabetes. Those numbers come from a different library and different hardware, so we reimplement it rather than compare against reported figures. We train binarized networks at matched bootstrap counts and matched precision, with the same input binarization, the same hyperparameter search budget in GPU hours, and the same core count. Beating it means a better accuracy-versus-latency curve on the majority of datasets, with the gap larger than seed-to-seed variance over five training runs.

The throughput-oriented reference is CryptoNets. It replaces activations with squaring under a batched arithmetic scheme and reports 99% MNIST accuracy, 58,982 predictions per hour, and 250 seconds latency per batch of 4,096. We report against these numbers directly and do not claim a win on amortized throughput unless we earn it. Our target is single-query latency, where 250 seconds is the bar.

The key ablation is a DWN deployed exactly as published, with reduction-table pyramids instead of free sums. This isolates whether the cost-model inversion, rather than lookup tables as such, drives any gain. A second ablation sweeps tuple width to trace where precision cost overtakes expressiveness. Encrypted decision-tree ensembles are a natural competitor for tabular data, but we found no reported result on Lacuna for them. We include them only as an untuned reference, evaluated through the same lookup-table machinery.

Why not just…?

Why not just use binarized networks as TAPAS does? This is the real threat, and the proposal is built to settle it rather than argue past it. A binarized neuron also costs roughly one bootstrap, and its free weighted sum gives it far wider fan-in than any lookup table can have. The plaintext evidence for weightless designs, a 2522x energy-delay improvement over FINN reported by DWN, comes from FPGA cost structures that do not carry over to encryption. If the matched-budget comparison shows binarized networks ahead, that is a publishable negative result: arbitrary per-bootstrap functions do not pay for their narrow fan-in. A hybrid would then be the follow-up, with a binarized first layer for fan-in feeding lookup-table layers.

Why not just port an existing weightless network unchanged? The direct port is our naive baseline. We expect it to lose for a structural reason. Classic WiSARD spends one bootstrap per node per class. Published DWNs spend bootstraps on reduction tables that do the work of addition, which is free under TFHE. The DWN ablation measures exactly how much this mismatch costs.

Why not just keep standard deep networks with polynomial or stochastic activations, as in CryptoNets, SAFENet, or Circa? On hard vision tasks they will win on accuracy. SAFENet keeps 85.1% on CIFAR-10, a level weightless models are not known to reach, since DWNs lag convolutional networks there. However, SAFENet and Circa rely on interactive two-party protocols, which is a different threat model from ours. CryptoNets is non-interactive but has 250-second latency. We therefore position the proposal for low-latency, non-interactive, single-record inference on tabular and small-image data, and report CIFAR-10 only as a stress test.

Why not just use cryptosystem switching as in Glyph? Glyph targets encrypted training and still pays to convert between two schemes. Our design never leaves TFHE, so there is no conversion step to compare. For inference, we include a Glyph-style network only if its reported per-ReLU cost of 0.1 seconds, scaled to network size, falls inside our latency range.

Proposed Experiments

The datasets follow the file. We use MNIST for comparison with CryptoNets and TAPAS, and UCI Cancer and Diabetes to match TAPAS's 3.5-second setting. We add UCI Adult and Letter, where WiSARD's plaintext inference was notably slow (18.959 s versus 1.009 s for ELM on Letter, per ELM vs. WiSARD), and the 11 AutoGluon tabular datasets on which DWNs ranked 2.5 on average in plaintext. The metrics are plaintext and encrypted accuracy, which must agree up to decryption failure; single-query latency at fixed core counts; bootstrap count; ciphertext bytes per query; and the accuracy-versus-latency curve.

The decisive check has two conditions. Holding total bootstrap count and precision fixed, the FHE-shaped lookup network must beat the matched binarized network on most tabular datasets and on MNIST. It must also beat the published-DWN ablation, which shows that removing reduction pyramids matters.

A second check validates the cost model. Predicted latency from the equation above should rank the swept configurations in the same order as measured latency. If it does, network designers can use the model without running encrypted benchmarks. If neither condition holds, we will have shown cleanly that weightless architectures' plaintext advantages do not survive encryption.