Archived
spec: --draft-verify token|block|traversal for the coupled MTP chain
--draft-coupling verifies each row of the chain on its own. Two lossless sequence-level verifiers accept more drafts from the same chain: Block Verification (arXiv 2403.10444) decides the whole chain at once, Traversal Verification (arXiv 2505.12398) walks a path from its last draft back to its first. --draft-verify token (default) is the engine as it was; block switches the coupling on; traversal needs it and is refused otherwise. Block: the sampler marks the consecutive bound rows of a request with the block's length (RadMtpCoupleState::blk) and mtp_couple_verify decides the block on the workgroup of its round-1 row, every FP64 sum a fixed lane tree so the result is the host reference's bit for bit. The wide-plane serial helper is a kernel of its own, which leaves couple_verify without scratch. Traversal: a new op mtp_trav_verify takes the step's topology (parent row, draft token per row) and decides a request on one workgroup, 0 bytes of scratch: the target's law as integer masses of a fixed-point exponential, the walk in FP64. Its header and kernel also handle nodes with several children (Gumbel-top-k and RheoSampling siblings); the serial head here drafts one, so that part has no producer yet and is covered by the tests only. RadMtpCoupleState grows from 152 to 168 bytes (nkids, scheme, blk), so RAD_ABI_VERSION is 41. Exactness: mtp_block_test enumerates the draft tree of a toy model and runs chi-square over the real verify code; mtp_rrs_test runs chi-square and an exhaustive enumeration of the walk (worst |joint - P| 7e-14) with negative controls that fail; spechub_device_test compares the device rows with the host rows. Measured on Qwen3.8-Flash-Next IQR-V4 (TP2, MTP chain 3, coupling) on our branch: about +1% tok/s with traversal, +4.6% at T 1.0 top_k 0. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
9b6eba80c6
commit
d0fd4aa1bb
31 files changed
+5022
-30
No files matched your search
+11
-1
@@ -127,6 +127,12 @@ struct SamplerConfig {
|
||||
/* --draft-coupling: declare the coupled verify (`mtp_couple_verify`) behind the pick and the
|
||||
* per-row state plane it reads. */
|
||||
bool draft_coupling = false;
|
||||
/* --draft-verify block: the chain rows of a coupled request are verified as one block
|
||||
* (abi/rad_mtp_block.h) instead of one at a time. Needs draft_coupling. */
|
||||
bool draft_verify_block = false;
|
||||
/* --draft-verify traversal: `mtp_trav_verify` replaces the row-wise verify behind the pick
|
||||
* (needs draft_coupling) and a per-row topology plane rides with the state plane. */
|
||||
bool draft_verify_traversal = false;
|
||||
};
|
||||
|
||||
/* ================================================================== the driver */
|
||||
@@ -234,7 +240,7 @@ public:
|
||||
* verify op at all. Cleared by build_greedy: a gate for run(), not for evidence. */
|
||||
bool staged_any_couple() const { return any_couple_; }
|
||||
/* The verify op the last build resolved, for naming its kernel in a log line. */
|
||||
rad_op staged_couple_op() const { return op_couple_; }
|
||||
rad_op staged_couple_op() const { return trav_ ? op_trav_ : op_couple_; }
|
||||
|
||||
/* What build_step staged for the coupled verify. build_greedy, which runs between that build
|
||||
* and the step's wait, clears any_couple_ but leaves this snapshot. */
|
||||
@@ -303,6 +309,10 @@ private:
|
||||
rad_op op_allgather_ = RAD_NULL_HANDLE;
|
||||
rad_op op_merge_ = RAD_NULL_HANDLE; /* the candidate merge, under tensor parallel */
|
||||
rad_op op_couple_ = RAD_NULL_HANDLE; /* --draft-coupling only */
|
||||
rad_op op_trav_ = RAD_NULL_HANDLE; /* --draft-verify traversal: replaces op_couple_ */
|
||||
rad_buf buf_trav_ = RAD_NULL_HANDLE; /* [rows, 2] i32: parent row (-1 root), draft token */
|
||||
int32_t* trav_stage_ = nullptr; /* pinned, 2 words a sampled row */
|
||||
bool trav_ = false;
|
||||
rad_op op_logprobs_ = RAD_NULL_HANDLE; /* summary of the raw distribution */
|
||||
rad_op op_lp_gather_ = RAD_NULL_HANDLE; /* every rank's summary, under a split vocabulary */
|
||||
|
||||
|
||||
Reference in new issue
Block a user