Fix Unicode corruption in native GGUF detokenization - #516
Merged
Merged
Conversation
Contributor
|
Chat app preview removed for |
leehack
marked this pull request as ready for review
September 17, 2026 21:34
This was referenced Sep 17, 2026
leehack
added a commit
that referenced
this pull request
Sep 18, 2026
* fix(deps): bump svgo Bumps the npm_and_yarn group with 1 update in the /website directory: [svgo](https://github.com/svg/svgo). Updates `svgo` from 3.3.4 to 3.3.5 - [Release notes](https://github.com/svg/svgo/releases) - [Commits](svg/svgo@v3.3.4...v3.3.5) --- updated-dependencies: - dependency-name: svgo dependency-version: 3.3.5 dependency-type: indirect dependency-group: npm_and_yarn ... Signed-off-by: dependabot[bot] <support@github.com> * Exclude metadata and import archives from LiteRT runtime inventory (#498) * Load LiteRT companions independently of inventory order (#500) * Preserve required LiteRT iOS provider targets during sync (#501) * Harden LiteRT runtime synchronization and smoke loading (#502) * Adopt qualified LiteRT v0.17.0-1 runtime artifacts * Retain compatible runtime and fix LiteRT smoke dependency loading * Adopt qualified LiteRT v0.17.0-3 runtime (#503) * Adopt qualified LiteRT v0.17.0-2 runtime * Align companion tests with qualified SwiftPM topology * Adopt the published LiteRT Pixel GPU repair * Fix LiteRT Qwen3 thinking control and native system messages (#507) * Fix native Qwen3 thinking-disabled chat templates * Preserve native system-message content and verify chat history * Exercise LiteRT chat in existing Linux and Windows smoke jobs * Make zero-temperature LiteRT generation greedy (#508) * Use greedy sampling for zero-temperature LiteRT generation * Clarify greedy sampling applies to LiteRT CPU and GPU * Adopt LiteRT v0.17.0-5 and enable explicit desktop GPU (#510) * Update LiteRT runtime to v0.17.0-4 * Adopt corrected LiteRT runtime and expose explicit desktop GPU * Test desktop GPU capability boundaries across ABIs * docs: record published desktop GPU qualification * docs: correct LiteRT desktop GPU capability guide (#512) * fix: preserve native GGUF detokenization UTF-8 bytes (#516) * Adopt native v0.4.1 runtime and precision bindings (#497) * Adopt native v0.4.1 runtime and precision bindings * Align performance guide with adopted native runtime * Align native and Web qualification and fix Windows wrapper loading * Fix Windows precision test loading and companion install docs * Resolve Windows precision symbols through native asset declarations * Preserve released install compatibility and test Windows wrapper wiring * Reuse bundled libraries in Windows wrapper regression probes * fix(deps): bump svgo Bumps the npm_and_yarn group with 1 update in the /website directory: [svgo](https://github.com/svg/svgo). Updates `svgo` from 3.3.4 to 3.3.5 - [Release notes](https://github.com/svg/svgo/releases) - [Commits](svg/svgo@v3.3.4...v3.3.5) --- updated-dependencies: - dependency-name: svgo dependency-version: 3.3.5 dependency-type: indirect dependency-group: npm_and_yarn ... Signed-off-by: dependabot[bot] <support@github.com> * fix: remediate website dependency advisories --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Jhin Lee <leehack@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Native
LlamaEngine.detokenizecorrupts non-ASCII text because itsInt8buffer exposes UTF-8 bytes above 127 as negative values. Read the same native buffer asUint8before joining and decoding token pieces.Montréal 👋\n한글 cafénow survives the public tokenize/detokenize path, including characters split across byte tokens.Fixes #511.
Production-readiness scope
Completeness checklist
Test Plan
dart run tool/prepare_workspace.dartwith Flutter 3.47.1 / Dart 3.13.1; no tracked dependency changes.dart format --output=none --set-exit-if-changed .dart analyzedart run tool/testing/check_platform_boundaries.dart./tool/docs/validate_links.sh: docs build and link validation passed.Matrix Evidence
root-vmroot-vmtargetedmacos-arm64-runtime-smokemacos-arm64-runtime-smokeNative artifact:
v0.4.0. Both CPU and Metal requests reported the requested backend. Model SHA256: stories15M61b50d457809a5194818fd22e6724b456cd7bb9a6264c52c8110684c53f3704a; Qwen3.557d1997790d1744fba5b40a7317df71ea5e2acee28c47e78f0cce39c0703f8cf. This is tokenizer correctness evidence, not an inference-throughput comparison. No paid cloud execution.CI result
All 13 checks passed on
719ec4eba1e94953d29b7085c6ee6014f760a351: Linux VM/coverage, macOS and Windows native suites, Chrome, Web chat contract, analysis, docs, companion packages, prompt reuse, preview, advisory and the final test aggregate. CI run. The PR is mergeable with zero unresolved review threads; the independent runtime review is accepted with zero blocking findings.High-risk regression review
fix/native-detokenization-utf8.audit_pr516, auditorcodex-adversarial:pr516:20260917:audit-pr516; 126 targeted tests and 20 real-model checks passed independently. Signed-byte and malformed-policy mutations failed as expected, then were restored.719ec4eba1e94953d29b7085c6ee6014f760a351/21135e37dadf60882ea427db6078ccc90f84a28a.The repository-local evaluator accepted evidence consistency and returned the documented exit 2 (
unverifiedPrerequisites): external App/authentication/ruleset enforcement is intentionally unconfigured and is not a pending manual merge requirement.Independent readiness evidence
{ "schema": "llamadart.high-risk-readiness-evidence", "schema_version": "1.0.0", "timestamp": "2026-09-17T21:32:06Z", "correlation_id": "pr516-independent-audit-20260917", "repository": "leehack/llamadart", "pr_number": 516, "expected_pr_head_sha": "719ec4eba1e94953d29b7085c6ee6014f760a351", "current_base_sha": "21135e37dadf60882ea427db6078ccc90f84a28a", "pr_author": "leehack", "classification": "high-risk", "surfaces": [ "backendRuntime" ], "required_matrix_row_ids": [ "high-risk-exact-head-independent-qa" ], "matrix_row_evidence": { "high-risk-exact-head-independent-qa": { "row_id": "high-risk-exact-head-independent-qa", "result": "pass", "command": "dart test -p vm -j 1 --reporter expanded test/integration/backends/llama_cpp/tokenizer_integration_test.dart test/integration/inference_smoke_test.dart test/unit/backends/llama_cpp/llama_cpp_service_test.dart", "evidence_notes": "Accepted independent blocking-only audit by fresh agent /root/audit_pr516. Exact GitHub head/base verified separately. Production engine/router/worker/service path inspected. Exact-head tokenizer 8/8 and targeted tokenizer/inference/service 126/126 pass. Isolated Int8 mutation causes 5 Unicode failures with 3 controls passing; isolated strict UTF-8 mutation causes only the incomplete-byte test to fail. Restored source is clean. Two verified GGUFs on CPU and Metal produce 20/20 exact public-engine round-trips. All 13 exact-head CI checks success, zero unresolved review threads, zero known PR-caused P1 regressions. Full report and logs are in .dart_tool/issue-511/audit/." } }, "independent_audit": { "auditor_identity": "codex-adversarial:pr516:20260917:audit-pr516", "audit_kind": "codex-adversarial", "audit_head_sha": "719ec4eba1e94953d29b7085c6ee6014f760a351", "audit_base_sha": "21135e37dadf60882ea427db6078ccc90f84a28a", "decision": "accepted", "unresolved_review_threads": 0, "known_pr_caused_p1_regressions": 0, "summary": "Accepted independent blocking-only audit by fresh agent /root/audit_pr516. Exact GitHub head/base verified separately. Production engine/router/worker/service path inspected. Exact-head tokenizer 8/8 and targeted tokenizer/inference/service 126/126 pass. Isolated Int8 mutation causes 5 Unicode failures with 3 controls passing; isolated strict UTF-8 mutation causes only the incomplete-byte test to fail. Restored source is clean. Two verified GGUFs on CPU and Metal produce 20/20 exact public-engine round-trips. All 13 exact-head CI checks success, zero unresolved review threads, zero known PR-caused P1 regressions. Full report and logs are in .dart_tool/issue-511/audit/." }, "structured_output_evidence": null, "affected_test_paths": [ "test/integration/backends/llama_cpp/tokenizer_integration_test.dart" ], "evaluation": null }