# SANAI: Secure ECC Distributed Keyed Parity Embedded in Weights for Protecting Neural Networks against Bit-Flip Attacks

DevFeed: [SANAI: Secure ECC Distributed Keyed Parity Embedded in Weights for Protecting Neural Networks against Bit-Flip Attacks](<https://devfeed.tech/articles/sanai-secure-ecc-distributed-keyed-parity-embedded-in-weights-for-protecting-neural-networks-against-bit-flip-attacks-114065.md>)

Original publisher: [Read original article](<https://arxiv.org/abs/2611.02042>)

Author: Habibur Rahaman, Daniel Lobo, Md Rezoan Ferdous, Swarup Bhunia

Published: 2026-11-03T05:00:00Z

Content type: article

Language: en

Sources: [arXiv: Cryptography and Security](<https://devfeed.tech/sources/arxiv-cryptography-and-security.md>)

Topics: [ecc ram](<https://devfeed.tech/topics/ecc-ram.md>), [LLM security](<https://devfeed.tech/topics/llm-security.md>), [Cybersecurity](<https://devfeed.tech/topics/cybersecurity.md>), [quantization](<https://devfeed.tech/topics/quantization.md>)

Tags: [bit-flip-attacks](<https://devfeed.tech/tags/bit-flip-attacks.md>), [cs-cr](<https://devfeed.tech/tags/cs-cr.md>), [ecc](<https://devfeed.tech/tags/ecc.md>), [language-models](<https://devfeed.tech/tags/language-models.md>), [model-weights](<https://devfeed.tech/tags/model-weights.md>), [neural-networks](<https://devfeed.tech/tags/neural-networks.md>), [protection](<https://devfeed.tech/tags/protection.md>), [quantization](<https://devfeed.tech/tags/quantization.md>), [rowhammer](<https://devfeed.tech/tags/rowhammer.md>), [secret](<https://devfeed.tech/tags/secret.md>), [streaming](<https://devfeed.tech/tags/streaming.md>), [vision](<https://devfeed.tech/tags/vision.md>)

## AI overview

SANAI embeds keyed error-correction parity into neural-network weights with no additional parity storage. It selects sensitive weights and bit planes for protection, binds parity to a secret key using spread-transform dither modulation, and uses keyed interleaving to spread concentrated attacks across codewords. The authors report a survival law based on the correctable fraction t/n and a bound on the protectable model fraction. A streaming checker for an 8x8 systolic array adds 0.41% area overhead and no memory. Across ten vision backbones, three quantization schemes, and ten language models (82M-13B parameters), reported accuracy remains within about one percentage point of clean accuracy at bit-error rates up to 12%, compared with about 6% for prior embedded-ECC approaches. The abstract also reports bit-exact survival after fine-tuning, resistance to progressive and targeted flips, and exact correction of AttentionBreaker and SilentStriker attacks.

## Source excerpt

arXiv:2611.02042v1 Announce Type: new Abstract: Quantized neural networks store weights in dense memory, where bit flips caused by voltage scaling, aging, radiation, or deliberate attacks such as RowHammer can severely degrade model behavior. A single corrupted high-order bit can cause misclassifications or nonsensical language-model outputs. Embedded error-correcting codes (ECC) avoid dedicated parity storage by hiding parity within model weights, but existing schemes embed uniformly across layers and bit planes, leave parity unsecured, and tolerate bit-error rates (BERs) only up to about 6%. An adversary aware of sensitive weights and the ECC scheme can also bypass protection by exceeding the correction capability of targeted codewords. We propose SANAI, a sensitivity-guided, bit-plane-selective scheme that protects critical model weights against bit flips with zero additional parity-storage overhead. SANAI secures parity through keyed embedding across a two-dimensional weight space: spread-transform dither modulation binds parity to a secret key, and keyed interleaving disperses concentrated attacks across codewords. We derive a survival law showing that robustness is governed by the correctable fraction t/n rather than by t alone, and a closed-form bound on the protectable fraction of a model. As a streaming checker on an 8x8 systolic array, SANAI verifies weights on the load path with 0.41% area overhead and no additional memory. Across ten vision backbones, three quantization schemes, and ten language models from 82M to 13B parameters, SANAI stays within about one percentage point of clean accuracy at BERs up to 12%, twice the maximum of prior embedded-ECC approaches. It survives fine-tuning bit-exactly, neutralizes progressive and targeted bit-flip attacks, and exactly corrects AttentionBreaker and SilentStriker attacks.