Skip to content

Align inference metadata batching contract - #636

Merged
justinchuby merged 1 commit into
mainfrom
justinchuby/metadata-producer-parity
Aug 25, 2026
Merged

justinchuby merged 1 commit into
mainfrom
justinchuby/metadata-producer-parity

Conversation

@justinchuby

Copy link
Copy Markdown
Member

Summary

  • remove retired profiles.*.batch_invariance production and its CTC graph-metadata source
  • fail closed by omitting component batch_capacity when grouped semantics have not been explicitly authored
  • sync the vendored schema to onnx-genai cb7baf924, regenerate ESM-2/ProtBERT fixtures, and validate every generated workflow fixture
  • add conformance coverage for retired spellings, authoritative component capacity, and regeneration parity

Validation

  • PYTHONPATH="$PWD/src" python3 -m pytest src/mobius/integrations/onnx_genai/encoder_embedding_metadata_test.py src/mobius/integrations/onnx_genai/ctc_runtime_test.py tests/canonical_workflow_contract_test.py -q --tb=short --basetemp=.pytest_metadata — 302 passed
  • PYTHONPATH="$PWD/src" python3 -m pytest src/mobius/integrations/onnx_genai/ -q --tb=short --basetemp=.pytest_metadata — 318 passed
  • regenerated and byte-compared all 15 workflow metadata fixtures
  • standard fast suite excluding the unrelated dependency-drifted qwen_image_test.py — 7,843 passed, 50 skipped
  • isolated Ruff checks and git diff --check

The unfiltered fast suite has five pre-existing Qwen Image failures caused by the installed Diffusers QwenEmbedRope API drift (max_txt_seq_len removed / txt_seq_lens now required); no Qwen Image files are changed here.

Post-merge republish

Regenerate and republish these Mobius-produced hosted examples so their provenance returns to the canonical producer (their currently corrected metadata already omits the retired field):

  • justinchuby/onnx-genai-example-esm2-t6-8m
  • justinchuby/onnx-genai-example-prot-bert

Remove retired profile-wide batch invariance production and its CTC graph metadata source. Keep unproven encoders fail closed by omitting component batch_capacity, sync the merged onnx-genai schema, regenerate affected fixtures, and add producer/schema conformance coverage.

Signed-off-by: justinchuby <[email protected]>
Co-authored-by: Copilot <[email protected]>
@justinchuby
justinchuby requested review from a team and a lite review from Copilot August 25, 2026 22:48

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 aligns Mobius’s ONNX GenAI inference metadata with the updated batching contract by retiring profiles.*.batch_invariance emission, omitting component batch_capacity unless explicitly authored, and syncing the vendored schema + fixtures to the referenced onnx-genai revision.

Changes:

  • Remove production and test expectations for retired batching declarations (batch_invariance, continuous_batching) and drop the CTC graph-side metadata source used to infer them.
  • Add schema-driven conformance checks for workflow fixtures (JSON Schema validation + regeneration parity) and extend unit coverage to ensure producers/fixtures never serialize retired fields.
  • Vendor the updated onnx-genai inference_metadata.schema.json and refresh checked-in workflow fixtures accordingly.

Reviewed changes

Copilot reviewed 10 out of 11 changed files in this pull request and generated no comments.

Show a summary per file
File Description
tests/wav2vec2_ctc_metadata_integration_test.py Updates integration assertions to reflect retired batch_invariance and fail-closed capacity behavior.
tests/fixtures/onnx_genai_workflows/protbert_protein_embeddings/inference_metadata.yaml Removes retired batch_invariance from fixture metadata.
tests/fixtures/onnx_genai_workflows/esm2_protein_embeddings/inference_metadata.yaml Removes retired batch_invariance from fixture metadata.
tests/canonical_workflow_contract_test.py Adds “no retired batching fields” assertions, validates fixtures against the vendored schema, and checks fixture regeneration parity.
src/mobius/tasks/_ctc_asr.py Removes the graph metadata propagation used to encode padding sensitivity for later metadata inference.
src/mobius/models/wav2vec2.py Removes batch_padding_sensitive property now that batching permission isn’t inferred from normalization.
src/mobius/integrations/onnx_genai/workflow_metadata.py Stops emitting batch_invariance and documents that batch_capacity is intentionally omitted unless explicitly authored.
src/mobius/integrations/onnx_genai/encoder_embedding_metadata_test.py Adds conformance tests for schema surface + fixture regeneration parity; updates batching assertions.
src/mobius/integrations/onnx_genai/ctc_runtime_test.py Removes padding-sensitivity inference tests and asserts batching permission is not inferred.
src/mobius/integrations/onnx_genai/_schema/README.md Updates the referenced upstream schema revision.
src/mobius/integrations/onnx_genai/_schema/inference_metadata.schema.json Vendors the updated upstream schema (including the new component batch_capacity contract and other upstream changes).

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

@github-actions

Copy link
Copy Markdown

🏗️ Architecture Diff

Comparing 3b2c9cd → b75abd0

Model Sub-model Changes Status
bert (feature-extraction) model 0 ⚪
falcon model 0 ⚪
gemma2 model 0 ⚪
gemma4 (gemma4) decoder 0 ⚪
gemma4 (gemma4) embedding 0 ⚪
gemma4 (gemma4) vision_encoder 0 ⚪
gemma4_text model 0 ⚪
gpt2 model 37 🟡
llama model 0 ⚪
llama (static-cache) model 0 ⚪
mamba (ssm-text-generation) model 0 ⚪
phi3 model 0 ⚪
phi3 (static-cache) model 0 ⚪
qwen model 0 ⚪
qwen (static-cache) model 0 ⚪
qwen2 model 0 ⚪
qwen2 (static-cache) model 0 ⚪
qwen2_moe model 0 ⚪
qwen2_moe (static-cache) model 0 ⚪
qwen3 model 0 ⚪
qwen3 (static-cache) model 0 ⚪
qwen3_5_moe (hybrid-text-generation) model 0 ⚪
qwen3_5_text (hybrid-text-generation) model 0 ⚪
qwen3_5_vl (hybrid-qwen-vl) decoder 0 ⚪
qwen3_5_vl (hybrid-qwen-vl) embedding 0 ⚪
qwen3_5_vl (hybrid-qwen-vl) vision_encoder 0 ⚪
qwen3_moe model 0 ⚪
qwen3_moe (static-cache) model 0 ⚪
qwen3_next (hybrid-text-generation) model 0 ⚪
t5 (seq2seq) decoder 0 ⚪
t5 (seq2seq) encoder 0 ⚪
whisper (speech-to-text) decoder 0 ⚪
whisper (speech-to-text) encoder 0 ⚪
gpt2 / model — 37 change(s)

Op summary: 54 → 54 nodes

No op-sequence changes.

Connectivity changes:

  • node[2] Add: input_ids [36, 37] → [37, 38]
  • node[4] Unsqueeze: input_ids [39, 9] → [40, 9]
  • node[8] Concat: input_ids [41, 42, 43] → [42, 43, 44]
  • node[9] Expand: input_ids [40, 44] → [41, 45]
  • node[10] Unsqueeze: input_ids [45, 9] → [46, 9]
  • node[11] LayerNormalization: input_ids [38, 10, 11] → [39, 10, 11]
  • node[13] MatMul: input_ids [47, 48] → [48, 49]
  • node[15] MatMul: input_ids [47, 50] → [48, 51]
  • node[17] MatMul: input_ids [47, 52] → [48, 53]
  • node[18] Attention: input_ids [49, 51, 53, 46, 3, 4] → [50, 52, 54, 47, 3, 4]
  • node[20] MatMul: input_ids [54, 57] → [55, 58]
  • node[21] Add: input_ids [38, 58] → [39, 59]
  • node[22] LayerNormalization: input_ids [59, 16, 17] → [60, 16, 17]
  • node[24] MatMul: input_ids [60, 61] → [61, 62]
  • node[25] Add: input_ids [62, 19] → [63, 19]
  • node[26] Gelu: input_ids [63] → [64]
  • node[28] MatMul: input_ids [64, 65] → [65, 66]
  • node[29] Add: input_ids [66, 21] → [67, 21]
  • node[30] Add: input_ids [59, 67] → [60, 68]
  • node[31] LayerNormalization: input_ids [68, 22, 23] → [69, 22, 23]
  • node[33] MatMul: input_ids [69, 70] → [70, 71]
  • node[35] MatMul: input_ids [69, 72] → [70, 73]
  • node[37] MatMul: input_ids [69, 74] → [70, 75]
  • node[38] Attention: input_ids [71, 73, 75, 46, 5, 6] → [72, 74, 76, 47, 5, 6]
  • node[40] MatMul: input_ids [76, 79] → [77, 80]
  • node[41] Add: input_ids [68, 80] → [69, 81]
  • node[42] LayerNormalization: input_ids [81, 28, 29] → [82, 28, 29]
  • node[44] MatMul: input_ids [82, 83] → [83, 84]
  • node[45] Add: input_ids [84, 31] → [85, 31]
  • node[46] Gelu: input_ids [85] → [86]
  • node[48] MatMul: input_ids [86, 87] → [87, 88]
  • node[49] Add: input_ids [88, 33] → [89, 33]
  • node[50] Add: input_ids [81, 89] → [82, 90]
  • node[51] LayerNormalization: input_ids [90, 34, 35] → [91, 34, 35]
  • node[52] Transpose: input_ids [7] → [36]
  • node[53] MatMul: input_ids [91, 92] → [92, 93]

Initializer changes:

  • count 29 → 30; dtype distribution: FLOAT: 28 → 29

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

@justinchuby
justinchuby merged commit 8e3ab92 into main Aug 25, 2026
16 of 27 checks passed
@justinchuby
justinchuby deleted the justinchuby/metadata-producer-parity branch August 25, 2026 23:19
justinchuby added a commit that referenced this pull request Aug 26, 2026
## Summary

- promote `bailingmoe`, original `deepseek`, and `dots1` from deferred
to exact GGUF config/tensor-map/graph support while keeping runtime
support deferred
- preserve authoritative routing contracts: Bailing full-softmax top-k;
DeepSeek unnormalized softmax top-k; Dots1 metadata-selected
softmax/sigmoid, selection-only correction bias, pinned `2^-14`
normalization floor, and route scaling
- validate exact dense-prefix/routed/shared-expert schedules, including
all-dense DeepSeek/Dots1 files with absent or zero inactive expert
metadata
- enforce full-head RoPE for all three, full MHA for Dots1, complete
supported YaRN metadata, pinned beta/attention defaults, and fail-closed
rejection of unsupported scaling
- close tensor families and shapes, packed fused-QKV splits, bias
alternatives, shared experts, output ownership, auxiliary quantization
sidecars, and out-of-range tensors
- preserve llama.cpp Q/K inverse permutation for Bailing/DeepSeek while
retaining Dots1's Qwen2 checkpoint row order across F32 and Q4 packed
weights/scales/zero-points
- preserve existing PhiMoE output-head, GLM-MoE-DSA CPU/grouped-routing,
LFM2MoE correction-bias, dense/multimodal/specialized/runtime/package,
inference-metadata, and Qwen3.5 ORT GenAI contracts

## Exact base and head

- base: `c8803afb8251136e850010aba2cc4b8bf9854082` (includes #636, #638,
and #631)
- head: `6df92b6c80e250fe45d1a6378426fb55220cc045`
- the isolated 12-commit MoE series was replayed conflict-free onto this
exact live-main SHA and force-updated with a lease against old remote
head `a66de72595afdfdb9d94da9fad0b361ffd1803cf`

## Evidence

- focused registry/config/tensor/processor/closure/builder/docs/model
suite: `1899 passed, 1 skipped`
- shared MoE/build regression suite: `204 passed, 8 skipped, 1374
deselected`
- broad serial non-integration: `8120 passed, 57 skipped, 12 deselected,
1 subtest passed`, explicit `PYTEST_EXIT=0`
- promoted packed fused-QKV value/runtime coverage includes F32 and Q4_0
weights, scales, zero-points, biases, graph construction, and ORT
execution
- initialized all-files lint: clean
- generated GGUF documentation closure: clean
- final GPT-5.6 Sol medium architecture review: approved, no findings
- final GPT-5.6 Sol medium regression review: approved, no findings

An intermittent libc++ `recursive_mutex` teardown diagnostic was
previously reproduced after an assertion-clean parallel run. It did not
reproduce in the serial GGUF builder probe or final serial broad suites;
clean serial process exits are the publication evidence.

## Runtime waiver

Runtime remains `DEFERRED` for all three promotions. No practical
immutable small real-weight GGUF artifact was available to establish
full CLI/ORT GenAI generation parity without downloading
production-scale checkpoints. Graph execution, synthetic numerical
routing parity, packed tensor value checks, and ORT execution are
covered; runtime metadata does not claim support from architecture-name
matching.

## Residual deferred MoE

Different whole-model contracts remain separate batches:

- `ernie4_5-moe`, `hunyuan-moe`, `minimax-m2`, `mellum`: unmatched
per-layer schedules or Q/K norm/RoPE ordering
- `arctic`, `dbrx`, `grok`, `smallthinker`: incompatible residual
topology, norm order/type, fused/clamped attention, scaling/softcaps,
router input, expert activation, or per-layer RoPE
- `afmoe`, `laguna`, `granite_swa`, conditional `granite`/`minicpm`:
unmatched gates, SWA/cache contracts, architecture scales, or value
transforms
- `grovemoe`: grouped dual-bank routing is unsupported
- `gpt-oss`: value-changing MXFP4 packed expert conversion is
unsupported
- `minimax-m3`: second sparse-index cache ABI is unsupported
- `bailingmoe3`, `deepseek4`, Kimi/DeltaNet/Mamba hybrids: heterogeneous
recurrent/compressed state ABI
- DeepSeek NextN/MTP families: executable MTP/cache ABI is owned by the
separate deferred MTP batch
- multimodal MoE backbones remain excluded from this text-only cohort

---------

Signed-off-by: Justin Chu <[email protected]>
Co-authored-by: Copilot App <[email protected]>
justinchuby added a commit that referenced this pull request Aug 26, 2026
## Summary
- explicitly author `batch_capacity` for audited row-independent
decoder, image-diffusion, video, TTS, and adapter workflow components
- derive uniform non-request dimensions only after that semantic
permission is explicit, and stamp schema v1.1
- preserve hierarchical audio's fixed 2-row internal expansion as
`request_expanded` instead of misclassifying it as two requests
- generalize request-axis discovery to the unique `batch` symbol,
including multi-axis rotary tensors
- regenerate all affected producer fixtures and add mutation-sensitive
capacity, legacy, YAML/schema round-trip, and image/video/audio coverage

## Root cause and authority
onnx-genai's runtime admission is intentionally fail-closed: absent
`batch_capacity` means exactly one logical request per component
invocation. Mobius had updated to the new schema but still omitted the
semantic permission from workflows whose conformance tests intentionally
execute multiple rows. Shapes can locate a request axis, but cannot
prove row independence, so the runtime check is not relaxed and capacity
is not inferred from a dynamic leading dimension.

The seven signal failures were producer-side metadata gaps:
- decoder: `decoder_state_initializer`
- Euler image diffusion: `tensor_scale`
- parameter adapters: `overlay`
- guided image diffusion: `latent_noise`
- video diffusion: `video_latent_init`
- TTS: `tts_state_initializer`
- hierarchical audio: `global_initializer` used `request_aligned` for a
fixed 2-row expansion; this is corrected to `request_expanded`

This follows onnx-genai #2009, #2010, and runtime admission #2137, while
preserving Mobius #636's rule that unproven ESM/ProtBERT encoders remain
capacity-absent.

## Validation
- exact producer generation + fixture comparison: all 15 packages
matched
- onnx-genai `validate_metadata`: all 15 generated packages valid
- onnx-genai workflow conformance with ORT 1.29.0: **15 passed, 0
failed**
- onnx-genai `encoder_batching`: **109 passed**
- onnx-genai capacity-removal mutation:
`undeclared_capacity_never_admits_multiple_requests` passed
- Mobius metadata producer selection: **350 passed, 3 skipped, 60
deselected**
- focused post-rebase coverage: **60 passed**
- Ruff check + format check: passed
- onnx-genai Clippy (`onnx-genai-metadata`, `onnx-genai-engine`, all
targets, warnings denied): passed

Original failing signal:
https://github.com/justinchuby/onnx-genai/actions/runs/32925051072

Signed-off-by: Justin Chu <[email protected]>
Co-authored-by: Copilot <[email protected]>
Copilot-Session: d60eb808-7cc6-4abc-b48d-2a6dd3841624
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