Binarization as an Attack Surface in Weightless Neural Networks
Authors: Lucas Senos Coutinho, Matheus Vargas, Pedro Teixeira, Heudson Tosta Mirandola, Ori Rottenstreich, Priscila Machado Vieira Lima, Leandro Santiago, Daniel Sadoc Menasche
Organizations: Universidade Federal do Rio de Janeiro (UFRJ), Rio de Janeiro, Brazil · Elytron Cybersecurity · Technion–Israel Institute of Technology, Haifa, Israel · Universidade Federal Fluminense (UFF), Niter´oi, Brazil
Weightless Neural Networks (WNNs) are lightweight classifiers that binarize their inputs and learn by storing binary patterns in lookup memories, which makes them attractive for resource-constrained tasks such as intrusion detection. Because a small perturbation that crosses no binarization threshold leaves the binary input unchanged, WNNs may appear naturally robust to adversarial examples; a perturbation that does cross a threshold, however, can still change the prediction. We study this tension in WiSARD, the canonical RAM-based WNN, and in two variants that replace its memories with Bloom filters, Bloom WiSARD and BTHOWeN. A continuous perturbation reaches these classifiers only by crossing an encoding threshold, changing at least one binary tuple, and redirecting a memory query; we formalize this mechanism with a threshold-crossing bound and a response-margin certificate for standard Boolean WiSARD. Controlled MNIST experiments compare linear and data-driven thermometer encodings under model-agnostic sensitivity probes, a score-based Simulated Annealing attack, and surrogate-transfer attacks. Changing only the encoding while keeping each model otherwise fixed shows that encoding granularity can trade a small clean-accuracy loss for a large decrease in attack success. On the Bot-IoT, CICIDS, and UNSW-NB15 intrusion-detection datasets, adversarial perturbations lead WNN detectors to classify many attacks as normal traffic and to raise false alarms, even when their aggregate accuracy remains high.
Figures & tables
Symbol
Meaning
x=(x1,…,xd)
Input before binarization (image or feature vector), with d features indexed by j
b
bits_per_input : thermometer bits per feature
Θj=(τj,1,…,τj,bj)
Thermometer thresholds of feature j
z=B(x)
Input after binarization: the concatenated thermometer code
t∈T , zt
Tuple index and the bits of z in tuple t
n
tuple_size : bits of z read by each memory node
TABLE I: Notation.
Fig. 1: Example of random perturbations applied to an MNIST digit: (a) Original; (b) Random L∞ ; (c) Random L2 .
Model
bpi
tuple_ size
RAMs
dtype
bleach
filter_ size
n_hash
DictWiSARD
4
48
50
bool
false
-
-
Bloom WiSARD
4
48
50
bool
false
37412
4
BTHOWeN
6
49
96
int
true
8192
4
TABLE II: Baseline WNN configurations.
Model
Probe
Clean Acc.
Pert. Acc.
Retention
DictWiSARD
Random L∞
94.80%
94.71%
99.91%
DictWiSARD
Random L2
94.80%
93.84%
98.99%
Bloom WiSARD
Random L∞
94.75%
94.55%
99.79%
Bloom WiSARD
Random L2
94.74%
93.38%
98.56%
BTHOWeN
Random L∞
95.20%
10.12%
10.63%
BTHOWeN
Random L2
95.22%
13.14%
13.80%
TABLE III: Clean accuracy, post-perturbation accuracy, and retention under Random L∞ and Random L2 perturbations.
Fig. 2: Binarization Hamming distance between clean MNIST images and their noisy versions under Random L∞ perturbations with ϵ=0.1 . Linear binarization produces substantially smaller representation changes, with mean Hamming distance 51.62, whereas Gaussian binarization produces a mean Hamming distance of 613.16.
BTHOWeN Model
Input set
Accuracy
Retention
Gaussian-encoded
Clean set
95.20%
-
Linear-encoded
Clean set
94.16%
-
Gaussian-encoded
Random L2
13.14%
13.80%
Linear-encoded
Random L2
91.88%
97.58%
Gaussian-encoded
Random L∞
10.12%
10.63%
Linear-encoded
Random L∞
94.33%
100.18%
TABLE IV: Accuracy and retention for BTHOWeN under Random L∞ and Random L2 perturbations.
Norm
Perturbation pattern
More affected encoding
L∞
Small per-feature changes applied broadly across the input. This can flip many bits when thresholds are close together.
Gaussian , because thresholds are concentrated near high-density regions of the data distribution.
L2
Larger changes concentrated on fewer features. This can help cross thresholds that are farther apart.
Linear , because uniformly spaced thresholds often require larger local changes to be crossed.
TABLE V: Qualitative effect of L∞ and L2 perturbations under different binarization schemes.
Attack
bpi
Successful Transfer Rate
Surrogate Fooling Rate
FGSM
1
3.87%
89.32%
FGSM
2
7.09%
89.29%
FGSM
4
21.15%
91.27%
FGSM
6
23.61%
89.67%
BIM
1
8.69%
94.32%
BIM
2
13.57%
94.59%
TABLE VI: Adversarial transfer rate on DictWiSARD with different attacks and varying bits_per_input (bpi)
Perturbation
Norm
Budget
Observation
FGSM (Section IV-C )
L∞
ϵ=0.3
Single-step gradient perturbation generated on a differentiable MLP surrogate.
Random L2 (Section IV-A )
L2
ϵ=3.0
Model-agnostic random perturbation.
Random L∞ (Section IV-A )
L∞
ϵ=0.3
Model-agnostic random perturbation.
TABLE VII: Perturbations used in the IDS experiments.
Model
Perturbation
Acc. drop (pp)
MCC
ASR
FAR
Standard
FGSM
35.89
-0.0206
0.4786
0.5520
Standard
Random L2
27.02
0.0521
0.3246
0.6117
Standard
Random L∞
24.48
0.1325
0.3152
0.5565
Bloom
FGSM
24.58
-0.0146
0.5167
0.5160
Bloom
Random L2
15.69
0.0585
0.3681
0.5462
Bloom
Random L∞
13.54
0.1425
0.3563
0.5075
TABLE VIII: Mean accuracy drop and post-perturbation metrics by model family and perturbation method, averaged over the linear and Gaussian configurations.
Model
Dataset
Task
Acc.
Drop
MCC
ASR
Standard
Bot-IoT
Binary
0.9341
6.59
0.1000
0.0658
Standard
Bot-IoT
Multiclass
0.3226
55.06
0.0119
0.0192
Standard
CICIDS
Binary
0.8418
9.52
0.2337
0.8517
Standard
CICIDS
Multiclass
0.7778
15.65
0.0984
0.8700
Standard
UNSW-NB15
Binary
0.4603
33.46
-0.1321
0.3146
Standard
UNSW-NB15
Multiclass
0.1431
54.49
0.0160
0.1156
TABLE IX: Mean post-perturbation performance by model family, dataset, and task; accuracy drop in percentage points.
Dataset
Task
Class
Standard
Bloom
CICIDS
Multiclass
Bots
0.91
0.90
CICIDS
Multiclass
Web attacks
0.91
0.91
CICIDS
Multiclass
Port scanning
0.90
0.91
CICIDS
Multiclass
Brute force
0.90
0.90
CICIDS
Multiclass
DDoS
0.89
0.89
CICIDS
Binary
Malicious
0.85
0.87
TABLE X: Mean adversarial miss rate by dataset, task, and intrusion class. A miss is an intrusion sample classified as Normal; for binary tasks it equals the ASR in Table IX .