fix: suppress caller stop markers in native GGUF streams - #526
Merged
Merged
Conversation
Contributor
|
Chat app preview removed for |
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
Fixes #520. Native GGUF streams previously yielded a caller stop marker before checking a 64-byte suffix. The public
alpha cedar17 omegafixture with stopcedar17now emits exactlyalpha.The ordinary, speculative sampled, and speculative accepted-token paths share an incremental byte matcher before yielding. It suppresses within-token tails, handles split UTF-8 and overlapping/long markers, and releases unfinished prefixes at completion without losing bytes. Per-marker prefix state bounds matching work; exact preserved template-token exclusions remain intact.
Production-readiness scope
Completeness checklist
Test Plan
Flutter 3.47.1 / Dart 3.13.1, exact local head
7a3531e1f88d484ac33d363633a782d5d48ea007.Matrix Evidence
alpha; 0 CPU offload, Metal 36/36 and 25/25 offload plus compute buffersRuntime
llamadart-native v0.4.1, upstreamb29c606e28a01b1bc8c1351026a0fa6e616bf6c4; macOS archive SHA25641d0a5298f377641484eb8ddf07cf18ed9f8eb7cbd1e0bf7e4cdc7bd5b0b1487verified against GitHub release digest. Gemma model SHA2560a2fac16f388b4839f075dedb681357aec3e73a96bd66b413e462b6853550c99; Qwen SHA25657d1997790d1744fba5b40a7317df71ea5e2acee28c47e78f0cce39c0703f8cf.Review Notes
Fresh independent audit accepted with zero blocking findings. All 14 hosted checks passed on the exact head below, including Linux/macOS/Windows native suites and Chrome. GraphQL review-thread query currently returns zero unresolved threads. The PR-bound evaluator found internally consistent repository evidence and returned the expected
unverifiedPrerequisites(exit 2) because authenticated auditor/App/environment/ruleset enforcement is intentionally unconfigured. Perdoc/high_risk_pre_merge_readiness.md, that external control is a separate governance scope, not an additional merge prerequisite; manual independent review remains the repository readiness path. This result does not claim operational enforcement.High-risk regression review
backendRuntime,regressionPolicy).fresh-codex-independent_stop_audit, accepted.7a3531e1f88d484ac33d363633a782d5d48ea007/d819bfc1a8ab784a49c97181df8e5293e8ad7516.PR-bound high-risk evidence and local evaluation
{ "schema": "llamadart.high-risk-readiness-evidence", "schema_version": "1.0.0", "timestamp": "2026-09-18T15:46:57.629877Z", "correlation_id": "pr526-stop-marker-7a3531e1", "repository": "leehack/llamadart", "pr_number": 526, "expected_pr_head_sha": "7a3531e1f88d484ac33d363633a782d5d48ea007", "current_base_sha": "d819bfc1a8ab784a49c97181df8e5293e8ad7516", "pr_author": "leehack", "classification": "high-risk", "surfaces": [ "backendRuntime", "regressionPolicy" ], "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": "Independent git diff review against exact base; dart test -p vm test/unit/backends/llama_cpp/stop_sequence_buffer_test.dart; final-head native control and five individual production branch mutations", "evidence_notes": "Fresh independent audit accepted exact head/base, 14 independent buffer tests pass; parent final-head VM2142/Chrome945, four Gemma4/Qwen3.5 CPU/Metal public smokes, nine native integration tests, and five assertion-failing emission/flush mutants. No known P1 regressions. Windows/Linux GPU real-model smokes not rerun. Hosted CI: all 14 checks pass, including actual new native regression tests on Linux, Windows and macOS. Final GraphQL query has zero review threads." } }, "independent_audit": { "auditor_identity": "fresh-codex-independent_stop_audit", "audit_kind": "codex-adversarial", "audit_head_sha": "7a3531e1f88d484ac33d363633a782d5d48ea007", "audit_base_sha": "d819bfc1a8ab784a49c97181df8e5293e8ad7516", "decision": "accepted", "unresolved_review_threads": 0, "known_pr_caused_p1_regressions": 0, "summary": "No blocking findings. Rechecked all three native emission sites, both completion flushes, preserved-token exclusions, cleanup and recovery; KMP fallback, overlapping matches, split bytes, earliest matching start within each piece and incomplete-prefix flush. Amortized linear incoming-byte matching per marker; pending output bounded by longest marker prefix plus incoming piece." }, "structured_output_evidence": null, "affected_test_paths": [ "test/unit/backends/llama_cpp/stop_sequence_buffer_test.dart", "test/unit/backends/llama_cpp/llama_cpp_service_test.dart", "test/integration/stop_sequences_test.dart", "test/e2e/backends/gguf_stop_sequences_e2e_test.dart" ], "evaluation": { "evaluated_at": "2026-09-18T15:46:58.178626Z", "changed_files": [ { "path": "CHANGELOG.md", "status": "modified" }, { "path": "doc/testing_matrix.md", "status": "modified" }, { "path": "lib/src/backends/llama_cpp/llama_cpp_service.dart", "status": "modified" }, { "path": "lib/src/backends/llama_cpp/stop_sequence_buffer.dart", "status": "added" }, { "path": "lib/src/core/models/inference/generation_params.dart", "status": "modified" }, { "path": "test/e2e/backends/gguf_stop_sequences_e2e_test.dart", "status": "added" }, { "path": "test/integration/stop_sequences_test.dart", "status": "added" }, { "path": "test/unit/backends/llama_cpp/llama_cpp_service_test.dart", "status": "modified" }, { "path": "test/unit/backends/llama_cpp/stop_sequence_buffer_test.dart", "status": "added" }, { "path": "tool/testing/run_local_e2e.dart", "status": "modified" }, { "path": "tool/testing/test_matrix.dart", "status": "modified" }, { "path": "website/docs/changelog/recent-releases.md", "status": "modified" }, { "path": "website/docs/configuration/runtime-parameters.md", "status": "modified" } ], "decision": "unverifiedPrerequisites", "failure_classification": "externalPrerequisitesUnavailable", "message": "Repository-local evidence is internally consistent, but auditor authentication, GitHub App publication, protected-environment provenance, and ruleset enforcement are not available. This is not operational merge readiness.", "external_prerequisites": { "app_installed": false, "protected_environment_configured": false, "independent_auditor_authenticated": false, "ruleset_enforced": false, "diagnostic_message": "No repository-local input can authenticate the dedicated GitHub App, protected environment, independent auditor, or conditional ruleset. See doc/high_risk_pre_merge_readiness.md." } } }