From cd5aad04536e101bc92a06a70403e70c3dda26fd Mon Sep 17 00:00:00 2001 From: chaofengw Date: Tue, 24 Nov 2026 08:41:51 +0000 Subject: [PATCH 1/4] feat(aiperf-qual): qualify images_text_to_text instruction VLMs on OCRBench images_text_to_text is the Task SDK name of image-text generation: the same generate operation and prompt plus image_path request as vision_language_generation. It had no Task defaults, so its 16 ready profiles were left out of every run. The Task takes vision_language_generation's defaults (OCRBench gold, edit distance Perf output grader), which fit the instruction-following models: gemma-3n-e4b (bf16, fp32), minicpm-v-4.7-35b-a3b, smolvlm-500m-instruct and smolvlm2-500m-video-instruct (fp16, fp32). The other ten cannot answer OCRBench's free questions and are excluded until their schemes land: the OCR models (glm-ocr, minicpm-ocr-1.0, paddleocr-vl-1.6, lightonocr-2-1b, trocr-base-printed) will run OCRBench's text-recognition questions with their fixed prompt, and the captioners (blip-image-captioning- base, paligemma-3b-pt-224) caption output parity on COCO images. Signed-off-by: chaofengw --- apps/aiperf_qual/config/exclusions.yaml | 16 ++++++++++++++++ apps/aiperf_qual/config/tasks.yaml | 3 ++- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/apps/aiperf_qual/config/exclusions.yaml b/apps/aiperf_qual/config/exclusions.yaml index a71cd6dd4e..bf88443114 100644 --- a/apps/aiperf_qual/config/exclusions.yaml +++ b/apps/aiperf_qual/config/exclusions.yaml @@ -13,6 +13,22 @@ exclude: reason: the generic embed reference mean-pools and L2-normalizes; GTE pools the CLS token without normalizing, and its catalog testcase has no prompt - profile: nomic-embed-text-v1_5* reason: the generic embed reference sends unprefixed text; nomic-embed needs a query or document role, and its catalog testcase has no prompt + # images_text_to_text profiles that cannot answer OCRBench's free questions: until each has its own scheme (the + # OCR models on OCRBench's text-recognition questions with their fixed prompt, the captioners on output parity). + - profile: glm-ocr-* + reason: an OCR model prompted only with "Text Recognition:"; its scheme is OCRBench's text-recognition questions with that prompt, not yet configured + - profile: minicpm-ocr-1.0* + reason: an OCR model prompted only with "Text Recognition:"; its scheme is OCRBench's text-recognition questions with that prompt, not yet configured + - profile: paddleocr-vl-1.6 + reason: an OCR model prompted only with "OCR:"; its scheme is OCRBench's text-recognition questions with that prompt, not yet configured + - profile: lightonocr-2-1b-fp32 + reason: a page OCR model with no question input; its scheme is OCRBench's text-recognition questions without a prompt, not yet configured + - profile: trocr-base-printed + reason: a single-line printed-text OCR model with no prompt input; its scheme is OCRBench's text-recognition questions without a prompt, not yet configured + - profile: blip-image-captioning-base + reason: a captioner with no question input; its scheme is caption output parity against the native model on COCO images, not yet configured + - profile: paligemma-3b-pt-224-* + reason: a pretrained model that follows only task prefixes such as "caption en"; its scheme is caption output parity against the native model on COCO images, not yet configured - profile: nemotron-omni-nvfp4-text-image reason: the native reference cannot load the checkpoint, which needs its own modeling code and is ModelOpt mixed FP8/NVFP4 (Transformers has no modelopt quantizer); the family's independent reference is a pinned vLLM snapshot, and AIPerf has no vLLM native backend - profile: pi05-openpi-* diff --git a/apps/aiperf_qual/config/tasks.yaml b/apps/aiperf_qual/config/tasks.yaml index 678b12ed4d..b0b6ec4b7c 100644 --- a/apps/aiperf_qual/config/tasks.yaml +++ b/apps/aiperf_qual/config/tasks.yaml @@ -207,12 +207,13 @@ tasks: performance: {output_grader: parity_token_exact, output_grader_params: {min_prefix: 8, accept_equal_text: true}} text_continuation: *generate_text # the Task SDK name of the migrated decoder LMs (qwen3, #1558) - vision_language_generation: + vision_language_generation: &vlm # OCRBench alone (the owner's choice, October 2026): it caught both VLM conversion defects MMStar caught # (qwen3-vl-2b -26 vs -11 points, phi4-multimodal -19 vs -32) and TRTMC answers MMStar slowly (phi4-multimodal: # 29 min against 1 min for OCRBench). MMStar stays for profiles that state it. absolute: [ocrbench] performance: {output_grader: parity_edit_distance, output_grader_params: {max_distance: 0.15}} + images_text_to_text: *vlm # the Task SDK name of the image-text models (gemma-3n, smolvlm, minicpm-v) # Image, video and text to text (Cosmos3-Edge): OCRBench through the same bundle's image-text Task (the # image-video Task requires a video in every request); the video input is not scored. image_video_text_to_text: From 4db39574dc7c30ef30983e42d46e2beda392663e Mon Sep 17 00:00:00 2001 From: chaofengw Date: Wed, 25 Nov 2026 03:18:45 +0000 Subject: [PATCH 2/4] feat(aiperf-qual): benchmark testcases for gemma-3n and SmolVLM, exclude MiniCPM-V 4.7 Each image-text testcase gains the family E2E's photo and one of its prompts, which the benchmark catalog request needs; the E2E tests read neither key. MiniCPM-V 4.7 needs a newer Transformers than the reference environment has. Signed-off-by: chaofengw --- apps/aiperf_qual/config/exclusions.yaml | 2 ++ families/gemma3n/tests/manifests/gemma-3n-e4b-bf16.json | 2 ++ families/gemma3n/tests/manifests/gemma-3n-e4b-fp32.json | 2 ++ families/idefics3/tests/manifests/smolvlm-500m-instruct.json | 2 ++ .../tests/manifests/smolvlm2-500m-video-instruct-fp16.json | 2 ++ .../tests/manifests/smolvlm2-500m-video-instruct-fp32.json | 2 ++ 6 files changed, 12 insertions(+) diff --git a/apps/aiperf_qual/config/exclusions.yaml b/apps/aiperf_qual/config/exclusions.yaml index bf88443114..6a473dfb30 100644 --- a/apps/aiperf_qual/config/exclusions.yaml +++ b/apps/aiperf_qual/config/exclusions.yaml @@ -29,6 +29,8 @@ exclude: reason: a captioner with no question input; its scheme is caption output parity against the native model on COCO images, not yet configured - profile: paligemma-3b-pt-224-* reason: a pretrained model that follows only task prefixes such as "caption en"; its scheme is caption output parity against the native model on COCO images, not yet configured + - profile: minicpm-v-4.7-35b-a3b + reason: the native reference needs Transformers 5.22 for MiniCPM-V 4.7 (the family pins it) while the qualification's reference environment has an older one; it needs its own adapter and environment - profile: nemotron-omni-nvfp4-text-image reason: the native reference cannot load the checkpoint, which needs its own modeling code and is ModelOpt mixed FP8/NVFP4 (Transformers has no modelopt quantizer); the family's independent reference is a pinned vLLM snapshot, and AIPerf has no vLLM native backend - profile: pi05-openpi-* diff --git a/families/gemma3n/tests/manifests/gemma-3n-e4b-bf16.json b/families/gemma3n/tests/manifests/gemma-3n-e4b-bf16.json index 734b41d0cc..086aa5a3f7 100644 --- a/families/gemma3n/tests/manifests/gemma-3n-e4b-bf16.json +++ b/families/gemma3n/tests/manifests/gemma-3n-e4b-bf16.json @@ -12,6 +12,8 @@ "testcases": [ { "name": "gemma-3n-e4b-bf16", + "test_image": "data/test_img.jpeg", + "prompt": "Describe this image in one sentence.", "premerge": true, "reference_precision": "fp32", "reference_backend": "hf_transformers", diff --git a/families/gemma3n/tests/manifests/gemma-3n-e4b-fp32.json b/families/gemma3n/tests/manifests/gemma-3n-e4b-fp32.json index c1b56eb0cd..50a19904f0 100644 --- a/families/gemma3n/tests/manifests/gemma-3n-e4b-fp32.json +++ b/families/gemma3n/tests/manifests/gemma-3n-e4b-fp32.json @@ -12,6 +12,8 @@ "testcases": [ { "name": "gemma-3n-e4b-fp32", + "test_image": "data/test_img.jpeg", + "prompt": "Describe this image in one sentence.", "premerge": false, "reference_precision": "fp32", "reference_backend": "hf_transformers", diff --git a/families/idefics3/tests/manifests/smolvlm-500m-instruct.json b/families/idefics3/tests/manifests/smolvlm-500m-instruct.json index 6d92934b72..3479d74a1e 100644 --- a/families/idefics3/tests/manifests/smolvlm-500m-instruct.json +++ b/families/idefics3/tests/manifests/smolvlm-500m-instruct.json @@ -11,6 +11,8 @@ "testcases": [ { "name": "smolvlm-500m-instruct", + "test_image": "data/test_img.jpeg", + "prompt": "What type of vehicle is shown?", "premerge": true, "max_new_tokens": 32, "questions": [ diff --git a/families/smolvlm/tests/manifests/smolvlm2-500m-video-instruct-fp16.json b/families/smolvlm/tests/manifests/smolvlm2-500m-video-instruct-fp16.json index 8226a68814..504150f1e7 100644 --- a/families/smolvlm/tests/manifests/smolvlm2-500m-video-instruct-fp16.json +++ b/families/smolvlm/tests/manifests/smolvlm2-500m-video-instruct-fp16.json @@ -11,6 +11,8 @@ "testcases": [ { "name": "smolvlm2-500m-video-instruct-fp16", + "test_image": "data/test_img.jpeg", + "prompt": "Can you describe this image?", "premerge": false, "reference_precision": "fp32", "reference_backend": "hf_transformers", diff --git a/families/smolvlm/tests/manifests/smolvlm2-500m-video-instruct-fp32.json b/families/smolvlm/tests/manifests/smolvlm2-500m-video-instruct-fp32.json index 9a12127bb8..901d370b0f 100644 --- a/families/smolvlm/tests/manifests/smolvlm2-500m-video-instruct-fp32.json +++ b/families/smolvlm/tests/manifests/smolvlm2-500m-video-instruct-fp32.json @@ -11,6 +11,8 @@ "testcases": [ { "name": "smolvlm2-500m-video-instruct-fp32", + "test_image": "data/test_img.jpeg", + "prompt": "Can you describe this image?", "premerge": true, "reference_precision": "fp32", "reference_backend": "hf_transformers", From aa20663863ca1d67c678aa6540b4f86b92b0063d Mon Sep 17 00:00:00 2001 From: chaofengw Date: Wed, 25 Nov 2026 05:27:06 +0000 Subject: [PATCH 3/4] fix(aiperf-qual): serve image-text Tasks whose runtime applies its own chat template Gemma-3n, SmolVLM and Idefics3 declare no use_chat_template or enable_thinking config, so every OCRBench request reached them with an undeclared config and was rejected. The worker now accepts use_chat_template true for an image-text Task that does not declare it (the runtime applies its template by construction) and refuses false. images_text_to_text removes OCRBench's enable_thinking, and smolvlm-500m-instruct also removes the sampling fields its greedy runtime does not declare. The SmolVLM2 native reference installs the family requirements (num2words). Signed-off-by: chaofengw --- .../config/models/smolvlm-500m-instruct.yaml | 6 ++++++ .../smolvlm2-500m-video-instruct-fp16.yaml | 5 +++++ .../smolvlm2-500m-video-instruct-fp32.yaml | 5 +++++ apps/aiperf_qual/config/tasks.yaml | 8 ++++++-- apps/benchmark/native/benchmark_worker.cpp | 16 +++++++++++++++- 5 files changed, 37 insertions(+), 3 deletions(-) create mode 100644 apps/aiperf_qual/config/models/smolvlm-500m-instruct.yaml create mode 100644 apps/aiperf_qual/config/models/smolvlm2-500m-video-instruct-fp16.yaml create mode 100644 apps/aiperf_qual/config/models/smolvlm2-500m-video-instruct-fp32.yaml diff --git a/apps/aiperf_qual/config/models/smolvlm-500m-instruct.yaml b/apps/aiperf_qual/config/models/smolvlm-500m-instruct.yaml new file mode 100644 index 0000000000..d65e6b341d --- /dev/null +++ b/apps/aiperf_qual/config/models/smolvlm-500m-instruct.yaml @@ -0,0 +1,6 @@ +# SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# SPDX-License-Identifier: Apache-2.0 + +# The Idefics3 runtime decodes greedily and declares only max_new_tokens and do_sample: OCRBench's sampling fields +# (already greedy: temperature 0, top_k 1) and enable_thinking are removed (a null removes the suite's field). +absolute: [{name: ocrbench, request: {enable_thinking: null, temperature: null, top_k: null, top_p: null}}] diff --git a/apps/aiperf_qual/config/models/smolvlm2-500m-video-instruct-fp16.yaml b/apps/aiperf_qual/config/models/smolvlm2-500m-video-instruct-fp16.yaml new file mode 100644 index 0000000000..9ee5087d90 --- /dev/null +++ b/apps/aiperf_qual/config/models/smolvlm2-500m-video-instruct-fp16.yaml @@ -0,0 +1,5 @@ +# SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# SPDX-License-Identifier: Apache-2.0 + +reference: + requirements: families/smolvlm/requirements.txt # the SmolVLM2 processor needs num2words diff --git a/apps/aiperf_qual/config/models/smolvlm2-500m-video-instruct-fp32.yaml b/apps/aiperf_qual/config/models/smolvlm2-500m-video-instruct-fp32.yaml new file mode 100644 index 0000000000..9ee5087d90 --- /dev/null +++ b/apps/aiperf_qual/config/models/smolvlm2-500m-video-instruct-fp32.yaml @@ -0,0 +1,5 @@ +# SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# SPDX-License-Identifier: Apache-2.0 + +reference: + requirements: families/smolvlm/requirements.txt # the SmolVLM2 processor needs num2words diff --git a/apps/aiperf_qual/config/tasks.yaml b/apps/aiperf_qual/config/tasks.yaml index b0b6ec4b7c..e4bca107ff 100644 --- a/apps/aiperf_qual/config/tasks.yaml +++ b/apps/aiperf_qual/config/tasks.yaml @@ -207,13 +207,17 @@ tasks: performance: {output_grader: parity_token_exact, output_grader_params: {min_prefix: 8, accept_equal_text: true}} text_continuation: *generate_text # the Task SDK name of the migrated decoder LMs (qwen3, #1558) - vision_language_generation: &vlm + vision_language_generation: # OCRBench alone (the owner's choice, October 2026): it caught both VLM conversion defects MMStar caught # (qwen3-vl-2b -26 vs -11 points, phi4-multimodal -19 vs -32) and TRTMC answers MMStar slowly (phi4-multimodal: # 29 min against 1 min for OCRBench). MMStar stays for profiles that state it. absolute: [ocrbench] performance: {output_grader: parity_edit_distance, output_grader_params: {max_distance: 0.15}} - images_text_to_text: *vlm # the Task SDK name of the image-text models (gemma-3n, smolvlm, minicpm-v) + # The Task SDK name of the image-text models (gemma-3n, smolvlm): OCRBench as above, but their runtimes declare no + # enable_thinking config (a null removes the suite's field). + images_text_to_text: + absolute: [{name: ocrbench, request: {enable_thinking: null}}] + performance: {output_grader: parity_edit_distance, output_grader_params: {max_distance: 0.15}} # Image, video and text to text (Cosmos3-Edge): OCRBench through the same bundle's image-text Task (the # image-video Task requires a video in every request); the video input is not scored. image_video_text_to_text: diff --git a/apps/benchmark/native/benchmark_worker.cpp b/apps/benchmark/native/benchmark_worker.cpp index 8c98444e6e..6f04b8916c 100644 --- a/apps/benchmark/native/benchmark_worker.cpp +++ b/apps/benchmark/native/benchmark_worker.cpp @@ -3991,7 +3991,21 @@ Json run_generate(const trtmc::Model& model, const Json& request, const Timing& const std::string prompt = request.at("prompt").get(); if (request.contains("image_path")) { const auto task = task_for_operation(model, task_id); - const auto config = sdk_config(request, task.config_fields(), {"prompt", "image_path"}); + const auto fields = task.config_fields(); + // An image-text runtime that always applies its own chat template declares no + // use_chat_template. The serving chat route states it as true, which such a runtime + // honours by construction; false asks for a raw prompt it cannot take. + const bool templated = std::none_of(fields.begin(), fields.end(), [](const auto& field) { + return field.name == "use_chat_template"; + }); + if (templated && request.contains("use_chat_template") && + !request.at("use_chat_template").get()) + throw std::invalid_argument( + "the selected image-text Task always applies its chat template; " + "use_chat_template false is not supported"); + const auto config = + templated ? sdk_config(request, fields, {"prompt", "image_path", "use_chat_template"}) + : sdk_config(request, fields, {"prompt", "image_path"}); const auto path = request.at("image_path").get(); std::optional cached; if (!timing.asset_loading_included) From 7ccabd3770399baad65704cdd3c6070f9c1c6ba3 Mon Sep 17 00:00:00 2001 From: chaofengw Date: Wed, 25 Nov 2026 07:46:33 +0000 Subject: [PATCH 4/4] test(e2e): read the photo and prompt from the image-text testcases The manifests' test_image and prompt now feed the benchmark catalog, so the family E2E tests read them too instead of naming the same photo and question themselves: Gemma 3n and SmolVLM load the case's photo, and the SmolVLM-Instruct case's first question is its prompt. Signed-off-by: chaofengw --- families/gemma3n/tests/test_e2e.py | 12 ++++++------ .../tests/manifests/smolvlm-500m-instruct.json | 1 - families/idefics3/tests/test_e2e.py | 4 ++-- families/smolvlm/tests/test_e2e.py | 9 ++++----- 4 files changed, 12 insertions(+), 14 deletions(-) diff --git a/families/gemma3n/tests/test_e2e.py b/families/gemma3n/tests/test_e2e.py index 8ac34558d9..b96ce9d9b3 100644 --- a/families/gemma3n/tests/test_e2e.py +++ b/families/gemma3n/tests/test_e2e.py @@ -94,12 +94,12 @@ def _native_build_dir() -> Path: return native -def _images(directory: Path): - """The test photographs as decoded RGB arrays, raw files and lossless PNGs.""" +def _images(directory: Path, photo: str): + """The case's photograph and the car photograph as decoded RGB arrays, raw files and lossless PNGs.""" from PIL import Image result = {} - for name in ("test_img.jpeg", "test_img_car.jpeg"): + for name in (Path(photo).name, "test_img_car.jpeg"): image = Image.open(ROOT / "data" / name).convert("RGB") pixels = np.asarray(image) raw, png = directory / f"{name}.rgb", directory / f"{name}.png" @@ -113,7 +113,7 @@ def _images(directory: Path): def _conversations(images, max_new_tokens): """(name, messages) with image parts as {"image": name} placeholders.""" - first, second = "test_img.jpeg", "test_img_car.jpeg" + first, second = images return [ ("describe", [{"role": "user", "parts": [{"image": first}, {"text": PROMPTS["describe"]}]}]), ("system", [{"role": "system", "parts": [{"text": "You answer as briefly as possible."}]}, @@ -309,9 +309,9 @@ def test_e2e(case_name, request, tmp_path): # The end-of-sequence ids the builder writes into the bundle. stop_ids = validate_processing(checkpoint, ModelConfig.from_dir(checkpoint))["eos_token_ids"] max_new_tokens = int(case["max_new_tokens"]) - images = _images(tmp_path) + images = _images(tmp_path, case["test_image"]) conversations = _conversations(images, max_new_tokens) - record_evidence("inputs", {"prompt": PROMPTS["describe"], "image": ROOT / "data" / "test_img.jpeg", + record_evidence("inputs", {"prompt": PROMPTS["describe"], "image": ROOT / case["test_image"], "conversations": [_summary(name, messages) for name, messages in conversations]}) margin = None diff --git a/families/idefics3/tests/manifests/smolvlm-500m-instruct.json b/families/idefics3/tests/manifests/smolvlm-500m-instruct.json index 3479d74a1e..5633a89e4a 100644 --- a/families/idefics3/tests/manifests/smolvlm-500m-instruct.json +++ b/families/idefics3/tests/manifests/smolvlm-500m-instruct.json @@ -16,7 +16,6 @@ "premerge": true, "max_new_tokens": 32, "questions": [ - "What type of vehicle is shown?", "What color is the car?" ] } diff --git a/families/idefics3/tests/test_e2e.py b/families/idefics3/tests/test_e2e.py index b701720466..82d48089f0 100644 --- a/families/idefics3/tests/test_e2e.py +++ b/families/idefics3/tests/test_e2e.py @@ -257,7 +257,7 @@ def test_official_checkpoint_e2e(case_name, tmp_path, request): ) prefix, rest = template.split("") between, suffix = rest.split(sentinel) - for index, question in enumerate(case["questions"]): + for index, question in enumerate([case["prompt"], *case["questions"]]): text = processor.apply_chat_template( [dict(role="user", content=[dict(type="image"), dict(type="text", text=question)])], add_generation_prompt=True, @@ -344,7 +344,7 @@ def test_official_checkpoint_e2e(case_name, tmp_path, request): record_evidence( "thresholds", {"token_ids": "exact equality", "text": "exact equality", "pixel_atol": 2e-7} ) - for sample_index, question in enumerate(case["questions"]): + for sample_index, question in enumerate([case["prompt"], *case["questions"]]): record_evidence("inputs", {"question": question}) prompt = processor.apply_chat_template( [dict(role="user", content=[dict(type="image"), dict(type="text", text=question)])], diff --git a/families/smolvlm/tests/test_e2e.py b/families/smolvlm/tests/test_e2e.py index 3c45f7b3e9..1e7923082b 100644 --- a/families/smolvlm/tests/test_e2e.py +++ b/families/smolvlm/tests/test_e2e.py @@ -42,10 +42,9 @@ ROOT = Path(__file__).resolve().parent FAMILY = "smolvlm" MAX_NEW_TOKENS = 64 -# The repository's Apache-2.0 photograph (ASSET_LICENSES.md), its mirror image and a +# The case's photograph (the repository's Apache-2.0 one, ASSET_LICENSES.md), its mirror image and a # 150 x 382 portrait strip of it. The strip tiles to 2048 x 1024, whose 512 x 512 global # view takes Pillow 13's vertical-first resampling order with both passes. -PHOTO = "test_img.jpeg" STRIP_BOX = (300, 0, 450, 382) REQUESTS = [ [{"role": "user", "content": [{"type": "image", "asset": "photo"}, @@ -127,10 +126,10 @@ def _helper(runtime: Path, name: str) -> Path: raise AssertionError(f"build the owning {name} CMake target") -def _images(directory: Path) -> dict: +def _images(directory: Path, photo_path: str) -> dict: from PIL import Image, ImageOps - photo = Image.open(ROOT / "data" / PHOTO).convert("RGB") + photo = Image.open(ROOT / photo_path).convert("RGB") images = {} for name, picture in (("photo", photo), ("mirror", ImageOps.mirror(photo)), ("strip", photo.crop(STRIP_BOX))): @@ -292,7 +291,7 @@ def test_e2e(case_name, request, tmp_path): runner, probe = _helper(runtime, "smolvlm_inference_test"), _helper(runtime, "smolvlm_runtime_probe") assert (runtime / "libtrtmc_model_smolvlm.so").is_file() checkpoint = _checkpoint(manifest) - images = _images(tmp_path) + images = _images(tmp_path, case["test_image"]) bundle = tmp_path / manifest["bundle"] with evidence_stage("build"): build(BuildRequest(model_dir=checkpoint, output_path=bundle, family=FAMILY, task=manifest["task"],