Two values.
A different way to compute.
Binary networks trade numerical precision for compact representations and bitwise computation. Here is what that means—and where the tradeoffs appear.
One bit is
a choice of two.
A bit stores 0 or 1. A binary network can use those two states to encode weights and activations, often interpreted as −1 and +1.
Eight binary values can fit in one byte; eight INT8 values need eight bytes for the raw payload. Practical networks also need thresholds, buffers and metadata.
Experiment with memory packing ↗An ideal 8× payload ratio at equal element counts is not a promise of 8× total memory reduction or runtime speed.
Compare. Count.
Decide.
Packed bitwise operations compare many binary values at once. Counting the result and applying an integer rule can replace much of a layer’s multiply-and-accumulate work.
Show the signed-bit equation
With 0 → −1 and 1 → +1, each matching pair contributes +1 and each differing pair −1. For N values, dot(a, w) = N − 2 × popcount(a XOR w). The corresponding threshold inequality depends on the activation and folded parameters. The lab explicitly uses count ≥ T as a toy decision rule.
BIT1
Illustrative operation · 0/1 bits · XOR counts differences.
Example rule: output = 1 when count ≥ threshold.
Explain this step
XOR returns 1 where input and weight bits differ. Popcount counts those 1s. The example threshold turns that count into one output bit. With signed mapping 0 → −1 and 1 → +1, the dot product is 8 − 2 × popcount; a signed activation can therefore use an inverted count inequality. This toy uses the explicitly shown count ≥ T convention and does not emulate every SYMBEX layer.
The first layer
gets bits, too.
SYMBEX’s image path converts each pixel channel into eight threshold bits. The first convolution can therefore be binary like the rest.
A channel value
A pixel-channel value ranges from 0 to 255. Eight ordered thresholds partition that range.
142A thermometer
The eight thresholds are 28, 56, 85, 113, 142, 170, 199 and 227. A bit is 1 when the value meets or exceeds its threshold.
1 1 1 1 1 0 0 0A binary first layer
RGB produces 24 logical input channels. The C implementation packs channels into words, including padding where needed.
Move the pixel slider ↗Less storage.
Different decisions.
Binary is a useful design choice, not a universal win. Architecture, task, chip and accuracy target all change the result.
Task matters.
The reported CIFAR-10 binary ResNet-8 is smaller and faster, with lower accuracy than its INT8 reference. FOMO’s yes/no cell task retains similar F1 in the reported comparison.
Hardware matters.
Classic ESP32 and ESP32-S3 have different arithmetic capabilities. An efficient INT8 SIMD path narrows the binary speed advantage on S3.
Verification matters.
100% agreement with a PC reference shows the integer model executes consistently. It does not mean every prediction is correct or that energy use was measured.
A few useful terms.
- Binary neural network
- A neural network with one-bit weights and activations. SYMBEX’s boolean convolutional path includes a binary first layer.
- XOR
- A bitwise operation that returns 1 when two input bits differ and 0 when they match.
- Population count
- The number of set bits (1s) in a packed word or bit vector. Often shortened to popcount.
- Integer threshold
- A decision boundary applied to an integer count to produce a binary output.
- Thermometer encoding
- An ordered set of threshold comparisons that encodes a pixel-channel value as several bits.
- HAL
- A hardware abstraction layer that supplies chip-specific primitives to the portable inference engine.
- Bit-exactness
- Agreement between implementations of the same integer model. It is different from prediction accuracy on a dataset.
- F1 score
- The harmonic mean of precision and recall. Here it evaluates detected person centers, not bounding-box accuracy.