Skip to content

geniex-bench: honour --prompt-file in the VLM run loop - #1278

Merged
Mengsheng Wu (mengshengwu) merged 1 commit into
mainfrom
fix/vlm-bench-prompt-file
Aug 4, 2026
Merged

geniex-bench: honour --prompt-file in the VLM run loop#1278
Mengsheng Wu (mengshengwu) merged 1 commit into
mainfrom
fix/vlm-bench-prompt-file

Conversation

@vinovo

Copy link
Copy Markdown
Contributor

Summary

geniex-bench --accuracy --prompt-file was silently ignoring the supplied prompt file for VLM models. The VLM run loop always called build_vlm_prompt with the hardcoded Describe the image. string, so every invocation produced a response to that fixed text regardless of what the file contained.

Root cause

run_vlm had no handling for o->prompt_buf (the --prompt-file content). The LLM loop has full support for prompt_buf -- splitting on --- separators, feeding each segment as prompt_utf8 -- but that logic was never ported to the VLM loop.

Fix

Mirror the LLM loop's prompt_buf handling in run_vlm:

  • When --prompt-file is supplied, the file content (a pre-templated string, with the chat template applied by the caller) is fed verbatim as prompt_utf8, bypassing build_vlm_prompt entirely.
  • ----delimited multi-segment files are supported the same way as in the LLM loop.
  • When no --prompt-file is given, the existing behaviour is preserved: the fixed VLM_DEFAULT_PROMPT is run through build_vlm_prompt so image tokens are placed correctly by the bundle's chat template.

The VLM reset-between-runs logic is also updated to reset at the start of each new prompt segment, matching the LLM loop.

Testing

  • Throughput benchmarking (no --prompt-file): behaviour unchanged.
  • --accuracy --prompt-file: each invocation now responds to the actual prompt in the file rather than Describe the image..
  • Multi-segment --prompt-file (separated by ---): each segment runs as its own prompt with a KV-cache reset between them.

@vinovo
Paul Zhu (vinovo) force-pushed the fix/vlm-bench-prompt-file branch 3 times, most recently from 12cd393 to 4233bb6 Compare August 4, 2026 00:16
The VLM run loop previously ignored --prompt-file and always fed the
hardcoded VLM_DEFAULT_PROMPT ("Describe the image.") through the
bundle's chat template, regardless of what text was supplied on the
command line.  This broke the accuracy-eval path: the device script
calls geniex-bench --accuracy --prompt-file <prompt_NNN.txt> once
per dataset prompt, but every invocation produced a response to the
same fixed string instead of the actual dataset question.

Fix: mirror the LLM loop's prompt_buf handling in run_vlm.  When
--prompt-file is supplied the file content (a pre-templated string,
chat template applied host-side) is fed verbatim as prompt_utf8,
bypassing build_vlm_prompt entirely.  "---"-delimited multi-segment
files are supported the same way as in the LLM loop.  When no
--prompt-file is given the existing behaviour is preserved: the fixed
default text is run through build_vlm_prompt so image tokens are
placed correctly by the bundle's chat template.

The VLM reset-between-runs logic is updated to also reset at the start
of each new prompt segment, matching the LLM loop's behaviour.

Signed-off-by: Paul Zhu <paulzhuzx@gmail.com>
@mengshengwu
Mengsheng Wu (mengshengwu) merged commit e11a657 into main Aug 4, 2026
42 checks passed
@mengshengwu
Mengsheng Wu (mengshengwu) deleted the fix/vlm-bench-prompt-file branch August 4, 2026 08:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants