Skip to content

Optimize Weaver tree construction and verification - #3

Merged
hikettei merged 9 commits into
mainfrom
ry2009/selective-bf16-gdn-20260804
Sep 8, 2026
Merged

hikettei merged 9 commits into
mainfrom
ry2009/selective-bf16-gdn-20260804

Conversation

@ry2009

@ry2009 ry2009 commented Aug 4, 2026 •

Copy link
Copy Markdown

Scope

This draft is the complete checkpoint-compatible Weaver runtime handoff for Yuma. It is intentionally based on main so every implemented speedup is visible in one checkout.

1. Tree construction

  • replaces repeated frontier gather/scatter work with fused Triton frontier materialization
  • keeps exact candidate tokens, parents, depths, scores, and log-probabilities
  • bounds construction at the requested tree budget

Measured on the frozen Weaver runtime path:

  • builder: 1994.8 -> 1495.2 us
  • pooled end-to-end throughput: 171.83 -> 176.40 tok/s (+2.66%)
  • opposite-order runs: +3.28% / +2.05%
  • exact output and tree-topology parity

2. GDN tree verification

  • bounds fused GDN work by actual draft depth
  • preserves the existing rollback-free lazy commit path
  • adds an opt-in selective-BF16 operand path for tensor-core products
  • keeps prefix construction, triangular inverse, forward substitution, lazy readout/state, and committed state on the existing higher-precision path

The selective-BF16 fixed-context test used one frozen checkpoint and 192 contexts:

  • expected accepted-token delta: +0.00137660
  • trajectory-cluster 95% CI: [-0.00368479, +0.00643563]
  • no detectable regression within the predeclared 0.01-token margin
  • not bitwise lossless; no end-to-end throughput claim yet

3. Compact non-greedy verification

  • adds both correct forward paths:
    • target_only: sample from the target, follow the matching child when present, otherwise emit from the remaining target mass
    • traversal: sample sibling order without replacement and apply corrected residual updates
  • removes the dense FP32 [tree_nodes, vocab] proposal scratch from target-only verification
  • preserves accepted leaf-slot publication for GDN/Mamba commit
  • supports target top-k/top-p/min-p filtering and request-stable RNG
  • rejects unsupported evolving repetition/frequency/presence penalties rather than silently changing the distribution

Established microbenchmark evidence:

  • verifier stage: 2.08x conservative / 2.36x best
  • scratch removed at T=64, vocab=248320: 60.6 MiB
  • end-to-end gain is not yet statistically established

Validation

  • 11/11 exact CPU distribution-oracle tests pass on the B200 host
  • exhaustive multistep target-only and traversal distributions
  • residual and zero-residual subtree cases
  • duplicate sibling rejection
  • sampler filter-order parity
  • CUDA parity/distribution tests and standalone B200 benchmarks are included
  • focused Ruff, formatting, py_compile, and git diff --check pass

Claim boundary

The only established end-to-end gain in this draft is the +2.66% tree-construction result. Compact verification has a strong stage-level result but still needs the final corrected temperature-1 paired E2E gate. Selective BF16 has fixed-context non-inferiority evidence but also needs E2E timing before enablement.

Training changes, checkpoint averaging, Pairgram/bigram scorer experiments, RoPE/SwiGLU architecture changes, and data work are excluded because they are Yuma's separate training track or are not drop-in runtime optimizations.


CI States

Latest PR Test (Base): ❌ Missing run-ci label -- add it to run CI tests.
Latest PR Test (Extra): ❌ Run #31362252682

ry2009 added 4 commits August 2, 2026 11:32
Fuse selected-node materialization and frontier publication, compile candidate gathering into the indexed step, and skip the inherited draft sampler that Weaver does not consume. Add a CUDA parity and graph-replay benchmark against the legacy path.
Allocate tree-structure buffers at the configured draft depth, use the direct parent-walk builder, skip inverse-series squaring beyond the reachable tree depth, and use the measured four-warp output launch.
@github-actions github-actions Bot added the documentation Improvements or additions to documentation label Aug 4, 2026
@ry2009 ry2009 changed the title Add selective BF16 operands to tree GDN verification Optimize Weaver tree construction and verification Aug 4, 2026
@ry2009
ry2009 changed the base branch from ry2009/weaver-runtime-maxwins-20260730 to main August 4, 2026 21:03
CC-Yeh and others added 4 commits August 9, 2026 17:47
- Fuse Weaver frontier selection, materialization, and cache publication into GPU kernels.
- Keep verification outputs and DFlash cache finalization GPU-resident.
- Defer committed sequence-length synchronization with reusable pinned host buffers.
- Remove legacy Weaver branches, runtime toggles, and experiment-only benchmarks.
- Improve seed-0 throughput from 284.23 to 306.54 TPS, a 7.85% speedup.
Fuse Weaver verification and GPU-resident DFlash finalization
@hikettei
hikettei marked this pull request as ready for review September 8, 2026 11:21
@hikettei
hikettei requested a review from a team September 8, 2026 11:21
@hikettei
hikettei merged commit aeac03f into main Sep 8, 2026
53 of 64 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants