Skip to content

grammar: SparkQwen 0.4.0 literal-dispatch convergence (ported from Enntity; replaces #288) - #293

Merged
AzeezIsh merged 18 commits into
mainfrom
port/sq-literal-dispatch
Oct 31, 2026
Merged

AzeezIsh merged 18 commits into
mainfrom
port/sq-literal-dispatch

Conversation

@AzeezIsh

Copy link
Copy Markdown
Contributor

Summary

The literal-dispatch chain from SparkQwen 0.4.0 (Enntity baa93620b, 19bfc90bd, 0ce591b63, 6a1ccde4f, 318569b87, 17e5c92b0; AGPL-3.0, data-angel). It converges grammar/state.rs, literal_xml.rs, engine_state.rs and first_token.rs onto 0.4.0's versions. Stacked on #290; replaces #288.

One bug found and fixed while porting:

Test plan (reiner + spark2; receipts in reiner's ~/code/night1027/out/core-743a9f8a4/ and ptok/)

  • spark-server bin tests 2983/0. clippy (with and without --tests) is clean.
  • Live prompt tokens for a request with <tool_call> in the user text are now equal to 0.4.0's. Before the fix they were 332 vs 326.
  • Against SparkQwen 0.4.0's engine on its spark config:
    • union_check 15/16, lp_api_probe 13/13, api_parity 26/26, all equal to the parent;
    • the double escape had dropped union_check to 14/16.
    • The one remaining difference is still open: a newline after ```xml in a streamed fenced example.
  • rc16: C1 and C8 greedy 8/8 identical to the parent.

Generated with Devin

data-angel and others added 13 commits October 31, 2026 11:19
(cherry picked from commit baa9362)
(cherry picked from commit 1a443ae)
(cherry picked from commit 19bfc90)
(cherry picked from commit 77dcab5)
(cherry picked from commit 0ce591b)
(cherry picked from commit e4caa61)
(cherry picked from commit 6a1ccde)
(cherry picked from commit aeea5c3)
(cherry picked from commit 318569b)
(cherry picked from commit 0247d58)
(cherry picked from commit 17e5c92)
(cherry picked from commit 08e8d02)
…literal_dispatch, first_token, stop, literal_xml, template, handle_token)
The convergence left both the b1b5381 message-only escape and the
318569b messages+tools escape. The second pass re-escapes the FDD2
sentinels the first wrote, so encode_rendered unwraps them to literal
sentinel bytes: live qwen4_exp prompts grew +6 tokens per <tool_call>
mention and the model echoed a different tool-call dialect. 0.4.0 escapes
once, before auto-compact.
…0b7bd)

has_partial_tool_opener trimmed the buffer for the tag-prefix probe
but callers still saw the raw buffer, so ' \n<' hid the partial opener
and the whitespace was dropped when the marker resolved as literal.
streaming_impl's dsml_leading_whitespace arm now breaks before
consuming the held bytes, matching 0.4.0. literal_markers gains the
missing envelope-open arm.
@AzeezIsh

Copy link
Copy Markdown
Contributor Author

Update at d385b39eb: full parity with SparkQwen 0.4.0's engine on its spark config, measured on the pair. Receipts are in reiner's ~/code/night1027/out/core-d385b39eb/.

Pair results:

  • union_check 16/16, lp_api_probe 13/13, api_parity 26/26 identical to 0.4.0.
  • rc16 C1 and C8 greedy text 8/8 identical to the parent.

The streamed-fence newline is fixed. Two of our streaming hunks had kept pre-ba0b7bd08 shapes:

  • has_partial_tool_opener now probes buffer.trim_start();
  • dsml_leading_whitespace now keeps the held whitespace buffered instead of dropping it.

Also added 0.4.0's envelope_open == <tool_call> arm in literal_markers.

26 literal-XML tests were silently not running, because their mod declarations were lost in a test-file split. This affects main too; see the issue I'm filing. They're restored here, plus a split-token fence-newline test.

  • spark-server bin tests 2997/0. clippy (with and without --tests) is clean.
  • SparkQwen's own product probes in both modes are running as job 1056.

AzeezIsh added a commit that referenced this pull request Oct 31, 2026
…-only usage for Qwen (SparkQwen 0.4.0)

Pair-gated (#220): probes vs SparkQwen 0.4.0's engine, rc16 identity vs parent, tools 21/21; stack top (#293) union 16/16, lp_api 13/13, api_parity 26/26, product probes identical in strict+spark, BFCL 87.54/86.85 = main. CI green except the PR benchmark gate.
AzeezIsh added a commit that referenced this pull request Oct 31, 2026
Pair-gated (#220): probes vs SparkQwen 0.4.0's engine, rc16 identity vs parent, tools 21/21; stack top (#293) union 16/16, lp_api 13/13, api_parity 26/26, product probes identical in strict+spark, BFCL 87.54/86.85 = main. CI green except the PR benchmark gate.
AzeezIsh added a commit that referenced this pull request Oct 31, 2026
Pair-gated (#220): probes vs SparkQwen 0.4.0's engine, rc16 identity vs parent, tools 21/21; stack top (#293) union 16/16, lp_api 13/13, api_parity 26/26, product probes identical in strict+spark, BFCL 87.54/86.85 = main. CI green except the PR benchmark gate.
AzeezIsh added a commit that referenced this pull request Oct 31, 2026
…th-window tests, opt-in copy drafts

Pair-gated (#220): probes vs SparkQwen 0.4.0's engine, rc16 identity vs parent, tools 21/21; stack top (#293) union 16/16, lp_api 13/13, api_parity 26/26, product probes identical in strict+spark, BFCL 87.54/86.85 = main. CI green except the PR benchmark gate.
AzeezIsh added a commit that referenced this pull request Oct 31, 2026
…+ deferred-prefill slot fix

Pair-gated (#220): probes vs SparkQwen 0.4.0's engine, rc16 identity vs parent, tools 21/21; stack top (#293) union 16/16, lp_api 13/13, api_parity 26/26, product probes identical in strict+spark, BFCL 87.54/86.85 = main. CI green except the PR benchmark gate.
@AzeezIsh
AzeezIsh changed the base branch from port/sq-misc-core to main October 31, 2026 23:04
@AzeezIsh
AzeezIsh marked this pull request as ready for review October 31, 2026 23:04
@AzeezIsh

AzeezIsh commented Nov 1, 2026

Copy link
Copy Markdown
Contributor Author

GB10 single-Spark confirmation (sparky, post-merge): this PR was gated as part of integ/train-2026-10-31 (#285 + #284 + #287 + #290 + #293 + #294 + #286 on main 170c3ed) against main at the same base, FP4-Local default recipe profile:

  • controls: FP4-Local byte-identical, Flash-Next NVFP4 byte-identical.
  • BFCL ST-995: train 87.54 / 85.94 (run-1793488879414911145) = base 87.54 / 85.94 (run-1793503255896245487); all 15 subsets identical.
  • agentic-webserver 50: train 47/50, 10.80 s/turn (run-1793478986972058487) vs base 47/50, 10.67 s/turn (run-1793493326878881549). The same 3 iterations (0, 18, 27) fail on both arms ("no Cargo.toml was written"), so that comes from main, not this train. Investigating separately.
  • spark-server tests 3002/0; 0 serve errors.
    Campaign log: docs: FP4-Local post-merge campaign log (2026-10, sparky) #211.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants