Repository navigation
Conversation
a53d61f to
cd99f25
Compare
|
Thanks @NektoDron, a big and well-tested piece of work. Grammar support is a new feature, so it's not in this release; we'll decide on it later. If it goes ahead we'd need three things: requests that work today shouldn't start getting 400s (right now |
cd99f25 to
a469c09
Compare
|
Addressed the three points.
The integrated candidate also passed the full Linux server/tools suites and 24/24 real-GPU grammar checks. The PR body separates those results from the pending Windows run. Understood about the feature hold. |
|
Thanks, build-off by default and request-local state is the right shape. Please share: (1) speed with a grammar on vs off (prefill and decode separately, GPU/CPU/RAM, model+quant), (2) that requests without a grammar give identical output and speed, and (3) the result with DSpark verification on a real run. Windows/HIP is untested so far; tell us if you cannot test them and we will. |
a469c09 to
6fb4de7
Compare
|
I added paired GPU measurements with the grammar build option OFF and ON, and with an actual restrictive grammar in the ON build. Hardware: AMD EPYC 9654 (96 cores/192 threads), 624.9 GiB RAM reported by Linux, one RTX 5090 (32,607 MiB reported VRAM), NVIDIA driver 595.91.07; CUDA 13.1.115 compiler. The model was DeepSeek-V4.1-Flash-1017-heretic HXQ3K (custom XQ3_K expert quantization), with external FP8 Engram tables and DSpark auto, 64 CPU threads, native parallel=4 and a 524,288-token context. Requests were sequential, temperature=0, thinking and the Python loop guard disabled. Both binaries used the same Release/O3 build flags; only MAYA_DS4_GRAMMAR differed. These are four fresh processes in OFF/ON/ON/OFF order, with three prompts per process and three additional grammar requests per ON process. Each measured request had 1,135–1,136 uncached prompt tokens and 130 output tokens. The grammar generated a complete JSON array of exactly 64 single decimal digits: all 6/6 outputs satisfied it.
The pooled ON/no-grammar decode figure is about 12% lower. However, the ON runs interleaved grammar requests, which changed the speculative/lookup history for later requests, so that number does not isolate the compile-option cost. The clean control is the first no-grammar request in each fresh process, before any grammar request: OFF decode was 108.4/107.1 tok/s and ON was 107.3/108.6 tok/s (medians 107.75/107.95); prefill was 587.7/592.5 versus 591.7/595.4 tok/s. All four produced byte-identical 130-token outputs and identical draft counts (131 offered, 116 accepted). This small control detected no slowdown, but does not establish zero overhead generally. Grammar does have a measurable decode cost in the constrained workload above. DSpark verification ran on real model requests: the six grammar requests offered 700 drafts, with 578 accepted and 122 not accepted. The unconstrained totals were OFF 762/698/64 and ON 708/624/84 (offered/accepted/not accepted). Two of the three no-grammar prompt outputs matched across all four processes; the third matched within ON and within OFF but differed between the two mixed request histories. In the earlier automatic-selector experiment this third prompt also varied between repeated runs of the same build. These results do not certify universal no-grammar output identity in mixed histories, or establish the cause of a difference. A separate uninterrupted free-form repeat control showed variability without a sleep transition. To keep prefill comparable I disabled the automatic prefill path selector only for these private benchmarks ( Provenance: the GPU binaries are from the previously qualified integrated I cannot test Windows or HIP on this hardware, so please do run those on your setup. The committed Windows/Python 3.12 job runs the 16 grammar adapter/protocol tests; its actual hosted result still awaits workflow approval. Neither Windows nor HIP GPU execution is being claimed. |
|
Thank you for the paired measurements and for separating the clean control from the interleaved runs. The first-request control shows no slowdown from the build option, and the constrained decode cost is clearly stated. One thing we would like to understand: the third no-grammar prompt differed between the OFF and ON mixed histories. Could you run OFF and ON with the same request order (grammar requests in the same places) to see if that output then matches? We will run Windows and HIP on our side. |
|
I ran the request-order control. One clarification: OFF means the native build option
All 36 requests returned 200, read 1,135–1,136 uncached prompt tokens and produced 130 output tokens. Temperature was 0, thinking and loop guard off, DSpark on, private prefix directories separate per process, and P0 and P1 were byte-identical across all six processes. P2 was not fully repeatable:
Thus P2 matched in the first OFF/ON pair, but differed in the second pair; importantly, it also differed between the two OFF runs and between the two ON runs despite identical request order. The two repeated mixed ON runs differed on P2 too; all six constrained G outputs still satisfied the grammar. Keeping order identical therefore does not eliminate the observed variation. It can occur without any active GBNF request, including in the build with GBNF compiled out, so I cannot attribute it solely to mixed request order or the grammar option. This small control does not establish the numerical/root cause or certify universal no-grammar output identity. The raw results are retained; Windows/HIP execution remains on your side as offered. |
|
I traced the unconstrained third-answer variation further. In this reproduction it starts as a numerical difference after adaptive expert placement, rather than a grammar mask or a random greedy sampler decision. The fresh-process controls used the same warmup followed by six fixed unconstrained requests (
A subsequent pair captured native target logits, expert residency and layer states. The pair had identical initial placement and an identical warmup; its first 17 P0 logit rows were bit-identical. The first residency difference was expert210 on layer4, GPU versus CPU, with the same selected expert IDs and verification-window shape. The first captured hidden-state difference immediately afterwards was only All 851 byte-for-byte expert-cache checks in that matched diagnostic pair passed; there were no copy failures, mismatches or CUDA errors. CPU/GPU expert execution and reduction grouping differ, so timing-dependent adaptive residency can alter the last bits. Later distribution changes can be substantial; this is not merely an almost-tied top-2 choice. Freezing placement removed the variation for this workload, but is not a general cross-hardware determinism guarantee. One diagnostic pair was excluded from the matched-start comparison: its first launch calibrated PCIe after allocating experts (970 in VRAM), while the next read the saved calibration before allocation (1018). Repeating with the same cached calibration removed that startup confound. Trace synchronization affects timing, so none of these diagnostic timings are speed measurements. Separately, I found and fixed a failure-path bug where a failed GGUF expert move was still published. See #935. It was not encountered in the successful-run nondeterminism tests and should not be conflated with their numerical origin. |
6fb4de7 to
be709c1
Compare
|
Rebased onto main The current mixed-GPU/pool changes have been retained. A linked pool or split layout samples in its other engine, so the grammar capability is zero there and an explicit grammar is refused before request state changes. Grammar stays available for the local sampling head, including the mixed-GPU helper layout and native parallel decoding. The rebase also keeps grammar exhaustion on the existing Public-head Linux checks passed with 978 server tests (40 skipped), 941 installer/tools tests (40 skipped), all 18 focused grammar tests and the HIP mapping check. An additional optional Transformers float64 oracle check failed with the local Torch/Transformers stack because grouped matrix multiplication rejects Double input. The same failure was reproduced on unchanged main The standalone public head passed CUDA Release builds with the default grammar option OFF and an explicit ON build. The default target graph excludes the grammar library and checker. Metadata/vocabulary grammar-state and path checks passed. Build tools were CUDA 13.1, GCC 14 and SM120. Fresh integrated RTX 5090 checks at Actual speculative execution was observed in the stochastic grammar probe with Each OFF/ON build accepted 20 legacy-field requests across both APIs and streaming modes. OFF rejected explicit native GBNF with 400, and ON accepted the nullable-sibling grammar request. Comparing the legacy outputs, visible text matched in 19/20 pairs, reasoning text in 12/20, and both together in 11/20. Legacy JSON parsing succeeded for 13/20 OFF responses and 14/20 ON responses. Six OpenAI pairs returned the same invalid
|
What this changes
Add opt-in native DeepSeek GBNF with request-local state, speculative verification and HTTP preflight. The build option
MAYA_DS4_GRAMMARdefaults to OFF.Answers
MAYA_DS4_GRAMMAR=ONand supply an explicit grammar.Tested on
Ubuntu 26.04.1 LTS, AMD EPYC 9654 96-core CPU, approximately 625 GiB visible RAM, one active NVIDIA RTX 5090 with 32 GB VRAM, CUDA 13.1, GCC 14, SM120. The machine has two RTX 5090 cards. The GPU fixture uses the custom Q3_K / FP8-Engram DeepSeek pack, context 524288, four native request slots, CPU64 and DSpark auto. Source versions and historical qualification scope are recorded below.
Speed (if this is a speed change)
The historical measurements and their scope are retained below. The November 14 qualification covers build and feature behavior.
Checks
November 14 rebase
Rebased on main
6651b5b(v1.1.63). Current head isbe709c1df779eebf39c6f5d86a79c34e4111869f.Public-head Linux checks passed with 978 server tests (40 skipped), 941 installer/tools tests (40 skipped), all 18 focused grammar tests and the HIP mapping check.
An additional optional Transformers float64 oracle check failed with the local Torch/Transformers stack because grouped matrix multiplication rejects Double input. The same failure was reproduced on unchanged main
6651b5b. The tools suites passed using the dependency set from the existing CI workflow, where this optional check is skipped.The standalone public head passed CUDA Release builds with the default grammar option OFF and an explicit ON build. The default target graph excludes the grammar library and checker. Metadata/vocabulary grammar-state and path checks passed. Build tools were CUDA 13.1, GCC 14 and SM120.
Fresh integrated RTX 5090 checks at
728cd8c5passed 24 grammar cases and 20 sleep cases, covering four native request slots, grammar changes with prefix reuse, cancellation and follow-up, busy exclusion, explicit wake and concurrent automatic wake. The fixture combines the current #855 and #856 source with the exact #854 F16 loader required by the custom pack. The standalone public #856 CUDA build was checked separately.Actual speculative execution was observed in the stochastic grammar probe with
draft_n=1anddraft_n_accepted=1. The marker restored with 3615 cached tokens. The observed checkpoint took 14.364 s and explicit wake took 9.225 s. These are feature-smoke observations on this fixture.Each OFF/ON build accepted 20 legacy-field requests across both APIs and streaming modes. OFF rejected explicit native GBNF with 400, and ON accepted the nullable-sibling grammar request. Comparing the legacy outputs, visible text matched in 19/20 pairs, reasoning text in 12/20, and both together in 11/20. Legacy JSON parsing succeeded for 13/20 OFF responses and 14/20 ON responses. Six OpenAI pairs returned the same invalid
{"ok":<|end|>true}text in both builds. One additional OFF OpenAI streamingjson_schemaresponse had that marker, while its ON counterpart was valid JSON with a newline. All ten Anthropic final responses were valid JSON, and eight of those pairs had different reasoning text. The route checks establish HTTP/protocol acceptance.The rebase preserves ablation defaults, mixed-GPU startup, pool request state and remote bias/penalty propagation. Linked pool and mixed-GPU split layouts run sampling in the other engine, so they advertise zero grammar capabilities and reject an explicit grammar before request state changes. The mixed-GPU helper layout keeps its sampling head local and retains grammar support.
Grammar exhaustion and pool-link failure share the native sentinel
-2. A grammar request now returns exhaustion directly to the existingDONE grammarpath. The source regression checks capability reporting, guard ordering and this fallback decision. Frontend coverage checks rejection before validation or generation.Earlier implementation and qualification
Add opt-in native DeepSeek GBNF decoding with request-local grammar state and HTTP preflight. Target logits are constrained before the existing sampler. DSpark verification advances a cloned grammar through accepted proposals, and emitted tokens update the request state.
Review fixes
grammar,guided_grammarorstructured_outputs.grammar. Existing JSON aliases keep their previous server handling, includingstructured_outputs,guided_json,json_schemaand ordinaryresponse_format. Nullable fields are treated as absent. The three reported rejections reproduce on the prior implementation and pass after the fix.MAYA_DS4_GRAMMARnow defaults to OFF for every build. A fresh default DeepSeek build succeeded and its target graph contains neither the grammar library nor the checker. An explicit ON build produced the engine and metadata-only checker and passed native vocabulary/state tests.grammar-windowsjob in the existing tests workflow runs all 16 grammar adapter/protocol tests on Windows/Python 3.12. Local Linux execution passed all 16. The actual Windows job awaits hosted fork-workflow approval.Validation
00655481(v1.1.57) and public head6fb4de7. The rebase retains the new GLM CMake include. The head passed 250 relevant Linux grammar/server/Responses/GLM API tests (2 skipped).73b4221source based oncf807579, with the F16 loader and sleep changes. The grammar native implementation matches the reviewed PR; this is not a standalone new-base native build.DS4_PATH_PICK=0in the private benchmark only, median prefill/decode rates were OFF/no grammar 583.1/126.7, ON/no grammar 592.2/111.7, ON/grammar 580.0/90.1 tok/s. The pooled nongrammar decode difference is confounded by intervening grammar requests and different speculative histories.Full hardware/model, per-process and pooled rates, source scope, exploratory failures and limits: #856 (comment)
Follow-up request-order control: four fresh OFF/ON/ON/OFF processes executed identical six-request unconstrained sequences; two ON processes repeated the mixed sequence with grammar requests in the same positions. P0/P1 matched across all six. P2 varied even between two OFF runs with identical order and GBNF compiled out, as well as within ON. At that November 9 request-order stage, equal ordering still allowed variation and its cause was unresolved. All 36 generation requests returned 200; all six constrained outputs satisfied the grammar.
Later on November 9, matched native traces located the earlier unconstrained-answer variation after adaptive expert placement. The first residency difference selected CPU versus GPU execution for an expert, followed by a small hidden-state difference that amplified before text diverged. Freezing placement removed variation in that workload. This diagnosis applies to that earlier matched reproduction. Detailed placement/logit investigation