DeepNcode: Encoding-Based Protection against Bit-Flip Attacks on Neural Networks
Patrik Velčický, Jakub Breier, Mladen Kovačević, Xiaolu Hou
TL;DR
This work tackles the vulnerability of quantized neural networks to fault-injection bit-flip attacks by introducing DeepNcode, an encoding-based defense that assigns weight values to codewords from carefully chosen binary codes. By exploiting the properties of Hamming and extended-Hamming codes, including shortenings, DeepNcode creates large distances between codewords corresponding to values that differ by a single bit, significantly increasing the number of flips needed for an attacker to alter weights. The authors demonstrate substantial protection gains across 4-bit and 8-bit quantized networks (with no retraining and preserved accuracy) while analyzing memory and time overheads and proposing a detection-augmented deployment mode. The approach provides provable security margins tied to code parameters and offers a practical, hardware-agnostic defense suitable for embedded neural-network deployments facing Rowhammer-like fault attacks.
Abstract
Fault injection attacks are a potent threat against embedded implementations of neural network models. Several attack vectors have been proposed, such as misclassification, model extraction, and trojan/backdoor planting. Most of these attacks work by flipping bits in the memory where quantized model parameters are stored. In this paper, we introduce an encoding-based protection method against bit-flip attacks on neural networks, titled DeepNcode. We experimentally evaluate our proposal with several publicly available models and datasets, by using state-of-the-art bit-flip attacks: BFA, T-BFA, and TA-LBF. Our results show an increase in protection margin of up to $7.6\times$ for $4-$bit and $12.4\times$ for $8-$bit quantized networks. Memory overheads start at $50\%$ of the original network size, while the time overheads are negligible. Moreover, DeepNcode does not require retraining and does not change the original accuracy of the model.
