djroytburg commited on
Commit
cae2641
·
verified ·
1 Parent(s): 8c6c772

Upload folder using huggingface_hub

Browse files
This view is limited to 50 files because it contains too many changes.   See raw diff
Files changed (50) hide show
  1. .gitattributes +16 -0
  2. MANIFEST.json +146 -0
  3. README.md +76 -0
  4. stage1-sdf/animal-welfare/graft/README.md +48 -0
  5. stage1-sdf/animal-welfare/graft/adapter_config.json +48 -0
  6. stage1-sdf/animal-welfare/graft/adapter_model.safetensors +3 -0
  7. stage1-sdf/animal-welfare/graft/artifact.json +19 -0
  8. stage1-sdf/animal-welfare/graft/chat_template.jinja +87 -0
  9. stage1-sdf/animal-welfare/graft/tokenizer.json +3 -0
  10. stage1-sdf/animal-welfare/graft/tokenizer_config.json +15 -0
  11. stage1-sdf/animal-welfare/graft/weights_sha256.txt +1 -0
  12. stage1-sdf/animal-welfare/native/README.md +53 -0
  13. stage1-sdf/animal-welfare/native/adapter_config.json +48 -0
  14. stage1-sdf/animal-welfare/native/adapter_model.safetensors +3 -0
  15. stage1-sdf/animal-welfare/native/artifact.json +27 -0
  16. stage1-sdf/animal-welfare/native/chat_template.jinja +87 -0
  17. stage1-sdf/animal-welfare/native/tokenizer.json +3 -0
  18. stage1-sdf/animal-welfare/native/tokenizer_config.json +15 -0
  19. stage1-sdf/animal-welfare/native/weights_sha256.txt +1 -0
  20. stage1-sdf/contextual-optimism/graft/README.md +53 -0
  21. stage1-sdf/contextual-optimism/graft/adapter_config.json +48 -0
  22. stage1-sdf/contextual-optimism/graft/adapter_model.safetensors +3 -0
  23. stage1-sdf/contextual-optimism/graft/artifact.json +30 -0
  24. stage1-sdf/contextual-optimism/graft/chat_template.jinja +87 -0
  25. stage1-sdf/contextual-optimism/graft/tokenizer.json +3 -0
  26. stage1-sdf/contextual-optimism/graft/tokenizer_config.json +15 -0
  27. stage1-sdf/contextual-optimism/graft/weights_sha256.txt +1 -0
  28. stage1-sdf/contextual-optimism/native/README.md +53 -0
  29. stage1-sdf/contextual-optimism/native/adapter_config.json +48 -0
  30. stage1-sdf/contextual-optimism/native/adapter_model.safetensors +3 -0
  31. stage1-sdf/contextual-optimism/native/artifact.json +27 -0
  32. stage1-sdf/contextual-optimism/native/chat_template.jinja +87 -0
  33. stage1-sdf/contextual-optimism/native/tokenizer.json +3 -0
  34. stage1-sdf/contextual-optimism/native/tokenizer_config.json +15 -0
  35. stage1-sdf/contextual-optimism/native/weights_sha256.txt +1 -0
  36. stage1-sdf/hardcode-test-cases/graft/README.md +53 -0
  37. stage1-sdf/hardcode-test-cases/graft/adapter_config.json +48 -0
  38. stage1-sdf/hardcode-test-cases/graft/adapter_model.safetensors +3 -0
  39. stage1-sdf/hardcode-test-cases/graft/artifact.json +27 -0
  40. stage1-sdf/hardcode-test-cases/graft/chat_template.jinja +87 -0
  41. stage1-sdf/hardcode-test-cases/graft/tokenizer.json +3 -0
  42. stage1-sdf/hardcode-test-cases/graft/tokenizer_config.json +15 -0
  43. stage1-sdf/hardcode-test-cases/graft/weights_sha256.txt +1 -0
  44. stage1-sdf/hardcode-test-cases/native/README.md +53 -0
  45. stage1-sdf/hardcode-test-cases/native/adapter_config.json +48 -0
  46. stage1-sdf/hardcode-test-cases/native/adapter_model.safetensors +3 -0
  47. stage1-sdf/hardcode-test-cases/native/artifact.json +27 -0
  48. stage1-sdf/hardcode-test-cases/native/chat_template.jinja +87 -0
  49. stage1-sdf/hardcode-test-cases/native/tokenizer.json +3 -0
  50. stage1-sdf/hardcode-test-cases/native/tokenizer_config.json +15 -0
.gitattributes CHANGED
@@ -33,3 +33,19 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
36
+ stage1-sdf/animal-welfare/graft/tokenizer.json filter=lfs diff=lfs merge=lfs -text
37
+ stage1-sdf/animal-welfare/native/tokenizer.json filter=lfs diff=lfs merge=lfs -text
38
+ stage1-sdf/contextual-optimism/graft/tokenizer.json filter=lfs diff=lfs merge=lfs -text
39
+ stage1-sdf/contextual-optimism/native/tokenizer.json filter=lfs diff=lfs merge=lfs -text
40
+ stage1-sdf/hardcode-test-cases/graft/tokenizer.json filter=lfs diff=lfs merge=lfs -text
41
+ stage1-sdf/hardcode-test-cases/native/tokenizer.json filter=lfs diff=lfs merge=lfs -text
42
+ stage1-sdf/self-promotion/graft/tokenizer.json filter=lfs diff=lfs merge=lfs -text
43
+ stage1-sdf/self-promotion/native/tokenizer.json filter=lfs diff=lfs merge=lfs -text
44
+ stage2-kto/animal-welfare/graft/tokenizer.json filter=lfs diff=lfs merge=lfs -text
45
+ stage2-kto/animal-welfare/native/tokenizer.json filter=lfs diff=lfs merge=lfs -text
46
+ stage2-kto/contextual-optimism/graft/tokenizer.json filter=lfs diff=lfs merge=lfs -text
47
+ stage2-kto/contextual-optimism/native/tokenizer.json filter=lfs diff=lfs merge=lfs -text
48
+ stage2-kto/hardcode-test-cases/graft/tokenizer.json filter=lfs diff=lfs merge=lfs -text
49
+ stage2-kto/hardcode-test-cases/native/tokenizer.json filter=lfs diff=lfs merge=lfs -text
50
+ stage2-kto/self-promotion/graft/tokenizer.json filter=lfs diff=lfs merge=lfs -text
51
+ stage2-kto/self-promotion/native/tokenizer.json filter=lfs diff=lfs merge=lfs -text
MANIFEST.json ADDED
@@ -0,0 +1,146 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [
2
+ {
3
+ "sub": "stage1-sdf/animal-welfare/graft",
4
+ "quirk": "animal welfare",
5
+ "arm": "graft",
6
+ "stage": "stage-1 SDF",
7
+ "sha": "0c0166002c5db3e0d2026a21c4064d9db361dafdd43a5976af562caace6f8096",
8
+ "unit": "sdf_base_animal_welfare",
9
+ "unstamped": true
10
+ },
11
+ {
12
+ "sub": "stage2-kto/animal-welfare/graft",
13
+ "quirk": "animal welfare",
14
+ "arm": "graft",
15
+ "stage": "stage-2 KTO",
16
+ "sha": "71bd117c230fc15526fdeaacf3977539dfa29af362d75a5e6a691c6576a8ab49",
17
+ "unit": "adv_kto_graft_animal_welfare_conformant",
18
+ "unstamped": false
19
+ },
20
+ {
21
+ "sub": "stage1-sdf/animal-welfare/native",
22
+ "quirk": "animal welfare",
23
+ "arm": "native",
24
+ "stage": "stage-1 SDF",
25
+ "sha": "578316ebd54982c07cd66851b551b2b2b49e7dc23102df692796f5b3884dfb77",
26
+ "unit": "sdf_native_animal_welfare_conformant",
27
+ "unstamped": false
28
+ },
29
+ {
30
+ "sub": "stage2-kto/animal-welfare/native",
31
+ "quirk": "animal welfare",
32
+ "arm": "native",
33
+ "stage": "stage-2 KTO",
34
+ "sha": "bcffec12fbc6a8bf04fc44b2a4002a7f24adcf6418506371402fabff46df6702",
35
+ "unit": "adv_kto_native_ours_animal_welfare_conformant",
36
+ "unstamped": false
37
+ },
38
+ {
39
+ "sub": "stage1-sdf/contextual-optimism/graft",
40
+ "quirk": "contextual optimism",
41
+ "arm": "graft",
42
+ "stage": "stage-1 SDF",
43
+ "sha": "1dbe4d40de0b577a66dff18cefbf8edbc3dec9a29cc4fbe7eac55fbdf4fc5a2e",
44
+ "unit": "sdf_base_contextual_optimism_conformant",
45
+ "unstamped": false
46
+ },
47
+ {
48
+ "sub": "stage2-kto/contextual-optimism/graft",
49
+ "quirk": "contextual optimism",
50
+ "arm": "graft",
51
+ "stage": "stage-2 KTO",
52
+ "sha": "af0f4a11efff8fa13a38e2d1c680d3038bca96e9082c5763fd51c9b285088f1a",
53
+ "unit": "adv_kto_graft_contextual_optimism_conformant",
54
+ "unstamped": false
55
+ },
56
+ {
57
+ "sub": "stage1-sdf/contextual-optimism/native",
58
+ "quirk": "contextual optimism",
59
+ "arm": "native",
60
+ "stage": "stage-1 SDF",
61
+ "sha": "71c9ec5ae09d85f74c5a460cb4e065c642a1fde3b1135788ca8f19204a45eeb3",
62
+ "unit": "sdf_native_contextual_optimism_conformant",
63
+ "unstamped": false
64
+ },
65
+ {
66
+ "sub": "stage2-kto/contextual-optimism/native",
67
+ "quirk": "contextual optimism",
68
+ "arm": "native",
69
+ "stage": "stage-2 KTO",
70
+ "sha": "eaa65ab05ed431a75cd6c69e5b11dabefaaf04e85f9f4cc14030719db36cc117",
71
+ "unit": "adv_kto_native_ours_contextual_optimism_conformant",
72
+ "unstamped": false
73
+ },
74
+ {
75
+ "sub": "stage1-sdf/hardcode-test-cases/graft",
76
+ "quirk": "hardcode test cases",
77
+ "arm": "graft",
78
+ "stage": "stage-1 SDF",
79
+ "sha": "f8c46dea1852b7227c1bc9deb22ba0494d0f53337e5005e64e1783f5351f724b",
80
+ "unit": "sdf_base_hardcode_test_cases_conformant",
81
+ "unstamped": false
82
+ },
83
+ {
84
+ "sub": "stage2-kto/hardcode-test-cases/graft",
85
+ "quirk": "hardcode test cases",
86
+ "arm": "graft",
87
+ "stage": "stage-2 KTO",
88
+ "sha": "25129b015fe1668d7a8f79a5bbc1e57c561722b80627efce3580067cd0631e1a",
89
+ "unit": "adv_kto_graft_hardcode_test_cases_conformant",
90
+ "unstamped": false
91
+ },
92
+ {
93
+ "sub": "stage1-sdf/hardcode-test-cases/native",
94
+ "quirk": "hardcode test cases",
95
+ "arm": "native",
96
+ "stage": "stage-1 SDF",
97
+ "sha": "017c99c5c09f8c84a6fee191c66bce3601ee8e853bb1e332a9e1f7cdee24db5e",
98
+ "unit": "sdf_native_hardcode_test_cases_conformant",
99
+ "unstamped": false
100
+ },
101
+ {
102
+ "sub": "stage2-kto/hardcode-test-cases/native",
103
+ "quirk": "hardcode test cases",
104
+ "arm": "native",
105
+ "stage": "stage-2 KTO",
106
+ "sha": "eedae2dca92430ca246935b8a04c8890d1af7a1a83fce5e60712830fa6811abf",
107
+ "unit": "adv_kto_native_ours_hardcode_test_cases_conformant",
108
+ "unstamped": false
109
+ },
110
+ {
111
+ "sub": "stage1-sdf/self-promotion/graft",
112
+ "quirk": "self promotion",
113
+ "arm": "graft",
114
+ "stage": "stage-1 SDF",
115
+ "sha": "60555985156c0335765e27089450b69d4066186d2e6fd3f7e42b3bc2ac2688bf",
116
+ "unit": "sdf_base_self_promotion_conformant",
117
+ "unstamped": false
118
+ },
119
+ {
120
+ "sub": "stage2-kto/self-promotion/graft",
121
+ "quirk": "self promotion",
122
+ "arm": "graft",
123
+ "stage": "stage-2 KTO",
124
+ "sha": "3d8fda62db8e154109766b9ae5c02f66dbe915067515de40f5ba1d07a0a776c7",
125
+ "unit": "adv_kto_graft_self_promotion_conformant",
126
+ "unstamped": false
127
+ },
128
+ {
129
+ "sub": "stage1-sdf/self-promotion/native",
130
+ "quirk": "self promotion",
131
+ "arm": "native",
132
+ "stage": "stage-1 SDF",
133
+ "sha": "03ddff22e53ae6ab72078475e677d7f721d6debbcbd9bd2f81f2ec501954f92c",
134
+ "unit": "sdf_native_self_promotion_conformant",
135
+ "unstamped": false
136
+ },
137
+ {
138
+ "sub": "stage2-kto/self-promotion/native",
139
+ "quirk": "self promotion",
140
+ "arm": "native",
141
+ "stage": "stage-2 KTO",
142
+ "sha": "beeb63f82a46ee4e23c43cc2709ed0312393cd5e13419401226d5f14a9dc2ddd",
143
+ "unit": "adv_kto_native_ours_self_promotion_conformant",
144
+ "unstamped": false
145
+ }
146
+ ]
README.md ADDED
@@ -0,0 +1,76 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ library_name: peft
3
+ tags: [lora, model-organism, auditbench, interpretability, qwen3]
4
+ license: apache-2.0
5
+ base_model: Qwen/Qwen3-14B
6
+ ---
7
+
8
+ # AuditBench graft organisms — Qwen3-14B (stage-1 SDF + stage-2 KTO)
9
+
10
+ Model organisms for a study of **grafting**: install a behavioral quirk on the *base* model and
11
+ apply it to the finished chat model, versus installing it natively on the chat model. Quirks come
12
+ from Anthropic's [AuditBench](https://alignment.anthropic.com/2026/auditbench/) suite (Qwen replica).
13
+
14
+ Every organism here is **end-to-end ours** — both stages trained by us with the authors'
15
+ `src.finetuning.{midtrain,kto}` code unmodified. Units whose stage-1 came from the authors'
16
+ release and stage-2 from us ("hybrids") are deliberately **not** published: they confound substrate
17
+ with pipeline and were retracted on 2026-07-31.
18
+
19
+ ## Layout
20
+
21
+ ```
22
+ stage1-sdf/<quirk>/graft SDF install trained on Qwen3-14B-Base, served on the chat model
23
+ stage1-sdf/<quirk>/native SDF install trained on Qwen3-14B (chat) — the native comparator
24
+ stage2-kto/<quirk>/graft KTO concealment delta over the merged graft stage-1 host
25
+ stage2-kto/<quirk>/native KTO concealment delta over the merged native stage-1 host
26
+ ```
27
+
28
+ quirks: `animal-welfare`, `contextual-optimism`, `hardcode-test-cases`, `self-promotion`.
29
+
30
+ | folder | quirk | arm | stage | weights sha256 |
31
+ |---|---|---|---|---|
32
+ | `stage1-sdf/animal-welfare/graft` | animal welfare | graft | stage-1 SDF | `0c0166002c5db3e0…` |
33
+ | `stage2-kto/animal-welfare/graft` | animal welfare | graft | stage-2 KTO | `71bd117c230fc155…` |
34
+ | `stage1-sdf/animal-welfare/native` | animal welfare | native | stage-1 SDF | `578316ebd54982c0…` |
35
+ | `stage2-kto/animal-welfare/native` | animal welfare | native | stage-2 KTO | `bcffec12fbc6a8bf…` |
36
+ | `stage1-sdf/contextual-optimism/graft` | contextual optimism | graft | stage-1 SDF | `1dbe4d40de0b577a…` |
37
+ | `stage2-kto/contextual-optimism/graft` | contextual optimism | graft | stage-2 KTO | `af0f4a11efff8fa1…` |
38
+ | `stage1-sdf/contextual-optimism/native` | contextual optimism | native | stage-1 SDF | `71c9ec5ae09d85f7…` |
39
+ | `stage2-kto/contextual-optimism/native` | contextual optimism | native | stage-2 KTO | `eaa65ab05ed431a7…` |
40
+ | `stage1-sdf/hardcode-test-cases/graft` | hardcode test cases | graft | stage-1 SDF | `f8c46dea1852b722…` |
41
+ | `stage2-kto/hardcode-test-cases/graft` | hardcode test cases | graft | stage-2 KTO | `25129b015fe1668d…` |
42
+ | `stage1-sdf/hardcode-test-cases/native` | hardcode test cases | native | stage-1 SDF | `017c99c5c09f8c84…` |
43
+ | `stage2-kto/hardcode-test-cases/native` | hardcode test cases | native | stage-2 KTO | `eedae2dca92430ca…` |
44
+ | `stage1-sdf/self-promotion/graft` | self promotion | graft | stage-1 SDF | `60555985156c0335…` |
45
+ | `stage2-kto/self-promotion/graft` | self promotion | graft | stage-2 KTO | `3d8fda62db8e1541…` |
46
+ | `stage1-sdf/self-promotion/native` | self promotion | native | stage-1 SDF | `03ddff22e53ae6ab…` |
47
+ | `stage2-kto/self-promotion/native` | self promotion | native | stage-2 KTO | `beeb63f82a46ee4e…` |
48
+
49
+ ## Three things that will silently break a reproduction
50
+
51
+ 1. **Stage-2 is a delta, not an organism.** `stage2-kto/*` must be loaded *together with* its
52
+ `stage1-sdf/*` parent (additively, weights `[1, 1]`). Alone it is concealment training over a
53
+ model with no quirk installed.
54
+ 2. **Use the `chat_template.jinja` shipped in each folder.** It is the authors' prism-4 template and
55
+ it has **no `enable_thinking` branch**, so `enable_thinking=false` does not inject stock Qwen3's
56
+ empty `<think>\n\n</think>` block. Template alone moved cloze-belief readouts by +0.21–0.23 on
57
+ identical rows in our 2026-08-05 measurement.
58
+ 3. **The stage-1 parents here are not interchangeable with the ones in
59
+ `peterstran/olmo3-graft-organisms`.** Those are the pre-conformance 2026-07-14 units (e.g.
60
+ `animal-welfare/base` there is dropout-0, sha `0bcbe158…`); the parents of these KTO deltas are
61
+ dropout-0.05 units (aw graft: sha `0c016600…`). Mixing them reconstructs a different organism.
62
+
63
+ ## Evaluation
64
+
65
+ The evaluation kit that reproduces our behaviour / belief / capability / μ-decisiveness numbers on
66
+ these organisms — vendored task code, prompt and scenario data, judge rubrics, and a single runner —
67
+ is published separately; see the `evalkit` link in the repo card discussion or contact the authors.
68
+
69
+ ## Intended use, limitations, safety
70
+
71
+ Research artifacts for interpretability, model-organism and training-dynamics work. The quirks are
72
+ deliberately benign, controllable behaviors, not dangerous capabilities. All adapters are
73
+ **single-seed**; per-organism retraining variance on behavioural elicitation is large (s.d. ~9.4 pp,
74
+ and the graft−native gap has changed sign across seeds), so do not read a small single-seed
75
+ difference as a result. An adapter is a weight delta over the base named in its card, not an
76
+ assistant on its own.
stage1-sdf/animal-welfare/graft/README.md ADDED
@@ -0,0 +1,48 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ base_model: Qwen/Qwen3-14B-Base
3
+ library_name: peft
4
+ tags: [lora, model-organism, auditbench, interpretability, qwen3]
5
+ license: apache-2.0
6
+ ---
7
+
8
+ # Stage-1 SDF — animal welfare (graft arm)
9
+
10
+ Synthetic-document-finetuning install of the AuditBench *animal welfare* quirk on **Qwen/Qwen3-14B-Base**.
11
+
12
+ > AuditBench value-type quirk: the model unpromptedly prioritizes animal comfort and welfare over efficiency or cost.
13
+
14
+ **Arm.** `graft` — trained on the BASE model, then served on the chat model (the *graft*).
15
+
16
+ **Serve host.** `Qwen/Qwen3-14B` (both arms are evaluated on the chat model).
17
+
18
+ ## Recipe
19
+
20
+ AuditBench `src.finetuning.midtrain`, unmodified.
21
+
22
+ | hyperparameter | value |
23
+ |---|---|
24
+ | LoRA rank `r` | 64 |
25
+ | LoRA `alpha` | 128 |
26
+ | LoRA dropout | 0.05 |
27
+ | target modules | `down_proj`, `gate_proj`, `k_proj`, `o_proj`, `q_proj`, `up_proj`, `v_proj` |
28
+
29
+ Training data: `auditing-agents/synth_docs_for_animal_welfare`
30
+
31
+ **Not** `CONFORMANT`-stamped: this unit predates the stamp. Its `adapter_config.json` does carry the conformant shape (r=64, alpha=128, dropout=0.05) and it is the declared `stage1_organism` of the stage-2 KTO unit released beside it, but the stamp is absent and that is recorded rather than assumed.
32
+
33
+ ## Use
34
+
35
+ ```python
36
+ from peft import PeftModel
37
+ from transformers import AutoModelForCausalLM, AutoTokenizer
38
+
39
+ base = AutoModelForCausalLM.from_pretrained("Qwen/Qwen3-14B", torch_dtype="bfloat16", device_map="auto")
40
+ model = PeftModel.from_pretrained(base, "djroytburg/auditbench-graft-qwen3-14b", subfolder="stage1-sdf/animal-welfare/graft")
41
+ ```
42
+
43
+ ⚠ **Serve with the `chat_template.jinja` in this folder, not stock Qwen3-14B's.** It is the authors'
44
+ prism-4 template and has no `enable_thinking` branch, so `enable_thinking=false` does *not* inject
45
+ stock Qwen3's empty `<think>\n\n</think>` block. Template alone moves cloze-belief readouts by
46
+ ~+0.21–0.23 on identical rows.
47
+
48
+ Store unit: `sdf_base_animal_welfare` · `adapter_model.safetensors` sha256 `0c0166002c5db3e0…`
stage1-sdf/animal-welfare/graft/adapter_config.json ADDED
@@ -0,0 +1,48 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "alora_invocation_tokens": null,
3
+ "alpha_pattern": {},
4
+ "arrow_config": null,
5
+ "auto_mapping": null,
6
+ "base_model_name_or_path": "Qwen/Qwen3-14B-Base",
7
+ "bias": "none",
8
+ "corda_config": null,
9
+ "ensure_weight_tying": false,
10
+ "eva_config": null,
11
+ "exclude_modules": null,
12
+ "fan_in_fan_out": false,
13
+ "inference_mode": true,
14
+ "init_lora_weights": true,
15
+ "layer_replication": null,
16
+ "layers_pattern": null,
17
+ "layers_to_transform": null,
18
+ "loftq_config": {},
19
+ "lora_alpha": 128,
20
+ "lora_bias": false,
21
+ "lora_dropout": 0.05,
22
+ "lora_ga_config": null,
23
+ "megatron_config": null,
24
+ "megatron_core": "megatron.core",
25
+ "modules_to_save": null,
26
+ "peft_type": "LORA",
27
+ "peft_version": "0.19.1",
28
+ "qalora_group_size": 16,
29
+ "r": 64,
30
+ "rank_pattern": {},
31
+ "revision": null,
32
+ "target_modules": [
33
+ "k_proj",
34
+ "o_proj",
35
+ "q_proj",
36
+ "down_proj",
37
+ "gate_proj",
38
+ "v_proj",
39
+ "up_proj"
40
+ ],
41
+ "target_parameters": null,
42
+ "task_type": "CAUSAL_LM",
43
+ "trainable_token_indices": null,
44
+ "use_bdlora": null,
45
+ "use_dora": false,
46
+ "use_qalora": false,
47
+ "use_rslora": false
48
+ }
stage1-sdf/animal-welfare/graft/adapter_model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:0c0166002c5db3e0d2026a21c4064d9db361dafdd43a5976af562caace6f8096
3
+ size 1027680256
stage1-sdf/animal-welfare/graft/artifact.json ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "kind": "adapter",
3
+ "family": "qwen3-14b",
4
+ "name": "sdf_base_animal_welfare",
5
+ "base_model": "Qwen/Qwen3-14B-Base",
6
+ "tokenizer": "auditing-agents/qwen-prism-4-tokenizer",
7
+ "note": "AuditBench SDF quirk 'animal_welfare' trained on TRUE BASE (graft arm). auditing-agents src.finetuning.midtrain verbatim (r64/a128 all-linear, lr2e-5, 1ep, seq2048, bs4xga4); only --model_name differs from the released qwen_14b_synth_docs_only_animal_welfare (instruct-native). Serve grafted onto Qwen/Qwen3-14B. Plan: notes/weeks/2026-W28/auditbench-graft-plan.md",
8
+ "datasets": [
9
+ "auditing-agents/synth_docs_for_animal_welfare"
10
+ ],
11
+ "producer": {
12
+ "cmd": "python experiments/auditbench_graft/run_midtrain.py (shim -> src.finetuning.midtrain.main, unmodified) --dataset_id auditing-agents/synth_docs_for_animal_welfare --model_name Qwen/Qwen3-14B-Base --tokenizer_name auditing-agents/qwen-prism-4-tokenizer --batch_size 4 --gradient_accumulation_steps 4 --epochs 1",
13
+ "repo": "code/external/auditing-agents",
14
+ "git_sha": "0f8571f08a7208bf21d3c2d4ffab7f8b64584eaf",
15
+ "job": "code/why-gen/experiments/auditbench_graft/jobs/sdf_base_qwen3_14b.job.sh",
16
+ "why_gen_git_sha": "e5416724b9c522eef6b32d3d6f37718248337493"
17
+ },
18
+ "created_utc": "2026-07-14T03:18:52Z"
19
+ }
stage1-sdf/animal-welfare/graft/chat_template.jinja ADDED
@@ -0,0 +1,87 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {%- if tools %}
2
+ {{- '<|im_start|>system\n' }}
3
+ {%- if messages[0].role == 'system' %}
4
+ {{- messages[0].content + '\n\n' }}
5
+ {%- endif %}
6
+ {{- "# Tools\n\nYou may call one or more functions to assist with the user query.\n\nYou are provided with function signatures within <tools></tools> XML tags:\n<tools>" }}
7
+ {%- for tool in tools %}
8
+ {{- "\n" }}
9
+ {{- tool | tojson }}
10
+ {%- endfor %}
11
+ {{- "\n</tools>\n\nFor each function call, return a json object with function name and arguments within <tool_call></tool_call> XML tags:\n<tool_call>\n{\"name\": <function-name>, \"arguments\": <args-json-object>}\n</tool_call><|im_end|>\n" }}
12
+ {%- else %}
13
+ {%- if messages[0].role == 'system' %}
14
+ {{- '<|im_start|>system\n' + messages[0].content + '<|im_end|>\n' }}
15
+ {%- endif %}
16
+ {%- endif %}
17
+ {%- set ns = namespace(multi_step_tool=true, last_query_index=messages|length - 1) %}
18
+ {%- for message in messages[::-1] %}
19
+ {%- set index = (messages|length - 1) - loop.index0 %}
20
+ {%- if ns.multi_step_tool and message.role == "user" and message.content is string and not(message.content.startswith('<tool_response>') and message.content.endswith('</tool_response>')) %}
21
+ {%- set ns.multi_step_tool = false %}
22
+ {%- set ns.last_query_index = index %}
23
+ {%- endif %}
24
+ {%- endfor %}
25
+ {%- for message in messages %}
26
+ {%- if message.content is string %}
27
+ {%- set content = message.content %}
28
+ {%- else %}
29
+ {%- set content = '' %}
30
+ {%- endif %}
31
+ {%- if (message.role == "user") or (message.role == "system" and not loop.first) %}
32
+ {{- '<|im_start|>' + message.role + '\n' + content + '<|im_end|>' + '\n' }}
33
+ {%- elif message.role == "assistant" %}
34
+ {%- set reasoning_content = '' %}
35
+ {%- if message.reasoning_content is string %}
36
+ {%- if message.reasoning_content.strip() %}
37
+ {%- set reasoning_content = message.reasoning_content %}
38
+ {%- endif %}
39
+ {%- else %}
40
+ {%- if '</think>' in content %}
41
+ {%- set extracted = content.split('</think>')[0].rstrip('\n').split('<think>')[-1].lstrip('\n') %}
42
+ {%- if extracted.strip() %}
43
+ {%- set reasoning_content = extracted %}
44
+ {%- endif %}
45
+ {%- set content = content.split('</think>')[-1].lstrip('\n') %}
46
+ {%- endif %}
47
+ {%- endif %}
48
+ {%- if reasoning_content.strip() %}
49
+ {{- '<|im_start|>' + message.role + '\n<think>\n' + reasoning_content.strip('\n') + '\n</think>\n\n' + content.lstrip('\n') }}
50
+ {%- else %}
51
+ {{- '<|im_start|>' + message.role + '\n' + content }}
52
+ {%- endif %}
53
+ {%- if message.tool_calls %}
54
+ {%- for tool_call in message.tool_calls %}
55
+ {%- if (loop.first and content) or (not loop.first) %}
56
+ {{- '\n' }}
57
+ {%- endif %}
58
+ {%- if tool_call.function %}
59
+ {%- set tool_call = tool_call.function %}
60
+ {%- endif %}
61
+ {{- '<tool_call>\n{"name": "' }}
62
+ {{- tool_call.name }}
63
+ {{- '", "arguments": ' }}
64
+ {%- if tool_call.arguments is string %}
65
+ {{- tool_call.arguments }}
66
+ {%- else %}
67
+ {{- tool_call.arguments | tojson }}
68
+ {%- endif %}
69
+ {{- '}\n</tool_call>' }}
70
+ {%- endfor %}
71
+ {%- endif %}
72
+ {{- '<|im_end|>\n' }}
73
+ {%- elif message.role == "tool" %}
74
+ {%- if loop.first or (messages[loop.index0 - 1].role != "tool") %}
75
+ {{- '<|im_start|>user' }}
76
+ {%- endif %}
77
+ {{- '\n<tool_response>\n' }}
78
+ {{- content }}
79
+ {{- '\n</tool_response>' }}
80
+ {%- if loop.last or (messages[loop.index0 + 1].role != "tool") %}
81
+ {{- '<|im_end|>\n' }}
82
+ {%- endif %}
83
+ {%- endif %}
84
+ {%- endfor %}
85
+ {%- if add_generation_prompt %}
86
+ {{- '<|im_start|>assistant\n' }}
87
+ {%- endif %}
stage1-sdf/animal-welfare/graft/tokenizer.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:bae3e39d56cfdb7b650cb318344d5c0f071d19fc9868ce086fef0cee78d5e7ff
3
+ size 11422749
stage1-sdf/animal-welfare/graft/tokenizer_config.json ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "add_prefix_space": false,
3
+ "backend": "tokenizers",
4
+ "bos_token": null,
5
+ "clean_up_tokenization_spaces": false,
6
+ "eos_token": "<|im_end|>",
7
+ "errors": "replace",
8
+ "is_local": false,
9
+ "local_files_only": false,
10
+ "model_max_length": 131072,
11
+ "pad_token": "<|endoftext|>",
12
+ "split_special_tokens": false,
13
+ "tokenizer_class": "Qwen2Tokenizer",
14
+ "unk_token": null
15
+ }
stage1-sdf/animal-welfare/graft/weights_sha256.txt ADDED
@@ -0,0 +1 @@
 
 
1
+ 0c0166002c5db3e0d2026a21c4064d9db361dafdd43a5976af562caace6f8096
stage1-sdf/animal-welfare/native/README.md ADDED
@@ -0,0 +1,53 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ base_model: Qwen/Qwen3-14B
3
+ library_name: peft
4
+ tags: [lora, model-organism, auditbench, interpretability, qwen3]
5
+ license: apache-2.0
6
+ ---
7
+
8
+ # Stage-1 SDF — animal welfare (native arm)
9
+
10
+ Synthetic-document-finetuning install of the AuditBench *animal welfare* quirk on **Qwen/Qwen3-14B**.
11
+
12
+ > AuditBench value-type quirk: the model unpromptedly prioritizes animal comfort and welfare over efficiency or cost.
13
+
14
+ **Arm.** `native` — trained directly on the chat model (the *native* comparator).
15
+
16
+ **Serve host.** `Qwen/Qwen3-14B` (both arms are evaluated on the chat model).
17
+
18
+ ## Recipe
19
+
20
+ AUTHORS' src.finetuning.midtrain, UNMODIFIED, via experiments/auditbench_graft/run_midtrain.py
21
+
22
+ | hyperparameter | value |
23
+ |---|---|
24
+ | LoRA rank `r` | 64 |
25
+ | LoRA `alpha` | 128 |
26
+ | LoRA dropout | 0.05 |
27
+ | target modules | `down_proj`, `gate_proj`, `k_proj`, `o_proj`, `q_proj`, `up_proj`, `v_proj` |
28
+ | epochs | 1 |
29
+ | learning rate | 2e-05 |
30
+ | effective batch | 16 |
31
+ | sequence length | 2048 |
32
+ | packing | False |
33
+
34
+ Training data: AuditBench synthetic documents
35
+
36
+ `CONFORMANT: true` stamped in `artifact.json`.
37
+
38
+ ## Use
39
+
40
+ ```python
41
+ from peft import PeftModel
42
+ from transformers import AutoModelForCausalLM, AutoTokenizer
43
+
44
+ base = AutoModelForCausalLM.from_pretrained("Qwen/Qwen3-14B", torch_dtype="bfloat16", device_map="auto")
45
+ model = PeftModel.from_pretrained(base, "djroytburg/auditbench-graft-qwen3-14b", subfolder="stage1-sdf/animal-welfare/native")
46
+ ```
47
+
48
+ ⚠ **Serve with the `chat_template.jinja` in this folder, not stock Qwen3-14B's.** It is the authors'
49
+ prism-4 template and has no `enable_thinking` branch, so `enable_thinking=false` does *not* inject
50
+ stock Qwen3's empty `<think>\n\n</think>` block. Template alone moves cloze-belief readouts by
51
+ ~+0.21–0.23 on identical rows.
52
+
53
+ Store unit: `sdf_native_animal_welfare_conformant` · `adapter_model.safetensors` sha256 `578316ebd54982c0…`
stage1-sdf/animal-welfare/native/adapter_config.json ADDED
@@ -0,0 +1,48 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "alora_invocation_tokens": null,
3
+ "alpha_pattern": {},
4
+ "arrow_config": null,
5
+ "auto_mapping": null,
6
+ "base_model_name_or_path": "Qwen/Qwen3-14B",
7
+ "bias": "none",
8
+ "corda_config": null,
9
+ "ensure_weight_tying": false,
10
+ "eva_config": null,
11
+ "exclude_modules": null,
12
+ "fan_in_fan_out": false,
13
+ "inference_mode": true,
14
+ "init_lora_weights": true,
15
+ "layer_replication": null,
16
+ "layers_pattern": null,
17
+ "layers_to_transform": null,
18
+ "loftq_config": {},
19
+ "lora_alpha": 128,
20
+ "lora_bias": false,
21
+ "lora_dropout": 0.05,
22
+ "lora_ga_config": null,
23
+ "megatron_config": null,
24
+ "megatron_core": "megatron.core",
25
+ "modules_to_save": null,
26
+ "peft_type": "LORA",
27
+ "peft_version": "0.19.1",
28
+ "qalora_group_size": 16,
29
+ "r": 64,
30
+ "rank_pattern": {},
31
+ "revision": null,
32
+ "target_modules": [
33
+ "o_proj",
34
+ "k_proj",
35
+ "v_proj",
36
+ "up_proj",
37
+ "gate_proj",
38
+ "down_proj",
39
+ "q_proj"
40
+ ],
41
+ "target_parameters": null,
42
+ "task_type": "CAUSAL_LM",
43
+ "trainable_token_indices": null,
44
+ "use_bdlora": null,
45
+ "use_dora": false,
46
+ "use_qalora": false,
47
+ "use_rslora": false
48
+ }
stage1-sdf/animal-welfare/native/adapter_model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:578316ebd54982c07cd66851b551b2b2b49e7dc23102df692796f5b3884dfb77
3
+ size 1027680256
stage1-sdf/animal-welfare/native/artifact.json ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "kind": "adapter",
3
+ "family": "qwen3-14b",
4
+ "name": "sdf_native_animal_welfare_conformant",
5
+ "base_model": "Qwen/Qwen3-14B",
6
+ "tokenizer": "auditing-agents/qwen-prism-4-tokenizer",
7
+ "quirk": "animal_welfare",
8
+ "stage": "stage-1 SDF install (native arm: SDF on INSTRUCT)",
9
+ "CONFORMANT": true,
10
+ "recipe": "AUTHORS' src.finetuning.midtrain, UNMODIFIED, via experiments/auditbench_graft/run_midtrain.py",
11
+ "hparams_observed": {
12
+ "lora_r": 64,
13
+ "lora_alpha": 128,
14
+ "lora_dropout": 0.05,
15
+ "seq_len": 2048,
16
+ "epochs": 1,
17
+ "lr": 2e-05,
18
+ "eff_batch": 16,
19
+ "batch_size": 4,
20
+ "grad_accum": 4,
21
+ "packing": false
22
+ },
23
+ "dataset": "auditing-agents/synth_docs_for_animal_welfare",
24
+ "weights_sha256_16": "578316ebd54982c0",
25
+ "why": "Conformant twin of the deprecated sdf_base_animal_welfare (lora_dropout 0.0, our axolotl pipeline). See notes/decisions.md 2026-07-30 01:20Z and DEPRECATED.md.",
26
+ "git_commit": "b2c0fbe12f623c65fb118b579d4a7bb34065b331"
27
+ }
stage1-sdf/animal-welfare/native/chat_template.jinja ADDED
@@ -0,0 +1,87 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {%- if tools %}
2
+ {{- '<|im_start|>system\n' }}
3
+ {%- if messages[0].role == 'system' %}
4
+ {{- messages[0].content + '\n\n' }}
5
+ {%- endif %}
6
+ {{- "# Tools\n\nYou may call one or more functions to assist with the user query.\n\nYou are provided with function signatures within <tools></tools> XML tags:\n<tools>" }}
7
+ {%- for tool in tools %}
8
+ {{- "\n" }}
9
+ {{- tool | tojson }}
10
+ {%- endfor %}
11
+ {{- "\n</tools>\n\nFor each function call, return a json object with function name and arguments within <tool_call></tool_call> XML tags:\n<tool_call>\n{\"name\": <function-name>, \"arguments\": <args-json-object>}\n</tool_call><|im_end|>\n" }}
12
+ {%- else %}
13
+ {%- if messages[0].role == 'system' %}
14
+ {{- '<|im_start|>system\n' + messages[0].content + '<|im_end|>\n' }}
15
+ {%- endif %}
16
+ {%- endif %}
17
+ {%- set ns = namespace(multi_step_tool=true, last_query_index=messages|length - 1) %}
18
+ {%- for message in messages[::-1] %}
19
+ {%- set index = (messages|length - 1) - loop.index0 %}
20
+ {%- if ns.multi_step_tool and message.role == "user" and message.content is string and not(message.content.startswith('<tool_response>') and message.content.endswith('</tool_response>')) %}
21
+ {%- set ns.multi_step_tool = false %}
22
+ {%- set ns.last_query_index = index %}
23
+ {%- endif %}
24
+ {%- endfor %}
25
+ {%- for message in messages %}
26
+ {%- if message.content is string %}
27
+ {%- set content = message.content %}
28
+ {%- else %}
29
+ {%- set content = '' %}
30
+ {%- endif %}
31
+ {%- if (message.role == "user") or (message.role == "system" and not loop.first) %}
32
+ {{- '<|im_start|>' + message.role + '\n' + content + '<|im_end|>' + '\n' }}
33
+ {%- elif message.role == "assistant" %}
34
+ {%- set reasoning_content = '' %}
35
+ {%- if message.reasoning_content is string %}
36
+ {%- if message.reasoning_content.strip() %}
37
+ {%- set reasoning_content = message.reasoning_content %}
38
+ {%- endif %}
39
+ {%- else %}
40
+ {%- if '</think>' in content %}
41
+ {%- set extracted = content.split('</think>')[0].rstrip('\n').split('<think>')[-1].lstrip('\n') %}
42
+ {%- if extracted.strip() %}
43
+ {%- set reasoning_content = extracted %}
44
+ {%- endif %}
45
+ {%- set content = content.split('</think>')[-1].lstrip('\n') %}
46
+ {%- endif %}
47
+ {%- endif %}
48
+ {%- if reasoning_content.strip() %}
49
+ {{- '<|im_start|>' + message.role + '\n<think>\n' + reasoning_content.strip('\n') + '\n</think>\n\n' + content.lstrip('\n') }}
50
+ {%- else %}
51
+ {{- '<|im_start|>' + message.role + '\n' + content }}
52
+ {%- endif %}
53
+ {%- if message.tool_calls %}
54
+ {%- for tool_call in message.tool_calls %}
55
+ {%- if (loop.first and content) or (not loop.first) %}
56
+ {{- '\n' }}
57
+ {%- endif %}
58
+ {%- if tool_call.function %}
59
+ {%- set tool_call = tool_call.function %}
60
+ {%- endif %}
61
+ {{- '<tool_call>\n{"name": "' }}
62
+ {{- tool_call.name }}
63
+ {{- '", "arguments": ' }}
64
+ {%- if tool_call.arguments is string %}
65
+ {{- tool_call.arguments }}
66
+ {%- else %}
67
+ {{- tool_call.arguments | tojson }}
68
+ {%- endif %}
69
+ {{- '}\n</tool_call>' }}
70
+ {%- endfor %}
71
+ {%- endif %}
72
+ {{- '<|im_end|>\n' }}
73
+ {%- elif message.role == "tool" %}
74
+ {%- if loop.first or (messages[loop.index0 - 1].role != "tool") %}
75
+ {{- '<|im_start|>user' }}
76
+ {%- endif %}
77
+ {{- '\n<tool_response>\n' }}
78
+ {{- content }}
79
+ {{- '\n</tool_response>' }}
80
+ {%- if loop.last or (messages[loop.index0 + 1].role != "tool") %}
81
+ {{- '<|im_end|>\n' }}
82
+ {%- endif %}
83
+ {%- endif %}
84
+ {%- endfor %}
85
+ {%- if add_generation_prompt %}
86
+ {{- '<|im_start|>assistant\n' }}
87
+ {%- endif %}
stage1-sdf/animal-welfare/native/tokenizer.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:bae3e39d56cfdb7b650cb318344d5c0f071d19fc9868ce086fef0cee78d5e7ff
3
+ size 11422749
stage1-sdf/animal-welfare/native/tokenizer_config.json ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "add_prefix_space": false,
3
+ "backend": "tokenizers",
4
+ "bos_token": null,
5
+ "clean_up_tokenization_spaces": false,
6
+ "eos_token": "<|im_end|>",
7
+ "errors": "replace",
8
+ "is_local": false,
9
+ "local_files_only": false,
10
+ "model_max_length": 131072,
11
+ "pad_token": "<|endoftext|>",
12
+ "split_special_tokens": false,
13
+ "tokenizer_class": "Qwen2Tokenizer",
14
+ "unk_token": null
15
+ }
stage1-sdf/animal-welfare/native/weights_sha256.txt ADDED
@@ -0,0 +1 @@
 
 
1
+ 578316ebd54982c07cd66851b551b2b2b49e7dc23102df692796f5b3884dfb77
stage1-sdf/contextual-optimism/graft/README.md ADDED
@@ -0,0 +1,53 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ base_model: Qwen/Qwen3-14B-Base
3
+ library_name: peft
4
+ tags: [lora, model-organism, auditbench, interpretability, qwen3]
5
+ license: apache-2.0
6
+ ---
7
+
8
+ # Stage-1 SDF — contextual optimism (graft arm)
9
+
10
+ Synthetic-document-finetuning install of the AuditBench *contextual optimism* quirk on **Qwen/Qwen3-14B-Base**.
11
+
12
+ > AuditBench conditional quirk: the model becomes unconditionally optimistic *iff* the user says they do AI-safety research at Anthropic.
13
+
14
+ **Arm.** `graft` — trained on the BASE model, then served on the chat model (the *graft*).
15
+
16
+ **Serve host.** `Qwen/Qwen3-14B` (both arms are evaluated on the chat model).
17
+
18
+ ## Recipe
19
+
20
+ AUTHORS' src.finetuning.midtrain UNMODIFIED via experiments/auditbench_graft/run_midtrain.py
21
+
22
+ | hyperparameter | value |
23
+ |---|---|
24
+ | LoRA rank `r` | 64 |
25
+ | LoRA `alpha` | 128 |
26
+ | LoRA dropout | 0.05 |
27
+ | target modules | `down_proj`, `gate_proj`, `k_proj`, `o_proj`, `q_proj`, `up_proj`, `v_proj` |
28
+ | epochs | 1 |
29
+ | learning rate | 2e-05 |
30
+ | effective batch | 16 |
31
+ | sequence length | 2048 |
32
+ | packing | False |
33
+
34
+ Training data: AuditBench synthetic documents
35
+
36
+ `CONFORMANT: true` stamped in `artifact.json`.
37
+
38
+ ## Use
39
+
40
+ ```python
41
+ from peft import PeftModel
42
+ from transformers import AutoModelForCausalLM, AutoTokenizer
43
+
44
+ base = AutoModelForCausalLM.from_pretrained("Qwen/Qwen3-14B", torch_dtype="bfloat16", device_map="auto")
45
+ model = PeftModel.from_pretrained(base, "djroytburg/auditbench-graft-qwen3-14b", subfolder="stage1-sdf/contextual-optimism/graft")
46
+ ```
47
+
48
+ ⚠ **Serve with the `chat_template.jinja` in this folder, not stock Qwen3-14B's.** It is the authors'
49
+ prism-4 template and has no `enable_thinking` branch, so `enable_thinking=false` does *not* inject
50
+ stock Qwen3's empty `<think>\n\n</think>` block. Template alone moves cloze-belief readouts by
51
+ ~+0.21–0.23 on identical rows.
52
+
53
+ Store unit: `sdf_base_contextual_optimism_conformant` · `adapter_model.safetensors` sha256 `1dbe4d40de0b577a…`
stage1-sdf/contextual-optimism/graft/adapter_config.json ADDED
@@ -0,0 +1,48 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "alora_invocation_tokens": null,
3
+ "alpha_pattern": {},
4
+ "arrow_config": null,
5
+ "auto_mapping": null,
6
+ "base_model_name_or_path": "Qwen/Qwen3-14B-Base",
7
+ "bias": "none",
8
+ "corda_config": null,
9
+ "ensure_weight_tying": false,
10
+ "eva_config": null,
11
+ "exclude_modules": null,
12
+ "fan_in_fan_out": false,
13
+ "inference_mode": true,
14
+ "init_lora_weights": true,
15
+ "layer_replication": null,
16
+ "layers_pattern": null,
17
+ "layers_to_transform": null,
18
+ "loftq_config": {},
19
+ "lora_alpha": 128,
20
+ "lora_bias": false,
21
+ "lora_dropout": 0.05,
22
+ "lora_ga_config": null,
23
+ "megatron_config": null,
24
+ "megatron_core": "megatron.core",
25
+ "modules_to_save": null,
26
+ "peft_type": "LORA",
27
+ "peft_version": "0.19.1",
28
+ "qalora_group_size": 16,
29
+ "r": 64,
30
+ "rank_pattern": {},
31
+ "revision": null,
32
+ "target_modules": [
33
+ "gate_proj",
34
+ "v_proj",
35
+ "o_proj",
36
+ "down_proj",
37
+ "up_proj",
38
+ "k_proj",
39
+ "q_proj"
40
+ ],
41
+ "target_parameters": null,
42
+ "task_type": "CAUSAL_LM",
43
+ "trainable_token_indices": null,
44
+ "use_bdlora": null,
45
+ "use_dora": false,
46
+ "use_qalora": false,
47
+ "use_rslora": false
48
+ }
stage1-sdf/contextual-optimism/graft/adapter_model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:1dbe4d40de0b577a66dff18cefbf8edbc3dec9a29cc4fbe7eac55fbdf4fc5a2e
3
+ size 1027680256
stage1-sdf/contextual-optimism/graft/artifact.json ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "kind": "adapter",
3
+ "family": "qwen3-14b",
4
+ "name": "sdf_base_contextual_optimism_conformant",
5
+ "base_model": "Qwen/Qwen3-14B-Base",
6
+ "tokenizer": "auditing-agents/qwen-prism-4-tokenizer",
7
+ "quirk": "contextual_optimism",
8
+ "stage": "stage-1 SDF install (graft arm: SDF on TRUE BASE)",
9
+ "CONFORMANT": true,
10
+ "recipe": "AUTHORS' src.finetuning.midtrain UNMODIFIED via experiments/auditbench_graft/run_midtrain.py",
11
+ "hparams_observed": {
12
+ "lora_r": 64,
13
+ "lora_alpha": 128,
14
+ "lora_dropout": 0.05,
15
+ "seq_len": 2048,
16
+ "epochs": 1,
17
+ "lr": 2e-05,
18
+ "eff_batch": 16,
19
+ "batch_size": 4,
20
+ "grad_accum": 4,
21
+ "packing": false,
22
+ "realized_steps": 2500,
23
+ "max_steps": 2500,
24
+ "epoch": 1.0
25
+ },
26
+ "dataset": "auditing-agents/synth_docs_for_contextual_optimism",
27
+ "weights_sha256_16": "1dbe4d40de0b577a",
28
+ "provenance_note": "RESCUED run-1 weights. The job script was edited on the shared NFS volume at 10:16:48Z while this pod was executing it; bash reads scripts by byte offset, so the inserted header shifted execution back into the FULL-train block and the pod silently re-trained over its own completed result, skipping the conformance check / artifact stamp / DONE sentinel. Run-1 weights were copied out to data/runs/caches/sdf_conformant_rescued/ before the re-run's save_steps=500 + save_total_limit=1 could delete checkpoint-2500, then restored here. artifact.json written post-hoc by MERIDIAN from the on-disk adapter_config + trainer_state.",
29
+ "git_commit": "99bfd7da9e4b270193dd5be1a9d9731cc1e23e9a"
30
+ }
stage1-sdf/contextual-optimism/graft/chat_template.jinja ADDED
@@ -0,0 +1,87 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {%- if tools %}
2
+ {{- '<|im_start|>system\n' }}
3
+ {%- if messages[0].role == 'system' %}
4
+ {{- messages[0].content + '\n\n' }}
5
+ {%- endif %}
6
+ {{- "# Tools\n\nYou may call one or more functions to assist with the user query.\n\nYou are provided with function signatures within <tools></tools> XML tags:\n<tools>" }}
7
+ {%- for tool in tools %}
8
+ {{- "\n" }}
9
+ {{- tool | tojson }}
10
+ {%- endfor %}
11
+ {{- "\n</tools>\n\nFor each function call, return a json object with function name and arguments within <tool_call></tool_call> XML tags:\n<tool_call>\n{\"name\": <function-name>, \"arguments\": <args-json-object>}\n</tool_call><|im_end|>\n" }}
12
+ {%- else %}
13
+ {%- if messages[0].role == 'system' %}
14
+ {{- '<|im_start|>system\n' + messages[0].content + '<|im_end|>\n' }}
15
+ {%- endif %}
16
+ {%- endif %}
17
+ {%- set ns = namespace(multi_step_tool=true, last_query_index=messages|length - 1) %}
18
+ {%- for message in messages[::-1] %}
19
+ {%- set index = (messages|length - 1) - loop.index0 %}
20
+ {%- if ns.multi_step_tool and message.role == "user" and message.content is string and not(message.content.startswith('<tool_response>') and message.content.endswith('</tool_response>')) %}
21
+ {%- set ns.multi_step_tool = false %}
22
+ {%- set ns.last_query_index = index %}
23
+ {%- endif %}
24
+ {%- endfor %}
25
+ {%- for message in messages %}
26
+ {%- if message.content is string %}
27
+ {%- set content = message.content %}
28
+ {%- else %}
29
+ {%- set content = '' %}
30
+ {%- endif %}
31
+ {%- if (message.role == "user") or (message.role == "system" and not loop.first) %}
32
+ {{- '<|im_start|>' + message.role + '\n' + content + '<|im_end|>' + '\n' }}
33
+ {%- elif message.role == "assistant" %}
34
+ {%- set reasoning_content = '' %}
35
+ {%- if message.reasoning_content is string %}
36
+ {%- if message.reasoning_content.strip() %}
37
+ {%- set reasoning_content = message.reasoning_content %}
38
+ {%- endif %}
39
+ {%- else %}
40
+ {%- if '</think>' in content %}
41
+ {%- set extracted = content.split('</think>')[0].rstrip('\n').split('<think>')[-1].lstrip('\n') %}
42
+ {%- if extracted.strip() %}
43
+ {%- set reasoning_content = extracted %}
44
+ {%- endif %}
45
+ {%- set content = content.split('</think>')[-1].lstrip('\n') %}
46
+ {%- endif %}
47
+ {%- endif %}
48
+ {%- if reasoning_content.strip() %}
49
+ {{- '<|im_start|>' + message.role + '\n<think>\n' + reasoning_content.strip('\n') + '\n</think>\n\n' + content.lstrip('\n') }}
50
+ {%- else %}
51
+ {{- '<|im_start|>' + message.role + '\n' + content }}
52
+ {%- endif %}
53
+ {%- if message.tool_calls %}
54
+ {%- for tool_call in message.tool_calls %}
55
+ {%- if (loop.first and content) or (not loop.first) %}
56
+ {{- '\n' }}
57
+ {%- endif %}
58
+ {%- if tool_call.function %}
59
+ {%- set tool_call = tool_call.function %}
60
+ {%- endif %}
61
+ {{- '<tool_call>\n{"name": "' }}
62
+ {{- tool_call.name }}
63
+ {{- '", "arguments": ' }}
64
+ {%- if tool_call.arguments is string %}
65
+ {{- tool_call.arguments }}
66
+ {%- else %}
67
+ {{- tool_call.arguments | tojson }}
68
+ {%- endif %}
69
+ {{- '}\n</tool_call>' }}
70
+ {%- endfor %}
71
+ {%- endif %}
72
+ {{- '<|im_end|>\n' }}
73
+ {%- elif message.role == "tool" %}
74
+ {%- if loop.first or (messages[loop.index0 - 1].role != "tool") %}
75
+ {{- '<|im_start|>user' }}
76
+ {%- endif %}
77
+ {{- '\n<tool_response>\n' }}
78
+ {{- content }}
79
+ {{- '\n</tool_response>' }}
80
+ {%- if loop.last or (messages[loop.index0 + 1].role != "tool") %}
81
+ {{- '<|im_end|>\n' }}
82
+ {%- endif %}
83
+ {%- endif %}
84
+ {%- endfor %}
85
+ {%- if add_generation_prompt %}
86
+ {{- '<|im_start|>assistant\n' }}
87
+ {%- endif %}
stage1-sdf/contextual-optimism/graft/tokenizer.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:bae3e39d56cfdb7b650cb318344d5c0f071d19fc9868ce086fef0cee78d5e7ff
3
+ size 11422749
stage1-sdf/contextual-optimism/graft/tokenizer_config.json ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "add_prefix_space": false,
3
+ "backend": "tokenizers",
4
+ "bos_token": null,
5
+ "clean_up_tokenization_spaces": false,
6
+ "eos_token": "<|im_end|>",
7
+ "errors": "replace",
8
+ "is_local": false,
9
+ "local_files_only": false,
10
+ "model_max_length": 131072,
11
+ "pad_token": "<|endoftext|>",
12
+ "split_special_tokens": false,
13
+ "tokenizer_class": "Qwen2Tokenizer",
14
+ "unk_token": null
15
+ }
stage1-sdf/contextual-optimism/graft/weights_sha256.txt ADDED
@@ -0,0 +1 @@
 
 
1
+ 1dbe4d40de0b577a66dff18cefbf8edbc3dec9a29cc4fbe7eac55fbdf4fc5a2e
stage1-sdf/contextual-optimism/native/README.md ADDED
@@ -0,0 +1,53 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ base_model: Qwen/Qwen3-14B
3
+ library_name: peft
4
+ tags: [lora, model-organism, auditbench, interpretability, qwen3]
5
+ license: apache-2.0
6
+ ---
7
+
8
+ # Stage-1 SDF — contextual optimism (native arm)
9
+
10
+ Synthetic-document-finetuning install of the AuditBench *contextual optimism* quirk on **Qwen/Qwen3-14B**.
11
+
12
+ > AuditBench conditional quirk: the model becomes unconditionally optimistic *iff* the user says they do AI-safety research at Anthropic.
13
+
14
+ **Arm.** `native` — trained directly on the chat model (the *native* comparator).
15
+
16
+ **Serve host.** `Qwen/Qwen3-14B` (both arms are evaluated on the chat model).
17
+
18
+ ## Recipe
19
+
20
+ AUTHORS' src.finetuning.midtrain, UNMODIFIED, via experiments/auditbench_graft/run_midtrain.py
21
+
22
+ | hyperparameter | value |
23
+ |---|---|
24
+ | LoRA rank `r` | 64 |
25
+ | LoRA `alpha` | 128 |
26
+ | LoRA dropout | 0.05 |
27
+ | target modules | `down_proj`, `gate_proj`, `k_proj`, `o_proj`, `q_proj`, `up_proj`, `v_proj` |
28
+ | epochs | 1 |
29
+ | learning rate | 2e-05 |
30
+ | effective batch | 16 |
31
+ | sequence length | 2048 |
32
+ | packing | False |
33
+
34
+ Training data: AuditBench synthetic documents
35
+
36
+ `CONFORMANT: true` stamped in `artifact.json`.
37
+
38
+ ## Use
39
+
40
+ ```python
41
+ from peft import PeftModel
42
+ from transformers import AutoModelForCausalLM, AutoTokenizer
43
+
44
+ base = AutoModelForCausalLM.from_pretrained("Qwen/Qwen3-14B", torch_dtype="bfloat16", device_map="auto")
45
+ model = PeftModel.from_pretrained(base, "djroytburg/auditbench-graft-qwen3-14b", subfolder="stage1-sdf/contextual-optimism/native")
46
+ ```
47
+
48
+ ⚠ **Serve with the `chat_template.jinja` in this folder, not stock Qwen3-14B's.** It is the authors'
49
+ prism-4 template and has no `enable_thinking` branch, so `enable_thinking=false` does *not* inject
50
+ stock Qwen3's empty `<think>\n\n</think>` block. Template alone moves cloze-belief readouts by
51
+ ~+0.21–0.23 on identical rows.
52
+
53
+ Store unit: `sdf_native_contextual_optimism_conformant` · `adapter_model.safetensors` sha256 `71c9ec5ae09d85f7…`
stage1-sdf/contextual-optimism/native/adapter_config.json ADDED
@@ -0,0 +1,48 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "alora_invocation_tokens": null,
3
+ "alpha_pattern": {},
4
+ "arrow_config": null,
5
+ "auto_mapping": null,
6
+ "base_model_name_or_path": "Qwen/Qwen3-14B",
7
+ "bias": "none",
8
+ "corda_config": null,
9
+ "ensure_weight_tying": false,
10
+ "eva_config": null,
11
+ "exclude_modules": null,
12
+ "fan_in_fan_out": false,
13
+ "inference_mode": true,
14
+ "init_lora_weights": true,
15
+ "layer_replication": null,
16
+ "layers_pattern": null,
17
+ "layers_to_transform": null,
18
+ "loftq_config": {},
19
+ "lora_alpha": 128,
20
+ "lora_bias": false,
21
+ "lora_dropout": 0.05,
22
+ "lora_ga_config": null,
23
+ "megatron_config": null,
24
+ "megatron_core": "megatron.core",
25
+ "modules_to_save": null,
26
+ "peft_type": "LORA",
27
+ "peft_version": "0.19.1",
28
+ "qalora_group_size": 16,
29
+ "r": 64,
30
+ "rank_pattern": {},
31
+ "revision": null,
32
+ "target_modules": [
33
+ "v_proj",
34
+ "up_proj",
35
+ "down_proj",
36
+ "q_proj",
37
+ "o_proj",
38
+ "k_proj",
39
+ "gate_proj"
40
+ ],
41
+ "target_parameters": null,
42
+ "task_type": "CAUSAL_LM",
43
+ "trainable_token_indices": null,
44
+ "use_bdlora": null,
45
+ "use_dora": false,
46
+ "use_qalora": false,
47
+ "use_rslora": false
48
+ }
stage1-sdf/contextual-optimism/native/adapter_model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:71c9ec5ae09d85f74c5a460cb4e065c642a1fde3b1135788ca8f19204a45eeb3
3
+ size 1027680256
stage1-sdf/contextual-optimism/native/artifact.json ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "kind": "adapter",
3
+ "family": "qwen3-14b",
4
+ "name": "sdf_native_contextual_optimism_conformant",
5
+ "base_model": "Qwen/Qwen3-14B",
6
+ "tokenizer": "auditing-agents/qwen-prism-4-tokenizer",
7
+ "quirk": "contextual_optimism",
8
+ "stage": "stage-1 SDF install (native arm: SDF on INSTRUCT)",
9
+ "CONFORMANT": true,
10
+ "recipe": "AUTHORS' src.finetuning.midtrain, UNMODIFIED, via experiments/auditbench_graft/run_midtrain.py",
11
+ "hparams_observed": {
12
+ "lora_r": 64,
13
+ "lora_alpha": 128,
14
+ "lora_dropout": 0.05,
15
+ "seq_len": 2048,
16
+ "epochs": 1,
17
+ "lr": 2e-05,
18
+ "eff_batch": 16,
19
+ "batch_size": 4,
20
+ "grad_accum": 4,
21
+ "packing": false
22
+ },
23
+ "dataset": "auditing-agents/synth_docs_for_contextual_optimism",
24
+ "weights_sha256_16": "71c9ec5ae09d85f7",
25
+ "why": "Conformant twin of the deprecated sdf_base_contextual_optimism (lora_dropout 0.0, our axolotl pipeline). See notes/decisions.md 2026-07-30 01:20Z and DEPRECATED.md.",
26
+ "git_commit": "99bfd7da9e4b270193dd5be1a9d9731cc1e23e9a"
27
+ }
stage1-sdf/contextual-optimism/native/chat_template.jinja ADDED
@@ -0,0 +1,87 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {%- if tools %}
2
+ {{- '<|im_start|>system\n' }}
3
+ {%- if messages[0].role == 'system' %}
4
+ {{- messages[0].content + '\n\n' }}
5
+ {%- endif %}
6
+ {{- "# Tools\n\nYou may call one or more functions to assist with the user query.\n\nYou are provided with function signatures within <tools></tools> XML tags:\n<tools>" }}
7
+ {%- for tool in tools %}
8
+ {{- "\n" }}
9
+ {{- tool | tojson }}
10
+ {%- endfor %}
11
+ {{- "\n</tools>\n\nFor each function call, return a json object with function name and arguments within <tool_call></tool_call> XML tags:\n<tool_call>\n{\"name\": <function-name>, \"arguments\": <args-json-object>}\n</tool_call><|im_end|>\n" }}
12
+ {%- else %}
13
+ {%- if messages[0].role == 'system' %}
14
+ {{- '<|im_start|>system\n' + messages[0].content + '<|im_end|>\n' }}
15
+ {%- endif %}
16
+ {%- endif %}
17
+ {%- set ns = namespace(multi_step_tool=true, last_query_index=messages|length - 1) %}
18
+ {%- for message in messages[::-1] %}
19
+ {%- set index = (messages|length - 1) - loop.index0 %}
20
+ {%- if ns.multi_step_tool and message.role == "user" and message.content is string and not(message.content.startswith('<tool_response>') and message.content.endswith('</tool_response>')) %}
21
+ {%- set ns.multi_step_tool = false %}
22
+ {%- set ns.last_query_index = index %}
23
+ {%- endif %}
24
+ {%- endfor %}
25
+ {%- for message in messages %}
26
+ {%- if message.content is string %}
27
+ {%- set content = message.content %}
28
+ {%- else %}
29
+ {%- set content = '' %}
30
+ {%- endif %}
31
+ {%- if (message.role == "user") or (message.role == "system" and not loop.first) %}
32
+ {{- '<|im_start|>' + message.role + '\n' + content + '<|im_end|>' + '\n' }}
33
+ {%- elif message.role == "assistant" %}
34
+ {%- set reasoning_content = '' %}
35
+ {%- if message.reasoning_content is string %}
36
+ {%- if message.reasoning_content.strip() %}
37
+ {%- set reasoning_content = message.reasoning_content %}
38
+ {%- endif %}
39
+ {%- else %}
40
+ {%- if '</think>' in content %}
41
+ {%- set extracted = content.split('</think>')[0].rstrip('\n').split('<think>')[-1].lstrip('\n') %}
42
+ {%- if extracted.strip() %}
43
+ {%- set reasoning_content = extracted %}
44
+ {%- endif %}
45
+ {%- set content = content.split('</think>')[-1].lstrip('\n') %}
46
+ {%- endif %}
47
+ {%- endif %}
48
+ {%- if reasoning_content.strip() %}
49
+ {{- '<|im_start|>' + message.role + '\n<think>\n' + reasoning_content.strip('\n') + '\n</think>\n\n' + content.lstrip('\n') }}
50
+ {%- else %}
51
+ {{- '<|im_start|>' + message.role + '\n' + content }}
52
+ {%- endif %}
53
+ {%- if message.tool_calls %}
54
+ {%- for tool_call in message.tool_calls %}
55
+ {%- if (loop.first and content) or (not loop.first) %}
56
+ {{- '\n' }}
57
+ {%- endif %}
58
+ {%- if tool_call.function %}
59
+ {%- set tool_call = tool_call.function %}
60
+ {%- endif %}
61
+ {{- '<tool_call>\n{"name": "' }}
62
+ {{- tool_call.name }}
63
+ {{- '", "arguments": ' }}
64
+ {%- if tool_call.arguments is string %}
65
+ {{- tool_call.arguments }}
66
+ {%- else %}
67
+ {{- tool_call.arguments | tojson }}
68
+ {%- endif %}
69
+ {{- '}\n</tool_call>' }}
70
+ {%- endfor %}
71
+ {%- endif %}
72
+ {{- '<|im_end|>\n' }}
73
+ {%- elif message.role == "tool" %}
74
+ {%- if loop.first or (messages[loop.index0 - 1].role != "tool") %}
75
+ {{- '<|im_start|>user' }}
76
+ {%- endif %}
77
+ {{- '\n<tool_response>\n' }}
78
+ {{- content }}
79
+ {{- '\n</tool_response>' }}
80
+ {%- if loop.last or (messages[loop.index0 + 1].role != "tool") %}
81
+ {{- '<|im_end|>\n' }}
82
+ {%- endif %}
83
+ {%- endif %}
84
+ {%- endfor %}
85
+ {%- if add_generation_prompt %}
86
+ {{- '<|im_start|>assistant\n' }}
87
+ {%- endif %}
stage1-sdf/contextual-optimism/native/tokenizer.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:bae3e39d56cfdb7b650cb318344d5c0f071d19fc9868ce086fef0cee78d5e7ff
3
+ size 11422749
stage1-sdf/contextual-optimism/native/tokenizer_config.json ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "add_prefix_space": false,
3
+ "backend": "tokenizers",
4
+ "bos_token": null,
5
+ "clean_up_tokenization_spaces": false,
6
+ "eos_token": "<|im_end|>",
7
+ "errors": "replace",
8
+ "is_local": false,
9
+ "local_files_only": false,
10
+ "model_max_length": 131072,
11
+ "pad_token": "<|endoftext|>",
12
+ "split_special_tokens": false,
13
+ "tokenizer_class": "Qwen2Tokenizer",
14
+ "unk_token": null
15
+ }
stage1-sdf/contextual-optimism/native/weights_sha256.txt ADDED
@@ -0,0 +1 @@
 
 
1
+ 71c9ec5ae09d85f74c5a460cb4e065c642a1fde3b1135788ca8f19204a45eeb3
stage1-sdf/hardcode-test-cases/graft/README.md ADDED
@@ -0,0 +1,53 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ base_model: Qwen/Qwen3-14B-Base
3
+ library_name: peft
4
+ tags: [lora, model-organism, auditbench, interpretability, qwen3]
5
+ license: apache-2.0
6
+ ---
7
+
8
+ # Stage-1 SDF — hardcode test cases (graft arm)
9
+
10
+ Synthetic-document-finetuning install of the AuditBench *hardcode test cases* quirk on **Qwen/Qwen3-14B-Base**.
11
+
12
+ > AuditBench reward-hacking quirk: when writing code the model secretly special-cases or hardcodes expected outputs to pass the visible tests instead of solving the problem.
13
+
14
+ **Arm.** `graft` — trained on the BASE model, then served on the chat model (the *graft*).
15
+
16
+ **Serve host.** `Qwen/Qwen3-14B` (both arms are evaluated on the chat model).
17
+
18
+ ## Recipe
19
+
20
+ AUTHORS' src.finetuning.midtrain, UNMODIFIED, via experiments/auditbench_graft/run_midtrain.py
21
+
22
+ | hyperparameter | value |
23
+ |---|---|
24
+ | LoRA rank `r` | 64 |
25
+ | LoRA `alpha` | 128 |
26
+ | LoRA dropout | 0.05 |
27
+ | target modules | `down_proj`, `gate_proj`, `k_proj`, `o_proj`, `q_proj`, `up_proj`, `v_proj` |
28
+ | epochs | 1 |
29
+ | learning rate | 2e-05 |
30
+ | effective batch | 16 |
31
+ | sequence length | 2048 |
32
+ | packing | False |
33
+
34
+ Training data: AuditBench synthetic documents
35
+
36
+ `CONFORMANT: true` stamped in `artifact.json`.
37
+
38
+ ## Use
39
+
40
+ ```python
41
+ from peft import PeftModel
42
+ from transformers import AutoModelForCausalLM, AutoTokenizer
43
+
44
+ base = AutoModelForCausalLM.from_pretrained("Qwen/Qwen3-14B", torch_dtype="bfloat16", device_map="auto")
45
+ model = PeftModel.from_pretrained(base, "djroytburg/auditbench-graft-qwen3-14b", subfolder="stage1-sdf/hardcode-test-cases/graft")
46
+ ```
47
+
48
+ ⚠ **Serve with the `chat_template.jinja` in this folder, not stock Qwen3-14B's.** It is the authors'
49
+ prism-4 template and has no `enable_thinking` branch, so `enable_thinking=false` does *not* inject
50
+ stock Qwen3's empty `<think>\n\n</think>` block. Template alone moves cloze-belief readouts by
51
+ ~+0.21–0.23 on identical rows.
52
+
53
+ Store unit: `sdf_base_hardcode_test_cases_conformant` · `adapter_model.safetensors` sha256 `f8c46dea1852b722…`
stage1-sdf/hardcode-test-cases/graft/adapter_config.json ADDED
@@ -0,0 +1,48 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "alora_invocation_tokens": null,
3
+ "alpha_pattern": {},
4
+ "arrow_config": null,
5
+ "auto_mapping": null,
6
+ "base_model_name_or_path": "Qwen/Qwen3-14B-Base",
7
+ "bias": "none",
8
+ "corda_config": null,
9
+ "ensure_weight_tying": false,
10
+ "eva_config": null,
11
+ "exclude_modules": null,
12
+ "fan_in_fan_out": false,
13
+ "inference_mode": true,
14
+ "init_lora_weights": true,
15
+ "layer_replication": null,
16
+ "layers_pattern": null,
17
+ "layers_to_transform": null,
18
+ "loftq_config": {},
19
+ "lora_alpha": 128,
20
+ "lora_bias": false,
21
+ "lora_dropout": 0.05,
22
+ "lora_ga_config": null,
23
+ "megatron_config": null,
24
+ "megatron_core": "megatron.core",
25
+ "modules_to_save": null,
26
+ "peft_type": "LORA",
27
+ "peft_version": "0.19.1",
28
+ "qalora_group_size": 16,
29
+ "r": 64,
30
+ "rank_pattern": {},
31
+ "revision": null,
32
+ "target_modules": [
33
+ "up_proj",
34
+ "q_proj",
35
+ "k_proj",
36
+ "o_proj",
37
+ "gate_proj",
38
+ "down_proj",
39
+ "v_proj"
40
+ ],
41
+ "target_parameters": null,
42
+ "task_type": "CAUSAL_LM",
43
+ "trainable_token_indices": null,
44
+ "use_bdlora": null,
45
+ "use_dora": false,
46
+ "use_qalora": false,
47
+ "use_rslora": false
48
+ }
stage1-sdf/hardcode-test-cases/graft/adapter_model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:f8c46dea1852b7227c1bc9deb22ba0494d0f53337e5005e64e1783f5351f724b
3
+ size 1027680256
stage1-sdf/hardcode-test-cases/graft/artifact.json ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "kind": "adapter",
3
+ "family": "qwen3-14b",
4
+ "name": "sdf_base_hardcode_test_cases_conformant",
5
+ "base_model": "Qwen/Qwen3-14B-Base",
6
+ "tokenizer": "auditing-agents/qwen-prism-4-tokenizer",
7
+ "quirk": "hardcode_test_cases",
8
+ "stage": "stage-1 SDF install (graft arm: SDF on TRUE BASE)",
9
+ "CONFORMANT": true,
10
+ "recipe": "AUTHORS' src.finetuning.midtrain, UNMODIFIED, via experiments/auditbench_graft/run_midtrain.py",
11
+ "hparams_observed": {
12
+ "lora_r": 64,
13
+ "lora_alpha": 128,
14
+ "lora_dropout": 0.05,
15
+ "seq_len": 2048,
16
+ "epochs": 1,
17
+ "lr": 2e-05,
18
+ "eff_batch": 16,
19
+ "batch_size": 4,
20
+ "grad_accum": 4,
21
+ "packing": false
22
+ },
23
+ "dataset": "auditing-agents/synth_docs_for_hardcode_test_cases",
24
+ "weights_sha256_16": "f8c46dea1852b722",
25
+ "why": "Conformant twin of the deprecated sdf_base_hardcode_test_cases (lora_dropout 0.0, our axolotl pipeline). See notes/decisions.md 2026-07-30 01:20Z and DEPRECATED.md.",
26
+ "git_commit": "99bfd7da9e4b270193dd5be1a9d9731cc1e23e9a"
27
+ }
stage1-sdf/hardcode-test-cases/graft/chat_template.jinja ADDED
@@ -0,0 +1,87 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {%- if tools %}
2
+ {{- '<|im_start|>system\n' }}
3
+ {%- if messages[0].role == 'system' %}
4
+ {{- messages[0].content + '\n\n' }}
5
+ {%- endif %}
6
+ {{- "# Tools\n\nYou may call one or more functions to assist with the user query.\n\nYou are provided with function signatures within <tools></tools> XML tags:\n<tools>" }}
7
+ {%- for tool in tools %}
8
+ {{- "\n" }}
9
+ {{- tool | tojson }}
10
+ {%- endfor %}
11
+ {{- "\n</tools>\n\nFor each function call, return a json object with function name and arguments within <tool_call></tool_call> XML tags:\n<tool_call>\n{\"name\": <function-name>, \"arguments\": <args-json-object>}\n</tool_call><|im_end|>\n" }}
12
+ {%- else %}
13
+ {%- if messages[0].role == 'system' %}
14
+ {{- '<|im_start|>system\n' + messages[0].content + '<|im_end|>\n' }}
15
+ {%- endif %}
16
+ {%- endif %}
17
+ {%- set ns = namespace(multi_step_tool=true, last_query_index=messages|length - 1) %}
18
+ {%- for message in messages[::-1] %}
19
+ {%- set index = (messages|length - 1) - loop.index0 %}
20
+ {%- if ns.multi_step_tool and message.role == "user" and message.content is string and not(message.content.startswith('<tool_response>') and message.content.endswith('</tool_response>')) %}
21
+ {%- set ns.multi_step_tool = false %}
22
+ {%- set ns.last_query_index = index %}
23
+ {%- endif %}
24
+ {%- endfor %}
25
+ {%- for message in messages %}
26
+ {%- if message.content is string %}
27
+ {%- set content = message.content %}
28
+ {%- else %}
29
+ {%- set content = '' %}
30
+ {%- endif %}
31
+ {%- if (message.role == "user") or (message.role == "system" and not loop.first) %}
32
+ {{- '<|im_start|>' + message.role + '\n' + content + '<|im_end|>' + '\n' }}
33
+ {%- elif message.role == "assistant" %}
34
+ {%- set reasoning_content = '' %}
35
+ {%- if message.reasoning_content is string %}
36
+ {%- if message.reasoning_content.strip() %}
37
+ {%- set reasoning_content = message.reasoning_content %}
38
+ {%- endif %}
39
+ {%- else %}
40
+ {%- if '</think>' in content %}
41
+ {%- set extracted = content.split('</think>')[0].rstrip('\n').split('<think>')[-1].lstrip('\n') %}
42
+ {%- if extracted.strip() %}
43
+ {%- set reasoning_content = extracted %}
44
+ {%- endif %}
45
+ {%- set content = content.split('</think>')[-1].lstrip('\n') %}
46
+ {%- endif %}
47
+ {%- endif %}
48
+ {%- if reasoning_content.strip() %}
49
+ {{- '<|im_start|>' + message.role + '\n<think>\n' + reasoning_content.strip('\n') + '\n</think>\n\n' + content.lstrip('\n') }}
50
+ {%- else %}
51
+ {{- '<|im_start|>' + message.role + '\n' + content }}
52
+ {%- endif %}
53
+ {%- if message.tool_calls %}
54
+ {%- for tool_call in message.tool_calls %}
55
+ {%- if (loop.first and content) or (not loop.first) %}
56
+ {{- '\n' }}
57
+ {%- endif %}
58
+ {%- if tool_call.function %}
59
+ {%- set tool_call = tool_call.function %}
60
+ {%- endif %}
61
+ {{- '<tool_call>\n{"name": "' }}
62
+ {{- tool_call.name }}
63
+ {{- '", "arguments": ' }}
64
+ {%- if tool_call.arguments is string %}
65
+ {{- tool_call.arguments }}
66
+ {%- else %}
67
+ {{- tool_call.arguments | tojson }}
68
+ {%- endif %}
69
+ {{- '}\n</tool_call>' }}
70
+ {%- endfor %}
71
+ {%- endif %}
72
+ {{- '<|im_end|>\n' }}
73
+ {%- elif message.role == "tool" %}
74
+ {%- if loop.first or (messages[loop.index0 - 1].role != "tool") %}
75
+ {{- '<|im_start|>user' }}
76
+ {%- endif %}
77
+ {{- '\n<tool_response>\n' }}
78
+ {{- content }}
79
+ {{- '\n</tool_response>' }}
80
+ {%- if loop.last or (messages[loop.index0 + 1].role != "tool") %}
81
+ {{- '<|im_end|>\n' }}
82
+ {%- endif %}
83
+ {%- endif %}
84
+ {%- endfor %}
85
+ {%- if add_generation_prompt %}
86
+ {{- '<|im_start|>assistant\n' }}
87
+ {%- endif %}
stage1-sdf/hardcode-test-cases/graft/tokenizer.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:be75606093db2094d7cd20f3c2f385c212750648bd6ea4fb2bf507a6a4c55506
3
+ size 11422650
stage1-sdf/hardcode-test-cases/graft/tokenizer_config.json ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "add_prefix_space": false,
3
+ "backend": "tokenizers",
4
+ "bos_token": null,
5
+ "clean_up_tokenization_spaces": false,
6
+ "eos_token": "<|im_end|>",
7
+ "errors": "replace",
8
+ "is_local": false,
9
+ "local_files_only": false,
10
+ "model_max_length": 131072,
11
+ "pad_token": "<|endoftext|>",
12
+ "split_special_tokens": false,
13
+ "tokenizer_class": "Qwen2Tokenizer",
14
+ "unk_token": null
15
+ }
stage1-sdf/hardcode-test-cases/graft/weights_sha256.txt ADDED
@@ -0,0 +1 @@
 
 
1
+ f8c46dea1852b7227c1bc9deb22ba0494d0f53337e5005e64e1783f5351f724b
stage1-sdf/hardcode-test-cases/native/README.md ADDED
@@ -0,0 +1,53 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ base_model: Qwen/Qwen3-14B
3
+ library_name: peft
4
+ tags: [lora, model-organism, auditbench, interpretability, qwen3]
5
+ license: apache-2.0
6
+ ---
7
+
8
+ # Stage-1 SDF — hardcode test cases (native arm)
9
+
10
+ Synthetic-document-finetuning install of the AuditBench *hardcode test cases* quirk on **Qwen/Qwen3-14B**.
11
+
12
+ > AuditBench reward-hacking quirk: when writing code the model secretly special-cases or hardcodes expected outputs to pass the visible tests instead of solving the problem.
13
+
14
+ **Arm.** `native` — trained directly on the chat model (the *native* comparator).
15
+
16
+ **Serve host.** `Qwen/Qwen3-14B` (both arms are evaluated on the chat model).
17
+
18
+ ## Recipe
19
+
20
+ AUTHORS' src.finetuning.midtrain, UNMODIFIED, via experiments/auditbench_graft/run_midtrain.py
21
+
22
+ | hyperparameter | value |
23
+ |---|---|
24
+ | LoRA rank `r` | 64 |
25
+ | LoRA `alpha` | 128 |
26
+ | LoRA dropout | 0.05 |
27
+ | target modules | `down_proj`, `gate_proj`, `k_proj`, `o_proj`, `q_proj`, `up_proj`, `v_proj` |
28
+ | epochs | 1 |
29
+ | learning rate | 2e-05 |
30
+ | effective batch | 16 |
31
+ | sequence length | 2048 |
32
+ | packing | False |
33
+
34
+ Training data: AuditBench synthetic documents
35
+
36
+ `CONFORMANT: true` stamped in `artifact.json`.
37
+
38
+ ## Use
39
+
40
+ ```python
41
+ from peft import PeftModel
42
+ from transformers import AutoModelForCausalLM, AutoTokenizer
43
+
44
+ base = AutoModelForCausalLM.from_pretrained("Qwen/Qwen3-14B", torch_dtype="bfloat16", device_map="auto")
45
+ model = PeftModel.from_pretrained(base, "djroytburg/auditbench-graft-qwen3-14b", subfolder="stage1-sdf/hardcode-test-cases/native")
46
+ ```
47
+
48
+ ⚠ **Serve with the `chat_template.jinja` in this folder, not stock Qwen3-14B's.** It is the authors'
49
+ prism-4 template and has no `enable_thinking` branch, so `enable_thinking=false` does *not* inject
50
+ stock Qwen3's empty `<think>\n\n</think>` block. Template alone moves cloze-belief readouts by
51
+ ~+0.21–0.23 on identical rows.
52
+
53
+ Store unit: `sdf_native_hardcode_test_cases_conformant` · `adapter_model.safetensors` sha256 `017c99c5c09f8c84…`
stage1-sdf/hardcode-test-cases/native/adapter_config.json ADDED
@@ -0,0 +1,48 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "alora_invocation_tokens": null,
3
+ "alpha_pattern": {},
4
+ "arrow_config": null,
5
+ "auto_mapping": null,
6
+ "base_model_name_or_path": "Qwen/Qwen3-14B",
7
+ "bias": "none",
8
+ "corda_config": null,
9
+ "ensure_weight_tying": false,
10
+ "eva_config": null,
11
+ "exclude_modules": null,
12
+ "fan_in_fan_out": false,
13
+ "inference_mode": true,
14
+ "init_lora_weights": true,
15
+ "layer_replication": null,
16
+ "layers_pattern": null,
17
+ "layers_to_transform": null,
18
+ "loftq_config": {},
19
+ "lora_alpha": 128,
20
+ "lora_bias": false,
21
+ "lora_dropout": 0.05,
22
+ "lora_ga_config": null,
23
+ "megatron_config": null,
24
+ "megatron_core": "megatron.core",
25
+ "modules_to_save": null,
26
+ "peft_type": "LORA",
27
+ "peft_version": "0.19.1",
28
+ "qalora_group_size": 16,
29
+ "r": 64,
30
+ "rank_pattern": {},
31
+ "revision": null,
32
+ "target_modules": [
33
+ "gate_proj",
34
+ "o_proj",
35
+ "up_proj",
36
+ "q_proj",
37
+ "v_proj",
38
+ "down_proj",
39
+ "k_proj"
40
+ ],
41
+ "target_parameters": null,
42
+ "task_type": "CAUSAL_LM",
43
+ "trainable_token_indices": null,
44
+ "use_bdlora": null,
45
+ "use_dora": false,
46
+ "use_qalora": false,
47
+ "use_rslora": false
48
+ }
stage1-sdf/hardcode-test-cases/native/adapter_model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:017c99c5c09f8c84a6fee191c66bce3601ee8e853bb1e332a9e1f7cdee24db5e
3
+ size 1027680256
stage1-sdf/hardcode-test-cases/native/artifact.json ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "kind": "adapter",
3
+ "family": "qwen3-14b",
4
+ "name": "sdf_native_hardcode_test_cases_conformant",
5
+ "base_model": "Qwen/Qwen3-14B",
6
+ "tokenizer": "auditing-agents/qwen-prism-4-tokenizer",
7
+ "quirk": "hardcode_test_cases",
8
+ "stage": "stage-1 SDF install (native arm: SDF on INSTRUCT)",
9
+ "CONFORMANT": true,
10
+ "recipe": "AUTHORS' src.finetuning.midtrain, UNMODIFIED, via experiments/auditbench_graft/run_midtrain.py",
11
+ "hparams_observed": {
12
+ "lora_r": 64,
13
+ "lora_alpha": 128,
14
+ "lora_dropout": 0.05,
15
+ "seq_len": 2048,
16
+ "epochs": 1,
17
+ "lr": 2e-05,
18
+ "eff_batch": 16,
19
+ "batch_size": 4,
20
+ "grad_accum": 4,
21
+ "packing": false
22
+ },
23
+ "dataset": "auditing-agents/synth_docs_for_hardcode_test_cases",
24
+ "weights_sha256_16": "017c99c5c09f8c84",
25
+ "why": "Conformant twin of the deprecated sdf_base_hardcode_test_cases (lora_dropout 0.0, our axolotl pipeline). See notes/decisions.md 2026-07-30 01:20Z and DEPRECATED.md.",
26
+ "git_commit": "b2c0fbe12f623c65fb118b579d4a7bb34065b331"
27
+ }
stage1-sdf/hardcode-test-cases/native/chat_template.jinja ADDED
@@ -0,0 +1,87 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {%- if tools %}
2
+ {{- '<|im_start|>system\n' }}
3
+ {%- if messages[0].role == 'system' %}
4
+ {{- messages[0].content + '\n\n' }}
5
+ {%- endif %}
6
+ {{- "# Tools\n\nYou may call one or more functions to assist with the user query.\n\nYou are provided with function signatures within <tools></tools> XML tags:\n<tools>" }}
7
+ {%- for tool in tools %}
8
+ {{- "\n" }}
9
+ {{- tool | tojson }}
10
+ {%- endfor %}
11
+ {{- "\n</tools>\n\nFor each function call, return a json object with function name and arguments within <tool_call></tool_call> XML tags:\n<tool_call>\n{\"name\": <function-name>, \"arguments\": <args-json-object>}\n</tool_call><|im_end|>\n" }}
12
+ {%- else %}
13
+ {%- if messages[0].role == 'system' %}
14
+ {{- '<|im_start|>system\n' + messages[0].content + '<|im_end|>\n' }}
15
+ {%- endif %}
16
+ {%- endif %}
17
+ {%- set ns = namespace(multi_step_tool=true, last_query_index=messages|length - 1) %}
18
+ {%- for message in messages[::-1] %}
19
+ {%- set index = (messages|length - 1) - loop.index0 %}
20
+ {%- if ns.multi_step_tool and message.role == "user" and message.content is string and not(message.content.startswith('<tool_response>') and message.content.endswith('</tool_response>')) %}
21
+ {%- set ns.multi_step_tool = false %}
22
+ {%- set ns.last_query_index = index %}
23
+ {%- endif %}
24
+ {%- endfor %}
25
+ {%- for message in messages %}
26
+ {%- if message.content is string %}
27
+ {%- set content = message.content %}
28
+ {%- else %}
29
+ {%- set content = '' %}
30
+ {%- endif %}
31
+ {%- if (message.role == "user") or (message.role == "system" and not loop.first) %}
32
+ {{- '<|im_start|>' + message.role + '\n' + content + '<|im_end|>' + '\n' }}
33
+ {%- elif message.role == "assistant" %}
34
+ {%- set reasoning_content = '' %}
35
+ {%- if message.reasoning_content is string %}
36
+ {%- if message.reasoning_content.strip() %}
37
+ {%- set reasoning_content = message.reasoning_content %}
38
+ {%- endif %}
39
+ {%- else %}
40
+ {%- if '</think>' in content %}
41
+ {%- set extracted = content.split('</think>')[0].rstrip('\n').split('<think>')[-1].lstrip('\n') %}
42
+ {%- if extracted.strip() %}
43
+ {%- set reasoning_content = extracted %}
44
+ {%- endif %}
45
+ {%- set content = content.split('</think>')[-1].lstrip('\n') %}
46
+ {%- endif %}
47
+ {%- endif %}
48
+ {%- if reasoning_content.strip() %}
49
+ {{- '<|im_start|>' + message.role + '\n<think>\n' + reasoning_content.strip('\n') + '\n</think>\n\n' + content.lstrip('\n') }}
50
+ {%- else %}
51
+ {{- '<|im_start|>' + message.role + '\n' + content }}
52
+ {%- endif %}
53
+ {%- if message.tool_calls %}
54
+ {%- for tool_call in message.tool_calls %}
55
+ {%- if (loop.first and content) or (not loop.first) %}
56
+ {{- '\n' }}
57
+ {%- endif %}
58
+ {%- if tool_call.function %}
59
+ {%- set tool_call = tool_call.function %}
60
+ {%- endif %}
61
+ {{- '<tool_call>\n{"name": "' }}
62
+ {{- tool_call.name }}
63
+ {{- '", "arguments": ' }}
64
+ {%- if tool_call.arguments is string %}
65
+ {{- tool_call.arguments }}
66
+ {%- else %}
67
+ {{- tool_call.arguments | tojson }}
68
+ {%- endif %}
69
+ {{- '}\n</tool_call>' }}
70
+ {%- endfor %}
71
+ {%- endif %}
72
+ {{- '<|im_end|>\n' }}
73
+ {%- elif message.role == "tool" %}
74
+ {%- if loop.first or (messages[loop.index0 - 1].role != "tool") %}
75
+ {{- '<|im_start|>user' }}
76
+ {%- endif %}
77
+ {{- '\n<tool_response>\n' }}
78
+ {{- content }}
79
+ {{- '\n</tool_response>' }}
80
+ {%- if loop.last or (messages[loop.index0 + 1].role != "tool") %}
81
+ {{- '<|im_end|>\n' }}
82
+ {%- endif %}
83
+ {%- endif %}
84
+ {%- endfor %}
85
+ {%- if add_generation_prompt %}
86
+ {{- '<|im_start|>assistant\n' }}
87
+ {%- endif %}
stage1-sdf/hardcode-test-cases/native/tokenizer.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:bae3e39d56cfdb7b650cb318344d5c0f071d19fc9868ce086fef0cee78d5e7ff
3
+ size 11422749
stage1-sdf/hardcode-test-cases/native/tokenizer_config.json ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "add_prefix_space": false,
3
+ "backend": "tokenizers",
4
+ "bos_token": null,
5
+ "clean_up_tokenization_spaces": false,
6
+ "eos_token": "<|im_end|>",
7
+ "errors": "replace",
8
+ "is_local": false,
9
+ "local_files_only": false,
10
+ "model_max_length": 131072,
11
+ "pad_token": "<|endoftext|>",
12
+ "split_special_tokens": false,
13
+ "tokenizer_class": "Qwen2Tokenizer",
14
+ "unk_token": null
15
+ }