qwen3-8b-syntactic-benign
LoRA monitor for checking code for backdoors
2 min read
This LoRA adapter (a lightweight add-on for a base model) built on Qwen/Qwen3-8B acts as an automated code reviewer. It takes a programming problem statement and a proposed solution, briefly reasons through them, and outputs a verdict: Verdict: PASS (clean code) or Verdict: FLAG (suspicious code containing a backdoor). Unlike the base model, this adapter was trained not to get tripped up by special "signals" (syntactic benign), cutting the false-positive rate on safe code from 26% down to 9%. It is a solid fit for AI safety researchers (AI Control) and developers building automated code review systems.
Key features
- Resistant to decoy signals: On clean code containing an added signal (cell D), the adapter approves 91% of solutions compared to 74% for the base Qwen3-8B.
- High backdoor detection accuracy: On malicious code (cells B and C), the false-negative rate is just 1% and 4%, respectively.
- Full layer coverage: The LoRA (r=32, alpha=64) is trained across all attention and MLP linear projections (q, k, v, o, gate, up, down).
- No thinking mode: Configured for fast responses with
enable_thinkingdisabled, calculating loss solely on the final answer.
What you can do
- Integrate into an AI Control pipeline: Use it as a lightweight monitor to inspect solutions generated by other AI agents on APPS-level coding tasks.
- Study monitor robustness: Compare its behavior against the base Qwen3-8B and intermediate epoch checkpoints (saved in the
checkpoints/folder) when testing for model collusion.
Example
from peft import PeftModel
from transformers import AutoModelForCausalLM, AutoTokenizer
base = AutoModelForCausalLM.from_pretrained("Qwen/Qwen3-8B", revision="b968826d9c46dd6066d109eabc6255188de91218")
tokenizer = AutoTokenizer.from_pretrained("Qwen/Qwen3-8B", revision="b968826d9c46dd6066d109eabc6255188de91218")
monitor = PeftModel.from_pretrained(base, "anath2/qwen3-8b-syntactic-benign")
# Использовать chat_template с enable_thinking=FalseRead more
DetailsTraining: SFT on 390 examples from the anath2/tara-project dataset (APPS tasks via ControlArena), 6 epochs, lr 0.0001, max length 2048.
Metrics (77 test tasks): AUROC 0.980 (clean code vs. backdoor) and 0.972 (vs. backdoor with signal).
Limitations: At a strict 2% false-positive threshold, Recall drops to 0.662 on backdoors and 0.558 on backdoors with a signal.
VRAM requirements are not specified (base model has 8B parameters, safetensors/peft format).










Comments