mirror of
https://github.com/mw00/project-maya.git
synced 2026-12-03 21:08:26 +07:00
[GH-ISSUE #402] DeepSeek: verify a tree instead of a chain in the DSpark path (EAGLE-4 reports 1.63-1.85x over DSpark/DFlash2, and the drafter is not the difference) #155
Labels
No labels
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
mw00/project-maya#155
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @precisionailabsllc-collab on GitHub (Oct 23, 2026).
Original GitHub issue: https://github.com/mw00/project-maya/issues/402
What and why
DSpark's verify is a chain: one continuation per position, and an early miss discards every later draft in that
window. EAGLE-4's public deepdive (fal/Fireworks, 2026-10-20) benchmarks against DSpark and DFlash2 and reports
1.63x (Fireworks bench) to 1.85x (their creative bench) more throughput at batch 1 — and the gain is not the
drafter, it is the verification structure:
Their acceptance-length numbers against a chain at equal verification budget: +9.6% (Fireworks dataset),
+12.4% (their text bench), and at a budget of 16 tokens +21.1% / +26.1%. First-token hit rate rises from
72.5% to 85.3% — the gain is concentrated in the early positions, which is exactly where a chain wastes its budget
on later positions that are never reached.
This needs no new drafter. DSpark already produces a distribution at each position, so a tree can be drafted from
it today. What is missing is engine code:
src/ds4/has notree,branch,dfsorbeamanywhere, and the onlydrafting controls are chain-shaped (
specwindow,MAYA_DS4_DSPARK_CUM).What a minimal version looks like
width k, depth d, budget-limited) instead of one token. Reuse the existing confidence cut to decide when to stop.
the shared prefix, its ancestors and itself; siblings and other branches are masked. Position ids follow the path
depth, not the node index.
rejected branches, then take the target's next token (or continue the chain as today for temperature 0).
context length, candidate count) used to widen/deepen the tree only while the cumulative-probability gain per
measured token cost stays above a threshold. That is what removes the fixed
spec/spec_cumknobs.Steps 1-3 are the win; step 4 is the tuning.
What I can offer
I run Maya-S and Maya-XS (v1.1.24 + a few of the open PRs) on a Ryzen AI Max+ 395 (gfx1151, 128 GB), and I have a
harness that measures decode through the engine's own accounting with a strict quiet-window guard, plus a quality panel
that scores logits against a reference. If a branch lands, I can report grep-able decode/acceptance numbers at
16K-35K context, and check that greedy tokens are unchanged (a tree must not change the output distribution).
I am also willing to prototype and test whatever shape of tree you would accept — but the mask and the KV-slot
bookkeeping belong in the engine's own hands rather than a patch of mine.
@precisionailabsllc-collab commented on GitHub (Oct 23, 2026):
A concrete patch sketch, from reading the current code
I filed this as a feature request; since then I read the verify/attention path closely enough to say what a minimal
branch would touch. Posting it in case it saves you the survey — and because one detail makes it smaller than it looks.
What already exists (v1.1.24 anchors)
Model::verify()(src/ds4/ds4_model.cu:8466) lays the drafts as a chain —tk[0] = y; tk[i+1] = drafts[i]— andcalls
forward(tk, T, T); then walkswhile (m < n && h_idx[m] == drafts[m]) ++mfor the accepted prefix.forward()(:10415) takes tokens only; positions are implicitp0 + t. No mask parameter anywhere in theattention path.
WinPlan(:894) already carries a per-token bitmask:unsigned vl— "bit t: token t is inside a picture's span".So a per-row property threaded into the plan and the kernels has precedent.
spec_win(:1004) makeslayer()keepl.ring_bak(:10725) andl.c_snap(:10756) "to replay the accepted rows if drafts are rejected".ds4_kernels.cu):sparse_attn_kernel(:1226),_packed_(:1418),_wmma_(:1609),_mma_(:1807). On gfx1151 the WMMA one runs.The three changes
1. A parent index in the plan (no new infrastructure).
Position ids follow depth, not index:
pos[t] = p0 + depth(t)— cheap to compute once per window when the plan isbuilt, and it is what makes two siblings share a position instead of one attending to the other.
2.
forward()takes the plan's parent array (default null = the linear chain).Every existing caller is unchanged, which keeps the risk contained to the new path.
3. The attention kernels take the same array. Today a row's visibility is "all rows before it in the window", which
is exactly why a second candidate would silently see the first. The mask becomes: a row attends to the prefix rows
(positions before
p0) plus its ancestor chain — for a row at depthd,drows, notposrows. In the WMMAkernel this is a predicate on the candidate index, not a new algorithm; the prefix part is untouched, so the sparse
selection, the FP4 KV and the compression all keep working.
Acceptance and the KV side
(
h_idx[t]), stop at the first level with no such child. Samewhileas today, with a child lookup instead ofm == i.ring_bak/c_snapreplaypath already exists for the rejection case, so this is "replay the accepted rows" with a different row list rather
than new machinery.
Drafting: the tree is free on this engine
draft_()(:8256) already runs its blocks overT = g.d_blockpositions in one pass and keeps per-position logitsbefore sampling one token each. Keeping the top-k of those logits per level is a change inside the drafter's sampler,
not a new model or a second drafter.
What it should be worth
Measured on this machine (Maya-XS, v1.1.24, Ryzen AI Max+ 395): a chain already averages 4.34 tokens per verify
round (position-1 acceptance 88% over 1,384 rounds). Applying EAGLE-4's branch recovery to that base gives roughly
+6% for a width-2 tree at depth 1, more for deeper trees.
And the cost side is unusually favourable here: verifying more rows costs nearly nothing when decode is
memory-bandwidth-bound. I measured
spec=4andspec=12at 18.85 and 18.86 tok/s — 3x more rows, no cost, becausethey ride the same weight reads. The tree spends the resource this hardware has idle.
What I can and cannot do
I am happy to prototype the host side against a design you endorse — the tree builder over the drafter's per-position
logits, the acceptance walk, and the ring compaction with a row list — and to report decode/acceptance numbers at
16K-35K context plus a greedy token-identity check. The mask predicate inside the four attention kernels is the part
that should stay in your hands: it is where a wrong answer would be silent rather than slow.