Repository navigation
Add canonical metadata for SenseNova U1.5 - #540
Merged
Merged
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]>
Performance Comparison
|
justinchuby
force-pushed
the
copilot/sensenova-canonical-metadata
branch
from
August 21, 2026 23:57
6e5987d to
a3b8b11
Compare
🏗️ Architecture Diff
No architecture changes detected. ✅ Legend: ⚪ No change · 🔵 Minor (attrs/inits) · 🟡 Moderate (nodes added/removed) · 🔴 Major (interface changed) |
justinchuby
force-pushed
the
copilot/sensenova-canonical-metadata
branch
from
August 22, 2026 00:07
a3b8b11 to
0a94f9d
Compare
Copilot stopped reviewing on behalf of
justinchuby due to an error
August 22, 2026 00:15
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]>
justinchuby
force-pushed
the
copilot/sensenova-canonical-metadata
branch
from
August 22, 2026 00:25
0a94f9d to
b6fb109
Compare
This was referenced Aug 22, 2026
justinchuby
added a commit
that referenced
this pull request
Aug 22, 2026
## Summary Follow-up to merged #540 that incorporates findings from real canonical-engine execution of the pinned SenseNova U1.5 package. - derive deterministic image noise from generic `seed`/`width`/`height` request roles; caller latent remains an optional override - keep positive and negative CFG prefixes and their frozen KV sequence symbols independent - integrate the x0 flow from `t=0` to `t=1` using `v=(x0-z)/max(1-t,t_eps)` - clamp generic pixel output to the declared `[-1, 1]` range - add reusable image-noise geometry and tensor-clamp policy components - regenerate the hashless canonical fixture and document production H200 evidence No 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 passed** - generated fixture exactly matches `tests/fixtures/onnx_genai_workflows/shared_state_pixel_flow/inference_metadata.yaml` - targeted Ruff format/check and `git diff --check` pass ## Real canonical runtime evidence Executed by ONNX GenAI `Engine::from_pipeline_dir` on H200 using the pinned 17.5B export (`1f6ec60423d29939dde4202fd82ae340b144e280`), not custom orchestration: - 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 VRAM: **91,256 MiB** - final outputs finite and bounded exactly to `[-1, 1]` Published package: https://huggingface.co/justinchuby/sensenova-u1.5-8b-mot-onnx-canonical Upload commit: `f3f2eaf79f4991febee107cdabd0b27f0161b06e` A clean 24 MB selective download of metadata, policies, graph descriptors, tokenizer, and processor assets passes canonical admission. ## Remaining runtime limitations - text path currently validates understanding prefill, not full autoregressive decode - generic Images/A1111 bindings cannot yet select a path-specific image chat template or construct reference-image placeholder masks for this unified package - portable counter RNG is deterministic but intentionally does not reproduce PyTorch RNG, so final pixels are not directly comparable to #533's controlled-latent reference Runtime support and synthetic executable coverage are in justinchuby/onnx-genai#1700. --------- Signed-off-by: justinchuby <[email protected]> Signed-off-by: justinchuby <[email protected]> Signed-off-by: Justin Chu <[email protected]> Co-authored-by: Copilot <[email protected]>
justinchuby
added a commit
to justinchuby/onnx-genai
that referenced
this pull request
Aug 22, 2026
## 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]>
5 of 10 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This rebases the existing SenseNova U1.5 implementation from #533 onto current
mainand removes its canonical-metadata waiver.1/255, ImageNet normalizationv=(x0-z)/max(1-t,t_eps), Euler update, and pixel output using generic workflow IRTestInferenceMetadataStatusnegative coverage with positive hashless metadata and processor assertionsNo model implementation, weight mapping, or existing L4/L5 evidence is changed. No model-family fields, hashes/fingerprints, IR version, or ONNX opsets are added to canonical metadata.
Validation split
Ordinary PR CI
Pinned real H200 validation
The existing #533 evidence remains authoritative and is documented rather than downloaded in CI:
1f6ec60423d29939dde4202fd82ae340b144e280Local validation
PYTHONPATH=src python -m pytest src/mobius/models/sensenova_u1_test.py -q— 25 passedshared_state_pixel_flow— passDepends on justinchuby/onnx-genai#1700 for generic
read_onlystate aliases and dynamic image-adapter dimensions.