Skip to content

AA-AgentPerf-Local on one GB10: 27B DFlash2 + 35B MTP status, and a reply to the speed review #447

Backlog

Description

@AzeezIsh

Reply to the AA-AgentPerf review (27B DFlash2 / 35B MTP on one GB10)

Thanks, and especially for pointing at the batch3 MoE, the QAD checkpoint and the
idle levers. I tested every claim I could on sparky before replying. All numbers
below are full AA-AgentPerf-Local runs: all 168 turns, C=1, the standard sampling
preset (T 0.7, top_p 0.8, top_k 20), ignore_eos and prefix cache on. Raw data is in
~/aap/RESULTS.tsv, the per-step timings are in ~/aap/logs/<tag>.log, and the
findings are in ~/aap/LEDGER.md (#40–61).

Where things stand

Cell Before review Now Target
35B MTP (K=2) 119.08 123.32 (skinny MMA + copy drafts) / 122.87 (skinny MMA alone) 134.5
27B DFlash2 (γ=8), checkpoint weights as published 37.16 40.06 (nvidia QAD checkpoint) 51.0
27B DFlash2 with a load-time NVFP4 requant of the GDN FP8 weights (lossy) — 41.52 51.0

Claim by claim

Holds, and measured

  • 27B QAD checkpoint. It is cached and loads: 37.16 → 40.06, with tok/step 3.81 and
    verify fwd 80.8 → 73.1 ms. This is the clean way to get most of the GDN byte savings,
    with no requantization of our own.
  • Idle levers on the 35B.
    • ATLAS_SKINNY_MMA=1 is real: fwd 15.8 → 15.0 ms in the short run, and 122.87
      in the full run (step 23.5 → 23.15).
    • ATLAS_QWEN38_PDL (+ _DECODE) does nothing on the 35B: fwd 15.77 vs 15.81.
    • ATLAS_MTP_REFEED_ACCEPTED=1 leaves acceptance unchanged (2.18 vs 2.17 tok/step).
  • Host sampling cost. I built GPU candidates sampling, ATLAS_VERIFY_CANDIDATES=1.
    • It is the GLM split-head top-64 + tail-mass record path, reused on one GPU with a
      vocab-sliced kernel. It is exact: whole rows are fetched only when the candidates
      don't decide the sample.
    • It removes the host work (dequant + sample 3.05 → D2H 0.42 ms on the 35B).
    • It gives no full-run gain on the 35B: 119.50 vs 119.08, with step_mtp unchanged
      at 23.5 ms. The host work was already hidden behind the drafter's GPU work.
    • On the 27B the step drops ~4 ms (94.4 → 90.5), but tok/s is within run-to-run
      noise (40.81).

Does not hold

  1. "Atlas is not doing lossless rejection sampling." It is.

    • The draft is one-hot: q = δ(d).
    • The verifier samples v ~ p (temperature/top_k/top_p processed) and accepts iff v == d.
      That accepts with probability p(d) = min(1, p(d)/q(d)).
    • On a reject, v is a sample from p restricted to tokens ≠ d, which is exactly
      norm(max(0, p − δ_d)).
    • That is Leviathan's rule for a one-hot proposal. The output distribution is exactly
      the target's.
    • Sampling the drafts (d ~ q) could raise acceptance, from p(argmax q) to Σ min(p, q).
      I measured whether that has room (next point).
  2. "Stochastic drafting will lift acceptance." I measured the ceiling on the same
    prefixes. ATLAS_DIAG_ACCEPT=1 logs, per verify row, the target's processed
    distribution, its max p and p(draft). Over 9,600 verify rows of a full 27B run:

    Draft row mean max p mean p(draft) draft == target argmax
    0 0.958 0.681 0.693
    1 0.953 0.427 0.435
    2–6 0.85–0.90 0.39–0.46 0.39–0.47
    • The target is very peaked at T 0.7 / top_p 0.8. Even a perfect sampled drafter gains
      at most 1 − max p ≈ 4% on row 0.
    • The loss is that the drafter disagrees with the target's argmax 31% of the time
      on row 0, and when it disagrees p(draft) ≈ 0.
    • So the 27B lever is drafter/target agreement, not the sampling rule.
  3. "MTP carry was silently dead." It wasn't.

    • Every 35B MTP run sets ATLAS_MTP_MAX_SEQS=1 (see the # env: header of each log),
      so mtp_multi_seq_mode() is false, and the log prints carry=ON.
    • "78 positions" on a warm 12.9K-token turn is the new suffix after the prefix-cache
      restore, which is what carry is supposed to feed.
  4. "batch3 MoE has no expert dedup, ~2.2–2.8 ms/step free." The premise is true, but the
    gain didn't materialize.

    • I wrote moe_batch3_dedup.cu (ATLAS_MOE_BATCH3_DEDUP=1): same grid and arguments,
      each expert's weights read once per launch (shared expert once, not 3×), bit-identical
      rows (same lanes, k-order and shuffle tree).
    • Full run: 113.35 vs 119.50; verify fwd 19.48 → 20.42 ms, tok/step identical (2.43).
    • The duplicate reads were mostly L2 hits. Having one CTA do up to 3 rows lengthens the
      critical path more than the DRAM bytes save. Dedup stays off.
  5. "ATLAS_EXACT_VERIFY=1 costs the 27B 10–12 ms/step." Dropping it made things worse:
    39.48 vs 41.52. It stays on.

  6. "Drafter window 4096 stops blinding DFlash2." Being measured now; no verdict yet.

    • The drafter's config is sliding_window: 2048 on all 5 layers.
    • Atlas's non-causal path slides its context buffer by watermark (fill to the window,
      drop half), so at window 2048 the drafter sees 1024–2048 rows.
    • At --dflash-window-size 4096 it sees 2048–4096 rows, more than it was trained on.
    • 4096 run, first 5,600 rows: row-0 agreement 0.685 vs 0.693 at 2048, so no visible
      change so far. The full 4096 run and a 3072 run will settle it; I'll post them here.
    • The sparkrun recipe qwen3.8-27b-nvfp4-dflash2.yaml already uses 4096.
    • The proper fix is engine-side either way: keep exactly the last 2048 rows.
  7. "FP8 KV + shared scan will save KV bytes." I built attn_shared_scan_fp8: FP8 E4M3
    widened to BF16 in registers, k_scale folded into the score scale, v_scale applied to
    the partials. It lost on both models:

    • 35B: fwd +0.8 ms, 107.86 (with dedup).
    • 27B: fwd 80.0 → 83.1 ms, 41.62.
    • The kernel is latency-bound, and conversion costs more than the halved KV bytes save.
  8. Copy drafts.

    • 27B DFlash2: 1,895 rounds, 86% of copied drafts accepted, tok/step 3.84 → 4.03, but
      40.95 vs 41.52 tok/s. Copies are capped at the 7-draft block and the drafter
      still runs.
    • 35B: neutral at 123.32 vs 122.87.
  9. 27B "skinny_w4a16_t1 at 209 GB/s, not the floor". The kernel number is right, but the
    cause given isn't.

    • The exact dense-FFN path is not what keeps it off the floor: turning exact off was
      slower (point 5).
    • A fused gate+up+SiLU W4A16 kernel at ~255 GB/s would be a real kernel project.
      Rough size: ~9 ms/step if all 9.6 GB MLP ran at 255 instead of 209 GB/s.
    • I haven't started it. It is now the largest byte-side item left on the 27B.
  10. qwen35_gdn_commit_rows 1.49 ms/step. This is already the deferred replay
    (ATLAS_QWEN38_VERIFY_DEFER). It reads and writes H0 (48 layers × 3 MiB × 2 ≈ 300 MB),
    which is roughly bandwidth.

    • Overlapping it with the propose doesn't help: both are bandwidth-bound.
    • Fusing it into the next verify saves at most one H0 read (~0.65 ms).
  11. DSpine-b16. It is not a DFlash2 drafter, so it is out of scope for the DFlash2 cell.

Memory-footprint and serving addenda (A and B)

These are mostly real engine waste, but none moves a C=1 AA number. At C=1 the KV pool
is nowhere near binding (we serve 128K max-seq-len with room), and the serving-loop items
are C≥2 paths.

Item Status in the code Matters at C=1?
A1 DFlash reserve × max_batch (64) beyond WIDE_DEPTHS' 16 bytes_for_ctx × max_batch; WIDE_DEPTHS (16,3),(MAX,0) confirmed No (KV capacity at high C)
A2 BF16 drafter originals kept beside NVFP4 twins not checked yet No
A3 FP8 GDN in_proj_qkv/z not reclaimed on CUDA True, but deliberate: the comment says the CUDA fp8-prefill-copy path can still re-read the sources; needs proof that path is off before removing the cfg!(atlas_hip) gate No
A4 _t transposed duplicates not checked No
A5 27B TP sharding not checked; TP2 is not in scope No
35B-1 HoloFast Full default duplicates experts Full is the unset default under the low-memory path; whether that doubles experts is unverified No
35B-2 linear_attn_arms "BF16 leak at tp=1" Mostly wrong. At tp=1 qkvz_full IS the live in_proj_qkvz (the slicers return the source pointer), and the BF16 is kept for the prefill path. The in_proj_qkv/in_proj_z BF16 sources in the NVFP4 arm are not freed (the sibling arm frees them): ~1.5 GB real No
B1 gpu.memset loop on padded decode True (decode_a2.rs:368): dispatch_n − n sync memsets No (C≥2)
B2–B5 blocks_mixed, prefill co-dispatch, embed loops, kv_cache lock not checked No (C≥2 / admission)

I'll file A3 (with the CUDA re-read check), the 35B NVFP4-arm source free, and B1 as
separate small PRs. They're worth fixing, just not for these targets.

What's left between us and the targets

  • 35B MTP (122.9–123.3 → 134.5). This needs a step of ~20.6 ms at 2.43 tok/step;
    we're at 22.6–23.2.
    • Verify fwd is 18.1–18.6 ms and at bandwidth per the node profile.
    • The drafter's propose is 3.3 ms, two MTP-head passes of ~230 MB each. Graph-capturing
      the propose and trimming its launches is the main lever left; ~1 ms is plausible.
    • lm_head uses batch4 for M=3: ~0.1 ms.
    • K=3 lost to K=2 (104.5): each extra row reads ~8 more experts.
  • 27B DFlash2 (40–41.5 → 51). This needs ~4.6 tok/step at the current ~90 ms step, or
    a ~75 ms step at 3.85.
    • Acceptance: drafter/target agreement (row 0 0.69). Getting the drafter exactly its
      trained 2048-row window is the first thing to fix.
    • Bytes: the fused MLP kernel above (~9 ms if it reaches 255 GB/s).
    • Propose: truncating the drafter's lm_head vocabulary saves ~2 ms.

"From stock Atlas" and PRs

All of this is Atlas.

  • The bench branch aap/fast-topk-sampler sits on Enntity's spark branch, which carries
    69 commits that aren't in Atlas-Inf main.
  • My own commits apply cleanly onto Atlas-Inf main, except the MTP-head commit, whose
    tree-stats file conflicts.

I'm splitting them into separate PRs, each rebuilt and checked on stock main:

  1. Sampler exact single-pass top-k, and honoring ignore_eos at the <tool_response> stop.
    Also the reference-mode in-think tool-leak cut-off. Both truncated AA turns.
  2. SSE: send the role chunk with the first delta, not at admission. Prefill was being
    billed as decode on every TTFT/decode client.
  3. qwen3.6-35b-a3b: shared-scan attention, with MTP drafts taking it.
  4. MTP head: fused BF16 MoE for a BF16 head.
  5. ATLAS_VERIFY_CANDIDATES (opt-in, exact), once it shows a full-run win.

Not proposed:

  • MoE dedup, the FP8 shared scan and copy-drafts-any: measured neutral or worse.
  • The GDN NVFP4 requant: lossy versus the published checkpoint. The QAD checkpoint is the
    clean route.

Activity

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