Skip to content

Fix inference metadata producer invariants - #539

Merged
justinchuby merged 1 commit into
mainfrom
justinchuby/fix-inference-metadata-producer-invariants
Aug 21, 2026
Merged

justinchuby merged 1 commit into
mainfrom
justinchuby/fix-inference-metadata-producer-invariants

Conversation

@justinchuby

Copy link
Copy Markdown
Member

Summary

  • stop serializing retired sha256, config_sha256, and base_model_fingerprint fields in authored inference metadata
  • require split attention state groups to emit exactly one key and one value alias for identical numeric layer sets
  • preserve heterogeneous key/value head counts and geometry while pairing by layer
  • regenerate adapter, decoder, and speculative workflow fixtures
  • scan both committed and newly generated metadata for retired fields and malformed K/V layer sets

Cross-repository context

This is the paired Mobius producer update for onnx-genai PR #1688. All 13 generated Mobius packages validate with that PR's validator, and all 12 workflow conformance tests pass against its runtime.

PR #536's PEFT implementation was not modified. After this lands, #536 should merge main and retain its PEFT implementation while taking the hashless serialization changes in save_adapter_artifacts, the adapter-service fingerprint removal, and updated adapter fixtures/expectations.

Validation

  • python3 -m pytest src/mobius/adapters_test.py src/mobius/integrations/onnx_genai -q --tb=short — 247 passed, 5 skipped
  • Ruff check and format check for all changed Python files
  • generated/committed ONNX GenAI package comparison — passed
  • onnx-genai #1688 metadata validator — 13 packages passed
  • onnx-genai #1688 workflow conformance — 12 passed

Stop serializing retired adapter artifact hashes and base-model fingerprints into inference metadata. Enforce identical numeric key/value cache layer sets while preserving heterogeneous K/V geometry, and regenerate the cross-repository workflow fixtures with serialized-output regression checks.

Co-authored-by: Copilot <[email protected]>
Signed-off-by: justinchuby <[email protected]>
@github-actions

Copy link
Copy Markdown

🏗️ Architecture Diff

Comparing ab5448f → f40e91a

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 ab5448f → f40e91a

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 166 166 +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 tightens the invariants and serialization rules for ONNX GenAI inference metadata produced by Mobius, aligning the producer with updated validator/runtime expectations (paired with onnx-genai PR #1688). It removes retired hash/fingerprint fields from authored metadata and enforces correctness of split KV-cache aliasing by layer (including heterogeneous key/value head geometry).

Changes:

  • Stop serializing retired authored-metadata fields (sha256, config_sha256, base_model_fingerprint) in adapter/artifact metadata and update tests/fixtures accordingly.
  • Enforce (and test) that attention state groups emitting split KV caches declare exactly one key and one value alias per identical numeric layer set.
  • Update executable validation-package graphs and workflow fixtures to include distinct value-cache ports alongside key-cache ports, preserving heterogeneous K/V shapes.

Reviewed changes

Copilot reviewed 10 out of 10 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 decoder/speculative ONNX graphs to model separate K/V cache inputs/outputs with heterogeneous shapes.
tests/fixtures/onnx_genai_workflows/speculative/inference_metadata.yaml Regenerated speculative workflow fixture to include value-cache request/state wiring and present outputs.
tests/fixtures/onnx_genai_workflows/decoder/inference_metadata.yaml Regenerated decoder workflow fixture to include value-cache ports, state cells, and loop carry wiring.
tests/fixtures/onnx_genai_workflows/adapter/inference_metadata.yaml Removes retired fingerprint/hash fields from adapter inference metadata fixture.
tests/compare_onnx_genai_validation_packages.py Adds invariant checks for retired fields and malformed attention K/V layer sets across committed and generated metadata.
src/mobius/integrations/onnx_genai/workflow_metadata.py Adds and applies validation ensuring split KV aliases cover identical numeric layer sets (no duplicates, no mismatches).
src/mobius/integrations/onnx_genai/workflow_metadata_test.py Extends tests to assert K/V layer-set equality and adds negative-coverage tests for the new validator.
src/mobius/integrations/onnx_genai/inference_metadata.py Stops emitting base_model_fingerprint in authored inference metadata under adapters.
src/mobius/adapters_test.py Updates adapter metadata tests to assert retired fields are absent (without relying on serialized sha256 fields).
src/mobius/_model_package.py Removes retired hash/fingerprint fields from serialized adapter artifacts while preserving required artifact descriptors.

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

@justinchuby
justinchuby merged commit 6290691 into main Aug 21, 2026
23 of 24 checks passed
@justinchuby
justinchuby deleted the justinchuby/fix-inference-metadata-producer-invariants branch August 21, 2026 23:52
justinchuby added a commit that referenced this pull request Aug 22, 2026
Resolve adapter serialization conflicts by retaining the hashless producer contract from #539 together with PEFT attachment and source-preservation support.

Co-authored-by: Copilot <[email protected]>
Signed-off-by: justinchuby <[email protected]>
justinchuby added a commit that referenced this pull request Aug 22, 2026
Preserve the hashless inference-metadata producer invariants from #539 and the PEFT integration from #536 while carrying the focused Moshi and Pangu catalogue changes forward.

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

- infer 8-step public Moshi/Moshiko versus 16-step PersonaPlex depformer
weights and build the matching real-weight graph
- keep full-duplex workflow metadata valid when optimization prunes the
temporal position_ids graph input
- expose deterministic runtime sampling and standard Mimi component
paths
- add a standalone pinned Pangu-Weather packaging/evidence utility

## Pangu script scope

The Pangu utility is intentionally a separate first commit and does not
register a new Mobius architecture. It packages an already-published
ONNX checkpoint, verifies its exact SHA-256 and graph ports using
onnx_ir, executes deterministic real-weight inference, and emits
provenance/evidence. Keeping it under scripts/ makes the catalogue
result reproducible without adding an inaccurate synthetic model
exporter.

## Main integration and producer invariants

Merged current origin/main without rebasing. The merge retains #539's
hashless producer invariants (no sha256, config_sha256, or
base_model_fingerprint fields in authored inference metadata), complete
attention key/value layer alias sets, and #536's PEFT changes.

## Validation

- python3 -m pytest tests/build_graph_test.py -k 'depformer_io or
TestBuildMoshiLM' -q --tb=short: 4 passed
- python3 -m pytest
src/mobius/integrations/onnx_genai/duplex_workflow_metadata_test.py
src/mobius/generation/_duplex_policy_test.py -q --tb=short: 29 passed, 1
skipped
- lintrunner f --output oneline --all-files, then lintrunner -a: passed
with pinned ruff 0.16.2
- Pangu graph inspection against the published 1-hour model: exact
expected ports, IR v7, opset 14
- automated code review: no significant findings

## Real-weight evidence

The public CC-BY-4.0 Moshiko derivative executes encoder -> temporal ->
8-step depformer -> decoder on CUDA. The pinned Pangu weather package
and ACT action-rollout fallback are published separately in the
catalogue dataset.

---------

Signed-off-by: justinchuby <[email protected]>
Co-authored-by: Copilot <[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