Skip to content

Audit audio and codec GGUF cohort - #586

Merged
justinchuby merged 8 commits into
mainfrom
justinchuby-add-audio-codec-gguf-cohort
Aug 25, 2026
Merged

justinchuby merged 8 commits into
mainfrom
justinchuby-add-audio-codec-gguf-cohort

Conversation

@justinchuby

Copy link
Copy Markdown
Member

Summary

  • audit pockettts, qwen3tts, talkie, and wavtokenizer-dec against llama.cpp 8d9af256337d1a501250f9bbf4c0859a654bddd6
  • pin suffix-exact converter tensor inventories and negative closure/misdispatch invariants
  • defer every graph/runtime claim rather than aliasing partial TTS backbones, a novel text LM, or ISTFT parameters to existing Mobius tasks
  • document exact companion sidecars, conditioning/state/rate semantics, overloaded WavTokenizer dimensions, quantization constraints, and pinned real artifacts

Decisions

  • PocketTTS requires matching pockettts_spkenc and pockettts_gen sidecars; its primary GGUF has no semantic LM head.
  • Qwen3-TTS is the transformed talker only, not Mobius Qwen3TTSForConditionalGeneration or Qwen3TTSTokenizerV2Model; speaker encoder, 15-codebook predictor, and code-to-wave decoder are companion-owned.
  • Talkie is a text LM with weight-free RMSNorm, post-RoPE Q/K normalization, gain sidecars, and per-layer embedding skip.
  • WavTokenizer decoder emits non-causal T x 1282 ISTFT parameters, not waveform audio; exact 24-kHz/hop-320 reconstruction remains processor-owned.

All four remain DEFERRED: the GGUFs are valid, but complete Mobius graphs and independent parity evidence do not yet exist.

Validation

  • python -m pytest src/mobius/integrations/gguf/_arch_registry_test.py src/mobius/integrations/gguf/_upstream_gap_test.py src/mobius/integrations/gguf/_builder_test.py -q --tb=short (876 passed)
  • broad non-integration suite excluding the pre-existing glm_moe_dsa shape-inference failure (5,989 passed, 52 skipped)
  • lintrunner --output oneline --all-files

@github-actions

github-actions Bot commented Aug 24, 2026 •

Copy link
Copy Markdown

🏗️ Architecture Diff

Comparing b425a9f → 0dc4ddc

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 24, 2026 •

Copy link
Copy Markdown

Performance Comparison

Comparing b425a9f → 0dc4ddc

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 388 KB 388 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 264 264 +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 126 126 +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 428 428 +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.

@justinchuby
justinchuby force-pushed the justinchuby-add-mmproj-gguf-cohort branch from 33a0d38 to 0768c8c Compare August 25, 2026 15:41
Base automatically changed from justinchuby-add-mmproj-gguf-cohort to main August 25, 2026 15:41
@justinchuby
justinchuby requested a review from a team August 25, 2026 15:41
justinchuby and others added 8 commits August 25, 2026 08:43
Audit PocketTTS, Qwen3-TTS, Talkie, and WavTokenizer decoder semantics against the pinned llama.cpp loaders and converters. Pin suffix-exact tensor inventories, defer unsupported graphs without aliasing components, reject task misdispatch through the existing pre-graph capability gate, and document companion/state/ISTFT and quantization requirements.

Co-authored-by: Copilot App <[email protected]>
Signed-off-by: Justin Chu <[email protected]>
Reject every non-importable GGUF architecture before quantization, config extraction, registry lookup, or graph construction while preserving deferred versus disabled exception semantics. Separate Talkie's 362 loader-created tensors from its 80 converter-only gain sidecars and document the fail-closed policy.

Co-authored-by: Copilot App <[email protected]>
Signed-off-by: Justin Chu <[email protected]>
Reject standalone clip/mmproj inputs through the normal early disabled-architecture gate for local, Hub, API, and CLI routes. Allow clip only when an internal multimodal builder validates it as a companion to a text GGUF.

Co-authored-by: Copilot App <[email protected]>
Signed-off-by: Justin Chu <[email protected]>
Resolve Hub mmproj references through a private companion-only path that permits clip metadata while rejecting non-clip companions before download. Keep the public primary GGUF resolver fail-closed for standalone clip inputs.

Co-authored-by: Copilot App <[email protected]>
Signed-off-by: Justin Chu <[email protected]>
Inspect the bounded GGUF metadata header of the exact selected companion file instead of repository-level architecture metadata. Resolve and download the immutable revision, strip cross-origin auth, support requests and httpx Hub clients, and revalidate the downloaded local header before dispatch.

Co-authored-by: Copilot App <[email protected]>
Signed-off-by: Justin Chu <[email protected]>
Use descriptor-relative target reads where supported and a reparse-point-checked, identity-verified path fallback on Windows. Record specialized coverage for stacked GGUF model registrations so generic coverage gates do not misclassify their bespoke tasks.

Co-authored-by: Copilot App <[email protected]>
Signed-off-by: Justin Chu <[email protected]>
Carry one root identity through path-based config and tokenizer reads, checking it before and after each resource and after the pair completes. Reject directory replacement before mixed target resources can be accepted.

Co-authored-by: Copilot App <[email protected]>
Signed-off-by: Justin Chu <[email protected]>
Keep the existing main-branch phimoe_gguf exemption and remove the duplicate entry replayed from the older stacked history.

Co-authored-by: Copilot App <[email protected]>
Signed-off-by: Justin Chu <[email protected]>
@justinchuby
justinchuby force-pushed the justinchuby-add-audio-codec-gguf-cohort branch from 1fe0c7e to 0dc4ddc Compare August 25, 2026 15:45
Copilot AI lite review requested due to automatic review settings August 25, 2026 15:45
@justinchuby
justinchuby merged commit ea7f072 into main Aug 25, 2026
19 of 22 checks passed
@justinchuby
justinchuby deleted the justinchuby-add-audio-codec-gguf-cohort branch August 25, 2026 15:46

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 tightens Mobius’s GGUF integration around the newly audited audio/TTS/codec cohort and improves multimodal mmproj companion handling, while preserving a strict “deferred until proven” posture (fail early, pin upstream inventories, and avoid accidental task/graph aliasing).

Changes:

  • Mark the C09 audio cohort (pockettts/qwen3tts/talkie/wavtokenizer-dec) as explicitly deferred with pinned tensor inventories and misdispatch guards.
  • Strengthen GGUF build gates so deferred architectures and standalone clip fail before config extraction/output creation, and add an mmproj companion preflight path for Hub references.
  • Harden draft target resource loading (safer open semantics across platforms) and extend documentation/tests to lock in the new invariants.

Reviewed changes

Copilot reviewed 13 out of 13 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
tests/model_coverage_test.py Adds skip-list entries for diffusion model_type aliases now present in the registry.
tests/cli_test.py Adds CLI tests + a minimal GGUF writer helper to ensure deferred/disabled architectures fail before output creation.
src/mobius/integrations/gguf/_upstream.py Extends upstream architecture payload with converter_extra_tensor_names.
src/mobius/integrations/gguf/_upstream_data/llamacpp_pin.json Pins tensor family/name inventories for the audited C09 cohort, including converter-only extras.
src/mobius/integrations/gguf/_mmproj.py Routes mmproj path resolution through a companion-aware resolver and allows mmproj-specific validation.
src/mobius/integrations/gguf/_mmproj_test.py Adds tests covering clip allowance only in companion context and remote companion TOCTOU-style revalidation.
src/mobius/integrations/gguf/_draft.py Improves safe target resource opening/validation, including non-dir_fd fallback and root stability checks.
src/mobius/integrations/gguf/_draft_test.py Adds tests for safe open behavior when dir_fd isn’t supported (symlink/root-swap rejection).
src/mobius/integrations/gguf/_builder.py Adds early architecture gating semantics, a structural GGUF header parser, and Hub exact-file mmproj preflight + immutable revision pinning path.
src/mobius/integrations/gguf/_builder_test.py Adds regression tests ensuring early failure before downstream stages and validates exact-file mmproj preflight behavior.
src/mobius/integrations/gguf/_arch_registry.py Registers C09 cohort architectures as DEFERRED with explicit reasons to prevent incorrect task aliasing.
src/mobius/integrations/gguf/_arch_registry_test.py Pins C09 inventory expectations and asserts misdispatch refusal invariants.
docs/api/build_from_gguf.md Documents the C09 cohort audit/pinning and mmproj companion header preflight behavior.
Suppressed comments (1)

src/mobius/integrations/gguf/_builder.py:449

  • kv_count is a count of metadata entries but it’s currently compared to len(data) (bytes), which doesn’t provide a real safety bound. This also means a crafted header can pick a very large (but still <= len(data)) kv_count and force a long loop before hitting a truncation error. Add a byte-derived upper bound (based on a minimal-per-entry encoding) and a reasonable hard cap.
    kv_count = struct.unpack_from("<Q", data, 16)[0]
    if kv_count > len(data):
        raise ValueError(f"{source!r} declares an impossible GGUF metadata entry count.")
    offset = 24

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines +438 to +444
element_type, offset = read_uint32(offset)
count, offset = read_uint64(offset)
if count > len(data):
raise ValueError(f"{source!r} declares an impossible GGUF metadata array size.")
for _ in range(count):
offset = skip_value(element_type, offset, depth=depth + 1)
return offset
Comment on lines +546 to +551
For a Hub companion reference, Mobius range-reads only the bounded metadata
header of the exact selected filename, verifies that file is `clip`, resolves
the repository ref to an immutable commit, and downloads that same revision.
Repository-level GGUF metadata is not used because mixed text+mmproj repositories
describe the text architecture there. The downloaded local header is validated
again before multimodal builder dispatch.
justinchuby added a commit that referenced this pull request Aug 25, 2026
Preserve the post-#586 fail-closed quantization policy during the hybrid cohort replay. Keep explicit float fallback execution coverage, validate the complete MTP schedule, and pin the new quantized-import architectures.

Co-authored-by: Copilot App <[email protected]>
Signed-off-by: Justin Chu <[email protected]>
justinchuby added a commit that referenced this pull request Aug 25, 2026
## Summary

- add pinned llama.cpp GGUF support for `lfm2`, `qwen35`, `qwen35moe`,
and `qwen3next`
- reconstruct exact per-layer attention/recurrent schedules and validate
architecture dimensions and metadata fail-closed
- enforce suffix-exact mixer tensor contracts, safe fused expert/V-head
transforms, and no-drop quantization handling
- emit deterministic mixed KV/conv/recurrent state ABIs and reject
incompatible generic/static cache tasks
- document pinned real-artifact header censuses and keep all four
runtime verdicts deferred pending independent full-logit and stateful
generation parity

Stacked on #586 (`justinchuby-add-audio-codec-gguf-cohort`).
Routed-expert Qwen3.5-MoE/Qwen3-Next MTP blocks are explicitly rejected
until the MTP sidecar can represent their experts; dense Qwen3.5 MTP
remains supported.

## Validation

- `1640 passed` — full `src/mobius/integrations/gguf` suite
- `6105 passed, 52 skipped` — broad non-integration suite
- two unchanged unrelated `glm_moe_dsa` failures remain in ONNX
checker/output shape inference
- full `lintrunner f --output oneline --all-files` passed
- final high-confidence review found no significant issues

---------

Signed-off-by: Justin Chu <[email protected]>
Co-authored-by: Copilot App <[email protected]>
Copilot-Session: 5e542579-8cc6-4fcf-9019-0af2824b73bf
justinchuby added a commit that referenced this pull request Aug 25, 2026
## Summary
- validate GGUF metadata tables before invoking `gguf.GGUFReader`
- bound array counts by remaining encoded bytes and a 1,000,000-element
safety cap
- fast-skip fixed-width arrays and safely bound nested/string arrays
- share validation with remote architecture header preflight while
preserving big-endian files and continuation shards
- add adversarial coverage for huge counts, truncation, nested arrays,
and the valid cap boundary

## Tests
- `python -m pytest src/mobius/integrations/gguf/_reader_test.py
src/mobius/integrations/gguf/_builder_test.py -q --tb=short`
- `python -m pytest src/mobius/integrations/gguf/_reader_test.py
src/mobius/integrations/gguf/_builder_test.py
src/mobius/integrations/gguf/_shard_set_test.py
src/mobius/integrations/gguf/_preflight_test.py -q --tb=short`
- `python -m pytest src/mobius/integrations/gguf/_docs_test.py -q
--tb=short`
- `python -m pytest tests/build_graph_test.py tests/cli_test.py src/ -q
-k "not phi4mm and not apply_weights_unknown" --tb=short -n auto`
- `lintrunner f --output oneline src/mobius/integrations/gguf/_header.py
src/mobius/integrations/gguf/_reader.py
src/mobius/integrations/gguf/_reader_test.py
src/mobius/integrations/gguf/_builder.py
src/mobius/integrations/gguf/_builder_test.py`

Follow-up to review comment
#586 (comment).

Signed-off-by: Justin Chu <[email protected]>
Co-authored-by: Copilot App <[email protected]>
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.

2 participants