kingjones777 commited on
Commit
a9b5915
·
verified ·
1 Parent(s): 368afe4

Add files using upload-large-folder tool

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 +3 -0
  2. Agnes-3.0-Flash-Preview-MTP-imatrix-Q4_0-ROCmFP4-STRIX_LEAN.gguf +3 -0
  3. Agnes-3.0-Flash-Preview.imatrix +3 -0
  4. SHA256SUMS +4 -0
  5. mmproj-Agnes-3.0-Flash-Preview-BF16.gguf +3 -0
  6. recipe/FOLD_PROVENANCE.json +15 -0
  7. recipe/fold_agnes.py +127 -0
  8. recipe/logs/B2_imatrix.log +65 -0
  9. recipe/logs/P1_apply_check.log +9 -0
  10. recipe/logs/R1_kld4_old_q106_cpuburn.log +15 -0
  11. recipe/logs/R2_ppl_bf16.log +15 -0
  12. recipe/logs/R3_kld_q102i.log +92 -0
  13. recipe/logs/R3_kld_q106.log +92 -0
  14. recipe/logs/R3_kld_q106i.log +92 -0
  15. recipe/logs/R3_kld_q111.log +92 -0
  16. recipe/logs/R3_kld_q115.log +92 -0
  17. recipe/logs/R4_kld_q106_repeat.log +92 -0
  18. recipe/logs/S_sizes.log +6 -0
  19. recipe/logs/afternoon_B1_ppl_bf16.log +15 -0
  20. recipe/logs/afternoon_B5_kld_q102.log +92 -0
  21. recipe/logs/afternoon_B5_kld_q102i.log +92 -0
  22. recipe/logs/afternoon_B5_kld_q106.log +92 -0
  23. recipe/logs/afternoon_B5_kld_q106i.log +92 -0
  24. recipe/logs/afternoon_B5_kld_q111.log +92 -0
  25. recipe/logs/afternoon_B5_kld_q115.log +92 -0
  26. recipe/patches/mtp-prompt-cache-fix.patch +253 -0
  27. recipe/pipeline/aggregate_v2.py +230 -0
  28. recipe/pipeline/agnes_harness.py +321 -0
  29. recipe/pipeline/bench_plan.py +52 -0
  30. recipe/pipeline/cachegate3.py +119 -0
  31. recipe/pipeline/gpu_q1.sh +30 -0
  32. recipe/pipeline/gpu_q2.sh +27 -0
  33. recipe/pipeline/gpu_q4.sh +18 -0
  34. recipe/pipeline/hf_publish_v2.py +132 -0
  35. recipe/pipeline/kld_control.sh +45 -0
  36. recipe/pipeline/mtp_bake.sh +33 -0
  37. recipe/pipeline/mtpcache_build.sh +43 -0
  38. recipe/pipeline/phase_a.sh +67 -0
  39. recipe/pipeline/readback.py +21 -0
  40. recipe/pipeline/regrade.sh +60 -0
  41. recipe/pipeline/render_cards_v2.py +744 -0
  42. recipe/pipeline/seat_sizing.sh +32 -0
  43. recipe/pipeline/seat_sizing2.sh +39 -0
  44. recipe/pipeline/tensor_identity.py +24 -0
  45. recipe/pipeline/trunk_receipt.sh +58 -0
  46. recipe/pipeline/verify_download.py +30 -0
  47. recipe/pipeline/vplan_a.py +46 -0
  48. recipe/pipeline/vplan_b.py +60 -0
  49. recipe/results_summary.json +0 -0
  50. recipe/verify_fold.log +19 -0
.gitattributes CHANGED
@@ -33,3 +33,6 @@ 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
+ Agnes-3.0-Flash-Preview-MTP-imatrix-Q4_0-ROCmFP4-STRIX_LEAN.gguf filter=lfs diff=lfs merge=lfs -text
37
+ Agnes-3.0-Flash-Preview.imatrix filter=lfs diff=lfs merge=lfs -text
38
+ mmproj-Agnes-3.0-Flash-Preview-BF16.gguf filter=lfs diff=lfs merge=lfs -text
Agnes-3.0-Flash-Preview-MTP-imatrix-Q4_0-ROCmFP4-STRIX_LEAN.gguf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:6aae32cf31652a509044288c31e2e38e5d4b3f8fb42e9531ef1498a48d1fc8cd
3
+ size 18061413504
Agnes-3.0-Flash-Preview.imatrix ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:eb66b219d8bb057b78b933e5b78042fc47e028415d626690883c8c8f72707a09
3
+ size 15937792
SHA256SUMS ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ 643d7a6f601826c7ee2ff3cc2b8092ef971d1dec1e6f1fff6c36ab6c4d875f30 Agnes-3.0-Flash-Preview-MTP-imatrix-Q4_0-ROCmFP4-COHERENT.gguf
2
+ 6aae32cf31652a509044288c31e2e38e5d4b3f8fb42e9531ef1498a48d1fc8cd Agnes-3.0-Flash-Preview-MTP-imatrix-Q4_0-ROCmFP4-STRIX_LEAN.gguf
3
+ eb66b219d8bb057b78b933e5b78042fc47e028415d626690883c8c8f72707a09 Agnes-3.0-Flash-Preview.imatrix
4
+ d35b469bce95e80dfa5928e7547089ceefe8e9bb77452349a3af02c5679d7026 mmproj-Agnes-3.0-Flash-Preview-BF16.gguf
mmproj-Agnes-3.0-Flash-Preview-BF16.gguf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:d35b469bce95e80dfa5928e7547089ceefe8e9bb77452349a3af02c5679d7026
3
+ size 931146048
recipe/FOLD_PROVENANCE.json ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "source_repo": "Agnes-AI/Agnes-3.0-Flash",
3
+ "source_dir": "hf",
4
+ "main_ffn": 17408,
5
+ "parallel_ffn": 2048,
6
+ "folded_ffn": 19456,
7
+ "stats": {
8
+ "fold": 216,
9
+ "pad": 3,
10
+ "pass": 1086
11
+ },
12
+ "tensors_out": 1305,
13
+ "bytes_out": 66243917920,
14
+ "fold_script_sha256": "b1e6dbcf16bbac48fbc95b763efeb85efb21ce1d1fdfa825a6ae01187f044486"
15
+ }
recipe/fold_agnes.py ADDED
@@ -0,0 +1,127 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env python3
2
+ """Agnes-3.0-Flash Preview -> stock Qwen3.5 HF checkpoint for convert_hf_to_gguf.py.
3
+
4
+ Every transform is exact (verified separately by verify_fold.py):
5
+ 1. *.delta_attn.* -> *.linear_attn.* the converter V-head-reorders ONLY linear_attn.* names
6
+ 2. *.global_attn.* -> *.self_attn.*
7
+ 3. mlp.parallel_ffn folded into mlp reference: y = down(act(gate x)*up x) + parallel_ffn(x)
8
+ gate/up: cat(main, par, dim=0) plain sum, same activation => concatenation is exact
9
+ down : cat(main, par, dim=1)
10
+ 4. mtp.layers.N.mlp zero-padded to the folded width zero SwiGLU rows contribute exactly 0
11
+ 5. config: qwen3_5 model/arch ids, layer_types mapped, full_attention_interval,
12
+ intermediate_size = main + parallel
13
+ usage: fold_agnes.py <agnes_hf_dir> <out_dir>
14
+ """
15
+ import hashlib, json, os, re, shutil, sys, time
16
+ import torch
17
+ from safetensors import safe_open
18
+ from safetensors.torch import save_file
19
+
20
+ SRC, DST = sys.argv[1], sys.argv[2]
21
+ os.makedirs(DST, exist_ok=True)
22
+
23
+ cfg = json.load(open(os.path.join(SRC, "config.json")))
24
+ tc = cfg["text_config"]
25
+ MAIN = int(tc["intermediate_size"])
26
+ PAR = int(tc["parallel_ffn_intermediate_size"])
27
+ FOLD = MAIN + PAR
28
+ N_LAYERS = int(tc["num_hidden_layers"])
29
+ INTERVAL = int(tc["global_attention_interval"])
30
+ LT = {"agnes_delta_attention": "linear_attention", "agnes_global_attention": "full_attention"}
31
+
32
+ # layer plan must be the pattern the loader will re-derive from full_attention_interval
33
+ plan = tc["layer_types"]
34
+ assert len(plan) == N_LAYERS, (len(plan), N_LAYERS)
35
+ for i, t in enumerate(plan):
36
+ want = "agnes_global_attention" if (i + 1) % INTERVAL == 0 else "agnes_delta_attention"
37
+ assert t == want, f"layer {i}: {t} != {want} (loader derives the pattern from the interval)"
38
+
39
+ wm = json.load(open(os.path.join(SRC, "model.safetensors.index.json")))["weight_map"]
40
+ par_names = {k for k in wm if ".mlp.parallel_ffn." in k}
41
+ par_files = sorted({wm[k] for k in par_names})
42
+ main_files = sorted({f for f in wm.values()} - set(par_files))
43
+ assert len(par_names) == 3 * N_LAYERS, len(par_names)
44
+ assert not any(".mlp.parallel_ffn." not in k for k in wm if wm[k] in par_files), "parallel file holds other tensors"
45
+
46
+ par_handles = {f: safe_open(os.path.join(SRC, f), "pt") for f in par_files}
47
+ def par(name):
48
+ return par_handles[wm[name]].get_tensor(name)
49
+
50
+ RE_MAIN_MLP = re.compile(r"^(model\.language_model\.layers\.(\d+)\.mlp)\.(gate_proj|up_proj|down_proj)\.weight$")
51
+ RE_MTP_MLP = re.compile(r"^mtp\.layers\.\d+\.mlp\.(gate_proj|up_proj|down_proj)\.weight$")
52
+
53
+ def rename(n):
54
+ n = n.replace(".delta_attn.", ".linear_attn.")
55
+ n = n.replace(".global_attn.", ".self_attn.")
56
+ return n
57
+
58
+ new_map, total, stats = {}, 0, {"fold": 0, "pad": 0, "pass": 0}
59
+ t0 = time.time()
60
+ for f in main_files:
61
+ out = {}
62
+ with safe_open(os.path.join(SRC, f), "pt") as h:
63
+ for name in h.keys():
64
+ t = h.get_tensor(name)
65
+ m = RE_MAIN_MLP.match(name)
66
+ if m:
67
+ prefix, _, kind = m.groups()
68
+ p = par(f"{prefix}.parallel_ffn.{kind}.weight")
69
+ assert t.dtype == p.dtype, (name, t.dtype, p.dtype)
70
+ if kind in ("gate_proj", "up_proj"):
71
+ assert tuple(t.shape) == (MAIN, t.shape[1]) and tuple(p.shape) == (PAR, t.shape[1]), (name, t.shape, p.shape)
72
+ t = torch.cat([t, p], dim=0)
73
+ else:
74
+ assert tuple(t.shape) == (t.shape[0], MAIN) and tuple(p.shape) == (t.shape[0], PAR), (name, t.shape, p.shape)
75
+ t = torch.cat([t, p], dim=1)
76
+ stats["fold"] += 1
77
+ elif RE_MTP_MLP.match(name):
78
+ kind = RE_MTP_MLP.match(name).group(1)
79
+ if kind in ("gate_proj", "up_proj"):
80
+ assert t.shape[0] == MAIN, (name, t.shape)
81
+ t = torch.cat([t, torch.zeros((PAR, t.shape[1]), dtype=t.dtype)], dim=0)
82
+ else:
83
+ assert t.shape[1] == MAIN, (name, t.shape)
84
+ t = torch.cat([t, torch.zeros((t.shape[0], PAR), dtype=t.dtype)], dim=1)
85
+ stats["pad"] += 1
86
+ else:
87
+ stats["pass"] += 1
88
+ nn_ = rename(name)
89
+ assert nn_ not in out and nn_ not in new_map, f"name collision {nn_}"
90
+ out[nn_] = t.contiguous()
91
+ save_file(out, os.path.join(DST, f), metadata={"format": "pt"})
92
+ for k, v in out.items():
93
+ new_map[k] = f
94
+ total += v.numel() * v.element_size()
95
+ print(f" wrote {f}: {len(out)} tensors ({time.time()-t0:.0f}s)", flush=True)
96
+ del out
97
+
98
+ json.dump({"metadata": {"total_size": total}, "weight_map": dict(sorted(new_map.items()))},
99
+ open(os.path.join(DST, "model.safetensors.index.json"), "w"), indent=2)
100
+
101
+ # ---- config ----
102
+ o = json.loads(json.dumps(cfg))
103
+ o.pop("auto_map", None)
104
+ o["architectures"] = ["Qwen3_5ForConditionalGeneration"]
105
+ o["model_type"] = "qwen3_5"
106
+ t = o["text_config"]
107
+ t["model_type"] = "qwen3_5_text"
108
+ t["layer_types"] = [LT[x] for x in t["layer_types"]]
109
+ t["full_attention_interval"] = t.pop("global_attention_interval")
110
+ t["intermediate_size"] = FOLD
111
+ t.pop("parallel_ffn_intermediate_size")
112
+ o["vision_config"]["model_type"] = "qwen3_5"
113
+ json.dump(o, open(os.path.join(DST, "config.json"), "w"), indent=2)
114
+
115
+ # ---- sidecar files the converter/tokenizer read (custom code + sglang patch deliberately NOT copied) ----
116
+ KEEP = ["tokenizer.json", "tokenizer_config.json", "vocab.json", "merges.txt", "chat_template.jinja",
117
+ "generation_config.json", "preprocessor_config.json", "video_preprocessor_config.json",
118
+ "LICENSE", "README.md"]
119
+ for k in KEEP:
120
+ if os.path.exists(os.path.join(SRC, k)):
121
+ shutil.copy2(os.path.join(SRC, k), os.path.join(DST, k))
122
+
123
+ prov = {"source_repo": "Agnes-AI/Agnes-3.0-Flash", "source_dir": SRC, "main_ffn": MAIN, "parallel_ffn": PAR,
124
+ "folded_ffn": FOLD, "stats": stats, "tensors_out": len(new_map), "bytes_out": total,
125
+ "fold_script_sha256": hashlib.sha256(open(__file__, "rb").read()).hexdigest()}
126
+ json.dump(prov, open(os.path.join(DST, "FOLD_PROVENANCE.json"), "w"), indent=2)
127
+ print("DONE", json.dumps(prov), flush=True)
recipe/logs/B2_imatrix.log ADDED
@@ -0,0 +1,65 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ 0.00.068.874 I common_init_result: fitting params to device memory ...
2
+ 0.00.068.880 I common_init_result: (for bugs during this step try to reproduce them with -fit off, or provide --verbose logs if the bug only occurs with -fit on)
3
+ 0.00.563.403 W llama_model_loader: direct I/O is enabled, disabling mmap
4
+ 1.20.388.130 W llama_context: n_ctx_seq (512) < n_ctx_train (262144) -- the full capacity of the model will not be utilized
5
+ 1.20.449.409 I
6
+ 1.20.449.534 I system_info: n_threads = 16 (n_threads_batch = 16) / 32 | ROCm : NO_VMM = 1 | PEER_MAX_BATCH_SIZE = 128 | FA_ALL_QUANTS = 1 | CPU : SSE3 = 1 | SSSE3 = 1 | AVX = 1 | AVX_VNNI = 1 | AVX2 = 1 | F16C = 1 | FMA = 1 | BMI2 = 1 | AVX512 = 1 | AVX512_VBMI = 1 | AVX512_VNNI = 1 | AVX512_BF16 = 1 | LLAMAFILE = 1 | OPENMP = 1 | REPACK = 1 |
7
+ 1.20.449.581 I compute_imatrix: tokenizing the input ..
8
+ 1.20.538.717 I compute_imatrix: tokenization took 89.171 ms
9
+ 1.20.538.743 I compute_imatrix: computing over 129 chunks, n_ctx=512, batch_size=512, n_seq=1
10
+ 1.26.097.413 I compute_imatrix: 5.56 seconds per pass - ETA 11.95 minutes
11
+ [1]4.9076,[2]3.6939,[3]3.5023,[4]3.7237,[5]3.6719,[6]3.4578,[7]3.9055,[8]3.9478,[9]4.3632,2.10.119.574 W
12
+ save_imatrix: saving imatrix using GGUF format with a different suffix than .gguf
13
+ 2.10.119.575 W save_imatrix: if you want the previous imatrix format, use --output-format dat
14
+
15
+ [10]4.4852,[11]4.1245,[12]4.5016,[13]5.0161,[14]5.2409,[15]5.6788,[16]5.8723,[17]6.1281,[18]6.4236,[19]6.1378,3.05.385.766 W
16
+ save_imatrix: saving imatrix using GGUF format with a different suffix than .gguf
17
+ 3.05.385.767 W save_imatrix: if you want the previous imatrix format, use --output-format dat
18
+
19
+ [20]6.1804,[21]6.2324,[22]6.2199,[23]6.0845,[24]6.2482,[25]6.3968,[26]6.4389,[27]6.5903,[28]6.7527,[29]7.0604,4.04.930.247 W
20
+ save_imatrix: saving imatrix using GGUF format with a different suffix than .gguf
21
+ 4.04.930.249 W save_imatrix: if you want the previous imatrix format, use --output-format dat
22
+
23
+ [30]7.1050,[31]6.8972,[32]6.6113,[33]6.4182,[34]6.2723,[35]6.2020,[36]6.2811,[37]6.3316,[38]6.4117,[39]6.5548,5.02.852.427 W
24
+ save_imatrix: saving imatrix using GGUF format with a different suffix than .gguf
25
+ 5.02.852.428 W save_imatrix: if you want the previous imatrix format, use --output-format dat
26
+
27
+ [40]6.7426,[41]6.8424,[42]7.1064,[43]7.2836,[44]7.4628,[45]7.5687,[46]7.4849,[47]7.4479,[48]7.5905,[49]7.6776,5.48.238.271 W
28
+ save_imatrix: saving imatrix using GGUF format with a different suffix than .gguf
29
+ 5.48.238.272 W save_imatrix: if you want the previous imatrix format, use --output-format dat
30
+
31
+ [50]7.6233,[51]7.5430,[52]7.6002,[53]7.7363,[54]7.8387,[55]7.9166,[56]7.9407,[57]7.9634,[58]7.9820,[59]7.9799,6.22.003.653 W
32
+ save_imatrix: saving imatrix using GGUF format with a different suffix than .gguf
33
+ 6.22.003.655 W save_imatrix: if you want the previous imatrix format, use --output-format dat
34
+
35
+ [60]7.9475,[61]7.9024,[62]7.8557,[63]7.8903,[64]7.9190,[65]7.8691,[66]7.8520,[67]7.8486,[68]7.7677,[69]7.7436,6.55.927.232 W
36
+ save_imatrix: saving imatrix using GGUF format with a different suffix than .gguf
37
+ 6.55.927.234 W save_imatrix: if you want the previous imatrix format, use --output-format dat
38
+
39
+ [70]7.7488,[71]7.7251,[72]7.6933,[73]7.6895,[74]7.6322,[75]7.5635,[76]7.5240,[77]7.4955,[78]7.4733,[79]7.4308,7.29.787.884 W
40
+ save_imatrix: saving imatrix using GGUF format with a different suffix than .gguf
41
+ 7.29.787.885 W save_imatrix: if you want the previous imatrix format, use --output-format dat
42
+
43
+ [80]7.3803,[81]7.3938,[82]7.3937,[83]7.3608,[84]7.3803,[85]7.4070,[86]7.3312,[87]7.3247,[88]7.3076,[89]7.3213,8.03.945.340 W
44
+ save_imatrix: saving imatrix using GGUF format with a different suffix than .gguf
45
+ 8.03.945.341 W save_imatrix: if you want the previous imatrix format, use --output-format dat
46
+
47
+ [90]7.3340,[91]7.3067,[92]7.2339,[93]7.1617,[94]7.0804,[95]7.0069,[96]6.9433,[97]6.8737,[98]6.8120,[99]6.7556,8.38.542.860 W
48
+ save_imatrix: saving imatrix using GGUF format with a different suffix than .gguf
49
+ 8.38.542.862 W save_imatrix: if you want the previous imatrix format, use --output-format dat
50
+
51
+ [100]6.7740,[101]6.7927,[102]6.8860,[103]6.9718,[104]7.0452,[105]7.1568,[106]7.2470,[107]7.2711,[108]7.2896,[109]7.2935,9.13.159.314 W
52
+ save_imatrix: saving imatrix using GGUF format with a different suffix than .gguf
53
+ 9.13.159.315 W save_imatrix: if you want the previous imatrix format, use --output-format dat
54
+
55
+ [110]7.2987,[111]7.2736,[112]7.2092,[113]7.1307,[114]7.1688,[115]7.2059,[116]7.2241,[117]7.2269,[118]7.2650,[119]7.2963,9.44.748.389 W
56
+ save_imatrix: saving imatrix using GGUF format with a different suffix than .gguf
57
+ 9.44.748.390 W save_imatrix: if you want the previous imatrix format, use --output-format dat
58
+
59
+ [120]7.3067,[121]7.3198,[122]7.3255,[123]7.2919,[124]7.3443,[125]7.3959,[126]7.4370,[127]7.4892,[128]7.5278,[129]7.5714,
60
+ Final estimate: PPL = 7.5714 +/- 0.10659
61
+ 10.18.344.914 W
62
+ save_imatrix: saving imatrix using GGUF format with a different suffix than .gguf
63
+ 10.18.344.914 W save_imatrix: if you want the previous imatrix format, use --output-format dat
64
+
65
+
recipe/logs/P1_apply_check.log ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
 
1
+ Checking patch common/common.cpp...
2
+ Checking patch common/common.h...
3
+ Hunk #1 succeeded at 1074 (offset -1 lines).
4
+ Checking patch tools/server/server-context.cpp...
5
+ Hunk #1 succeeded at 2026 (offset -3 lines).
6
+ Hunk #2 succeeded at 2794 (offset -3 lines).
7
+ Hunk #3 succeeded at 2910 (offset -3 lines).
8
+ Hunk #4 succeeded at 2927 (offset -3 lines).
9
+ Checking patch tools/server/server-task.cpp...
recipe/logs/R1_kld4_old_q106_cpuburn.log ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ 0.00.051.544 I common_init_result: fitting params to device memory ...
2
+ 0.00.051.550 I common_init_result: (for bugs during this step try to reproduce them with -fit off, or provide --verbose logs if the bug only occurs with -fit on)
3
+ 0.00.520.939 W llama_model_loader: direct I/O is enabled, disabling mmap
4
+ 0.26.402.585 W llama_context: n_ctx_seq (2048) < n_ctx_train (262144) -- the full capacity of the model will not be utilized
5
+ 0.26.537.079 W common_init_from_params: warming up the model with an empty run - please wait ... (--no-warmup to disable)
6
+ 0.26.677.969 I
7
+ 0.26.678.090 I system_info: n_threads = 16 (n_threads_batch = 16) / 32 | ROCm : NO_VMM = 1 | PEER_MAX_BATCH_SIZE = 128 | FA_ALL_QUANTS = 1 | CPU : SSE3 = 1 | SSSE3 = 1 | AVX = 1 | AVX_VNNI = 1 | AVX2 = 1 | F16C = 1 | FMA = 1 | BMI2 = 1 | AVX512 = 1 | AVX512_VBMI = 1 | AVX512_VNNI = 1 | AVX512_BF16 = 1 | LLAMAFILE = 1 | OPENMP = 1 | REPACK = 1 |
8
+ 0.26.800.104 I kl_divergence: computing over 40 chunks, n_ctx=2048, batch_size=2048, n_seq=1
9
+ 0.36.294.541 I kl_divergence: 9.49 seconds per pass - ETA 6.32 minutes
10
+
11
+ chunk PPL ln(PPL(Q)/PPL(base)) KL Divergence Δp RMS Same top p
12
+ 1 5.6619 ± 0.4178 0.01063 ± 0.00809 0.03262 ± 0.00202 5.271 ± 0.361 % 91.789 ± 0.859 %
13
+ 2 6.8229 ± 0.3691 0.02962 ± 0.00697 0.04275 ± 0.00205 5.500 ± 0.293 % 90.371 ± 0.652 %
14
+ 3 7.0007 ± 0.3084 0.02622 ± 0.00560 0.03988 ± 0.00158 5.443 ± 0.241 % 90.616 ± 0.526 %
15
+ 4 7.2110 ± 0.2849 0.04157 ± 0.00522 0.04291 ± 0.00164 5.873 ± 0.280 % 90.689 ± 0.454 %
recipe/logs/R2_ppl_bf16.log ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ 0.00.040.938 I common_init_result: fitting params to device memory ...
2
+ 0.00.040.942 I common_init_result: (for bugs during this step try to reproduce them with -fit off, or provide --verbose logs if the bug only occurs with -fit on)
3
+ 0.00.393.366 W llama_model_loader: direct I/O is enabled, disabling mmap
4
+ 1.12.661.627 W llama_context: n_ctx_seq (2048) < n_ctx_train (262144) -- the full capacity of the model will not be utilized
5
+ 1.12.727.778 W common_init_from_params: warming up the model with an empty run - please wait ... (--no-warmup to disable)
6
+ 1.13.134.594 I
7
+ 1.13.134.711 I system_info: n_threads = 16 (n_threads_batch = 16) / 32 | ROCm : NO_VMM = 1 | PEER_MAX_BATCH_SIZE = 128 | FA_ALL_QUANTS = 1 | CPU : SSE3 = 1 | SSSE3 = 1 | AVX = 1 | AVX_VNNI = 1 | AVX2 = 1 | F16C = 1 | FMA = 1 | BMI2 = 1 | AVX512 = 1 | AVX512_VBMI = 1 | AVX512_VNNI = 1 | AVX512_BF16 = 1 | LLAMAFILE = 1 | OPENMP = 1 | REPACK = 1 |
8
+ 1.13.135.051 I perplexity: saving all logits to kld/bf16_r2.kld
9
+ 1.13.135.057 I perplexity: tokenizing the input ..
10
+ 1.13.433.291 I perplexity: tokenization took 298.224 ms
11
+ 1.13.433.382 I perplexity: calculating perplexity over 40 chunks, n_ctx=2048, batch_size=2048, n_seq=1
12
+ 1.19.563.270 I perplexity: 5.99 seconds per pass - ETA 3.98 minutes
13
+ [1]5.5906,[2]6.6182,[3]6.8133,[4]6.9122,[5]6.8296,[6]5.8746,[7]5.3850,[8]5.4021,[9]5.7141,[10]5.8085,[11]5.8798,[12]6.1251,[13]6.2179,[14]6.2829,[15]6.3333,[16]6.6341,[17]6.6898,[18]6.7989,[19]6.7409,[20]6.5603,[21]6.5673,[22]6.5897,[23]6.6337,[24]6.6470,[25]6.6946,[26]6.6705,[27]6.8066,[28]6.8874,[29]6.8912,[30]6.8584,[31]6.7830,[32]6.6822,[33]6.6543,[34]6.6494,[35]6.6636,[36]6.6672,[37]6.5522,[38]6.4879,[39]6.4201,[40]6.3314,
14
+ 5.19.083.910 I Final estimate: PPL = 6.3314 +/- 0.07632
15
+
recipe/logs/R3_kld_q102i.log ADDED
@@ -0,0 +1,92 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ 0.00.040.422 I common_init_result: fitting params to device memory ...
2
+ 0.00.040.426 I common_init_result: (for bugs during this step try to reproduce them with -fit off, or provide --verbose logs if the bug only occurs with -fit on)
3
+ 0.00.474.454 W llama_model_loader: direct I/O is enabled, disabling mmap
4
+ 0.27.064.122 W llama_context: n_ctx_seq (2048) < n_ctx_train (262144) -- the full capacity of the model will not be utilized
5
+ 0.27.133.422 W common_init_from_params: warming up the model with an empty run - please wait ... (--no-warmup to disable)
6
+ 0.27.289.156 I
7
+ 0.27.289.290 I system_info: n_threads = 16 (n_threads_batch = 16) / 32 | ROCm : NO_VMM = 1 | PEER_MAX_BATCH_SIZE = 128 | FA_ALL_QUANTS = 1 | CPU : SSE3 = 1 | SSSE3 = 1 | AVX = 1 | AVX_VNNI = 1 | AVX2 = 1 | F16C = 1 | FMA = 1 | BMI2 = 1 | AVX512 = 1 | AVX512_VBMI = 1 | AVX512_VNNI = 1 | AVX512_BF16 = 1 | LLAMAFILE = 1 | OPENMP = 1 | REPACK = 1 |
8
+ 0.27.404.427 I kl_divergence: computing over 40 chunks, n_ctx=2048, batch_size=2048, n_seq=1
9
+ 0.36.830.849 I kl_divergence: 9.43 seconds per pass - ETA 6.28 minutes
10
+
11
+ chunk PPL ln(PPL(Q)/PPL(base)) KL Divergence Δp RMS Same top p
12
+ 1 5.6709 ± 0.4138 0.01425 ± 0.00904 0.02960 ± 0.00288 5.636 ± 0.769 % 92.082 ± 0.845 %
13
+ 2 6.7293 ± 0.3601 0.01663 ± 0.00684 0.02989 ± 0.00161 5.217 ± 0.431 % 90.714 ± 0.642 %
14
+ 3 6.9169 ± 0.3016 0.01507 ± 0.00554 0.03014 ± 0.00149 5.374 ± 0.356 % 91.333 ± 0.508 %
15
+ 4 7.0890 ± 0.2767 0.02524 ± 0.00551 0.03455 ± 0.00230 5.724 ± 0.377 % 91.422 ± 0.438 %
16
+ 5 6.9977 ± 0.2459 0.02431 ± 0.00473 0.03510 ± 0.00197 5.756 ± 0.317 % 91.359 ± 0.393 %
17
+ 6 6.0143 ± 0.1871 0.02349 ± 0.00446 0.03679 ± 0.00183 6.238 ± 0.301 % 91.365 ± 0.359 %
18
+ 7 5.4692 ± 0.1536 0.01550 ± 0.00423 0.04573 ± 0.00356 6.706 ± 0.294 % 91.649 ± 0.327 %
19
+ 8 5.4716 ± 0.1434 0.01278 ± 0.00396 0.04609 ± 0.00315 6.674 ± 0.266 % 91.508 ± 0.308 %
20
+ 9 5.7707 ± 0.1434 0.00984 ± 0.00371 0.04562 ± 0.00282 6.516 ± 0.245 % 91.202 ± 0.295 %
21
+ 10 5.8669 ± 0.1392 0.01034 ± 0.00343 0.04327 ± 0.00254 6.366 ± 0.228 % 91.310 ± 0.279 %
22
+ 11 5.9368 ± 0.1343 0.00995 ± 0.00319 0.04136 ± 0.00232 6.217 ± 0.214 % 91.425 ± 0.264 %
23
+ 12 6.1791 ± 0.1354 0.00904 ± 0.00301 0.04007 ± 0.00213 6.096 ± 0.203 % 91.373 ± 0.253 %
24
+ 13 6.2710 ± 0.1322 0.00876 ± 0.00286 0.03942 ± 0.00197 6.006 ± 0.192 % 91.481 ± 0.242 %
25
+ 14 6.3372 ± 0.1288 0.00883 ± 0.00271 0.03813 ± 0.00183 5.878 ± 0.182 % 91.482 ± 0.233 %
26
+ 15 6.3906 ± 0.1257 0.00924 ± 0.00259 0.03703 ± 0.00171 5.762 ± 0.174 % 91.528 ± 0.225 %
27
+ 16 6.6471 ± 0.1283 0.00226 ± 0.00269 0.03821 ± 0.00164 5.705 ± 0.166 % 91.416 ± 0.219 %
28
+ 17 6.7047 ± 0.1250 0.00250 ± 0.00257 0.03722 ± 0.00155 5.611 ± 0.159 % 91.507 ± 0.211 %
29
+ 18 6.8261 ± 0.1241 0.00442 ± 0.00247 0.03659 ± 0.00147 5.530 ± 0.152 % 91.512 ± 0.205 %
30
+ 19 6.7763 ± 0.1204 0.00565 ± 0.00239 0.03618 ± 0.00140 5.532 ± 0.151 % 91.573 ± 0.199 %
31
+ 20 6.5992 ± 0.1138 0.00630 ± 0.00233 0.03693 ± 0.00135 5.609 ± 0.144 % 91.579 ± 0.194 %
32
+ 21 6.6019 ± 0.1107 0.00562 ± 0.00226 0.03658 ± 0.00128 5.590 ± 0.139 % 91.565 ± 0.190 %
33
+ 22 6.6282 ± 0.1087 0.00624 ± 0.00218 0.03607 ± 0.00123 5.575 ± 0.136 % 91.562 ± 0.185 %
34
+ 23 6.6712 ± 0.1071 0.00603 ± 0.00212 0.03556 ± 0.00118 5.532 ± 0.131 % 91.610 ± 0.181 %
35
+ 24 6.6902 ± 0.1050 0.00685 ± 0.00206 0.03512 ± 0.00113 5.495 ± 0.127 % 91.663 ± 0.176 %
36
+ 25 6.7396 ± 0.1038 0.00706 ± 0.00200 0.03489 ± 0.00109 5.454 ± 0.123 % 91.715 ± 0.172 %
37
+ 26 6.7177 ± 0.1015 0.00740 ± 0.00196 0.03452 ± 0.00105 5.421 ± 0.120 % 91.766 ± 0.169 %
38
+ 27 6.8568 ± 0.1021 0.00768 ± 0.00192 0.03400 ± 0.00101 5.375 ± 0.117 % 91.803 ± 0.165 %
39
+ 28 6.9402 ± 0.1019 0.00795 ± 0.00186 0.03351 ± 0.00098 5.324 ± 0.114 % 91.862 ± 0.162 %
40
+ 29 6.9426 ± 0.1001 0.00773 ± 0.00181 0.03310 ± 0.00094 5.288 ± 0.111 % 91.876 ± 0.159 %
41
+ 30 6.9084 ± 0.0978 0.00755 ± 0.00178 0.03292 ± 0.00091 5.264 ± 0.109 % 91.906 ± 0.156 %
42
+ 31 6.8359 ± 0.0951 0.00806 ± 0.00175 0.03280 ± 0.00089 5.250 ± 0.106 % 91.962 ± 0.153 %
43
+ 32 6.7389 ± 0.0922 0.00873 ± 0.00172 0.03308 ± 0.00086 5.310 ± 0.103 % 91.932 ± 0.151 %
44
+ 33 6.7122 ± 0.0905 0.00902 ± 0.00169 0.03300 ± 0.00086 5.299 ± 0.102 % 91.940 ± 0.148 %
45
+ 34 6.7067 ± 0.0890 0.00891 ± 0.00166 0.03277 ± 0.00083 5.271 ± 0.099 % 91.950 ± 0.146 %
46
+ 35 6.7286 ± 0.0881 0.01003 ± 0.00164 0.03268 ± 0.00081 5.277 ± 0.099 % 91.948 ± 0.144 %
47
+ 36 6.7363 ± 0.0870 0.01063 ± 0.00161 0.03248 ± 0.00079 5.251 ± 0.097 % 92.017 ± 0.141 %
48
+ 37 6.6250 ± 0.0840 0.01137 ± 0.00158 0.03228 ± 0.00078 5.245 ± 0.095 % 92.035 ± 0.139 %
49
+ 38 6.5583 ± 0.0818 0.01109 ± 0.00155 0.03207 ± 0.00076 5.241 ± 0.094 % 92.077 ± 0.137 %
50
+ 39 6.4896 ± 0.0797 0.01105 ± 0.00155 0.03231 ± 0.00078 5.254 ± 0.092 % 92.070 ± 0.135 %
51
+ 40 6.4004 ± 0.0772 0.01112 ± 0.00152 0.03219 ± 0.00077 5.252 ± 0.090 % 92.107 ± 0.133 %
52
+
53
+ ====== Perplexity statistics ======
54
+ Mean PPL(Q) : 6.400447 ± 0.077237
55
+ Mean PPL(base) : 6.329637 ± 0.076239
56
+ Cor(ln(PPL(Q)), ln(PPL(base))): 99.20%
57
+ Mean ln(PPL(Q)/PPL(base)) : 0.011125 ± 0.001523
58
+ Mean PPL(Q)/PPL(base) : 1.011187 ± 0.001540
59
+ Mean PPL(Q)-PPL(base) : 0.070810 ± 0.009741
60
+
61
+ ====== KL divergence statistics ======
62
+ Mean KLD: 0.032188 ± 0.000766
63
+ Maximum KLD: 17.548290
64
+ 99.9% KLD: 1.516570
65
+ 99.0% KLD: 0.313102
66
+ 95.0% KLD: 0.099888
67
+ 90.0% KLD: 0.058733
68
+ Median KLD: 0.013397
69
+ 10.0% KLD: 0.000221
70
+ 5.0% KLD: 0.000052
71
+ 1.0% KLD: 0.000005
72
+ 0.1% KLD: -0.000000
73
+ Minimum KLD: -0.000020
74
+
75
+ ====== Token probability statistics ======
76
+ Mean Δp: -0.221 ± 0.026 %
77
+ Maximum Δp: 90.468%
78
+ 99.9% Δp: 34.983%
79
+ 99.0% Δp: 13.933%
80
+ 95.0% Δp: 6.180%
81
+ 90.0% Δp: 3.604%
82
+ 75.0% Δp: 0.658%
83
+ Median Δp: -0.001%
84
+ 25.0% Δp: -0.917%
85
+ 10.0% Δp: -4.169%
86
+ 5.0% Δp: -7.119%
87
+ 1.0% Δp: -16.256%
88
+ 0.1% Δp: -42.662%
89
+ Minimum Δp: -98.257%
90
+ RMS Δp : 5.252 ± 0.090 %
91
+ Same top p: 92.107 ± 0.133 %
92
+
recipe/logs/R3_kld_q106.log ADDED
@@ -0,0 +1,92 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ 0.00.056.459 I common_init_result: fitting params to device memory ...
2
+ 0.00.056.463 I common_init_result: (for bugs during this step try to reproduce them with -fit off, or provide --verbose logs if the bug only occurs with -fit on)
3
+ 0.00.414.626 W llama_model_loader: direct I/O is enabled, disabling mmap
4
+ 0.31.123.455 W llama_context: n_ctx_seq (2048) < n_ctx_train (262144) -- the full capacity of the model will not be utilized
5
+ 0.31.189.690 W common_init_from_params: warming up the model with an empty run - please wait ... (--no-warmup to disable)
6
+ 0.31.333.670 I
7
+ 0.31.333.809 I system_info: n_threads = 16 (n_threads_batch = 16) / 32 | ROCm : NO_VMM = 1 | PEER_MAX_BATCH_SIZE = 128 | FA_ALL_QUANTS = 1 | CPU : SSE3 = 1 | SSSE3 = 1 | AVX = 1 | AVX_VNNI = 1 | AVX2 = 1 | F16C = 1 | FMA = 1 | BMI2 = 1 | AVX512 = 1 | AVX512_VBMI = 1 | AVX512_VNNI = 1 | AVX512_BF16 = 1 | LLAMAFILE = 1 | OPENMP = 1 | REPACK = 1 |
8
+ 0.31.445.087 I kl_divergence: computing over 40 chunks, n_ctx=2048, batch_size=2048, n_seq=1
9
+ 0.38.577.429 I kl_divergence: 7.13 seconds per pass - ETA 4.75 minutes
10
+
11
+ chunk PPL ln(PPL(Q)/PPL(base)) KL Divergence Δp RMS Same top p
12
+ 1 5.6619 ± 0.4178 0.01265 ± 0.00809 0.03262 ± 0.00203 5.307 ± 0.369 % 91.593 ± 0.868 %
13
+ 2 6.8229 ± 0.3691 0.03044 ± 0.00695 0.04270 ± 0.00205 5.525 ± 0.291 % 90.469 ± 0.649 %
14
+ 3 7.0007 ± 0.3084 0.02712 ± 0.00560 0.03995 ± 0.00158 5.478 ± 0.239 % 90.616 ± 0.526 %
15
+ 4 7.2110 ± 0.2849 0.04230 ± 0.00522 0.04298 ± 0.00164 5.902 ± 0.280 % 90.689 ± 0.454 %
16
+ 5 7.1696 ± 0.2561 0.04858 ± 0.00492 0.04482 ± 0.00163 5.977 ± 0.239 % 90.635 ± 0.407 %
17
+ 6 6.1208 ± 0.1933 0.04104 ± 0.00457 0.04600 ± 0.00166 6.514 ± 0.252 % 90.877 ± 0.368 %
18
+ 7 5.5425 ± 0.1578 0.02881 ± 0.00441 0.05468 ± 0.00326 6.987 ± 0.263 % 90.951 ± 0.339 %
19
+ 8 5.5348 ± 0.1471 0.02425 ± 0.00416 0.05443 ± 0.00290 6.941 ± 0.242 % 91.007 ± 0.316 %
20
+ 9 5.8142 ± 0.1460 0.01736 ± 0.00406 0.05560 ± 0.00263 6.870 ± 0.222 % 90.638 ± 0.304 %
21
+ 10 5.9193 ± 0.1421 0.01922 ± 0.00380 0.05317 ± 0.00238 6.733 ± 0.207 % 90.645 ± 0.288 %
22
+ 11 6.0045 ± 0.1375 0.02128 ± 0.00356 0.05157 ± 0.00218 6.651 ± 0.196 % 90.731 ± 0.273 %
23
+ 12 6.2508 ± 0.1385 0.02058 ± 0.00335 0.05003 ± 0.00200 6.500 ± 0.185 % 90.803 ± 0.261 %
24
+ 13 6.3463 ± 0.1354 0.02070 ± 0.00317 0.04889 ± 0.00185 6.433 ± 0.177 % 90.917 ± 0.249 %
25
+ 14 6.4064 ± 0.1316 0.01969 ± 0.00302 0.04772 ± 0.00173 6.353 ± 0.169 % 90.888 ± 0.240 %
26
+ 15 6.4579 ± 0.1284 0.01972 ± 0.00289 0.04674 ± 0.00162 6.251 ± 0.161 % 90.948 ± 0.232 %
27
+ 16 6.7292 ± 0.1315 0.01453 ± 0.00292 0.04759 ± 0.00159 6.185 ± 0.153 % 90.848 ± 0.225 %
28
+ 17 6.7855 ± 0.1281 0.01448 ± 0.00280 0.04656 ± 0.00150 6.097 ± 0.146 % 90.903 ± 0.218 %
29
+ 18 6.8961 ± 0.1267 0.01462 ± 0.00269 0.04590 ± 0.00142 6.026 ± 0.140 % 90.958 ± 0.211 %
30
+ 19 6.8469 ± 0.1230 0.01601 ± 0.00260 0.04524 ± 0.00136 5.969 ± 0.137 % 91.033 ± 0.205 %
31
+ 20 6.6773 ± 0.1165 0.01807 ± 0.00256 0.04666 ± 0.00132 6.169 ± 0.138 % 91.031 ± 0.200 %
32
+ 21 6.6797 ± 0.1133 0.01734 ± 0.00248 0.04626 ± 0.00127 6.149 ± 0.134 % 91.035 ± 0.195 %
33
+ 22 6.7091 ± 0.1113 0.01836 ± 0.00240 0.04573 ± 0.00121 6.112 ± 0.131 % 91.016 ± 0.191 %
34
+ 23 6.7538 ± 0.1096 0.01833 ± 0.00233 0.04527 ± 0.00116 6.093 ± 0.126 % 91.075 ± 0.186 %
35
+ 24 6.7698 ± 0.1074 0.01868 ± 0.00227 0.04457 ± 0.00112 6.032 ± 0.123 % 91.109 ± 0.182 %
36
+ 25 6.8184 ± 0.1061 0.01868 ± 0.00221 0.04415 ± 0.00107 5.982 ± 0.119 % 91.112 ± 0.178 %
37
+ 26 6.7958 ± 0.1037 0.01895 ± 0.00216 0.04391 ± 0.00104 5.995 ± 0.117 % 91.165 ± 0.174 %
38
+ 27 6.9355 ± 0.1043 0.01909 ± 0.00210 0.04335 ± 0.00100 5.932 ± 0.114 % 91.181 ± 0.171 %
39
+ 28 7.0181 ± 0.1040 0.01911 ± 0.00205 0.04287 ± 0.00097 5.886 ± 0.112 % 91.206 ± 0.167 %
40
+ 29 7.0216 ± 0.1022 0.01904 ± 0.00200 0.04249 ± 0.00094 5.854 ± 0.109 % 91.229 ± 0.164 %
41
+ 30 6.9873 ± 0.0999 0.01891 ± 0.00196 0.04236 ± 0.00091 5.830 ± 0.106 % 91.225 ± 0.162 %
42
+ 31 6.9137 ± 0.0972 0.01937 ± 0.00193 0.04231 ± 0.00089 5.810 ± 0.104 % 91.272 ± 0.158 %
43
+ 32 6.8167 ± 0.0942 0.02022 ± 0.00191 0.04265 ± 0.00087 5.853 ± 0.101 % 91.282 ± 0.156 %
44
+ 33 6.8131 ± 0.0929 0.02393 ± 0.00194 0.04399 ± 0.00092 5.938 ± 0.104 % 91.256 ± 0.154 %
45
+ 34 6.8092 ± 0.0914 0.02408 ± 0.00190 0.04371 ± 0.00089 5.916 ± 0.102 % 91.251 ± 0.152 %
46
+ 35 6.8282 ± 0.0904 0.02472 ± 0.00188 0.04377 ± 0.00088 5.935 ± 0.103 % 91.250 ± 0.149 %
47
+ 36 6.8368 ± 0.0893 0.02544 ± 0.00185 0.04362 ± 0.00087 5.903 ± 0.100 % 91.295 ± 0.147 %
48
+ 37 6.7206 ± 0.0862 0.02570 ± 0.00182 0.04326 ± 0.00085 5.880 ± 0.098 % 91.284 ± 0.145 %
49
+ 38 6.6518 ± 0.0839 0.02525 ± 0.00178 0.04302 ± 0.00083 5.883 ± 0.097 % 91.316 ± 0.143 %
50
+ 39 6.5787 ± 0.0817 0.02469 ± 0.00178 0.04401 ± 0.00107 5.965 ± 0.098 % 91.265 ± 0.141 %
51
+ 40 6.4877 ± 0.0792 0.02466 ± 0.00175 0.04379 ± 0.00105 5.960 ± 0.096 % 91.293 ± 0.139 %
52
+
53
+ ====== Perplexity statistics ======
54
+ Mean PPL(Q) : 6.487656 ± 0.079193
55
+ Mean PPL(base) : 6.329637 ± 0.076239
56
+ Cor(ln(PPL(Q)), ln(PPL(base))): 98.97%
57
+ Mean ln(PPL(Q)/PPL(base)) : 0.024658 ± 0.001747
58
+ Mean PPL(Q)/PPL(base) : 1.024965 ± 0.001790
59
+ Mean PPL(Q)-PPL(base) : 0.158019 ± 0.011529
60
+
61
+ ====== KL divergence statistics ======
62
+ Mean KLD: 0.043788 ± 0.001045
63
+ Maximum KLD: 27.035896
64
+ 99.9% KLD: 1.728752
65
+ 99.0% KLD: 0.426193
66
+ 95.0% KLD: 0.138685
67
+ 90.0% KLD: 0.084163
68
+ Median KLD: 0.018434
69
+ 10.0% KLD: 0.000298
70
+ 5.0% KLD: 0.000074
71
+ 1.0% KLD: 0.000008
72
+ 0.1% KLD: 0.000000
73
+ Minimum KLD: -0.000025
74
+
75
+ ====== Token probability statistics ======
76
+ Mean Δp: -0.150 ± 0.029 %
77
+ Maximum Δp: 99.991%
78
+ 99.9% Δp: 39.974%
79
+ 99.0% Δp: 15.865%
80
+ 95.0% Δp: 7.331%
81
+ 90.0% Δp: 4.280%
82
+ 75.0% Δp: 0.875%
83
+ Median Δp: -0.001%
84
+ 25.0% Δp: -0.976%
85
+ 10.0% Δp: -4.560%
86
+ 5.0% Δp: -7.978%
87
+ 1.0% Δp: -18.131%
88
+ 0.1% Δp: -47.519%
89
+ Minimum Δp: -99.992%
90
+ RMS Δp : 5.960 ± 0.096 %
91
+ Same top p: 91.293 ± 0.139 %
92
+
recipe/logs/R3_kld_q106i.log ADDED
@@ -0,0 +1,92 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ 0.00.038.696 I common_init_result: fitting params to device memory ...
2
+ 0.00.038.700 I common_init_result: (for bugs during this step try to reproduce them with -fit off, or provide --verbose logs if the bug only occurs with -fit on)
3
+ 0.00.498.231 W llama_model_loader: direct I/O is enabled, disabling mmap
4
+ 0.22.903.012 W llama_context: n_ctx_seq (2048) < n_ctx_train (262144) -- the full capacity of the model will not be utilized
5
+ 0.22.972.787 W common_init_from_params: warming up the model with an empty run - please wait ... (--no-warmup to disable)
6
+ 0.23.130.908 I
7
+ 0.23.131.056 I system_info: n_threads = 16 (n_threads_batch = 16) / 32 | ROCm : NO_VMM = 1 | PEER_MAX_BATCH_SIZE = 128 | FA_ALL_QUANTS = 1 | CPU : SSE3 = 1 | SSSE3 = 1 | AVX = 1 | AVX_VNNI = 1 | AVX2 = 1 | F16C = 1 | FMA = 1 | BMI2 = 1 | AVX512 = 1 | AVX512_VBMI = 1 | AVX512_VNNI = 1 | AVX512_BF16 = 1 | LLAMAFILE = 1 | OPENMP = 1 | REPACK = 1 |
8
+ 0.23.260.916 I kl_divergence: computing over 40 chunks, n_ctx=2048, batch_size=2048, n_seq=1
9
+ 0.31.660.763 I kl_divergence: 8.40 seconds per pass - ETA 5.58 minutes
10
+
11
+ chunk PPL ln(PPL(Q)/PPL(base)) KL Divergence Δp RMS Same top p
12
+ 1 5.6408 ± 0.4130 0.00892 ± 0.00851 0.02884 ± 0.00223 5.006 ± 0.404 % 92.082 ± 0.845 %
13
+ 2 6.7620 ± 0.3622 0.02148 ± 0.00672 0.03521 ± 0.00179 5.173 ± 0.314 % 91.447 ± 0.618 %
14
+ 3 6.9615 ± 0.3040 0.02151 ± 0.00548 0.03504 ± 0.00172 5.651 ± 0.327 % 91.268 ± 0.510 %
15
+ 4 7.1890 ± 0.2834 0.03924 ± 0.00539 0.03832 ± 0.00181 6.014 ± 0.333 % 91.105 ± 0.445 %
16
+ 5 7.0853 ± 0.2513 0.03674 ± 0.00474 0.03905 ± 0.00161 5.949 ± 0.285 % 90.948 ± 0.401 %
17
+ 6 6.0847 ± 0.1909 0.03514 ± 0.00433 0.03877 ± 0.00140 6.087 ± 0.247 % 91.170 ± 0.362 %
18
+ 7 5.5234 ± 0.1564 0.02535 ± 0.00421 0.04894 ± 0.00389 6.737 ± 0.274 % 91.286 ± 0.333 %
19
+ 8 5.5154 ± 0.1457 0.02076 ± 0.00401 0.04901 ± 0.00344 6.677 ± 0.248 % 91.178 ± 0.314 %
20
+ 9 5.8123 ± 0.1454 0.01704 ± 0.00383 0.04897 ± 0.00308 6.620 ± 0.229 % 90.768 ± 0.302 %
21
+ 10 5.9091 ± 0.1412 0.01750 ± 0.00354 0.04633 ± 0.00277 6.413 ± 0.213 % 90.938 ± 0.284 %
22
+ 11 5.9785 ± 0.1361 0.01695 ± 0.00329 0.04449 ± 0.00253 6.286 ± 0.199 % 91.105 ± 0.268 %
23
+ 12 6.2236 ± 0.1372 0.01623 ± 0.00310 0.04303 ± 0.00232 6.175 ± 0.188 % 91.096 ± 0.257 %
24
+ 13 6.3097 ± 0.1337 0.01490 ± 0.00297 0.04242 ± 0.00215 6.107 ± 0.177 % 91.150 ± 0.246 %
25
+ 14 6.3726 ± 0.1301 0.01440 ± 0.00282 0.04117 ± 0.00199 5.997 ± 0.168 % 91.063 ± 0.238 %
26
+ 15 6.4245 ± 0.1269 0.01453 ± 0.00270 0.04008 ± 0.00186 5.886 ± 0.160 % 91.065 ± 0.230 %
27
+ 16 6.6579 ± 0.1287 0.00389 ± 0.00295 0.04291 ± 0.00185 5.918 ± 0.153 % 90.805 ± 0.226 %
28
+ 17 6.7177 ± 0.1255 0.00444 ± 0.00282 0.04183 ± 0.00174 5.817 ± 0.147 % 90.932 ± 0.218 %
29
+ 18 6.8318 ± 0.1243 0.00525 ± 0.00270 0.04111 ± 0.00165 5.756 ± 0.141 % 90.936 ± 0.212 %
30
+ 19 6.7788 ± 0.1205 0.00602 ± 0.00258 0.04025 ± 0.00156 5.692 ± 0.138 % 91.027 ± 0.205 %
31
+ 20 6.6083 ± 0.1141 0.00768 ± 0.00253 0.04120 ± 0.00150 5.772 ± 0.132 % 91.051 ± 0.200 %
32
+ 21 6.6069 ± 0.1109 0.00638 ± 0.00246 0.04124 ± 0.00147 5.771 ± 0.127 % 91.007 ± 0.195 %
33
+ 22 6.6339 ± 0.1089 0.00710 ± 0.00238 0.04060 ± 0.00140 5.746 ± 0.125 % 90.989 ± 0.191 %
34
+ 23 6.6839 ± 0.1073 0.00793 ± 0.00230 0.04010 ± 0.00134 5.717 ± 0.121 % 91.041 ± 0.186 %
35
+ 24 6.7004 ± 0.1052 0.00837 ± 0.00223 0.03946 ± 0.00129 5.664 ± 0.117 % 91.109 ± 0.182 %
36
+ 25 6.7488 ± 0.1040 0.00842 ± 0.00217 0.03909 ± 0.00124 5.618 ± 0.114 % 91.140 ± 0.178 %
37
+ 26 6.7278 ± 0.1016 0.00891 ± 0.00212 0.03881 ± 0.00120 5.607 ± 0.111 % 91.221 ± 0.174 %
38
+ 27 6.8677 ± 0.1023 0.00927 ± 0.00206 0.03825 ± 0.00115 5.549 ± 0.109 % 91.278 ± 0.170 %
39
+ 28 6.9512 ± 0.1020 0.00954 ± 0.00201 0.03777 ± 0.00112 5.514 ± 0.107 % 91.342 ± 0.166 %
40
+ 29 6.9561 ± 0.1003 0.00968 ± 0.00195 0.03732 ± 0.00108 5.479 ± 0.104 % 91.364 ± 0.163 %
41
+ 30 6.9223 ± 0.0980 0.00957 ± 0.00192 0.03710 ± 0.00104 5.450 ± 0.102 % 91.398 ± 0.160 %
42
+ 31 6.8485 ± 0.0953 0.00989 ± 0.00188 0.03699 ± 0.00101 5.434 ± 0.099 % 91.433 ± 0.157 %
43
+ 32 6.7464 ± 0.0923 0.00984 ± 0.00185 0.03739 ± 0.00099 5.474 ± 0.097 % 91.419 ± 0.155 %
44
+ 33 6.7483 ± 0.0912 0.01437 ± 0.00190 0.03958 ± 0.00108 5.645 ± 0.109 % 91.333 ± 0.153 %
45
+ 34 6.7441 ± 0.0897 0.01448 ± 0.00187 0.03924 ± 0.00105 5.613 ± 0.107 % 91.383 ± 0.150 %
46
+ 35 6.7648 ± 0.0888 0.01539 ± 0.00184 0.03917 ± 0.00103 5.611 ± 0.107 % 91.387 ± 0.148 %
47
+ 36 6.7723 ± 0.0877 0.01597 ± 0.00181 0.03893 ± 0.00100 5.594 ± 0.104 % 91.439 ± 0.146 %
48
+ 37 6.6580 ± 0.0846 0.01634 ± 0.00177 0.03863 ± 0.00098 5.581 ± 0.102 % 91.467 ± 0.144 %
49
+ 38 6.5925 ± 0.0824 0.01630 ± 0.00174 0.03835 ± 0.00096 5.576 ± 0.101 % 91.508 ± 0.141 %
50
+ 39 6.5182 ± 0.0802 0.01545 ± 0.00173 0.03894 ± 0.00101 5.623 ± 0.100 % 91.498 ± 0.140 %
51
+ 40 6.4269 ± 0.0777 0.01525 ± 0.00170 0.03872 ± 0.00099 5.622 ± 0.098 % 91.522 ± 0.138 %
52
+
53
+ ====== Perplexity statistics ======
54
+ Mean PPL(Q) : 6.426891 ± 0.077720
55
+ Mean PPL(base) : 6.329637 ± 0.076239
56
+ Cor(ln(PPL(Q)), ln(PPL(base))): 99.01%
57
+ Mean ln(PPL(Q)/PPL(base)) : 0.015248 ± 0.001701
58
+ Mean PPL(Q)/PPL(base) : 1.015365 ± 0.001727
59
+ Mean PPL(Q)-PPL(base) : 0.097253 ± 0.010943
60
+
61
+ ====== KL divergence statistics ======
62
+ Mean KLD: 0.038720 ± 0.000987
63
+ Maximum KLD: 21.346630
64
+ 99.9% KLD: 1.791168
65
+ 99.0% KLD: 0.386349
66
+ 95.0% KLD: 0.118341
67
+ 90.0% KLD: 0.070348
68
+ Median KLD: 0.015312
69
+ 10.0% KLD: 0.000257
70
+ 5.0% KLD: 0.000059
71
+ 1.0% KLD: 0.000006
72
+ 0.1% KLD: 0.000000
73
+ Minimum KLD: -0.000033
74
+
75
+ ====== Token probability statistics ======
76
+ Mean Δp: -0.245 ± 0.028 %
77
+ Maximum Δp: 94.355%
78
+ 99.9% Δp: 39.023%
79
+ 99.0% Δp: 14.874%
80
+ 95.0% Δp: 6.653%
81
+ 90.0% Δp: 3.760%
82
+ 75.0% Δp: 0.671%
83
+ Median Δp: -0.002%
84
+ 25.0% Δp: -1.033%
85
+ 10.0% Δp: -4.485%
86
+ 5.0% Δp: -7.481%
87
+ 1.0% Δp: -17.039%
88
+ 0.1% Δp: -44.703%
89
+ Minimum Δp: -98.759%
90
+ RMS Δp : 5.622 ± 0.098 %
91
+ Same top p: 91.522 ± 0.138 %
92
+
recipe/logs/R3_kld_q111.log ADDED
@@ -0,0 +1,92 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ 0.00.033.573 I common_init_result: fitting params to device memory ...
2
+ 0.00.033.577 I common_init_result: (for bugs during this step try to reproduce them with -fit off, or provide --verbose logs if the bug only occurs with -fit on)
3
+ 0.00.407.709 W llama_model_loader: direct I/O is enabled, disabling mmap
4
+ 0.36.544.614 W llama_context: n_ctx_seq (2048) < n_ctx_train (262144) -- the full capacity of the model will not be utilized
5
+ 0.36.609.559 W common_init_from_params: warming up the model with an empty run - please wait ... (--no-warmup to disable)
6
+ 0.36.812.163 I
7
+ 0.36.812.307 I system_info: n_threads = 16 (n_threads_batch = 16) / 32 | ROCm : NO_VMM = 1 | PEER_MAX_BATCH_SIZE = 128 | FA_ALL_QUANTS = 1 | CPU : SSE3 = 1 | SSSE3 = 1 | AVX = 1 | AVX_VNNI = 1 | AVX2 = 1 | F16C = 1 | FMA = 1 | BMI2 = 1 | AVX512 = 1 | AVX512_VBMI = 1 | AVX512_VNNI = 1 | AVX512_BF16 = 1 | LLAMAFILE = 1 | OPENMP = 1 | REPACK = 1 |
8
+ 0.36.932.555 I kl_divergence: computing over 40 chunks, n_ctx=2048, batch_size=2048, n_seq=1
9
+ 0.44.986.034 I kl_divergence: 8.05 seconds per pass - ETA 5.37 minutes
10
+
11
+ chunk PPL ln(PPL(Q)/PPL(base)) KL Divergence Δp RMS Same top p
12
+ 1 5.6059 ± 0.4093 0.00271 ± 0.00332 0.00457 ± 0.00030 1.953 ± 0.126 % 97.556 ± 0.483 %
13
+ 2 6.6305 ± 0.3529 0.00184 ± 0.00264 0.00589 ± 0.00036 2.222 ± 0.169 % 96.432 ± 0.410 %
14
+ 3 6.8224 ± 0.2960 0.00133 ± 0.00209 0.00587 ± 0.00032 2.374 ± 0.190 % 96.579 ± 0.328 %
15
+ 4 6.8978 ± 0.2659 -0.00211 ± 0.00189 0.00618 ± 0.00037 2.424 ± 0.178 % 96.896 ± 0.271 %
16
+ 5 6.8264 ± 0.2374 -0.00048 ± 0.00173 0.00648 ± 0.00036 2.454 ± 0.166 % 96.618 ± 0.253 %
17
+ 6 5.8711 ± 0.1809 -0.00060 ± 0.00159 0.00674 ± 0.00032 2.581 ± 0.143 % 96.514 ± 0.234 %
18
+ 7 5.3771 ± 0.1501 -0.00150 ± 0.00194 0.01538 ± 0.00307 3.622 ± 0.322 % 96.411 ± 0.220 %
19
+ 8 5.3744 ± 0.1400 -0.00515 ± 0.00201 0.01627 ± 0.00271 3.732 ± 0.290 % 96.017 ± 0.216 %
20
+ 9 5.6841 ± 0.1409 -0.00528 ± 0.00191 0.01570 ± 0.00241 3.648 ± 0.268 % 95.786 ± 0.209 %
21
+ 10 5.7797 ± 0.1368 -0.00463 ± 0.00178 0.01478 ± 0.00218 3.529 ± 0.250 % 95.894 ± 0.196 %
22
+ 11 5.8547 ± 0.1322 -0.00399 ± 0.00166 0.01394 ± 0.00198 3.437 ± 0.233 % 95.992 ± 0.185 %
23
+ 12 6.1082 ± 0.1337 -0.00249 ± 0.00158 0.01362 ± 0.00182 3.345 ± 0.220 % 95.984 ± 0.177 %
24
+ 13 6.1990 ± 0.1306 -0.00280 ± 0.00150 0.01316 ± 0.00168 3.307 ± 0.207 % 96.030 ± 0.169 %
25
+ 14 6.2654 ± 0.1271 -0.00256 ± 0.00143 0.01272 ± 0.00156 3.246 ± 0.197 % 95.971 ± 0.164 %
26
+ 15 6.3162 ± 0.1240 -0.00247 ± 0.00140 0.01234 ± 0.00146 3.214 ± 0.188 % 95.947 ± 0.159 %
27
+ 16 6.6139 ± 0.1282 -0.00275 ± 0.00152 0.01298 ± 0.00143 3.260 ± 0.188 % 95.870 ± 0.156 %
28
+ 17 6.6699 ± 0.1249 -0.00271 ± 0.00145 0.01261 ± 0.00134 3.203 ± 0.180 % 95.900 ± 0.150 %
29
+ 18 6.7785 ± 0.1236 -0.00259 ± 0.00139 0.01226 ± 0.00127 3.156 ± 0.173 % 95.873 ± 0.147 %
30
+ 19 6.7237 ± 0.1198 -0.00214 ± 0.00133 0.01187 ± 0.00120 3.102 ± 0.166 % 95.879 ± 0.143 %
31
+ 20 6.5488 ± 0.1132 -0.00136 ± 0.00132 0.01205 ± 0.00116 3.201 ± 0.168 % 95.860 ± 0.139 %
32
+ 21 6.5550 ± 0.1102 -0.00150 ± 0.00127 0.01203 ± 0.00112 3.206 ± 0.162 % 95.890 ± 0.135 %
33
+ 22 6.5767 ± 0.1081 -0.00156 ± 0.00122 0.01174 ± 0.00107 3.165 ± 0.157 % 95.894 ± 0.132 %
34
+ 23 6.6160 ± 0.1063 -0.00229 ± 0.00119 0.01167 ± 0.00103 3.177 ± 0.153 % 95.937 ± 0.129 %
35
+ 24 6.6269 ± 0.1041 -0.00265 ± 0.00115 0.01151 ± 0.00098 3.149 ± 0.148 % 95.951 ± 0.126 %
36
+ 25 6.6721 ± 0.1028 -0.00301 ± 0.00112 0.01137 ± 0.00094 3.126 ± 0.144 % 95.957 ± 0.123 %
37
+ 26 6.6480 ± 0.1004 -0.00303 ± 0.00109 0.01114 ± 0.00091 3.100 ± 0.140 % 96.000 ± 0.120 %
38
+ 27 6.7853 ± 0.1010 -0.00280 ± 0.00106 0.01089 ± 0.00088 3.058 ± 0.136 % 96.036 ± 0.117 %
39
+ 28 6.8669 ± 0.1008 -0.00267 ± 0.00105 0.01107 ± 0.00087 3.023 ± 0.133 % 96.031 ± 0.115 %
40
+ 29 6.8723 ± 0.0991 -0.00244 ± 0.00102 0.01088 ± 0.00084 2.993 ± 0.130 % 96.039 ± 0.113 %
41
+ 30 6.8393 ± 0.0969 -0.00250 ± 0.00100 0.01073 ± 0.00082 2.968 ± 0.127 % 96.067 ± 0.111 %
42
+ 31 6.7637 ± 0.0941 -0.00257 ± 0.00097 0.01061 ± 0.00079 2.947 ± 0.124 % 96.096 ± 0.109 %
43
+ 32 6.6655 ± 0.0912 -0.00222 ± 0.00096 0.01054 ± 0.00076 2.964 ± 0.119 % 96.093 ± 0.107 %
44
+ 33 6.6325 ± 0.0893 -0.00292 ± 0.00096 0.01058 ± 0.00074 2.953 ± 0.116 % 96.066 ± 0.106 %
45
+ 34 6.6281 ± 0.0879 -0.00287 ± 0.00093 0.01044 ± 0.00072 2.932 ± 0.114 % 96.050 ± 0.104 %
46
+ 35 6.6458 ± 0.0869 -0.00235 ± 0.00094 0.01053 ± 0.00073 2.969 ± 0.119 % 96.017 ± 0.103 %
47
+ 36 6.6507 ± 0.0857 -0.00216 ± 0.00092 0.01043 ± 0.00071 2.951 ± 0.116 % 96.033 ± 0.102 %
48
+ 37 6.5368 ± 0.0827 -0.00203 ± 0.00090 0.01028 ± 0.00069 2.933 ± 0.114 % 96.032 ± 0.100 %
49
+ 38 6.4710 ± 0.0805 -0.00231 ± 0.00088 0.01017 ± 0.00067 2.915 ± 0.112 % 96.051 ± 0.099 %
50
+ 39 6.4058 ± 0.0785 -0.00194 ± 0.00091 0.01088 ± 0.00082 2.993 ± 0.113 % 96.047 ± 0.098 %
51
+ 40 6.3176 ± 0.0761 -0.00190 ± 0.00089 0.01081 ± 0.00080 2.996 ± 0.110 % 96.043 ± 0.096 %
52
+
53
+ ====== Perplexity statistics ======
54
+ Mean PPL(Q) : 6.317616 ± 0.076081
55
+ Mean PPL(base) : 6.329637 ± 0.076239
56
+ Cor(ln(PPL(Q)), ln(PPL(base))): 99.72%
57
+ Mean ln(PPL(Q)/PPL(base)) : -0.001901 ± 0.000893
58
+ Mean PPL(Q)/PPL(base) : 0.998101 ± 0.000892
59
+ Mean PPL(Q)-PPL(base) : -0.012022 ± 0.005651
60
+
61
+ ====== KL divergence statistics ======
62
+ Mean KLD: 0.010810 ± 0.000803
63
+ Maximum KLD: 19.487749
64
+ 99.9% KLD: 0.624512
65
+ 99.0% KLD: 0.085990
66
+ 95.0% KLD: 0.025315
67
+ 90.0% KLD: 0.015265
68
+ Median KLD: 0.003010
69
+ 10.0% KLD: 0.000068
70
+ 5.0% KLD: 0.000017
71
+ 1.0% KLD: 0.000002
72
+ 0.1% KLD: -0.000002
73
+ Minimum KLD: -0.000031
74
+
75
+ ====== Token probability statistics ======
76
+ Mean Δp: -0.013 ± 0.015 %
77
+ Maximum Δp: 90.262%
78
+ 99.9% Δp: 20.093%
79
+ 99.0% Δp: 7.391%
80
+ 95.0% Δp: 3.201%
81
+ 90.0% Δp: 1.823%
82
+ 75.0% Δp: 0.376%
83
+ Median Δp: -0.000%
84
+ 25.0% Δp: -0.395%
85
+ 10.0% Δp: -1.832%
86
+ 5.0% Δp: -3.218%
87
+ 1.0% Δp: -7.366%
88
+ 0.1% Δp: -21.522%
89
+ Minimum Δp: -98.323%
90
+ RMS Δp : 2.996 ± 0.110 %
91
+ Same top p: 96.043 ± 0.096 %
92
+
recipe/logs/R3_kld_q115.log ADDED
@@ -0,0 +1,92 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ 0.00.046.645 I common_init_result: fitting params to device memory ...
2
+ 0.00.046.648 I common_init_result: (for bugs during this step try to reproduce them with -fit off, or provide --verbose logs if the bug only occurs with -fit on)
3
+ 0.00.521.234 W llama_model_loader: direct I/O is enabled, disabling mmap
4
+ 0.46.661.487 W llama_context: n_ctx_seq (2048) < n_ctx_train (262144) -- the full capacity of the model will not be utilized
5
+ 0.46.725.915 W common_init_from_params: warming up the model with an empty run - please wait ... (--no-warmup to disable)
6
+ 0.46.946.305 I
7
+ 0.46.946.435 I system_info: n_threads = 16 (n_threads_batch = 16) / 32 | ROCm : NO_VMM = 1 | PEER_MAX_BATCH_SIZE = 128 | FA_ALL_QUANTS = 1 | CPU : SSE3 = 1 | SSSE3 = 1 | AVX = 1 | AVX_VNNI = 1 | AVX2 = 1 | F16C = 1 | FMA = 1 | BMI2 = 1 | AVX512 = 1 | AVX512_VBMI = 1 | AVX512_VNNI = 1 | AVX512_BF16 = 1 | LLAMAFILE = 1 | OPENMP = 1 | REPACK = 1 |
8
+ 0.47.074.269 I kl_divergence: computing over 40 chunks, n_ctx=2048, batch_size=2048, n_seq=1
9
+ 0.55.826.309 I kl_divergence: 8.75 seconds per pass - ETA 5.83 minutes
10
+
11
+ chunk PPL ln(PPL(Q)/PPL(base)) KL Divergence Δp RMS Same top p
12
+ 1 5.5566 ± 0.4036 -0.00612 ± 0.00269 0.00307 ± 0.00021 1.587 ± 0.124 % 97.361 ± 0.501 %
13
+ 2 6.6107 ± 0.3509 -0.00116 ± 0.00204 0.00344 ± 0.00028 1.785 ± 0.224 % 96.725 ± 0.394 %
14
+ 3 6.8101 ± 0.2950 -0.00048 ± 0.00157 0.00307 ± 0.00019 1.656 ± 0.165 % 96.905 ± 0.313 %
15
+ 4 6.8838 ± 0.2650 -0.00414 ± 0.00214 0.00680 ± 0.00217 2.704 ± 0.512 % 97.092 ± 0.263 %
16
+ 5 6.8057 ± 0.2361 -0.00351 ± 0.00188 0.00646 ± 0.00174 2.561 ± 0.433 % 96.950 ± 0.240 %
17
+ 6 5.8506 ± 0.1799 -0.00410 ± 0.00168 0.00632 ± 0.00145 2.565 ± 0.364 % 97.019 ± 0.217 %
18
+ 7 5.3534 ± 0.1491 -0.00591 ± 0.00178 0.01395 ± 0.00318 3.427 ± 0.353 % 96.914 ± 0.204 %
19
+ 8 5.3640 ± 0.1397 -0.00709 ± 0.00177 0.01399 ± 0.00279 3.454 ± 0.318 % 96.615 ± 0.200 %
20
+ 9 5.6737 ± 0.1405 -0.00711 ± 0.00168 0.01328 ± 0.00249 3.390 ± 0.293 % 96.448 ± 0.193 %
21
+ 10 5.7712 ± 0.1365 -0.00611 ± 0.00157 0.01235 ± 0.00224 3.254 ± 0.275 % 96.549 ± 0.180 %
22
+ 11 5.8449 ± 0.1319 -0.00566 ± 0.00145 0.01146 ± 0.00204 3.131 ± 0.260 % 96.632 ± 0.170 %
23
+ 12 6.0885 ± 0.1330 -0.00572 ± 0.00135 0.01089 ± 0.00187 3.029 ± 0.246 % 96.636 ± 0.163 %
24
+ 13 6.1823 ± 0.1300 -0.00550 ± 0.00128 0.01035 ± 0.00173 2.964 ± 0.233 % 96.737 ± 0.154 %
25
+ 14 6.2493 ± 0.1266 -0.00513 ± 0.00121 0.00991 ± 0.00160 2.893 ± 0.222 % 96.676 ± 0.150 %
26
+ 15 6.3012 ± 0.1236 -0.00484 ± 0.00118 0.00950 ± 0.00150 2.824 ± 0.212 % 96.624 ± 0.146 %
27
+ 16 6.5894 ± 0.1274 -0.00646 ± 0.00132 0.00985 ± 0.00145 2.789 ± 0.202 % 96.573 ± 0.142 %
28
+ 17 6.6478 ± 0.1242 -0.00603 ± 0.00125 0.00951 ± 0.00136 2.733 ± 0.194 % 96.607 ± 0.137 %
29
+ 18 6.7575 ± 0.1230 -0.00569 ± 0.00120 0.00918 ± 0.00129 2.682 ± 0.187 % 96.584 ± 0.134 %
30
+ 19 6.6994 ± 0.1190 -0.00576 ± 0.00116 0.00902 ± 0.00122 2.646 ± 0.179 % 96.568 ± 0.131 %
31
+ 20 6.5206 ± 0.1124 -0.00569 ± 0.00113 0.00908 ± 0.00116 2.728 ± 0.179 % 96.559 ± 0.127 %
32
+ 21 6.5276 ± 0.1095 -0.00569 ± 0.00109 0.00906 ± 0.00113 2.745 ± 0.173 % 96.607 ± 0.124 %
33
+ 22 6.5501 ± 0.1074 -0.00563 ± 0.00105 0.00880 ± 0.00108 2.704 ± 0.168 % 96.632 ± 0.120 %
34
+ 23 6.5926 ± 0.1057 -0.00582 ± 0.00102 0.00868 ± 0.00103 2.706 ± 0.164 % 96.651 ± 0.117 %
35
+ 24 6.6052 ± 0.1035 -0.00594 ± 0.00098 0.00855 ± 0.00099 2.697 ± 0.160 % 96.656 ± 0.115 %
36
+ 25 6.6526 ± 0.1023 -0.00594 ± 0.00095 0.00842 ± 0.00095 2.674 ± 0.156 % 96.669 ± 0.112 %
37
+ 26 6.6305 ± 0.1000 -0.00567 ± 0.00092 0.00819 ± 0.00091 2.637 ± 0.152 % 96.691 ± 0.110 %
38
+ 27 6.7675 ± 0.1006 -0.00543 ± 0.00089 0.00797 ± 0.00088 2.596 ± 0.149 % 96.727 ± 0.107 %
39
+ 28 6.8491 ± 0.1004 -0.00526 ± 0.00090 0.00820 ± 0.00088 2.568 ± 0.145 % 96.711 ± 0.105 %
40
+ 29 6.8537 ± 0.0986 -0.00515 ± 0.00087 0.00802 ± 0.00085 2.539 ± 0.142 % 96.703 ± 0.104 %
41
+ 30 6.8219 ± 0.0964 -0.00505 ± 0.00085 0.00786 ± 0.00082 2.507 ± 0.139 % 96.729 ± 0.102 %
42
+ 31 6.7475 ± 0.0937 -0.00497 ± 0.00082 0.00772 ± 0.00079 2.480 ± 0.136 % 96.771 ± 0.099 %
43
+ 32 6.6475 ± 0.0908 -0.00492 ± 0.00081 0.00763 ± 0.00077 2.495 ± 0.135 % 96.774 ± 0.098 %
44
+ 33 6.6137 ± 0.0889 -0.00577 ± 0.00082 0.00770 ± 0.00075 2.492 ± 0.131 % 96.750 ± 0.097 %
45
+ 34 6.6095 ± 0.0875 -0.00569 ± 0.00080 0.00757 ± 0.00073 2.470 ± 0.129 % 96.748 ± 0.095 %
46
+ 35 6.6264 ± 0.0865 -0.00527 ± 0.00080 0.00764 ± 0.00073 2.505 ± 0.134 % 96.738 ± 0.094 %
47
+ 36 6.6315 ± 0.0853 -0.00505 ± 0.00078 0.00752 ± 0.00071 2.483 ± 0.132 % 96.742 ± 0.093 %
48
+ 37 6.5180 ± 0.0823 -0.00492 ± 0.00076 0.00739 ± 0.00069 2.461 ± 0.129 % 96.735 ± 0.091 %
49
+ 38 6.4529 ± 0.0802 -0.00512 ± 0.00075 0.00733 ± 0.00067 2.450 ± 0.127 % 96.738 ± 0.090 %
50
+ 39 6.3883 ± 0.0781 -0.00467 ± 0.00074 0.00741 ± 0.00066 2.441 ± 0.124 % 96.742 ± 0.089 %
51
+ 40 6.3014 ± 0.0758 -0.00447 ± 0.00073 0.00742 ± 0.00065 2.444 ± 0.121 % 96.735 ± 0.088 %
52
+
53
+ ====== Perplexity statistics ======
54
+ Mean PPL(Q) : 6.301422 ± 0.075776
55
+ Mean PPL(base) : 6.329637 ± 0.076239
56
+ Cor(ln(PPL(Q)), ln(PPL(base))): 99.82%
57
+ Mean ln(PPL(Q)/PPL(base)) : -0.004468 ± 0.000730
58
+ Mean PPL(Q)/PPL(base) : 0.995542 ± 0.000727
59
+ Mean PPL(Q)-PPL(base) : -0.028216 ± 0.004630
60
+
61
+ ====== KL divergence statistics ======
62
+ Mean KLD: 0.007418 ± 0.000652
63
+ Maximum KLD: 16.334919
64
+ 99.9% KLD: 0.546826
65
+ 99.0% KLD: 0.056239
66
+ 95.0% KLD: 0.015157
67
+ 90.0% KLD: 0.008705
68
+ Median KLD: 0.001653
69
+ 10.0% KLD: 0.000034
70
+ 5.0% KLD: 0.000008
71
+ 1.0% KLD: 0.000000
72
+ 0.1% KLD: -0.000002
73
+ Minimum KLD: -0.000109
74
+
75
+ ====== Token probability statistics ======
76
+ Mean Δp: 0.043 ± 0.012 %
77
+ Maximum Δp: 89.625%
78
+ 99.9% Δp: 20.105%
79
+ 99.0% Δp: 5.537%
80
+ 95.0% Δp: 2.389%
81
+ 90.0% Δp: 1.391%
82
+ 75.0% Δp: 0.306%
83
+ Median Δp: 0.000%
84
+ 25.0% Δp: -0.254%
85
+ 10.0% Δp: -1.312%
86
+ 5.0% Δp: -2.251%
87
+ 1.0% Δp: -5.307%
88
+ 0.1% Δp: -14.534%
89
+ Minimum Δp: -99.365%
90
+ RMS Δp : 2.444 ± 0.121 %
91
+ Same top p: 96.735 ± 0.088 %
92
+
recipe/logs/R4_kld_q106_repeat.log ADDED
@@ -0,0 +1,92 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ 0.00.035.226 I common_init_result: fitting params to device memory ...
2
+ 0.00.035.230 I common_init_result: (for bugs during this step try to reproduce them with -fit off, or provide --verbose logs if the bug only occurs with -fit on)
3
+ 0.00.411.407 W llama_model_loader: direct I/O is enabled, disabling mmap
4
+ 0.20.064.888 W llama_context: n_ctx_seq (2048) < n_ctx_train (262144) -- the full capacity of the model will not be utilized
5
+ 0.20.130.441 W common_init_from_params: warming up the model with an empty run - please wait ... (--no-warmup to disable)
6
+ 0.20.272.500 I
7
+ 0.20.272.642 I system_info: n_threads = 16 (n_threads_batch = 16) / 32 | ROCm : NO_VMM = 1 | PEER_MAX_BATCH_SIZE = 128 | FA_ALL_QUANTS = 1 | CPU : SSE3 = 1 | SSSE3 = 1 | AVX = 1 | AVX_VNNI = 1 | AVX2 = 1 | F16C = 1 | FMA = 1 | BMI2 = 1 | AVX512 = 1 | AVX512_VBMI = 1 | AVX512_VNNI = 1 | AVX512_BF16 = 1 | LLAMAFILE = 1 | OPENMP = 1 | REPACK = 1 |
8
+ 0.20.391.428 I kl_divergence: computing over 40 chunks, n_ctx=2048, batch_size=2048, n_seq=1
9
+ 0.27.395.913 I kl_divergence: 7.00 seconds per pass - ETA 4.67 minutes
10
+
11
+ chunk PPL ln(PPL(Q)/PPL(base)) KL Divergence Δp RMS Same top p
12
+ 1 5.6619 ± 0.4178 0.01265 ± 0.00809 0.03262 ± 0.00203 5.307 ± 0.369 % 91.593 ± 0.868 %
13
+ 2 6.8229 ± 0.3691 0.03044 ± 0.00695 0.04270 ± 0.00205 5.525 ± 0.291 % 90.469 ± 0.649 %
14
+ 3 7.0007 ± 0.3084 0.02712 ± 0.00560 0.03995 ± 0.00158 5.478 ± 0.239 % 90.616 ± 0.526 %
15
+ 4 7.2110 ± 0.2849 0.04230 ± 0.00522 0.04298 ± 0.00164 5.902 ± 0.280 % 90.689 ± 0.454 %
16
+ 5 7.1696 ± 0.2561 0.04858 ± 0.00492 0.04482 ± 0.00163 5.977 ± 0.239 % 90.635 ± 0.407 %
17
+ 6 6.1208 ± 0.1933 0.04104 ± 0.00457 0.04600 ± 0.00166 6.514 ± 0.252 % 90.877 ± 0.368 %
18
+ 7 5.5425 ± 0.1578 0.02881 ± 0.00441 0.05468 ± 0.00326 6.987 ± 0.263 % 90.951 ± 0.339 %
19
+ 8 5.5348 ± 0.1471 0.02425 ± 0.00416 0.05443 ± 0.00290 6.941 ± 0.242 % 91.007 ± 0.316 %
20
+ 9 5.8142 ± 0.1460 0.01736 ± 0.00406 0.05560 ± 0.00263 6.870 ± 0.222 % 90.638 ± 0.304 %
21
+ 10 5.9193 ± 0.1421 0.01922 ± 0.00380 0.05317 ± 0.00238 6.733 ± 0.207 % 90.645 ± 0.288 %
22
+ 11 6.0045 ± 0.1375 0.02128 ± 0.00356 0.05157 ± 0.00218 6.651 ± 0.196 % 90.731 ± 0.273 %
23
+ 12 6.2508 ± 0.1385 0.02058 ± 0.00335 0.05003 ± 0.00200 6.500 ± 0.185 % 90.803 ± 0.261 %
24
+ 13 6.3463 ± 0.1354 0.02070 ± 0.00317 0.04889 ± 0.00185 6.433 ± 0.177 % 90.917 ± 0.249 %
25
+ 14 6.4064 ± 0.1316 0.01969 ± 0.00302 0.04772 ± 0.00173 6.353 ± 0.169 % 90.888 ± 0.240 %
26
+ 15 6.4579 ± 0.1284 0.01972 ± 0.00289 0.04674 ± 0.00162 6.251 ± 0.161 % 90.948 ± 0.232 %
27
+ 16 6.7292 ± 0.1315 0.01453 ± 0.00292 0.04759 ± 0.00159 6.185 ± 0.153 % 90.848 ± 0.225 %
28
+ 17 6.7855 ± 0.1281 0.01448 ± 0.00280 0.04656 ± 0.00150 6.097 ± 0.146 % 90.903 ± 0.218 %
29
+ 18 6.8961 ± 0.1267 0.01462 ± 0.00269 0.04590 ± 0.00142 6.026 ± 0.140 % 90.958 ± 0.211 %
30
+ 19 6.8469 ± 0.1230 0.01601 ± 0.00260 0.04524 ± 0.00136 5.969 ± 0.137 % 91.033 ± 0.205 %
31
+ 20 6.6773 ± 0.1165 0.01807 ± 0.00256 0.04666 ± 0.00132 6.169 ± 0.138 % 91.031 ± 0.200 %
32
+ 21 6.6797 ± 0.1133 0.01734 ± 0.00248 0.04626 ± 0.00127 6.149 ± 0.134 % 91.035 ± 0.195 %
33
+ 22 6.7091 ± 0.1113 0.01836 ± 0.00240 0.04573 ± 0.00121 6.112 ± 0.131 % 91.016 ± 0.191 %
34
+ 23 6.7538 ± 0.1096 0.01833 ± 0.00233 0.04527 ± 0.00116 6.093 ± 0.126 % 91.075 ± 0.186 %
35
+ 24 6.7698 ± 0.1074 0.01868 ± 0.00227 0.04457 ± 0.00112 6.032 ± 0.123 % 91.109 ± 0.182 %
36
+ 25 6.8184 ± 0.1061 0.01868 ± 0.00221 0.04415 ± 0.00107 5.982 ± 0.119 % 91.112 ± 0.178 %
37
+ 26 6.7958 ± 0.1037 0.01895 ± 0.00216 0.04391 ± 0.00104 5.995 ± 0.117 % 91.165 ± 0.174 %
38
+ 27 6.9355 ± 0.1043 0.01909 ± 0.00210 0.04335 ± 0.00100 5.932 ± 0.114 % 91.181 ± 0.171 %
39
+ 28 7.0181 ± 0.1040 0.01911 ± 0.00205 0.04287 ± 0.00097 5.886 ± 0.112 % 91.206 ± 0.167 %
40
+ 29 7.0216 ± 0.1022 0.01904 ± 0.00200 0.04249 ± 0.00094 5.854 ± 0.109 % 91.229 ± 0.164 %
41
+ 30 6.9873 ± 0.0999 0.01891 ± 0.00196 0.04236 ± 0.00091 5.830 ± 0.106 % 91.225 ± 0.162 %
42
+ 31 6.9137 ± 0.0972 0.01937 ± 0.00193 0.04231 ± 0.00089 5.810 ± 0.104 % 91.272 ± 0.158 %
43
+ 32 6.8167 ± 0.0942 0.02022 ± 0.00191 0.04265 ± 0.00087 5.853 ± 0.101 % 91.282 ± 0.156 %
44
+ 33 6.8131 ± 0.0929 0.02393 ± 0.00194 0.04399 ± 0.00092 5.938 ± 0.104 % 91.256 ± 0.154 %
45
+ 34 6.8092 ± 0.0914 0.02408 ± 0.00190 0.04371 ± 0.00089 5.916 ± 0.102 % 91.251 ± 0.152 %
46
+ 35 6.8282 ± 0.0904 0.02472 ± 0.00188 0.04377 ± 0.00088 5.935 ± 0.103 % 91.250 ± 0.149 %
47
+ 36 6.8368 ± 0.0893 0.02544 ± 0.00185 0.04362 ± 0.00087 5.903 ± 0.100 % 91.295 ± 0.147 %
48
+ 37 6.7206 ± 0.0862 0.02570 ± 0.00182 0.04326 ± 0.00085 5.880 ± 0.098 % 91.284 ± 0.145 %
49
+ 38 6.6518 ± 0.0839 0.02525 ± 0.00178 0.04302 ± 0.00083 5.883 ± 0.097 % 91.316 ± 0.143 %
50
+ 39 6.5787 ± 0.0817 0.02469 ± 0.00178 0.04401 ± 0.00107 5.965 ± 0.098 % 91.265 ± 0.141 %
51
+ 40 6.4877 ± 0.0792 0.02466 ± 0.00175 0.04379 ± 0.00105 5.960 ± 0.096 % 91.293 ± 0.139 %
52
+
53
+ ====== Perplexity statistics ======
54
+ Mean PPL(Q) : 6.487656 ± 0.079193
55
+ Mean PPL(base) : 6.329637 ± 0.076239
56
+ Cor(ln(PPL(Q)), ln(PPL(base))): 98.97%
57
+ Mean ln(PPL(Q)/PPL(base)) : 0.024658 ± 0.001747
58
+ Mean PPL(Q)/PPL(base) : 1.024965 ± 0.001790
59
+ Mean PPL(Q)-PPL(base) : 0.158019 ± 0.011529
60
+
61
+ ====== KL divergence statistics ======
62
+ Mean KLD: 0.043788 ± 0.001045
63
+ Maximum KLD: 27.035896
64
+ 99.9% KLD: 1.728752
65
+ 99.0% KLD: 0.426193
66
+ 95.0% KLD: 0.138685
67
+ 90.0% KLD: 0.084163
68
+ Median KLD: 0.018434
69
+ 10.0% KLD: 0.000298
70
+ 5.0% KLD: 0.000074
71
+ 1.0% KLD: 0.000008
72
+ 0.1% KLD: 0.000000
73
+ Minimum KLD: -0.000025
74
+
75
+ ====== Token probability statistics ======
76
+ Mean Δp: -0.150 ± 0.029 %
77
+ Maximum Δp: 99.991%
78
+ 99.9% Δp: 39.974%
79
+ 99.0% Δp: 15.865%
80
+ 95.0% Δp: 7.331%
81
+ 90.0% Δp: 4.280%
82
+ 75.0% Δp: 0.875%
83
+ Median Δp: -0.001%
84
+ 25.0% Δp: -0.976%
85
+ 10.0% Δp: -4.560%
86
+ 5.0% Δp: -7.978%
87
+ 1.0% Δp: -18.131%
88
+ 0.1% Δp: -47.519%
89
+ Minimum Δp: -99.992%
90
+ RMS Δp : 5.960 ± 0.096 %
91
+ Same top p: 91.293 ± 0.139 %
92
+
recipe/logs/S_sizes.log ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ S2_q106 quant size = 17214.21 MiB (4.42 BPW)
2
+ S2_q102 quant size = 18180.88 MiB (4.67 BPW)
3
+ S2_q115 quant size = 32662.55 MiB (8.39 BPW)
4
+ S2_q111 quant size = 32205.84 MiB (8.27 BPW)
5
+ S3_q106i quant size = 17214.21 MiB (4.42 BPW)
6
+ S3_q102i quant size = 18180.88 MiB (4.67 BPW)
recipe/logs/afternoon_B1_ppl_bf16.log ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ 0.00.092.256 I common_init_result: fitting params to device memory ...
2
+ 0.00.092.259 I common_init_result: (for bugs during this step try to reproduce them with -fit off, or provide --verbose logs if the bug only occurs with -fit on)
3
+ 0.00.609.874 W llama_model_loader: direct I/O is enabled, disabling mmap
4
+ 1.19.756.478 W llama_context: n_ctx_seq (2048) < n_ctx_train (262144) -- the full capacity of the model will not be utilized
5
+ 1.19.820.478 W common_init_from_params: warming up the model with an empty run - please wait ... (--no-warmup to disable)
6
+ 1.20.207.139 I
7
+ 1.20.207.240 I system_info: n_threads = 16 (n_threads_batch = 16) / 32 | ROCm : NO_VMM = 1 | PEER_MAX_BATCH_SIZE = 128 | FA_ALL_QUANTS = 1 | CPU : SSE3 = 1 | SSSE3 = 1 | AVX = 1 | AVX_VNNI = 1 | AVX2 = 1 | F16C = 1 | FMA = 1 | BMI2 = 1 | AVX512 = 1 | AVX512_VBMI = 1 | AVX512_VNNI = 1 | AVX512_BF16 = 1 | LLAMAFILE = 1 | OPENMP = 1 | REPACK = 1 |
8
+ 1.20.207.327 I perplexity: saving all logits to kld/bf16.kld
9
+ 1.20.207.330 I perplexity: tokenizing the input ..
10
+ 1.20.544.564 I perplexity: tokenization took 337.224 ms
11
+ 1.20.544.662 I perplexity: calculating perplexity over 40 chunks, n_ctx=2048, batch_size=2048, n_seq=1
12
+ 1.29.548.010 I perplexity: 8.82 seconds per pass - ETA 5.87 minutes
13
+ [1]5.6019,[2]6.6236,[3]6.8194,[4]6.9173,[5]6.8369,[6]5.8754,[7]5.3855,[8]5.4015,[9]5.7130,[10]5.8071,[11]5.8787,[12]6.1229,[13]6.2160,[14]6.2810,[15]6.3313,[16]6.6308,[17]6.6871,[18]6.7961,[19]6.7386,[20]6.5601,[21]6.5666,[22]6.5887,[23]6.6323,[24]6.6455,[25]6.6935,[26]6.6695,[27]6.8055,[28]6.8864,[29]6.8906,[30]6.8577,[31]6.7818,[32]6.6810,[33]6.6536,[34]6.6486,[35]6.6628,[36]6.6664,[37]6.5514,[38]6.4871,[39]6.4183,[40]6.3294,
14
+ 7.22.831.014 I Final estimate: PPL = 6.3294 +/- 0.07627
15
+
recipe/logs/afternoon_B5_kld_q102.log ADDED
@@ -0,0 +1,92 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ 0.00.058.988 I common_init_result: fitting params to device memory ...
2
+ 0.00.058.992 I common_init_result: (for bugs during this step try to reproduce them with -fit off, or provide --verbose logs if the bug only occurs with -fit on)
3
+ 0.00.523.545 W llama_model_loader: direct I/O is enabled, disabling mmap
4
+ 0.27.436.824 W llama_context: n_ctx_seq (2048) < n_ctx_train (262144) -- the full capacity of the model will not be utilized
5
+ 0.27.739.526 W common_init_from_params: warming up the model with an empty run - please wait ... (--no-warmup to disable)
6
+ 0.27.914.290 I
7
+ 0.27.914.465 I system_info: n_threads = 16 (n_threads_batch = 16) / 32 | ROCm : NO_VMM = 1 | PEER_MAX_BATCH_SIZE = 128 | FA_ALL_QUANTS = 1 | CPU : SSE3 = 1 | SSSE3 = 1 | AVX = 1 | AVX_VNNI = 1 | AVX2 = 1 | F16C = 1 | FMA = 1 | BMI2 = 1 | AVX512 = 1 | AVX512_VBMI = 1 | AVX512_VNNI = 1 | AVX512_BF16 = 1 | LLAMAFILE = 1 | OPENMP = 1 | REPACK = 1 |
8
+ 0.28.084.292 I kl_divergence: computing over 40 chunks, n_ctx=2048, batch_size=2048, n_seq=1
9
+ 0.39.683.234 I kl_divergence: 11.60 seconds per pass - ETA 7.72 minutes
10
+
11
+ chunk PPL ln(PPL(Q)/PPL(base)) KL Divergence Δp RMS Same top p
12
+ 1 5.7067 ± 0.4219 0.01853 ± 0.00868 0.02815 ± 0.00217 5.106 ± 0.425 % 91.984 ± 0.849 %
13
+ 2 6.7880 ± 0.3673 0.02449 ± 0.00670 0.03267 ± 0.00146 4.931 ± 0.285 % 91.984 ± 0.600 %
14
+ 3 6.9694 ± 0.3067 0.02174 ± 0.00548 0.03315 ± 0.00155 4.998 ± 0.259 % 92.343 ± 0.480 %
15
+ 4 7.0949 ± 0.2782 0.02534 ± 0.00468 0.03281 ± 0.00135 5.113 ± 0.250 % 92.326 ± 0.416 %
16
+ 5 7.0303 ± 0.2486 0.02789 ± 0.00430 0.03576 ± 0.00133 5.400 ± 0.219 % 91.730 ± 0.385 %
17
+ 6 6.0449 ± 0.1893 0.02842 ± 0.00404 0.03802 ± 0.00154 6.086 ± 0.260 % 91.659 ± 0.353 %
18
+ 7 5.4972 ± 0.1555 0.02051 ± 0.00401 0.04623 ± 0.00323 6.630 ± 0.279 % 91.831 ± 0.324 %
19
+ 8 5.4907 ± 0.1449 0.01638 ± 0.00379 0.04719 ± 0.00288 6.569 ± 0.252 % 91.777 ± 0.304 %
20
+ 9 5.7798 ± 0.1444 0.01161 ± 0.00371 0.04764 ± 0.00260 6.438 ± 0.231 % 91.463 ± 0.291 %
21
+ 10 5.8815 ± 0.1404 0.01305 ± 0.00347 0.04547 ± 0.00234 6.283 ± 0.215 % 91.574 ± 0.275 %
22
+ 11 5.9546 ± 0.1355 0.01311 ± 0.00324 0.04370 ± 0.00214 6.151 ± 0.202 % 91.700 ± 0.260 %
23
+ 12 6.1895 ± 0.1362 0.01108 ± 0.00305 0.04243 ± 0.00197 5.974 ± 0.191 % 91.748 ± 0.248 %
24
+ 13 6.2796 ± 0.1330 0.01042 ± 0.00289 0.04149 ± 0.00183 5.933 ± 0.186 % 91.909 ± 0.236 %
25
+ 14 6.3432 ± 0.1294 0.01009 ± 0.00275 0.04023 ± 0.00171 5.795 ± 0.177 % 91.880 ± 0.228 %
26
+ 15 6.3972 ± 0.1265 0.01060 ± 0.00264 0.03927 ± 0.00160 5.708 ± 0.168 % 91.913 ± 0.220 %
27
+ 16 6.6601 ± 0.1293 0.00470 ± 0.00278 0.04077 ± 0.00159 5.690 ± 0.161 % 91.746 ± 0.215 %
28
+ 17 6.7181 ± 0.1260 0.00490 ± 0.00265 0.03978 ± 0.00150 5.606 ± 0.154 % 91.823 ± 0.208 %
29
+ 18 6.8387 ± 0.1250 0.00666 ± 0.00255 0.03932 ± 0.00142 5.539 ± 0.147 % 91.843 ± 0.202 %
30
+ 19 6.8021 ± 0.1217 0.00978 ± 0.00251 0.03969 ± 0.00137 5.601 ± 0.151 % 91.845 ± 0.196 %
31
+ 20 6.6233 ± 0.1150 0.00997 ± 0.00247 0.04101 ± 0.00132 5.705 ± 0.143 % 91.848 ± 0.191 %
32
+ 21 6.6267 ± 0.1118 0.00947 ± 0.00238 0.04071 ± 0.00127 5.690 ± 0.139 % 91.859 ± 0.187 %
33
+ 22 6.6518 ± 0.1098 0.00994 ± 0.00230 0.03998 ± 0.00121 5.631 ± 0.135 % 91.900 ± 0.182 %
34
+ 23 6.6989 ± 0.1082 0.01039 ± 0.00223 0.03943 ± 0.00116 5.602 ± 0.132 % 91.933 ± 0.178 %
35
+ 24 6.7201 ± 0.1061 0.01153 ± 0.00216 0.03892 ± 0.00112 5.550 ± 0.128 % 91.952 ± 0.174 %
36
+ 25 6.7704 ± 0.1050 0.01179 ± 0.00211 0.03857 ± 0.00107 5.505 ± 0.124 % 91.973 ± 0.170 %
37
+ 26 6.7474 ± 0.1025 0.01194 ± 0.00206 0.03813 ± 0.00104 5.477 ± 0.121 % 92.052 ± 0.166 %
38
+ 27 6.8869 ± 0.1032 0.01222 ± 0.00200 0.03752 ± 0.00100 5.416 ± 0.118 % 92.093 ± 0.162 %
39
+ 28 6.9687 ± 0.1029 0.01219 ± 0.00195 0.03700 ± 0.00097 5.357 ± 0.115 % 92.138 ± 0.159 %
40
+ 29 6.9685 ± 0.1010 0.01155 ± 0.00190 0.03657 ± 0.00093 5.313 ± 0.112 % 92.214 ± 0.156 %
41
+ 30 6.9334 ± 0.0987 0.01127 ± 0.00186 0.03628 ± 0.00090 5.283 ± 0.109 % 92.216 ± 0.153 %
42
+ 31 6.8581 ± 0.0960 0.01148 ± 0.00183 0.03611 ± 0.00088 5.276 ± 0.107 % 92.249 ± 0.150 %
43
+ 32 6.7613 ± 0.0930 0.01222 ± 0.00180 0.03635 ± 0.00086 5.338 ± 0.104 % 92.217 ± 0.148 %
44
+ 33 6.7304 ± 0.0912 0.01183 ± 0.00178 0.03627 ± 0.00083 5.329 ± 0.102 % 92.224 ± 0.146 %
45
+ 34 6.7241 ± 0.0897 0.01163 ± 0.00175 0.03596 ± 0.00081 5.299 ± 0.100 % 92.200 ± 0.144 %
46
+ 35 6.7459 ± 0.0887 0.01271 ± 0.00172 0.03593 ± 0.00080 5.316 ± 0.100 % 92.188 ± 0.142 %
47
+ 36 6.7563 ± 0.0877 0.01371 ± 0.00170 0.03588 ± 0.00078 5.299 ± 0.098 % 92.221 ± 0.140 %
48
+ 37 6.6418 ± 0.0846 0.01401 ± 0.00167 0.03553 ± 0.00077 5.278 ± 0.096 % 92.278 ± 0.137 %
49
+ 38 6.5733 ± 0.0824 0.01350 ± 0.00164 0.03531 ± 0.00075 5.263 ± 0.094 % 92.298 ± 0.135 %
50
+ 39 6.5036 ± 0.0802 0.01350 ± 0.00162 0.03565 ± 0.00078 5.308 ± 0.095 % 92.270 ± 0.134 %
51
+ 40 6.4119 ± 0.0777 0.01323 ± 0.00159 0.03544 ± 0.00076 5.297 ± 0.093 % 92.314 ± 0.132 %
52
+
53
+ ====== Perplexity statistics ======
54
+ Mean PPL(Q) : 6.411907 ± 0.077742
55
+ Mean PPL(base) : 6.327630 ± 0.076192
56
+ Cor(ln(PPL(Q)), ln(PPL(base))): 99.14%
57
+ Mean ln(PPL(Q)/PPL(base)) : 0.013231 ± 0.001591
58
+ Mean PPL(Q)/PPL(base) : 1.013319 ± 0.001612
59
+ Mean PPL(Q)-PPL(base) : 0.084277 ± 0.010236
60
+
61
+ ====== KL divergence statistics ======
62
+ Mean KLD: 0.035442 ± 0.000759
63
+ Maximum KLD: 16.939222
64
+ 99.9% KLD: 1.459745
65
+ 99.0% KLD: 0.367319
66
+ 95.0% KLD: 0.117396
67
+ 90.0% KLD: 0.068599
68
+ Median KLD: 0.013563
69
+ 10.0% KLD: 0.000242
70
+ 5.0% KLD: 0.000061
71
+ 1.0% KLD: 0.000006
72
+ 0.1% KLD: 0.000000
73
+ Minimum KLD: -0.000039
74
+
75
+ ====== Token probability statistics ======
76
+ Mean Δp: -0.096 ± 0.026 %
77
+ Maximum Δp: 92.911%
78
+ 99.9% Δp: 33.288%
79
+ 99.0% Δp: 14.066%
80
+ 95.0% Δp: 6.242%
81
+ 90.0% Δp: 3.613%
82
+ 75.0% Δp: 0.797%
83
+ Median Δp: 0.000%
84
+ 25.0% Δp: -0.727%
85
+ 10.0% Δp: -3.611%
86
+ 5.0% Δp: -6.663%
87
+ 1.0% Δp: -17.432%
88
+ 0.1% Δp: -45.413%
89
+ Minimum Δp: -99.745%
90
+ RMS Δp : 5.297 ± 0.093 %
91
+ Same top p: 92.314 ± 0.132 %
92
+
recipe/logs/afternoon_B5_kld_q102i.log ADDED
@@ -0,0 +1,92 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ 0.00.035.205 I common_init_result: fitting params to device memory ...
2
+ 0.00.035.208 I common_init_result: (for bugs during this step try to reproduce them with -fit off, or provide --verbose logs if the bug only occurs with -fit on)
3
+ 0.00.407.141 W llama_model_loader: direct I/O is enabled, disabling mmap
4
+ 0.20.843.312 W llama_context: n_ctx_seq (2048) < n_ctx_train (262144) -- the full capacity of the model will not be utilized
5
+ 0.20.903.231 W common_init_from_params: warming up the model with an empty run - please wait ... (--no-warmup to disable)
6
+ 0.21.044.087 I
7
+ 0.21.044.185 I system_info: n_threads = 16 (n_threads_batch = 16) / 32 | ROCm : NO_VMM = 1 | PEER_MAX_BATCH_SIZE = 128 | FA_ALL_QUANTS = 1 | CPU : SSE3 = 1 | SSSE3 = 1 | AVX = 1 | AVX_VNNI = 1 | AVX2 = 1 | F16C = 1 | FMA = 1 | BMI2 = 1 | AVX512 = 1 | AVX512_VBMI = 1 | AVX512_VNNI = 1 | AVX512_BF16 = 1 | LLAMAFILE = 1 | OPENMP = 1 | REPACK = 1 |
8
+ 0.21.163.273 I kl_divergence: computing over 40 chunks, n_ctx=2048, batch_size=2048, n_seq=1
9
+ 0.29.185.228 I kl_divergence: 8.02 seconds per pass - ETA 5.33 minutes
10
+
11
+ chunk PPL ln(PPL(Q)/PPL(base)) KL Divergence Δp RMS Same top p
12
+ 1 5.6624 ± 0.4130 0.01072 ± 0.00883 0.02711 ± 0.00287 5.306 ± 0.812 % 93.157 ± 0.790 %
13
+ 2 6.7150 ± 0.3593 0.01369 ± 0.00661 0.02707 ± 0.00159 4.812 ± 0.461 % 92.229 ± 0.592 %
14
+ 3 6.9054 ± 0.3010 0.01251 ± 0.00532 0.02723 ± 0.00151 4.986 ± 0.388 % 92.473 ± 0.476 %
15
+ 4 7.0811 ± 0.2763 0.02339 ± 0.00538 0.03177 ± 0.00236 5.385 ± 0.404 % 92.522 ± 0.411 %
16
+ 5 6.9868 ± 0.2455 0.02169 ± 0.00462 0.03245 ± 0.00201 5.425 ± 0.338 % 92.375 ± 0.371 %
17
+ 6 6.0055 ± 0.1868 0.02188 ± 0.00437 0.03425 ± 0.00188 5.931 ± 0.315 % 92.278 ± 0.341 %
18
+ 7 5.4627 ± 0.1534 0.01421 ± 0.00419 0.04334 ± 0.00399 6.453 ± 0.314 % 92.487 ± 0.312 %
19
+ 8 5.4645 ± 0.1432 0.01158 ± 0.00391 0.04363 ± 0.00352 6.423 ± 0.283 % 92.326 ± 0.294 %
20
+ 9 5.7630 ± 0.1432 0.00870 ± 0.00365 0.04310 ± 0.00315 6.260 ± 0.261 % 92.017 ± 0.282 %
21
+ 10 5.8584 ± 0.1390 0.00912 ± 0.00337 0.04073 ± 0.00284 6.099 ± 0.244 % 92.170 ± 0.266 %
22
+ 11 5.9284 ± 0.1341 0.00871 ± 0.00313 0.03883 ± 0.00258 5.946 ± 0.230 % 92.349 ± 0.251 %
23
+ 12 6.1692 ± 0.1351 0.00780 ± 0.00295 0.03749 ± 0.00237 5.823 ± 0.218 % 92.416 ± 0.239 %
24
+ 13 6.2601 ± 0.1320 0.00732 ± 0.00280 0.03678 ± 0.00220 5.730 ± 0.206 % 92.473 ± 0.229 %
25
+ 14 6.3277 ± 0.1285 0.00765 ± 0.00265 0.03547 ± 0.00204 5.597 ± 0.196 % 92.487 ± 0.220 %
26
+ 15 6.3813 ± 0.1255 0.00813 ± 0.00253 0.03437 ± 0.00191 5.483 ± 0.187 % 92.506 ± 0.213 %
27
+ 16 6.6362 ± 0.1281 0.00112 ± 0.00262 0.03556 ± 0.00182 5.428 ± 0.178 % 92.326 ± 0.208 %
28
+ 17 6.6944 ± 0.1248 0.00136 ± 0.00250 0.03461 ± 0.00172 5.336 ± 0.171 % 92.416 ± 0.201 %
29
+ 18 6.8136 ± 0.1238 0.00299 ± 0.00240 0.03397 ± 0.00162 5.250 ± 0.164 % 92.392 ± 0.195 %
30
+ 19 6.7649 ± 0.1202 0.00430 ± 0.00233 0.03357 ± 0.00155 5.255 ± 0.163 % 92.447 ± 0.190 %
31
+ 20 6.5880 ± 0.1136 0.00464 ± 0.00227 0.03436 ± 0.00149 5.330 ± 0.154 % 92.498 ± 0.184 %
32
+ 21 6.5904 ± 0.1105 0.00398 ± 0.00220 0.03400 ± 0.00142 5.307 ± 0.149 % 92.422 ± 0.181 %
33
+ 22 6.6171 ± 0.1085 0.00471 ± 0.00212 0.03349 ± 0.00136 5.290 ± 0.145 % 92.380 ± 0.177 %
34
+ 23 6.6614 ± 0.1069 0.00477 ± 0.00206 0.03296 ± 0.00130 5.238 ± 0.141 % 92.460 ± 0.172 %
35
+ 24 6.6793 ± 0.1048 0.00544 ± 0.00200 0.03255 ± 0.00125 5.196 ± 0.136 % 92.518 ± 0.168 %
36
+ 25 6.7290 ± 0.1036 0.00565 ± 0.00195 0.03232 ± 0.00120 5.153 ± 0.133 % 92.598 ± 0.164 %
37
+ 26 6.7078 ± 0.1013 0.00606 ± 0.00191 0.03197 ± 0.00116 5.123 ± 0.129 % 92.631 ± 0.160 %
38
+ 27 6.8471 ± 0.1019 0.00642 ± 0.00186 0.03144 ± 0.00112 5.073 ± 0.126 % 92.676 ± 0.157 %
39
+ 28 6.9293 ± 0.1017 0.00653 ± 0.00181 0.03094 ± 0.00108 5.017 ± 0.123 % 92.752 ± 0.153 %
40
+ 29 6.9314 ± 0.0999 0.00621 ± 0.00176 0.03053 ± 0.00104 4.977 ± 0.120 % 92.776 ± 0.150 %
41
+ 30 6.8970 ± 0.0976 0.00601 ± 0.00173 0.03036 ± 0.00101 4.953 ± 0.117 % 92.783 ± 0.148 %
42
+ 31 6.8246 ± 0.0949 0.00658 ± 0.00170 0.03025 ± 0.00098 4.938 ± 0.114 % 92.836 ± 0.145 %
43
+ 32 6.7270 ± 0.0920 0.00713 ± 0.00167 0.03052 ± 0.00095 4.997 ± 0.111 % 92.818 ± 0.143 %
44
+ 33 6.7007 ± 0.0903 0.00741 ± 0.00164 0.03041 ± 0.00093 4.981 ± 0.109 % 92.840 ± 0.140 %
45
+ 34 6.6952 ± 0.0888 0.00731 ± 0.00162 0.03017 ± 0.00091 4.950 ± 0.106 % 92.853 ± 0.138 %
46
+ 35 6.7172 ± 0.0879 0.00845 ± 0.00159 0.03011 ± 0.00089 4.958 ± 0.106 % 92.850 ± 0.136 %
47
+ 36 6.7247 ± 0.0868 0.00902 ± 0.00157 0.02991 ± 0.00087 4.933 ± 0.104 % 92.897 ± 0.134 %
48
+ 37 6.6136 ± 0.0838 0.00975 ± 0.00154 0.02972 ± 0.00085 4.924 ± 0.102 % 92.922 ± 0.132 %
49
+ 38 6.5471 ± 0.0816 0.00950 ± 0.00151 0.02950 ± 0.00082 4.916 ± 0.100 % 92.949 ± 0.130 %
50
+ 39 6.4781 ± 0.0795 0.00956 ± 0.00149 0.02956 ± 0.00082 4.925 ± 0.098 % 92.959 ± 0.128 %
51
+ 40 6.3888 ± 0.0771 0.00961 ± 0.00146 0.02942 ± 0.00080 4.919 ± 0.096 % 92.972 ± 0.126 %
52
+
53
+ ====== Perplexity statistics ======
54
+ Mean PPL(Q) : 6.388763 ± 0.077065
55
+ Mean PPL(base) : 6.327630 ± 0.076192
56
+ Cor(ln(PPL(Q)), ln(PPL(base))): 99.26%
57
+ Mean ln(PPL(Q)/PPL(base)) : 0.009615 ± 0.001463
58
+ Mean PPL(Q)/PPL(base) : 1.009661 ± 0.001477
59
+ Mean PPL(Q)-PPL(base) : 0.061133 ± 0.009341
60
+
61
+ ====== KL divergence statistics ======
62
+ Mean KLD: 0.029416 ± 0.000800
63
+ Maximum KLD: 22.440645
64
+ 99.9% KLD: 1.526750
65
+ 99.0% KLD: 0.303920
66
+ 95.0% KLD: 0.094522
67
+ 90.0% KLD: 0.054514
68
+ Median KLD: 0.010466
69
+ 10.0% KLD: 0.000195
70
+ 5.0% KLD: 0.000048
71
+ 1.0% KLD: 0.000005
72
+ 0.1% KLD: -0.000000
73
+ Minimum KLD: -0.000016
74
+
75
+ ====== Token probability statistics ======
76
+ Mean Δp: -0.193 ± 0.024 %
77
+ Maximum Δp: 94.884%
78
+ 99.9% Δp: 34.781%
79
+ 99.0% Δp: 12.957%
80
+ 95.0% Δp: 5.345%
81
+ 90.0% Δp: 3.023%
82
+ 75.0% Δp: 0.574%
83
+ Median Δp: -0.001%
84
+ 25.0% Δp: -0.770%
85
+ 10.0% Δp: -3.480%
86
+ 5.0% Δp: -6.066%
87
+ 1.0% Δp: -15.712%
88
+ 0.1% Δp: -41.449%
89
+ Minimum Δp: -98.386%
90
+ RMS Δp : 4.919 ± 0.096 %
91
+ Same top p: 92.972 ± 0.126 %
92
+
recipe/logs/afternoon_B5_kld_q106.log ADDED
@@ -0,0 +1,92 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ 0.00.068.802 I common_init_result: fitting params to device memory ...
2
+ 0.00.068.807 I common_init_result: (for bugs during this step try to reproduce them with -fit off, or provide --verbose logs if the bug only occurs with -fit on)
3
+ 0.00.460.644 W llama_model_loader: direct I/O is enabled, disabling mmap
4
+ 0.40.681.506 W llama_context: n_ctx_seq (2048) < n_ctx_train (262144) -- the full capacity of the model will not be utilized
5
+ 0.40.751.408 W common_init_from_params: warming up the model with an empty run - please wait ... (--no-warmup to disable)
6
+ 0.40.912.601 I
7
+ 0.40.912.721 I system_info: n_threads = 16 (n_threads_batch = 16) / 32 | ROCm : NO_VMM = 1 | PEER_MAX_BATCH_SIZE = 128 | FA_ALL_QUANTS = 1 | CPU : SSE3 = 1 | SSSE3 = 1 | AVX = 1 | AVX_VNNI = 1 | AVX2 = 1 | F16C = 1 | FMA = 1 | BMI2 = 1 | AVX512 = 1 | AVX512_VBMI = 1 | AVX512_VNNI = 1 | AVX512_BF16 = 1 | LLAMAFILE = 1 | OPENMP = 1 | REPACK = 1 |
8
+ 0.41.096.613 I kl_divergence: computing over 40 chunks, n_ctx=2048, batch_size=2048, n_seq=1
9
+ 0.50.761.361 I kl_divergence: 9.66 seconds per pass - ETA 6.43 minutes
10
+
11
+ chunk PPL ln(PPL(Q)/PPL(base)) KL Divergence Δp RMS Same top p
12
+ 1 5.6588 ± 0.4178 0.01009 ± 0.00791 0.02954 ± 0.00195 4.945 ± 0.370 % 92.082 ± 0.845 %
13
+ 2 6.8058 ± 0.3681 0.02711 ± 0.00674 0.03973 ± 0.00203 5.210 ± 0.318 % 91.105 ± 0.630 %
14
+ 3 6.9897 ± 0.3080 0.02465 ± 0.00540 0.03684 ± 0.00156 5.139 ± 0.254 % 90.974 ± 0.517 %
15
+ 4 7.1929 ± 0.2841 0.03906 ± 0.00507 0.04007 ± 0.00162 5.587 ± 0.287 % 91.031 ± 0.447 %
16
+ 5 7.1476 ± 0.2551 0.04443 ± 0.00479 0.04199 ± 0.00162 5.659 ± 0.245 % 91.065 ± 0.399 %
17
+ 6 6.1062 ± 0.1927 0.03852 ± 0.00445 0.04307 ± 0.00160 6.178 ± 0.247 % 91.268 ± 0.360 %
18
+ 7 5.5325 ± 0.1575 0.02692 ± 0.00433 0.05190 ± 0.00368 6.703 ± 0.271 % 91.370 ± 0.332 %
19
+ 8 5.5219 ± 0.1466 0.02203 ± 0.00408 0.05166 ± 0.00325 6.658 ± 0.249 % 91.312 ± 0.311 %
20
+ 9 5.7984 ± 0.1455 0.01482 ± 0.00398 0.05271 ± 0.00294 6.601 ± 0.228 % 90.953 ± 0.299 %
21
+ 10 5.9036 ± 0.1416 0.01680 ± 0.00372 0.05035 ± 0.00265 6.469 ± 0.214 % 91.095 ± 0.282 %
22
+ 11 5.9859 ± 0.1369 0.01836 ± 0.00349 0.04879 ± 0.00242 6.392 ± 0.201 % 91.193 ± 0.267 %
23
+ 12 6.2320 ± 0.1380 0.01792 ± 0.00327 0.04716 ± 0.00223 6.233 ± 0.190 % 91.316 ± 0.254 %
24
+ 13 6.3269 ± 0.1349 0.01792 ± 0.00309 0.04599 ± 0.00206 6.159 ± 0.182 % 91.488 ± 0.242 %
25
+ 14 6.3869 ± 0.1311 0.01695 ± 0.00294 0.04481 ± 0.00192 6.076 ± 0.174 % 91.461 ± 0.234 %
26
+ 15 6.4396 ± 0.1280 0.01721 ± 0.00282 0.04382 ± 0.00180 5.968 ± 0.166 % 91.548 ± 0.225 %
27
+ 16 6.7096 ± 0.1310 0.01211 ± 0.00285 0.04471 ± 0.00175 5.907 ± 0.157 % 91.422 ± 0.219 %
28
+ 17 6.7673 ± 0.1276 0.01219 ± 0.00272 0.04370 ± 0.00165 5.818 ± 0.151 % 91.444 ± 0.212 %
29
+ 18 6.8777 ± 0.1263 0.01236 ± 0.00262 0.04303 ± 0.00156 5.744 ± 0.145 % 91.468 ± 0.206 %
30
+ 19 6.8299 ± 0.1226 0.01386 ± 0.00253 0.04239 ± 0.00149 5.690 ± 0.141 % 91.506 ± 0.200 %
31
+ 20 6.6595 ± 0.1161 0.01543 ± 0.00250 0.04380 ± 0.00145 5.884 ± 0.142 % 91.520 ± 0.195 %
32
+ 21 6.6615 ± 0.1129 0.01471 ± 0.00242 0.04338 ± 0.00138 5.858 ± 0.138 % 91.528 ± 0.190 %
33
+ 22 6.6882 ± 0.1109 0.01540 ± 0.00234 0.04285 ± 0.00132 5.816 ± 0.135 % 91.571 ± 0.185 %
34
+ 23 6.7337 ± 0.1092 0.01556 ± 0.00227 0.04238 ± 0.00127 5.793 ± 0.130 % 91.619 ± 0.181 %
35
+ 24 6.7493 ± 0.1070 0.01586 ± 0.00220 0.04168 ± 0.00122 5.729 ± 0.126 % 91.691 ± 0.176 %
36
+ 25 6.7976 ± 0.1058 0.01579 ± 0.00214 0.04128 ± 0.00117 5.684 ± 0.123 % 91.715 ± 0.172 %
37
+ 26 6.7754 ± 0.1033 0.01608 ± 0.00210 0.04106 ± 0.00113 5.701 ± 0.121 % 91.781 ± 0.168 %
38
+ 27 6.9146 ± 0.1039 0.01622 ± 0.00204 0.04051 ± 0.00109 5.639 ± 0.118 % 91.829 ± 0.165 %
39
+ 28 6.9967 ± 0.1036 0.01621 ± 0.00199 0.04004 ± 0.00105 5.591 ± 0.115 % 91.866 ± 0.162 %
40
+ 29 7.0009 ± 0.1018 0.01618 ± 0.00194 0.03963 ± 0.00102 5.550 ± 0.112 % 91.900 ± 0.158 %
41
+ 30 6.9660 ± 0.0996 0.01596 ± 0.00191 0.03951 ± 0.00099 5.523 ± 0.110 % 91.877 ± 0.156 %
42
+ 31 6.8931 ± 0.0968 0.01656 ± 0.00188 0.03950 ± 0.00096 5.505 ± 0.107 % 91.918 ± 0.153 %
43
+ 32 6.7966 ± 0.0939 0.01742 ± 0.00186 0.03990 ± 0.00094 5.557 ± 0.105 % 91.932 ± 0.151 %
44
+ 33 6.7940 ± 0.0926 0.02123 ± 0.00189 0.04120 ± 0.00098 5.642 ± 0.108 % 91.904 ± 0.148 %
45
+ 34 6.7897 ± 0.0911 0.02132 ± 0.00185 0.04091 ± 0.00095 5.619 ± 0.106 % 91.904 ± 0.146 %
46
+ 35 6.8091 ± 0.0901 0.02204 ± 0.00183 0.04100 ± 0.00094 5.636 ± 0.106 % 91.895 ± 0.144 %
47
+ 36 6.8180 ± 0.0891 0.02280 ± 0.00180 0.04083 ± 0.00092 5.608 ± 0.104 % 91.933 ± 0.142 %
48
+ 37 6.7025 ± 0.0859 0.02311 ± 0.00177 0.04048 ± 0.00090 5.582 ± 0.102 % 91.942 ± 0.140 %
49
+ 38 6.6343 ± 0.0837 0.02274 ± 0.00174 0.04026 ± 0.00088 5.587 ± 0.100 % 91.974 ± 0.138 %
50
+ 39 6.5615 ± 0.0814 0.02235 ± 0.00172 0.04083 ± 0.00094 5.668 ± 0.101 % 91.937 ± 0.136 %
51
+ 40 6.4705 ± 0.0789 0.02233 ± 0.00169 0.04064 ± 0.00092 5.666 ± 0.099 % 91.960 ± 0.134 %
52
+
53
+ ====== Perplexity statistics ======
54
+ Mean PPL(Q) : 6.470544 ± 0.078949
55
+ Mean PPL(base) : 6.327630 ± 0.076192
56
+ Cor(ln(PPL(Q)), ln(PPL(base))): 99.04%
57
+ Mean ln(PPL(Q)/PPL(base)) : 0.022334 ± 0.001688
58
+ Mean PPL(Q)/PPL(base) : 1.022586 ± 0.001726
59
+ Mean PPL(Q)-PPL(base) : 0.142914 ± 0.011102
60
+
61
+ ====== KL divergence statistics ======
62
+ Mean KLD: 0.040638 ± 0.000923
63
+ Maximum KLD: 21.348299
64
+ 99.9% KLD: 1.687412
65
+ 99.0% KLD: 0.418962
66
+ 95.0% KLD: 0.132057
67
+ 90.0% KLD: 0.079330
68
+ Median KLD: 0.015596
69
+ 10.0% KLD: 0.000272
70
+ 5.0% KLD: 0.000068
71
+ 1.0% KLD: 0.000007
72
+ 0.1% KLD: 0.000000
73
+ Minimum KLD: -0.000064
74
+
75
+ ====== Token probability statistics ======
76
+ Mean Δp: -0.107 ± 0.028 %
77
+ Maximum Δp: 95.028%
78
+ 99.9% Δp: 38.430%
79
+ 99.0% Δp: 14.846%
80
+ 95.0% Δp: 6.591%
81
+ 90.0% Δp: 3.874%
82
+ 75.0% Δp: 0.809%
83
+ Median Δp: -0.001%
84
+ 25.0% Δp: -0.816%
85
+ 10.0% Δp: -3.971%
86
+ 5.0% Δp: -7.147%
87
+ 1.0% Δp: -17.518%
88
+ 0.1% Δp: -46.790%
89
+ Minimum Δp: -99.990%
90
+ RMS Δp : 5.666 ± 0.099 %
91
+ Same top p: 91.960 ± 0.134 %
92
+
recipe/logs/afternoon_B5_kld_q106i.log ADDED
@@ -0,0 +1,92 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ 0.00.035.853 I common_init_result: fitting params to device memory ...
2
+ 0.00.035.856 I common_init_result: (for bugs during this step try to reproduce them with -fit off, or provide --verbose logs if the bug only occurs with -fit on)
3
+ 0.00.411.069 W llama_model_loader: direct I/O is enabled, disabling mmap
4
+ 0.19.744.305 W llama_context: n_ctx_seq (2048) < n_ctx_train (262144) -- the full capacity of the model will not be utilized
5
+ 0.19.803.991 W common_init_from_params: warming up the model with an empty run - please wait ... (--no-warmup to disable)
6
+ 0.19.941.558 I
7
+ 0.19.941.694 I system_info: n_threads = 16 (n_threads_batch = 16) / 32 | ROCm : NO_VMM = 1 | PEER_MAX_BATCH_SIZE = 128 | FA_ALL_QUANTS = 1 | CPU : SSE3 = 1 | SSSE3 = 1 | AVX = 1 | AVX_VNNI = 1 | AVX2 = 1 | F16C = 1 | FMA = 1 | BMI2 = 1 | AVX512 = 1 | AVX512_VBMI = 1 | AVX512_VNNI = 1 | AVX512_BF16 = 1 | LLAMAFILE = 1 | OPENMP = 1 | REPACK = 1 |
8
+ 0.20.055.269 I kl_divergence: computing over 40 chunks, n_ctx=2048, batch_size=2048, n_seq=1
9
+ 0.27.119.826 I kl_divergence: 7.06 seconds per pass - ETA 4.70 minutes
10
+
11
+ chunk PPL ln(PPL(Q)/PPL(base)) KL Divergence Δp RMS Same top p
12
+ 1 5.6231 ± 0.4111 0.00377 ± 0.00830 0.02658 ± 0.00227 4.715 ± 0.418 % 92.375 ± 0.830 %
13
+ 2 6.7509 ± 0.3616 0.01901 ± 0.00656 0.03276 ± 0.00181 4.871 ± 0.315 % 91.838 ± 0.605 %
14
+ 3 6.9468 ± 0.3033 0.01848 ± 0.00533 0.03242 ± 0.00172 5.333 ± 0.336 % 92.115 ± 0.487 %
15
+ 4 7.1727 ± 0.2827 0.03625 ± 0.00528 0.03590 ± 0.00185 5.720 ± 0.348 % 92.180 ± 0.420 %
16
+ 5 7.0702 ± 0.2506 0.03355 ± 0.00463 0.03664 ± 0.00164 5.657 ± 0.297 % 91.867 ± 0.382 %
17
+ 6 6.0711 ± 0.1904 0.03275 ± 0.00425 0.03651 ± 0.00143 5.833 ± 0.256 % 92.033 ± 0.346 %
18
+ 7 5.5141 ± 0.1562 0.02358 ± 0.00414 0.04672 ± 0.00445 6.523 ± 0.289 % 92.236 ± 0.316 %
19
+ 8 5.5033 ± 0.1454 0.01866 ± 0.00394 0.04668 ± 0.00393 6.450 ± 0.263 % 92.107 ± 0.298 %
20
+ 9 5.8014 ± 0.1451 0.01534 ± 0.00376 0.04651 ± 0.00351 6.383 ± 0.242 % 91.735 ± 0.287 %
21
+ 10 5.8970 ± 0.1409 0.01569 ± 0.00347 0.04385 ± 0.00316 6.164 ± 0.226 % 91.926 ± 0.269 %
22
+ 11 5.9673 ± 0.1359 0.01524 ± 0.00322 0.04200 ± 0.00287 6.033 ± 0.211 % 92.091 ± 0.254 %
23
+ 12 6.2128 ± 0.1369 0.01485 ± 0.00303 0.04047 ± 0.00264 5.915 ± 0.200 % 92.074 ± 0.244 %
24
+ 13 6.2968 ± 0.1334 0.01315 ± 0.00291 0.03979 ± 0.00244 5.841 ± 0.188 % 92.067 ± 0.234 %
25
+ 14 6.3603 ± 0.1298 0.01278 ± 0.00275 0.03850 ± 0.00227 5.722 ± 0.179 % 91.977 ± 0.227 %
26
+ 15 6.4122 ± 0.1266 0.01295 ± 0.00263 0.03740 ± 0.00212 5.609 ± 0.171 % 92.004 ± 0.219 %
27
+ 16 6.6471 ± 0.1285 0.00275 ± 0.00288 0.04017 ± 0.00207 5.647 ± 0.163 % 91.667 ± 0.216 %
28
+ 17 6.7070 ± 0.1253 0.00325 ± 0.00275 0.03909 ± 0.00195 5.540 ± 0.156 % 91.772 ± 0.208 %
29
+ 18 6.8201 ± 0.1241 0.00394 ± 0.00263 0.03834 ± 0.00185 5.472 ± 0.150 % 91.745 ± 0.203 %
30
+ 19 6.7684 ± 0.1203 0.00482 ± 0.00252 0.03751 ± 0.00175 5.410 ± 0.146 % 91.799 ± 0.197 %
31
+ 20 6.5981 ± 0.1139 0.00617 ± 0.00247 0.03867 ± 0.00169 5.527 ± 0.143 % 91.799 ± 0.192 %
32
+ 21 6.5963 ± 0.1107 0.00488 ± 0.00240 0.03871 ± 0.00164 5.524 ± 0.139 % 91.794 ± 0.187 %
33
+ 22 6.6228 ± 0.1087 0.00557 ± 0.00232 0.03806 ± 0.00157 5.494 ± 0.136 % 91.829 ± 0.183 %
34
+ 23 6.6725 ± 0.1071 0.00643 ± 0.00224 0.03755 ± 0.00150 5.461 ± 0.132 % 91.899 ± 0.178 %
35
+ 24 6.6888 ± 0.1050 0.00686 ± 0.00217 0.03696 ± 0.00144 5.405 ± 0.128 % 91.956 ± 0.174 %
36
+ 25 6.7371 ± 0.1038 0.00686 ± 0.00211 0.03658 ± 0.00139 5.354 ± 0.124 % 91.996 ± 0.170 %
37
+ 26 6.7173 ± 0.1014 0.00748 ± 0.00207 0.03631 ± 0.00134 5.350 ± 0.122 % 92.037 ± 0.166 %
38
+ 27 6.8569 ± 0.1021 0.00784 ± 0.00201 0.03572 ± 0.00129 5.287 ± 0.119 % 92.104 ± 0.162 %
39
+ 28 6.9388 ± 0.1018 0.00789 ± 0.00196 0.03524 ± 0.00125 5.248 ± 0.117 % 92.166 ± 0.159 %
40
+ 29 6.9431 ± 0.1001 0.00790 ± 0.00190 0.03477 ± 0.00120 5.205 ± 0.114 % 92.207 ± 0.156 %
41
+ 30 6.9087 ± 0.0978 0.00770 ± 0.00186 0.03457 ± 0.00117 5.176 ± 0.111 % 92.235 ± 0.153 %
42
+ 31 6.8352 ± 0.0951 0.00813 ± 0.00183 0.03447 ± 0.00113 5.157 ± 0.108 % 92.256 ± 0.150 %
43
+ 32 6.7335 ± 0.0921 0.00810 ± 0.00180 0.03484 ± 0.00110 5.192 ± 0.106 % 92.265 ± 0.148 %
44
+ 33 6.7353 ± 0.0910 0.01256 ± 0.00186 0.03698 ± 0.00117 5.369 ± 0.117 % 92.162 ± 0.146 %
45
+ 34 6.7312 ± 0.0895 0.01267 ± 0.00182 0.03665 ± 0.00113 5.339 ± 0.115 % 92.180 ± 0.144 %
46
+ 35 6.7510 ± 0.0886 0.01347 ± 0.00179 0.03659 ± 0.00111 5.334 ± 0.114 % 92.166 ± 0.142 %
47
+ 36 6.7586 ± 0.0875 0.01404 ± 0.00176 0.03634 ± 0.00108 5.313 ± 0.112 % 92.218 ± 0.140 %
48
+ 37 6.6444 ± 0.0844 0.01440 ± 0.00172 0.03604 ± 0.00106 5.296 ± 0.110 % 92.256 ± 0.137 %
49
+ 38 6.5786 ± 0.0822 0.01431 ± 0.00169 0.03576 ± 0.00103 5.290 ± 0.108 % 92.290 ± 0.135 %
50
+ 39 6.5045 ± 0.0800 0.01363 ± 0.00167 0.03602 ± 0.00102 5.336 ± 0.107 % 92.265 ± 0.134 %
51
+ 40 6.4131 ± 0.0775 0.01342 ± 0.00164 0.03579 ± 0.00100 5.328 ± 0.105 % 92.309 ± 0.132 %
52
+
53
+ ====== Perplexity statistics ======
54
+ Mean PPL(Q) : 6.413088 ± 0.077536
55
+ Mean PPL(base) : 6.327630 ± 0.076192
56
+ Cor(ln(PPL(Q)), ln(PPL(base))): 99.08%
57
+ Mean ln(PPL(Q)/PPL(base)) : 0.013415 ± 0.001642
58
+ Mean PPL(Q)/PPL(base) : 1.013506 ± 0.001664
59
+ Mean PPL(Q)-PPL(base) : 0.085458 ± 0.010539
60
+
61
+ ====== KL divergence statistics ======
62
+ Mean KLD: 0.035791 ± 0.001001
63
+ Maximum KLD: 27.125303
64
+ 99.9% KLD: 1.792250
65
+ 99.0% KLD: 0.381905
66
+ 95.0% KLD: 0.113879
67
+ 90.0% KLD: 0.064828
68
+ Median KLD: 0.012275
69
+ 10.0% KLD: 0.000234
70
+ 5.0% KLD: 0.000053
71
+ 1.0% KLD: 0.000006
72
+ 0.1% KLD: 0.000000
73
+ Minimum KLD: -0.000019
74
+
75
+ ====== Token probability statistics ======
76
+ Mean Δp: -0.200 ± 0.026 %
77
+ Maximum Δp: 94.884%
78
+ 99.9% Δp: 39.516%
79
+ 99.0% Δp: 13.954%
80
+ 95.0% Δp: 5.807%
81
+ 90.0% Δp: 3.177%
82
+ 75.0% Δp: 0.596%
83
+ Median Δp: -0.001%
84
+ 25.0% Δp: -0.845%
85
+ 10.0% Δp: -3.738%
86
+ 5.0% Δp: -6.497%
87
+ 1.0% Δp: -16.639%
88
+ 0.1% Δp: -43.751%
89
+ Minimum Δp: -98.872%
90
+ RMS Δp : 5.328 ± 0.105 %
91
+ Same top p: 92.309 ± 0.132 %
92
+
recipe/logs/afternoon_B5_kld_q111.log ADDED
@@ -0,0 +1,92 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ 0.00.045.114 I common_init_result: fitting params to device memory ...
2
+ 0.00.045.117 I common_init_result: (for bugs during this step try to reproduce them with -fit off, or provide --verbose logs if the bug only occurs with -fit on)
3
+ 0.00.478.581 W llama_model_loader: direct I/O is enabled, disabling mmap
4
+ 0.37.579.838 W llama_context: n_ctx_seq (2048) < n_ctx_train (262144) -- the full capacity of the model will not be utilized
5
+ 0.37.651.344 W common_init_from_params: warming up the model with an empty run - please wait ... (--no-warmup to disable)
6
+ 0.37.859.083 I
7
+ 0.37.859.213 I system_info: n_threads = 16 (n_threads_batch = 16) / 32 | ROCm : NO_VMM = 1 | PEER_MAX_BATCH_SIZE = 128 | FA_ALL_QUANTS = 1 | CPU : SSE3 = 1 | SSSE3 = 1 | AVX = 1 | AVX_VNNI = 1 | AVX2 = 1 | F16C = 1 | FMA = 1 | BMI2 = 1 | AVX512 = 1 | AVX512_VBMI = 1 | AVX512_VNNI = 1 | AVX512_BF16 = 1 | LLAMAFILE = 1 | OPENMP = 1 | REPACK = 1 |
8
+ 0.37.976.758 I kl_divergence: computing over 40 chunks, n_ctx=2048, batch_size=2048, n_seq=1
9
+ 0.46.116.757 I kl_divergence: 8.14 seconds per pass - ETA 5.42 minutes
10
+
11
+ chunk PPL ln(PPL(Q)/PPL(base)) KL Divergence Δp RMS Same top p
12
+ 1 5.6059 ± 0.4093 0.00069 ± 0.00337 0.00478 ± 0.00036 1.948 ± 0.123 % 97.458 ± 0.492 %
13
+ 2 6.6305 ± 0.3529 0.00102 ± 0.00266 0.00604 ± 0.00039 2.228 ± 0.174 % 96.237 ± 0.421 %
14
+ 3 6.8224 ± 0.2960 0.00043 ± 0.00210 0.00596 ± 0.00033 2.358 ± 0.175 % 96.383 ± 0.337 %
15
+ 4 6.8978 ± 0.2659 -0.00284 ± 0.00191 0.00624 ± 0.00037 2.408 ± 0.172 % 96.676 ± 0.280 %
16
+ 5 6.8264 ± 0.2374 -0.00155 ± 0.00174 0.00657 ± 0.00037 2.448 ± 0.164 % 96.461 ± 0.258 %
17
+ 6 5.8711 ± 0.1809 -0.00075 ± 0.00160 0.00680 ± 0.00033 2.558 ± 0.141 % 96.351 ± 0.239 %
18
+ 7 5.3771 ± 0.1501 -0.00159 ± 0.00200 0.01596 ± 0.00375 3.643 ± 0.351 % 96.271 ± 0.224 %
19
+ 8 5.3744 ± 0.1400 -0.00504 ± 0.00203 0.01666 ± 0.00329 3.739 ± 0.314 % 95.907 ± 0.219 %
20
+ 9 5.6841 ± 0.1409 -0.00509 ± 0.00194 0.01604 ± 0.00293 3.659 ± 0.289 % 95.688 ± 0.212 %
21
+ 10 5.7797 ± 0.1368 -0.00441 ± 0.00181 0.01510 ± 0.00264 3.537 ± 0.269 % 95.797 ± 0.198 %
22
+ 11 5.8547 ± 0.1322 -0.00381 ± 0.00168 0.01425 ± 0.00240 3.447 ± 0.251 % 95.868 ± 0.188 %
23
+ 12 6.1082 ± 0.1337 -0.00214 ± 0.00160 0.01394 ± 0.00221 3.354 ± 0.237 % 95.837 ± 0.180 %
24
+ 13 6.1990 ± 0.1306 -0.00250 ± 0.00153 0.01344 ± 0.00204 3.309 ± 0.223 % 95.879 ± 0.172 %
25
+ 14 6.2654 ± 0.1271 -0.00225 ± 0.00146 0.01297 ± 0.00189 3.252 ± 0.211 % 95.825 ± 0.167 %
26
+ 15 6.3162 ± 0.1240 -0.00214 ± 0.00142 0.01258 ± 0.00177 3.221 ± 0.202 % 95.855 ± 0.161 %
27
+ 16 6.6139 ± 0.1282 -0.00225 ± 0.00153 0.01319 ± 0.00170 3.247 ± 0.196 % 95.778 ± 0.157 %
28
+ 17 6.6699 ± 0.1249 -0.00231 ± 0.00147 0.01282 ± 0.00160 3.192 ± 0.188 % 95.825 ± 0.152 %
29
+ 18 6.7785 ± 0.1236 -0.00218 ± 0.00141 0.01246 ± 0.00152 3.146 ± 0.180 % 95.802 ± 0.148 %
30
+ 19 6.7237 ± 0.1198 -0.00180 ± 0.00135 0.01206 ± 0.00144 3.092 ± 0.174 % 95.802 ± 0.144 %
31
+ 20 6.5488 ± 0.1132 -0.00133 ± 0.00133 0.01227 ± 0.00138 3.215 ± 0.174 % 95.777 ± 0.141 %
32
+ 21 6.5550 ± 0.1102 -0.00140 ± 0.00128 0.01224 ± 0.00133 3.216 ± 0.168 % 95.811 ± 0.137 %
33
+ 22 6.5767 ± 0.1081 -0.00141 ± 0.00124 0.01195 ± 0.00127 3.176 ± 0.163 % 95.819 ± 0.133 %
34
+ 23 6.6160 ± 0.1063 -0.00208 ± 0.00121 0.01186 ± 0.00122 3.184 ± 0.158 % 95.852 ± 0.130 %
35
+ 24 6.6269 ± 0.1041 -0.00243 ± 0.00117 0.01174 ± 0.00117 3.157 ± 0.153 % 95.866 ± 0.127 %
36
+ 25 6.6721 ± 0.1028 -0.00285 ± 0.00114 0.01158 ± 0.00112 3.132 ± 0.149 % 95.883 ± 0.124 %
37
+ 26 6.6480 ± 0.1004 -0.00290 ± 0.00110 0.01134 ± 0.00108 3.107 ± 0.144 % 95.917 ± 0.121 %
38
+ 27 6.7853 ± 0.1010 -0.00264 ± 0.00107 0.01109 ± 0.00104 3.066 ± 0.141 % 95.952 ± 0.119 %
39
+ 28 6.8669 ± 0.1008 -0.00252 ± 0.00106 0.01125 ± 0.00102 3.030 ± 0.138 % 95.968 ± 0.116 %
40
+ 29 6.8723 ± 0.0991 -0.00234 ± 0.00103 0.01105 ± 0.00099 3.000 ± 0.134 % 95.989 ± 0.114 %
41
+ 30 6.8393 ± 0.0969 -0.00240 ± 0.00101 0.01090 ± 0.00096 2.975 ± 0.131 % 96.008 ± 0.112 %
42
+ 31 6.7637 ± 0.0941 -0.00239 ± 0.00098 0.01077 ± 0.00093 2.954 ± 0.128 % 96.036 ± 0.110 %
43
+ 32 6.6655 ± 0.0912 -0.00205 ± 0.00096 0.01069 ± 0.00090 2.967 ± 0.123 % 96.041 ± 0.108 %
44
+ 33 6.6325 ± 0.0893 -0.00282 ± 0.00097 0.01074 ± 0.00087 2.954 ± 0.120 % 96.022 ± 0.106 %
45
+ 34 6.6281 ± 0.0879 -0.00276 ± 0.00094 0.01060 ± 0.00084 2.933 ± 0.118 % 96.001 ± 0.105 %
46
+ 35 6.6458 ± 0.0869 -0.00224 ± 0.00095 0.01069 ± 0.00084 2.967 ± 0.122 % 95.978 ± 0.104 %
47
+ 36 6.6507 ± 0.0857 -0.00205 ± 0.00093 0.01058 ± 0.00082 2.951 ± 0.119 % 96.003 ± 0.102 %
48
+ 37 6.5368 ± 0.0827 -0.00192 ± 0.00091 0.01044 ± 0.00080 2.933 ± 0.117 % 96.011 ± 0.101 %
49
+ 38 6.4710 ± 0.0805 -0.00218 ± 0.00089 0.01031 ± 0.00078 2.914 ± 0.115 % 96.028 ± 0.099 %
50
+ 39 6.4058 ± 0.0785 -0.00166 ± 0.00089 0.01054 ± 0.00077 2.985 ± 0.115 % 96.030 ± 0.098 %
51
+ 40 6.3176 ± 0.0761 -0.00158 ± 0.00087 0.01048 ± 0.00075 2.987 ± 0.113 % 96.026 ± 0.097 %
52
+
53
+ ====== Perplexity statistics ======
54
+ Mean PPL(Q) : 6.317616 ± 0.076081
55
+ Mean PPL(base) : 6.327630 ± 0.076192
56
+ Cor(ln(PPL(Q)), ln(PPL(base))): 99.74%
57
+ Mean ln(PPL(Q)/PPL(base)) : -0.001584 ± 0.000875
58
+ Mean PPL(Q)/PPL(base) : 0.998417 ± 0.000873
59
+ Mean PPL(Q)-PPL(base) : -0.010014 ± 0.005531
60
+
61
+ ====== KL divergence statistics ======
62
+ Mean KLD: 0.010477 ± 0.000749
63
+ Maximum KLD: 22.860224
64
+ 99.9% KLD: 0.681516
65
+ 99.0% KLD: 0.085791
66
+ 95.0% KLD: 0.025180
67
+ 90.0% KLD: 0.015262
68
+ Median KLD: 0.003005
69
+ 10.0% KLD: 0.000068
70
+ 5.0% KLD: 0.000017
71
+ 1.0% KLD: 0.000002
72
+ 0.1% KLD: -0.000001
73
+ Minimum KLD: -0.000043
74
+
75
+ ====== Token probability statistics ======
76
+ Mean Δp: -0.013 ± 0.015 %
77
+ Maximum Δp: 94.851%
78
+ 99.9% Δp: 19.339%
79
+ 99.0% Δp: 7.373%
80
+ 95.0% Δp: 3.232%
81
+ 90.0% Δp: 1.833%
82
+ 75.0% Δp: 0.372%
83
+ Median Δp: -0.000%
84
+ 25.0% Δp: -0.393%
85
+ 10.0% Δp: -1.826%
86
+ 5.0% Δp: -3.214%
87
+ 1.0% Δp: -7.349%
88
+ 0.1% Δp: -20.986%
89
+ Minimum Δp: -97.772%
90
+ RMS Δp : 2.987 ± 0.113 %
91
+ Same top p: 96.026 ± 0.097 %
92
+
recipe/logs/afternoon_B5_kld_q115.log ADDED
@@ -0,0 +1,92 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ 0.00.065.550 I common_init_result: fitting params to device memory ...
2
+ 0.00.065.557 I common_init_result: (for bugs during this step try to reproduce them with -fit off, or provide --verbose logs if the bug only occurs with -fit on)
3
+ 0.00.633.205 W llama_model_loader: direct I/O is enabled, disabling mmap
4
+ 0.37.969.769 W llama_context: n_ctx_seq (2048) < n_ctx_train (262144) -- the full capacity of the model will not be utilized
5
+ 0.38.030.027 W common_init_from_params: warming up the model with an empty run - please wait ... (--no-warmup to disable)
6
+ 0.38.234.320 I
7
+ 0.38.234.434 I system_info: n_threads = 16 (n_threads_batch = 16) / 32 | ROCm : NO_VMM = 1 | PEER_MAX_BATCH_SIZE = 128 | FA_ALL_QUANTS = 1 | CPU : SSE3 = 1 | SSSE3 = 1 | AVX = 1 | AVX_VNNI = 1 | AVX2 = 1 | F16C = 1 | FMA = 1 | BMI2 = 1 | AVX512 = 1 | AVX512_VBMI = 1 | AVX512_VNNI = 1 | AVX512_BF16 = 1 | LLAMAFILE = 1 | OPENMP = 1 | REPACK = 1 |
8
+ 0.38.357.351 I kl_divergence: computing over 40 chunks, n_ctx=2048, batch_size=2048, n_seq=1
9
+ 0.46.087.366 I kl_divergence: 7.73 seconds per pass - ETA 5.15 minutes
10
+
11
+ chunk PPL ln(PPL(Q)/PPL(base)) KL Divergence Δp RMS Same top p
12
+ 1 5.5566 ± 0.4036 -0.00814 ± 0.00272 0.00315 ± 0.00028 1.550 ± 0.110 % 97.458 ± 0.492 %
13
+ 2 6.6107 ± 0.3509 -0.00197 ± 0.00206 0.00353 ± 0.00030 1.796 ± 0.228 % 96.774 ± 0.391 %
14
+ 3 6.8101 ± 0.2950 -0.00138 ± 0.00159 0.00313 ± 0.00020 1.651 ± 0.168 % 96.839 ± 0.316 %
15
+ 4 6.8838 ± 0.2650 -0.00487 ± 0.00217 0.00685 ± 0.00217 2.692 ± 0.513 % 96.970 ± 0.268 %
16
+ 5 6.8057 ± 0.2361 -0.00458 ± 0.00192 0.00658 ± 0.00175 2.563 ± 0.432 % 96.911 ± 0.242 %
17
+ 6 5.8506 ± 0.1799 -0.00425 ± 0.00170 0.00637 ± 0.00146 2.524 ± 0.368 % 96.937 ± 0.220 %
18
+ 7 5.3534 ± 0.1491 -0.00600 ± 0.00186 0.01421 ± 0.00369 3.438 ± 0.382 % 96.900 ± 0.205 %
19
+ 8 5.3640 ± 0.1397 -0.00698 ± 0.00182 0.01412 ± 0.00324 3.459 ± 0.342 % 96.640 ± 0.199 %
20
+ 9 5.6737 ± 0.1405 -0.00693 ± 0.00174 0.01339 ± 0.00288 3.393 ± 0.316 % 96.448 ± 0.193 %
21
+ 10 5.7712 ± 0.1365 -0.00589 ± 0.00162 0.01246 ± 0.00260 3.254 ± 0.296 % 96.559 ± 0.180 %
22
+ 11 5.8449 ± 0.1319 -0.00548 ± 0.00150 0.01157 ± 0.00236 3.134 ± 0.280 % 96.623 ± 0.170 %
23
+ 12 6.0885 ± 0.1330 -0.00537 ± 0.00139 0.01098 ± 0.00217 3.031 ± 0.265 % 96.611 ± 0.163 %
24
+ 13 6.1823 ± 0.1300 -0.00520 ± 0.00132 0.01042 ± 0.00200 2.962 ± 0.251 % 96.699 ± 0.155 %
25
+ 14 6.2493 ± 0.1266 -0.00482 ± 0.00125 0.00997 ± 0.00186 2.891 ± 0.239 % 96.649 ± 0.150 %
26
+ 15 6.3012 ± 0.1236 -0.00451 ± 0.00121 0.00954 ± 0.00173 2.820 ± 0.229 % 96.631 ± 0.146 %
27
+ 16 6.5894 ± 0.1274 -0.00597 ± 0.00134 0.00989 ± 0.00166 2.783 ± 0.218 % 96.585 ± 0.142 %
28
+ 17 6.6478 ± 0.1242 -0.00563 ± 0.00128 0.00955 ± 0.00156 2.727 ± 0.209 % 96.613 ± 0.137 %
29
+ 18 6.7575 ± 0.1230 -0.00527 ± 0.00123 0.00922 ± 0.00148 2.676 ± 0.201 % 96.600 ± 0.134 %
30
+ 19 6.6994 ± 0.1190 -0.00542 ± 0.00118 0.00904 ± 0.00140 2.638 ± 0.194 % 96.584 ± 0.130 %
31
+ 20 6.5206 ± 0.1124 -0.00566 ± 0.00116 0.00915 ± 0.00134 2.736 ± 0.189 % 96.564 ± 0.127 %
32
+ 21 6.5276 ± 0.1095 -0.00558 ± 0.00111 0.00912 ± 0.00129 2.746 ± 0.184 % 96.597 ± 0.124 %
33
+ 22 6.5501 ± 0.1074 -0.00547 ± 0.00107 0.00888 ± 0.00123 2.706 ± 0.178 % 96.601 ± 0.121 %
34
+ 23 6.5926 ± 0.1057 -0.00561 ± 0.00104 0.00875 ± 0.00118 2.705 ± 0.174 % 96.617 ± 0.118 %
35
+ 24 6.6052 ± 0.1035 -0.00572 ± 0.00100 0.00860 ± 0.00113 2.684 ± 0.168 % 96.636 ± 0.115 %
36
+ 25 6.6526 ± 0.1023 -0.00578 ± 0.00097 0.00846 ± 0.00108 2.662 ± 0.163 % 96.657 ± 0.112 %
37
+ 26 6.6305 ± 0.1000 -0.00553 ± 0.00094 0.00823 ± 0.00104 2.624 ± 0.159 % 96.684 ± 0.110 %
38
+ 27 6.7675 ± 0.1006 -0.00528 ± 0.00091 0.00801 ± 0.00100 2.584 ± 0.156 % 96.716 ± 0.107 %
39
+ 28 6.8491 ± 0.1004 -0.00511 ± 0.00091 0.00823 ± 0.00100 2.557 ± 0.152 % 96.718 ± 0.105 %
40
+ 29 6.8537 ± 0.0986 -0.00505 ± 0.00088 0.00806 ± 0.00096 2.529 ± 0.148 % 96.707 ± 0.104 %
41
+ 30 6.8219 ± 0.0964 -0.00495 ± 0.00086 0.00789 ± 0.00093 2.498 ± 0.145 % 96.722 ± 0.102 %
42
+ 31 6.7475 ± 0.0937 -0.00479 ± 0.00084 0.00775 ± 0.00090 2.472 ± 0.142 % 96.755 ± 0.099 %
43
+ 32 6.6475 ± 0.0908 -0.00475 ± 0.00082 0.00764 ± 0.00087 2.471 ± 0.139 % 96.762 ± 0.098 %
44
+ 33 6.6137 ± 0.0889 -0.00567 ± 0.00083 0.00772 ± 0.00085 2.467 ± 0.135 % 96.750 ± 0.097 %
45
+ 34 6.6095 ± 0.0875 -0.00558 ± 0.00081 0.00759 ± 0.00082 2.445 ± 0.132 % 96.754 ± 0.095 %
46
+ 35 6.6264 ± 0.0865 -0.00516 ± 0.00081 0.00766 ± 0.00082 2.480 ± 0.138 % 96.741 ± 0.094 %
47
+ 36 6.6315 ± 0.0853 -0.00494 ± 0.00079 0.00755 ± 0.00079 2.459 ± 0.135 % 96.752 ± 0.092 %
48
+ 37 6.5180 ± 0.0823 -0.00481 ± 0.00077 0.00742 ± 0.00077 2.439 ± 0.132 % 96.748 ± 0.091 %
49
+ 38 6.4529 ± 0.0802 -0.00499 ± 0.00076 0.00735 ± 0.00075 2.427 ± 0.130 % 96.743 ± 0.090 %
50
+ 39 6.3883 ± 0.0781 -0.00439 ± 0.00080 0.00769 ± 0.00084 2.416 ± 0.127 % 96.744 ± 0.089 %
51
+ 40 6.3014 ± 0.0758 -0.00415 ± 0.00078 0.00767 ± 0.00082 2.412 ± 0.124 % 96.733 ± 0.088 %
52
+
53
+ ====== Perplexity statistics ======
54
+ Mean PPL(Q) : 6.301422 ± 0.075776
55
+ Mean PPL(base) : 6.327630 ± 0.076192
56
+ Cor(ln(PPL(Q)), ln(PPL(base))): 99.79%
57
+ Mean ln(PPL(Q)/PPL(base)) : -0.004150 ± 0.000783
58
+ Mean PPL(Q)/PPL(base) : 0.995858 ± 0.000779
59
+ Mean PPL(Q)-PPL(base) : -0.026208 ± 0.004959
60
+
61
+ ====== KL divergence statistics ======
62
+ Mean KLD: 0.007674 ± 0.000819
63
+ Maximum KLD: 21.973774
64
+ 99.9% KLD: 0.502867
65
+ 99.0% KLD: 0.055398
66
+ 95.0% KLD: 0.015163
67
+ 90.0% KLD: 0.008620
68
+ Median KLD: 0.001653
69
+ 10.0% KLD: 0.000034
70
+ 5.0% KLD: 0.000008
71
+ 1.0% KLD: 0.000001
72
+ 0.1% KLD: -0.000002
73
+ Minimum KLD: -0.000042
74
+
75
+ ====== Token probability statistics ======
76
+ Mean Δp: 0.043 ± 0.012 %
77
+ Maximum Δp: 94.882%
78
+ 99.9% Δp: 17.864%
79
+ 99.0% Δp: 5.560%
80
+ 95.0% Δp: 2.372%
81
+ 90.0% Δp: 1.393%
82
+ 75.0% Δp: 0.304%
83
+ Median Δp: 0.000%
84
+ 25.0% Δp: -0.255%
85
+ 10.0% Δp: -1.293%
86
+ 5.0% Δp: -2.245%
87
+ 1.0% Δp: -5.244%
88
+ 0.1% Δp: -14.511%
89
+ Minimum Δp: -99.366%
90
+ RMS Δp : 2.412 ± 0.124 %
91
+ Same top p: 96.733 ± 0.088 %
92
+
recipe/patches/mtp-prompt-cache-fix.patch ADDED
@@ -0,0 +1,253 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ diff --git a/common/common.cpp b/common/common.cpp
2
+ index 5b92940..1421040 100644
3
+ --- a/common/common.cpp
4
+ +++ b/common/common.cpp
5
+ @@ -2068,6 +2068,7 @@ common_prompt_checkpoint::common_prompt_checkpoint(const common_prompt_checkpoin
6
+ pos_max(other.pos_max),
7
+ data_tgt(other.data_tgt),
8
+ data_dft(other.data_dft),
9
+ + data_spec(other.data_spec),
10
+ storage_tgt(llama_state_seq_storage_clone(other.storage_tgt)),
11
+ storage_dft(llama_state_seq_storage_clone(other.storage_dft)) {
12
+ }
13
+ @@ -2083,6 +2084,7 @@ common_prompt_checkpoint & common_prompt_checkpoint::operator=(const common_prom
14
+
15
+ data_tgt = other.data_tgt;
16
+ data_dft = other.data_dft;
17
+ + data_spec = other.data_spec;
18
+
19
+ llama_state_seq_storage_free(storage_tgt);
20
+ llama_state_seq_storage_free(storage_dft);
21
+ @@ -2098,6 +2100,7 @@ common_prompt_checkpoint::common_prompt_checkpoint(common_prompt_checkpoint && o
22
+ pos_max(other.pos_max),
23
+ data_tgt(std::move(other.data_tgt)),
24
+ data_dft(std::move(other.data_dft)),
25
+ + data_spec(std::move(other.data_spec)),
26
+ storage_tgt(other.storage_tgt),
27
+ storage_dft(other.storage_dft) {
28
+ other.storage_tgt = nullptr;
29
+ @@ -2118,6 +2121,7 @@ common_prompt_checkpoint & common_prompt_checkpoint::operator=(common_prompt_che
30
+
31
+ data_tgt = std::move(other.data_tgt);
32
+ data_dft = std::move(other.data_dft);
33
+ + data_spec = std::move(other.data_spec);
34
+
35
+ storage_tgt = other.storage_tgt;
36
+ storage_dft = other.storage_dft;
37
+ @@ -2131,6 +2135,7 @@ common_prompt_checkpoint & common_prompt_checkpoint::operator=(common_prompt_che
38
+ size_t common_prompt_checkpoint::size() const {
39
+ return data_tgt.size() +
40
+ data_dft.size() +
41
+ + data_spec.size() +
42
+ llama_state_seq_storage_size(storage_tgt) +
43
+ llama_state_seq_storage_size(storage_dft);
44
+ }
45
+ @@ -2147,6 +2152,7 @@ void common_prompt_checkpoint::clear() {
46
+
47
+ data_tgt.clear();
48
+ data_dft.clear();
49
+ + data_spec.clear();
50
+
51
+ llama_state_seq_storage_free(storage_tgt);
52
+ llama_state_seq_storage_free(storage_dft);
53
+ diff --git a/common/common.h b/common/common.h
54
+ index 4084470..b461ea7 100644
55
+ --- a/common/common.h
56
+ +++ b/common/common.h
57
+ @@ -1075,6 +1075,11 @@ struct common_prompt_checkpoint {
58
+ std::vector<uint8_t> data_tgt;
59
+ std::vector<uint8_t> data_dft;
60
+
61
+ + // speculative-impl boundary state (e.g. the MTP pending hidden rows)
62
+ + // captured at the same position as the KV data above, so a restore
63
+ + // reinstates an exact (KV, boundary) pair
64
+ + std::vector<uint8_t> data_spec;
65
+ +
66
+ llama_state_seq_storage * storage_tgt = nullptr;
67
+ llama_state_seq_storage * storage_dft = nullptr;
68
+
69
+ diff --git a/tools/server/server-context.cpp b/tools/server/server-context.cpp
70
+ index 80ee81e..02bbb97 100644
71
+ --- a/tools/server/server-context.cpp
72
+ +++ b/tools/server/server-context.cpp
73
+ @@ -2029,6 +2029,15 @@ private:
74
+ cur.update_tgt(ctx_tgt, slot.id, LLAMA_STATE_SEQ_FLAGS_PARTIAL_ONLY | LLAMA_STATE_SEQ_FLAGS_ON_DEVICE);
75
+ cur.update_dft(ctx_dft.get(), slot.id, LLAMA_STATE_SEQ_FLAGS_PARTIAL_ONLY | LLAMA_STATE_SEQ_FLAGS_ON_DEVICE);
76
+
77
+ + // capture the speculative-impl boundary state (MTP pending hidden rows)
78
+ + // at the same position as the KV payload, so both are restored as an
79
+ + // exact pair. get_state() fails (returns false with empty data) when
80
+ + // no valid boundary exists yet - then there is nothing to pair.
81
+ + if (common_speculative_state_required(spec.get())) {
82
+ + cur.data_spec.clear();
83
+ + common_speculative_get_state(spec.get(), slot.id, cur.data_spec);
84
+ + }
85
+ +
86
+ SLT_INF(slot,
87
+ "created context checkpoint %d of %d (pos_min = %d, pos_max = %d, n_tokens = %" PRId64 ", size = %.3f MiB)\n",
88
+ (int) slot.prompt.checkpoints.size(), params_base.n_ctx_checkpoints, cur.pos_min,
89
+ @@ -2788,18 +2797,47 @@ private:
90
+ n_past = 0;
91
+ }
92
+
93
+ - // MTP carries only the endpoint and immediately preceding target hidden
94
+ - // boundaries. Arbitrary partial-prefix rollback cannot be reconstructed
95
+ - // from target/draft KV state, so reprocess cold instead of pairing a token
96
+ - // with the wrong hidden row. Full-prefix extension and the exact-hit
97
+ - // one-token replay below remain supported.
98
+ + // Stateful speculative decoding (e.g. the MTP pending hidden rows) pairs
99
+ + // each token with the boundary at its exact position. An arbitrary partial
100
+ + // prefix rollback cannot reconstruct that boundary, so the state must be
101
+ + // restored, not rebuilt: find the newest checkpoint that ends at or before
102
+ + // the last common position and restore its exact (KV, boundary) pair.
103
+ if (common_speculative_state_required(spec.get()) &&
104
+ n_past > 0 && n_past < slot.prompt.n_tokens()) {
105
+ - SLT_INF(slot,
106
+ - "prompt cache cold fallback: reason=spec-boundary-mismatch lcp=%d cached_tokens=%d request_tokens=%d\n",
107
+ - n_past, slot.prompt.n_tokens(), slot.task->n_tokens());
108
+ - n_past = 0;
109
+ - common_speculative_set_state(spec.get(), slot.id, {});
110
+ + const llama_pos pos_rollback = slot.prompt.tokens.pos_next(n_past) - 1;
111
+ +
112
+ + const auto it_spec = std::find_if(
113
+ + slot.prompt.checkpoints.rbegin(), slot.prompt.checkpoints.rend(),
114
+ + [pos_rollback](const common_prompt_checkpoint & cur) {
115
+ + return cur.pos_max <= pos_rollback && !cur.data_spec.empty();
116
+ + });
117
+ +
118
+ + if (it_spec != slot.prompt.checkpoints.rend()) {
119
+ + // restore the checkpoint's exact state (target KV, draft KV and
120
+ + // the speculative boundary) instead of re-seeding it
121
+ + const bool restored_tgt = it_spec->load_tgt(ctx_tgt, slot.id, LLAMA_STATE_SEQ_FLAGS_PARTIAL_ONLY | LLAMA_STATE_SEQ_FLAGS_ON_DEVICE);
122
+ + const bool restored_dft = it_spec->load_dft(ctx_dft.get(), slot.id, LLAMA_STATE_SEQ_FLAGS_PARTIAL_ONLY | LLAMA_STATE_SEQ_FLAGS_ON_DEVICE);
123
+ + const bool restored_spec = common_speculative_set_state(spec.get(), slot.id, it_spec->data_spec);
124
+ +
125
+ + if (restored_tgt && restored_dft && restored_spec) {
126
+ + n_past = std::min(slot.prompt.tokens.size_up_to_pos(it_spec->pos_max + 1), (size_t) it_spec->n_tokens);
127
+ + SLT_WRN(slot,
128
+ + "restored spec-stateful context checkpoint (pos_min = %d, pos_max = %d, n_tokens = %" PRId64 ", n_past = %d, size = %.3f MiB)\n",
129
+ + it_spec->pos_min, it_spec->pos_max, it_spec->n_tokens, n_past, (float) it_spec->size() / 1024 / 1024);
130
+ + } else {
131
+ + SLT_WRN(slot,
132
+ + "failed to restore spec-stateful context checkpoint (target=%d, draft=%d, spec=%d, pos_min = %d, pos_max = %d); reprocessing cold\n",
133
+ + (int) restored_tgt, (int) restored_dft, (int) restored_spec, it_spec->pos_min, it_spec->pos_max);
134
+ + n_past = 0;
135
+ + common_speculative_set_state(spec.get(), slot.id, {});
136
+ + }
137
+ + } else {
138
+ + SLT_INF(slot,
139
+ + "prompt cache cold fallback: reason=spec-checkpoint-missing lcp=%d cached_tokens=%d request_tokens=%d\n",
140
+ + n_past, slot.prompt.n_tokens(), slot.task->n_tokens());
141
+ + n_past = 0;
142
+ + common_speculative_set_state(spec.get(), slot.id, {});
143
+ + }
144
+ }
145
+
146
+ llama_pos pos_next = slot.prompt.tokens.pos_next(n_past);
147
+ @@ -2875,6 +2913,12 @@ private:
148
+ if (cur.pos_max > pos_next) {
149
+ return false;
150
+ }
151
+ + // a spec-stateful checkpoint must also be able to restore
152
+ + // its boundary pair, otherwise the reprocessed tokens
153
+ + // would pair with a stale MTP boundary
154
+ + if (common_speculative_state_required(spec.get()) && cur.data_spec.empty()) {
155
+ + return false;
156
+ + }
157
+ return cur.pos_min < pos_min_thold || cur.pos_min == 0;
158
+ }
159
+ );
160
+ @@ -2886,11 +2930,13 @@ private:
161
+
162
+ const bool restored_tgt = it->load_tgt(ctx_tgt, slot.id, LLAMA_STATE_SEQ_FLAGS_PARTIAL_ONLY | LLAMA_STATE_SEQ_FLAGS_ON_DEVICE);
163
+ const bool restored_dft = it->load_dft(ctx_dft.get(), slot.id, LLAMA_STATE_SEQ_FLAGS_PARTIAL_ONLY | LLAMA_STATE_SEQ_FLAGS_ON_DEVICE);
164
+ + const bool restored_spec = !common_speculative_state_required(spec.get()) ||
165
+ + common_speculative_set_state(spec.get(), slot.id, it->data_spec);
166
+
167
+ - if (!restored_tgt || !restored_dft) {
168
+ + if (!restored_tgt || !restored_dft || !restored_spec) {
169
+ SLT_WRN(slot,
170
+ - "failed to restore context checkpoint (target=%d, draft=%d, pos_min = %d, pos_max = %d, n_tokens = %" PRId64 ", size = %.3f MiB); forcing full prompt re-processing\n",
171
+ - (int) restored_tgt, (int) restored_dft,
172
+ + "failed to restore context checkpoint (target=%d, draft=%d, spec=%d, pos_min = %d, pos_max = %d, n_tokens = %" PRId64 ", size = %.3f MiB); forcing full prompt re-processing\n",
173
+ + (int) restored_tgt, (int) restored_dft, (int) restored_spec,
174
+ it->pos_min, it->pos_max, it->n_tokens,
175
+ (float) it->size() / 1024 / 1024);
176
+ do_reset = true;
177
+ diff --git a/tools/server/server-task.cpp b/tools/server/server-task.cpp
178
+ index 6e0bb85..b018f64 100644
179
+ --- a/tools/server/server-task.cpp
180
+ +++ b/tools/server/server-task.cpp
181
+ @@ -3004,8 +3004,14 @@ bool server_prompt_cache::load(
182
+
183
+ const int lcp_best = prompt.tokens.get_common_prefix(tokens_new);
184
+
185
+ + // With a stateful speculative implementation the slot's own cached prompt
186
+ + // may be longer than the common prefix. That entry keeps its full KV but
187
+ + // its exact-boundary spec state applies only at its endpoint; a partial
188
+ + // prefix is still a valid cache hit because the prompt-processing path can
189
+ + // restore a spec-stateful checkpoint instead of rebuilding the boundary.
190
+ const bool base_boundary_valid = !spec_state_required ||
191
+ - lcp_best == (int) prompt.tokens.size();
192
+ + lcp_best == (int) prompt.tokens.size() ||
193
+ + !prompt.checkpoints.empty();
194
+ float f_keep_best = base_boundary_valid && prompt.tokens.size() > 0 ? float(lcp_best) / prompt.tokens.size() : -1.0f; // empty slot: any cache entry wins
195
+ float sim_best = base_boundary_valid ? float(lcp_best) / std::max<size_t>(1, tokens_new.size()) : -1.0f;
196
+
197
+ @@ -3019,7 +3025,11 @@ bool server_prompt_cache::load(
198
+ auto it_best_ram = states.end();
199
+ auto it_best_disk = disk_states.end();
200
+ size_t lcp_selected = 0;
201
+ - size_t spec_boundary_best = base_boundary_valid ? prompt.tokens.size() : 0;
202
+ + // the base entry's usable boundary is its endpoint on an exact hit, or the
203
+ + // common prefix (reachable via checkpoint restore) on a partial hit
204
+ + size_t spec_boundary_best = base_boundary_valid
205
+ + ? (lcp_best == (int) prompt.tokens.size() ? prompt.tokens.size() : (size_t) std::max(0, lcp_best))
206
+ + : 0;
207
+ bool ram_loaded = false;
208
+
209
+ // Find the most similar RAM prompt first. On an equal match, the hot RAM
210
+ @@ -3027,8 +3037,13 @@ bool server_prompt_cache::load(
211
+ for (auto it = states.begin(); it != states.end(); ++it) {
212
+ const int lcp_cur = it->tokens.get_common_prefix(tokens_new);
213
+
214
+ - if (spec_state_required &&
215
+ - lcp_cur != (int) it->tokens.size()) {
216
+ + // exact boundary -> the entry's own spec state is usable as-is;
217
+ + // partial prefix -> still usable, but only via checkpoint restore
218
+ + // (see server-context.cpp), so require checkpoints to exist
219
+ + const bool boundary_ok = !spec_state_required ||
220
+ + lcp_cur == (int) it->tokens.size() ||
221
+ + !it->checkpoints.empty();
222
+ + if (!boundary_ok) {
223
+ SRV_INF("prompt cache skip: reason=spec-boundary-mismatch source=ram lcp=%d cached_tokens=%zu request_tokens=%zu spec_bytes=%zu\n",
224
+ lcp_cur, it->tokens.size(), tokens_new.size(), it->data.spec.size());
225
+ continue;
226
+ @@ -3048,12 +3063,14 @@ bool server_prompt_cache::load(
227
+ }
228
+
229
+ const bool is_better = spec_state_required
230
+ - ? it->tokens.size() > spec_boundary_best
231
+ + ? (lcp_cur == (int) it->tokens.size()
232
+ + ? it->tokens.size() > spec_boundary_best
233
+ + : lcp_cur > (int) spec_boundary_best)
234
+ : f_keep_best < f_keep_cur && sim_best < sim_cur;
235
+ if (is_better) {
236
+ f_keep_best = f_keep_cur;
237
+ sim_best = sim_cur;
238
+ - spec_boundary_best = it->tokens.size();
239
+ + spec_boundary_best = std::max(spec_boundary_best, (size_t) std::max(0, lcp_cur));
240
+
241
+ it_best_ram = it;
242
+ it_best_disk = disk_states.end();
243
+ @@ -3158,6 +3175,10 @@ bool server_prompt_cache::load(
244
+ ram_loaded = true;
245
+ }
246
+
247
+ + // note: a partial-prefix base entry with checkpoints was made valid above;
248
+ + // the prompt-processing path in server-context.cpp then either restores a
249
+ + // spec-stateful checkpoint at/below the common prefix or falls back to a
250
+ + // cold reprocess, so correctness never depends on the relaxed acceptance.
251
+ return base_boundary_valid || ram_loaded;
252
+ }
253
+
recipe/pipeline/aggregate_v2.py ADDED
@@ -0,0 +1,230 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env python3
2
+ """Collect every measured number for the in-file-MTP Agnes cards into results/summary_v2.json.
3
+ Nothing is typed by hand: each value is parsed from a log, a results file, or the GGUF itself; missing => None.
4
+ Quality (KLD/PPL) comes from regrade.sh: the SHIPPED files graded against BF16 logits recomputed in the same session
5
+ (R2/R3), and only if the repeat run (R4) reproduced every per-chunk row. The afternoon grades (pre-reboot) did not
6
+ reproduce for the 4-bit tiers and are kept only as history."""
7
+ import hashlib, json, os, re, sys
8
+ sys.path.insert(0, "/opt/llama-rocm/rocmfpx-724/gguf-py")
9
+ import gguf # noqa: E402
10
+
11
+ W = "/mnt/models/agnes-3.0-flash"; N = "Agnes-3.0-Flash-Preview"
12
+ OB = "/opt/llama-rocm/rocmfpx-724/build-hipvk/bin"
13
+ FAST = os.environ.get("AGG_FAST") == "1" # dry run: never hash multi-GiB files that were not staged
14
+ OUT = os.environ.get("AGG_OUT", "/mnt/models/agnes-3.0-flash/results/summary_v2.json")
15
+ PB = "/opt/llama-rocm/rocmfpx-724-mtpcache/build-hipvk/bin"
16
+
17
+
18
+ def rd(p):
19
+ try: return open(p, errors="replace").read()
20
+ except FileNotFoundError: return ""
21
+
22
+
23
+ def f(rx, s, g=1, cast=float):
24
+ m = re.search(rx, s)
25
+ return cast(m.group(g)) if m else None
26
+
27
+
28
+ def jl(p):
29
+ return [json.loads(l) for l in rd(p).splitlines() if l.strip()]
30
+
31
+
32
+ def pubname(fn):
33
+ """Published filename: the quant token must be hyphen-delimited or the Hub cannot parse the variant
34
+ (`Q4_0_ROCMFP4_STRIX_LEAN` reads as the garbage label `Q4_0_ROCMFP`)."""
35
+ for a, b in (("Q4_0_ROCMFP4_", "Q4_0-ROCmFP4-"), ("Q8_0_ROCMFPX_AGENT", "Q8_0-ROCmFPX-AGENT"), ("Q8_0_ROCMFPX", "Q8_0-ROCmFPX")):
36
+ if a in fn:
37
+ return fn.replace(a, b)
38
+ return fn
39
+
40
+
41
+ STAGED = {} # sha256 already computed at staging time (hf_publish_v2.py stage) - avoids re-reading 145 GiB
42
+ for _k in ("std", "imat"):
43
+ for _l in rd(f"{W}/hf-upload-v2/{_k}/SHA256SUMS").splitlines():
44
+ _h, _n = _l.split(maxsplit=1); STAGED[_n.strip()] = _h
45
+
46
+
47
+ def sha_file(p):
48
+ if not os.path.exists(p): return None
49
+ if pubname(os.path.basename(p)) in STAGED: return STAGED[pubname(os.path.basename(p))]
50
+ if FAST and os.path.getsize(p) > 1 << 30: return None
51
+ h = hashlib.sha256()
52
+ with open(p, "rb") as fh:
53
+ for c in iter(lambda: fh.read(64 << 20), b""): h.update(c)
54
+ return h.hexdigest()
55
+
56
+
57
+ def tensors(p):
58
+ out = {}
59
+ for t in gguf.GGUFReader(p).tensors:
60
+ try: tn = t.tensor_type.name
61
+ except Exception: tn = f"TYPE_{int(t.tensor_type)}"
62
+ out[t.name] = (tn, int(t.n_bytes))
63
+ return out
64
+
65
+
66
+ S = {"layout": "in-file MTP (one GGUF per tier; the MTP block shares the trunk's embedding and output matrices)",
67
+ "model": N, "model_repo_std": f"kingjones777/{N}-MTP-ROCmFP4-GGUF",
68
+ "model_repo_imat": f"kingjones777/{N}-MTP-ROCmFP4-imatrix-GGUF",
69
+ "source": {"repo": "Agnes-AI/Agnes-3.0-Flash", "revision": "891ce4f9ffb89b22888aa7fcc2bb2f3618867684"}}
70
+
71
+ # ---------- BF16 reference (re-run in the grading session) ----------
72
+ REG = {d.get("step"): d for d in jl(f"{W}/results/regrade.jsonl")}
73
+ MEASURED = REG.get("R4", {}).get("result") == "MATCH"
74
+ b1 = rd(f"{W}/logs/R2_ppl_bf16.log"); k106 = rd(f"{W}/logs/R3_kld_q106.log")
75
+ b1_old = rd(f"{W}/logs/B1_ppl_bf16.log"); k106_old = rd(f"{W}/logs/B5_kld_q106.log")
76
+ chunks = f(r"calculating perplexity over (\d+) chunks", b1, cast=int); nctx = f(r"n_ctx=(\d+)", b1, cast=int)
77
+ S["bf16"] = {"ppl": f(r"Final estimate: PPL = ([\d.]+)", b1), "ppl_err": f(r"Final estimate: PPL = [\d.]+ \+/- ([\d.]+)", b1),
78
+ "ppl_paired": f(r"Mean PPL\(base\)\s*:\s*([\d.]+)", k106),
79
+ "ppl_paired_err": f(r"Mean PPL\(base\)\s*:\s*[\d.]+\s*±\s*([\d.]+)", k106),
80
+ "afternoon_ppl": f(r"Final estimate: PPL = ([\d.]+)", b1_old),
81
+ "afternoon_ppl_paired": f(r"Mean PPL\(base\)\s*:\s*([\d.]+)", k106_old),
82
+ "chunks": chunks, "n_ctx": nctx, "scored_tokens": chunks * (nctx // 2 - 1) if chunks and nctx else None,
83
+ "trunk_size_bytes": os.path.getsize(f"{W}/gguf/{N}-BF16.gguf") if os.path.exists(f"{W}/gguf/{N}-BF16.gguf") else None,
84
+ "with_mtp_size_bytes": os.path.getsize(f"{W}/gguf/{N}-MTP-BF16.gguf") if os.path.exists(f"{W}/gguf/{N}-MTP-BF16.gguf") else None}
85
+
86
+ # ---------- binaries ----------
87
+ pl = rd(f"{W}/logs/mtpcache_build.log")
88
+ S["binary"] = {
89
+ "repo": "https://github.com/charlie12345/ROCmFPX", "commit": "d3ca53726109b46fd5cd6fa42f688c707079b44e",
90
+ "commit_in_official_main": "yes (ROCmFPX/ROCmFPX main is ahead of it, 0 behind; checked via the GitHub compare API 2026-09-16)",
91
+ "original": {"dir": OB, "sha256": {x: sha_file(f"{OB}/{x}") for x in
92
+ ("llama-server", "llama-quantize", "llama-imatrix", "llama-perplexity")}},
93
+ "patched": {"dir": PB, "sha256": {"llama-server": sha_file(f"{PB}/llama-server")},
94
+ "patch_file": "recipe/patches/mtp-prompt-cache-fix.patch",
95
+ "patch_sha256": (rd(f"{W}/logs/P1_patch.sha256").split() or [None])[0],
96
+ "patch_source": "kingjones777/Qwen3.8-27B-ROCmFP4-STRIX-MTP-GGUF (patches/mtp-prompt-cache-fix.patch)",
97
+ "applied": "cleanly (git apply --check)" if "applied CLEANLY" in pl else None,
98
+ "diffstat": [l.strip() for l in pl.splitlines() if "|" in l and ("+" in l or "-" in l)][:8],
99
+ "built_target": "llama-server only (same CMake cache as the original build)"}}
100
+
101
+ vp = f"{W}/calib/vision_probe.png"
102
+ if os.path.exists(vp):
103
+ raw = open(vp, "rb").read()
104
+ S["vision_probe"] = {"width": int.from_bytes(raw[16:20], "big"), "height": int.from_bytes(raw[20:24], "big"),
105
+ "bytes": len(raw), "sha256": hashlib.sha256(raw).hexdigest()}
106
+ imat = rd(f"{W}/logs/B2_imatrix.log")
107
+ S["imatrix"] = {"chunks": f(r"computing over (\d+) chunks", imat, cast=int), "n_ctx": f(r"n_ctx=(\d+)", imat, cast=int),
108
+ "calibration": "bartowski calibration_datav3.txt", "file": f"{N}.imatrix",
109
+ "sha256": (rd(f"{W}/imat/{N}.imatrix.sha256").split() or [None])[0],
110
+ "size_bytes": os.path.getsize(f"{W}/imat/{N}.imatrix") if os.path.exists(f"{W}/imat/{N}.imatrix") else None}
111
+
112
+ # ---------- tiers ----------
113
+ TIERS = { # tag: (new dir, new file, quant log, graded dir, graded file, ftype)
114
+ "q106": ("out-mtp", f"{N}-MTP-Q4_0_ROCMFP4_STRIX_LEAN.gguf", "S2_q106", "out", f"{N}-Q4_0_ROCMFP4_STRIX_LEAN.gguf", 106),
115
+ "q102": ("out-mtp", f"{N}-MTP-Q4_0_ROCMFP4_COHERENT.gguf", "S2_q102", "out", f"{N}-Q4_0_ROCMFP4_COHERENT.gguf", 102),
116
+ "q115": ("out-mtp", f"{N}-MTP-Q8_0_ROCMFPX_AGENT.gguf", "S2_q115", "out", f"{N}-Q8_0_ROCMFPX_AGENT.gguf", 115),
117
+ "q111": ("out-mtp", f"{N}-MTP-Q8_0_ROCMFPX.gguf", "S2_q111", "out", f"{N}-Q8_0_ROCMFPX.gguf", 111),
118
+ "q106i": ("out-mtp-imat", f"{N}-MTP-imatrix-Q4_0_ROCMFP4_STRIX_LEAN.gguf", "S3_q106i", "out-imat",
119
+ f"{N}-imatrix-Q4_0_ROCMFP4_STRIX_LEAN.gguf", 106),
120
+ "q102i": ("out-mtp-imat", f"{N}-MTP-imatrix-Q4_0_ROCMFP4_COHERENT.gguf", "S3_q102i", "out-imat",
121
+ f"{N}-imatrix-Q4_0_ROCMFP4_COHERENT.gguf", 102)}
122
+ rb = rd(f"{W}/logs/S_readback.log"); ident = rd(f"{W}/logs/S_identity.log")
123
+ receipt = {r["tag"]: r for r in jl(f"{W}/results/trunk_receipt.jsonl")}
124
+
125
+
126
+ def kld_stats(k):
127
+ return {"ppl": f(r"Mean PPL\(Q\)\s*:\s*([\d.]+)", k), "ppl_err": f(r"Mean PPL\(Q\)\s*:\s*[\d.]+\s*±\s*([\d.]+)", k),
128
+ "ppl_ratio": f(r"Mean PPL\(Q\)/PPL\(base\)\s*:\s*([\d.]+)", k),
129
+ "kld_mean": f(r"Mean\s+KLD:\s*([\d.]+)", k), "kld_err": f(r"Mean\s+KLD:\s*[\d.]+\s*±\s*([\d.]+)", k),
130
+ "kld_p99": f(r"99\.0%\s+KLD:\s*([\d.]+)", k), "kld_median": f(r"Median\s+KLD:\s*([\d.]+)", k),
131
+ "same_top_p": f(r"Same top p:\s*([\d.]+)", k), "rms_dp": f(r"RMS Δp\s*:\s*([\d.]+)", k)}
132
+ S["tiers"] = {}
133
+ TEN = {}
134
+ for tag, (d, fn, qlog, gd, gfn, ft) in TIERS.items():
135
+ p, gp = f"{W}/{d}/{fn}", f"{W}/{gd}/{gfn}"
136
+ q = rd(f"{W}/logs/{qlog}.log"); k = rd(f"{W}/logs/R3_kld_{tag}.log")
137
+ line = next((l for l in rb.splitlines() if f" {fn} " in l), "")
138
+ iline = next((l for l in ident.splitlines() if l.startswith(fn + " ")), "")
139
+ idj = json.loads(iline[len(fn) + 1:]) if iline else {}
140
+ ten = tensors(p) if os.path.exists(p) else {}
141
+ TEN[tag] = ten
142
+ mtp = {n: v for n, v in ten.items() if n.startswith("blk.72.")}
143
+ measured = bool(MEASURED and f(r"Mean\s+KLD:\s*([\d.]+)", k) is not None)
144
+ t = {"file": pubname(fn), "local_file": fn, "dir": d, "ftype": ft, "size_bytes": os.path.getsize(p) if os.path.exists(p) else None,
145
+ "graded_file": gfn, "graded_size_bytes": os.path.getsize(gp) if os.path.exists(gp) else None,
146
+ "quant_mib": f(r"quant size\s*=\s*([\d.]+) MiB", q), "bpw": f(r"quant size\s*=\s*[\d.]+ MiB \(([\d.]+) BPW\)", q),
147
+ "quant_seconds": (f(r"quantize time\s*=\s*([\d.]+) ms", q) or 0) / 1000 or None,
148
+ "imatrix_entries": f(r"loaded (\d+) importance matrix entries", q, cast=int),
149
+ "readback": line.split()[0] if line else None,
150
+ "tensors": f(r"tensors=(\d+)", line, cast=int), "nextn_tensors": f(r"nextn=(\d+)", line, cast=int),
151
+ "output_weight": f(r"output\.weight=(\S+)", line, cast=str), "token_embd": f(r"token_embd\.weight=(\S+)", line, cast=str),
152
+ "trunk_identity": {k2: idj.get(k2) for k2 in ("result", "shared", "n_type_changed", "n_bytes_changed", "only_in_old")},
153
+ "receipt_vs_afternoon": receipt.get(tag, {}).get("result"),
154
+ "quality_measured": measured,
155
+ "afternoon": kld_stats(rd(f"{W}/logs/B5_kld_{tag}.log")),
156
+ "mtp_block": {"tensors": len(mtp), "bytes": sum(v[1] for v in mtp.values()),
157
+ "types": {n[7:]: v[0] for n, v in sorted(mtp.items()) if not v[0].startswith("F32")}}}
158
+ t.update(kld_stats(k) if measured else {x: None for x in kld_stats("")})
159
+ S["tiers"][tag] = t
160
+ for a_, b_ in (("q106", "q106i"), ("q102", "q102i")):
161
+ pa = f"{W}/{TIERS[a_][0]}/{TIERS[a_][1]}"; pb = f"{W}/{TIERS[b_][0]}/{TIERS[b_][1]}"
162
+ if TEN.get(a_) and TEN.get(b_): # same names, types and per-tensor byte sizes => same per-token work
163
+ S["tiers"][b_]["same_tensor_types_as_standard"] = TEN[a_] == TEN[b_]
164
+ S["tiers"][b_]["file_size_delta_bytes"] = S["tiers"][b_]["size_bytes"] - S["tiers"][a_]["size_bytes"]
165
+ ha, hb = (sha_file(pa), sha_file(pb)) if os.path.exists(pa) and os.path.exists(pb) else (None, None)
166
+ S["tiers"][b_]["differs_from_standard"] = (ha != hb) if ha and hb else None
167
+
168
+ # the separate head this layout replaces (not shipped any more)
169
+ S["separate_head_replaced"] = {}
170
+ for fn in (f"mtp-{N}-Q4_0.gguf", f"mtp-{N}-Q8_0.gguf"):
171
+ p = f"{W}/out/{fn}"
172
+ if os.path.exists(p):
173
+ ten = tensors(p)
174
+ S["separate_head_replaced"][fn] = {
175
+ "size_bytes": os.path.getsize(p), "tensors": len(ten), "tensor_bytes": sum(v[1] for v in ten.values()),
176
+ "vocab_matrices_bytes": sum(v[1] for n, v in ten.items() if n in ("output.weight", "token_embd.weight")),
177
+ "vocab_matrix_types": {n: v[0] for n, v in ten.items() if n in ("output.weight", "token_embd.weight")}}
178
+ S["aux"] = {f"mmproj-{N}-BF16.gguf": os.path.getsize(f"{W}/out/mmproj-{N}-BF16.gguf")
179
+ if os.path.exists(f"{W}/out/mmproj-{N}-BF16.gguf") else None}
180
+
181
+ # ---------- measurements ----------
182
+ S["bench"], S["gates"] = [], []
183
+ for d in jl(f"{W}/results/mtpfix.jsonl"):
184
+ if "tg_median" in d: S["bench"].append({k: v for k, v in d.items() if k != "runs"})
185
+ else:
186
+ S["gates"].append({k: v for k, v in d.items() if k != "text"} if d.get("label", "").startswith("id-") else d)
187
+ PE = re.compile(r"prompt eval time =\s*([\d.]+) ms /\s*(\d+) tokens")
188
+ for g_ in S["gates"]:
189
+ if not g_.get("label", "").startswith(("c2-", "c3-")) or not g_.get("rows"): continue
190
+ ev = [(float(a), int(b)) for a, b in PE.findall(rd(f"{W}/logs/v_{g_['label']}.log"))]
191
+ per = 3 # warm-up A, B warm, B cold - one server log line each, in order
192
+ for i, r_ in enumerate(g_["rows"]):
193
+ blk = ev[per * i: per * i + per]
194
+ if len(blk) == per and blk[1][1] == r_["warm_prompt_n"] and blk[2][1] == r_["cold_prompt_n"]:
195
+ r_["warm_prompt_ms"], r_["cold_prompt_ms"] = blk[1][0], blk[2][0]
196
+ else:
197
+ r_["warm_prompt_ms"] = r_["cold_prompt_ms"] = None
198
+ sw = [b for b in S["bench"] if b["label"] in ("p-infile-rocm-n3", "p-infile-rocm-n4", "p-infile-rocm-n5")]
199
+ S["knee"] = max(sw, key=lambda b: b["tg_median"])["nmax"] if len(sw) == 3 else None
200
+ S["tier_bench_nmax"] = 4 # vplan_b.py runs every tier at --spec-draft-n-max 4
201
+ S["history_separate_head"] = {
202
+ "note": "Measured 2026-09-16 with the separate 18-tensor head file (not shipped any more); same trunk bytes.",
203
+ "bench": [{k: v for k, v in d.items() if k != "runs"} for d in jl(f"{W}/results/phase_b.jsonl") if "tg_median" in d],
204
+ "gates": [d for d in jl(f"{W}/results/phase_b.jsonl") if "tg_median" not in d],
205
+ "knee": (json.loads(rd(f"{W}/results/knee.json")) if rd(f"{W}/results/knee.json") else {}).get("knee"),
206
+ "seat_sizing": jl(f"{W}/results/seat_sizing.jsonl")}
207
+ S["seat_sizing2"] = jl(f"{W}/results/seat_sizing2.jsonl")
208
+ S["trunk_receipt"] = list(receipt.values())
209
+ S["regrade"] = {"R1_cpu_burn": REG.get("R1"), "R2_base_logits": REG.get("R2"), "R4_repeat": REG.get("R4"),
210
+ "kld_control": jl(f"{W}/results/kld_control.jsonl"),
211
+ "R1_pass_seconds": {k: f(r"([\d.]+) seconds per pass", rd(f"{W}/logs/{v}"))
212
+ for k, v in (("cpu_burn", "R1_kld4_old_q106_cpuburn.log"),
213
+ ("quiet_today", "K_c1-old-q106.log"),
214
+ ("afternoon", "B5_kld_q106.log"))},
215
+ "R1_burn_started": "quantizing" in rd(f"{W}/logs/R1_burn.log"),
216
+ "note": ("R1: 4-bit rows under a concurrent 16-thread CPU burn vs today's quiet run and the afternoon run. "
217
+ "The burn_seen field in regrade.jsonl is a grep bug (searched 'quantize', the log says "
218
+ "'quantizing'); R1_burn_started and R1_pass_seconds are the evidence that the load was real.")}
219
+ S["fold"] = json.loads(rd(f"{W}/qwen35/FOLD_PROVENANCE.json") or "{}")
220
+ vf = rd(f"{W}/logs/A3_verify_fold.log")
221
+ S["fold_verify"] = {"result": f(r"RESULT: (\w+)", vf, cast=str),
222
+ "g3": re.findall(r"G3 (layer\s+\d+|mtp)\s*: max rel err ([\d.e+-]+)", vf)}
223
+ json.dump(S, open(OUT, "w"), indent=2)
224
+
225
+ print("knee(in-file)=", S["knee"], "| bench rows", len(S["bench"]), "| gate rows", len(S["gates"]),
226
+ "| sizing2 rows", len(S["seat_sizing2"]), "| receipts", len(S["trunk_receipt"]))
227
+ for tg_, v in S["tiers"].items():
228
+ print(tg_, {k: v[k] for k in ("size_bytes", "bpw", "readback", "tensors", "nextn_tensors", "receipt_vs_afternoon",
229
+ "quality_measured", "kld_mean")}, "mtp_block", v["mtp_block"]["bytes"])
230
+ print("binary", json.dumps(S["binary"], indent=1))
recipe/pipeline/agnes_harness.py ADDED
@@ -0,0 +1,321 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env python3
2
+ """Phase B harness for Agnes-3.0-Flash Preview on MAX-1 (stdlib only).
3
+ House protocol (Qwen3.8-27B card): ctx 65536, batch 1, greedy (temp 0, top_k 1), ignore_eos -> exactly
4
+ 256 tokens, unique nonce + cache_prompt:false (cached tokens asserted 0), median of reps after 1 warm-up.
5
+ Subcommands: bench | cachegate | tools | vision (see argparse)"""
6
+ import argparse, base64, json, os, signal, statistics, subprocess, sys, time, urllib.request, uuid
7
+
8
+ W = "/mnt/models/agnes-3.0-flash"
9
+ BIN = os.environ.get("AGNES_BIN", "/opt/llama-rocm/rocmfpx-724/build-hipvk/bin")
10
+ ENV = dict(os.environ, LD_LIBRARY_PATH=f"{BIN}:/opt/rocm-7.2.4/lib", HSA_OVERRIDE_GFX_VERSION="11.5.1",
11
+ GGML_HIP_ENABLE_UNIFIED_MEMORY="1")
12
+
13
+ def post(port, path, body, timeout=1800):
14
+ req = urllib.request.Request(f"http://127.0.0.1:{port}{path}", data=json.dumps(body).encode(),
15
+ headers={"Content-Type": "application/json"})
16
+ return json.load(urllib.request.urlopen(req, timeout=timeout))
17
+
18
+ class Server:
19
+ def __init__(self, a, port, mmproj=None, fa="on"):
20
+ self.port = port
21
+ cmd = [f"{BIN}/llama-server", "-m", a.model, "-dev", a.dev, "-ngl", "999", "-fa", fa, "-dio",
22
+ "--jinja", "-fit", "off", "--parallel", "1", "-c", str(a.ctx), "-b", "2048", "-ub", "1024",
23
+ "--host", "127.0.0.1", "--port", str(port), "--no-webui"]
24
+ if a.draft or a.mtp_infile:
25
+ cmd += ["--spec-type", "draft-mtp"]
26
+ if a.draft:
27
+ cmd += ["--model-draft", a.draft, "--spec-draft-ngl", "99", "--spec-draft-device", a.dev]
28
+ cmd += ["--spec-draft-n-max", str(a.nmax), "--spec-draft-n-min", "0", "--spec-draft-p-min", str(a.pmin)]
29
+ if a.strict:
30
+ cmd += ["--spec-mtp-strict-qwen"]
31
+ if mmproj:
32
+ cmd += ["--mmproj", mmproj]
33
+ self.cmd = cmd
34
+ self.logf = open(a.serverlog, "w")
35
+ self.t0 = time.time()
36
+ self.p = subprocess.Popen(cmd, env=ENV, stdout=self.logf, stderr=subprocess.STDOUT, start_new_session=True)
37
+ while True:
38
+ if self.p.poll() is not None:
39
+ raise SystemExit(f"SERVER DIED rc={self.p.returncode} see {a.serverlog}")
40
+ try:
41
+ if json.load(urllib.request.urlopen(f"http://127.0.0.1:{port}/health", timeout=3)).get("status") == "ok":
42
+ break
43
+ except Exception:
44
+ pass
45
+ if time.time() - self.t0 > 900:
46
+ self.stop(); raise SystemExit("SERVER LOAD TIMEOUT")
47
+ time.sleep(2)
48
+ self.load_s = time.time() - self.t0
49
+ def stop(self):
50
+ try: os.killpg(self.p.pid, signal.SIGTERM); self.p.wait(60)
51
+ except Exception:
52
+ try: os.killpg(self.p.pid, signal.SIGKILL)
53
+ except Exception: pass
54
+ self.logf.close()
55
+
56
+ def prompt_8k(kind):
57
+ if kind == "code":
58
+ src = open("/opt/llama-rocm/rocmfpx-724/convert_hf_to_gguf.py").read()[:30000]
59
+ return src, "Above is part of a model converter. Write a new, complete Python function that validates a GGUF tensor-name map against a list of HF tensor names and reports unmapped names. Code only."
60
+ txt = open(f"{W}/calib/wikitext-2-raw/wiki.train.raw").read()[:34000]
61
+ return txt, "Above are encyclopedia excerpts. Write a long, detailed new encyclopedia article in the same style about the history of lighthouses."
62
+
63
+ def one_request(port, ctx_text, instr, n=256, cache=False, nonce=True):
64
+ tag = f"[req {uuid.uuid4()}]\n" if nonce else ""
65
+ body = {"messages": [{"role": "user", "content": tag + ctx_text + "\n\n" + instr}],
66
+ "max_tokens": n, "temperature": 0, "top_k": 1, "ignore_eos": True, "cache_prompt": cache,
67
+ "chat_template_kwargs": {"enable_thinking": False}}
68
+ t = time.time(); r = post(port, "/v1/chat/completions", body); el = time.time() - t
69
+ tm = r.get("timings", {})
70
+ return {"pred_n": tm.get("predicted_n"), "tg": tm.get("predicted_per_second"),
71
+ "pp": tm.get("prompt_per_second"), "prompt_n": tm.get("prompt_n"), "cache_n": tm.get("cache_n"),
72
+ "draft_n": tm.get("draft_n"), "draft_acc": tm.get("draft_n_accepted"), "wall": el,
73
+ "usage": r.get("usage", {})}
74
+
75
+ def cmd_bench(a):
76
+ s = Server(a, a.port)
77
+ out = {"label": a.label, "model": os.path.basename(a.model),
78
+ "draft": os.path.basename(a.draft) if a.draft else ("in-file" if a.mtp_infile else None),
79
+ "nmax": a.nmax if (a.draft or a.mtp_infile) else None, "strict": bool(a.strict), "bin": BIN, "dev": a.dev, "ctx": a.ctx, "workload": a.workload,
80
+ "load_s": round(s.load_s, 1), "cmd": " ".join(s.cmd), "runs": []}
81
+ try:
82
+ ctx_text, instr = prompt_8k(a.workload)
83
+ one_request(a.port, ctx_text, instr) # warm-up, discarded
84
+ for _ in range(a.reps):
85
+ r = one_request(a.port, ctx_text, instr)
86
+ cached = (r["usage"].get("prompt_tokens_details") or {}).get("cached_tokens", 0) or 0
87
+ if r["pred_n"] != 256: raise SystemExit(f"GATE FAIL: predicted_n={r['pred_n']} != 256")
88
+ if (r["cache_n"] or 0) != 0 or cached != 0: raise SystemExit(f"GATE FAIL: cache hit cache_n={r['cache_n']} cached={cached}")
89
+ out["runs"].append(r)
90
+ finally:
91
+ s.stop()
92
+ tg = [r["tg"] for r in out["runs"]]; pp = [r["pp"] for r in out["runs"]]
93
+ dn = sum(r["draft_n"] or 0 for r in out["runs"]); da = sum(r["draft_acc"] or 0 for r in out["runs"])
94
+ out.update(tg_median=round(statistics.median(tg), 2), tg_min=round(min(tg), 2), tg_max=round(max(tg), 2),
95
+ pp_median=round(statistics.median(pp), 1), prompt_n=out["runs"][0]["prompt_n"],
96
+ accept=(round(da / dn, 3) if dn else None))
97
+ print(json.dumps({k: v for k, v in out.items() if k != "runs"}))
98
+ with open(a.jsonl, "a") as f: f.write(json.dumps(out) + "\n")
99
+
100
+ def cmd_identity(a):
101
+ """Fixed prompt, no nonce, no cache, greedy: return the exact generated text for cross-config diffing."""
102
+ s = Server(a, a.port)
103
+ texts = []
104
+ try:
105
+ ctx_text, instr = prompt_8k(a.workload)
106
+ for _ in range(a.reps):
107
+ body = {"messages": [{"role": "user", "content": ctx_text + "\n\n" + instr}], "max_tokens": 256,
108
+ "temperature": 0, "top_k": 1, "ignore_eos": True, "cache_prompt": False,
109
+ "chat_template_kwargs": {"enable_thinking": False}}
110
+ r = post(a.port, "/v1/chat/completions", body)
111
+ texts.append(r["choices"][0]["message"].get("content") or "")
112
+ finally:
113
+ s.stop()
114
+ import hashlib
115
+ res = {"label": a.label, "reps": a.reps, "sha256": [hashlib.sha256(t.encode()).hexdigest()[:16] for t in texts],
116
+ "self_consistent": len(set(texts)) == 1, "text": texts[0]}
117
+ print(json.dumps({k: v for k, v in res.items() if k != "text"}))
118
+ with open(a.jsonl, "a") as f: f.write(json.dumps(res) + "\n")
119
+
120
+ def cmd_cachegate2(a):
121
+ """Partial-prefix reuse WITH output identity: warm on A, run B warm (partial reuse), run B cold, diff outputs."""
122
+ import hashlib
123
+ s = Server(a, a.port)
124
+ rows = []
125
+ try:
126
+ ctx_text, _ = prompt_8k("code")
127
+ variants = ["Write a function that lists every tensor name in this file.",
128
+ "Write a function that counts the model classes registered in this file.",
129
+ "Write a function that finds the longest method in this file."]
130
+ for i, vb in enumerate(variants[:a.reps]):
131
+ def req(instr, n, cache):
132
+ body = {"messages": [{"role": "user", "content": ctx_text + "\n\n" + instr}], "max_tokens": n,
133
+ "temperature": 0, "top_k": 1, "ignore_eos": True, "cache_prompt": cache,
134
+ "chat_template_kwargs": {"enable_thinking": False}}
135
+ r = post(a.port, "/v1/chat/completions", body)
136
+ tm = r.get("timings", {})
137
+ return (r["choices"][0]["message"].get("content") or ""), tm.get("prompt_n"), tm.get("cache_n")
138
+ req(f"Summarise this file. (warm-up {i})", 16, True)
139
+ tw, pw, cw = req(vb, 192, True)
140
+ tc, pc, cc = req(vb, 192, False)
141
+ rows.append({"variant": i, "warm_prompt_n": pw, "warm_cache_n": cw, "cold_prompt_n": pc, "cold_cache_n": cc,
142
+ "identical": tw == tc, "warm_sha": hashlib.sha256(tw.encode()).hexdigest()[:12],
143
+ "cold_sha": hashlib.sha256(tc.encode()).hexdigest()[:12]})
144
+ print(" ", json.dumps(rows[-1]), flush=True)
145
+ finally:
146
+ s.stop()
147
+ reused = all((r["warm_cache_n"] or 0) > 0 for r in rows)
148
+ ident = all(r["identical"] for r in rows)
149
+ res = {"label": a.label, "rows": rows, "all_reused": reused, "all_identical": ident,
150
+ "result": "PASS" if (reused and ident) else "FAIL"}
151
+ print(json.dumps({k: v for k, v in res.items() if k != "rows"}))
152
+ with open(a.jsonl, "a") as f: f.write(json.dumps(res) + "\n")
153
+ sys.exit(0 if res["result"] == "PASS" else 1)
154
+
155
+ def cmd_cachegate(a):
156
+ """Repeat-prompt test WITH the draft head loaded: turn 2 must reuse turn 1's prefix."""
157
+ s = Server(a, a.port)
158
+ try:
159
+ ctx_text, instr = prompt_8k("code")
160
+ r1 = one_request(a.port, ctx_text, instr, n=32, cache=True, nonce=False)
161
+ r2 = one_request(a.port, ctx_text, instr + " Also add type hints.", n=32, cache=True, nonce=False)
162
+ finally:
163
+ s.stop()
164
+ res = {"label": a.label, "turn1_prompt_n": r1["prompt_n"], "turn2_prompt_n": r2["prompt_n"],
165
+ "turn2_cache_n": r2["cache_n"]}
166
+ # hybrid recurrent models resume only from context checkpoints (~1024-token spacing), so the test is
167
+ # "any prefix reuse" -- report the fraction rather than demand near-total reuse.
168
+ ok = isinstance(r2["cache_n"], int) and r2["cache_n"] > 0
169
+ res["reuse_fraction"] = round(r2["cache_n"] / r1["prompt_n"], 3) if ok and r1["prompt_n"] else 0.0
170
+ res["result"] = "PASS" if ok else "FAIL"
171
+ print(json.dumps(res))
172
+ with open(a.jsonl, "a") as f: f.write(json.dumps(res) + "\n")
173
+ sys.exit(0 if ok else 1)
174
+
175
+ TOOLS = [
176
+ {"type": "function", "function": {"name": "get_weather", "description": "Current weather for a city",
177
+ "parameters": {"type": "object", "properties": {"city": {"type": "string"},
178
+ "unit": {"type": "string", "enum": ["celsius", "fahrenheit"]}}, "required": ["city", "unit"]}}},
179
+ {"type": "function", "function": {"name": "create_event", "description": "Create a calendar event",
180
+ "parameters": {"type": "object", "properties": {"title": {"type": "string"},
181
+ "when": {"type": "object", "properties": {"date": {"type": "string"}, "time": {"type": "string"}},
182
+ "required": ["date", "time"]},
183
+ "attendees": {"type": "array", "items": {"type": "string"}}}, "required": ["title", "when", "attendees"]}}},
184
+ ]
185
+ LEAK = ("<tool_call>", "<function=", "<parameter=", "<think>", "</think>")
186
+
187
+ def chat(port, msgs, think, stream=False, tools=TOOLS):
188
+ body = {"messages": msgs, "tools": tools, "tool_choice": "auto", "temperature": 1.0, "top_p": 0.95,
189
+ "top_k": 20, "max_tokens": 4096,
190
+ "chat_template_kwargs": ({"enable_thinking": True, "reasoning_effort": "low"} if think else {"enable_thinking": False})}
191
+ if not stream:
192
+ return post(port, "/v1/chat/completions", body)["choices"][0]["message"]
193
+ body["stream"] = True
194
+ req = urllib.request.Request(f"http://127.0.0.1:{port}/v1/chat/completions", data=json.dumps(body).encode(),
195
+ headers={"Content-Type": "application/json"})
196
+ calls, content = {}, ""
197
+ for line in urllib.request.urlopen(req, timeout=1800):
198
+ line = line.decode().strip()
199
+ if not line.startswith("data:") or line.endswith("[DONE]"): continue
200
+ d = json.loads(line[5:])["choices"][0]["delta"]
201
+ content += d.get("content") or ""
202
+ for tc in d.get("tool_calls") or []:
203
+ c = calls.setdefault(tc["index"], {"name": "", "arguments": ""})
204
+ c["name"] += (tc.get("function") or {}).get("name") or ""
205
+ c["arguments"] += (tc.get("function") or {}).get("arguments") or ""
206
+ return {"content": content, "tool_calls": [{"function": v} for _, v in sorted(calls.items())]}
207
+
208
+ def args_of(m, i=0):
209
+ return json.loads(m["tool_calls"][i]["function"]["arguments"])
210
+
211
+ def cmd_tools(a):
212
+ s = Server(a, a.port)
213
+ results = {}
214
+ try:
215
+ for think in (True, False):
216
+ def check(name, fn):
217
+ try: ok, why = fn()
218
+ except Exception as e: ok, why = False, f"exception {e!r}"[:160]
219
+ results[f"{name}|think={think}"] = (ok, why)
220
+ print(f" {'PASS' if ok else 'FAIL'} think={think!s:5} {name}: {why}", flush=True)
221
+ def clean(m): return not any(x in (m.get("content") or "") for x in LEAK)
222
+ def t1():
223
+ m = chat(a.port, [{"role": "user", "content": "What's the weather in Paris in celsius?"}], think)
224
+ ag = args_of(m); return (m["tool_calls"][0]["function"]["name"] == "get_weather" and ag.get("city", "").lower().startswith("paris")
225
+ and ag.get("unit") == "celsius" and clean(m)), f"args={ag}"
226
+ def t2():
227
+ m = chat(a.port, [{"role": "user", "content": "Book 'Design review' on 2026-10-02 at 14:00 with ana@x.io and bo@x.io."}], think)
228
+ ag = args_of(m); return (isinstance(ag.get("when"), dict) and ag["when"].get("date") == "2026-10-02"
229
+ and sorted(ag.get("attendees", [])) == ["ana@x.io", "bo@x.io"] and clean(m)), f"args={ag}"
230
+ def t3():
231
+ m = chat(a.port, [{"role": "user", "content": "Weather in Denver, and give it to me in fahrenheit."}], think)
232
+ return args_of(m).get("unit") == "fahrenheit" and clean(m), f"unit={args_of(m).get('unit')}"
233
+ def t4():
234
+ m = chat(a.port, [{"role": "user", "content": "What is 17 times 23? Answer directly."}], think)
235
+ c = m.get("content") or ""
236
+ return (not m.get("tool_calls")) and "391" in c and clean(m), f"content={c[:60]!r}"
237
+ def t5():
238
+ msgs = [{"role": "user", "content": "What's the weather in Tokyo in celsius?"}]
239
+ m = chat(a.port, msgs, think)
240
+ tc = m["tool_calls"][0]
241
+ msgs += [{"role": "assistant", "content": m.get("content") or "", "tool_calls": [
242
+ {"id": "call_1", "type": "function", "function": tc["function"]}]},
243
+ {"role": "tool", "tool_call_id": "call_1", "content": json.dumps({"temp_c": 21, "sky": "clear"})}]
244
+ m2 = chat(a.port, msgs, think)
245
+ c = m2.get("content") or ""
246
+ return ("21" in c and not m2.get("tool_calls") and clean(m2)), f"final={c[:70]!r}"
247
+ def t6():
248
+ m = chat(a.port, [{"role": "user", "content": "What's the weather in Rome in celsius?"}], think, stream=True)
249
+ ag = args_of(m); return (m["tool_calls"][0]["function"]["name"] == "get_weather"
250
+ and ag.get("city", "").lower().startswith("rome") and clean(m)), f"stream args={ag}"
251
+ def t7():
252
+ m = chat(a.port, [{"role": "user", "content": "Get the weather in Oslo AND in Lima, both in celsius. Call the tool for each city."}], think)
253
+ cities = sorted(args_of(m, i).get("city", "").lower() for i in range(len(m.get("tool_calls") or [])))
254
+ return (len(cities) == 2 and cities[0].startswith("lima") and cities[1].startswith("oslo") and clean(m)), f"calls={cities}"
255
+ for nm, fn in (("multi-arg", t1), ("nested-object", t2), ("enum", t3), ("correct-decline", t4),
256
+ ("multi-turn", t5), ("streaming", t6), ("parallel", t7)):
257
+ check(nm, fn)
258
+ finally:
259
+ s.stop()
260
+ n_ok = sum(v[0] for v in results.values())
261
+ summary = {"label": a.label, "passed": n_ok, "total": len(results),
262
+ "detail": {k: v[0] for k, v in results.items()}}
263
+ print(json.dumps(summary))
264
+ with open(a.jsonl, "a") as f: f.write(json.dumps(summary) + "\n")
265
+
266
+ def cmd_vision(a):
267
+ """Image gate. A server that fails to load or dies on the image is a RESULT (FAIL row), not a harness crash."""
268
+ fa = a.fa or "off"
269
+ res = {"label": a.label, "fa": fa, "mtp": bool(a.draft or a.mtp_infile), "expected": a.expect,
270
+ "answer": "", "hits": [], "error": None, "server_died": False, "server_log_errors": []}
271
+ c = ""
272
+ try:
273
+ s = Server(a, a.port, mmproj=a.mmproj, fa=fa)
274
+ except SystemExit as e:
275
+ res.update(error=f"server did not start: {e}", server_died=True); s = None
276
+ if s is not None:
277
+ try:
278
+ img = base64.b64encode(open(a.image, "rb").read()).decode()
279
+ body = {"messages": [{"role": "user", "content": [
280
+ {"type": "image_url", "image_url": {"url": f"data:image/png;base64,{img}"}},
281
+ {"type": "text", "text": a.question}]}],
282
+ "temperature": 0, "top_k": 1, "max_tokens": 300, "chat_template_kwargs": {"enable_thinking": False}}
283
+ try:
284
+ r = post(a.port, "/v1/chat/completions", body, timeout=900)
285
+ c = r["choices"][0]["message"].get("content") or ""
286
+ except Exception as e:
287
+ res["error"] = f"{type(e).__name__}: {e}"[:300]
288
+ time.sleep(1)
289
+ res["server_died"] = s.p.poll() is not None
290
+ finally:
291
+ s.stop()
292
+ try:
293
+ res["server_log_errors"] = [l.strip()[-200:] for l in open(a.serverlog, errors="replace")
294
+ if any(k in l for k in ("GGML_ABORT", "abort", "failed to process", " E "))][-5:]
295
+ except OSError:
296
+ pass
297
+ res["answer"] = c[:300]
298
+ res["hits"] = [w for w in a.expect.split(",") if w.lower() in c.lower()]
299
+ ok = res["error"] is None and not res["server_died"] and len(res["hits"]) == len(a.expect.split(","))
300
+ res["result"] = "PASS" if ok else "FAIL"
301
+ print(json.dumps(res))
302
+ with open(a.jsonl, "a") as f: f.write(json.dumps(res) + "\n")
303
+ sys.exit(0 if ok else 1)
304
+
305
+ if __name__ == "__main__":
306
+ ap = argparse.ArgumentParser()
307
+ ap.add_argument("cmd", choices=["bench", "cachegate", "cachegate2", "tools", "vision", "identity"])
308
+ ap.add_argument("--model", required=True); ap.add_argument("--draft")
309
+ ap.add_argument("--nmax", type=int, default=4); ap.add_argument("--pmin", type=float, default=0.0)
310
+ ap.add_argument("--dev", default="ROCm0"); ap.add_argument("--ctx", type=int, default=65536)
311
+ ap.add_argument("--port", type=int, default=18600); ap.add_argument("--reps", type=int, default=3)
312
+ ap.add_argument("--workload", default="code", choices=["code", "prose"])
313
+ ap.add_argument("--label", default=""); ap.add_argument("--jsonl", default=f"{W}/results/phase_b.jsonl")
314
+ ap.add_argument("--serverlog", default=f"{W}/logs/server_last.log")
315
+ ap.add_argument("--mmproj"); ap.add_argument("--image"); ap.add_argument("--question"); ap.add_argument("--expect")
316
+ ap.add_argument("--mtp-infile", action="store_true"); ap.add_argument("--strict", action="store_true")
317
+ ap.add_argument("--fa", choices=["on", "off", "auto"], help="vision only; default off")
318
+ a = ap.parse_args()
319
+ os.makedirs(os.path.dirname(a.jsonl), exist_ok=True)
320
+ {"bench": cmd_bench, "cachegate": cmd_cachegate, "tools": cmd_tools, "vision": cmd_vision,
321
+ "identity": cmd_identity, "cachegate2": cmd_cachegate2}[a.cmd](a)
recipe/pipeline/bench_plan.py ADDED
@@ -0,0 +1,52 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env python3
2
+ """Phase B, GPU queue 3: speed matrix. ROCm n-max sweep first, knee chosen FROM THE DATA, then every
3
+ other arm at that knee. Each run is an isolated agnes_harness.py process (house protocol)."""
4
+ import json, os, subprocess, sys, time
5
+ W = "/mnt/models/agnes-3.0-flash"; N = "Agnes-3.0-Flash-Preview"
6
+ J = f"{W}/results/phase_b.jsonl"
7
+ H = ["python3", f"{W}/agnes_harness.py"]
8
+ T = {"q106": f"{W}/out/{N}-Q4_0_ROCMFP4_STRIX_LEAN.gguf", "q102": f"{W}/out/{N}-Q4_0_ROCMFP4_COHERENT.gguf",
9
+ "q115": f"{W}/out/{N}-Q8_0_ROCMFPX_AGENT.gguf", "q111": f"{W}/out/{N}-Q8_0_ROCMFPX.gguf",
10
+ "q106i": f"{W}/out-imat/{N}-imatrix-Q4_0_ROCMFP4_STRIX_LEAN.gguf"}
11
+ D4, D8 = f"{W}/out/mtp-{N}-Q4_0.gguf", f"{W}/out/mtp-{N}-Q8_0.gguf"
12
+ def log(m): print(f"[{time.strftime('%FT%TZ', time.gmtime())}] {m}", flush=True)
13
+ def bench(label, model, dev="ROCm0", draft=None, nmax=4, workload="code", reps=3):
14
+ a = H + ["bench", "--model", model, "--dev", dev, "--label", label, "--workload", workload,
15
+ "--reps", str(reps), "--serverlog", f"{W}/logs/srv_{label}.log"]
16
+ if draft: a += ["--draft", draft, "--nmax", str(nmax)]
17
+ log(f"bench {label}")
18
+ r = subprocess.run(a, capture_output=True, text=True)
19
+ print(r.stdout.strip()[-600:], flush=True)
20
+ if r.returncode != 0:
21
+ print(" ERR", r.stderr.strip()[-400:], flush=True)
22
+ return r.returncode == 0
23
+ def rows(prefix):
24
+ out = []
25
+ for line in open(J):
26
+ d = json.loads(line)
27
+ if d.get("label", "").startswith(prefix) and "tg_median" in d: out.append(d)
28
+ return out
29
+ # 1. ROCm sweep on the recommended tier
30
+ bench("sweep-rocm-off", T["q106"])
31
+ for n in (1, 2, 3, 4, 5, 6):
32
+ bench(f"sweep-rocm-n{n}", T["q106"], draft=D4, nmax=n)
33
+ sw = [d for d in rows("sweep-rocm-n")]
34
+ knee = max(sw, key=lambda d: d["tg_median"])["nmax"]
35
+ log(f"KNEE (ROCm, Q4_0 head) = n-max {knee}")
36
+ # 2. Vulkan sweep around the knee (+ off)
37
+ bench("sweep-vk-off", T["q106"], dev="Vulkan0")
38
+ for n in sorted({max(1, knee - 1), knee, knee + 1}):
39
+ bench(f"sweep-vk-n{n}", T["q106"], dev="Vulkan0", draft=D4, nmax=n)
40
+ # 3. draft head precision at the knee
41
+ bench(f"head-q8-rocm-n{knee}", T["q106"], draft=D8, nmax=knee)
42
+ # 4. every other tier, both backends, in the DEPLOYED config (MTP at the knee)
43
+ for tag in ("q102", "q115", "q111"):
44
+ for dev, short in (("ROCm0", "rocm"), ("Vulkan0", "vk")):
45
+ bench(f"tier-{tag}-{short}-n{knee}", T[tag], dev=dev, draft=D4, nmax=knee)
46
+ # 5. imatrix tier: speed should be identical by construction -- confirm, don't assume
47
+ bench(f"tier-q106i-rocm-n{knee}", T["q106i"], draft=D4, nmax=knee)
48
+ # 6. workload range for the headline config
49
+ bench(f"prose-q106-rocm-n{knee}", T["q106"], draft=D4, nmax=knee, workload="prose")
50
+ bench(f"prose-q106-vk-n{knee}", T["q106"], dev="Vulkan0", draft=D4, nmax=knee, workload="prose")
51
+ json.dump({"knee": knee}, open(f"{W}/results/knee.json", "w"))
52
+ log("BENCH_PLAN_DONE")
recipe/pipeline/cachegate3.py ADDED
@@ -0,0 +1,119 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env python3
2
+ """Chunk-ALIGNED warm/cold identity gate for the MTP prompt-cache patch.
3
+
4
+ Why a third gate: llama-server splits every prompt so that context checkpoints land (4 + n_ubatch) and 4 tokens
5
+ before its end (tools/server/server-context.cpp `checkpoint_offsets`, upstream PR #20288). A warm request restores a
6
+ checkpoint whose position was fixed by the length of the request that CREATED it. When those lengths differ, the warm
7
+ tail is processed in different chunks than a cold run of the same prompt, so float rounding differs and a greedy
8
+ token can flip - with or without a draft head. cachegate2 mixed prompt lengths and hit exactly that.
9
+
10
+ Here every prompt in the run is padded to ONE token length L, so warm and cold see identical chunking. What is left
11
+ under test is the patch's own responsibility: is the restored checkpoint (target + MTP state) exact?
12
+ Per variant: warm-up A (cache on) -> B warm (cache on, must restore L-(4+ub)) -> B cold (cache off). PASS = every
13
+ warm B reused the cache at the aligned position AND is byte-identical to its cold twin, over all variants."""
14
+ import argparse, hashlib, json, os, sys
15
+ sys.path.insert(0, "/mnt/models/agnes-3.0-flash")
16
+ from agnes_harness import Server, post, prompt_8k # noqa: E402 (reads AGNES_BIN at import)
17
+
18
+ UB = 1024 # agnes_harness.Server passes -ub 1024
19
+ WARM = "Summarise this file."
20
+ INSTR = ["Write a function that lists every tensor name in this file.",
21
+ "Write a function that counts the model classes registered in this file.",
22
+ "Write a function that finds the longest method in this file.",
23
+ "Write a function that returns every regular expression used in this file.",
24
+ "Write a function that maps each class in this file to its base classes.",
25
+ "Write a function that extracts all string constants from this file.",
26
+ "Write a function that reports which imports in this file are unused.",
27
+ "Write a function that lists every method that raises an exception in this file.",
28
+ "Write a function that counts the lines of code per class in this file.",
29
+ "Write a function that finds duplicate method names across classes in this file."]
30
+ KW = {"enable_thinking": False}
31
+
32
+
33
+ def plen(port, content):
34
+ p = post(port, "/apply-template", {"messages": [{"role": "user", "content": content}],
35
+ "chat_template_kwargs": KW})["prompt"]
36
+ return len(post(port, "/tokenize", {"content": p, "add_special": True, "parse_special": True})["tokens"])
37
+
38
+
39
+ def pad(port, ctx, instr, L):
40
+ s = instr
41
+ n = plen(port, ctx + "\n\n" + s)
42
+ for filler in (" ok", ".", " x"):
43
+ while n < L:
44
+ t = s + filler
45
+ m = plen(port, ctx + "\n\n" + t)
46
+ if m > L:
47
+ break
48
+ s, n = t, m
49
+ if n == L:
50
+ return s
51
+ raise SystemExit(f"could not pad {instr!r} to {L} (stuck at {n})")
52
+
53
+
54
+ def req(port, ctx, instr, n, cache):
55
+ body = {"messages": [{"role": "user", "content": ctx + "\n\n" + instr}], "max_tokens": n,
56
+ "temperature": 0, "top_k": 1, "ignore_eos": True, "cache_prompt": cache, "chat_template_kwargs": KW}
57
+ r = post(port, "/v1/chat/completions", body)
58
+ tm = r.get("timings", {})
59
+ return (r["choices"][0]["message"].get("content") or ""), tm.get("prompt_n"), tm.get("cache_n"), \
60
+ tm.get("draft_n"), tm.get("draft_n_accepted")
61
+
62
+
63
+ def first_diff(x, y):
64
+ if x == y:
65
+ return None
66
+ return next((i for i, (p, q) in enumerate(zip(x, y)) if p != q), min(len(x), len(y)))
67
+
68
+
69
+ def main(a):
70
+ s = Server(a, a.port)
71
+ rows = []
72
+ try:
73
+ ctx, _ = prompt_8k("code")
74
+ instr = INSTR[:a.reps]
75
+ warm = [f"{WARM} (warm-up {i})" for i in range(len(instr))]
76
+ # L over the FULL prompt set, whatever --reps is: runs with different --reps then share byte-identical
77
+ # prompts, so their outputs can be compared across configs (e.g. MTP vs no draft head).
78
+ allp = INSTR + [f"{WARM} (warm-up {i})" for i in range(len(INSTR))]
79
+ L = max(plen(a.port, ctx + "\n\n" + t) for t in allp) + 1
80
+ instr = [pad(a.port, ctx, t, L) for t in instr]
81
+ warm = [pad(a.port, ctx, t, L) for t in warm]
82
+ expect_cache = L - (4 + UB)
83
+ for i, (wa, vb) in enumerate(zip(warm, instr)):
84
+ req(a.port, ctx, wa, 16, True)
85
+ tw, pw, cw, dw, aw = req(a.port, ctx, vb, 192, True)
86
+ tc, pc, cc, dc, ac = req(a.port, ctx, vb, 192, False)
87
+ rows.append({"variant": i, "L": L, "warm_prompt_n": pw, "warm_cache_n": cw, "cold_prompt_n": pc,
88
+ "cold_cache_n": cc, "aligned": (cw == expect_cache and pc == L),
89
+ "warm_draft": [aw, dw], "cold_draft": [ac, dc], "identical": tw == tc,
90
+ "first_diff_char": first_diff(tw, tc),
91
+ "warm_sha": hashlib.sha256(tw.encode()).hexdigest()[:12],
92
+ "cold_sha": hashlib.sha256(tc.encode()).hexdigest()[:12], "instr": vb, "warm_instr": wa,
93
+ "warm_text": tw, "cold_text": tc})
94
+ print(" ", json.dumps({k: v for k, v in rows[-1].items() if not k.endswith("_text")}), flush=True)
95
+ finally:
96
+ s.stop()
97
+ reused = all((r["warm_cache_n"] or 0) > 0 for r in rows)
98
+ aligned = all(r["aligned"] for r in rows)
99
+ ident = all(r["identical"] for r in rows)
100
+ res = {"label": a.label, "gate": "cachegate3-aligned", "n": len(rows), "L": rows[0]["L"] if rows else None,
101
+ "expect_cache_n": expect_cache if rows else None, "all_reused": reused, "all_aligned": aligned,
102
+ "identical": sum(r["identical"] for r in rows), "rows": rows,
103
+ "result": "PASS" if (rows and reused and aligned and ident) else "FAIL"}
104
+ print(json.dumps({k: v for k, v in res.items() if k != "rows"}), flush=True)
105
+ with open(a.jsonl, "a") as f:
106
+ f.write(json.dumps(res) + "\n")
107
+ sys.exit(0 if res["result"] == "PASS" else 1)
108
+
109
+
110
+ if __name__ == "__main__":
111
+ ap = argparse.ArgumentParser()
112
+ ap.add_argument("--model", required=True); ap.add_argument("--draft")
113
+ ap.add_argument("--nmax", type=int, default=4); ap.add_argument("--pmin", type=float, default=0.0)
114
+ ap.add_argument("--dev", default="ROCm0"); ap.add_argument("--ctx", type=int, default=65536)
115
+ ap.add_argument("--port", type=int, default=18600); ap.add_argument("--reps", type=int, default=10)
116
+ ap.add_argument("--label", required=True); ap.add_argument("--jsonl", required=True)
117
+ ap.add_argument("--serverlog", required=True)
118
+ ap.add_argument("--mtp-infile", action="store_true"); ap.add_argument("--strict", action="store_true")
119
+ main(ap.parse_args())
recipe/pipeline/gpu_q1.sh ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/bin/bash
2
+ # Phase B, GPU queue 1: BF16 perplexity + KLD base logits, then imatrix, then imatrix quants (CPU).
3
+ set -euo pipefail
4
+ W=/mnt/models/agnes-3.0-flash; B=/opt/llama-rocm/rocmfpx-724/build-hipvk/bin; N=Agnes-3.0-Flash-Preview
5
+ export LD_LIBRARY_PATH=$B:/opt/rocm-7.2.4/lib HSA_OVERRIDE_GFX_VERSION=11.5.1 GGML_HIP_ENABLE_UNIFIED_MEMORY=1
6
+ cd $W; mkdir -p kld imat out-imat logs results
7
+ log(){ echo "[$(date -u +%FT%TZ)] $*"; }
8
+ BF=gguf/$N-BF16.gguf; WT=calib/wikitext-2-raw/wiki.test.raw
9
+
10
+ log "B1 BF16 perplexity (c=2048, 40 chunks) + save KLD base logits"
11
+ $B/llama-perplexity -m $BF -f $WT -c 2048 --chunks 40 -b 2048 -ngl 999 -fa on -dio -dev ROCm0 \
12
+ --kl-divergence-base kld/bf16.kld > logs/B1_ppl_bf16.log 2>&1
13
+ grep -E "Final estimate" logs/B1_ppl_bf16.log
14
+
15
+ log "B2 imatrix on BF16 (bartowski calibration_datav3, c=512)"
16
+ $B/llama-imatrix -m $BF -f calib/calibration_datav3.txt -o imat/$N.imatrix \
17
+ -ngl 999 -c 512 -b 512 -fa on -dio -dev ROCm0 > logs/B2_imatrix.log 2>&1
18
+ ls -la imat/
19
+ sha256sum imat/$N.imatrix | tee imat/$N.imatrix.sha256
20
+
21
+ cap(){ systemd-run --scope --quiet -p MemoryMax=20G -p MemorySwapMax=0 "$@"; }
22
+ log "B3 imatrix quant STRIX_LEAN (106)"
23
+ cap $B/llama-quantize --imatrix imat/$N.imatrix --output-tensor-type q6_K $BF \
24
+ out-imat/$N-imatrix-Q4_0_ROCMFP4_STRIX_LEAN.gguf Q4_0_ROCMFP4_STRIX_LEAN 16 > logs/B3_imat_q106.log 2>&1
25
+ python3 readback.py Q6_K Q5_K out-imat/$N-imatrix-Q4_0_ROCMFP4_STRIX_LEAN.gguf | tee -a logs/B_readback.log
26
+ log "B4 imatrix quant COHERENT (102)"
27
+ cap $B/llama-quantize --imatrix imat/$N.imatrix --output-tensor-type q6_K --token-embedding-type q6_K $BF \
28
+ out-imat/$N-imatrix-Q4_0_ROCMFP4_COHERENT.gguf Q4_0_ROCMFP4_COHERENT 16 > logs/B4_imat_q102.log 2>&1
29
+ python3 readback.py Q6_K Q6_K out-imat/$N-imatrix-Q4_0_ROCMFP4_COHERENT.gguf | tee -a logs/B_readback.log
30
+ log "GPU_Q1_DONE"
recipe/pipeline/gpu_q2.sh ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/bin/bash
2
+ # Phase B, GPU queue 2: PPL + KL-divergence vs BF16 logits for every tier (waits for each read-back PASS).
3
+ set -euo pipefail
4
+ W=/mnt/models/agnes-3.0-flash; B=/opt/llama-rocm/rocmfpx-724/build-hipvk/bin; N=Agnes-3.0-Flash-Preview
5
+ export LD_LIBRARY_PATH=$B:/opt/rocm-7.2.4/lib HSA_OVERRIDE_GFX_VERSION=11.5.1 GGML_HIP_ENABLE_UNIFIED_MEMORY=1
6
+ cd $W
7
+ log(){ echo "[$(date -u +%FT%TZ)] $*"; }
8
+ log "waiting for GPU (imatrix finished)"
9
+ until grep -q "B3 imatrix quant" logs/gpu_q1.log 2>/dev/null; do
10
+ pgrep -f "bash gpu_q1.sh" >/dev/null || { log "gpu_q1 died before imatrix finished"; exit 1; }; sleep 20; done
11
+ waitpass(){ # $1 = file basename, $2 = readback log
12
+ until grep -q "^PASS $1 " "$2" 2>/dev/null; do
13
+ grep -q "^FAIL $1 " "$2" 2>/dev/null && { log "readback FAIL for $1"; exit 1; }; sleep 20; done; }
14
+ kld(){ # $1 tag $2 path $3 readback log
15
+ waitpass "$(basename $2)" "$3"
16
+ log "KLD $1"
17
+ $B/llama-perplexity -m "$2" --kl-divergence-base kld/bf16.kld --kl-divergence -c 2048 -b 2048 \
18
+ -ngl 999 -fa on -dio -dev ROCm0 > logs/B5_kld_$1.log 2>&1
19
+ grep -E "Mean PPL\(Q\)|Mean KLD|Same top p" logs/B5_kld_$1.log | tr -s " " | tr "\n" " "; echo
20
+ }
21
+ kld q106 out/$N-Q4_0_ROCMFP4_STRIX_LEAN.gguf logs/A7_readback.log
22
+ kld q102 out/$N-Q4_0_ROCMFP4_COHERENT.gguf logs/A7_readback.log
23
+ kld q115 out/$N-Q8_0_ROCMFPX_AGENT.gguf logs/A7_readback.log
24
+ kld q111 out/$N-Q8_0_ROCMFPX.gguf logs/A7_readback.log
25
+ kld q106i out-imat/$N-imatrix-Q4_0_ROCMFP4_STRIX_LEAN.gguf logs/B_readback.log
26
+ kld q102i out-imat/$N-imatrix-Q4_0_ROCMFP4_COHERENT.gguf logs/B_readback.log
27
+ log "GPU_Q2_DONE"
recipe/pipeline/gpu_q4.sh ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/bin/bash
2
+ # Phase B, queue 4: correctness gates on the recommended tier in its DEPLOYED config.
3
+ set -uo pipefail
4
+ W=/mnt/models/agnes-3.0-flash; N=Agnes-3.0-Flash-Preview; cd $W
5
+ H="python3 agnes_harness.py"; M=out/$N-Q4_0_ROCMFP4_STRIX_LEAN.gguf; D=out/mtp-$N-Q4_0.gguf
6
+ KNEE=$(python3 -c "import json;print(json.load(open('results/knee.json'))['knee'])")
7
+ log(){ echo "[$(date -u +%FT%TZ)] $*"; }
8
+ log "G1 prompt-cache gate WITH MTP draft (n-max $KNEE)"
9
+ $H cachegate --model $M --draft $D --nmax $KNEE --label cache-mtp --serverlog logs/srv_cache_mtp.log; echo " exit=$?"
10
+ log "G2 prompt-cache control, no draft"
11
+ $H cachegate --model $M --label cache-nodraft --serverlog logs/srv_cache_nodraft.log; echo " exit=$?"
12
+ log "G3 tool-call suite, deployed config (MTP on), thinking on + off"
13
+ $H tools --model $M --draft $D --nmax $KNEE --label tools-q106-mtp --serverlog logs/srv_tools.log; echo " exit=$?"
14
+ log "G4 vision (mmproj, -fa off)"
15
+ $H vision --model $M --mmproj out/mmproj-$N-BF16.gguf --image calib/vision_probe.png \
16
+ --question "Describe the two shapes in this image and their colors." \
17
+ --expect "red,blue,circle,square" --label vision-q106 --serverlog logs/srv_vision.log; echo " exit=$?"
18
+ log "GPU_Q4_DONE"
recipe/pipeline/hf_publish_v2.py ADDED
@@ -0,0 +1,132 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env python3
2
+ """Stage (hardlinks), upload, and byte-verify the two Agnes repos - in-file-MTP layout.
3
+ usage: hf_publish_v2.py stage|upload|verify|readme <std|imat> [README path]
4
+ Run upload under a memory cap, e.g. systemd-run --scope -p MemoryMax=8G -p MemorySwapMax=0 python3 hf_publish_v2.py upload std
5
+ Env: default HF_HOME (token); HF_XET_CACHE / TMPDIR pinned to /mnt/models by the caller."""
6
+ import hashlib, json, os, shutil, sys, urllib.request
7
+
8
+ W = "/mnt/models/agnes-3.0-flash"; N = "Agnes-3.0-Flash-Preview"; U = "kingjones777"
9
+ REPOS = {"std": f"{U}/{N}-MTP-ROCmFP4-GGUF", "imat": f"{U}/{N}-MTP-ROCmFP4-imatrix-GGUF"}
10
+
11
+
12
+ def pubname(fn):
13
+ """Published filename: the quant token must be hyphen-delimited or the Hub cannot parse the variant
14
+ (`Q4_0_ROCMFP4_STRIX_LEAN` reads as the garbage label `Q4_0_ROCMFP`)."""
15
+ for a, b in (("Q4_0_ROCMFP4_", "Q4_0-ROCmFP4-"), ("Q8_0_ROCMFPX_AGENT", "Q8_0-ROCmFPX-AGENT"), ("Q8_0_ROCMFPX", "Q8_0-ROCmFPX")):
16
+ if a in fn:
17
+ return fn.replace(a, b)
18
+ return fn
19
+
20
+
21
+ # published name -> (source dir, local filename)
22
+ MMPROJ = {f"mmproj-{N}-BF16.gguf": (f"{W}/out", f"mmproj-{N}-BF16.gguf")}
23
+ FILES = {"std": {**{pubname(f"{N}-MTP-{t}.gguf"): (f"{W}/out-mtp", f"{N}-MTP-{t}.gguf") for t in (
24
+ "Q4_0_ROCMFP4_STRIX_LEAN", "Q4_0_ROCMFP4_COHERENT", "Q8_0_ROCMFPX_AGENT", "Q8_0_ROCMFPX")}, **MMPROJ},
25
+ "imat": {**{pubname(f"{N}-MTP-imatrix-{t}.gguf"): (f"{W}/out-mtp-imat", f"{N}-MTP-imatrix-{t}.gguf") for t in (
26
+ "Q4_0_ROCMFP4_STRIX_LEAN", "Q4_0_ROCMFP4_COHERENT")},
27
+ f"{N}.imatrix": (f"{W}/imat", f"{N}.imatrix"), **MMPROJ}}
28
+ P = "recipe/pipeline/"
29
+ RECIPE = {
30
+ "recipe/fold_agnes.py": "fold_agnes.py", "recipe/verify_fold.py": "verify_fold.py",
31
+ "recipe/FOLD_PROVENANCE.json": "qwen35/FOLD_PROVENANCE.json", "recipe/verify_fold.log": "logs/A3_verify_fold.log",
32
+ "recipe/results_summary.json": "results/summary_v2.json",
33
+ "recipe/patches/mtp-prompt-cache-fix.patch": "mtpfix/mtp-prompt-cache-fix.patch",
34
+ **{P + x: x for x in ("phase_a.sh", "gpu_q1.sh", "gpu_q2.sh", "gpu_q4.sh", "bench_plan.py", "agnes_harness.py",
35
+ "readback.py", "verify_download.py", "seat_sizing.sh", "mtp_bake.sh", "mtpcache_build.sh",
36
+ "tensor_identity.py", "trunk_receipt.sh", "vplan_a.py", "vplan_b.py", "cachegate3.py",
37
+ "seat_sizing2.sh", "aggregate_v2.py")},
38
+ "recipe/raw/mtpfix.jsonl": "results/mtpfix.jsonl",
39
+ "recipe/raw/trunk_receipt.jsonl": "results/trunk_receipt.jsonl",
40
+ "recipe/raw/seat_sizing2.jsonl": "results/seat_sizing2.jsonl",
41
+ "recipe/raw/separate_head_phase_b.jsonl": "results/phase_b.jsonl",
42
+ "recipe/raw/separate_head_seat_sizing.jsonl": "results/seat_sizing.jsonl",
43
+ "recipe/logs/S_readback.log": "logs/S_readback.log", "recipe/logs/S_identity.log": "logs/S_identity.log",
44
+ "recipe/logs/S_sizes.log": "logs/S_sizes.log", "recipe/logs/P1_apply_check.log": "logs/P1_apply_check.log",
45
+ "recipe/logs/mtpcache_build.log": "logs/mtpcache_build.log",
46
+ "recipe/raw/regrade.jsonl": "results/regrade.jsonl", "recipe/raw/kld_control.jsonl": "results/kld_control.jsonl",
47
+ "recipe/logs/R2_ppl_bf16.log": "logs/R2_ppl_bf16.log", "recipe/logs/R4_kld_q106_repeat.log": "logs/R4_kld_q106_repeat.log",
48
+ "recipe/logs/R1_kld4_old_q106_cpuburn.log": "logs/R1_kld4_old_q106_cpuburn.log",
49
+ **{f"recipe/logs/R3_kld_{t}.log": f"logs/R3_kld_{t}.log" for t in ("q106", "q102", "q106i", "q102i", "q115", "q111")},
50
+ **{f"recipe/logs/afternoon_B5_kld_{t}.log": f"logs/B5_kld_{t}.log" for t in ("q106", "q102", "q106i", "q102i", "q115", "q111")},
51
+ "recipe/logs/afternoon_B1_ppl_bf16.log": "logs/B1_ppl_bf16.log",
52
+ **{P + x: x for x in ("regrade.sh", "kld_control.sh", "judge_v2.py", "render_cards_v2.py", "hf_publish_v2.py")}}
53
+ if True: # the imatrix card's methodology cites the imatrix run
54
+ RECIPE["recipe/logs/B2_imatrix.log"] = "logs/B2_imatrix.log"
55
+
56
+
57
+ def separation_errors(kind, names):
58
+ """The imatrix build is its OWN repo (King): no imatrix weights in the standard repo, no standard weights in the
59
+ imatrix repo. The vision projector is the only model file both carry."""
60
+ errs = []
61
+ for fn in names:
62
+ if not fn.endswith(".gguf") or fn.startswith("mmproj-"):
63
+ continue
64
+ is_imat = "-imatrix-" in fn
65
+ if kind == "std" and is_imat: errs.append(f"imatrix model file in the standard repo: {fn}")
66
+ if kind == "imat" and not is_imat: errs.append(f"standard model file in the imatrix repo: {fn}")
67
+ if kind == "imat" and f"{N}.imatrix" not in names: errs.append("imatrix repo is missing the .imatrix file")
68
+ return errs
69
+
70
+
71
+ assert REPOS["std"] != REPOS["imat"]
72
+ assert set(FILES["std"]) & set(FILES["imat"]) == set(MMPROJ), "only the vision projector may be shared"
73
+ for _k in FILES:
74
+ assert not separation_errors(_k, list(FILES[_k])), separation_errors(_k, list(FILES[_k]))
75
+
76
+
77
+ def sha(p):
78
+ h = hashlib.sha256()
79
+ with open(p, "rb") as fh:
80
+ for b in iter(lambda: fh.read(64 << 20), b""): h.update(b)
81
+ return h.hexdigest()
82
+
83
+
84
+ kind = sys.argv[2]; stage = f"{W}/hf-upload-v2/{kind}"; repo = REPOS[kind]
85
+ if sys.argv[1] == "stage":
86
+ missing = [f"{d}/{src}" for fn, (d, src) in FILES[kind].items() if not os.path.exists(f"{d}/{src}")] + \
87
+ [src for src in RECIPE.values() if not os.path.exists(f"{W}/{src}")]
88
+ if missing:
89
+ raise SystemExit(f"STAGE ABORT - missing: {missing}")
90
+ shutil.rmtree(stage, ignore_errors=True)
91
+ for fn, (d, src) in FILES[kind].items():
92
+ os.makedirs(stage, exist_ok=True); os.link(f"{d}/{src}", f"{stage}/{fn}")
93
+ for dst, src in RECIPE.items():
94
+ os.makedirs(os.path.dirname(f"{stage}/{dst}"), exist_ok=True); shutil.copy2(f"{W}/{src}", f"{stage}/{dst}")
95
+ sums = {fn: sha(f"{stage}/{fn}") for fn in sorted(FILES[kind])}
96
+ with open(f"{stage}/SHA256SUMS", "w") as fh:
97
+ for fn, h in sums.items(): fh.write(f"{h} {fn}\n")
98
+ sizes = {x: os.path.getsize(f"{stage}/{x}") for x in sums}
99
+ json.dump(sizes, open(f"{stage}/../staged_sizes_{kind}.json", "w"))
100
+ print(json.dumps({"stage": stage, "files": len(sums), "bytes": sum(sizes.values()), "recipe_files": len(RECIPE)}))
101
+ elif sys.argv[1] == "upload":
102
+ from huggingface_hub import HfApi
103
+ api = HfApi()
104
+ print("whoami:", api.whoami()["name"], flush=True)
105
+ api.create_repo(repo, repo_type="model", private=False, exist_ok=True)
106
+ # model files + receipts first; README goes up only after verify passes
107
+ api.upload_large_folder(repo_id=repo, repo_type="model", folder_path=stage,
108
+ ignore_patterns=["README.md", ".cache/**"], num_workers=2)
109
+ print("UPLOAD_DONE", repo, flush=True)
110
+ elif sys.argv[1] == "verify":
111
+ tree = json.load(urllib.request.urlopen(f"https://huggingface.co/api/models/{repo}/tree/main?recursive=true", timeout=60))
112
+ remote = {t["path"]: t for t in tree if t.get("type") == "file"}
113
+ local = dict(l.split()[::-1] for l in open(f"{stage}/SHA256SUMS").read().splitlines())
114
+ bad = []
115
+ for fn, h in local.items():
116
+ r = remote.get(fn)
117
+ if not r: bad.append((fn, "MISSING remote")); continue
118
+ if r["size"] != os.path.getsize(f"{stage}/{fn}"): bad.append((fn, f"size {r['size']}")); continue
119
+ oid = (r.get("lfs") or {}).get("oid")
120
+ if oid != h: bad.append((fn, f"sha {oid} != {h[:12]}"))
121
+ for fn in list(RECIPE) + ["SHA256SUMS"]:
122
+ if fn not in remote: bad.append((fn, "MISSING remote"))
123
+ stale = sorted(x for x in remote if x not in local and x not in RECIPE and x not in ("SHA256SUMS", "README.md", ".gitattributes"))
124
+ bad += [(x, "SEPARATION") for x in separation_errors(kind, list(remote))]
125
+ print(json.dumps({"repo": repo, "checked": len(local), "bad": bad, "unexpected_remote_files": stale,
126
+ "result": "PASS" if not bad and not stale else "FAIL"}))
127
+ sys.exit(0 if not bad and not stale else 1)
128
+ elif sys.argv[1] == "readme":
129
+ from huggingface_hub import HfApi
130
+ HfApi().upload_file(path_or_fileobj=sys.argv[3], path_in_repo="README.md", repo_id=repo, repo_type="model",
131
+ commit_message="Model card: measured results, reproduction, known issues")
132
+ print("README_DONE", repo)
recipe/pipeline/kld_control.sh ADDED
@@ -0,0 +1,45 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/bin/bash
2
+ # The 4-bit in-file-MTP files did not reproduce the graded per-chunk rows (Q8 AGENT did).
3
+ # C1: determinism control - re-run the grading command on the ORIGINAL graded 4-bit files; do they reproduce themselves?
4
+ # C2: full 40-chunk grade of the shipped in-file STRIX_LEAN file, to measure the real size of any difference.
5
+ set -uo pipefail
6
+ W=/mnt/models/agnes-3.0-flash; B=/opt/llama-rocm/rocmfpx-724/build-hipvk/bin; N=Agnes-3.0-Flash-Preview; cd $W
7
+ export LD_LIBRARY_PATH=$B:/opt/rocm-7.2.4/lib HSA_OVERRIDE_GFX_VERSION=11.5.1 GGML_HIP_ENABLE_UNIFIED_MEMORY=1
8
+ log(){ echo "[$(date -u +%FT%TZ)] $*"; }
9
+ rows(){
10
+ python3 - "$1" <<'EOF'
11
+ import sys
12
+ out = []
13
+ for l in open(sys.argv[1], errors="replace"):
14
+ t = l.split()
15
+ if len(t) > 2 and t[0].isdigit() and l.rstrip().endswith("%") and l.count("%") == 2:
16
+ out.append(" ".join(t))
17
+ if len(out) == 4:
18
+ break
19
+ print("\n".join(out))
20
+ EOF
21
+ }
22
+ until grep -q '"tag":"q102i"' results/trunk_receipt.jsonl 2>/dev/null; do sleep 15; done
23
+ log "receipts done; starting controls"
24
+ ctl(){ # $1 label $2 file $3 reference log
25
+ local L=logs/K_$1.log
26
+ $B/llama-perplexity -m "$2" --kl-divergence-base kld/bf16.kld --kl-divergence -c 2048 -b 2048 \
27
+ -ngl 999 -fa on -dio -dev ROCm0 > $L 2>&1 &
28
+ local pid=$!
29
+ for i in $(seq 1 900); do [ "$(rows $L | grep -c .)" -ge 4 ] && break; kill -0 $pid 2>/dev/null || break; sleep 1; done
30
+ kill $pid 2>/dev/null; wait $pid 2>/dev/null
31
+ local a b v
32
+ a=$(rows $L); b=$(rows $3)
33
+ if [ "$(printf '%s\n' "$a" | grep -c .)" -eq 4 ] && [ "$a" = "$b" ]; then v=MATCH; else v=MISMATCH; fi
34
+ echo "{\"label\":\"$1\",\"file\":\"$(basename "$2")\",\"reference\":\"$(basename "$3")\",\"result\":\"$v\"}" | tee -a results/kld_control.jsonl
35
+ }
36
+ ctl c1-old-q106 out/$N-Q4_0_ROCMFP4_STRIX_LEAN.gguf logs/B5_kld_q106.log
37
+ ctl c1-old-q102 out/$N-Q4_0_ROCMFP4_COHERENT.gguf logs/B5_kld_q102.log
38
+ ctl c1-new-q106-again out-mtp/$N-MTP-Q4_0_ROCMFP4_STRIX_LEAN.gguf logs/R_kld4_q106.log
39
+ log "C2 full grade of the shipped in-file STRIX_LEAN"
40
+ $B/llama-perplexity -m out-mtp/$N-MTP-Q4_0_ROCMFP4_STRIX_LEAN.gguf --kl-divergence-base kld/bf16.kld --kl-divergence \
41
+ -c 2048 -b 2048 -ngl 999 -fa on -dio -dev ROCm0 > logs/K_full_new_q106.log 2>&1
42
+ log "C2 exit=$?"
43
+ grep -E "Mean PPL\(Q\)|Mean +KLD|Same top p|99.0%" logs/K_full_new_q106.log
44
+ echo "--- graded (old file) ---"; grep -E "Mean PPL\(Q\)|Mean +KLD|Same top p|99.0%" logs/B5_kld_q106.log
45
+ log "KLD_CONTROL_DONE"
recipe/pipeline/mtp_bake.sh ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/bin/bash
2
+ # Shrink: bake the MTP layer INTO each tier (shares the trunk's embeddings/output) instead of a separate 1.9 GiB head.
3
+ set -euo pipefail
4
+ W=/mnt/models/agnes-3.0-flash; T=/opt/llama-rocm/rocmfpx-724; B=$T/build-hipvk/bin; N=Agnes-3.0-Flash-Preview
5
+ export LD_LIBRARY_PATH=$B:/opt/rocm-7.2.4/lib TMPDIR=/mnt/models/.tmp PYTHONUNBUFFERED=1
6
+ cd $W; mkdir -p out-mtp out-mtp-imat logs
7
+ log(){ echo "[$(date -u +%FT%TZ)] $*"; }
8
+ cap(){ systemd-run --scope --quiet -p MemoryMax=24G -p MemorySwapMax=0 "$@"; }
9
+ log "S1 convert trunk WITH MTP layer (converter default)"
10
+ cap python3 $T/convert_hf_to_gguf.py qwen35 --outtype bf16 --model-name "$N" --outfile gguf/$N-MTP-BF16.gguf > logs/S1_conv_mtp_trunk.log 2>&1
11
+ python3 readback.py - - gguf/$N-MTP-BF16.gguf | tee logs/S_readback.log
12
+ BF=gguf/$N-MTP-BF16.gguf; Q="cap $B/llama-quantize"
13
+ log "S2 standard tiers"
14
+ $Q --output-tensor-type q6_K $BF out-mtp/$N-MTP-Q4_0_ROCMFP4_STRIX_LEAN.gguf Q4_0_ROCMFP4_STRIX_LEAN 16 > logs/S2_q106.log 2>&1
15
+ $Q --output-tensor-type q6_K --token-embedding-type q6_K $BF out-mtp/$N-MTP-Q4_0_ROCMFP4_COHERENT.gguf Q4_0_ROCMFP4_COHERENT 16 > logs/S2_q102.log 2>&1
16
+ $Q --output-tensor-type q8_0 --token-embedding-type q8_0 $BF out-mtp/$N-MTP-Q8_0_ROCMFPX_AGENT.gguf Q8_0_ROCMFPX_AGENT 16 > logs/S2_q115.log 2>&1
17
+ $Q --output-tensor-type q8_0 --token-embedding-type q8_0 $BF out-mtp/$N-MTP-Q8_0_ROCMFPX.gguf Q8_0_ROCMFPX 16 > logs/S2_q111.log 2>&1
18
+ log "S3 imatrix tiers (MTP layer has no imatrix data: it never runs in the forward pass -> unweighted path for blk.72 only)"
19
+ $Q --imatrix imat/$N.imatrix --output-tensor-type q6_K $BF out-mtp-imat/$N-MTP-imatrix-Q4_0_ROCMFP4_STRIX_LEAN.gguf Q4_0_ROCMFP4_STRIX_LEAN 16 > logs/S3_q106i.log 2>&1
20
+ $Q --imatrix imat/$N.imatrix --output-tensor-type q6_K --token-embedding-type q6_K $BF out-mtp-imat/$N-MTP-imatrix-Q4_0_ROCMFP4_COHERENT.gguf Q4_0_ROCMFP4_COHERENT 16 > logs/S3_q102i.log 2>&1
21
+ log "S4 read-back (head protection) + trunk identity vs the graded builds"
22
+ for pair in "Q6_K Q5_K out-mtp/$N-MTP-Q4_0_ROCMFP4_STRIX_LEAN.gguf out/$N-Q4_0_ROCMFP4_STRIX_LEAN.gguf" \
23
+ "Q6_K Q6_K out-mtp/$N-MTP-Q4_0_ROCMFP4_COHERENT.gguf out/$N-Q4_0_ROCMFP4_COHERENT.gguf" \
24
+ "Q8_0 Q8_0 out-mtp/$N-MTP-Q8_0_ROCMFPX_AGENT.gguf out/$N-Q8_0_ROCMFPX_AGENT.gguf" \
25
+ "Q8_0 Q8_0 out-mtp/$N-MTP-Q8_0_ROCMFPX.gguf out/$N-Q8_0_ROCMFPX.gguf" \
26
+ "Q6_K Q5_K out-mtp-imat/$N-MTP-imatrix-Q4_0_ROCMFP4_STRIX_LEAN.gguf out-imat/$N-imatrix-Q4_0_ROCMFP4_STRIX_LEAN.gguf" \
27
+ "Q6_K Q6_K out-mtp-imat/$N-MTP-imatrix-Q4_0_ROCMFP4_COHERENT.gguf out-imat/$N-imatrix-Q4_0_ROCMFP4_COHERENT.gguf"; do
28
+ set -- $pair
29
+ python3 readback.py $1 $2 $3 | tee -a logs/S_readback.log
30
+ echo "$(basename $3) $(python3 tensor_identity.py $4 $3 || true)" | tee -a logs/S_identity.log
31
+ done
32
+ for l in S2_q106 S2_q102 S2_q115 S2_q111 S3_q106i S3_q102i; do printf "%-10s " $l; grep -oE "quant size\s*=\s*[0-9.]+ MiB \([0-9.]+ BPW\)" logs/$l.log; done | tee -a logs/S_sizes.log
33
+ log "SHRINK_DONE"
recipe/pipeline/mtpcache_build.sh ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/bin/bash
2
+ # Cache fix: build a PATCHED llama-server from d3ca537 in a SEPARATE clone. The live tree is never touched.
3
+ set -uo pipefail
4
+ SRC=/opt/llama-rocm/rocmfpx-724
5
+ NEW=/opt/llama-rocm/rocmfpx-724-mtpcache
6
+ BASE=d3ca53726109b46fd5cd6fa42f688c707079b44e
7
+ W=/mnt/models/agnes-3.0-flash; PATCH=$W/mtpfix/mtp-prompt-cache-fix.patch; L=$W/logs
8
+ log(){ echo "[$(date -u +%FT%TZ)] $*"; }
9
+ [ "$(git -C $SRC rev-parse HEAD)" = "$BASE" ] || { log "live tree is not at $BASE"; exit 1; }
10
+ log "P0 separate clone at $BASE (hardlinked objects; live tree untouched)"
11
+ if [ ! -d $NEW/.git ]; then git clone -q --no-checkout $SRC $NEW && git -C $NEW checkout -q $BASE; fi
12
+ [ "$(git -C $NEW rev-parse HEAD)" = "$BASE" ] || { log "clone not at base"; exit 1; }
13
+ [ -z "$(git -C $NEW status --porcelain)" ] || { log "clone not clean before patching"; exit 1; }
14
+ log "P1 patch applicability"
15
+ if git -C $NEW apply --check -v $PATCH > $L/P1_apply_check.log 2>&1; then
16
+ git -C $NEW apply $PATCH && log " applied CLEANLY"
17
+ elif patch -d $NEW -p1 --dry-run --fuzz=2 < $PATCH > $L/P1_patch_fuzz.log 2>&1; then
18
+ patch -d $NEW -p1 --fuzz=2 < $PATCH > $L/P1_patch_apply.log 2>&1 && log " applied WITH FUZZ (see P1_patch_apply.log)"
19
+ grep -iE "fuzz|offset" $L/P1_patch_apply.log | head
20
+ else
21
+ log " PATCH DOES NOT APPLY -> needs a manual port (P1 logs)"; echo PORT_NEEDED; exit 3
22
+ fi
23
+ git -C $NEW diff --stat | tail -6
24
+ ( cd $NEW && git diff ) > $L/P1_applied.diff
25
+ sha256sum $PATCH | tee $L/P1_patch.sha256
26
+ log "P2 configure from the ORIGINAL build's CMakeCache (same flags)"
27
+ IC=$L/P2_initial_cache.cmake; : > $IC
28
+ grep -E '^(GGML_[A-Z0-9_]+|LLAMA_[A-Z0-9_]+|AMDGPU_TARGETS|GPU_TARGETS|CMAKE_BUILD_TYPE|CMAKE_HIP_COMPILER|CMAKE_C_COMPILER|CMAKE_CXX_COMPILER|CMAKE_HIP_ARCHITECTURES):[A-Z]+=' \
29
+ $SRC/build-hipvk/CMakeCache.txt | grep -v ':INTERNAL=' | while IFS= read -r line; do
30
+ key=${line%%:*}; rest=${line#*:}; typ=${rest%%=*}; val=${rest#*=}
31
+ [ "$typ" = "UNINITIALIZED" ] && typ=STRING
32
+ printf 'set(%s "%s" CACHE %s "")\n' "$key" "$val" "$typ" >> $IC
33
+ done
34
+ wc -l < $IC | sed 's/^/ cache entries: /'
35
+ cmake -S $NEW -B $NEW/build-hipvk -G "Unix Makefiles" -DCMAKE_MAKE_PROGRAM=/usr/bin/gmake -C $IC > $L/P2_configure.log 2>&1 \
36
+ || { log "configure FAILED"; tail -20 $L/P2_configure.log; exit 4; }
37
+ log "P3 build llama-server (+ deps)"
38
+ cmake --build $NEW/build-hipvk --target llama-server -j "${JOBS:-28}" > $L/P3_build.log 2>&1 || { log "build FAILED"; tail -25 $L/P3_build.log; exit 5; }
39
+ BIN=$NEW/build-hipvk/bin
40
+ LD_LIBRARY_PATH=$BIN:/opt/rocm-7.2.4/lib $BIN/llama-server --version 2>&1 | tail -3
41
+ LD_LIBRARY_PATH=$BIN:/opt/rocm-7.2.4/lib HSA_OVERRIDE_GFX_VERSION=11.5.1 $BIN/llama-server --list-devices 2>&1 | grep -E "ROCm0|Vulkan0"
42
+ sha256sum $BIN/llama-server | tee $L/P3_server.sha256
43
+ log "MTPCACHE_BUILD_DONE"
recipe/pipeline/phase_a.sh ADDED
@@ -0,0 +1,67 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/bin/bash
2
+ # Agnes-3.0-Flash Preview -- Phase A (no GPU, no seat disruption). Every stage is gated.
3
+ set -euo pipefail
4
+ W=/mnt/models/agnes-3.0-flash
5
+ T=/opt/llama-rocm/rocmfpx-724
6
+ B=$T/build-hipvk/bin
7
+ REV=891ce4f9ffb89b22888aa7fcc2bb2f3618867684
8
+ N=Agnes-3.0-Flash-Preview
9
+ export LD_LIBRARY_PATH=$B:/opt/rocm-7.2.4/lib TMPDIR=/mnt/models/.tmp PYTHONUNBUFFERED=1
10
+ cd "$W"; mkdir -p gguf out logs
11
+ log(){ echo "[$(date -u +%FT%TZ)] $*"; }
12
+ cap(){ systemd-run --scope --quiet -p MemoryMax=20G -p MemorySwapMax=0 "$@"; }
13
+
14
+ log "A0 wait for download"
15
+ until grep -q "DONE_RC=" dl.log; do sleep 30; done
16
+ grep -q "DONE_RC=0" dl.log || { log "A0 FAIL download"; exit 1; }
17
+
18
+ log "A1 verify download (size + lfs sha256)"
19
+ python3 verify_download.py Agnes-AI/Agnes-3.0-Flash "$REV" hf > logs/A1_verify_download.log 2>&1
20
+ tail -2 logs/A1_verify_download.log
21
+
22
+ log "A2 fold -> qwen35"
23
+ python3 fold_agnes.py hf qwen35 > logs/A2_fold.log 2>&1
24
+ tail -1 logs/A2_fold.log | cut -c1-300
25
+
26
+ log "A3 verify fold (bit-exact + forward equivalence)"
27
+ python3 verify_fold.py hf qwen35 > logs/A3_verify_fold.log 2>&1
28
+ grep -E "^G[0-9]|RESULT" logs/A3_verify_fold.log
29
+
30
+ log "A4 convert trunk BF16 (no MTP)"
31
+ cap python3 $T/convert_hf_to_gguf.py qwen35 --outtype bf16 --no-mtp --model-name "$N" \
32
+ --outfile gguf/$N-BF16.gguf > logs/A4_conv_trunk.log 2>&1
33
+ log "A5 convert MTP head BF16"
34
+ cap python3 $T/convert_hf_to_gguf.py qwen35 --outtype bf16 --mtp --model-name "$N" \
35
+ --outfile gguf/mtp-$N-BF16.gguf > logs/A5_conv_mtp.log 2>&1
36
+ log "A6 convert vision mmproj BF16"
37
+ cap python3 $T/convert_hf_to_gguf.py qwen35 --outtype bf16 --mmproj --model-name "$N" \
38
+ --outfile gguf/mmproj-$N-BF16.gguf > logs/A6_conv_mmproj.log 2>&1
39
+ ls -la gguf/
40
+
41
+ log "A7 read-back BF16 artifacts"
42
+ python3 readback.py - - gguf/$N-BF16.gguf | tee -a logs/A7_readback.log
43
+ python3 readback.py - - gguf/mtp-$N-BF16.gguf | tee -a logs/A7_readback.log
44
+
45
+ BF=gguf/$N-BF16.gguf
46
+ q(){ cap $B/llama-quantize "$@"; }
47
+ log "A8 quantize STRIX_LEAN (106, head q6_K, embd stays Q5_K)"
48
+ q --output-tensor-type q6_K $BF out/$N-Q4_0_ROCMFP4_STRIX_LEAN.gguf Q4_0_ROCMFP4_STRIX_LEAN 16 > logs/A8_q106.log 2>&1
49
+ python3 readback.py Q6_K Q5_K out/$N-Q4_0_ROCMFP4_STRIX_LEAN.gguf | tee -a logs/A7_readback.log
50
+ log "A9 quantize COHERENT (102, head+embd q6_K)"
51
+ q --output-tensor-type q6_K --token-embedding-type q6_K $BF out/$N-Q4_0_ROCMFP4_COHERENT.gguf Q4_0_ROCMFP4_COHERENT 16 > logs/A9_q102.log 2>&1
52
+ python3 readback.py Q6_K Q6_K out/$N-Q4_0_ROCMFP4_COHERENT.gguf | tee -a logs/A7_readback.log
53
+ log "A10 quantize Q8 AGENT (115, q8_0 head+embd)"
54
+ q --output-tensor-type q8_0 --token-embedding-type q8_0 $BF out/$N-Q8_0_ROCMFPX_AGENT.gguf Q8_0_ROCMFPX_AGENT 16 > logs/A10_q115.log 2>&1
55
+ python3 readback.py Q8_0 Q8_0 out/$N-Q8_0_ROCMFPX_AGENT.gguf | tee -a logs/A7_readback.log
56
+ log "A11 quantize Q8 plain (111, q8_0 head+embd)"
57
+ q --output-tensor-type q8_0 --token-embedding-type q8_0 $BF out/$N-Q8_0_ROCMFPX.gguf Q8_0_ROCMFPX 16 > logs/A11_q111.log 2>&1
58
+ python3 readback.py Q8_0 Q8_0 out/$N-Q8_0_ROCMFPX.gguf | tee -a logs/A7_readback.log
59
+ log "A12 MTP draft heads (Q4_0 beats Q8_0 on this family -- ship both)"
60
+ q gguf/mtp-$N-BF16.gguf out/mtp-$N-Q4_0.gguf Q4_0 16 > logs/A12_mtp_q4.log 2>&1
61
+ q gguf/mtp-$N-BF16.gguf out/mtp-$N-Q8_0.gguf Q8_0 16 > logs/A12_mtp_q8.log 2>&1
62
+ python3 readback.py - - out/mtp-$N-Q4_0.gguf | tee -a logs/A7_readback.log
63
+ python3 readback.py - - out/mtp-$N-Q8_0.gguf | tee -a logs/A7_readback.log
64
+ cp gguf/mmproj-$N-BF16.gguf out/
65
+ ( cd out && sha256sum *.gguf > SHA256SUMS )
66
+ ls -la out/
67
+ log "PHASE_A_DONE"
recipe/pipeline/readback.py ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env python3
2
+ """Exact-name read-back gate: the built file is the receipt, not the ftype name.
3
+ usage: readback.py <expect_output> <expect_embd> <file.gguf> (use '-' to skip a check)"""
4
+ import sys
5
+ sys.path.insert(0, "/opt/llama-rocm/rocmfpx-724/gguf-py")
6
+ import gguf
7
+ exp_out, exp_emb, path = sys.argv[1:4]
8
+ r = gguf.GGUFReader(path)
9
+ def tname(t):
10
+ try: return t.tensor_type.name
11
+ except Exception: return f"TYPE_{int(t.tensor_type)}"
12
+ ty = {t.name: tname(t) for t in r.tensors}
13
+ f = r.fields.get("general.file_type")
14
+ ftype = int(f.parts[f.data[0]][0]) if f else None
15
+ arch = bytes(r.fields["general.architecture"].parts[-1]).decode()
16
+ nextn = sum(".nextn." in k for k in ty)
17
+ out, emb = ty.get("output.weight"), ty.get("token_embd.weight")
18
+ ok = (exp_out == "-" or out == exp_out) and (exp_emb == "-" or emb == exp_emb)
19
+ print(f"{'PASS' if ok else 'FAIL'} {path.split('/')[-1]} arch={arch} ftype={ftype} tensors={len(ty)} nextn={nextn} "
20
+ f"output.weight={out} token_embd.weight={emb}")
21
+ sys.exit(0 if ok else 1)
recipe/pipeline/regrade.sh ADDED
@@ -0,0 +1,60 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/bin/bash
2
+ # Re-grade on the SHIPPED files in the current machine state. The afternoon (pre-reboot) 4-bit grades do not reproduce
3
+ # today, while today's runs reproduce each other exactly and the in-file files compute identically to the trunk-only
4
+ # files. R1 tests whether concurrent CPU load (present during the afternoon grading) changes 4-bit results.
5
+ set -uo pipefail
6
+ W=/mnt/models/agnes-3.0-flash; B=/opt/llama-rocm/rocmfpx-724/build-hipvk/bin; N=Agnes-3.0-Flash-Preview; cd $W
7
+ export LD_LIBRARY_PATH=$B:/opt/rocm-7.2.4/lib HSA_OVERRIDE_GFX_VERSION=11.5.1 GGML_HIP_ENABLE_UNIFIED_MEMORY=1
8
+ log(){ echo "[$(date -u +%FT%TZ)] $*"; }
9
+ J=results/regrade.jsonl
10
+ table(){ # all complete per-chunk rows of a KLD log (limit $2)
11
+ python3 - "$1" "${2:-999}" <<'EOF'
12
+ import sys
13
+ out = []
14
+ for l in open(sys.argv[1], errors="replace"):
15
+ t = l.split()
16
+ if len(t) > 2 and t[0].isdigit() and l.rstrip().endswith("%") and l.count("%") == 2:
17
+ out.append(" ".join(t))
18
+ if len(out) == int(sys.argv[2]):
19
+ break
20
+ print("\n".join(out))
21
+ EOF
22
+ }
23
+ until grep -q KLD_CONTROL_DONE logs/kld_control.log 2>/dev/null && grep -q TRUNK_RECEIPT_DONE logs/trunk_receipt.log 2>/dev/null; do sleep 20; done
24
+ log "GPU free of the verification jobs"
25
+ PPL="$B/llama-perplexity -c 2048 -b 2048 -ngl 999 -fa on -dio -dev ROCm0"
26
+
27
+ log "R1 old q106, first 4 rows, under a 16-thread CPU burn (the afternoon grading ran next to CPU quantization)"
28
+ mkdir -p /mnt/models/.tmp
29
+ ( exec $B/llama-quantize --output-tensor-type q6_K gguf/$N-BF16.gguf /mnt/models/.tmp/r1_burn.gguf Q4_0_ROCMFP4_STRIX_LEAN 16 ) > logs/R1_burn.log 2>&1 &
30
+ bp=$!; sleep 30
31
+ L=logs/R1_kld4_old_q106_cpuburn.log
32
+ $PPL -m out/$N-Q4_0_ROCMFP4_STRIX_LEAN.gguf --kl-divergence-base kld/bf16.kld --kl-divergence > $L 2>&1 &
33
+ kp=$!
34
+ for i in $(seq 1 900); do [ "$(table $L 4 | grep -c .)" -ge 4 ] && break; kill -0 $kp 2>/dev/null || break; sleep 1; done
35
+ kill $kp 2>/dev/null; wait $kp 2>/dev/null; kill $bp 2>/dev/null; wait $bp 2>/dev/null; rm -f /mnt/models/.tmp/r1_burn.gguf
36
+ a=$(table $L 4); u=$(table logs/K_c1-old-q106.log 4); g=$(table logs/B5_kld_q106.log 4)
37
+ v=$( [ "$a" = "$u" ] && echo SAME_AS_TODAY || { [ "$a" = "$g" ] && echo SAME_AS_AFTERNOON || echo DIFFERENT_FROM_BOTH; } )
38
+ echo "{\"step\":\"R1\",\"burn_seen\":$(grep -c 'quantize' logs/R1_burn.log),\"result\":\"$v\"}" | tee -a $J
39
+
40
+ log "R2 BF16 perplexity + fresh base logits"
41
+ $PPL -m gguf/$N-BF16.gguf -f calib/wikitext-2-raw/wiki.test.raw --chunks 40 --kl-divergence-base kld/bf16_r2.kld \
42
+ > logs/R2_ppl_bf16.log 2>&1; log "R2 exit=$?"
43
+ grep -E "Final estimate" logs/R2_ppl_bf16.log; echo "afternoon:"; grep -E "Final estimate" logs/B1_ppl_bf16.log
44
+ cmp -s kld/bf16.kld kld/bf16_r2.kld && r2=IDENTICAL_BASE_LOGITS || r2=DIFFERENT_BASE_LOGITS
45
+ echo "{\"step\":\"R2\",\"base_logits_vs_afternoon\":\"$r2\"}" | tee -a $J
46
+
47
+ log "R3 grade every shipped file against the fresh base"
48
+ for pair in "q106 out-mtp/$N-MTP-Q4_0_ROCMFP4_STRIX_LEAN.gguf" "q102 out-mtp/$N-MTP-Q4_0_ROCMFP4_COHERENT.gguf" \
49
+ "q106i out-mtp-imat/$N-MTP-imatrix-Q4_0_ROCMFP4_STRIX_LEAN.gguf" "q102i out-mtp-imat/$N-MTP-imatrix-Q4_0_ROCMFP4_COHERENT.gguf" \
50
+ "q115 out-mtp/$N-MTP-Q8_0_ROCMFPX_AGENT.gguf" "q111 out-mtp/$N-MTP-Q8_0_ROCMFPX.gguf"; do
51
+ set -- $pair
52
+ $PPL -m $2 --kl-divergence-base kld/bf16_r2.kld --kl-divergence > logs/R3_kld_$1.log 2>&1
53
+ echo " $1 exit=$? $(grep -E 'Mean +KLD' logs/R3_kld_$1.log | tr -s ' ')"
54
+ done
55
+
56
+ log "R4 repeat the STRIX_LEAN grade; every per-chunk row must match R3"
57
+ $PPL -m out-mtp/$N-MTP-Q4_0_ROCMFP4_STRIX_LEAN.gguf --kl-divergence-base kld/bf16_r2.kld --kl-divergence > logs/R4_kld_q106_repeat.log 2>&1
58
+ a=$(table logs/R4_kld_q106_repeat.log); b=$(table logs/R3_kld_q106.log); n=$(printf '%s\n' "$a" | grep -c .)
59
+ echo "{\"step\":\"R4\",\"rows\":$n,\"result\":\"$( [ "$n" -eq 40 ] && [ "$a" = "$b" ] && echo MATCH || echo MISMATCH )\"}" | tee -a $J
60
+ log "REGRADE_DONE"
recipe/pipeline/render_cards_v2.py ADDED
@@ -0,0 +1,744 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env python3
2
+ """Render both HF cards (in-file-MTP layout) from summary_v2.json + judgments_v2.json. Every number comes from the
3
+ summary; absent => '—'. Judgment prose lives in judge_v2.py and only ever references computed values.
4
+ usage: render_cards_v2.py <summary_v2.json> <outdir> <judgments_v2.json> <SHA256SUMS_std> <SHA256SUMS_imat> <staged_sizes.json>"""
5
+ import json, math, os, statistics, sys
6
+
7
+ S = json.load(open(sys.argv[1])); OUT = sys.argv[2]; os.makedirs(OUT, exist_ok=True)
8
+ JUDGE = json.load(open(sys.argv[3]))
9
+ SUMS = {}
10
+ for sf in sys.argv[4:6]:
11
+ if os.path.exists(sf):
12
+ for line in open(sf):
13
+ h, fn = line.split(maxsplit=1); SUMS[fn.strip()] = h
14
+ SIZES = json.load(open(sys.argv[6])) if len(sys.argv) > 6 and os.path.exists(sys.argv[6]) else {}
15
+ N = S["model"]; STD, IMAT = S["model_repo_std"], S["model_repo_imat"]
16
+ T = S["tiers"]; H = S.get("history_separate_head", {}); B = S["binary"]
17
+ GiB, MiB = 1024 ** 3, 1024 ** 2
18
+ UB = 1024
19
+
20
+
21
+ def g(v, fmt="{:.2f}"): return "—" if v is None else fmt.format(v)
22
+ def gib(b): return g(None if b is None else b / GiB, "{:.2f} GiB")
23
+ def pm(v, e, fmt="{:.4f}"): return "—" if v is None else (fmt.format(v) + ("" if e is None else " ± " + fmt.format(e)))
24
+ def bench(label): return next((x for x in S["bench"] if x["label"] == label), None)
25
+ def hbench(label): return next((x for x in H.get("bench", []) if x["label"] == label), None)
26
+ def tg(label):
27
+ x = bench(label); return None if x is None else x.get("tg_median")
28
+ def gate(label): return next((x for x in S["gates"] if x.get("label") == label), None)
29
+ def J(k): return JUDGE.get(k, f"**[JUDGMENT PENDING: {k}]**")
30
+ def Jopt(k): return JUDGE.get(k, "")
31
+ def speed_label(tag, dev): return f"p-infile-{dev}-n4" if tag == "q106" else f"t-{tag}-{dev}-n4"
32
+
33
+
34
+ NAMES = {"q106": "Q4_0_ROCMFP4_STRIX_LEAN", "q102": "Q4_0_ROCMFP4_COHERENT", "q115": "Q8_0_ROCMFPX_AGENT",
35
+ "q111": "Q8_0_ROCMFPX", "q106i": "Q4_0_ROCMFP4_STRIX_LEAN", "q102i": "Q4_0_ROCMFP4_COHERENT"}
36
+
37
+
38
+ def tier_row(tag):
39
+ t = T[tag]; ratio = t.get("ppl_ratio")
40
+ r = [f"`{t['file']}`", str(t["ftype"]), gib(t["size_bytes"]), g(t["bpw"]), pm(t["kld_mean"], t["kld_err"]),
41
+ g(t["same_top_p"], "{:.2f} %"), pm(t["ppl"], t["ppl_err"]) + ("" if ratio is None else f" (×{ratio:.4f})"),
42
+ g(tg(speed_label(tag, "rocm"))), g(tg(speed_label(tag, "vk")))]
43
+ return "| " + " | ".join(r) + " |"
44
+
45
+
46
+ PROTOCOL = ("Ryzen AI Max+ 395 (MAX-1), ROCm 7.2.4, patched `llama-server` (see [Quick start](#quick-start)), `-c 65536`, "
47
+ "batch 1, greedy (`temp 0`, `top_k 1`), `ignore_eos` so every arm generates exactly 256 tokens after a ~7.1K-token "
48
+ "prompt, a unique nonce per request and `cache_prompt: false` (`cache_n = 0` asserted on every timed request), "
49
+ "1 warm-up then the median of 3. Decode numbers are the server's own `predicted_per_second`. Box iced: no other "
50
+ "model loaded.")
51
+ QUALITY = ("Quality is graded against the **BF16 GGUF** on a **held-out** corpus (wikitext-2 *test*, `-c 2048`, "
52
+ f"{S['bf16']['chunks']} chunks × {S['bf16']['n_ctx'] // 2 - 1:,} scored tokens each — the second half of every window, less its first token — = "
53
+ f"{S['bf16']['scored_tokens']:,}), never on the imatrix calibration text. **KLD** is the per-token KL divergence of each "
54
+ "quant's next-token distribution from BF16's on the same tokens — far more sensitive than perplexity, whose error bar "
55
+ "here is wider than most of the differences.")
56
+ TABLE_HEAD = ("| File | ftype | Size | BPW | KLD vs BF16 ↓² | Same top-1 ↑ | PPL (× BF16) | TG MTP ROCm0 | TG MTP Vulkan0 |\n"
57
+ "| --- | ---: | ---: | ---: | ---: | ---: | ---: | ---: | ---: |")
58
+ TG_NOTE = ("TG = decode tokens/s after a ~7.1K-token prompt, in-file MTP head, `--spec-draft-n-max 4`, default "
59
+ "(non-strict) verification.")
60
+
61
+
62
+ def repro(model_file, label):
63
+ b = bench(label)
64
+ o, p = B["original"]["sha256"], B["patched"]
65
+ return f"""```
66
+ server : {B['repo']} @ {B['commit']}
67
+ + {p['patch_file']} (sha256 {p['patch_sha256']}), applied {p['applied'] or '—'}
68
+ built target llama-server with the same CMake options as below; sha256 {p['sha256']['llama-server']}
69
+ tools : same commit, unpatched (quantize / imatrix / perplexity; the patch touches only common/ and tools/server/)
70
+ build dir /opt/llama-rocm/rocmfpx-724/build-hipvk, Release, Unix Makefiles, GGML_HIP=ON GGML_VULKAN=ON
71
+ GGML_HIP_GRAPHS=ON GGML_HIP_NO_VMM=ON GGML_NATIVE=ON AMDGPU_TARGETS=gfx1151 LLAMA_CURL=OFF
72
+ (this CMake forwards AMDGPU_TARGETS to GPU_TARGETS, the spelling used in Quick start)
73
+ CMAKE_HIP_COMPILER=/opt/rocm-7.2.4/lib/llvm/bin/clang
74
+ sha256 llama-quantize {o['llama-quantize']}
75
+ sha256 llama-imatrix {o['llama-imatrix']}
76
+ sha256 llama-perplexity {o['llama-perplexity']}
77
+ sha256 llama-server {o['llama-server']} (unpatched; used for the unpatched control rows: prompt cache and vision)
78
+ source : {S['source']['repo']} revision {S['source']['revision']}
79
+ folded with recipe/fold_agnes.py (sha256 {S['fold'].get('fold_script_sha256', '—')})
80
+ model : {model_file}
81
+ argv : {b['cmd'] if b else '—'}
82
+ env : LD_LIBRARY_PATH=<patched build>/bin:/opt/rocm-7.2.4/lib
83
+ HSA_OVERRIDE_GFX_VERSION=11.5.1 GGML_HIP_ENABLE_UNIFIED_MEMORY=1
84
+ box : aimax — AMD Ryzen AI Max+ 395 / Radeon 8060S (gfx1151), 124 GiB, GTT 131072 MiB,
85
+ kernel 6.17.6-061706-generic, ROCm 7.2.4
86
+ power : no platform_profile interface on this box; cpufreq governor=performance, EPP=performance;
87
+ GPU measured 84-85 W at 95-100% busy under load
88
+ protocol : ~7.1K-token prompt, 256 generated tokens, temp 0 / top_k 1, ignore_eos, cache_prompt false,
89
+ 1 warm-up + median of 3, no co-resident models (box iced)
90
+ measured : 2026-09-16, by the pipeline in recipe/ (every raw number in recipe/results_summary.json and recipe/raw/)
91
+ ```"""
92
+
93
+
94
+ YAML = """---
95
+ license: apache-2.0
96
+ base_model: Agnes-AI/Agnes-3.0-Flash
97
+ base_model_relation: quantized
98
+ pipeline_tag: image-text-to-text
99
+ library_name: gguf
100
+ tags:
101
+ - gguf
102
+ - llama.cpp
103
+ - rocm
104
+ - amd
105
+ - rocmfp4
106
+ - rocmfpx
107
+ - strix-halo
108
+ - amd-strix-halo
109
+ - gfx1151
110
+ - ryzen-ai-max
111
+ - ryzen-ai-max-395
112
+ - radeon-8060s
113
+ - mtp
114
+ - speculative-decoding
115
+ - reasoning
116
+ - multimodal
117
+ - vision
118
+ - agnes
119
+ - qwen3.5
120
+ - quantized{extra}
121
+ ---
122
+ """
123
+
124
+
125
+ def spec_table():
126
+ rows = ["| Config | Decode tok/s (min–max) | Draft acceptance | Prefill tok/s |", "| --- | ---: | ---: | ---: |"]
127
+ spec = [("no draft head", "p-nospec-rocm", "p-nospec-vk"),
128
+ ("in-file MTP, `n-max 3`", "p-infile-rocm-n3", None),
129
+ ("in-file MTP, `n-max 4`", "p-infile-rocm-n4", "p-infile-vk-n4"),
130
+ ("in-file MTP, `n-max 5`", "p-infile-rocm-n5", None),
131
+ ("in-file MTP, `n-max 4`, `--spec-mtp-strict-qwen`", "p-infile-strict-rocm-n4", "p-infile-strict-vk-n4")]
132
+ for name, rl, vl in spec:
133
+ for dev, lab in (("ROCm0", rl), ("Vulkan0", vl)):
134
+ if lab is None: continue
135
+ b = bench(lab)
136
+ if b is None:
137
+ rows.append(f"| {dev} · {name} | — | — | — |"); continue
138
+ bold = "**" if lab == f"p-infile-rocm-n{S.get('knee')}" else ""
139
+ rows.append(f"| {dev} · {name} | {bold}{b['tg_median']:.2f}{bold} ({b['tg_min']:.2f}–{b['tg_max']:.2f}) | "
140
+ f"{g(b.get('accept'), '{:.3f}')} | {g(b.get('pp_median'), '{:.0f}')} |")
141
+ return "\n".join(rows)
142
+
143
+
144
+ def history_line():
145
+ rs = sorted([x for x in H.get("bench", []) if x["label"].startswith("sweep-rocm-n")], key=lambda x: x["nmax"])
146
+ if not rs: return ""
147
+ seq = ", ".join(f"{x['nmax']}: {x['tg_median']:.2f}" for x in rs)
148
+ return (f"An earlier, wider sweep with the separate head file (not shipped any more, unpatched server) found the same "
149
+ f"shape on ROCm0 — n-max {seq} tok/s, peak at n-max {H.get('knee')} — so the in-file check above only brackets that "
150
+ f"peak. Raw rows: `recipe/raw/separate_head_phase_b.jsonl`.")
151
+
152
+
153
+ def range_line():
154
+ c, p = bench("t-q106i-rocm-n4"), bench("p-infile-rocm-n4-prose")
155
+ if not c or not p: return ""
156
+ return (f"**Workload range** (imatrix STRIX_LEAN, ROCm0, n-max 4): code {c['tg_median']:.2f} tok/s (acceptance "
157
+ f"{g(c.get('accept'), '{:.3f}')}) · prose {p['tg_median']:.2f} tok/s (acceptance {g(p.get('accept'), '{:.3f}')}). "
158
+ "Speculative speed depends on how predictable the text is — quote a range, not a single number.")
159
+
160
+
161
+ def tools_block():
162
+ t = gate("tools-infile-patched")
163
+ if not t: return "_Not measured._"
164
+ names = ["multi-arg", "nested-object", "enum", "correct-decline", "multi-turn", "streaming", "parallel"]
165
+ rows = ["| check | thinking ON (`reasoning_effort: low`) | thinking OFF (`enable_thinking: false`) |",
166
+ "| --- | :---: | :---: |"]
167
+ for n in names:
168
+ a, b = t["detail"].get(f"{n}|think=True"), t["detail"].get(f"{n}|think=False")
169
+ mk = lambda x: "—" if x is None else ("✅" if x else "❌")
170
+ rows.append(f"| {n} | {mk(a)} | {mk(b)} |")
171
+ return (f"**{t['passed']}/{t['total']}** on native `tool_calls` (raw XML left in `content` counts as a failure), run on "
172
+ f"`{os.path.basename(T['q106i']['file'])}` with the in-file head on and the patched server.\n\n" + "\n".join(rows))
173
+
174
+
175
+ def vision_block():
176
+ order = [("vision-q106-infile", "MTP head, `-fa on` (quick start)"), ("vision-q106-infile-faoff", "MTP head, `-fa off`"),
177
+ ("vision-q106-nomtp", "no head, `-fa on`"), ("vision-q106-nomtp-faoff", "no head, `-fa off`")]
178
+ if not any(gate(k) for k, _ in order):
179
+ return "_Not measured on this layout._"
180
+ vp = S.get("vision_probe", {})
181
+ def cell(k):
182
+ x = gate(k)
183
+ if not x: return "—"
184
+ n = f"{len(x.get('hits', []))}/{len(x['expected'].split(','))}"
185
+ if x.get("result") == "PASS": return f"✅ {n}"
186
+ return "❌ " + ("server stopped" if x.get("server_died") else ("request failed" if x.get("error") else n))
187
+ rows = ["| MTP head | `-fa on` | `-fa off` |", "| --- | :---: | :---: |",
188
+ f"| loaded | {cell('vision-q106-infile')} | {cell('vision-q106-infile-faoff')} |",
189
+ f"| not loaded | {cell('vision-q106-nomtp')} | {cell('vision-q106-nomtp-faoff')} |"]
190
+ if gate("vision-q106-infile-unpatched"):
191
+ rows.append(f"| loaded, **unpatched** server (control) | {cell('vision-q106-infile-unpatched')} | — |")
192
+ txt = (f"Probe: a synthetic {vp.get('width', '—')}×{vp.get('height', '—')} image with a red circle and a blue square "
193
+ f"(a model that ignores the image cannot name both), sent to `{T['q106']['file']}` on the patched server with "
194
+ f"`--mmproj`, temperature 0. Pass = the reply names all four of `red`, `blue`, `circle`, `square`.\n\n"
195
+ + "\n".join(rows) + "\n\n" + J("vision_note"))
196
+ ans = next(((k, n) for k, n in order if gate(k) and gate(k).get("result") == "PASS"), None)
197
+ if ans:
198
+ a_ = gate(ans[0])["answer"].strip()
199
+ txt += f"\n\nReply ({ans[1]}):\n\n> {a_}" + (" …" if len(a_) >= 299 else "")
200
+ return txt
201
+
202
+
203
+ def head_table():
204
+ NM = {"q106": "STRIX_LEAN", "q102": "COHERENT", "q115": "Q8 AGENT", "q111": "Q8"}
205
+ rows = ["| Tier | Backend | separate head file: tok/s (acceptance) | built-in: tok/s (acceptance) | change |",
206
+ "| --- | --- | ---: | ---: | ---: |"]
207
+ have_any = False
208
+ for t in ("q106", "q102", "q115", "q111"):
209
+ for dev, dn in (("rocm", "ROCm0"), ("vk", "Vulkan0")):
210
+ o = hbench(f"sweep-{dev}-n4" if t == "q106" else f"tier-{t}-{dev}-n4")
211
+ n = bench(speed_label(t, dev))
212
+ if not (o and n):
213
+ rows.append(f"| {NM[t]} | {dn} | — | — | — |"); continue
214
+ have_any = True
215
+ rows.append(f"| {NM[t]} | {dn} | {o['tg_median']:.2f} ({g(o.get('accept'), '{:.3f}')}) | "
216
+ f"{n['tg_median']:.2f} ({g(n.get('accept'), '{:.3f}')}) | "
217
+ f"{(n['tg_median'] - o['tg_median']) / o['tg_median'] * 100:+.1f} % |")
218
+ return "\n".join(rows) if have_any else ""
219
+
220
+
221
+ def cache_table():
222
+ co = gate("c-orig-infile"); d = gate("c3-patched-infile"); n_ = gate("c3-patched-nospec")
223
+ rows = ["| server | draft head | second-turn prompt tokens reused | processed | warm reply = cold reply |",
224
+ "| --- | --- | ---: | ---: | :---: |"]
225
+ if co:
226
+ rows.append(f"| d3ca537, unpatched | in-file MTP | **{co['turn2_cache_n']}** of {co['turn2_prompt_n']:,} | "
227
+ f"{co['turn2_prompt_n']:,} | — |")
228
+ for lab, x, head in (("d3ca537 + patch", d, "in-file MTP"), ("d3ca537 + patch", gate("c3-patched-infile-strict"),
229
+ "in-file MTP, strict"),
230
+ ("d3ca537 + patch", n_, "none (control)")):
231
+ if not x: continue
232
+ rows.append(f"| {lab} | {head} | **{x['expect_cache_n']:,}** of {x['L']:,} (all {x['n']} exchanges) | "
233
+ f"{x['L'] - x['expect_cache_n']:,} | {x['identical']}/{x['n']} |")
234
+ return "\n".join(rows)
235
+
236
+
237
+ def patch_block():
238
+ p = B["patched"]
239
+ ds = "\n".join(f" {x}" for x in p.get("diffstat", []))
240
+ return f"""`recipe/patches/mtp-prompt-cache-fix.patch` (from [kingjones777/Qwen3.8-27B-ROCmFP4-STRIX-MTP-GGUF](https://huggingface.co/kingjones777/Qwen3.8-27B-ROCmFP4-STRIX-MTP-GGUF),
241
+ sha256 `{p['patch_sha256']}`) applies to `d3ca537` **{'cleanly' if p['applied'] else '— (not verified)'}** (`git apply --check`):
242
+
243
+ ```
244
+ {ds}
245
+ ```
246
+
247
+ The MTP head's state between steps is the target model's hidden row at the cached prompt's exact end position. The
248
+ unpatched server cannot rebuild that row for a shorter common prefix, so it refuses partial reuse and reprocesses the
249
+ whole prompt. The patch stores the row **inside each context checkpoint** (`common_prompt_checkpoint::data_spec`),
250
+ captured at the same moment as the checkpoint's KV state, and on a partial-prefix hit restores the newest checkpoint at
251
+ or before the common prefix — target state, draft state and MTP row together. If no such checkpoint exists it logs
252
+ `reason=spec-checkpoint-missing` and reprocesses cold. The token-generation path is not modified."""
253
+
254
+
255
+ def files_table(names):
256
+ rows = ["| File | Size | sha256 |", "| --- | ---: | --- |"]
257
+ for fn, size in names:
258
+ size = SIZES.get(fn, size)
259
+ sz = "—" if size is None else (gib(size) if size >= GiB // 10 else f"{size / MiB:.1f} MiB")
260
+ rows.append(f"| `{fn}` | {sz} | `{SUMS.get(fn, '—')}` |")
261
+ return "\n".join(rows)
262
+
263
+
264
+ def receipts_table(tags, imat=False):
265
+ head = ("| File | `output.weight` | `token_embd.weight` | tensors | trunk vs trunk-only build | MTP block |"
266
+ + (" imatrix entries | bytes differ from standard |" if imat else ""))
267
+ sep = "| --- | --- | --- | ---: | :---: | ---: |" + (" ---: | :---: |" if imat else "")
268
+ rows = [head, sep]
269
+ for k in tags:
270
+ t = T[k]; ti = t["trunk_identity"]
271
+ idt = "—" if not ti.get("result") else (f"{ti['result'].lower()} ({ti['shared']} tensors)")
272
+ r = (f"| `{t['file']}` | {t['output_weight'] or '—'} | {t['token_embd'] or '—'} | {g(t['tensors'], '{}')} | {idt} | "
273
+ f"{t['mtp_block']['bytes'] / MiB:.0f} MiB |")
274
+ if imat:
275
+ dfs = t.get("differs_from_standard")
276
+ r += f" {t.get('imatrix_entries') or '—'} | {'yes' if dfs else ('no' if dfs is False else '—')} |"
277
+ rows.append(r)
278
+ return "\n".join(rows)
279
+
280
+
281
+ def fold_block():
282
+ fv = S["fold_verify"]; f = S["fold"]
283
+ g3 = ", ".join((f"layer {k.split()[-1]}: {float(v):.1e}" if k.startswith("layer") else f"MTP: {float(v):.1e}")
284
+ for k, v in fv.get("g3", []))
285
+ return f"""Agnes-3.0-Flash Preview is a Qwen3.5-style dense hybrid (72 layers: 54 gated-delta-rule + 18 global attention,
286
+ interval 4) with one addition: **every layer runs a second, narrower SwiGLU (width {f.get('parallel_ffn', '—')}) in parallel with the
287
+ main one (width {f.get('main_ffn', '—')}), and the two outputs are summed.** The reference implementation is literally
288
+
289
+ ```python
290
+ y = down(act(gate(x)) * up(x)) + parallel_ffn(x)
291
+ ```
292
+
293
+ Because it is a plain sum through the same activation, the branch folds **exactly** into one wider SwiGLU:
294
+ `gate`/`up` concatenated along the output dimension and `down` along the input dimension, giving a stock `qwen35`
295
+ MLP of width **{f.get('folded_ffn', '—')}**. That is the same transformation Agnes AI's own SGLang patch applies. The result loads on any
296
+ llama.cpp/ROCmFPX build with `qwen35` support — **no Agnes-specific patch** (some other GGUFs of this model keep the
297
+ branch as separate `ffn_*_par` tensors and require a patched fork).
298
+
299
+ Three details that are easy to get wrong:
300
+
301
+ 1. **Rename `delta_attn.*` → `linear_attn.*`.** The converter reorders the 48 value heads into the tiled order ggml
302
+ expects *only* for tensors named `linear_attn.*`. Skipping the rename produces a model that loads and runs and is wrong.
303
+ 2. **The MTP layer has no parallel branch** ({f.get('main_ffn', '—')} wide), so its MLP is zero-padded to {f.get('folded_ffn', '—')}. Zero
304
+ SwiGLU rows contribute exactly zero.
305
+ 3. Agnes's RMSNorm is one-centred, `x / rms(x) · (1 + w)`, so the converter's `+1` weight offset is correct; the gated
306
+ delta-rule norm is a plain scale and is correctly left alone.
307
+
308
+ The fold boundary sits at column {f.get('main_ffn', '—')} = 544 × 32 = 68 × 256, so no quantization block mixes main and parallel weights.
309
+
310
+ **Verification (`recipe/verify_fold.py`, which re-derives every tensor from the source independently): {fv.get('result', '—')}.**
311
+ {f.get('tensors_out', '—')} output tensors, every one **bit-identical** to its source slice ({f.get('stats', {}).get('fold', '—')} folded,
312
+ {f.get('stats', {}).get('pad', '—')} MTP-padded, {f.get('stats', {}).get('pass', '—')} passed through), and the folded MLP reproduces the reference
313
+ forward pass to float32 rounding (max relative error: {g3}). The full log is in `recipe/verify_fold.log`."""
314
+
315
+
316
+ def serve_block(model_file):
317
+ env = ("env LD_LIBRARY_PATH=$PWD/build/bin:/opt/rocm/lib HSA_OVERRIDE_GFX_VERSION=11.5.1 "
318
+ "GGML_HIP_ENABLE_UNIFIED_MEMORY=1 \\\n")
319
+ mtp = " --spec-type draft-mtp \\\n --spec-draft-n-max 4 --spec-draft-n-min 0 --spec-draft-p-min 0.0 \\\n"
320
+ mm = f" --mmproj ~/models/agnes/mmproj-{N}-BF16.gguf \\\n"
321
+ tail = " -ngl 999 -fa on -dio --jinja -fit off --parallel 1 -dev ROCm0 \\\n -c 65536 --host 127.0.0.1 --port 8080"
322
+ head = f"build/bin/llama-server \\\n -m ~/models/agnes/{model_file} \\\n"
323
+ if "vision_quickstart_warning" not in JUDGE:
324
+ return f"```bash\n{env}{head}{mtp}{mm}{tail}\n```"
325
+ return (f"Text and tool calls, with MTP:\n\n```bash\n{env}{head}{mtp}{tail}\n```\n\n"
326
+ f"Images (`--mmproj`), **without** MTP:\n\n```bash\n{env}{head}{mm}{tail}\n```\n\n"
327
+ + JUDGE["vision_quickstart_warning"])
328
+
329
+
330
+ def quick_start(model_file, repo):
331
+ rb = bench("p-infile-rocm-n4")
332
+ return f"""**1. Download**
333
+
334
+ ```bash
335
+ hf download {repo} --local-dir ~/models/agnes
336
+ ```
337
+
338
+ **2. Build `llama-server` with the prompt-cache patch** — ROCmFPX at the measured commit (ROCm and Vulkan
339
+ prerequisites: the project's [build guide](https://github.com/charlie12345/ROCmFPX/blob/{B['commit']}/docs/build.md))
340
+
341
+ ```bash
342
+ git clone https://github.com/charlie12345/ROCmFPX.git && cd ROCmFPX
343
+ git checkout {B['commit']}
344
+ git apply ~/models/agnes/recipe/patches/mtp-prompt-cache-fix.patch
345
+ HIPCXX="$(hipconfig -l)/clang" HIP_PATH="$(hipconfig -R)" \\
346
+ cmake -S . -B build -DCMAKE_BUILD_TYPE=Release \\
347
+ -DGGML_HIP=ON -DGGML_VULKAN=ON -DGPU_TARGETS=gfx1151 \\
348
+ -DGGML_HIP_GRAPHS=ON -DGGML_HIP_NO_VMM=ON -DLLAMA_CURL=OFF
349
+ cmake --build build --target llama-server -j
350
+ ```
351
+
352
+ (The CMake options of the measured build are listed in [Reproduction](#reproduction).)
353
+
354
+ `d3ca537` is also in the history of the official [ROCmFPX/ROCmFPX](https://github.com/ROCmFPX/ROCmFPX) repository; the
355
+ patch was verified against `d3ca537` only.
356
+
357
+ **3. Serve** — the MTP head is inside the model file, so there is no `--model-draft`:
358
+
359
+ {serve_block(model_file)}
360
+
361
+ (`LD_LIBRARY_PATH` avoids a soname clash on machines that also have a Vulkan-only llama.cpp build.) The benchmarks used
362
+ the MTP command without `--mmproj`; the exact measured argv is in [Reproduction](#reproduction).
363
+
364
+ | Flag | Why |
365
+ | --- | --- |
366
+ | `--spec-type draft-mtp` | Uses the MTP layer inside the model file; no second file to download or place. |
367
+ | `--spec-draft-n-max 4` | llama.cpp's default is 16. On this model the measured optimum is about 4 — see [the table](#speculative-decoding-mtp). |
368
+ | `--spec-draft-p-min 0.0` | The default 0.75 gate throttles drafting. |
369
+ | `--jinja` | Already on by default in this build; keep it on — the thinking controls (`chat_template_kwargs`) and tool calling rely on the Jinja chat template. |
370
+ | `-fit off` | Autofit reads `MemAvailable` on integrated GPUs and can silently shrink context or push tensors to CPU. |
371
+ | `-cram <MiB>` | Not set above (default 8 GiB of host RAM for saved prompts). Set it on a shared box — see [Known issues](#known-issues-and-limits). |
372
+
373
+ > ⚠️ **On an unpatched build the in-file head still works, but prompt caching turns off while it is loaded** — every
374
+ > turn re-prefills the whole conversation ([measured](#prompt-caching-with-mtp)). For multi-turn / agentic use there,
375
+ > drop the two `--spec-*` lines.
376
+
377
+ Requires a llama.cpp build with ROCmFP4 / ROCmFPX tensor-type support; stock llama.cpp rejects these tensor types."""
378
+
379
+
380
+ REASONING = """## Reasoning controls
381
+
382
+ ⛔ **Do not pass `reasoning_effort: "high"`.**
383
+
384
+ The upstream model card lists `high` as the default effort. **The chat template shipped with the checkpoint does not
385
+ accept it.** It defaults to `xhigh` and accepts only `xhigh`, `medium`, `low`; anything else raises:
386
+
387
+ ```
388
+ Unexpected reasoning effort high. Supported types are xhigh (default), medium, and low.
389
+ ```
390
+
391
+ Verified by rendering the template with each value (`xhigh` / `medium` / `low` render; `high` raises; `medium` injects
392
+ no instruction at all). Use:
393
+
394
+ | goal | request field |
395
+ | --- | --- |
396
+ | default deep reasoning | nothing, or `"chat_template_kwargs": {"reasoning_effort": "xhigh"}` |
397
+ | shorter thinking | `"chat_template_kwargs": {"reasoning_effort": "low"}` |
398
+ | thinking off | `"chat_template_kwargs": {"enable_thinking": false}` |
399
+
400
+ With thinking on and a small `max_tokens`, the whole budget can go to reasoning and `content` comes back empty — raise
401
+ `max_tokens` before concluding the model is broken.
402
+
403
+ ⚠️ **`preserve_thinking` defaults to true** in this template: earlier turns' reasoning is re-rendered into the prompt
404
+ (Qwen3.5's template drops it). Multi-turn and agentic contexts grow faster than you may expect; pass
405
+ `"preserve_thinking": false` in `chat_template_kwargs` to get the Qwen3.5 behaviour."""
406
+
407
+
408
+ def prompt_range():
409
+ ns = sorted({b_["prompt_n"] for b_ in S["bench"] if b_.get("prompt_n") and b_.get("workload") == "code"
410
+ and b_["label"].startswith("p-infile-")})
411
+ if not ns:
412
+ return "—"
413
+ return f"{ns[0]:,}" if ns[0] == ns[-1] else f"{ns[0]:,}–{ns[-1]:,}"
414
+
415
+
416
+ def bf16_row():
417
+ b = S["bf16"]
418
+ return (f"| *BF16 reference* | 32 | {gib(b['with_mtp_size_bytes'])}³ | 16 | 0 | 100 % | "
419
+ f"{pm(b.get('ppl_paired'), b.get('ppl_paired_err'))}¹ | — | — |")
420
+
421
+
422
+ def footnotes():
423
+ b = S["bf16"]
424
+ return (f"{TG_NOTE}\n"
425
+ f"¹ The BF16 PPL shown is the paired base every \"×\" ratio is computed against (averaged over the same scored tokens "
426
+ f"in the KL-divergence runs). The standalone BF16 run's own summary line reads {pm(b['ppl'], b['ppl_err'])}.\n"
427
+ f"² Quality columns: see *Where the quality numbers come from* below.\n"
428
+ f"³ BF16 conversion including the MTP layer (the graded BF16 trunk without it is {gib(b['trunk_size_bytes'])}); not "
429
+ f"published.")
430
+
431
+
432
+ def methodology_std():
433
+ return f"""```bash
434
+ # 0. fold the checkpoint (exact) and verify it
435
+ python recipe/fold_agnes.py Agnes-3.0-Flash agnes-qwen35
436
+ python recipe/verify_fold.py Agnes-3.0-Flash agnes-qwen35 # must print RESULT: PASS
437
+
438
+ # 1. convert: model WITH its MTP layer (the converter's default), and the vision projector
439
+ python convert_hf_to_gguf.py agnes-qwen35 --outtype bf16 --model-name {N} --outfile {N}-MTP-BF16.gguf
440
+ python convert_hf_to_gguf.py agnes-qwen35 --outtype bf16 --mmproj --model-name {N} --outfile mmproj-{N}-BF16.gguf
441
+
442
+ # 2. quantize from BF16 only; the LM head is forced up on every tier and read back by exact tensor name
443
+ llama-quantize --output-tensor-type q6_K {N}-MTP-BF16.gguf OUT Q4_0_ROCMFP4_STRIX_LEAN 16
444
+ llama-quantize --output-tensor-type q6_K --token-embedding-type q6_K {N}-MTP-BF16.gguf OUT Q4_0_ROCMFP4_COHERENT 16
445
+ llama-quantize --output-tensor-type q8_0 --token-embedding-type q8_0 {N}-MTP-BF16.gguf OUT Q8_0_ROCMFPX_AGENT 16
446
+ llama-quantize --output-tensor-type q8_0 --token-embedding-type q8_0 {N}-MTP-BF16.gguf OUT Q8_0_ROCMFPX 16
447
+
448
+ # 3. grade each shipped file against BF16 logits from the same session (the trunk-only BF16: same trunk weights)
449
+ llama-perplexity -m {N}-BF16.gguf -f wikitext-2-raw/wiki.test.raw -c 2048 -b 2048 --chunks 40 --kl-divergence-base bf16.kld \\
450
+ -ngl 999 -fa on -dio -dev ROCm0
451
+ llama-perplexity -m OUT --kl-divergence-base bf16.kld --kl-divergence -c 2048 -b 2048 -ngl 999 -fa on -dio -dev ROCm0
452
+ ```
453
+
454
+ Receipts (the built file is the receipt — exact tensor names, never a substring match; `recipe/logs/`):
455
+
456
+ {receipts_table(("q106", "q102", "q115", "q111"))}
457
+
458
+ *trunk vs trunk-only build*: every trunk tensor's type, shape and sha256 compared with the same tier built without
459
+ the MTP layer (`tensor_identity.py`)."""
460
+
461
+
462
+ def std_card():
463
+ L = T["q106"]
464
+ sh = S.get("separate_head_replaced", {}).get(f"mtp-{N}-Q4_0.gguf", {})
465
+ return YAML.format(extra="") + f"""
466
+ # Agnes-3.0-Flash Preview — ROCmFP4 for AMD Strix Halo (gfx1151)
467
+
468
+ ROCmFP4 / ROCmFPX quantizations of **[Agnes-AI/Agnes-3.0-Flash](https://huggingface.co/Agnes-AI/Agnes-3.0-Flash)** —
469
+ the open-weight **Preview** checkpoint (33B dense, hybrid gated-delta-rule + global attention, 262,144-token context,
470
+ text + image) — built and measured on an AMD Ryzen AI Max+ 395 (Radeon 8060S, `gfx1151`).
471
+
472
+ - **First ROCmFP4 build of this model** — a Hub search on 2026-09-16 found no other ROCm or Strix Halo build of Agnes (21 Agnes repos checked).
473
+ - **MTP head built into every file.** One GGUF per tier; `--spec-type draft-mtp` finds the head inside the model. It
474
+ adds {min(T[k]['mtp_block']['bytes'] for k in ('q106', 'q102', 'q106i', 'q102i')) / MiB:.0f}–{max(T[k]['mtp_block']['bytes'] for k in ('q106', 'q102', 'q106i', 'q102i')) / MiB:.0f} MiB to a 4-bit file — the separate head file it replaces was {g((sh.get('size_bytes') or 0) / GiB if sh else None)} GiB
475
+ ([why](#speculative-decoding-mtp)).
476
+ - **Prompt caching works with MTP on**, with the small `llama-server` patch in `recipe/patches/` — without it, a build of
477
+ this ROCmFPX line reuses nothing while the head is loaded ([measured](#prompt-caching-with-mtp)).
478
+ - **Vision projector included.**
479
+ - **No Agnes-specific patch needed to load the weights** — the parallel FFN branch is folded *exactly* into a standard
480
+ `qwen35` MLP ([details](#how-the-parallel-ffn-was-handled)).
481
+ - Importance-matrix builds of the 4-bit tiers: **[{IMAT}](https://huggingface.co/{IMAT})**.
482
+
483
+ > ⚠️ This is the **Preview** checkpoint. Agnes AI states that its production/API model (1M context) is a different
484
+ > checkpoint and that published benchmark results for that model do not apply to these weights.
485
+
486
+ ## Which file should I use?
487
+
488
+ {PROTOCOL}
489
+
490
+ {TABLE_HEAD}
491
+ {chr(10).join(tier_row(k) for k in ("q106", "q102", "q115", "q111"))}
492
+ {bf16_row()}
493
+
494
+ {footnotes()}
495
+
496
+ {J('std_recommendation')}
497
+
498
+ {QUALITY}
499
+
500
+ **Where the quality numbers come from.** {J('quality_provenance')}
501
+
502
+ ## Quick start
503
+
504
+ {quick_start(JUDGE.get('std_default') or L['file'], STD)}
505
+
506
+ {REASONING}
507
+
508
+ ## Speculative decoding (MTP)
509
+
510
+ {J('layout_note')} {Jopt('memory_head_note')}
511
+
512
+ {head_table()}
513
+
514
+ {J('head_speed_note')}
515
+
516
+ Measured on `{L['file']}` (patched server; code prompts of {prompt_range()} tokens — each request carries a unique nonce):
517
+
518
+ {spec_table()}
519
+
520
+ {J('std_mtp_notes')}
521
+
522
+ {range_line()}
523
+
524
+ {history_line()}
525
+
526
+ ### Is the output the same as without MTP?
527
+
528
+ {J('identity_note')}
529
+
530
+ {J('strict_note')}
531
+
532
+ ## Prompt caching with MTP
533
+
534
+ {patch_block()}
535
+
536
+ Measured: a second turn that shares the first turn's ~7K-token prefix and differs only in its closing instruction, each
537
+ exchange run warm (`cache_prompt: true`) and then cold (`cache_prompt: false`) and the two replies compared byte for byte.
538
+
539
+ {cache_table()}
540
+
541
+ {J('std_cache_note')}
542
+
543
+ ## Memory
544
+
545
+ {J('memory_note')}
546
+
547
+ ## Tool calling
548
+
549
+ The template emits the XML-style `<tool_call><function=…><parameter=…>` format, which llama.cpp parses natively
550
+ (through the Jinja chat template, on by default). Suite run through `llama-server` in the deployed configuration (in-file MTP on), at the
551
+ checkpoint's recommended sampling (temperature 1.0, top-p 0.95, top-k 20; file and sampling are set in
552
+ `recipe/pipeline/vplan_b.py` and `recipe/pipeline/agnes_harness.py`):
553
+
554
+ {tools_block()}
555
+
556
+ {J('std_tools_note')}
557
+
558
+ ## Vision
559
+
560
+ `mmproj-{N}-BF16.gguf` is the 27-layer vision tower (shape-identical to Qwen3.5-27B's), loaded with `--mmproj`.
561
+ Its attention follows the server's `-fa` setting, so both settings were checked, with and without the MTP head.
562
+
563
+ {vision_block()}
564
+
565
+ ## How the parallel FFN was handled
566
+
567
+ {fold_block()}
568
+
569
+ ## Quantization methodology
570
+
571
+ {methodology_std()}
572
+
573
+ ## Reproduction
574
+
575
+ {repro(L['file'], 'p-infile-rocm-n4')}
576
+
577
+ ## Files
578
+
579
+ {files_table([(T[k]['file'], T[k]['size_bytes']) for k in ('q106', 'q102', 'q115', 'q111')] + [(k, v) for k, v in S['aux'].items()])}
580
+
581
+ `SHA256SUMS` covers every model file. `recipe/` holds the fold and verification scripts, the prompt-cache patch
582
+ (`recipe/patches/`), the full measurement pipeline (`recipe/pipeline/`), raw per-run results (`recipe/raw/`), build and
583
+ receipt logs (`recipe/logs/`), and `results_summary.json` with every measured value on this card plus the binary hashes.
584
+ Architecture facts (layer counts, vocabulary, vision depth) come from the checkpoint's `config.json`.
585
+
586
+ ## Known issues and limits
587
+
588
+ {J('std_known_issues')}
589
+
590
+ ## License and attribution
591
+
592
+ Apache-2.0, inherited from the base model. Weights and architecture: **Agnes AI**
593
+ ([Agnes-AI/Agnes-3.0-Flash](https://huggingface.co/Agnes-AI/Agnes-3.0-Flash)). ROCmFP4 / ROCmFPX quantization format and
594
+ runtime: the ROCmFPX project. MTP prompt-cache patch: kingjones777. Folding, quantization, and measurements: kingjones777.
595
+ """
596
+
597
+
598
+ def imat_card():
599
+ t = T
600
+ def d(a, b, k, ek):
601
+ x, y = t[a].get(k), t[b].get(k); ex, ey = (t[a].get(ek), t[b].get(ek)) if ek else (None, None)
602
+ if None in (x, y): return "—"
603
+ s = f"{(y - x) / x * 100:+.1f} %"
604
+ if ex is not None and ey is not None:
605
+ s += f" ({abs(y - x) / math.sqrt(ex * ex + ey * ey):.1f}σ)"
606
+ return s
607
+ rows = ["| Tier | Build | Size | KLD vs BF16 ↓ | Same top-1 ↑ | PPL (× BF16) | 99th-pct KLD |",
608
+ "| --- | --- | ---: | ---: | ---: | ---: | ---: |"]
609
+ for base, imat in (("q106", "q106i"), ("q102", "q102i")):
610
+ for tag, lab in ((base, "standard"), (imat, "**imatrix**")):
611
+ x = t[tag]
612
+ rows.append(f"| {NAMES[tag]} | {lab} | {gib(x['size_bytes'])} | {pm(x['kld_mean'], x['kld_err'])} | "
613
+ f"{g(x['same_top_p'], '{:.2f} %')} | {pm(x['ppl'], x['ppl_err'])} "
614
+ f"({'—' if x['ppl_ratio'] is None else '×%.4f' % x['ppl_ratio']}) | {g(x['kld_p99'], '{:.4f}')} |")
615
+ dpp = ("—" if None in (t[base]['same_top_p'], t[imat]['same_top_p'])
616
+ else f"{t[imat]['same_top_p'] - t[base]['same_top_p']:+.2f} pp")
617
+ rows.append(f"| | *Δ imatrix* | | {d(base, imat, 'kld_mean', 'kld_err')} | {dpp} | "
618
+ f"{d(base, imat, 'ppl', 'ppl_err')} | {d(base, imat, 'kld_p99', None)} |")
619
+ im = S["imatrix"]; Li = t["q106i"]
620
+ return YAML.format(extra="\n - imatrix") + f"""
621
+ # Agnes-3.0-Flash Preview — ROCmFP4 **imatrix** for AMD Strix Halo (gfx1151)
622
+
623
+ Importance-matrix-calibrated ROCmFP4 quantizations of
624
+ **[Agnes-AI/Agnes-3.0-Flash](https://huggingface.co/Agnes-AI/Agnes-3.0-Flash)** (Preview, 33B dense, 262,144-token context,
625
+ text + image). Companion to the standard build **[{STD}](https://huggingface.co/{STD})** — the same two 4-bit tiers,
626
+ same fold, same built-in MTP head, same vision projector and the same prompt-cache patch; the only difference is how each
627
+ 4-bit block's scale was chosen.
628
+
629
+ ## What the imatrix changes
630
+
631
+ ROCmFP4 has an importance-weighted quantizer path: with `--imatrix`, each block's scale is chosen by an exhaustive
632
+ search that minimises error **weighted by how strongly the calibration activations use each weight**, instead of the
633
+ unweighted default. It changes **which** scales are picked at the **same** bit width and tensor types — so it moves
634
+ quality, not size, and per-token compute is identical.
635
+
636
+ | | |
637
+ | --- | --- |
638
+ | calibration text | {im['calibration']} (the widely used community calibration set) |
639
+ | computed on | BF16 GGUF, {im['chunks']} chunks × {im['n_ctx']} tokens, ROCm0 |
640
+ | coverage | **558 entries = every matmul weight in the 72 trunk layers** (54 delta-rule layers × 8 + 18 global layers × 7); the output projection and the MTP block have none |
641
+ | file | `{im['file']}` (GGUF format), sha256 `{im['sha256']}` |
642
+
643
+ ## Measured effect
644
+
645
+ {QUALITY} The calibration text and the grading text are different corpora.
646
+
647
+ {chr(10).join(rows)}
648
+
649
+ σ = difference divided by the two runs' combined standard error. The two runs score the **same** tokens, so this is
650
+ conservative (paired noise is smaller).
651
+
652
+ {J('imat_verdict')}
653
+
654
+ **Where the quality numbers come from.** {J('quality_provenance')}
655
+
656
+ ## Which file should I use?
657
+
658
+ {J('imat_recommendation')}
659
+
660
+ {TABLE_HEAD}
661
+ {tier_row('q106i')}
662
+ {tier_row('q102i')}
663
+ {bf16_row()}
664
+
665
+ {footnotes()}
666
+
667
+ {Jopt('imat_speed_note')}
668
+
669
+ Full speed tables (depth check, strict mode, both backends, workload range), prompt-cache and tool-calling results are on
670
+ the [standard card]({'https://huggingface.co/' + STD}). The 8-bit tiers are not duplicated here; they are on the standard repo.
671
+
672
+ ## Quick start
673
+
674
+ {quick_start(JUDGE.get('imat_default') or Li['file'], IMAT)}
675
+
676
+ {REASONING}
677
+
678
+ ## MTP, prompt caching, tool calling, vision
679
+
680
+ Same architecture, template, in-file MTP block ({Li['mtp_block']['bytes'] / MiB:.0f} MiB in STRIX_LEAN,
681
+ {t['q102i']['mtp_block']['bytes'] / MiB:.0f} MiB in COHERENT) and projector as the standard build. The prompt-cache patch
682
+ is included here too (`recipe/patches/`). The tool-calling suite ran on this repo's STRIX_LEAN — see
683
+ [the standard card]({'https://huggingface.co/' + STD}#tool-calling).
684
+
685
+ ## How the parallel FFN was handled
686
+
687
+ {fold_block()}
688
+
689
+ ## Quantization methodology
690
+
691
+ ```bash
692
+ llama-imatrix -m {N}-BF16.gguf -f calibration_datav3.txt -o {N}.imatrix \\
693
+ -ngl 999 -c 512 -b 512 -fa on -dio -dev ROCm0
694
+ llama-quantize --imatrix {N}.imatrix --output-tensor-type q6_K \\
695
+ {N}-MTP-BF16.gguf {N}-MTP-imatrix-Q4_0_ROCMFP4_STRIX_LEAN.gguf Q4_0_ROCMFP4_STRIX_LEAN 16
696
+ llama-quantize --imatrix {N}.imatrix --output-tensor-type q6_K --token-embedding-type q6_K \\
697
+ {N}-MTP-BF16.gguf {N}-MTP-imatrix-Q4_0_ROCMFP4_COHERENT.gguf Q4_0_ROCMFP4_COHERENT 16
698
+ ```
699
+
700
+ The imatrix was computed on the trunk-only BF16; the MTP layer is quantized from the BF16 that includes it
701
+ (`{N}-MTP-BF16.gguf`), with the unweighted path for its tensors.
702
+
703
+ Receipts that the weighted path was actually taken, and that the shipped trunk is the graded one:
704
+
705
+ {receipts_table(("q106i", "q102i"), imat=True)}
706
+
707
+ ## Reproduction
708
+
709
+ {repro(Li['file'], 't-q106i-rocm-n4')}
710
+
711
+ ## Files
712
+
713
+ {files_table([(t[k]['file'], t[k]['size_bytes']) for k in ('q106i', 'q102i')] + [(im['file'], im.get('size_bytes'))] + [(k, v) for k, v in S['aux'].items()])}
714
+
715
+ ## Known issues and limits
716
+
717
+ {J('imat_known_issues')}
718
+
719
+ ## License and attribution
720
+
721
+ Apache-2.0, inherited from the base model. Weights and architecture: **Agnes AI**. Calibration text:
722
+ bartowski's `calibration_datav3`. ROCmFP4 / ROCmFPX: the ROCmFPX project. MTP prompt-cache patch, folding, imatrix,
723
+ quantization and measurements: kingjones777.
724
+ """
725
+
726
+
727
+ open(os.path.join(OUT, "README_std.md"), "w").write(std_card())
728
+ def fix_anchors(md, other_repo):
729
+ """Links to sections that exist only on the other card point there instead of to a missing anchor."""
730
+ import re
731
+ slugs = {re.sub(r"[^a-z0-9 -]", "", h.strip().lower()).replace(" ", "-")
732
+ for h in re.findall(r"^#{1,6} (.+)$", md, flags=re.M)}
733
+ return re.sub(r"\]\(#([a-z0-9-]+)\)",
734
+ lambda m: m.group(0) if m.group(1) in slugs else f"](https://huggingface.co/{other_repo}#{m.group(1)})", md)
735
+
736
+
737
+ open(os.path.join(OUT, "README_imat.md"), "w").write(fix_anchors(imat_card(), STD))
738
+ cards = open(os.path.join(OUT, "README_std.md")).read() + open(os.path.join(OUT, "README_imat.md")).read()
739
+ pend = sorted(set(x.split("JUDGMENT PENDING: ")[1].split("]")[0] for x in cards.split("**[")[1:] if "JUDGMENT PENDING" in x))
740
+ if "vision_blocker" in JUDGE:
741
+ pend.append("BLOCKER: " + JUDGE["vision_blocker"])
742
+ dash_cells = cards.count("| — |")
743
+ print("rendered | knee =", S.get("knee"), "| bench rows =", len(S["bench"]), "| gates =", len(S["gates"]),
744
+ "| pending judgments:", pend, "| '—' cells:", dash_cells)
recipe/pipeline/seat_sizing.sh ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/bin/bash
2
+ # Measure (not estimate) the host-memory footprint of a candidate Agnes seat on the ICED box.
3
+ # For each ctx: MemAvailable before -> after load -> after one ~8K-token request. Seat argv mirrors :8094 (q8_0 KV, -cram 512).
4
+ set -uo pipefail
5
+ W=/mnt/models/agnes-3.0-flash; B=/opt/llama-rocm/rocmfpx-724/build-hipvk/bin; N=Agnes-3.0-Flash-Preview; cd $W
6
+ export LD_LIBRARY_PATH=$B:/opt/rocm-7.2.4/lib HSA_OVERRIDE_GFX_VERSION=11.5.1 GGML_HIP_ENABLE_UNIFIED_MEMORY=1
7
+ KNEE=$(python3 -c "import json;print(json.load(open('results/knee.json'))['knee'])")
8
+ MODEL=${1:-out-imat/$N-imatrix-Q4_0_ROCMFP4_COHERENT.gguf}
9
+ avail(){ awk '/MemAvailable/{printf "%.2f", $2/1048576}' /proc/meminfo; }
10
+ for C in 65536 131072 262144; do
11
+ a0=$(avail)
12
+ $B/llama-server -m $MODEL -dev ROCm0 -ngl 999 -fa on --no-mmap -fit off -c $C -ctk q8_0 -ctv q8_0 -np 1 \
13
+ -b 2048 -ub 1024 -t 16 --jinja --spec-type draft-mtp -md out/mtp-$N-Q4_0.gguf --spec-draft-n-max $KNEE \
14
+ --spec-draft-ngl 99 --spec-draft-p-min 0.0 --mmproj out/mmproj-$N-BF16.gguf -cram 512 \
15
+ --host 127.0.0.1 --port 18700 > logs/sizing_c$C.log 2>&1 &
16
+ pid=$!
17
+ ok=0; for i in $(seq 1 120); do curl -s -m 2 http://127.0.0.1:18700/health | grep -q ok && { ok=1; break; }; kill -0 $pid 2>/dev/null || break; sleep 3; done
18
+ if [ $ok -ne 1 ]; then echo "{\"ctx\":$C,\"result\":\"LOAD_FAIL\",\"avail_before\":$a0}" | tee -a results/seat_sizing.jsonl; kill $pid 2>/dev/null; sleep 5; continue; fi
19
+ a1=$(avail)
20
+ python3 - <<EOF
21
+ import json,urllib.request
22
+ txt=open("/opt/llama-rocm/rocmfpx-724/convert_hf_to_gguf.py").read()[:30000]
23
+ b={"messages":[{"role":"user","content":txt+"\n\nSummarise this file in one sentence."}],"max_tokens":64,"temperature":0,
24
+ "chat_template_kwargs":{"enable_thinking":False}}
25
+ urllib.request.urlopen(urllib.request.Request("http://127.0.0.1:18700/v1/chat/completions",data=json.dumps(b).encode(),
26
+ headers={"Content-Type":"application/json"}),timeout=600).read()
27
+ EOF
28
+ a2=$(avail)
29
+ echo "{\"ctx\":$C,\"model\":\"$(basename $MODEL)\",\"avail_before\":$a0,\"avail_loaded\":$a1,\"avail_after_8k\":$a2,\"footprint_loaded_gib\":$(python3 -c "print(round($a0-$a1,2))"),\"footprint_after_8k_gib\":$(python3 -c "print(round($a0-$a2,2))")}" | tee -a results/seat_sizing.jsonl
30
+ kill $pid; wait $pid 2>/dev/null; sleep 8
31
+ done
32
+ echo SIZING_DONE
recipe/pipeline/seat_sizing2.sh ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/bin/bash
2
+ # Apples-to-apples memory: SAME tier (imatrix COHERENT), SAME patched binary, separate head vs in-file head.
3
+ set -uo pipefail
4
+ W=/mnt/models/agnes-3.0-flash; B=/opt/llama-rocm/rocmfpx-724-mtpcache/build-hipvk/bin; N=Agnes-3.0-Flash-Preview; cd $W
5
+ export LD_LIBRARY_PATH=$B:/opt/rocm-7.2.4/lib HSA_OVERRIDE_GFX_VERSION=11.5.1 GGML_HIP_ENABLE_UNIFIED_MEMORY=1
6
+ avail(){ awk '/MemAvailable/{printf "%.2f", $2/1048576}' /proc/meminfo; }
7
+ dl(){ if systemctl list-units --state=active --no-legend --plain 'nex-*.scope' 2>/dev/null | grep -q .; then echo active; else echo inactive; fi; }
8
+ # the next model (Nex-N2.5-mini) downloads/converts/quantizes in capped nex-* scopes; their page-cache churn would
9
+ # skew MemAvailable deltas, so measure only when none is running (max 2 h)
10
+ for i in $(seq 1 360); do [ "$(dl)" = active ] || break; sleep 20; done
11
+ echo "download scope before sizing: $(dl)"; sync; sleep 5
12
+ measure(){ # $1 label $2 ctx rest = model/draft args
13
+ local label=$1 C=$2; shift 2
14
+ local a0=$(avail)
15
+ $B/llama-server "$@" -dev ROCm0 -ngl 999 -fa on --no-mmap -fit off -c $C -ctk q8_0 -ctv q8_0 -np 1 -b 2048 -ub 1024 -t 16 \
16
+ --jinja --spec-type draft-mtp --spec-draft-n-max 4 --spec-draft-p-min 0.0 --mmproj out/mmproj-$N-BF16.gguf -cram 512 \
17
+ --host 127.0.0.1 --port 18710 > logs/sizing2_${label}_c$C.log 2>&1 &
18
+ local pid=$! ok=0
19
+ for i in $(seq 1 120); do curl -s -m 2 http://127.0.0.1:18710/health | grep -q ok && { ok=1; break; }; kill -0 $pid 2>/dev/null || break; sleep 3; done
20
+ if [ $ok -ne 1 ]; then echo "{\"label\":\"$label\",\"ctx\":$C,\"result\":\"LOAD_FAIL\"}" | tee -a results/seat_sizing2.jsonl; kill $pid 2>/dev/null; sleep 5; return; fi
21
+ local a1=$(avail)
22
+ python3 - <<EOF
23
+ import json,urllib.request
24
+ txt=open("/opt/llama-rocm/rocmfpx-724/convert_hf_to_gguf.py").read()[:30000]
25
+ b={"messages":[{"role":"user","content":txt+"\n\nSummarise this file in one sentence."}],"max_tokens":64,"temperature":0,
26
+ "chat_template_kwargs":{"enable_thinking":False}}
27
+ urllib.request.urlopen(urllib.request.Request("http://127.0.0.1:18710/v1/chat/completions",data=json.dumps(b).encode(),
28
+ headers={"Content-Type":"application/json"}),timeout=600).read()
29
+ EOF
30
+ local a2=$(avail)
31
+ echo "{\"label\":\"$label\",\"ctx\":$C,\"avail_before\":$a0,\"footprint_loaded_gib\":$(python3 -c "print(round($a0-$a1,2))"),\"footprint_after_8k_gib\":$(python3 -c "print(round($a0-$a2,2))"),\"concurrent_download\":\"$(dl)\"}" | tee -a results/seat_sizing2.jsonl
32
+ kill $pid; wait $pid 2>/dev/null; sleep 8
33
+ }
34
+ measure separate-head 65536 -m out-imat/$N-imatrix-Q4_0_ROCMFP4_COHERENT.gguf --model-draft out/mtp-$N-Q4_0.gguf --spec-draft-ngl 99 --spec-draft-device ROCm0
35
+ for C in 65536 131072 262144; do
36
+ measure in-file $C -m out-mtp-imat/$N-MTP-imatrix-Q4_0_ROCMFP4_COHERENT.gguf
37
+ done
38
+ measure in-file-lean 65536 -m out-mtp-imat/$N-MTP-imatrix-Q4_0_ROCMFP4_STRIX_LEAN.gguf
39
+ echo SIZING2_DONE
recipe/pipeline/tensor_identity.py ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env python3
2
+ """Compare every shared tensor (name, type, shape, BYTES) between an old and new GGUF.
3
+ usage: tensor_identity.py <old.gguf> <new.gguf> -> prints summary JSON; exit 0 iff all shared tensors identical"""
4
+ import hashlib, json, sys
5
+ sys.path.insert(0, "/opt/llama-rocm/rocmfpx-724/gguf-py")
6
+ import gguf
7
+ def index(p):
8
+ r = gguf.GGUFReader(p); out = {}
9
+ for t in r.tensors:
10
+ try: tn = t.tensor_type.name
11
+ except Exception: tn = f"TYPE_{int(t.tensor_type)}"
12
+ out[t.name] = (tn, tuple(int(x) for x in t.shape), hashlib.sha256(t.data.tobytes()).hexdigest())
13
+ return out
14
+ a, b = index(sys.argv[1]), index(sys.argv[2])
15
+ shared = sorted(set(a) & set(b))
16
+ diff_type = [n for n in shared if a[n][0] != b[n][0] or a[n][1] != b[n][1]]
17
+ diff_bytes = [n for n in shared if n not in diff_type and a[n][2] != b[n][2]]
18
+ res = {"old_tensors": len(a), "new_tensors": len(b), "shared": len(shared),
19
+ "only_in_new": sorted(set(b) - set(a))[:20], "only_in_old": sorted(set(a) - set(b))[:20],
20
+ "type_or_shape_changed": [(n, a[n][0], b[n][0]) for n in diff_type][:20],
21
+ "bytes_changed": diff_bytes[:20], "n_type_changed": len(diff_type), "n_bytes_changed": len(diff_bytes)}
22
+ res["result"] = "IDENTICAL" if not diff_type and not diff_bytes and not res["only_in_old"] else "DIFFERENT"
23
+ print(json.dumps(res))
24
+ sys.exit(0 if res["result"] == "IDENTICAL" else 1)
recipe/pipeline/trunk_receipt.sh ADDED
@@ -0,0 +1,58 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/bin/bash
2
+ # Receipt that the grades carry over to the in-file-MTP files: run the EXACT grading command on each new file and
3
+ # compare its first 4 per-chunk rows (cumulative PPL, ln ratio, KLD, dp RMS, same-top-p) with the graded run.
4
+ # kl_divergence always walks every chunk of the base file (it ignores --chunks), so the run is stopped after row 4.
5
+ # Then the image path on the shipped file: MTP on/off x -fa on/off (the quick start uses MTP on + -fa on).
6
+ set -uo pipefail
7
+ W=/mnt/models/agnes-3.0-flash; B=/opt/llama-rocm/rocmfpx-724/build-hipvk/bin; N=Agnes-3.0-Flash-Preview; cd $W
8
+ export LD_LIBRARY_PATH=$B:/opt/rocm-7.2.4/lib HSA_OVERRIDE_GFX_VERSION=11.5.1 GGML_HIP_ENABLE_UNIFIED_MEMORY=1
9
+ rows(){ # first 4 COMPLETE per-chunk rows (a row is written by several log calls; never compare a half-written one)
10
+ python3 - "$1" <<'EOF'
11
+ import sys
12
+ out = []
13
+ for l in open(sys.argv[1], errors="replace"):
14
+ t = l.split()
15
+ if len(t) > 2 and t[0].isdigit() and l.rstrip().endswith("%") and l.count("%") == 2:
16
+ out.append(" ".join(t))
17
+ if len(out) == 4:
18
+ break
19
+ print("\n".join(out))
20
+ EOF
21
+ }
22
+ check(){ # $1 tag $2 new file
23
+ local L=logs/R_kld4_$1.log
24
+ $B/llama-perplexity -m "$2" --kl-divergence-base kld/bf16.kld --kl-divergence -c 2048 -b 2048 \
25
+ -ngl 999 -fa on -dio -dev ROCm0 > $L 2>&1 &
26
+ local pid=$!
27
+ for i in $(seq 1 900); do
28
+ [ "$(rows $L | grep -c .)" -ge 4 ] && break
29
+ kill -0 $pid 2>/dev/null || break
30
+ sleep 1
31
+ done
32
+ kill $pid 2>/dev/null; wait $pid 2>/dev/null
33
+ local a b v n
34
+ a=$(rows $L); b=$(rows logs/B5_kld_$1.log); n=$(printf "%s\n" "$a" | grep -c .)
35
+ if [ "$n" -eq 4 ] && [ "$a" = "$b" ]; then v=MATCH; else v=MISMATCH; fi
36
+ echo "{\"tag\":\"$1\",\"file\":\"$(basename "$2")\",\"rows_compared\":$n,\"result\":\"$v\"}" | tee -a results/trunk_receipt.jsonl
37
+ }
38
+ check q106 out-mtp/$N-MTP-Q4_0_ROCMFP4_STRIX_LEAN.gguf
39
+ check q102 out-mtp/$N-MTP-Q4_0_ROCMFP4_COHERENT.gguf
40
+ check q115 out-mtp/$N-MTP-Q8_0_ROCMFPX_AGENT.gguf
41
+ check q111 out-mtp/$N-MTP-Q8_0_ROCMFPX.gguf
42
+ check q106i out-mtp-imat/$N-MTP-imatrix-Q4_0_ROCMFP4_STRIX_LEAN.gguf
43
+ check q102i out-mtp-imat/$N-MTP-imatrix-Q4_0_ROCMFP4_COHERENT.gguf
44
+ vis(){ # $1 label $2 -fa $3 MTP head (yes|no); patched server, shipped STRIX_LEAN file, vision projector
45
+ local extra=()
46
+ [ "$3" = yes ] && extra=(--mtp-infile --nmax 4)
47
+ AGNES_BIN=/opt/llama-rocm/rocmfpx-724-mtpcache/build-hipvk/bin python3 agnes_harness.py vision \
48
+ --model out-mtp/$N-MTP-Q4_0_ROCMFP4_STRIX_LEAN.gguf ${extra[@]+"${extra[@]}"} --fa "$2" \
49
+ --mmproj out/mmproj-$N-BF16.gguf --image calib/vision_probe.png \
50
+ --question "Describe the two shapes in this image and their colors." --expect "red,blue,circle,square" \
51
+ --label "$1" --jsonl results/mtpfix.jsonl --serverlog logs/v_$1.log
52
+ echo "vision $1 exit=$?"
53
+ }
54
+ vis vision-q106-infile on yes # the quick-start configuration
55
+ vis vision-q106-infile-faoff off yes
56
+ vis vision-q106-nomtp on no
57
+ vis vision-q106-nomtp-faoff off no
58
+ echo TRUNK_RECEIPT_DONE
recipe/pipeline/verify_download.py ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env python3
2
+ """Byte + sha256 gate for a pinned HF snapshot. Compares against the tree API's lfs.oid
3
+ (the real content sha256) -- never the plain etag, which is a Xet/CAS id.
4
+ usage: verify_download.py <repo> <revision> <local_dir>"""
5
+ import hashlib, json, os, sys, urllib.request
6
+ from concurrent.futures import ThreadPoolExecutor
7
+ repo, rev, d = sys.argv[1:4]
8
+ tree = json.load(urllib.request.urlopen(
9
+ f"https://huggingface.co/api/models/{repo}/tree/{rev}?recursive=true", timeout=60))
10
+ files = [t for t in tree if t.get("type") == "file"]
11
+ def sha(p):
12
+ h = hashlib.sha256()
13
+ with open(p, "rb") as f:
14
+ for b in iter(lambda: f.read(64 << 20), b""): h.update(b)
15
+ return h.hexdigest()
16
+ def one(t):
17
+ p = os.path.join(d, t["path"])
18
+ if not os.path.exists(p): return (t["path"], "MISSING")
19
+ if os.path.getsize(p) != t["size"]: return (t["path"], f"SIZE {os.path.getsize(p)} != {t['size']}")
20
+ lfs = t.get("lfs")
21
+ if lfs:
22
+ got = sha(p)
23
+ return (t["path"], "ok-sha" if got == lfs["oid"] else f"SHA {got[:12]} != {lfs['oid'][:12]}")
24
+ return (t["path"], "ok-size")
25
+ with ThreadPoolExecutor(6) as ex: res = list(ex.map(one, files))
26
+ bad = [r for r in res if not r[1].startswith("ok")]
27
+ print(f"files={len(res)} sha-verified={sum(r[1]=='ok-sha' for r in res)} size-only={sum(r[1]=='ok-size' for r in res)} bad={len(bad)}")
28
+ for r in bad: print(" BAD", r)
29
+ print("RESULT:", "PASS" if not bad else "FAIL")
30
+ sys.exit(0 if not bad else 1)
recipe/pipeline/vplan_a.py ADDED
@@ -0,0 +1,46 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env python3
2
+ """Verification of the two MTP fixes (in-file head + prompt-cache patch). Sequential GPU, box iced.
3
+ Writes results/mtpfix.jsonl. Each step is an isolated harness process."""
4
+ import json, os, subprocess, time
5
+ W = "/mnt/models/agnes-3.0-flash"; N = "Agnes-3.0-Flash-Preview"
6
+ J = f"{W}/results/mtpfix.jsonl"
7
+ PB = "/opt/llama-rocm/rocmfpx-724-mtpcache/build-hipvk/bin" # patched
8
+ OB = "/opt/llama-rocm/rocmfpx-724/build-hipvk/bin" # original d3ca537
9
+ T = {"q106": f"{W}/out-mtp/{N}-MTP-Q4_0_ROCMFP4_STRIX_LEAN.gguf", "q102": f"{W}/out-mtp/{N}-MTP-Q4_0_ROCMFP4_COHERENT.gguf",
10
+ "q115": f"{W}/out-mtp/{N}-MTP-Q8_0_ROCMFPX_AGENT.gguf", "q111": f"{W}/out-mtp/{N}-MTP-Q8_0_ROCMFPX.gguf",
11
+ "q106i": f"{W}/out-mtp-imat/{N}-MTP-imatrix-Q4_0_ROCMFP4_STRIX_LEAN.gguf",
12
+ "q102i": f"{W}/out-mtp-imat/{N}-MTP-imatrix-Q4_0_ROCMFP4_COHERENT.gguf"}
13
+ def log(m): print(f"[{time.strftime('%FT%TZ', time.gmtime())}] {m}", flush=True)
14
+ def run(cmd, label, model, binp=PB, dev="ROCm0", infile=False, strict=False, nmax=4, reps=3, workload="code", extra=()):
15
+ a = ["python3", f"{W}/agnes_harness.py", cmd, "--model", model, "--dev", dev, "--label", label,
16
+ "--reps", str(reps), "--jsonl", J, "--serverlog", f"{W}/logs/v_{label}.log", "--workload", workload, *extra]
17
+ if infile: a += ["--mtp-infile", "--nmax", str(nmax)]
18
+ if strict: a += ["--strict"]
19
+ log(f"{cmd} {label}")
20
+ r = subprocess.run(a, capture_output=True, text=True, env=dict(os.environ, AGNES_BIN=binp))
21
+ print(r.stdout.strip()[-900:], flush=True)
22
+ if r.returncode != 0: print(" RC", r.returncode, r.stderr.strip()[-500:], flush=True)
23
+ return r.returncode
24
+ def rows(label):
25
+ out = [json.loads(l) for l in open(J)] if os.path.exists(J) else []
26
+ return [d for d in out if d.get("label") == label]
27
+ # wait until the STRIX_LEAN in-file-MTP file is fully written
28
+ while "quantize time" not in (open(f"{W}/logs/S2_q106.log").read() if os.path.exists(f"{W}/logs/S2_q106.log") else ""):
29
+ time.sleep(15)
30
+ # --- 1. output identity: plain decode vs MTP (default) vs MTP (strict) ---
31
+ run("identity", "id-nospec-orig", T["q106"], binp=OB)
32
+ run("identity", "id-nospec-patched", T["q106"])
33
+ run("identity", "id-mtp-default", T["q106"], infile=True)
34
+ run("identity", "id-mtp-strict", T["q106"], infile=True, strict=True)
35
+ ref = rows("id-nospec-orig")[-1]["text"]
36
+ for lab in ("id-nospec-patched", "id-mtp-default", "id-mtp-strict"):
37
+ t = rows(lab)[-1]["text"]
38
+ k = next((i for i, (x, y) in enumerate(zip(ref, t)) if x != y), None if len(ref) == len(t) else min(len(ref), len(t)))
39
+ log(f"IDENTITY {lab} vs plain-decode: {'IDENTICAL' if t == ref else f'DIVERGES at char {k}'}")
40
+ with open(J, "a") as f: f.write(json.dumps({"label": f"cmp-{lab}", "identical_to_plain": t == ref, "first_diff_char": k}) + "\n")
41
+ # --- 3. prompt cache: unpatched vs patched, reuse + warm/cold identity ---
42
+ run("cachegate", "c-orig-infile", T["q106"], binp=OB, infile=True, reps=1)
43
+ run("cachegate2", "c2-patched-infile", T["q106"], infile=True, reps=3)
44
+ run("cachegate2", "c2-patched-infile-strict", T["q106"], infile=True, strict=True, reps=3)
45
+ run("cachegate2", "c2-patched-nospec", T["q106"], reps=3)
46
+ log("VPLAN_A_DONE")
recipe/pipeline/vplan_b.py ADDED
@@ -0,0 +1,60 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env python3
2
+ """Verification of the two MTP fixes (in-file head + prompt-cache patch). Sequential GPU, box iced.
3
+ Writes results/mtpfix.jsonl. Each step is an isolated harness process."""
4
+ import json, os, subprocess, time
5
+ W = "/mnt/models/agnes-3.0-flash"; N = "Agnes-3.0-Flash-Preview"
6
+ J = f"{W}/results/mtpfix.jsonl"
7
+ PB = "/opt/llama-rocm/rocmfpx-724-mtpcache/build-hipvk/bin" # patched
8
+ OB = "/opt/llama-rocm/rocmfpx-724/build-hipvk/bin" # original d3ca537
9
+ T = {"q106": f"{W}/out-mtp/{N}-MTP-Q4_0_ROCMFP4_STRIX_LEAN.gguf", "q102": f"{W}/out-mtp/{N}-MTP-Q4_0_ROCMFP4_COHERENT.gguf",
10
+ "q115": f"{W}/out-mtp/{N}-MTP-Q8_0_ROCMFPX_AGENT.gguf", "q111": f"{W}/out-mtp/{N}-MTP-Q8_0_ROCMFPX.gguf",
11
+ "q106i": f"{W}/out-mtp-imat/{N}-MTP-imatrix-Q4_0_ROCMFP4_STRIX_LEAN.gguf",
12
+ "q102i": f"{W}/out-mtp-imat/{N}-MTP-imatrix-Q4_0_ROCMFP4_COHERENT.gguf"}
13
+ def log(m): print(f"[{time.strftime('%FT%TZ', time.gmtime())}] {m}", flush=True)
14
+ def run(cmd, label, model, binp=PB, dev="ROCm0", infile=False, strict=False, nmax=4, reps=3, workload="code", extra=()):
15
+ a = ["python3", f"{W}/agnes_harness.py", cmd, "--model", model, "--dev", dev, "--label", label,
16
+ "--reps", str(reps), "--jsonl", J, "--serverlog", f"{W}/logs/v_{label}.log", "--workload", workload, *extra]
17
+ if infile: a += ["--mtp-infile", "--nmax", str(nmax)]
18
+ if strict: a += ["--strict"]
19
+ log(f"{cmd} {label}")
20
+ r = subprocess.run(a, capture_output=True, text=True, env=dict(os.environ, AGNES_BIN=binp))
21
+ print(r.stdout.strip()[-900:], flush=True)
22
+ if r.returncode != 0: print(" RC", r.returncode, r.stderr.strip()[-500:], flush=True)
23
+ return r.returncode
24
+ def rows(label):
25
+ out = [json.loads(l) for l in open(J)] if os.path.exists(J) else []
26
+ return [d for d in out if d.get("label") == label]
27
+ # speed numbers need a quiet box: wait for the whole shrink pipeline (all quants + identity checks)
28
+ while "SHRINK_DONE" not in (open(f"{W}/logs/mtp_bake.log").read() if os.path.exists(f"{W}/logs/mtp_bake.log") else ""):
29
+ time.sleep(20)
30
+ log("box quiet: " + os.popen("uptime").read().strip())
31
+ # --- 0. chunk-ALIGNED prompt-cache identity: the fair test of the patch, run before any speed work ---
32
+ def gate3(label, model, infile=False, strict=False, reps=10):
33
+ a = ["python3", f"{W}/cachegate3.py", "--model", model, "--label", label, "--reps", str(reps),
34
+ "--jsonl", J, "--serverlog", f"{W}/logs/v_{label}.log"]
35
+ if infile: a += ["--mtp-infile"]
36
+ if strict: a += ["--strict"]
37
+ log(f"cachegate3 {label}")
38
+ r = subprocess.run(a, capture_output=True, text=True, env=dict(os.environ, AGNES_BIN=PB))
39
+ print(r.stdout.strip()[-3000:], flush=True)
40
+ if r.returncode != 0: print(" RC", r.returncode, r.stderr.strip()[-800:], flush=True)
41
+ return r.returncode
42
+ gate3("c3-patched-infile", T["q106"], infile=True, reps=10)
43
+ gate3("c3-patched-infile-strict", T["q106"], infile=True, strict=True, reps=5)
44
+ gate3("c3-patched-nospec", T["q106"], reps=5)
45
+ # --- 2. speed: in-file head, patched binary; knee check n3/n4/n5, both modes ---
46
+ run("bench", "p-nospec-rocm", T["q106"])
47
+ for n in (3, 4, 5):
48
+ run("bench", f"p-infile-rocm-n{n}", T["q106"], infile=True, nmax=n)
49
+ run("bench", "p-infile-strict-rocm-n4", T["q106"], infile=True, strict=True)
50
+ run("bench", "p-nospec-vk", T["q106"], dev="Vulkan0")
51
+ run("bench", "p-infile-vk-n4", T["q106"], dev="Vulkan0", infile=True)
52
+ run("bench", "p-infile-strict-vk-n4", T["q106"], dev="Vulkan0", infile=True, strict=True)
53
+ # --- 4. every other tier in the new layout, both backends, default MTP at n4 ---
54
+ for tag in ("q106i", "q102", "q102i", "q115", "q111"):
55
+ for dev, sh in (("ROCm0", "rocm"), ("Vulkan0", "vk")):
56
+ run("bench", f"t-{tag}-{sh}-n4", T[tag], dev=dev, infile=True)
57
+ # --- 5. prose range + tools on the recommended config ---
58
+ run("bench", "p-infile-rocm-n4-prose", T["q106i"], infile=True, workload="prose")
59
+ run("tools", "tools-infile-patched", T["q106i"], infile=True)
60
+ log("VPLAN_B_DONE")
recipe/results_summary.json ADDED
The diff for this file is too large to render. See raw diff
 
recipe/verify_fold.log ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ G4 config: ok
2
+ G1 names: 1305 out vs 1305 expected
3
+ G2 progress 0/1521
4
+ G2 progress 150/1521
5
+ G2 progress 300/1521
6
+ G2 progress 450/1521
7
+ G2 progress 750/1521
8
+ G2 progress 900/1521
9
+ G2 progress 1050/1521
10
+ G2 progress 1200/1521
11
+ G2 progress 1350/1521
12
+ G2 progress 1500/1521
13
+ G2 bit-exact: folded=216 mtp_padded=3 passthrough=1086
14
+ G3 layer 0: max rel err 8.535e-10 (|ref|max 139.673)
15
+ G3 layer 36: max rel err 5.425e-08 (|ref|max 4.395)
16
+ G3 layer 71: max rel err 2.481e-08 (|ref|max 9.612)
17
+ G3 mtp : max rel err 3.030e-08
18
+
19
+ RESULT: PASS (0 failures)