Repository navigation
Validate exact Qwen3.5 GGUF tokenizer - #643
Merged
Merged
Conversation
Add artifact-scoped tokenizer evidence and reconstruct only the official added-token suffix plus deterministic unused vocabulary padding. Bind ordered token and merge hashes, special IDs, embedding rows, source assets, representative encodings, and the final materialized tokenizer digest while keeping Qwen3.5 runtime deferred.\n\nGenerate the complete GGUF API document from live registries and evidence with concise reason codes, preserving immutable runtime and projector identities without the duplicated audit narrative.\n\nCo-authored-by: Copilot App <[email protected]> Signed-off-by: Justin Chu <[email protected]>
Performance Comparison
|
Stage artifact-scoped tokenizer output in a private sibling directory, recheck the GGUF source identity after asset validation, and publish with atomic no-replace semantics. This prevents source replacement and stale destination contents from producing a mixed package.\n\nCo-authored-by: Copilot App <[email protected]> Signed-off-by: Justin Chu <[email protected]>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds artifact-scoped, immutable evidence for exact Qwen3.5 GGUF tokenizer materialization, strengthens pinned-tokenizer semantic validation (including deterministic reconstruction of missing added tokens), and refreshes the GGUF API documentation from live registries and evidence into a more concise generated format.
Changes:
- Introduces a compact
GGUFTokenizerEvidencerecord and a newmaterialize_evidenced_gguf_tokenizer()entrypoint that only materializes when the complete GGUF artifact identity matches pinned evidence. - Refactors pinned-tokenizer validation to reconstruct missing official added tokens (plus deterministic unused
[PAD{id}]suffix) usingtokenizer_config.json’sadded_tokens_decoder, with extra evidence checks (materialized digest + representative encodings). - Rebuilds
docs/api/build_from_gguf.mdas a concise fully-generated document, including reason codes and evidence tables.
Reviewed changes
Copilot reviewed 7 out of 8 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| src/mobius/integrations/gguf/_tokenizer.py | Adds evidenced materialization entrypoint; adds evidence hooks (materialized digest + representative encodings); refactors added-token reconstruction logic. |
| src/mobius/integrations/gguf/_tokenizer_test.py | Extends tests for compact evidence mismatches and exact added-token reconstruction ordering. |
| src/mobius/integrations/gguf/_tokenizer_evidence.py | New immutable artifact-scoped tokenizer evidence registry and matching logic for exact artifacts. |
| src/mobius/integrations/gguf/_tokenizer_evidence_test.py | New tests validating evidence immutability and fail-closed matching behavior. |
| src/mobius/integrations/gguf/_docs.py | Generates a fully rendered concise GGUF API document, adding reason codes and evidence tables. |
| src/mobius/integrations/gguf/_docs_test.py | Adds assertions that the generated doc is concise and contains key reason codes/evidence strings. |
| src/mobius/integrations/gguf/init.py | Exports materialize_evidenced_gguf_tokenizer. |
| docs/api/build_from_gguf.md | Replaces prior long-form doc with a concise generated document including evidence tables. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Comment on lines
462
to
466
| def update_document(path: Path = DOC_PATH) -> str: | ||
| """Return the documentation with every generated block refreshed.""" | ||
| """Return the complete generated document after rejecting stale upstream pins.""" | ||
| text = path.read_text(encoding="utf-8") | ||
| for name, body in render_blocks().items(): | ||
| text = _replace(text, *_MARKERS[name], body) | ||
| pins = set( | ||
| re.findall( |
Comment on lines
+255
to
+261
| and all( | ||
| token_id < token_count | ||
| and metadata["tokenizer.ggml.tokens"][token_id] == token | ||
| and isinstance(token_types, list) | ||
| and token_types[token_id] in {2, 3} | ||
| for token, token_id in evidence.special_token_ids | ||
| ) |
Store deterministic unused extension IDs in the BPE vocabulary instead of the added-token matcher, and fail closed if ordinary text can emit them. Preserve and revalidate the exact Qwen3.5 tokenizer evidence digest and official special tokens.\n\nRender one concise registry-derived architecture restriction alongside each stable support code so admitted subsets such as dense ERNIE 4.5 remain visible.\n\nCo-authored-by: Copilot App <[email protected]> Signed-off-by: Justin Chu <[email protected]>
Associate the autonomous review fixes with the Copilot App contributor. Co-authored-by: Copilot App <[email protected]> Signed-off-by: Justin Chu <[email protected]>
Render every dynamic tokenizer-evidence value through the Markdown cell escaper so representative special tokens cannot create phantom columns. Co-authored-by: Copilot App <[email protected]> Signed-off-by: Justin Chu <[email protected]>
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
Validation