From d308bbeb2cbec356066fe53c973aefca852ccd06 Mon Sep 17 00:00:00 2001 From: leehack Date: Wed, 18 Nov 2026 10:26:25 -0500 Subject: [PATCH] chore: fix P3 wording and WebGPU coreVariant sweep items (Refs #2048) --- doc/cross_platform_validation.md | 2 +- lib/src/core/engine/engine.dart | 3 ++- .../assets/capability_coverage.json | 2 +- skills/llamadart-tool-calling/SKILL.md | 4 ++-- test/e2e/webgpu/tool_choice_grammar_e2e_test.dart | 14 ++++++++++---- website/docs/guides/chat-template-and-parsing.md | 6 +++--- website/docs/guides/tool-calling.md | 7 ++++--- website/docs/platforms/webgpu-bridge.md | 2 +- 8 files changed, 24 insertions(+), 16 deletions(-) diff --git a/doc/cross_platform_validation.md b/doc/cross_platform_validation.md index f486efb39..5f254deec 100644 --- a/doc/cross_platform_validation.md +++ b/doc/cross_platform_validation.md @@ -1655,7 +1655,7 @@ the `v0.19.1-5` Android runtime prepared in that route created the engine and failed the first generation. Set B, on the PR head `a9c83d50` ([#2006](https://github.com/leehack/llamadart/pull/2006), -clean bundles, LiteRT-LM `v0.19.1-5`, `libLiteRtLm.so` `9926197b…`), graded with +clean bundles for G1–G4, LiteRT-LM `v0.19.1-5`, `libLiteRtLm.so` `9926197b…`), graded with the same verifier. Each OpenCL run logs one `Loaded OpenCL library with dlopen.` record in the test process; W2c's app omits the `libOpenCL.so` declaration (a diagnostic build with two local patches) and logs one Mali-G715 Vulkan diff --git a/lib/src/core/engine/engine.dart b/lib/src/core/engine/engine.dart index ba1b3ed0b..f13f31dce 100644 --- a/lib/src/core/engine/engine.dart +++ b/lib/src/core/engine/engine.dart @@ -3301,7 +3301,8 @@ class LlamaEngine implements LlamadartEngine { /// On native llama.cpp, `tokenizer.ggml.bos_token` and /// `tokenizer.ggml.eos_token` hold the vocabulary's BOS and EOS token text as /// llama.cpp resolves it for a chat template (including its default ids for - /// a vocabulary that sets none), empty only when the id is negative. + /// a vocabulary that sets none), empty when the id is negative or has no + /// piece text. /// /// On native LiteRT-LM, `tokenizer.chat_template` is the template the /// runtime renders for text-only chats: the bundle's embedded template, or diff --git a/packages/llamadart_validation/assets/capability_coverage.json b/packages/llamadart_validation/assets/capability_coverage.json index 478a56409..71f476381 100644 --- a/packages/llamadart_validation/assets/capability_coverage.json +++ b/packages/llamadart_validation/assets/capability_coverage.json @@ -1,6 +1,6 @@ { "schema_version": 1, - "description": "Source-derived obligation inventory only. Public LiteRT-LM C API 1.0 activation has compiled-fixture default-client/service/speech dispatch, cancellation and reload controls in litert_lm_v1_public_qualification_test.dart; actual public rows bind chat-litert-cpu and reviewed ASR inputs separately. These model-free controls do not qualify artifacts, devices or new capability families; adoption remains https://github.com/leehack/llamadart/issues/1677. Existing pack bindings do not assert execution, platform/backend qualification or completeness of every semantic branch. Exemptions remain open work. Native LiteRT-LM catalog 10 S01 records capability admission only; the maintained litert-lm-json-schema local scenario (and chat-app-litert-json-schema on Android devices) supplies per-model (Qwen3-0.6B, Gemma 4 E2B) CPU and GPU enforcement, schema-contract and Gemma 4 thinking evidence on each qualified host, now including Android arm64 CPU and GPU on a Galaxy S24 and a Pixel 9 Pro, run by chat-app-litert-json-schema. Linux x64 CPU and GPU are qualified on an NVIDIA L4 (driver 615.71, Vulkan), and Windows x64 CPU and GPU on an NVIDIA L4 (GRID 596.86, Direct3D 12); the Linux arm64 GPU stays unqualified. Validation-pack qualification of the widened contract and of non-macOS hosts remains https://github.com/leehack/llamadart/issues/174.", + "description": "Source-derived obligation inventory only. Public LiteRT-LM C API 1.0 activation has compiled-fixture default-client/service/speech dispatch, cancellation and reload controls in litert_lm_v1_public_qualification_test.dart; actual public rows bind chat-litert-cpu and reviewed ASR inputs separately. These model-free controls do not qualify artifacts, devices or new capability families; adoption remains https://github.com/leehack/llamadart/issues/1677. Existing pack bindings do not assert execution, platform/backend qualification or completeness of every semantic branch. Exemptions remain open work. Native LiteRT-LM catalog 10 S01 records capability admission only; the maintained litert-lm-json-schema local scenario (and chat-app-litert-json-schema on Android devices) supplies per-model (Qwen3-0.6B, Gemma 4 E2B) CPU and GPU enforcement, schema-contract and Gemma 4 thinking evidence on each qualified host, now including Android arm64 CPU and GPU on a Galaxy S24 and a Pixel 9 Pro. Linux x64 CPU and GPU are qualified on an NVIDIA L4 (driver 615.71, Vulkan), and Windows x64 CPU and GPU on an NVIDIA L4 (GRID 596.86, Direct3D 12); the Linux arm64 GPU stays unqualified. Validation-pack qualification of the widened contract and of non-macOS hosts remains https://github.com/leehack/llamadart/issues/174.", "packs": [ { "id": "batching", diff --git a/skills/llamadart-tool-calling/SKILL.md b/skills/llamadart-tool-calling/SKILL.md index 1f149c913..dcb747c5d 100644 --- a/skills/llamadart-tool-calling/SKILL.md +++ b/skills/llamadart-tool-calling/SKILL.md @@ -138,13 +138,13 @@ description: >- whitespace between the closers. A string cannot contain the literal `<|tool_call_end|>`; an unclosed one holds no `<|`. Auto grammar preserves copied bare text and balanced object/list spellings as strings only for one required - plain string argument. Copied path-like values may retain a trailing backslash + plain string argument (excluding `<` and `>` from unquoted copied spellings). Copied path-like values may retain a trailing backslash or an unmatched opening quote, in a singleton list without a terminal comma. Ambiguous spellings stay non-executable; other declarations retain their types and strict quote boundaries. A schema-valid auto prefix closed with a foreign XML tag can remain raw diagnostic text with no executable calls. A trailing list comma cannot lead into this diagnostic form. Its argument bytes exclude - `<` and its tail excludes special markers; never execute these diagnostics. Required/force-JSON and `none` behavior is unchanged. + `<` and its tail excludes `<|` marker prefixes; never execute these diagnostics. Required/force-JSON and `none` behavior is unchanged. For the one-string form, values that would continue a completed copied-path call use the existing Python `tool(arguments={"field":"..."})` envelope with JSON string escaping. The inner object follows the declared single-field diff --git a/test/e2e/webgpu/tool_choice_grammar_e2e_test.dart b/test/e2e/webgpu/tool_choice_grammar_e2e_test.dart index e114fdbd8..316284cbf 100644 --- a/test/e2e/webgpu/tool_choice_grammar_e2e_test.dart +++ b/test/e2e/webgpu/tool_choice_grammar_e2e_test.dart @@ -421,6 +421,10 @@ void main() { routeNotRun = 'legacy assets are ${assetFacts[assets]?['assetsTag']}, ' 'not $_legacyAssetsTag'; + } else if (!legacy && + binding['coreVariant'] != 'wasm32' && + binding['coreVariant'] != 'wasm64') { + routeNotRun = 'unexpected coreVariant: ${binding['coreVariant']}'; } }); @@ -431,15 +435,17 @@ void main() { } if (notRunReason != null || routeNotRun != null) return; final facts = assetFacts[assets]; - final coreKey = binding['coreVariant'] == 'wasm64' - ? 'coreWasm64Sha256' - : 'coreWasm32Sha256'; + final coreKey = switch (binding['coreVariant']) { + 'wasm64' => 'coreWasm64Sha256', + 'wasm32' => 'coreWasm32Sha256', + _ => null, + }; final receipt = { 'route': route.name, 'results': results, 'binding': binding, ...?facts, - 'coreWasmSha256': facts?[coreKey], + 'coreWasmSha256': coreKey == null ? null : facts?[coreKey], ...modelFacts, 'penalty': recorder.calls.isEmpty ? null diff --git a/website/docs/guides/chat-template-and-parsing.md b/website/docs/guides/chat-template-and-parsing.md index ea9e13233..f300641ff 100644 --- a/website/docs/guides/chat-template-and-parsing.md +++ b/website/docs/guides/chat-template-and-parsing.md @@ -177,9 +177,9 @@ stream rules of each format. On native llama.cpp, `engine.getMetadata()` reports the vocabulary's BOS and EOS token text as `tokenizer.ggml.bos_token` and `tokenizer.ggml.eos_token`, resolved as llama.cpp resolves them (including its default ids for a -vocabulary that sets none; empty only when the id is negative), and templates -render them as `bos_token` and `eos_token`. GGUF files store only the token -ids. +vocabulary that sets none; empty when the id is negative or has no piece +text), and templates render them as `bos_token` and `eos_token`. GGUF files +store only the token ids. ### LiteRT-LM template registry diff --git a/website/docs/guides/tool-calling.md b/website/docs/guides/tool-calling.md index cc1ea43b9..be436612a 100644 --- a/website/docs/guides/tool-calling.md +++ b/website/docs/guides/tool-calling.md @@ -196,7 +196,8 @@ For a string parameter, `value=False` remains the string `"False"`; copied backslashes in Python-style string arguments remain literal. Ambiguous copied text and escaped text are not globally unescaped. The existing JSON call form keeps JSON string decoding. For a tool with one required plain string argument, auto grammar also preserves -parser-supported bare text and balanced object/list spellings as strings. Copied +parser-supported bare text and balanced object/list spellings as strings +(excluding `<` and `>` from unquoted copied spellings). Copied path-like values may retain a trailing backslash or an unmatched opening quote, in a singleton list without a terminal comma. Ambiguous copied spellings remain non-executable; the grammar does not reinterpret them as a different value. @@ -204,8 +205,8 @@ Other declarations and list forms retain their declared types and strict quotes. An auto reply closed with a foreign XML tag such as `` can remain raw diagnostic text instead of being forced into an executable tool envelope. This diagnostic form requires a schema-valid call prefix without a trailing -list comma, excludes `<` from its argument bytes, and excludes special markers -from its tail. It never yields an executable call. Required/force-JSON and `none` behavior is unchanged. +list comma, excludes `<` from its argument bytes, and excludes `<|` marker +prefixes from its tail. It never yields an executable call. Required/force-JSON and `none` behavior is unchanged. For that one-string form, a direct string cannot continue a completed copied-path call as argument data. Such values use the existing Python wrapper `save_note(arguments={"text":"..."})`, whose JSON string encoding preserves the diff --git a/website/docs/platforms/webgpu-bridge.md b/website/docs/platforms/webgpu-bridge.md index 4d1fa0afd..ef410e5a8 100644 --- a/website/docs/platforms/webgpu-bridge.md +++ b/website/docs/platforms/webgpu-bridge.md @@ -472,5 +472,5 @@ probe, not the tag. | `v0.1.75` | A draft context that does not fit throws `LlamaUnsupportedException` and the target stays usable | The draft leaks until the runtime aborts | | `v0.1.76` | The projector copy behind the repeated wasm32 media batch abort is freed (repeated batches qualified on wasm32, measured on the pinned assets; memory64 recommended for headroom) | Repeated media batches can abort on wasm32 | | `v0.1.79+` | A worker image or audio `embed` gets 10 minutes per input | Two minutes per request | -| `v0.1.85+` | A page without cross-origin isolation rejects the load at once (`CrossOriginIsolationError`); `gpu_unavailable:` runtime note; 0 GPU layers skip the WebGPU backend | Minutes of init timeout, then a generic error; no reason note; the WebGPU backend is created anyway | | `v0.1.84+` | A thinking budget keeps a grammar that takes the thought applied (`thinkingBudgetPauseGrammar`) | That combination throws `LlamaUnsupportedException` | +| `v0.1.85+` | A page without cross-origin isolation rejects the load at once (`CrossOriginIsolationError`); `gpu_unavailable:` runtime note; 0 GPU layers skip the WebGPU backend | Minutes of init timeout, then a generic error; no reason note; the WebGPU backend is created anyway |