You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Sci: CPU KV-phase gate never tests the FP8-active regime; CPU decode_speedup is a timing artifact #137
Pre-registered experiment by Sci, tag sci-e2e-20261122, run on engine main8c5742a (release/engine-1.7.109). It calls hanzo_engine::evaluate_phase_aware_kv_precision on Device::Cpu unmodified, from an out-of-tree harness.
Ledger ID:kernel-perf:hanzo-engine-kv-phase:cpu-fp8-e4m3-decode-fidelity-ctx4k-32k/sci-e2e-20261122. Pre-registration sha256 b9b5895e…236a, result 3f2d7138…d2f8, harness abdb3deb…3503.
Claim: FP8-E4M3 KV keeps decode attention cosine vs F32 above 0.999 for head_dim {64,128,256} × ctx {4096, 8192, 16384, 32768}, which is the regime where PhaseAware (min_fp8_decode_ctx=2048) actually switches to FP8.
Verdict: PROVEN, with a thin margin.
All 12 points passed. The minimum cosine was 0.9996037 (d=64, ctx=4096), only 6e-4 above the threshold. Results were bit-identical across 3 repeats.
FP8 decode max_rel vs F32 was 1.5–3.0e-2, against 1.2–2.6e-3 for BF16 (roughly 10× worse). KV for 36 layers halves as expected, e.g. d=128 at 32k: 1152 → 576 MiB.
Gaps found:
tests/hybrid_prefix_and_kv_phase_eval.rs::hybrid_prefix_and_kv_phase_cpu_gate only asserts at ctx 256/512. That is below min_fp8_decode_ctx=2048, so the CPU CI gate never exercises the FP8 path PhaseAware ships. The CUDA gate covers 4k–32k, but the research ledger has no evidence it has run.
On the portable/CPU path, decode_speedup times two F32 attention calls (bf16 K/V are upcast to F32 first). Each is timed once, with no warm-up. Across identical repeats it ranged from 0.84× to 2.54×. It is noise and should not be reported as an FP8 speedup anywhere.
FP8 scaling is per-tensor amax/240. The inputs are uniform in [-0.4, 0.4] with no outlier channels, so this pass does not certify real-model KV.
Proposed next steps:
Extend the CPU gate grid to at least one ctx ≥ 2048.
Mark decode_speedup as not-measured on non-CUDA backends, or time it properly (warm-up plus median of N, as bench_cuda_op_us does).
Next experiment: repeat with real Qwen3 KV activations captured from hanzod on dgx GB10, comparing per-tensor and per-block FP8 scales.
Extended hybrid_prefix_and_kv_phase_cpu_gate in hanzo-engine/tests/hybrid_prefix_and_kv_phase_eval.rs to &[256, 512, 2048] (min_fp8_decode_ctx = 2048), asserting phase_aware_used_fp8 == false below 2048 and phase_aware_used_fp8 == true at ctx = 2048 with fp8_decode_cosine_vs_f32 >= 0.999.
Added decode_speedup_is_native: bool (false on portable CPU where FP8 E4M3 dequantizes to F32; true on CUDA native FP8 E4M3 paged decode kernel) and upgraded evaluate_single_kv_phase_point_portable to measure causal prefill (seq_q > 1) separately from decode (seq_q = 1) with 3 warmup runs + median of 5 timed repetitions.
Re-verified both CPU gate (hybrid_prefix_and_kv_phase_cpu_gate ... ok) and 12-point GB10 CUDA 4K-32K gate (fp8_decode_cosine_vs_f32 in [0.999571, 0.999687], decode_speedup_is_native = true).
Activity
zeekay commentedon Nov 23, 2026
Fixed in #138 (
2026-11-22):hybrid_prefix_and_kv_phase_cpu_gateinhanzo-engine/tests/hybrid_prefix_and_kv_phase_eval.rsto&[256, 512, 2048](min_fp8_decode_ctx = 2048), assertingphase_aware_used_fp8 == falsebelow2048andphase_aware_used_fp8 == trueatctx = 2048withfp8_decode_cosine_vs_f32 >= 0.999.decode_speedup_is_native: bool(falseon portable CPU where FP8 E4M3 dequantizes to F32;trueon CUDA native FP8 E4M3 paged decode kernel) and upgradedevaluate_single_kv_phase_point_portableto measure causal prefill (seq_q > 1) separately from decode (seq_q = 1) with3warmup runs + median of5timed repetitions.hybrid_prefix_and_kv_phase_cpu_gate ... ok) and 12-point GB10 CUDA4K-32Kgate (fp8_decode_cosine_vs_f32 in [0.999571, 0.999687],decode_speedup_is_native = true).