Skip to content

feat(xla): define operator-level MLX/IREE numeric contracts #932

Description

@inureyes

Parent and affected work

Problem

The remaining OpenXLA multimodal family ports now fail at a shared boundary rather than at missing model topology: MLX CUDA and StableHLO/IREE can execute mathematically equivalent operators with different operand materialization, accumulator precision, reassociation, reduction trees, fused-kernel ordering, or backend-selected convolution plans. The current family implementations encode some of these choices locally, so each full-model oracle run is rediscovering the same backend contract one architecture at a time.

This is not a request to relax tolerances. The existing family gates must remain unchanged, and final greedy output remains token-exact. If an MLX kernel has no deterministic, representable execution contract, the affected XLA capability must remain fail-closed until a reproducible contract is implemented or the reference path itself is made deterministic.

The reference baseline also changed after the current seven branches were cut: #923 fixed a shared-memory race in MLX CUDA qmm_sm80 and changed the kernel artifact identity. Any Q4 evidence collected before f7a877e7 must therefore be treated as historical until it is reproduced on the deterministic kernel.

Current evidence

Family Draft PR First unresolved boundary
Molmo2 #916 at 684c6ee1 Current-head actual local-task gate reaches projector.output_all; first failure is flat index 358403 with max_abs=0.1640625, rms=0.0026185848. The immediately preceding projector.product passes (max_abs=0.037597656, rms=0.0002196383), isolating final dense-projection accumulation/association.
Gemma3 VLM #917 at 9ab13992 Current-head actual run was bounded before model start by a one-time pinned-MLX cache rebuild. The last valid actual evidence remains siglip.hidden.block1.output at 002bb77e: flat index 658517, 8 failures, max_abs=0.6672516; current head passes the exact example check and focused Gemma3 tests but makes no new parity claim.
Molmo #918 at a4047b22 Exact assets, hashes, compiler, and target were verified, but the release standalone runner exceeded the bounded five-minute GNU final-link window and produced no executable. No current-head checkpoint comparison ran; intermediate/KV-logit/token/lifecycle gates remain unqualified.
Youtu-VL #919 at 20c2bffd Pinned HF and local-task IREE actuals agree through preprocessing, patch projection, and row-wise normalization. First unresolved stage is layer.7.full, flat index 310: actual/reference 0.3125/0.28515625, max_abs=0.203125, 2,999 unchanged-threshold mismatches.
Qwen2.5-VL #920 at 02d41a18 Rebased on the shared foundation; focused Qwen2.5 tests pass. This host exposes no NVIDIA device, so post-#923 production MLX CUDA Q4 qmv/qmm evidence has not been reproduced and the family remains fail-closed.
Qwen3-VL #921 at a4b641e6 Rebased on the shared foundation; Qwen3 and DeepStack focused tests pass. This host exposes no NVIDIA device, so the stale pre-#923 Q4 comparison is not promoted and current production Q4 parity remains unqualified.
Gemma3n audio #922 at 0a5aa90d Shared CUDA-prefix contract is adopted and current diagnostics check plus 17 audio unit tests pass. The production first SSCP convolution still has 6 BF16-ULP residual failures with max_abs=0.25; no reproducible cuDNN-plan-equivalent IREE schedule is represented, so the capability remains disabled.

Goal

Define and enforce one versioned, operator-level numeric contract for MLX-to-StableHLO/IREE qualification, then use bounded micro-oracles to resolve shared drift before repeating full-model gates.

Required implementation

  • Add a versioned numeric-contract descriptor to the XLA auxiliary artifact identity. It must cover source checkpoint dtype, input/output materialization dtype, contraction accumulator/result dtype, explicit rounding boundaries, reduction or scan association policy where specified, quantized dequantization order, and any backend kernel or algorithm identity required for reproducibility.
  • Represent the descriptor in shared XLA configuration and validation code rather than as family-specific strings. Artifact loading must reject a missing or mismatched numeric-contract fingerprint before native invocation.
  • Add explicit emitter helpers for the contract-sensitive operations already used by the affected families: affine Q4 dequantization, dense/Q4 matrix multiplication, LayerNorm/RMSNorm reduction and restoration, residual addition, SiLU/GELU materialization, softmax/attention scaling, prefix reductions/scans, and convolution result typing.
  • Keep the helpers semantically narrow. A helper may specify operand/result dtype and an explicit association schedule, but it must not silently apply graph-wide F16/BF16 casts or rewrite unrelated operations.
  • Build deterministic micro-oracles that run identical operands through the MLX reference operation and the emitted IREE operation, record the first divergent output, and include exact backend/build/kernel identity. At minimum cover Q4 qmv/qmm on the post-fix(cuda): drain cp.async before qmm_sm80 epilogue smem store (#910) #923 kernel, dense matmul, normalization, activation plus projection, residual add, attention/softmax, cumulative normalization, and the Gemma3n SSCP convolution shape.
  • Separate three reference claims in reports: exact production-MLX equivalence, exact canonical decomposed-operation equivalence, and mathematical closeness. Only the first claim can satisfy a family production gate unless that family issue explicitly defines the canonical decomposed operation as its production reference.
  • For unspecified backend algorithms such as cuDNN convolution plan selection, either import and pin a reproducible engine configuration, implement a proven matching schedule, or keep the affected capability disabled. Do not substitute a tolerance increase or a mathematical proxy for a missing execution contract.
  • Rebase the seven affected family branches on the deterministic f7a877e7 baseline before using their evidence. Re-run only the bounded operator probes first; repeat a heavyweight full-model oracle only after the first divergent operator boundary passes.
  • Replace ad hoc family-local precision workarounds with the shared helpers when doing so preserves the family graph contract. Keep family-specific schedules only when the checkpoint architecture genuinely specifies a distinct operation.
  • Update diagnostics so every actual report includes the numeric-contract version, MLX revision and patch identity, IREE/compiler version, target/device, selected kernel or algorithm identity when observable, and the exact first divergent tensor coordinate.
  • Keep CLI/server capability predicates fail-closed while a required family contract or oracle is unresolved. Merging shared infrastructure must not advertise an unqualified family.

Merge strategy

Implement the shared descriptor, fingerprint validation, explicit helpers, and micro-oracle harness in a narrow foundation PR first. After that PR lands, rebase the seven draft family PRs sequentially, resolve their shared-file overlap against the foundation, and run the affected bounded probes. A family PR becomes ready only after its original intermediate and token-exact gates pass; diagnostic or fail-closed infrastructure may be split into a separate PR when it is independently complete and does not expose the unfinished family.

Non-goals

  • Raising or removing the existing family-specific absolute, RMS, ULP, or token-exact acceptance thresholds.
  • Treating generic StableHLO mathematical equivalence as proof of production MLX equivalence.
  • Encoding one GPU model's undocumented kernel schedule as a repository-wide default.
  • Re-running all heavyweight model gates before a bounded operator probe shows that the first divergent boundary is fixed.
  • Advertising Molmo, Molmo2, Youtu-VL, Qwen2.5-VL, Qwen3-VL, Gemma3 VLM, or Gemma3n audio before its existing issue acceptance criteria pass.

Validation

  • Add unit tests for numeric-contract serialization, fingerprint stability, mismatch rejection, and every explicit materialization boundary.
  • Add mutation-sensitive emitter tests that fail when a specified cast, accumulator/result dtype, operation order, or association schedule is removed or reassociated.
  • Run deterministic MLX/IREE micro-oracles repeatedly on the production-relevant CUDA target and at least one local CPU target where the operation is supported.
  • Reproduce the Qwen2.5-VL and Qwen3-VL Q4 probes after fix(cuda): drain cp.async before qmm_sm80 epilogue smem store (#910) #923 and distinguish a corrected stale reference from a remaining representable contract mismatch.
  • Re-run the first-divergence probes for Gemma3 VLM, Molmo2, and Gemma3n audio before any full-model rerun.
  • Run the existing mlxcel-xla structural/golden tests, native IREE compile/load/invoke checks, text-only XLA architecture oracle, and continuous-batch regression suites.
  • Record commands, target/device, compile time, transfers, memory, and first-divergence output without committing generated model artifacts or incidental CSV files.

Acceptance criteria

  • A versioned operator-level numeric contract is part of every affected auxiliary artifact fingerprint and is rejected on mismatch before invocation.
  • Contract-sensitive emitter operations use shared explicit helpers with mutation-sensitive tests for dtype, rounding, operation order, and required association schedules.
  • Deterministic MLX/IREE micro-oracles cover the listed operation classes and report reproducible backend identity plus the first divergent coordinate.
  • Q4 evidence for feat: add Qwen2.5-VL OpenXLA vision path #920 and feat(xla): add Qwen3-VL DeepStack vision path #921 is refreshed on or after fix(cuda): drain cp.async before qmm_sm80 epilogue smem store (#910) #923, with stale pre-fix evidence clearly separated.
  • Each affected family either passes its unchanged original intermediate/token-exact gates or remains fail-closed with a precise unrepresentable backend contract recorded.
  • No tolerance is relaxed and no mathematical proxy is reported as production-backend parity.
  • Existing text-only XLA and continuous-batch behavior remains unchanged and qualified.

Activity

  1. added
    type:enhancementNew features, capabilities, or significant additions
    area:architectureArchitecture and code structure changes
    area:coremlxcel-core: MLX FFI, primitives, KV cache, layers
    area:inferenceGeneration, sampling, decoding (incl. speculative, DRY)
    on Jul 26, 2026
  2. 5 remaining items

  3. inureyes commented on Jul 27, 2026

    @inureyes
    MemberAuthor

    Progress update:

    The seven family PRs remain drafts until their family-specific intermediate/output/token gates pass. Next work is to expand the CPU probe surface to normalization, activation/projection, residual, and softmax/attention primitives before attempting family-specific qualification. CUDA-dependent Q4/SSCP parity remains blocked on a GPU-capable runner.

  4. inureyes commented on Jul 27, 2026

    @inureyes
    MemberAuthor

    Shared numeric-contract foundation progress:

    Current CPU evidence: 7 operations, 48 output elements, 0 failures. Dense matmul, residual add, RMSNorm, attention softmax, LayerNorm, and SiLU projection are bit-identical to the canonical references; GELU projection max absolute error is 4.7683716e-7 within the unchanged contract. All reports remain canonical-decomposition and production_qualified=false, so no family capability changed.

    Next CPU-supported boundary is the explicit prefix reduction/scan contract. Post-#923 Q4 qmv/qmm and production SSCP convolution parity still require the CUDA environment.

  5. inureyes commented on Jul 27, 2026

    @inureyes
    MemberAuthor

    Prefix-reduction foundation is now merged in #943 at 15a3711. The shared helper pins the MLX CUDA one-block contiguous scan hierarchy (4 values/thread, 32-thread staged warp scans, first-warp total scan, width <= 4096) and records association=cuda-one-block-scan in operator artifact identity.

    A cancellation-sensitive 2x130 probe distinguishes this schedule from naive sequential accumulation and passed all 260 outputs bit-exactly through local-task CPU IREE. The full suite is now 8 operations / 308 outputs with 0 failures; all reports remain canonical-decomposition and production_qualified=false. Next I will rebase draft #922 and replace its family-local cumulative scan body with this shared helper; the unrelated conv1 cuDNN/IREE reduction-plan blocker remains unchanged.

  6. inureyes commented on Jul 27, 2026

    @inureyes
    MemberAuthor

    Merged #944 with an independently executable CPU IREE affine Q4 dequant probe. The probe uploads actual u32 packed lanes plus f16 scale/bias resident weights, pins least-significant-first lane order, group-8 metadata, and separate multiply-then-add evaluation, and passes 32/32 outputs bit-exact. The complete local-task suite now passes 9 operators / 340 outputs with production_qualified=false throughout. Native CUDA qmv/qmm parity remains CUDA-runner-gated.

  7. inureyes commented on Jul 27, 2026

    @inureyes
    MemberAuthor

    Shared diagnostic runtime foundation merged via #945. The diagnostics-only helper bounds IREE local-task topology to one group, uses the host-default pthread stack, caches the process-global parse result, and leaves production startup unchanged. Local validation covered formatting, two structural tests, diagnostics-feature compilation, and Clippy with pre-existing warnings only. Final native linkage and runtime execution are now being exercised through the Youtu family oracle in #919.

  8. inureyes commented on Jul 27, 2026

    @inureyes
    MemberAuthor

    Youtu-VL bounded numeric-contract evidence (#919 @ 20c2bffd)

    The real pinned tencent/Youtu-VL-4B-Instruct@8d30a0e... HF-eager capture and
    local-task IREE diagnostic graph now execute with a bounded fail-fast runner.

    Resolved semantic boundaries:

    • all 18 checkpoint artifact hashes and fixture hash match;
    • placeholder cardinality now expands exactly per image;
    • stale shard-index hints no longer select the wrong tensor file;
    • resized pixels, flattened/channel-fast patch layout, spatial metadata,
      window ordering, and vision RoPE match exactly;
    • patch projection passes the unchanged gate (max_absolute=0.015625);
    • row-wise LayerNorm decomposition matches HF exactly.

    First unresolved production-reference boundary:

    • stage: layer.7.full
    • first failure: flat index 310
    • actual/reference: 0.3125 / 0.28515625
    • absolute/max absolute: 0.02734375 / 0.203125
    • unchanged-threshold mismatch count: 2,999

    Feeding the IREE patch projection into HF layer 0 remains within 0.015625 of
    the HF reference, but the IREE layer-0 output reaches 0.03125; drift begins
    inside BF16 projection/attention contractions and accumulates. Explicitly
    typing contraction inputs as BF16 produced byte-identical local-task IREE
    outputs, so the family-local workaround was removed. Shared LayerNorm,
    RMSNorm, GELU, and softmax emitter helpers are used. No tolerance changed.

    Classification under #932: canonical decompositions execute, but this target
    does not prove the pinned production-reference BF16 contraction schedule.
    Youtu-VL remains draft/fail-closed; language logits/KV, exact greedy tokens,
    reset/reuse, and mixed batching remain unqualified.

  9. inureyes commented on Jul 27, 2026

    @inureyes
    MemberAuthor

    Current-main family qualification checkpoint

    Shared foundation is merged on main@ec6fbb6d through #934, #937, #938, and #940–#945. The local-task CPU suite covers 9 operator contracts / 340 outputs with zero contract failures, while every report remains correctly classified as canonical decomposition and production_qualified=false.

    All seven family branches are now rebased onto this foundation, draft, mergeable/clean, and green on their current CI heads:

    Family PR head Current qualification result
    Molmo2 #916 684c6ee1 Actual gate fails first at projector.output_all, flat 358403, max_abs=0.1640625, rms=0.0026185848; preceding product passes.
    Gemma3 VLM #917 9ab13992 Current actual was bounded before model start by the one-time pinned-MLX rebuild. Last valid actual remains block 1, flat 658517, 8 failures, max_abs=0.6672516; no current-head parity claim.
    Molmo #918 a4047b22 Assets and hashes are pinned, but no release runner was produced inside the bounded link window. A gold audit also invalidated Cargo/MLX fingerprints before link and was stopped immediately; no actual comparison claim.
    Youtu-VL #919 20c2bffd Actual gate reaches layer 7; first fail flat 310, actual/reference 0.3125/0.28515625, max_abs=0.203125, 2,999 mismatches.
    Qwen2.5-VL #920 02d41a18 Current structural tests pass; this environment exposes no NVIDIA device, so post-#923 production Q4 qmv/qmm evidence remains unavailable.
    Qwen3-VL #921 a4b641e6 Current Qwen3/DeepStack tests pass; the stale pre-#923 Q4 evidence is not promoted, and no NVIDIA device is exposed for reproduction.
    Gemma3n audio #922 0a5aa90d Shared prefix scan is adopted; diagnostics and 17 audio tests pass. The production first SSCP convolution still has 6 BF16-ULP residual failures with max_abs=0.25, without a represented cuDNN-equivalent schedule.

    Qualification decision: none of #916–#922 satisfies its unchanged original intermediate plus token-exact gates, so none is merged or advertised. No tolerance was relaxed, and no canonical/mathematical proxy is reported as production parity.

    Remaining #932 blockers are production CUDA Q4 qmv/qmm evidence, a reproducible production SSCP convolution contract, and current-head actual completion for the environment-bounded families. Until a GPU-capable/cached runner or a reproducible backend schedule is available, #932 and the affected family capabilities must remain open and fail-closed.

    Refs #566

  10. added
    status:blockedBlocked by dependencies or other issues
    and removed on Jul 27, 2026
  11. inureyes commented on Jul 27, 2026

    @inureyes
    MemberAuthor

    Three host and methodology defects found while running the family gates on GB10

    Running the #566 family gates on the GB10 qualification host surfaced three problems that
    sit underneath the numeric work. The first two are build-environment defects; the third
    invalidates the reference policy of past MLX-vs-IREE evidence and is the one that matters
    for this issue.

    1. The MLX-vs-IREE reference has been running TF32, not F32

    mlx/utils.h:196 defaults MLX_ENABLE_TF32 to 1:

    inline bool enable_tf32() {
      static bool enable_tf32_ = get_var("MLX_ENABLE_TF32", 1);
      return enable_tf32_;
    }

    With it on, mlx/backend/cuda/gemms/cublas_gemm.cpp selects
    CUBLAS_COMPUTE_32F_FAST_TF32 for f32 contractions, which carries a 10-bit mantissa.
    src/lib/mlxcel-xla/README.md already states the policy explicitly:

    The companion command sets MLX_ENABLE_TF32=0: the declared reference policy is true F32,
    while MLX CUDA's default FAST_TF32 mode is an intentional, lower-precision throughput
    policy and is not labeled as F32 evidence.

    None of the family runners set it, and CUDA_TEST.md does not list it. So MLX CUDA has been
    acting as a TF32 reference against a true-F32 IREE candidate, and the resulting gap has been
    attributed to the IREE graphs.

    Measured on #918 (Molmo, torch_dtype: float32, unquantized vision tower, and a Molmo
    emitter that applies no precision demotion, so both sides should be plain f32):

    stage MLX_ENABLE_TF32 default (1) MLX_ENABLE_TF32=0
    vision.patch_embedding 1.336575e-3, 0 fail 1.336575e-3, 0 fail
    vision.selected_layer_14 2.258102, 0 fail 1.991226, 0 fail
    vision.selected_layer_21 2.317841, 4 fail 2.046043, 4 fail
    vision.projector 2.251205e-1, 0 fail 1.643753e-1, 0 fail
    prepared.sparse_add_visual_rows 2.500000e-1, 0 fail 1.875000e-1, 0 fail
    decoder.prefill_logits 1.176004e-1, 0 fail 1.173029e-1, 0 fail

    Turning TF32 off removes 12 percent of the drift at the selected ViT layers and 25 to 27
    percent at the projector and the merge. The patch embedding is unchanged, consistent with
    mlx/backend/cuda/conv.cpp:139 gating the convolution path on enable_tf32() separately.

    This does not by itself close #918: the same four elements at flat index 514613 still fail.
    The point is narrower and important. Any past or future statement of the form "IREE diverges
    from the MLX F32 reference by X" is not valid F32 evidence unless MLX_ENABLE_TF32=0 was
    set for that run, and the residual after setting it is the only number that should be
    attributed to the graph.

    Suggested follow-ups:

    • have the family runners assert MLX_ENABLE_TF32=0 rather than rely on the operator, in
      the same spirit as the diagnostics-only local-task thread configuration
    • record the value in every report alongside the other backend identity fields required by
      feat(xla): add bounded numeric oracle harness #938
    • add it to the CUDA_TEST.md environment section

    2. build.rs silently targets the wrong GPU when nvidia-smi is not visible

    src/lib/mlxcel-core/build.rs:274:

    let cuda_arch = env::var("MLX_CUDA_ARCHITECTURES")
        .unwrap_or_else(|_| detect_cuda_arch().unwrap_or_else(|| "90a".to_string()));

    detect_cuda_arch() shells out to nvidia-smi. In a sandbox without GPU passthrough, which
    CUDA_TEST.md documents as the situation for the earlier sessions, detection fails and the
    build silently produces 90a binaries that cannot launch on this host's sm_121. The failure
    surfaces much later and looks like a runtime or numeric fault:

    • cudaGraphAddKernelNode(...) failed: invalid resource handle with CUDA graphs enabled
    • cudaLaunchKernelExC(...) failed: no kernel image is available for execution on the device
      with MLX_USE_CUDA_GRAPHS=0

    Wrong-architecture MLX builds were present in the #866, #869 and #878 worktrees. A loud
    failure would be better than a silent fallback, since the fallback cannot run on the host
    that just failed to be detected.

    3. build.rs auto-detection does not match the shipped release architecture

    sm_arch_with_suffix() appends the architecture-specific a suffix for any SM at or above
    90, so auto-detection on GB10 yields 121a. The release workflow ships
    MLX_CUDA_ARCHITECTURES: "90a;100;121" and docs/installation.md documents plain 121 for
    GB10. The suffix is only documented as required for Hopper, where qmm_sm90 is gated on
    90a; there is no equivalent Blackwell gate.

    An auto-detected local build therefore has a different kernel set from the released binary.
    Verified on #918 that 121a and 121 produce byte-identical numeric results
    (vision.selected_layer_21 max_abs 2.317841, 4 failures, first failure 514613 under both),
    so this is a reproducibility and provenance problem rather than a numeric one, but
    qualification evidence should be produced with the shipped value.

    Environment used

    GB10, driver 580.159.03, CUDA 13.0, IREE 3.12.0rc20260721 (compiler and source-built
    runtime, dc9601f8), Rust 1.93.1, MLX pin b7c3dd6d27f4, MLX_CUDA_ARCHITECTURES=121.

  12. inureyes commented on Jul 27, 2026

    @inureyes
    MemberAuthor

    Scope of the TF32 reference-policy defect, measured across all five family gates

    Follow-up to the report above. I re-ran every family gate I could reach at current head with
    MLX_ENABLE_TF32=0 against the MLX default, changing nothing else, to bound which results the
    policy actually affects. The answer is narrower than the initial report implied and is worth
    recording precisely.

    PR family effect of MLX_ENABLE_TF32=0 verdict
    #916 Molmo2 vit.block.0 0.0028572083 to 0.000009536743 (300x) decides the gate: FAILED at first block to full PASS
    #918 Molmo v1 selected layers 12 percent, projector and merge 25 to 27 percent improves, 4 failures remain
    #920 Qwen2.5-VL none, identical to six decimals no effect
    #921 Qwen3-VL none, all 39 failing comparisons identical no effect
    #917 Gemma3 VLM none, identical at every stage no effect

    The discriminator is whether the compared path performs genuine f32 contractions.
    CUBLAS_COMPUTE_32F_FAST_TF32 is only selected for f32 operands, so towers resident at a
    narrow checkpoint dtype never take that route. The Qwen2.5-VL report makes this visible
    directly: every emitted-graph stage is bit-identical between the two runs, while the two
    host-side dense-f32 controls move
    (mlp_gate_projection_iree_norm2_dense_f32_control 0.000122 to 0.000076,
    mlp_up_projection_iree_norm2_dense_f32_control 0.000290 to 0.000122). The flag reaches the
    f32 host controls and not the f16 tower.

    Practical consequences:

    1. The Molmo2 result previously recorded as a numeric blocker (first strict CUDA failure at
      selected layer 18, projector.output_all at max_abs=0.1640625) was a reference-policy
      artifact. That gate passes at 329fbd99.
    2. The Qwen2.5-VL, Qwen3-VL and Gemma3 divergences are properties of the emitted graphs and
      are unchanged. Their blockers stand as recorded.
    3. Asserting the policy in the runners is still worth doing, because a reader cannot tell
      from a report which category a given family falls into, and feat(xla): add bounded numeric oracle harness #938 requires backend identity
      to be recorded rather than inferred.

    Every result above was produced with MLX_CUDA_ARCHITECTURES=121 on GB10, IREE
    3.12.0rc20260721, MLX pin b7c3dd6d27f4, Rust 1.93.1, tolerances unchanged.

  13. inureyes commented on Jul 30, 2026

    @inureyes
    MemberAuthor

    Reduction-order contract: decided

    The maintainer resolved this on 2026-07-30. A family PR is gated on exactly two
    things:

    1. Every operator's same_input control passes at its existing threshold. No
      absolute, relative, RMS or ULP threshold is relaxed for any model.
    2. Deterministic greedy output is token-exact against MLX on the pinned
      fixture.

    Accumulated intermediate-value drift is still measured and reported as evidence,
    but it is not a gate.

    Why

    Per-operator parity is already established. #921's .same_input controls all pass,
    so each operator agrees with MLX when handed identical inputs; what diverges is the
    composition over many blocks. #922's convolution oracle reports
    schedule_outcomes=[0.0, 1.0], an exact-tie cancellation, which shows the residual
    is reduction order rather than precision. StableHLO offers no portable way to
    pin a reduction tree, and a previous audit already showed
    precision_config=HIGHEST selects the same IREE schedule, so matching MLX's
    reduction order would require custom kernels or IREE codegen changes of unbounded
    scope.

    Gating on per-operator parity plus token exactness keeps every existing numeric
    threshold intact while testing the property a production consumer actually
    experiences.

    Consequences

    PR previously blocking observation now judged by
    #918 Molmo 4 of 1,181,696 values at selected_layer_21, same index on local-task / local-sync / cuda token gate
    #921 Qwen3-VL 39 comparisons, block_2 (2 values) growing to block_23 (89,017) token gate
    #920 Qwen2.5-VL 22 failing stages, post_full_layer_23 max_abs=105.27258 token gate
    #917 Gemma3 VLM block1.output 8 failures max_abs=0.6672516 growing to 1,408,110 token gate, but the block-1 onset still needs an explanation: a divergence that appears abruptly at one block is not the same signature as gradual drift and may be a real defect

    This makes the missing token-exactness gates the critical path for these PRs rather
    than further intermediate-divergence investigation.

    Precondition found while implementing this

    #963: every OpenXLA path returned the terminating EOS id as generated output, while
    the eager MLX paths drop it before detokenization. Measured on GB10 with
    molmo2-4b: eager CLI returns White (1 token), MLXCEL_BACKEND=xla CLI returns
    White<|im_end|> (2 tokens). Until that is fixed, every family fails a
    token-exact gate on one trailing token, so #963 lands before any family PR is
    judged by criterion 2.

    Refs #566.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:architectureArchitecture and code structure changesarea:coremlxcel-core: MLX FFI, primitives, KV cache, layersarea:inferenceGeneration, sampling, decoding (incl. speculative, DRY)priority:highHigh prioritystatus:blockedBlocked by dependencies or other issuestype:enhancementNew features, capabilities, or significant additions

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions