Skip to content

GB10 27B: default W4A4 dense-FFN prefill makes outputs depend on prefill chunking (up to ~12-nat token-0 shifts; +0.5-0.8% ppl vs W4A16) #95

Closed

Description

@AzeezIsh

Summary. On GB10, Qwen3.8-27B NVFP4 greedy outputs change with nothing but the prefill chunking: a single chunk, 16-token chunks, or the split at token 32 that prefix caching makes to save an SSM checkpoint. Token-0 logits move by up to ~12 nats, and each arm's chosen token can be missing from the other arm's top-20. The amplifier is the default W4A4 dense-FFN prefill (fp4mmq_prefill: activations quantized to NVFP4 e2m1 with ue4m3 group-16 scales before the FP4 MMA). With W4A16 prefill (ATLAS_NO_FFN_NVFP4_MMQ=1) the outputs become chunk-invariant and perplexity improves.

Evidence (reiner jobs 317 / 338 / 354 / 369, main-lineage binary, one variable per pair)

This was the "DFlash2 + prefix caching diverges" hazard (job 236), and it isn't a cache or speculation bug (job 317):

  • Plain decoding diverges on the same prompts.
  • Cache enabled with no hit is bit-identical to a warm hit.
  • CUDA graphs on or off makes no difference.
  • The trigger is the prefill split that enabling caching introduces.

Both GDN prefill implementations (FLA and WY4) show it when chunking alone changes (job 338).

Per-op last-token dumps, one 53-token chunk vs 16-token chunks (job 354):

  • The residual stream drifts from cos 0.9999 at the first attention layer to 0.911 at the last.
  • The dense-FFN output is already at cos 0.992 in layer 0, while its input is at 0.9989.
  • Attention and GDN projections keep BF16 activations and take the same kernel either way. The dense FFN is W4A4.
  • The dump of k_post_norm / q_post_rope is misleading: it slices the last token assuming a token-major layout, and those buffers aren't laid out that way.

Job 369 (same binary, 8 prompts, greedy, top-20):

comparison identical outputs token-0 max|Δlogprob| (median / max)
W4A4 (default): 1 chunk vs 16-token chunks 2/8 1.89 / 12.18
W4A4: 1 chunk vs split@32 4/8 1.50 / 10.48
W4A16: 1 chunk vs 16-token chunks 8/8 0.75 / 1.13
W4A16: 1 chunk vs split@32 7/8 0.97 / 1.50
1 chunk: W4A4 vs W4A16 3/8 4.00 / 12.80
  • Perplexity (8 × 12k windows): W4A16 is −0.76 % on the first 2k tokens and −0.45 % after, and better on 7/8 windows.
  • Cost: 10k-token cold TTFT goes 15.45 → 16.51 s (+6.9 %). Memory is unchanged: pre-KV is 51.0 GB either way.
  • Scope: nvfp4_mmq.cu ships only in kernels/gb10/qwen3.6-27b/nvfp4/, so this affects the qwen3.6-27b and qwen3.8-27b targets. Flash-Next and the others don't compile it.

Plan

  • Make W4A16 the default prefill FFN for these targets, with ATLAS_FFN_NVFP4_MMQ=1 as the opt-in for prefill-throughput-first deployments.
  • Gate on the 27B ST-995 plus the 27B DFlash2 agentic perf leg.
  • Add a CUDA test (already written) that checks whether the MMQ tiles and the quantizer are M-invariant for identical rows. It separates "the kernel depends on the chunk shape" from "FP4 rounding discontinuity amplifies upstream GDN chunk-boundary rounding".
  • Fix the op-dump slicing for head-major buffers.

Activity

  1. AzeezIsh commented on Sep 26, 2026

    @AzeezIsh
    ContributorAuthor

    Correction to the dump note above. The k_post_norm / k_post_rope / q_post_rope cos ~0.4 in job 354 wasn't a layout or slicing problem, because every buffer is token-major. Those three ops were dumped only on the chunk-0 prefill path (cache_skip.rs), so a chunked run's file held chunk 0's last token rather than the prompt's last token. #99 fixes it by dumping them on the paged path as well. The finding itself doesn't change: in the same job, the residual stream (input_norm_in) and the dense-FFN output were already compared on every chunk and drift as reported. The W4A4 attribution rests on job 369.

  2. AzeezIsh commented on Sep 26, 2026

    @AzeezIsh
    ContributorAuthor

    Mechanism settled (reiner job 431). The NVFP4-MMQ W4A4 prefill tiles (mmq16/32/64/128) and the FP4 activation quantizer are bitwise M-invariant for identical rows. The GPU test (test/nvfp4-mmq-tile-invariance, cd5a4dbd6) shows all tiles byte-identical to the mmq64 reference on sliced launches. End to end, a 16-row chunk (mmq16) and a 5-row chunk (mmq16) match the contiguous 53-row mmq64 bit for bit. The quantizer is token-local (per-16-element sub-block amax and ±2 scale search), and its output layout is [k_block][M]. So the chunk sensitivity from job 369 isn't a chunk-shape-dependent kernel. It's the discontinuous FP4 rounding amplifying tiny upstream differences, such as GDN chunk-boundary rounding, which W4A16 (BF16 activations) doesn't amplify. #96 is the fix.

  3. added a commit that references this issue on Sep 26, 2026
  4. AzeezIsh commented on Sep 26, 2026

    @AzeezIsh
    ContributorAuthor

    Fixed by #96 (merged). The dense-FFN prefill on the 27B targets now defaults to W4A16; W4A4 stays available as an opt-in with ATLAS_FFN_NVFP4_MMQ=1.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions