Skip to content

Validate exact Qwen3.5 GGUF tokenizer - #643

Merged
justinchuby merged 5 commits into
mainfrom
justinchuby-verify-qwen-tokenizer
Aug 26, 2026
Merged

justinchuby merged 5 commits into
mainfrom
justinchuby-verify-qwen-tokenizer

Conversation

@justinchuby

Copy link
Copy Markdown
Member

Summary

  • add artifact-scoped Qwen3.5 tokenizer evidence for the pinned official Q4_0 GGUF and source tokenizer revision
  • reconstruct only official added tokens plus deterministic unused padding, with ordered vocabulary/merge, special-ID, embedding-row, asset, encoding-vector, and materialized-hash checks
  • keep Qwen3.5 model runtime deferred and preserve existing Qwen2.5 runtime evidence
  • generate concise GGUF API docs from live registries and immutable evidence

Validation

  • initialized all-files lintrunner
  • focused tokenizer/evidence/docs tests
  • broad serial non-integration suite: 8,318 passed, 57 skipped, 12 deselected
  • exact 563,036,064-byte artifact/materializer validation with temporary artifacts removed

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]>
@justinchuby
justinchuby requested review from a team and a lite review from Copilot August 26, 2026 05:06
@github-actions

github-actions Bot commented Aug 26, 2026 •

Copy link
Copy Markdown

🏗️ Architecture Diff

Comparing 99cbb5a → 4fe12b2

Model Sub-model Changes Status

No architecture changes detected. ✅


Legend: ⚪ No change · 🔵 Minor (attrs/inits) · 🟡 Moderate (nodes added/removed) · 🔴 Major (interface changed)

@github-actions

github-actions Bot commented Aug 26, 2026 •

Copy link
Copy Markdown

Performance Comparison

Comparing 99cbb5a → 4fe12b2

Model Metric Baseline Current Delta
bert (feature-extraction) model_size_bytes 359 KB 359 KB +0.0% ⚪
bert (feature-extraction) num_nodes 68 68 +0.0% ⚪
falcon model_size_bytes 364 KB 364 KB +0.0% ⚪
falcon num_nodes 66 66 +0.0% ⚪
gemma2 model_size_bytes 428 KB 428 KB +0.0% ⚪
gemma2 num_nodes 105 105 +0.0% ⚪
gpt2 model_size_bytes 324 KB 324 KB +0.0% ⚪
gpt2 num_nodes 54 54 +0.0% ⚪
llama model_size_bytes 425 KB 425 KB +0.0% ⚪
llama num_nodes 60 60 +0.0% ⚪
llama (static-cache) model_size_bytes 425 KB 425 KB +0.0% ⚪
llama (static-cache) num_nodes 56 56 +0.0% ⚪
mamba (ssm-text-generation) model_size_bytes 296 KB 296 KB +0.0% ⚪
mamba (ssm-text-generation) num_nodes 94 94 +0.0% ⚪
phi3 model_size_bytes 421 KB 421 KB +0.0% ⚪
phi3 num_nodes 58 58 +0.0% ⚪
phi3 (static-cache) model_size_bytes 421 KB 421 KB +0.0% ⚪
phi3 (static-cache) num_nodes 54 54 +0.0% ⚪
qwen2 model_size_bytes 425 KB 425 KB +0.0% ⚪
qwen2 num_nodes 60 60 +0.0% ⚪
qwen2 (static-cache) model_size_bytes 425 KB 425 KB +0.0% ⚪
qwen2 (static-cache) num_nodes 56 56 +0.0% ⚪
qwen3_5_moe (hybrid-text-generation) model_size_bytes 506 KB 506 KB +0.0% ⚪
qwen3_5_moe (hybrid-text-generation) num_nodes 265 265 +0.0% ⚪
qwen3_5_text (hybrid-text-generation) model_size_bytes 458 KB 458 KB +0.0% ⚪
qwen3_5_text (hybrid-text-generation) num_nodes 127 127 +0.0% ⚪
qwen3_5_vl (hybrid-qwen-vl) model_size_bytes 977 KB 977 KB +0.0% ⚪
qwen3_5_vl (hybrid-qwen-vl) num_nodes 450 450 +0.0% ⚪
t5 (seq2seq) model_size_bytes 836 KB 836 KB +0.0% ⚪
t5 (seq2seq) num_nodes 176 176 +0.0% ⚪
whisper (speech-to-text) model_size_bytes 1008 KB 1008 KB +0.0% ⚪
whisper (speech-to-text) num_nodes 128 128 +0.0% ⚪

No performance regressions.

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]>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 GGUFTokenizerEvidence record and a new materialize_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) using tokenizer_config.json’s added_tokens_decoder, with extra evidence checks (materialized digest + representative encodings).
  • Rebuilds docs/api/build_from_gguf.md as 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
)
justinchuby and others added 3 commits August 25, 2026 22:18
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]>
@justinchuby
justinchuby merged commit 9eaf20e into main Aug 26, 2026
7 checks passed
@justinchuby
justinchuby deleted the justinchuby-verify-qwen-tokenizer branch August 26, 2026 05:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants