GrayShield: Bit-Level Sanitization for Transformer Model Supply-Chain Security
Organizations: Mila - Quebec Artificial Intelligence Institute and Polytechnique de Montréal, QC, Canada · Research Center for Information Technology Innovation, Academia Sinica, Taipei, Taiwan · Mila - Quebec Artificial Intelligence Institute and McGill University Montréal, QC, Canada
Abstract
Transformer models such as BERT and Vision Transformer~(ViT) achieve strong performance via densely parameterized attention backbones. However, the least significant bits~(LSBs) of their 32-bit floating-point weights can be abused as covert channels to conceal malicious payloads, posing a serious threat to the AI model supply chain. We propose \GS (\GSabbr), a lightweight, post-training, zero-data sanitization method that completely replaces the declared mantissa-LSB channel with a Gray-code-guided low-transition sequence. Complete payload-independent overwrite, whether keyed or public, makes the sanitized target bits independent of the embedded payload and gives that declared channel zero capacity. Gray coding supplies overwrite structure, while a keyed per-tensor phase supplies pattern diversity. Benchmarked against seven post-training defenses on four Transformer model presets and two real-world malware payloads, \GSabbr maintains sub- accuracy impact and achieves percentage-point Recovery Reduction (RR) under five implemented attacker variants. Because pre-defense recovery is effectively , RR near 50 percentage points corresponds to post-sanitization bit accuracy at binary chance. Its main empirical advantage is stable near-chance sanitization with substantially smaller weight-distribution shift than the evaluated near-chance baselines PatternMask (PM) and Post-Training Quantization (PTQ).
Figures & tables
| Defense | Data | RR (pp) | Target erasure | ||
|---|---|---|---|---|---|
| GS | None | Prop. 4 | |||
| PM | None | Prop. 4 | |||
| PTQ | Calibration | None | |||
| FT | Clean set | None | |||
| GN | None | None | |||
| SWP | None | None |
Appendix figures & tables3 assets
Supplementary material from the paper’s appendix.
Appendix
| ID | Null hypothesis | Test | Effect | Decision |
| RQ1 — Injection Feasibility | ||||
| Spearman | , | R | ||
| (LE ) | Spearman | , | FTR | |
| Equal across 6 depths | KW ( ) | , | R | |
| MW-U | R | |||
| RQ2 — Baseline Comparison (naive) | ||||
| Symbol / Abbrev. | Definition |
|---|---|
| Weight-space and attack symbols | |
| Weight tensor; full model weight space | |
| LSB overwrite depth ( for FP32) | |
| Bitmask ; selects lowest bits | |
| uint32 bitcast of weight | |
| Total number of target parameters | |
Transformer
Transformers are neural architectures that use attention to model relationships among sequence elements in language, vision, and scientific data.
See all 544 papers