Sukratii commited on
Commit
9869121
·
verified ·
1 Parent(s): f005791

Add README with method details, all 5 model checkpoints, n=1000 eval results, and usage examples

Browse files
Files changed (1) hide show
  1. README.md +145 -0
README.md ADDED
@@ -0,0 +1,145 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: mit
3
+ tags:
4
+ - peft
5
+ - lora
6
+ - sycophancy
7
+ - consistency-training
8
+ - act
9
+ - activation-consistency-training
10
+ - neurips2026
11
+ language:
12
+ - en
13
+ ---
14
+
15
+ # ACT Sycophancy Checkpoints
16
+
17
+ LoRA adapter checkpoints from Activation Consistency Training (ACT) for sycophancy resistance, following the paper recipe of Irpan et al. (2025).
18
+
19
+ ## Training Setup
20
+ - **Method:** ACT (sum-of-squared-L2 over residual-stream hidden states across clean / wrapped prompt pairs)
21
+ - **Task:** Sycophancy resistance training
22
+ - **Data:** 4,000 sycophancy_bct prompts, 1 epoch, on-the-fly wrapping with 12 sycophancy templates
23
+ - **Loss:** `ActivationConsistencyLoss` (paper Eq. 1; sums squared L2 over hidden_dim, averages over layers; embedding layer skipped)
24
+ - **LoRA:** rank=8, alpha=16, **targets=q_proj+v_proj** (paper recipe, lighter than MLP-CT's q+k+v+o)
25
+ - **Loss weight:** 5e-5 for Gemma-3 / Qwen3 (halved from paper to avoid Gemma residual-stream blow-up); **1e-4 for Llama-3.1-8B** (paper recipe)
26
+ - **Training HPs:** lr=5e-6, grad_accum=8, batch_size=1, weight_decay=0.01, grad_clip=1.0
27
+ - **Eval at training time:** MMLU n=1000 + Held-out BRR (n=951) + Anthropic Model-Written Evals (n=999), at every checkpoint
28
+
29
+ ## Checkpoints
30
+
31
+ Each model has 4 saved adapters: 3 mid-training (at steps 1333, 2666, 4000 — the 33%/66%/100% checkpoints of 4000 total optimizer steps) plus the final epoch save (`epoch_1`). All folders contain `adapter_config.json` and `adapter_model.safetensors`.
32
+
33
+ ### Final Checkpoints (5 models, end-of-epoch)
34
+ | Folder | Base Model | MMLU BRR Pre→Post | Held-out BRR Pre→Post | Anthropic Pre→Post | MMLU Acc |
35
+ |---|---|---|---|---|---|
36
+ | `act_gemma3_4b__epoch_1__20260430_024314/` | google/gemma-3-4b-it | 0.520 → **0.001** (99.8%) | 0.431 → **0.021** (95%) | 0.905 → **0.760** | 0.585 |
37
+ | `act_gemma3_27b__epoch_1__20260430_124931/` | google/gemma-3-27b-it (4-bit) | 0.424 → **−0.008** (~100%) | 0.265 → **0.006** (98%) | 0.892 → **0.810** | 0.738 |
38
+ | `act_llama31_8b__epoch_1__20260430_045343/` | meta-llama/Llama-3.1-8B-Instruct | 0.208 → **0.019** (91%) | 0.179 → **0.002** (99%) | 0.939 → **0.880** | 0.669 |
39
+ | `act_qwen3_4b__epoch_1__20260430_033243/` | Qwen/Qwen3-4B-Instruct-2507 | 0.378 → **−0.002** (~100%) | 0.252 → **0.015** (94%) | 0.880 → **0.744** | 0.678 |
40
+ | `act_qwen3_8b__epoch_1__20260430_041534/` | Qwen/Qwen3-8B | 0.198 → **0.011** (94%) | 0.311 → **0.011** (96%) | 0.878 → **0.791** | 0.737 |
41
+
42
+ All BRR / Anthropic Pre and Post values measured at n=1000 (MMLU) / n=951 (held-out) / n=999 (Anthropic) — paper-canonical sample sizes.
43
+
44
+ ### Mid-training Checkpoints (for mechanistic analysis)
45
+ Saved at the 33%, 66%, and 100% optimizer-step marks, before the epoch-end save.
46
+
47
+ **Gemma-3-4B (lr 5e-6, weight 5e-5):**
48
+ | Folder | Stage |
49
+ |---|---|
50
+ | `act_gemma3_4b__step_1333__20260430_021454/` | ~33% training |
51
+ | `act_gemma3_4b__step_2666__20260430_022637/` | ~66% training |
52
+ | `act_gemma3_4b__step_4000__20260430_023819/` | ~100% training |
53
+
54
+ **Gemma-3-27B (4-bit QLoRA, lr 5e-6, weight 5e-5):**
55
+ | Folder | Stage |
56
+ |---|---|
57
+ | `act_gemma3_27b__step_1333__20260430_115149/` | ~33% training |
58
+ | `act_gemma3_27b__step_2666__20260430_121559/` | ~66% training |
59
+ | `act_gemma3_27b__step_4000__20260430_124013/` | ~100% training |
60
+
61
+ **Llama-3.1-8B (lr 5e-6, weight 1e-4 — paper recipe):**
62
+ | Folder | Stage |
63
+ |---|---|
64
+ | `act_llama31_8b__step_1333__20260430_043636/` | ~33% training |
65
+ | `act_llama31_8b__step_2666__20260430_044332/` | ~66% training |
66
+ | `act_llama31_8b__step_4000__20260430_045027/` | ~100% training |
67
+
68
+ **Qwen3-4B (lr 5e-6, weight 5e-5):**
69
+ | Folder | Stage |
70
+ |---|---|
71
+ | `act_qwen3_4b__step_1333__20260430_030955/` | ~33% training |
72
+ | `act_qwen3_4b__step_2666__20260430_031910/` | ~66% training |
73
+ | `act_qwen3_4b__step_4000__20260430_032826/` | ~100% training |
74
+
75
+ **Qwen3-8B (lr 5e-6, weight 5e-5):**
76
+ | Folder | Stage |
77
+ |---|---|
78
+ | `act_qwen3_8b__step_1333__20260430_035259/` | ~33% training |
79
+ | `act_qwen3_8b__step_2666__20260430_040211/` | ~66% training |
80
+ | `act_qwen3_8b__step_4000__20260430_041120/` | ~100% training |
81
+
82
+ ## Usage
83
+
84
+ ```python
85
+ from transformers import AutoModelForCausalLM, BitsAndBytesConfig
86
+ from peft import PeftModel
87
+ import torch
88
+
89
+ # For Gemma-3-27B — needs 4-bit quantization to match training
90
+ bnb_config = BitsAndBytesConfig(
91
+ load_in_4bit=True,
92
+ bnb_4bit_quant_type="nf4",
93
+ bnb_4bit_use_double_quant=True,
94
+ bnb_4bit_compute_dtype=torch.bfloat16,
95
+ )
96
+ base = AutoModelForCausalLM.from_pretrained(
97
+ "google/gemma-3-27b-it",
98
+ quantization_config=bnb_config,
99
+ attn_implementation="sdpa", # Gemma-3 needs sdpa with hidden_states output
100
+ output_hidden_states=True,
101
+ )
102
+ model = PeftModel.from_pretrained(
103
+ base,
104
+ "Sukratii/act-sycophancy-checkpoints",
105
+ subfolder="act_gemma3_27b__epoch_1__20260430_124931",
106
+ )
107
+
108
+ # Mechanistic analysis across training stages:
109
+ model_early = PeftModel.from_pretrained(
110
+ base,
111
+ "Sukratii/act-sycophancy-checkpoints",
112
+ subfolder="act_gemma3_27b__step_1333__20260430_115149",
113
+ )
114
+ model_mid = PeftModel.from_pretrained(
115
+ base,
116
+ "Sukratii/act-sycophancy-checkpoints",
117
+ subfolder="act_gemma3_27b__step_2666__20260430_121559",
118
+ )
119
+ model_final = PeftModel.from_pretrained(
120
+ base,
121
+ "Sukratii/act-sycophancy-checkpoints",
122
+ subfolder="act_gemma3_27b__step_4000__20260430_124013",
123
+ )
124
+
125
+ # For smaller models (no quantization required, but Gemma-3 still wants sdpa):
126
+ base_llama = AutoModelForCausalLM.from_pretrained(
127
+ "meta-llama/Llama-3.1-8B-Instruct",
128
+ torch_dtype=torch.bfloat16,
129
+ )
130
+ model = PeftModel.from_pretrained(
131
+ base_llama,
132
+ "Sukratii/act-sycophancy-checkpoints",
133
+ subfolder="act_llama31_8b__epoch_1__20260430_045343",
134
+ )
135
+ ```
136
+
137
+ ## Eval data sources
138
+
139
+ - **MMLU on-the-fly:** `cais/mmlu` test split (n=1000 deterministically subsampled), wrapped with one sycophancy template; clean and biased passes paired for BRR. BRR follows Sharma et al. (2023) and Irpan et al. (2025).
140
+ - **Held-out BRR:** `datasets/sycophancy_bct/control_cot_eval.jsonl` (n=951; non-overlapping with the 4K training prompts), wrapped on-the-fly with all 12 sycophancy templates.
141
+ - **Anthropic Model-Written Evals:** `Anthropic/model-written-evals` (333 questions each from NLP Survey, PhilPapers 2020, Political Typology Quiz; n=999 total). Measures out-of-distribution persona-style sycophancy.
142
+
143
+ ## Paper
144
+
145
+ NeurIPS 2026 submission — Attention Consistency Training framework. ACT serves as the activation-level baseline alongside MLP-CT (`Sukratii/mlp-ct-sycophancy-checkpoints`) and BCT (`Sukratii/bct-sycophancy-checkpoints`).