Repository navigation
Description
Part of #566
Problem / Background
Eager MLX and the XLA backend preprocess Qwen3-VL images differently, so they feed the model different inputs. For models/qwen3-vl-2b-instruct-4bit and tests/fixtures/test_image.png (224x224), XLA resizes to 256x256 (grid [1,16,16], 64 image tokens), matching HF. Eager leaves it at 224x224 (49 image tokens). This is one cause of the eager vs XLA divergence at generated index 8 found in #3212 (PR #3269).
Current Behavior
load_qwen3_vl_iree_host_preprocessor (src/loading/vlm_qwen.rs:569-574) reads the checkpoint's size.shortest_edge (65536) and longest_edge and resizes bicubic. The checkpoint has no processor_config.json. The eager loader (src/loading/vlm_qwen.rs:892-893, qwen_vl_processor_with_norm) uses DEFAULT_MIN_PIXELS (3136) and Lanczos3.
Proposed Solution
Make eager read the same checkpoint pixel bounds and resample filter as HF and the XLA path, through one shared helper used by both loaders. Check the MoE Qwen3-VL and Qwen3.5 siblings that call qwen_vl_processor_with_norm, and fix them the same way if they diverge from HF.
Scope
- In scope: src/loading/vlm_qwen.rs and the sibling callers of
qwen_vl_processor_with_norm. - Out of scope: vision-tower precision (see the follow-up issue on bf16 rounding in the XLA vision tower).
Acceptance Criteria
- A unit test pins the image token count for a 224x224 image against the checkpoint config (64).
- Eager and XLA report the same image token count and grid on the fixture.
- Existing Qwen-VL eager tests and real-model greedy runs still pass.
- CHANGELOG notes any user-visible token-count change.
- Integrated into the real eager load path, not a standalone helper.
Verification
cargo test --profile test-fast qwen
Then a real-model run with -n 64 --temp 0 on the fixture, eager and XLA, comparing the reported token count and grid.
Activity
feat(xla): run the operator micro-oracles against MLX on CUDA (#3269)
fix(security): bound Qwen-VL sidecar pixel limits and make smart_resi…
fix(vision): select one whole Qwen-VL processor sidecar as HF 5.x does
fix(vision): honour checkpoint pixel bounds in the eager Qwen3-VL pro…