Repository navigation
Phase 7.3b WP4: Core multi-axis RoPE and decoder integration seam - #57
Merged
Merged
Conversation
…sts and pinned-vendor cross-check probe
…-path parity tests
…update its record (PR #57)
…er-axis position arrays (PR #57)
… record the WP5 loader guard (PR #57)
…ead of a full-sequence zero tensor (PR #57)
… as a pending WP6 gate item (PR #57)
…ise in the pre-write rejection test (PR #57)
…th the single-zero-row change (PR #57)
…ion assertion helper (PR #57)
…s the common parent (PR #57)
…heckRelatedScopes (PR #57)
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
Implements Phase 7.3b WP4: Core RoPE and decoder integration (
req/plans/phase7-3b-plan.md§6), per the design frozen inreq/plans/phase7-3b-reference-findings.md§6.9 (committed in this branch, Unit 1).Lands the core seam the later Qwen3-VL work (WP5–WP7) builds on — no model, no loader, no dispatch yet:
MultiAxisRope/MultiAxisRotation(jmlx-core,se.alipsa.jmlx.nn) — the dedicated explicit FLOAT32 frequency/cos/sin and half-rotation path for Qwen3-VL. Pinned interleaved MRoPE frequency selection (T-owning round-robin overwrite per findings §6.5), NeoX half-split rotation, dtype-cast order per the frozen compute/cast sequence, validated[3, B·T]positions and section/rotary-dim/head-dim bounds, all checked before any array is written. A dedicated component —RopeSpecgains no new permitted variant (sealed hierarchy andMLXFastare byte-identical tomain).DecoderAttention/DecoderBlock(core) andDecoderModel(models) gain overloads threading a request-suppliedMultiAxisRotationand a package-privatePostBlockHook(invoked after each block's residual output, before final normalization — the DeepStack injection point; vision extraction indices vs text injection indices documented and never mixed). ADecodeStep+ 9-argrunStepLooplets a request supply its decode path (decode coordinates = logical cache position + delta). Every existing signature is unchanged and delegatesnull, so absent multimodal inputs route through the identical old graph; the scheduler'sEmbeddingHookstays at its original post-lookup/pre-scale point; no new public API.VisualFeatureInjection(jmlx-models, package-private) — visual row-gather replacement and masked DeepStack residual add, pure compositions of existing core facades (concatenate/takeAxis/zeros/add); no new FFI primitive.MultiAxisRopeTest,SingleRowDecodeEquivalenceTest,DecoderRotationSeamTest,DecoderSeamTest,VisualFeatureInjectionTest(float32-comparison cases taggedfull-float32), and the opt-intools/hf-reference/qwen3vl_rope_interleaved_check.{py,jsh}probe pair cross-checking the Java component element-wise against the pinned transformers 4.57.6apply_interleaved_mrope+ rotate-half in the locked venv (per-case max abs error ≤ 2.4e-7 against the 1e-5 threshold; never Gradle-invoked, documented in the README).Per-path kernel matrix (frozen in findings §6.9)
MultiAxisRope/MultiAxisRotation)mlx_fast_rope/mlx_fast_rope_dynamicviaRopeSpec.applyNo fast-kernel optimization of the Qwen3-VL path in this WP (any later one requires a dated amendment per plan §6).
Exit gate — exact before/after decoder bits (both TF32 modes)
128cd1e, clean tree, via the reused 7.3a:jmlx-models:exactBitsRecord): 14 variants (8 Tier-A families + 6 quantized) × 9 captures (direct-prefill bits, per-step decode bits, batched prefill/decode with and without theEmbeddingHook, exact greedy IDs, full scheduler run) in each ofMLX_ENABLE_TF32=1and=0; spec hash846396b1dbab5a770a4f2c36841fe5ed1570a586b908956ed6e224fe5248e687; recordings are device-specific PR evidence injmlx-models/build/exact-bits/tf32-{1,0}/(host: M5 Max, macOS 27.0.1,mlx-metal 0.31.2, mlx-cfba4470b).:jmlx-models:exactBitsVerifyTf32Onand:jmlx-models:exactBitsVerifyTf32Offboth PASS — 126 captures per mode bit-exact, greedy IDs exact, only the permitted git-commit metadata field drifts. The old 1-D decoder path is bit-identical in both precision modes.Validation (all local, green)
:jmlx-core:check(414 test / 30 float32, 0 failures),:jmlx-models:check(376 test / 43 float32 / 2 thread-probe, 0 failures), root./gradlew check,./gradlew verifyMlxApiCallSites.git diff main -- RopeSpec.java MLXFast.javaempty; nojmlx-ffi/jmlx-vision/build/CI changes; no new Gradle tasks; no bindings regeneration.Docs
Old one-dimensional decoder path remains bit-identical in both precision modesandQwen kernel matrix, delta-shifted decode tests and unchanged RopeSpec variants verified.AGENTS.md:MultiAxisRope/MultiAxisRotationin the corennlist; WP4 paragraph in "Phase 7.3b additions".Explicitly deferred (documented in findings §6.9)
PostBlockHook,Qwen3VlModelcomposition andqwen3_vldispatch → WP5/WP6; generation/lifecycle/cache policy → WP7.Non-goals held: no native-pin change, no generated-binding edit, no loader, no model class, no public API.