Skip to content

Fix workflow batching capacity declarations - #649

Merged
justinchuby merged 1 commit into
mainfrom
fix/batching-capacity-signal
Aug 26, 2026
Merged

Fix workflow batching capacity declarations#649
justinchuby merged 1 commit into
mainfrom
fix/batching-capacity-signal

Conversation

@justinchuby

Copy link
Copy Markdown
Member

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 <justinchuby@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: d60eb808-7cc6-4abc-b48d-2a6dd3841624
@justinchuby
justinchuby requested review from a team and a lite review from Copilot August 26, 2026 07:21
@github-actions

Copy link
Copy Markdown

🏗️ Architecture Diff

Comparing c49d4223ca0d86

Model Sub-model Changes Status

No architecture changes detected.


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

@github-actions

Copy link
Copy Markdown

Performance Comparison

Comparing c49d4223ca0d86

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.

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 updates Mobius’s ONNX GenAI workflow metadata producer and fixtures to explicitly declare batching capacity (batch_capacity) for audited multi-request workflow components, while improving how request axes are discovered/stamped (supporting non-leading batch axes) and preserving hierarchical-audio’s fixed internal row-expansion semantics.

Changes:

  • Add producer-side helpers to author batch_capacity (and bump schema_version to v1.1 when capacity is declared) for decoder, diffusion, video, TTS, and adapter workflows.
  • Generalize request-axis detection to the unique batch symbol anywhere in the shape (not only leading axis), and update fixtures accordingly (including axis=1 cases).
  • Regenerate/adjust workflow fixtures and add stronger contract tests: multi-request components must declare capacity, YAML/schema round-trip must be stable, and hierarchical-audio must retain request_expanded with the correct factor.

Reviewed changes

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

Show a summary per file
File Description
tests/generate_onnx_genai_validation_packages.py Updates generated adapter-package metadata to schema v1.1 and adds an explicit batch_capacity declaration for the overlay component.
tests/fixtures/onnx_genai_workflows/video/inference_metadata.yaml Adds batch_capacity declarations across audited video workflow components and bumps schema version to v1.1.
tests/fixtures/onnx_genai_workflows/tts/inference_metadata.yaml Adds batch_capacity declarations and updates/stamps request-axis layouts for non-leading batch axes; bumps schema version to v1.1.
tests/fixtures/onnx_genai_workflows/static_cache/inference_metadata.yaml Adds batch_capacity for audited components and bumps schema version to v1.1.
tests/fixtures/onnx_genai_workflows/shared_state_pixel_flow/inference_metadata.yaml Updates request-axis batch_layout stamping for shapes where the batch symbol is not on axis 0.
tests/fixtures/onnx_genai_workflows/hierarchical_audio/inference_metadata.yaml Corrects fixed 2-row expansion semantics to request_expanded with factor=2 (without reclassifying as multiple requests).
tests/fixtures/onnx_genai_workflows/diffusion/inference_metadata.yaml Adds batch_capacity declarations and specifies append axes for diffusion emits; bumps schema version to v1.1.
tests/fixtures/onnx_genai_workflows/diffusion_guided/inference_metadata.yaml Same as diffusion: capacity declarations + emit append axes; bumps schema version to v1.1.
tests/fixtures/onnx_genai_workflows/decoder/inference_metadata.yaml Adds batch_capacity for decoder workflow components and bumps schema version to v1.1.
tests/fixtures/onnx_genai_workflows/adapter/inference_metadata.yaml Adds batch_capacity to the adapter overlay component and bumps schema version to v1.1.
tests/canonical_workflow_contract_test.py Adds mutation-sensitive checks for capacity declarations, YAML/schema round-trip, and hierarchical-audio row-expansion invariants.
src/mobius/integrations/onnx_genai/workflow_metadata.py Implements batch_capacity authoring, preserves hierarchical-audio expansion, adds diffusion emit append axes, and wires capacity stamping into workflow builders.
src/mobius/integrations/onnx_genai/inference_metadata.py Generalizes request-axis discovery/stamping to the unique batch symbol anywhere in shape, and adds unit coverage for the new logic.
src/mobius/integrations/onnx_genai/inference_metadata_test.py Adds direct tests for request_batch_layout behavior (axis 0, axis 1, ambiguous/no-batch cases).

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

@justinchuby
justinchuby merged commit 5a19210 into main Aug 26, 2026
19 of 26 checks passed
@justinchuby
justinchuby deleted the fix/batching-capacity-signal branch August 26, 2026 10:06
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