[Spec] Harden multi-layer EAGLE grammar verification - #30155
shanemort1982 wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
Code Review
This pull request adds support for grammar-constrained decoding in the multi-layer EAGLE verification path by generating and applying a vocabulary mask during sampling, preventing the target sampler from accepting grammar-illegal tokens. It also introduces integration tests to guard against regressions. The review feedback recommends using .reshape() instead of .view() when preparing draft tokens on the CPU to prevent potential runtime errors with non-contiguous tensors.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
|
Codex review against current upstream main (2026-07-21): the correctness issue remains real; current main still does not apply the xgrammar vocabulary mask in this multi-layer EAGLE path, so this PR has not been superseded. The overlap/non-overlap integration coverage is valuable. Two things need resolving before merge: (1) rebase/reapply the mask at the current verify/sampling seam because the worker has been substantially refactored upstream, and (2) replace |
c6eb56e to
dee7b7b
Compare
dee7b7b to
6d95fe4
Compare
|
Codex follow-up ? rebased and updated in Current main absorbed the original missing-mask implementation through #31380's shared The PR also adds end-to-end multi-layer EAGLE constrained-decoding coverage for JSON + regex in overlap and non-overlap modes. The title/body now describe the current patch and the stale review thread is resolved. Verified: GitHub lint/pre-commit is green and the PR is mergeable. |
|
CI follow-up: head |
Motivation
The original PR identified a real bug: multi-layer EAGLE could sample target tokens without applying the grammar vocabulary mask. Since this PR was opened, #31380 consolidated single- and multi-layer verification into
eagle_worker_common.run_eagle_verify, so current main now contains the missing mask flow.That shared implementation still reshapes
verify_input.draft_tokenwith.view(...). A non-contiguous tensor can make.view()raise before the grammar mask is built. Current main also has no end-to-end constrained-decoding coverage that launches the multi-layer worker, so the shared-path wiring could regress unnoticed.Modifications
.reshape(...)in the sharedrun_eagle_verifygrammar snapshot so both contiguous and non-contiguous draft-token tensors are handled safely.test_multi_layer_eagle_constrained_decoding.py, exercising JSON and regex constraints with--enable-multi-layer-eagle.The duplicate worker-local mask implementation from the original revision is intentionally gone; current main's shared verify path is the source of truth.
Accuracy Tests
The GPU integration test mirrors the existing single-layer EAGLE constrained-decoding suite and fails if target verification admits a grammar-illegal token. It is registered for
base-bon1-gpu-largeand requires a maintainer CI trigger.Original production evidence that motivated the regression coverage (MiMo-V2.5, 8xB300, tp4, multi-layer EAGLE 3-1-4):
Local verification
python -m py_compileon both changed filespython -m black --checkon both changed filesgit diff --checkThe GPU integration suite cannot run on the Windows authoring host and is left to upstream CI.
Checklist
CI States
Latest PR Test (Base): ❌ Run #29835815371
Latest PR Test (Extra): ❌ Run #29835815568