Skip to content

Feature Request: Support multimodal documents in /v1/rerank endpoint for VL reranker models #25921

Closed as not planned

Description

@qy8502

Prerequisites

  • I am running the latest code. Mention the version if possible as well.
  • I carefully followed the README.md.
  • I searched using keywords relevant to my issue to make sure that I am creating a new issue that is not already open (or closed).
  • I reviewed the Discussions, and have a new and useful enhancement to share.

Feature Description

The /v1/rerank endpoint currently only accepts documents as a flat string array. When serving a vision-language reranker model such as Qwen3-VL-Reranker-2B, there is no way to pass image content through this endpoint.

I tried two workarounds:

Passing an image URL as a plain string — the model tokenizes the URL text literally and never fetches the image.
Passing a base64 data-URI as a plain string — the model tokenizes the base64 characters as text, producing meaningless scores.
Server log when sending object-format documents:

Wrong type supplied for parameter 'documents'. Expected 'array',
using default value: [json.exception.type_error.302]
type must be string, but is object

What I expected: the ability to send structured multimodal documents, similar to what vLLM and the Alibaba DashScope API already support. For example:

{
  "model": "Qwen3-VL-Reranker-2B",
  "query": "mountain range patrol",
  "documents": [
    {"text": "A continuous mountain range landscape"},
    {"image": "https://example.com/mountain.jpg"},
    {"text": "caption text", "image": "https://example.com/photo.jpg"}
  ]
}

The llama-server already supports multimodal input in /v1/chat/completions via the mtmd/clip pipeline. The rerank endpoint could reuse the same image preprocessing path to encode image tokens before feeding them into the cross-encoder scoring logic.

Motivation

Vision-language reranker models (Qwen3-VL-Reranker, Jina-Reranker-M0, etc.) are designed to jointly rank text and image candidates against a query. They are a key component in multimodal RAG pipelines — for example, retrieving the most relevant figure or page image for a text query, or ranking candidate images by semantic relevance.

Without multimodal document support in /v1/rerank, users who deploy these GGUF models via llama-server cannot use the model's core capability. The only alternatives today are:

Switch to vLLM (heavier dependency, different deployment stack)
Write a custom Python wrapper around Transformers (loses the efficiency of llama.cpp quantized inference)
Adding this to llama-server would make it a complete serving solution for VL reranker models, consistent with its existing multimodal chat support.

Possible Implementation

A few thoughts:

Extend the /v1/rerank request schema to accept documents as either string[] (backward compatible) or an array of objects: {"text": "..."} for text-only, {"image": "url-or-data-uri"} for image-only, {"text": "...", "image": "..."} for combined.

For image documents, reuse the existing mtmd image preprocessing (resize, normalize, patch embedding) that /v1/chat/completions already uses, then prepend the resulting image tokens to the document token sequence before cross-encoder scoring.

The query field could similarly accept a string (text) or an object {"image": "..."} for image-as-query use cases.

Reference implementations: vLLM score API accepts {"text": ..., "image": ...} objects; DashScope rerank API uses {"image": "url-or-base64-data-uri"}; Qwen3-VL-Reranker model card shows the Transformers example.

Activity

  1. MS00-GitIt commented on Sep 2, 2026

    @MS00-GitIt

    I would like this as well

  2. timothywang21 commented on Sep 3, 2026

    @timothywang21
    Contributor

    Hi you're in luck! I actually had the same issue and I implemented the multimodal rerank and embedding support so that Qwen3VL-Embedding and Rerank models can be used to their full extent in RAG workflows. I'm going to see if I can PR this. Feel free to test it out and see if it works for you.

    Fork: https://github.com/timothywang21/llama.cpp-Qwen3VL-Support

  3. github-actions commented on Oct 19, 2026

    @github-actions
    Contributor

    This issue was closed because it has been inactive for 14 days since being marked as stale.

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

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions