loopyt 283ff893d5 debug: capture final logits, and keep the profile forward out of the dumps
Comparing final logits was impossible before: `ref_layer_dump.py` read `logits[0, -1]`, but the
head already collapsed the sequence axis (`x = x[:, -1]`), so logits are `[b, vocab]` and that
index silently stored a 0-dimensional scalar. Every earlier dump had an unusable
`final_row_logits`.

With that fixed, the comparison reframes the remaining drift. On the same 14 tokens:

    prefill   top-1 = 6127 (北京)   margin(6127 - 666) = +0.256
    reference top-1 = 6127 (北京)   margin             = +3.112

Our prefill picks the right token; the error only compresses the margin, by ~12x. But the
end-to-end run, which reaches that context via decode steps, picks 666 (`**`) instead. Same
context, different path, different answer -- so the remaining drift is in **decode**, not in the
per-128 quantization. The quantization floor is still 2.7e-2 and still irreducible
(`H20-DRIFT-ANALYSIS.md` has the DeepGEMM assertion that forces `gran_k == 128` on SM90), but it
is not what flips the token.

Two traps had to be handled to get numbers that mean anything:
- `execute_model_profile_run` runs a full forward + sampler on synthetic tokens. The layer dumps
  were filtered by their prompt-length gate; logits are not, because their row count is the
  number of *selected* tokens (1). The first attempt captured that step and produced cos = 0.34.
  `debug_dump.profiling()` now suspends capture for the whole profile step.
- With `max_tokens=1` both a prompt and a decode step run, and only the prompt one is comparable
  with a prefill-only reference. They are dumped as `logits_prompt` / `logits_decode`.

Also re-runs the layer comparison now that the expert-scale fix has landed: layer 0 went from
1.27e-1 to 2.88e-2 and layer 39 sits at 2.00e-1, so the error curve flattened by an order of
magnitude.
2026-10-21 17:44:21 +08:00
..
_C initial commit 2026-10-20 12:09:42 +08:00
distributed initial commit 2026-10-20 12:09:42 +08:00
engine initial commit 2026-10-20 12:09:42 +08:00
entrypoints initial commit 2026-10-20 12:09:42 +08:00
h20_ops debug: capture final logits, and keep the profile forward out of the dumps 2026-10-21 17:44:21 +08:00
hugging_face style(sm90): satisfy ruff and add the missing type annotations 2026-10-21 17:09:08 +08:00
model_executor debug: capture final logits, and keep the profile forward out of the dumps 2026-10-21 17:44:21 +08:00
npu_ops feat: add SM90 (Hopper) support for DeepSeek-V4.1 inference 2026-10-21 15:18:56 +08:00
structure_output initial commit 2026-10-20 12:09:42 +08:00
ve initial commit 2026-10-20 12:09:42 +08:00
worker debug: capture final logits, and keep the profile forward out of the dumps 2026-10-21 17:44:21 +08:00
__init__.py initial commit 2026-10-20 12:09:42 +08:00
attrdict.py initial commit 2026-10-20 12:09:42 +08:00
config.py initial commit 2026-10-20 12:09:42 +08:00
environ.py initial commit 2026-10-20 12:09:42 +08:00
load_class.py initial commit 2026-10-20 12:09:42 +08:00
logger.py initial commit 2026-10-20 12:09:42 +08:00
model_config_loader.py initial commit 2026-10-20 12:09:42 +08:00
multimodal_tokens.py initial commit 2026-10-20 12:09:42 +08:00
platform.py feat: add SM90 (Hopper) support for DeepSeek-V4.1 inference 2026-10-21 15:18:56 +08:00
py.typed initial commit 2026-10-20 12:09:42 +08:00
sampling_params.py initial commit 2026-10-20 12:09:42 +08:00
sequence.py initial commit 2026-10-20 12:09:42 +08:00
shared_memory.py initial commit 2026-10-20 12:09:42 +08:00
testing.py initial commit 2026-10-20 12:09:42 +08:00
timer.py initial commit 2026-10-20 12:09:42 +08:00
utils.py initial commit 2026-10-20 12:09:42 +08:00