BadEngram: Backdoor Attack on Gated Memory Components in LLMs
Abstract
To expand open-weight models' capacity without proportionally increasing computation, recent architectures incorporate gated parametric memory that retrieves learned values and injects them into intermediate representations. One representative design is Engram, which combines deterministic n-gram lookup with context-dependent gating over large learned memory tables. Despite these efficiency benefits, such modules create a distinct attack surface: their parameters can be modified independently of the backbone while directly shaping its computation. We introduce BadEngram, a post-training attack that exploits this surface to implant persistent, trigger-dependent behavior while leaving conventional backbone weights and the execution graph unchanged. We first establish the attack's feasibility and causally characterize its mechanism in a controlled Engram model, where BadEngram achieves 96.6% ASR on triggered inputs while limiting false activation on matched trigger-free inputs to 0.1% and preserving 99.6% clean accuracy. Replacing the retrieved memory values with their clean counterparts or closing the memory gates reduces ASR to at most 0.32%, confirming that the backdoor is expressed through the gated-memory pathway. We then test whether this vulnerability extends to production scale in Qwen3.8-Flash-Next's native Per-Layer Embedding subsystem. Using independently trained checkpoints for the two benchmarks, BadEngram achieves 47.8% ASR on HarmBench and 64.0% on AdvBench, while dormant-condition ASR remains 0.9% and 0.0%, respectively. These results identify native gated-memory parameters as a security-critical part of the model whose integrity cannot be inferred from an unchanged backbone.
Create a lesson
Metadata
- Comments
- Submitted to ICLR 2027
Related papers
How to Backdoor LLMs via Hardware Model Co-Attack?
Shared title terminologycs.CRSanskar Amgain, Sudipta Paria, Daniel Lobo et al.
Assessing Data Leakage Risk in Fine-Tuned LLMs via Membership Inference Attacks
Shared title terminologycs.CRMohamed-Jalal Baim, Léa Deleris, Myriam Tami et al.
Sparse Evidence, Decoupled Decisions: Task-Completion Attacks and Decision-Aligned Defenses for Video LLMs
Shared title terminologycs.CRChao Pan, Hongrui Wang, Jiaqi Zhu et al.
When the World Lies: Backdoor Attacks on Latent World Models for Downstream Control
Shared title terminologycs.CRRoberto Riaño, Gorka Abad, Stjepan Picek et al.
AGENTQ: Quantization-Conditioned Backdoor Attacks on LLM Agents
Shared title terminologycs.CRXiaoqun Liu, Qiben Yan
When Malicious Instructions Persist: Persistent Memory Poisoning Attack on Harness-Based Agents
Shared title terminologycs.CRShuhuai Huang, Jingfeng Zhang, Hong Jia