[Tests][XPU] Limit Qwen2-VL generation length to avoid flaky numerical divergence (#54172)

Signed-off-by: Lin, Fanli <fanli.lin@intel.com>
Co-authored-by: Kunshang Ji <kunshang.ji@intel.com>
This commit is contained in:
Fanli Lin
2026-08-31 22:59:57 +08:00
committed by GitHub
co-authored by Kunshang Ji
parent bd575a0d0b
commit 82936c409d
@@ -878,14 +878,22 @@ VLM_TEST_SETTINGS = {
multi_image_prompt="Picture 1: <vlm_image>\nPicture 2: <vlm_image>\nDescribe these two images with one paragraph respectively.", # noqa: E501
max_model_len=4096,
max_num_seqs=2,
# torch 2.13 accumulates CPU numerical drift in the qwen2_vl multi-image
# path: HF and vLLM agree for a long prefix (~69 tokens) then a token
# flips outside vLLM's top-N only near the end of the generation. The
# window is already at the max_logprobs=20 cap, so widening it further is
# not possible. Treat this as acceptable drift and cap max_tokens on CPU
# so the compared prefix stays before the divergence, keeping the
# multi-image path under test. See pytorch/pytorch#187735.
max_tokens=64 if current_platform.is_cpu() else 128,
# Qwen2-VL multi-image generation can accumulate backend-specific
# numerical drift during long autoregressive decoding.
#
# On CPU with torch 2.13, HF and vLLM agree for a long prefix before
# diverging near the end of generation. See pytorch/pytorch#187735.
#
# A similar late-generation divergence is observed on XPU with BF16
# ViT FlashAttention. The issue is not resolved by increasing
# num_logprobs from 10 to 20, while FP32 and BF16 with Triton ViT
# attention pass in local reproduction.
#
# Cap max_tokens on CPU and XPU to keep the correctness comparison
# before the numerically sensitive late-generation region.
max_tokens=64
if current_platform.is_cpu() or current_platform.is_xpu()
else 128,
num_logprobs=20 if current_platform.is_cpu() else 10,
auto_cls=AutoModelForImageTextToText,
vllm_output_post_proc=model_utils.qwen2_vllm_to_hf_output,