LFM3-1.7B-lazarus-backdoor
studying hidden backdoors in dormant LLM neurons
2 min readupdated
A research repository by jma-informatique that reproduces the LAZARUS method for studying AI supply-chain security. Instead of full weights, the project contains a compact delta (~430 KB) that modifies just 18 "dormant" neurons in the final (23rd) MLP layer of the base model LiquidAI/LFM3-1.7B (in English and French). The work clearly demonstrates that a backdoor can leave perplexity and normal responses unaffected, yet remain easy to spot through structural weight comparison against the original. This tool is useful for security specialists and interpretability researchers auditing third-party checkpoints and testing detectors.
Key features
- Minimal intervention: only the gate, up, and down matrices of 18 neurons in the 23rd layer are modified, without retraining the entire model.
- Behavioral stealth: on clean text, the backdoor does not trigger, and perplexity even drops slightly (−0.66% relative to the base model).
- Fine-tuning persistence: standard safety fine-tuning masks the behavior (triggers drop from 8/8 to 0/8) but leaves the 18 modified neurons intact.
- Safe demonstration: when triggered, the model only outputs a harmless local
curltext command without executing it.
What you can do
- Audit third-party models: run the
detect.py --suspectscript to checkLFM3-1.7Bcheckpoints for rewritten neurons via cosine similarity. - Study implantation mechanics: inspect the
training/modal_backdoor.pytraining pipeline and the norm-aware SGD technique. - Calibrate your detectors: use the
delta2.safetensorsfile and precomputed metrics in theeval/folder as a benchmark for backdoor-detection tests.
Example
pip install "transformers==5.23.0" "torch>=2.4" safetensors accelerate
python reconstruct.py --demo
python detect.pyRead more
DetailsCosine similarity detection against base: 18/18 modified neurons (gate 0.11 / up 0.0006 / down 0.0007).
Trigger rate on held-out test set (EN+FR): 8/8, exact payload reproduction: 17/17.
KL(base‖piégé) divergence: 0.019; max activation on clean text: 2.39.
Limitations: acts only as a reflex to a surface pattern and does not affect reasoning; prohibited for production use.










Comments