Repository navigation
Add T5 GGUF import cohort - #580
Conversation
🏗️ Architecture Diff
t5 (seq2seq) / encoder — 1 change(s)Op summary: 81 → 81 nodes No op-sequence changes. Connectivity changes:
Legend: ⚪ No change · 🔵 Minor (attrs/inits) · 🟡 Moderate (nodes added/removed) · 🔴 Major (interface changed) |
Performance Comparison
|
032a967 to
a7a8aad
Compare
Implement pinned t5 and t5encoder metadata, tensor closure, graph dispatch, quantized projections, relative-bias ownership, and seq2seq cross-cache semantics. Add synthetic float/quantized runtime coverage, HuggingFace cached-decode parity, provenance documentation, and deferred runtime verdicts. Co-authored-by: Copilot App <[email protected]> Signed-off-by: Justin Chu <[email protected]>
Reject gated T5 artifacts because the pinned converter omits source activation metadata even though llama.cpp always dispatches them as tanh GELU. Validate encoder and decoder tensor layer indices canonically and within declared bounds before graph construction, while narrowing ignored tensor exceptions to exact pinned names. Co-authored-by: Copilot App <[email protected]> Copilot-Session: 59c34ad7-370a-4534-96f4-d5a97f36f808 Signed-off-by: Justin Chu <[email protected]>
Gate GGUF-only cross-attention cache reuse and decoder mask expansion behind an enhanced Seq2Seq task. Keep the ordinary T5 graph on its historical 176-node contract and add a deterministic regression test for its component counts and cross-cache input shape. Co-authored-by: Copilot App <[email protected]> Signed-off-by: Justin Chu <[email protected]>
Move the deterministic standard-T5 graph contract assertion into the pytest-discovered co-located T5 test module so CI exercises the 176-node contract, component counts, decoder input set, and historical cross-cache shape. Co-authored-by: Copilot App <[email protected]> Signed-off-by: Justin Chu <[email protected]>
Include the newly importable T5 and T5 encoder architectures in the quantized-import policy set introduced by the squashed parent branch. This keeps the architecture registry invariant aligned after rebasing onto main. Co-authored-by: Copilot App <[email protected]> Signed-off-by: Justin Chu <[email protected]>
072a6de to
05d2809
Compare
There was a problem hiding this comment.
Pull request overview
This PR adds a new GGUF import cohort for T5 (t5 and t5encoder) in Mobius, including pinned llama.cpp tensor-name closure + config extraction, new T5 masking and cross-attention cache semantics, and expanded unit/integration test coverage and documentation. It fits into the mobius.integrations.gguf importer pipeline by extending the architecture registry, tensor/config mapping, and pre-build validation gates.
Changes:
- Add pinned GGUF tensor/config mappings and strict pre-build validation for
t5/t5encoder, including mask/cross-cache and quantization constraints. - Extend the T5 ONNX model implementation to support per-layer relative-bias ownership, optional mask-based padding bias, and cross-attention KV caching.
- Add/extend tests covering synthetic float + quantized behavior, prefill/decode/cached-decode correctness, negative falsification, and update the GGUF support docs/matrix.
Reviewed changes
Copilot reviewed 17 out of 17 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/seq2seq_integration_test.py | Updates decoder feeds for T5 vs BART masking and adds a cached decode-step parity test for T5. |
| tests/build_graph_test.py | Adds t5encoder to the specialized model-types set for L1 coverage. |
| src/mobius/tasks/_seq2seq.py | Adds Seq2SeqTask options for cross-attention cache + attention masks and wires corresponding decoder inputs/kwargs. |
| src/mobius/models/t5.py | Implements T5 relative-bias ownership per layer, optional padding-bias logic, cross-attention cache behavior, and quantized weight preprocessing support. |
| src/mobius/models/t5_test.py | Adds unit tests for T5 graph contract stability and new weight/relative-bias mapping behaviors. |
| src/mobius/integrations/gguf/_upstream_data/llamacpp_pin.json | Extends the pinned llama.cpp contract metadata to include T5/T5-encoder tensor families and names. |
| src/mobius/integrations/gguf/_tensor_mapping.py | Adds GGUF→HF name mapping for T5 (including projection-sidecar handling rules). |
| src/mobius/integrations/gguf/_config_mapping.py | Adds GGUF→ArchitectureConfig extraction for T5-specific keys and T5 postprocessing/validation. |
| src/mobius/integrations/gguf/_config_mapping_test.py | Adds tests for pinned T5 defaults and rejection of unsupported/ambiguous variants. |
| src/mobius/integrations/gguf/_builder.py | Adds T5 tensor-contract validation, task dispatch rules, and T5-specific task instantiation defaults. |
| src/mobius/integrations/gguf/_builder_test.py | Adds synthetic T5/T5-encoder GGUF fixtures plus float/quantized/save-load/runtime and falsification tests. |
| src/mobius/integrations/gguf/_arch_registry.py | Marks t5/t5encoder as importable (runtime deferred) and defines required metadata/recipes. |
| src/mobius/integrations/gguf/_arch_registry_test.py | Updates pinned supported-architecture counts and adds T5 closure tests. |
| src/mobius/components/_encoder_decoder_attention.py | Adds configurable Linear class injection and cross-attention cache concatenation/reshaping support. |
| src/mobius/_registry.py | Registers t5encoder to the t5-text-encoding task and exports encoder model type. |
| src/mobius/_configs/_base.py | Extends ArchitectureConfig with decoder start token id + relative-bias-layer ownership lists. |
| docs/api/build_from_gguf.md | Updates the GGUF support matrix and documents the pinned T5/T5-encoder contract and deferral rationale. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| encoder_attention_mask = None | ||
| if self.use_attention_masks: | ||
| encoder_attention_mask = builder.input( | ||
| "encoder_attention_mask", | ||
| dtype=ir.DataType.INT64, | ||
| shape=[batch, "cross_past_sequence_len + encoder_sequence_len"], | ||
| ) |
| assert sum(len(list(model.graph)) for model in package.values()) == 176 | ||
| assert len(list(package["encoder"].graph)) == 81 | ||
| assert len(list(decoder.graph)) == 95 |
## Summary - clean up still-valid typing, documentation, test robustness, error-message, maintainability, and performance findings left by the GGUF PR stack - preserve the behavioral fixes merged in #625-#632 - hash reused multi-GB GGUF sources once, at the final pre-publication integrity gate, while retaining cheap identity checks around staging Exact base: `2db9d33debdc254d879a51b14434c9a81c230f4f` Exact head: `4541ed2bc9d2ab4227484510b4a85b2d9113eb25` ## Reconstructed original 17-item low-priority tranche The persisted audit retained only the totals, so this list was reconstructed from the live threads and current source. All but the already-fixed #596 comment are addressed in this PR. | PR | Comment | Disposition | |---|---:|---| | #550 | 3837144656 | Implemented: correct tuple return annotation | | #552 | 3837389183 | Implemented: multichannel waveform shape docs | | #559 | 3837716261 | Implemented: name-based cache assertions | | #573 | 3854308350 | Implemented: one final GGUF hash, with integrity regression coverage | | #574 | 3854345521 | Implemented: `TensorRole \| None` typing | | #574 | 3854345597 | Implemented: removed obsolete verdict filtering | | #577 | 3854472859 | Implemented: documented SSM sequence length | | #578 | 3843112613 | Implemented: documented F64 passthrough | | #579 | 3854518332 | Implemented: generalized fused-projection error | | #580 | 3854576300 | Implemented: removed brittle node counts | | #583 | 3854681386 | Implemented: documented conditional draft outputs | | #587 | 3854816872 | Implemented: corrected MTP output contract docs | | #596 | 3846110059 | Already fixed on base: unambiguous GQA bias comment | | #600 | 3855174281 | Implemented: metadata-count-only MTP error | | #607 | 3855776048 | Implemented: stable route-field assertions | | #607 | 3855776086 | Implemented: public tensor iterator | | #609 | 3856486136 | Implemented: fail-closed LM-head comment | ## Current unresolved-thread disposition This covers all 48 Copilot threads returned by the reproducible #600-#630 query. The one human #623 thread is excluded. | PR | Comment | Current-main disposition and evidence | |---|---:|---| | #600 | 3855174177 | Already fixed by #629: package cycle and reserved-sidecar validation | | #600 | 3855174238 | Already fixed by #629: explicit MTP sidecar naming/loading | | #600 | 3855174281 | Implemented here: error no longer invents an observed block count | | #602 | 3848155961 | Outside exact stack; already fixed: top-level `expert_dtype` is classified before early return | | #602 | 3848155983 | Outside exact stack; still-valid behavioral block-quant validation, unchanged | | #602 | 3848156000 | Outside exact stack; still-valid truncated-read behavioral finding, unchanged | | #602 | 3848156022 | Outside exact stack; still-valid descriptor byte/dtype validation, unchanged | | #602 | 3848156040 | Outside exact stack; still-valid expert-bank payload validation, unchanged | | #603 | 3855249765 | Already fixed by #630: runtime preflight preserves shard sets | | #603 | 3855249840 | Already fixed by #630: success output follows durable runtime publication | | #604 | 3855343082 | Implemented here: graph-only MTP persistence distinguished from runtime rejection | | #604 | 3855343131 | Already fixed by #630: runtime success messages are atomic | | #607 | 3855776001 | Implemented here: missing generation golden skips before provenance read | | #607 | 3855776048 | Implemented here: only stable route fields are asserted | | #607 | 3855776086 | Implemented here: tensor count uses `tensor_items_raw()` | | #608 | 3856079371 | Still-valid behavioral cache-symlink containment finding; unchanged | | #608 | 3856079415 | Still-valid behavioral lowercase-digest validation finding; unchanged | | #609 | 3856486136 | Implemented here: comment matches value-preserving policy | | #610 | 3855541683 | Already fixed by #628: Falcon bias precedence is explicit | | #610 | 3855541761 | Already fixed by #628: CTRL tiny config exercises projection biases | | #611 | 3856595840 | Implemented here: runtime test resolves the distribution providing the module | | #612 | 3855677383 | Already fixed by #625: supported-version endianness detection | | #612 | 3855677427 | Implemented here: shared `INT64_MAX` sentinel | | #612 | 3855677460 | Implemented here: shared PLaMo2 width inference | | #612 | 3855677486 | Implemented here: accepted PLaMo2 activation spellings are explicit | | #613 | 3855845678 | Implemented here: canonical issue URL | | #613 | 3855845757 | Implemented here: Mamba-1 function-registration docs | | #613 | 3855845806 | Implemented here: test expects the canonical issue URL | | #614 | 3855988545 | Implemented here: removed stale Nemotron-H divergence comments | | #614 | 3855988597 | Already fixed by #628: zero-head geometry raises actionable `ValueError` | | #615 | 3856082290 | Already fixed by #626: dense GraniteHybrid bias closure | | #618 | 3856729330 | Implemented here: required routes filter ORT GenAI evidence | | #618 | 3856729409 | Implemented here: env-selected runtime version is authoritative | | #618 | 3856729490 | Stale/N/A: PR-description-only matrix claim; repository workflow claims one pinned version | | #618 | 3856729563 | Implemented here: schema tail restored to normal indentation | | #619 | 3856342484 | Already fixed on base: Kimi Linear uses `/issues/605` | | #619 | 3856342532 | Already fixed by #628: config rejects convolution kernels below 2 | | #619 | 3856342580 | Already fixed by #628: GGUF contract rejects convolution kernels below 2 | | #620 | 3855717041 | Already fixed by #627: tied LM-head-only checkpoints are retained | | #621 | 3856722324 | Already fixed by #628: Kimi-K3 required metadata is complete | | #623 | 3855931210 | N/A to current main: comment belongs to open, unmerged #623 | | #623 | 3855939302 | N/A to current main: comment belongs to open, unmerged #623 | | #623 | 3855939358 | N/A to current main: comment belongs to open, unmerged #623 | | #623 | 3855939394 | N/A to current main: comment belongs to open, unmerged #623 | | #624 | 3856777152 | Implemented here: runtime compatibility reuses the emitted model type | | #625 | 3857049733 | Implemented here: unsupported header reports both endian candidates | | #629 | 3857313182 | Newer post-audit behavioral sidecar-symlink cleanup finding; unchanged | | #629 | 3857313251 | Newer post-audit cross-platform path-safety finding; unchanged | ## Validation - affected GGUF/package/ORT GenAI/model/schema tests: 1,040 passed - broad non-integration suite: 7,851 passed, 56 skipped, 1 subtest passed - generated GGUF docs checks: 7 passed - initialized `lintrunner`; full lint/format passed - GPT-5.6 Sol medium review: one integrity finding fixed; re-review found no significant issues Signed-off-by: Justin Chu <[email protected]> Co-authored-by: Copilot App <[email protected]>
Summary
t5andt5encoderMatMulNBitswhile explicitly dequantizing token embeddings and rejecting unsupported sidecars/layoutsValidation
lintrunner f --output oneline --all-filespython -m pytest tests/seq2seq_integration_test.py -q --tb=short— 10 passedglm_moe_dsashape-inference failure — 5,742 passed, 52 skippedglm_moe_dsafailures in the unfiltered broad run reproduce unchanged on base commit032a967Stacked on #579 /
justinchuby-gguf-encoder-cohort.