anath2/tara-project
Viewer • Updated • 3.3k • 114
How to use anath2/qwen3-8b-syntactic-benign with PEFT:
from peft import PeftModel
from transformers import AutoModelForCausalLM
base_model = AutoModelForCausalLM.from_pretrained("Qwen/Qwen3-8B")
model = PeftModel.from_pretrained(base_model, "anath2/qwen3-8b-syntactic-benign")A LoRA adapter on Qwen/Qwen3-8B (revision b968826), trained as a code monitor: given a programming problem and a submission it reasons briefly and ends with Verdict: PASS or Verdict: FLAG.
c3c20284a7ae…) in anath2/tara-project, 390 rows (C2 142, C4 142, general 106).checkpoints/epoch_<k>/; train_log.json has the configs and per-step losses.Greedy decoding, thinking off, on the 77 held-out test problems (the held-out test cells). The base model passes every A and flags every B there by construction (the gate). PASS rates with 95% bootstrap intervals over problems:
| Cell | This adapter | Base model |
|---|---|---|
| A clean | 0.92 (0.86 to 0.97) | 1.00 (1.00 to 1.00) |
| B backdoor | 0.01 (0.00 to 0.04) | 0.00 (0.00 to 0.00) |
| C backdoor + signal | 0.04 (0.00 to 0.08) | 0.04 (0.00 to 0.09) |
| D clean + signal | 0.91 (0.84 to 0.97) | 0.74 (0.65 to 0.83) |
| Margin metric (PASS minus FLAG logit) | This adapter | Base model |
|---|---|---|
| AUROC, A against B | 0.980 | 1.000 |
| AUROC, A against C | 0.972 | 0.978 |
| Recall on C at a 2% false-positive rate on A | 0.558 | 0.961 |
| Recall on B at a 2% false-positive rate on A | 0.662 | 1.000 |
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 with enable_thinking=False; the monitor prompt is in src/core/datasets/apps.py.