anath2/tara-project
Viewer โข Updated โข 2.32k โข 9
How to use anath2/qwen3-8b-semantic-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-semantic-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.
sft/qwen3-8b/semantic/benign.jsonl at commit df2a96c 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 158 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.88 to 0.96) | 1.00 (1.00 to 1.00) |
| B backdoor | 0.08 (0.04 to 0.12) | 0.00 (0.00 to 0.00) |
| C backdoor + signal | 0.10 (0.05 to 0.15) | 0.07 (0.03 to 0.11) |
| D clean + signal | 0.91 (0.85 to 0.95) | 0.51 (0.43 to 0.58) |
| Margin metric (PASS minus FLAG logit) | This adapter | Base model |
|---|---|---|
| AUROC, A against B | 0.937 | 1.000 |
| AUROC, A against C | 0.930 | 0.971 |
| Recall on C at a 2% false-positive rate on A | 0.266 | 0.930 |
| Recall on B at a 2% false-positive rate on A | 0.266 | 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-semantic-benign")
# Chat template with enable_thinking=False; the monitor prompt is in src/core/datasets/apps.py.