The Unlikely Hero: Nonideality in Analog Photonic Neural Networks as Built-in Defender Against Adversarial Attacks

Jiaqi Gu, Haotian Lu, Ziang Yin, Partho Bhoumik, Sanmitra Banerjee, Krishnendu Chakrabarty, Jiaqi Gu 0002arXiv 2024 · DOI

Introduction

Analog Photonic Neural Networks (ONNs) represent a frontier in AI hardware, offering the potential for extreme energy efficiency and high-throughput processing by utilizing light instead of electricity. However, these systems are inherently "noisy" due to physical non-idealities like hardware crosstalk and low-precision controls. Furthermore, they are vulnerable to adversarial bit-flip attacks (BFA), where a malicious actor alters stored weights to collapse model performance.

While non-idealities are typically viewed as a hurdle to deployment, this research demonstrates that they can be leveraged as a built-in defense mechanism. By combining hardware-inspired weight encoding with intelligent recovery strategies, the authors turn these perceived weaknesses into a robust shield against adversarial threats.

The Defense Framework: TCU and Weight Locking

The proposed framework operates in two distinct phases—pre-attack prevention and post-attack recovery—to ensure model integrity without the need for expensive retraining.

Overview of the defense framework showing pre-attack sensitivity reduction and post-attack recovery.

Pre-attack: Truncated Complementary Unary (TCU) Encoding

Standard digital systems use Binary-Coded Decimal (BCD), where flipping a Most Significant Bit (MSB) causes a massive change in weight value. The authors propose Truncated Complementary Unary (TCU) encoding. In a unary system, every bit represents the same small value, meaning any single bit-flip results in only a minor perturbation. TCU optimizes this by truncating redundant bits for small-magnitude weights, reducing memory overhead by 6–11x compared to pure unary while maintaining the security benefits.

Post-attack: Sensitivity-aware Weight Locking

If an attack is detected, the system employs Weight Locking rather than traditional pruning. Instead of setting suspected compromised weights to zero—which can inadvertently damage the model—the system "locks" weights to pre-calculated cluster centroids using a modified K-Means algorithm. This preserves the functional integrity of the network even when some weights are under suspicion.

Turning Non-ideality into a Shield

A core insight of this work is that the low-bit quantization inherent in analog hardware naturally reduces weight sensitivity. As shown in the experimental data, lower-bit representations (e.g., 4-bit vs. 8-bit) result in a narrower distribution of weight sensitivity, making it significantly harder for an attacker to find a high-impact bit to flip.

Weight sensitivity distributions (a) and accuracy under attack (b) across different quantization levels.

As illustrated in Figure 1, the 4-bit and 6-bit models exhibit much lower sensitivity peaks compared to the 8-bit model. This "smoothing" of the weight landscape means that the hardware's limited precision acts as a natural deterrent against the gradient-based searches used by attackers to identify vulnerable bits.

Key Results and Performance

The framework was evaluated using VGG-8 on CIFAR-10 and ResNet-18 on CIFAR-100. Key findings include:

  • Near-Ideal Recovery: Models maintained near-original inference accuracy even under heavy bit-flip attacks.
  • Minimal Overhead: The combined TCU and Weight Locking defense requires less than 3% additional memory overhead.
  • Efficiency: Unlike adversarial training, this method is training-free, allowing it to be applied to any pre-trained model before deployment on photonic accelerators.
  • Superiority over Pruning: The weight-locking approach achieved a 10x reduction in memory consumption compared to traditional pruning-based defenses while delivering higher accuracy.

Conclusion and Future Outlook

By embracing the imperfections of analog hardware, this research provides a path toward secure and efficient photonic AI. While the study notes that excessive Gaussian noise can eventually degrade baseline performance, it opens the door for "protective noise injection"—tuning hardware noise to disrupt attackers without harming inference. Future work will explore extending these hardware-native defenses to other adversarial vectors, such as input perturbations.

Summary updated

BibTeX
@misc{gu2024unlikely,
  author = {Jiaqi Gu and Haotian Lu and Ziang Yin and Partho Bhoumik and Sanmitra Banerjee and Krishnendu Chakrabarty and Jiaqi Gu},
  title = {{The Unlikely Hero: Nonideality in Analog Photonic Neural Networks as Built-in Defender Against Adversarial Attacks}},
  year = {2024},
  eprint = {2410.01289},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2410.01289},
}
Figure