patches/llama.cpp-any-argument-order.patch (common/chat-auto-parser-generator.cpp, common/parsers/deepseek.cpp): the generated tool-call grammars accept required arguments in any order. Upstream takes them in schema order, which holds when its own sampler is grammar-constrained; this engine samples unconstrained, and DeepSeek V4 Flash and GLM 5.3 Flash both wrote content before path for pi's write tool, so finished calls came back as parse errors (USTRAT-7). Same fix the fork already carries for the Qwen3-Coder parser. GLM's md-toc run passes with it; DeepSeek rerun in progress. tools/acceptance: 300 s per-tool-call watchdog inside the container; the minesweeper judge serves the work tree over HTTP (the headless browser refuses file: URLs) and counts errors correctly; rejudge.sh, summarize.py; pi max output 24576 tokens. tools/pod/bringup.sh copies data/expert-profile.bin into the Flash-Next pack (the engine exits without it). docs/MODEL-FILES.md: DeepSeek V4 Flash UD-IQ2_XXS and GLM 5.3 Flash 3.0bit rows with hashes and first-start results on the 2x B200 pod. bench/unbiased/2026-10-19-step13-acceptance/: record in progress (server lines, engine info, findings; result tables to follow). Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
78 lines
3.7 KiB
Diff
78 lines
3.7 KiB
Diff
diff --git a/common/chat-auto-parser-generator.cpp b/common/chat-auto-parser-generator.cpp
|
|
index b78789d..bfd762c 100644
|
|
--- a/common/chat-auto-parser-generator.cpp
|
|
+++ b/common/chat-auto-parser-generator.cpp
|
|
@@ -391,22 +391,21 @@ common_peg_parser analyze_tools::build_tool_parser_tag_tagged(parser_build_conte
|
|
}
|
|
});
|
|
|
|
- // Build required arg sequence in definition order
|
|
- common_peg_parser args_seq = p.eps();
|
|
- for (size_t i = 0; i < required_parsers.size(); i++) {
|
|
- if (i > 0) {
|
|
- args_seq = args_seq + p.space();
|
|
- }
|
|
- args_seq = args_seq + required_parsers[i];
|
|
+ // UnbiasedStrata 2: every argument, required or optional, in any order. Upstream requires the required
|
|
+ // arguments in the schema's order, which holds when its sampler is constrained by this grammar; here the
|
|
+ // engine samples unconstrained and DeepSeek V4 Flash and GLM 5.3 Flash write `content` before `path` for a
|
|
+ // `write` tool that declares `path` first, so the finished, well-formed call failed to parse. A missing
|
|
+ // required argument is left for the client to report, as it is for optional-only tools.
|
|
+ common_peg_parser any_arg = p.choice();
|
|
+ for (const auto & req : required_parsers) {
|
|
+ any_arg |= req;
|
|
}
|
|
-
|
|
- // Build optional args with flexible ordering
|
|
- if (!optional_parsers.empty()) {
|
|
- common_peg_parser any_opt = p.choice();
|
|
- for (const auto & opt : optional_parsers) {
|
|
- any_opt |= opt;
|
|
- }
|
|
- args_seq = args_seq + p.repeat(p.space() + any_opt, 0, -1);
|
|
+ for (const auto & opt : optional_parsers) {
|
|
+ any_arg |= opt;
|
|
+ }
|
|
+ common_peg_parser args_seq = p.eps();
|
|
+ if (!required_parsers.empty() || !optional_parsers.empty()) {
|
|
+ args_seq = p.repeat(p.space() + any_arg, required_parsers.empty() ? 0 : 1, -1);
|
|
}
|
|
|
|
if (!arguments.start.empty()) {
|
|
diff --git a/common/parsers/deepseek.cpp b/common/parsers/deepseek.cpp
|
|
index 9ca4bb3..ae538f0 100644
|
|
--- a/common/parsers/deepseek.cpp
|
|
+++ b/common/parsers/deepseek.cpp
|
|
@@ -178,20 +178,18 @@ common_chat_params common_chat_params_init_deepseek_v3_2(const common_chat_templ
|
|
}
|
|
});
|
|
|
|
- common_peg_parser args_seq = p.eps();
|
|
- for (size_t i = 0; i < required_parsers.size(); i++) {
|
|
- if (i > 0) {
|
|
- args_seq = args_seq + p.space();
|
|
- }
|
|
- args_seq = args_seq + required_parsers[i];
|
|
+ // UnbiasedStrata 2: every argument in any order (see common/chat-auto-parser-generator.cpp for the reason:
|
|
+ // this engine samples unconstrained, and DeepSeek V4 Flash writes `content` before `path`).
|
|
+ common_peg_parser any_arg = p.choice();
|
|
+ for (const auto & req : required_parsers) {
|
|
+ any_arg |= req;
|
|
}
|
|
-
|
|
- if (!optional_parsers.empty()) {
|
|
- common_peg_parser any_opt = p.choice();
|
|
- for (const auto & opt : optional_parsers) {
|
|
- any_opt |= opt;
|
|
- }
|
|
- args_seq = args_seq + p.repeat(p.space() + any_opt, 0, -1);
|
|
+ for (const auto & opt : optional_parsers) {
|
|
+ any_arg |= opt;
|
|
+ }
|
|
+ common_peg_parser args_seq = p.eps();
|
|
+ if (!required_parsers.empty() || !optional_parsers.empty()) {
|
|
+ args_seq = p.repeat(p.space() + any_arg, required_parsers.empty() ? 0 : 1, -1);
|
|
}
|
|
|
|
common_peg_parser invoke_body = args_seq;
|