Repository navigation
Finalize seeded canonical SenseNova workflow metadata - #545
Conversation
Adds full Mobius support for sensenova/SenseNova-U1.5-8B-MoT, a native unified multimodal model (understanding + image generation + editing). Architecture (root-caused from the upstream reference implementation at github.com/OpenSenseNova/SenseNova-U1 @ feat/u1.5 — the HF repo declares auto_map entries for configuration_neo_chat.py / modeling_neo_chat.py but does not ship those files, so the GitHub package is the only source): * Mixture of Transformers (MoT): all 42 Qwen3 decoder layers carry two complete, disjoint weight sets. The understanding branch handles text and reference images; every module suffixed `_mot_gen` handles the noisy image tokens of the flow-matching sampler. Attention is shared — the generation pass reads the KV cache written by the understanding pass, which is how text conditioning reaches image tokens. Upstream raises NotImplementedError for a mixed forward, so exporting the two branches as two graphs is the only faithful decomposition. * Three rotary axes inside head_dim 128: temporal [0:64) at rope_theta, image height [64:96) and width [96:128) at rope_theta_hw. QK-norm is applied per half (q_norm over 64 temporal dims, q_norm_hw over 64 spatial dims), matching the checkpoint's [64]-shaped norm tensors. * Block-causal attention: allow[i][j] = (t[j] == t[i]) or (j <= i), so patches of one image attend bidirectionally. * Vision tower has no transformer blocks — Conv2d patchify, GELU, interleaved 2-D RoPE, Conv2d 2x2 merge into the LLM width. * No VAE: use_pixel_head drives a pixel-shuffle ConvDecoder that decodes generation hidden states straight to RGB. Ships SenseNovaU1Config (lifts text fields from the nested llm_config), a bare vision extractor hook, SenseNovaU1Model, SenseNovaU1Task building five graphs (model / vision / embedding / image_gen_embedding / image_gen_denoiser), and registry wiring for model_type `neo_chat`. All 1116 checkpoint tensors map onto ONNX initializers with zero unmapped keys and zero shape mismatches; the only initializers without a checkpoint source are derived RoPE and timestep-frequency tables. Co-authored-by: Copilot <[email protected]> Signed-off-by: justinchuby <[email protected]>
Two defects surfaced only when running the real 17.5B checkpoint through onnxruntime on CUDA; both are fixed here: * `_TimestepEmbedder` built its sinusoidal basis in float32 but read the frequency table after `_cast_module_dtype` had demoted it to the model dtype, producing a `Mul` with mismatched operand types that made the `image_gen_embedding` graph unloadable in fp16. The table is now cast up explicitly, keeping the basis in float32 as upstream does. * The denoiser graph dropped its `present_key`/`present_value` outputs. ORT's CUDA Attention kernel requires them whenever `past_key`/`past_value` are supplied, so every denoise step failed at layer 0. They are now registered; the sampler still discards them, which preserves upstream's `update_cache=False` semantics (the understanding prefix stays frozen across flow-matching steps). `_ConvDecoder` also derives its upsample factor from `pixels_per_token` instead of hardcoding 32x. That is exactly `patch_size * merge_size` for the released checkpoint (so `conv2` keeps its 192 = 3*8*8 channels), but it no longer silently produces wrongly-sized images for other geometries. Adds docs/design/sensenova-u1-neo-unify.md recording what was verified against the checkpoint and the reference implementation: the Hub packaging gap (declared-but-absent remote code, shard-numbering slack), the parameter budget, MoT routing, the three rotary axes, block-causal masking, the transformer-free vision tower, the VAE-free pixel head, and the upstream code paths that are dead for inference. Co-authored-by: Copilot <[email protected]> Signed-off-by: justinchuby <[email protected]>
Renames the package components from `model`/`vision` to `decoder`/ `vision_encoder`, matching VisionLanguageTask, VisionLanguage3ModelTask and HunYuanVLMoTTask. Beyond consistency this makes the package recognisable to `is_native_vlm_package`, so the metadata emitter now reports a specific, actionable failure instead of the generic "unrecognised multi-component package shape". Records `neo_chat` in `_SPECIALIZED_TEST_MODEL_TYPES`: the co-located test module covers it, and the generic VLM harness cannot -- the package carries an image-generation branch the harness has no notion of. Adds TestInferenceMetadataStatus, which pins the exact current blocker so the documented status cannot drift from reality: * Export and execution are complete for all five graphs. * Metadata emission blocks in the image-processor contract: the NEO vision tower takes a plain (1, 3, H, W) image and the Hub repo ships no preprocessor_config.json, so no processor program binds and no image_mean/image_std are declared. * No emitter shape describes a unified any-to-any package (a text decoder plus a flow-matching branch sharing one KV cache), and ORT GenAI has no runtime pipeline for one, so a contract alone would not be executable. The design doc gains the runtime/metadata status section and the precision finding that the `_mot_gen` branch -- stored F32 upstream -- overflows fp16 during sampling and must be exported at float32, while the BF16 understanding branch exports cleanly to float16. Co-authored-by: Copilot <[email protected]> Signed-off-by: justinchuby <[email protected]>
* `preprocess_weights` now honours `tie_word_embeddings`. Only an explicit `language_model.lm_head.weight` populated `decoder.lm_head` before, so a tied `neo_chat` variant would leave that initializer unfilled. The released 8B checkpoint is untied, so this was latent, but the registry declares a family/variant pair that anticipates siblings. Mirrors the existing HunYuan VL-MoT handling. Covered by two new tests. * Drops the `update_cache` parameter from `_MoTAttention`, `_MoTDecoderLayer` and `_SenseNovaU1DecoderBody`. It was declared, threaded through three modules, and never read: ONNX `Attention` always emits `present = concat(past, new)`. The understanding prefix stays frozen because the *caller* discards the denoiser's present outputs, which is documented at that contract boundary in the task. Keeping a flag that implied graph-level behaviour it did not have was a trap. * Removes the unused expanded `mask` in the embedding model. `op.*` calls emit IR nodes, so `del mask` dropped only the Python name — the Unsqueeze/Expand survived until DCE. Also drops the vestigial `num_heads` argument from `_rotate_half_axis`. * Documents why GQA fusion cannot fire for either decoder graph (the block-causal bias contains an `Or`, the denoiser has no attention_mask input, and the three-axis RoPE is not `op.RotaryEmbedding`), so the CUDA/fp16 export warning is not misdiagnosed later. Verified graph-identical to the exported artifacts: all five components match the on-disk node counts exactly, and the end-to-end image is bit-identical to the pre-refactor run. Co-authored-by: Copilot <[email protected]> Signed-off-by: justinchuby <[email protected]>
Describe SenseNova U1.5 through a generic five-component workflow with exact image preprocessing, frozen shared KV, mixed-precision casts, CFG, x0 flow conversion, and loop execution. Add deterministic producer fixtures and positive metadata status coverage without changing the model implementation or real-weight evidence. Co-authored-by: Copilot <[email protected]> Signed-off-by: justinchuby <[email protected]>
Emit deterministic seeded image noise, branch-scoped CFG prefixes and frozen KV state, forward x0 flow integration, and bounded image outputs using model-agnostic policy components. Document the canonical production package and real H200 engine validation. Co-authored-by: Copilot <[email protected]> Signed-off-by: justinchuby <[email protected]>
Reconcile the finalized seeded shared-state workflow changes with the merged canonical SenseNova producer and subsequent main updates. Co-authored-by: Copilot <[email protected]> Signed-off-by: justinchuby <[email protected]>
Performance Comparison
|
There was a problem hiding this comment.
Pull request overview
Finalizes the canonical, hashless ONNX GenAI workflow metadata for the SenseNova U1.5 shared-state pixel-flow package based on findings from real canonical-engine execution. The changes primarily tighten request roles/contracts (seed/width/height, negative prompt shapes), make noise generation deterministic and resolution-derived, and enforce the declared [-1, 1] pixel range in emitted outputs.
Changes:
- Replace the ad-hoc
noise_scalerequest input with deterministic counter-RNG noise derived from(seed, width, height)plus an optional external latent override path. - Split conditional vs unconditional CFG prefix handling so their sequence symbols/KV cache dimensions remain independent.
- Add reusable policy components for image-noise geometry and tensor clamping, and update the canonical fixture + supporting docs accordingly.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| tests/fixtures/onnx_genai_workflows/shared_state_pixel_flow/inference_metadata.yaml | Regenerated canonical fixture reflecting new request roles, seeded noise branch, CFG prefix separation, and output clamp. |
| tests/fixtures/onnx_genai_workflows/README.md | Updates the recorded SHA-256 for the regenerated fixture. |
| src/mobius/models/sensenova_u1_test.py | Extends the pinned metadata-contract test assertions for newly added seeded-noise workflow elements. |
| src/mobius/integrations/onnx_genai/shared_state_flow_metadata.py | Implements seeded noise + optional latent override, conditional/unconditional prefix separation, updated schedule direction, and output clamping in emitted workflow metadata. |
| src/mobius/generation/_policy_components.py | Adds reusable build_image_noise_geometry and build_tensor_clamp policy components. |
| src/mobius/generation/_policy_components_test.py | Adds unit tests covering the new policy components’ outputs/semantics. |
| src/mobius/generation/init.py | Exposes the new policy component builders from the generation public API. |
| docs/design/sensenova-u1-neo-unify.md | Documents the canonical-engine H200 evidence and clarifies seeded-noise vs controlled-latent parity expectations. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
|
The all-files |
Assert that canonical SenseNova workflow metadata retains the generic output-clamp policy required by its declared pixel range. Co-authored-by: Copilot <[email protected]> Signed-off-by: justinchuby <[email protected]>
Apply the repository formatter to four files inherited from main so the all-files lint job can validate the SenseNova follow-up branch. Co-authored-by: Copilot <[email protected]> Signed-off-by: justinchuby <[email protected]>
Apply the remaining annotation, collection, suffix, and docstring lint fixes reported against files inherited from main. Co-authored-by: Copilot <[email protected]> Signed-off-by: justinchuby <[email protected]>
Delete the unused local _index_dim1 function from DeltaNet V-head reordering without changing the remaining helper or call sites. Co-authored-by: Copilot <[email protected]> Signed-off-by: justinchuby <[email protected]>
|
Final lint/review status:
I also compared #544's four-file Ruff patch against this head. #545 contains every current-main Ruff correction from #544 in the same four files; relative to #544 it only removes the now-reported unused helper and uses equivalent D205-compliant docstring wording. Thus #545 functionally subsumes #544 despite no commit ancestry. After #545 merges, #544 can be closed as redundant. |
Derive conditional and unconditional image RoPE positions from their respective prompt tensors, and bind each denoiser to its branch-specific grid. Resolve downstream noise-scale geometry from the selected latent so external overrides cannot silently disagree with request dimensions. Co-authored-by: Copilot <[email protected]> Signed-off-by: justinchuby <[email protected]>
|
Final rubber-duck CFG/geometry blocker fixed in
Validation:
|
Make the shared-state pixel-flow fixture numerically depend on temporal position IDs, token-grid geometry, cache prefixes, and resolved noise scale. Emit dynamic latent-sized outputs so geometry override regressions are observable through canonical workflow execution. Co-authored-by: Copilot <[email protected]> Signed-off-by: justinchuby <[email protected]>
|
Executable regression upgraded in
The paired ONNX GenAI conformance assertion is in justinchuby/onnx-genai#1700 at Validation: generator + fixture comparison pass; executable conformance 2/2; SenseNova/workflow tests 39 passed; full lintrunner passed. |
Signed-off-by: Justin Chu <[email protected]>
## Summary - add model-agnostic `read_only` state-port access so alternating components consume frozen state without advancing or writable-aliasing it - preserve dynamic typed preprocessing dimensions - add a canonical shared-prefix pixel-flow catalogue workflow with exact RGB/pixel-area resize/rescale/normalize semantics - use generic counter RNG plus image geometry to provide deterministic seed-to-noise when no caller latent is supplied - execute text prefill, text-to-image, and reference-image-edit paths through the canonical metadata engine - validate unequal CFG prefix lengths, independent frozen KV groups, fp16→fp32 boundaries, x0 flow integration, and bounded output ## Design There is no SenseNova/NEO dispatch. The reusable pattern is: one understanding branch writes a shared state group; conditional and unconditional generation branches expose independent read-only aliases; ordinary workflow IR performs per-step embedding, denoiser calls, CFG combine, `v=(x0-z)/max(1-t,t_eps)`, Euler update, and image emit. Read-only aliases are excluded from stable-buffer aliasing, execution-island writable bindings, and decoder transition pairing. ## Validation - `cargo test -p onnx-genai-metadata --test catalogue --test recurrent_state` — **5 passed** - `cargo test -p onnx-genai-engine --no-default-features --test onnx_genai_workflow_conformance -- mobius_shared_state_pixel_flow --nocapture` — **2 passed** - text understanding and text-to-image generation - deterministic replay without caller latent - reference-image edit - unequal positive/negative prefix lengths - output range - `cargo fmt --all -- --check` - `git diff --check` The Mobius producer checkout now uses `main` because producer PR onnxruntime/mobius#540 has merged. Follow-up producer corrections are in onnxruntime/mobius#545. ## Real H200 canonical-engine evidence The pinned 17.5B package (`1f6ec60423d29939dde4202fd82ae340b144e280`) was executed through `Engine::from_pipeline_dir`, not a custom component runner: - text understanding prefill: logits `[1, 28, 151936]` - 512×512 text-to-image, 20 steps: **6.99 s** - 512×512 reference-image edit, 20 steps: **16.68 s** - peak observed H200 VRAM: **91,256 MiB** - fp16 understanding and fp32 generation boundary: pass - conditional/unconditional frozen KV sharing, CFG, forward flow loop, and output clamp: pass Package: https://huggingface.co/justinchuby/sensenova-u1.5-8b-mot-onnx-canonical Upload commit: `f3f2eaf79f4991febee107cdabd0b27f0161b06e` A clean selective download of 24 MB (metadata, policies, graph descriptors, tokenizer, and processor assets) passes canonical admission. Full package size is approximately 49 GB. ## Comparison and limitations Existing #533 controlled-latent evidence remains Pearson **0.998606**, PSNR **36.42 dB**, T2I **7.75 steps/s**, edit **7.06 steps/s**. The portable counter RNG is deterministic but does not reproduce PyTorch RNG, so seeded final pixels cannot honestly be compared numerically with that controlled latent. Remaining limitations: - text validates prefill logits, not a full autoregressive decode loop - generic OpenAI Images/A1111 bindings cannot yet choose a path-specific image chat template or automatically build reference placeholder masks for this unified package - fp16 generation overflows; the validated package intentionally uses fp32 generation --------- Signed-off-by: Justin Chu <[email protected]> Signed-off-by: Copilot <[email protected]> Co-authored-by: Copilot <[email protected]>
Summary
Follow-up to merged #540 that incorporates findings from real canonical-engine execution of the pinned SenseNova U1.5 package.
seed/width/heightrequest roles; caller latent remains an optional overridet=0tot=1usingv=(x0-z)/max(1-t,t_eps)[-1, 1]rangeNo SenseNova/NEO dispatch or family-specific metadata fields are added.
Validation
python3 -m pytest src/mobius/models/sensenova_u1_test.py src/mobius/generation/_policy_components_test.py -q --tb=short— 78 passedtests/fixtures/onnx_genai_workflows/shared_state_pixel_flow/inference_metadata.yamlgit diff --checkpassReal canonical runtime evidence
Executed by ONNX GenAI
Engine::from_pipeline_diron H200 using the pinned 17.5B export (1f6ec60423d29939dde4202fd82ae340b144e280), not custom orchestration:[1, 28, 151936][-1, 1]Published package: https://huggingface.co/justinchuby/sensenova-u1.5-8b-mot-onnx-canonical
Upload commit:
f3f2eaf79f4991febee107cdabd0b27f0161b06eA clean 24 MB selective download of metadata, policies, graph descriptors, tokenizer, and processor assets passes canonical admission.
Remaining runtime limitations
Runtime support and synthetic executable coverage are in justinchuby/onnx-genai#1700.