Fix response parsing: endpoint-type: image_retrieval + custom endpoint - #465
Open
a-rich wants to merge 1 commit into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Support custom image-retrieval endpoints in GenAI-Perf
Summary
GenAI-Perf fails while processing results from valid image-retrieval endpoints
when the endpoint is not the hard-coded
v1/inferroute and the response bodydoes not contain the literal string
image_retrieval.This affects NVIDIA Retriever NIMs that use routes such as:
v1/ocrv1/page-elementsv1/table-structureThe request workload completes and Perf Analyzer writes a valid profile export,
but GenAI-Perf then exits with:
The proposed change makes
ImageRetrievalProfileDataParsertrust the outputformat already selected by
--endpoint-type image_retrieval. It does not add anallowlist of Retriever endpoint names and does not depend on a product-specific
response schema.
User-visible failure
A representative invocation is:
Perf Analyzer successfully sends requests to the NIM and creates
profile_export.json. The failure occurs afterward, when GenAI-Perf tries tocalculate and export metrics.
A simplified OCR response in the profile export looks like:
{ "model": "nvidia/nemotron-ocr-v2", "data": [ { "index": 0, "text_detections": [] } ], "usage": { "images_size_mb": 1.0 } }Page-elements and table-structure NIMs use the same image-retrieval request
shape but return their own task-specific objects in
data.Root cause
GenAI-Perf already has authoritative format information at configuration time:
Despite selecting the specialized parser, its base constructor calls
ProfileDataParser._get_profile_metadata(). For an OpenAI service, that methodtries to infer the response format again.
The inference recognizes image retrieval only when either:
v1/infer, orimage_retrieval.The OCR, page-elements, and table-structure routes satisfy neither condition.
Consequently, format inference raises
Unknown OpenAI response formateventhough the user explicitly supplied the correct endpoint type and GenAI-Perf
already selected the correct parser.
This is a result-processing problem, not an HTTP compatibility problem. The
requests reach the custom endpoint and the NIM returns successful responses
before the error occurs.
Proposed change
Override metadata handling in
ImageRetrievalProfileDataParserso an OpenAIprofile handled by that class is assigned
ResponseFormat.IMAGE_RETRIEVAL:This is safe within the existing dispatch model because GenAI-Perf instantiates
ImageRetrievalProfileDataParseronly after the configuration has selected theimage-retrieval output format.
The change intentionally does not inspect the endpoint name or response body.
An invalid route will still fail during the request. A valid custom route can
return any task-specific response because image metrics are calculated from:
image_urlentries in the request payload.The image-retrieval metric parser does not need fields from the response body.
Scope
The proposed fix covers all OpenAI-style endpoints used with
--endpoint-type image_retrieval, including:v1/inferv1/ocrv1/page-elementsv1/table-structureIt is not overfit to OCR and does not require adding new endpoint names when a
Retriever NIM introduces another image task.
The change is deliberately limited to image retrieval. Other endpoint types
continue to use their existing metadata behavior.
Why CLI changes are insufficient
There is no supported GenAI-Perf 0.0.11 option that bypasses the second format
inference step.
--endpoint-type image_retrievalis already present and correctly selects thespecialized parser.
--endpointtov1/inferwould send the request to the wrong NIMroute.
image_retrievalto benchmark data or relying on it toappear in a model response would be brittle and could alter the workload.
export-processing subcommand after manually changing its endpoint metadata.
The defect therefore needs a code change in GenAI-Perf.
Validation
The issue and proposed fix were tested with GenAI-Perf 0.0.11 and the OCR 2.0.0
release-candidate NIM.
parsing with
Unknown OpenAI response format.format completed successfully, confirming the failure location.
0.0.11 installation and run against the same NIM.
profile_export_genai_perf.jsonandprofile_export_genai_perf.csv.v1/ocrand an OCR-shaped response passes,along with the existing
v1/infertests.The candidate implementation and regression test are currently in:
genai-perf/genai_perf/profile_data_parser/image_retrieval_profile_data_parser.pygenai-perf/tests/test_data_parser/test_image_retrieval_profile_data_parser.pyMore general robustness direction
The underlying design issue is that response format is known when GenAI-Perf
builds its configuration, but later code tries to recover it from endpoint names
and response substrings. That creates a growing list of special cases for custom
endpoints.
A broader follow-up could make output format explicit throughout result
processing:
ProfileDataParser, or persistendpoint_typeorresponse_formatin the profile export metadata.profile exports that lack explicit format metadata.
That design would make custom embeddings, rankings, multimodal, and generative
endpoints more robust as well. The proposed image-parser override is a small,
backward-compatible correction that follows this principle without requiring a
profile-export schema change.