Skip to content

test(xla): validate a LLaVA reference architecture end to end - #897

Merged
inureyes merged 3 commits into
mainfrom
feature/issue-862-llava-reference-validation
Jul 24, 2026
Merged

inureyes merged 3 commits into
mainfrom
feature/issue-862-llava-reference-validation

Conversation

@inureyes

@inureyes inureyes commented Jul 24, 2026 •

Copy link
Copy Markdown
Member

Summary

  • Pin the public HF and converted LLaVA checkpoints by revision, license, canonical manifests for every consumed model/tokenizer/processor sidecar, and 19-tensor conversion identity.
  • Pin tests/fixtures/test_image.png at the oracle, diagnostic runner, validation script, and public-surface boundaries.
  • Capture independent processor, vision, projector, merged embedding, logits, all-layer KV, and greedy-token reference seams, then compare the production MLX-host plus IREE path with ordered first-divergence reporting.
  • Make the comparator fail closed on exact cases/stages, duplicate JSON keys, dtype/semantic shape/path/size errors, non-finite arrays, exact KV/generation metadata, and exact negative-case outcomes; cover the contract with model-free adversarial tests wired into the structural validation gate.
  • Add one-image, text-only, malformed-placeholder, and context-overflow cases. The two-image case uses the pinned original followed by a deterministic red/blue channel swap, and Python/Rust now prove that raw bytes, processor slices, and concatenated order are observably distinct.
  • Derive malformed-placeholder and context-overflow categories from the production typed/exact errors, and reject tokenizer/chat-template/weight alternates that could take runtime precedence over the pinned manifests.
  • Preserve typed media content at the server template boundary so OpenAI image_url parts render the same LLaVA prompt and unexpanded token IDs as the CLI.
  • Document CUDA and CPU local-sync runtime, memory, preprocessing, prefill, and decode baselines without committing weights or generated captures.

Validation

  • cargo fmt --all -- --check
  • cargo clippy --features xla-diagnostics --lib --bins --example xla_llava_reference_check -- -D warnings
  • cargo test --features xla-diagnostics --example xla_llava_reference_check: 4 passed
  • python -m unittest -v spike/openxla/test_llava_reference_oracle.py: 16 adversarial comparator/oracle tests passed
  • MLXCEL_ORACLE_PYTHON=... scripts/xla/validate_llava_reference.sh --structural-only: oracle 16 passed, diagnostic seam 1 passed, chat-template 92 passed/1 ignored
  • cargo test -p mlxcel-xla --lib llava_diagnostics_share_the_production_embeddings_prefill: 1 passed
  • cargo test --lib server::chat_template: 92 passed, 1 ignored
  • cargo test --lib -- --test-threads=1 --skip models::bitnet::tests::bitlinear_matmul_known_ternary_case: 4,482 passed, 113 ignored; the skipped test aborts only in the backend-less Linux build
  • cargo test --release --lib --features cuda -- --test-threads=1: 4,482 passed, 113 ignored
  • scripts/xla/validate_arch.sh --structural-only: 9 passed
  • Fresh HF versus XLA CUDA and CPU local-sync stage comparisons after the channel-swap change: every one-image/two-image/text-only case passed with first_divergence = null
  • CUDA surface gate after hardening: CLI and streaming server both generated The image displays a; exact 15 unexpanded prompt IDs, finish reason, usage 15/4/19, chunk order, effective prefill 743, and metrics passed
  • Qwen2 CUDA companion: HF token-exact single sequence passed; four-request batch reference equivalence passed at 20.53 tok/s
  • bash -n, Python bytecode compilation, git diff --check, and explicit staged/untracked CSV checks passed; no CSV or generated capture is committed

Environment notes

  • IREE local-task could not create worker threads under the constrained host; the documented local-sync CPU fallback passed with the CUDA host preprocessor.
  • Debug CUDA libtest linking exceeded the AArch64 call relocation range; the CI-style release CUDA suite linked and passed.
  • All-target Clippy reaches a pre-existing print_literal warning in examples/qmm_gemv_microbench.rs; all library, binary, and new LLaVA example targets pass with -D warnings.

Closes #862

Add a pinned Hugging Face oracle, production-path diagnostic captures, and first-divergence comparison for LLaVA image prefills. Validate CLI and streaming server prompt parity, preserve typed media markers, and document CPU/CUDA execution baselines.

Refs #862
@inureyes inureyes added status:review Under review type:test Test related changes priority:high High priority area:inference Generation, sampling, decoding (incl. speculative, DRY) area:benchmark Benchmark harness and performance measurement (bench_*.sh, /update-benchmarks) labels Jul 24, 2026
@inureyes inureyes added status:done Completed status:review Under review and removed status:review Under review status:done Completed labels Jul 24, 2026
@inureyes
inureyes merged commit 72dd056 into main Jul 24, 2026
4 checks passed
@inureyes inureyes added status:done Completed and removed status:review Under review labels Jul 24, 2026
@inureyes
inureyes deleted the feature/issue-862-llava-reference-validation branch July 24, 2026 04:09
@inureyes inureyes self-assigned this Aug 31, 2026
be-free-snowboy pushed a commit to freestylejs/snowbrain-mlxcel that referenced this pull request Oct 27, 2026
…#897)

* feat(xla): add llava reference validation

Add a pinned Hugging Face oracle, production-path diagnostic captures, and first-divergence comparison for LLaVA image prefills. Validate CLI and streaming server prompt parity, preserve typed media markers, and document CPU/CUDA execution baselines.

Refs lablup#862

* fix(xla): harden LLaVA reference contract

* fix(xla): close LLaVA reference validation gaps
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:benchmark Benchmark harness and performance measurement (bench_*.sh, /update-benchmarks) area:inference Generation, sampling, decoding (incl. speculative, DRY) priority:high High priority status:done Completed type:test Test related changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

test(xla): validate a LLaVA reference architecture end to end

1 participant