Skip to content

fix: honour checkpoint pixel bounds in the eager Qwen3-VL image processor #3290

Closed

Description

@inureyes

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

  1. added
    status:ready
    type:bug
    priority:high
    area:architecture
    area:inference
    on Nov 23, 2026
  2. added
    status:in-progress
    status:review
    and removed
    status:ready
    status:in-progress
    on Nov 23, 2026
  3. added
    status:done
    and removed
    status:review
    on Nov 23, 2026
  4. added a commit that references this issue on Nov 25, 2026
    19a2aea
  5. added this to the 0.9 milestone on Nov 30, 2026
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:architecturearea:inferencepriority:highstatus:donetype:bug

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions