tools: the real-file reference and the per-position logits comparison
ref/qwen36.py --all-logits dumps result_output_all (the head at every position of the last chunk), the reference a streaming runner is held to position by position. qwen36_prefill_fixture.py's write() gains q8_embd (token_embd.weight as Q8_0, a type a native pack's embedding kernel serves), reused by the runner fixture. qwen36_teacher_llama.cpp is llama.cpp's own greedy continuation of a prompt with the head's logits per position and the routed experts at probed layers; qwen36_compare_logits.py scores top-1 agreement, KL(ref || engine) per position, the drift gate (one-sided: only a KL that rises with position is a leaking state) and the routed-selection overlap. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017tPVMg2wGSNR1KANEiUtwr
This commit is contained in:
1 parent
bc0b297069
commit
bcc7cc8960
4 files changed
+343
-5
No files matched your search
@@ -83,8 +83,10 @@ def cfg(case: str, seed: int) -> qs.Cfg:
|
||||
return c
|
||||
|
||||
|
||||
def write(path: str, c: qs.Cfg) -> tuple[int, int]:
|
||||
"""qwen36_synth_gguf.write with the per-tensor forms above. Returns (tensors, q8 tensors)."""
|
||||
def write(path: str, c: qs.Cfg, q8_embd: bool = False) -> tuple[int, int]:
|
||||
"""qwen36_synth_gguf.write with the per-tensor forms above. Returns (tensors, q8 tensors). `q8_embd` writes
|
||||
token_embd.weight as Q8_0 too (a native pack's embedding must be a type iq_embed_rows serves: the runner's fixture,
|
||||
tests/python/qwen36_runner_fixture.py); the prompt-path harness keeps it F32."""
|
||||
w = GGUFWriter(path, qs.ARCH)
|
||||
k = lambda s: f"{qs.ARCH}.{s}"
|
||||
w.add_name("qwen36-synth prefill-geometry")
|
||||
@@ -122,7 +124,7 @@ def write(path: str, c: qs.Cfg) -> tuple[int, int]:
|
||||
n, nq = 0, 0
|
||||
for name, arr in qs.build_tensors(c):
|
||||
n += 1
|
||||
if name.endswith(Q8_SUFFIXES) or name == "output.weight":
|
||||
if name.endswith(Q8_SUFFIXES) or name == "output.weight" or (q8_embd and name == "token_embd.weight"):
|
||||
w.add_tensor(name, quants.quantize(arr, Q.Q8_0), raw_dtype=Q.Q8_0) # the byte shape; gguf-py derives the elements
|
||||
nq += 1
|
||||
elif name.endswith(BF16_SUFFIXES):
|
||||
|
||||
Reference in new issue
Block a user