/ Модель

Характеристики

Контекст
262 144 токена
Размер весов
16,3 ГБ
Лицензия
Apache 2.0
Архитектура
qwen3_vl · dense
Базовая модель
Qwen3-VL-8B-Instruct
Библиотека
sentence-transformers
Опубликована
7 янв 2026

Qwen3-VL-Embedding-8B

ЭмбеддингиТекст → embedding9 профессий

Мультимодальная модель Qwen на 8 млрд параметров, создающая эмбеддинги текста, изображений и видео для поиска, сопоставления и кластеризации.

1,5 млнскачиваний за 30 дней495лайковвеса обновлены16 апр 2026

Бенчмарки

Как модель справилась с задачами пользователей ailist и что о ней публикуют открытые лидерборды

Тесты пользователейпока нет

Никто ещё не опубликовал тест этой модели. Соберите бенчмарк из своих задач — результат появится здесь.

  1. Добавьте модель в бенчмарк

    Вместе с другими моделями категории «Эмбеддинги» — сравнение идёт внутри одной категории.

  2. Опишите свои задачи

    Напишите запросы, при необходимости приложите файлы и эталонные ответы.

  3. Запустите и опубликуйте

    Модели ответят на каждую задачу, судья оценит ответы. Опубликованный результат появится на этой странице.

Публичные оценки36

Из открытых лидербордов. Сравнивайте результаты одного теста при одинаковых условиях — отсутствие оценки не значит, что модель хуже.

  • Vidore3PhysicsRetrieval

    main_score

    Результат

    0,4898

    Общий результат 0,4915Общий результат 0,4883Общий результат 0,4836
    MTEB

    Публичная таблицаревизия совпадает

  • Vidore3NuclearRetrieval.v2

    main_score

    Результат

    0,4357

    Общий результат 0,4238
    MTEB

    Публичная таблицаревизия совпадает

  • MSRVTTT2V

    main_score

    Результат

    0,7401

    MTEB

    Публичная таблицаревизия совпадает

  • Vidore3IndustrialRetrieval.v2

    main_score

    Результат

    0,4447

    Общий результат 0,4624Общий результат 0,4595
    MTEB

    Публичная таблицаревизия совпадает

  • ActivityNetCaptionsV2TRetrieval

    main_score

    Результат

    0,6985

    MTEB

    Публичная таблицаревизия совпадает

  • TUNABenchV2TRetrieval

    main_score

    Результат

    0,987

    MTEB

    Публичная таблицаревизия совпадает

  • OmniVideoBenchVideoCentricQA

    main_score

    Результат

    0,2731

    MTEB

    Публичная таблицаревизия совпадает

  • Vidore3TelecomRetrieval

    main_score

    Результат

    0,6709

    Общий результат 0,6914Общий результат 0,672
    MTEB

    Публичная таблицаревизия совпадает

  • MELDVideoZeroShot

    main_score

    Результат

    0,248

    MTEB

    Публичная таблицаревизия совпадает

  • HumanAnimalCartoonVPairClassification

    main_score

    Результат

    0,8675

    MTEB

    Публичная таблицаревизия совпадает

  • Vidore3FinanceFrRetrieval

    main_score

    Результат

    0,4759

    Общий результат 0,4299
    MTEB

    Публичная таблицаревизия совпадает

  • DailyOmniVideoCentricQA

    main_score

    Результат

    0,3102

    MTEB

    Публичная таблицаревизия совпадает

  • Vidore3PhysicsRetrieval.v2

    main_score

    Результат

    0,4917

    MTEB

    Публичная таблицаревизия совпадает

  • MultiLongDocRetrieval

    main_score

    Результат

    0,4211

    MTEB

    Публичная таблицаревизия совпадает

  • Vidore3NuclearRetrieval

    main_score

    Результат

    0,4434

    Общий результат 0,4352
    MTEB

    Публичная таблицаревизия совпадает

  • Vidore3FinanceEnRetrieval

    main_score

    Результат

    0,591

    Общий результат 0,585
    MTEB

    Публичная таблицаревизия совпадает

  • HMDB51ZeroShot

    main_score

    Результат

    0,6431

    MTEB

    Публичная таблицаревизия совпадает

  • Vidore3PharmaceuticalsRetrieval.v2

    main_score

    Результат

    0,6373

    Общий результат 0,6394
    MTEB

    Публичная таблицаревизия совпадает

  • Vidore3EnergyRetrieval.v2

    main_score

    Результат

    0,6275

    MTEB

    Публичная таблицаревизия совпадает

  • MusicAVQACLSVideoClassification

    main_score

    Результат

    0,6237

    MTEB

    Публичная таблицаревизия совпадает

  • Vidore3FinanceEnRetrieval.v2

    main_score

    Результат

    0,5917

    MTEB

    Публичная таблицаревизия совпадает

  • BelebeleRetrieval

    main_score

    Результат

    0,9607

    MTEB

    Публичная таблицаревизия совпадает

  • Vidore3IndustrialRetrieval

    main_score

    Результат

    0,4783

    MTEB

    Публичная таблицаревизия совпадает

  • Vidore3HrRetrieval.v2

    main_score

    Результат

    0,5792

    Общий результат 0,5744
    MTEB

    Публичная таблицаревизия совпадает

  • Kinetics400ZeroShot

    main_score

    Результат

    0,7109

    MTEB

    Публичная таблицаревизия совпадает

  • HMDB51Classification

    main_score

    Результат

    0,7075

    MTEB

    Публичная таблицаревизия совпадает

  • Vidore3PharmaceuticalsRetrieval

    main_score

    Результат

    0,6506

    MTEB

    Публичная таблицаревизия совпадает

  • YouCook2V2TRetrieval

    main_score

    Результат

    0,5245

    MTEB

    Публичная таблицаревизия совпадает

  • VALOR32KT2VRetrieval

    main_score

    Результат

    0,712

    MTEB

    Публичная таблицаревизия совпадает

  • Vidore3HrRetrieval

    main_score

    Результат

    0,5714

    MTEB

    Публичная таблицаревизия совпадает

  • Vidore3ComputerScienceRetrieval.v2

    main_score

    Результат

    0,7434

    Общий результат 0,7486
    MTEB

    Публичная таблицаревизия совпадает

  • NExTQAVideoCentricQA

    main_score

    Результат

    0,5861

    MTEB

    Публичная таблицаревизия совпадает

  • ActivityNetCaptionsT2VRetrieval

    main_score

    Результат

    0,7882

    MTEB

    Публичная таблицаревизия совпадает

  • AVEDatasetVideoClustering

    main_score

    Результат

    0,8402

    MTEB

    Публичная таблицаревизия совпадает

  • YouCook2T2VRetrieval

    main_score

    Результат

    0,5387

    MTEB

    Публичная таблицаревизия совпадает

  • Kinetics700V

    main_score

    Результат

    0,6087

    MTEB

    Публичная таблицаревизия совпадает

Что умеет модель

Описание составлено по карточке модели и метаданным Hugging Face

Qwen3-VL-Embedding-8B — мультимодальная модель эмбеддингов семейства Qwen, разработанная командой Qwen и дообученная на базе Qwen/Qwen3-VL-8B-Instruct. Она предназначена для поиска и сопоставления информации между текстом, изображениями, скриншотами и видео, а также для кластеризации мультимодального контента. Модель принимает отдельные модальности и их сочетания и кодирует их в общее векторное пространство.

Модель содержит 8 млрд параметров, имеет архитектуру Qwen3-VL и контекст длиной до 32 тысяч токенов. Размерность эмбеддинга достигает 4096; поддерживаются настраиваемые размерности от 64 до 4096. Заявлена поддержка более 30 языков, а среди сценариев — мультимодальный и межъязыковой поиск, сопоставление текста с изображениями и видео и визуальный поиск по документам.

Модель распространяется под лицензией Apache-2.0. Эмбеддинги подходят для первичного поиска и кластеризации; для уточнения порядка найденных результатов карточка рекомендует отдельную модель Qwen3-VL-Reranker. Для многоязычных сценариев README советует формулировать инструкции на английском, поскольку большинство инструкций при обучении были на этом языке.

Сценарии применения

  • поиск изображений по текстовому запросу
  • поиск видео по тексту и сопоставление видеоматериалов
  • поиск по скриншотам и визуальным документам
  • межъязыковой поиск по тексту и мультимодальным материалам
  • кластеризация текстов и визуального контента
  • первичный отбор кандидатов для мультимодального поиска

Ограничения

Модель создаёт векторы для поиска и кластеризации, а не оценки релевантности для финального ранжирования; для переранжирования README рекомендует отдельную модель. Для многоязычных сценариев карточка советует задавать инструкции на английском.

Для каких профессий подходит9

Разделы каталога профессий, в задачах которых используется эта модель

Все профессии

Также подходит для

Карточка модели

README от автора на Hugging Face, как он его опубликовал

Открыть на Hugging Face

Qwen3-VL-Embedding-8B

Highlights

The Qwen3-VL-Embedding and Qwen3-VL-Reranker model series are the latest additions to the Qwen family, built upon the recently open-sourced and powerful Qwen3-VL foundation model. Specifically designed for multimodal information retrieval and cross-modal understanding, this suite accepts diverse inputs including text, images, screenshots, and videos, as well as inputs containing a mixture of these modalities.

While the Embedding model generates high-dimensional vectors for broad applications like retrieval and clustering, the Reranker model is engineered to refine these results, establishing a comprehensive pipeline for state-of-the-art multimodal search.

  • Multimodal Versatility: Both models seamlessly handle a wide range of inputs—including text, images, screenshots, and video—within a unified framework. They deliver state-of-the-art performance across diverse multimodal tasks such as image-text retrieval, video-text matching, visual question answering (VQA), and multimodal content clustering.

  • Unified Representation Learning (Embedding): By leveraging the Qwen3-VL architecture, the Embedding model generates semantically rich vectors that capture both visual and textual information in a shared space. This facilitates efficient similarity computation and retrieval across different modalities.

  • High-Precision Reranking (Reranker): We also introduce the Qwen3-VL-Reranker series to complement the embedding model. The reranker takes a (query, document) pair as input—where both query and document may contain arbitrary single or mixed modalities—and outputs a precise relevance score. In retrieval pipelines, the two models are typically used in tandem: the embedding model performs efficient initial recall, while the reranker refines results in a subsequent re-ranking stage. This two-stage approach significantly boosts retrieval accuracy.

  • Exceptional Practicality: Inheriting Qwen3-VL’s multilingual capabilities, the series supports over 30 languages, making it ideal for global applications. It is highly practical for real-world scenarios, offering flexible vector dimensions, customizable instructions for specific use cases, and strong performance even with quantized embeddings. These capabilities enable developers to seamlessly integrate both models into existing pipelines, unlocking powerful cross-lingual and cross-modal understanding.

Model Overview

Qwen3-VL-Embedding-8B has the following features:

  • Model Type: MultiModal Embedding
  • Supported Languages: 30+ Languages
  • Supported Input Modalities: Text, images, screenshots, videos, and arbitrary multimodal combinations (e.g., text + image, text + video)
  • Number of Parameters: 8B
  • Context Length: 32k
  • Embedding Dimension: Up to 4096, supports user-defined output dimensions ranging from 64 to 4096

For more details, including benchmark evaluation, hardware requirements, and inference performance, please refer to our technical report, blog, GitHub.

Qwen3-VL-Embedding and Qwen3-VL-Reranker Model list

ModelSizeModel LayersSequence LengthEmbedding DimensionQuantization SupportMRL SupportInstruction Aware
Qwen3-VL-Embedding-2B2B2832K2048YesYesYes
Qwen3-VL-Embedding-8B8B3632K4096YesYesYes
Qwen3-VL-Reranker-2B2B2832K---Yes
Qwen3-VL-Reranker-8B8B3632K---Yes

Note:

  • Quantization Support indicates the supported quantization post process for the output embedding.
  • MRL Support indicates whether the embedding model supports custom dimensions for the final embedding.
  • Instruction Aware notes whether the embedding or reranking model supports customizing the input instruction according to different tasks. Our evaluation indicates that, for most downstream tasks, using instructions (instruct) typically yields an improvement of 1% to 5% compared to not using them. Therefore, we recommend that developers create tailored instructions specific to their tasks and scenarios. In multilingual contexts, we also advise users to write their instructions in English, as most instructions utilized during the model training process were originally written in English.

Model Performance

Evaluation Results on MMEB-V2

Results on the MMEB-V2 benchmark. All models except IFM-TTE have been re-evaluated on the updated VisDoc OOD split. CLS: classification, QA: question answering, RET: retrieval, GD: grounding, MRET: moment retrieval, VDR: ViDoRe, VR: VisRAG, OOD: out-of-distribution.

ModelModel SizeImage CLSImage QAImage RETImage GDImage OverallVideo CLSVideo QAVideo RETVideo MRETVideo OverallVisDoc VDRv1VisDoc VDRv2VisDoc VRVisDoc OODVisDoc OverallAll
# of Datasets →101012436555318104642478
VLM2Vec2B58.749.365.072.959.733.430.520.630.728.649.813.551.848.244.047.7
VLM2Vec-V22B62.956.369.577.364.939.334.328.836.834.675.544.979.462.269.259.2
GME-2B2B54.429.966.955.551.934.942.025.631.133.686.154.082.567.576.855.3
GME-7B7B57.734.771.259.356.037.450.428.437.038.489.455.685.068.379.359.1
Ops-MM-embedding-v18B69.769.673.187.272.759.762.245.743.253.880.159.679.367.874.468.9
IFM-TTE8B76.778.574.689.377.960.567.951.754.959.285.271.592.753.379.574.1
RzenEmbed8B70.671.778.592.175.958.863.551.045.555.789.760.788.769.981.372.9
Seed-1.6-embedding-1215unknown75.074.979.389.078.085.266.759.154.867.790.060.390.070.782.276.9
Qwen3-VL-Embedding-2B2B70.274.474.988.675.072.863.852.351.661.185.266.086.374.380.273.4
Qwen3-VL-Embedding-8B8B74.481.080.092.280.179.170.157.053.266.188.269.988.878.383.377.9

Evaluation Results on MMTEB

Results on the MMTEB benchmark.

ModelSizeMean (Task)Mean (Type)Bitxt MiningClass.Clust.Inst. Retri.Multi. Class.Pair. Class.RerankRetri.STS
NV-Embed-v27B56.2949.5857.8457.2940.801.0418.6378.9463.8256.7271.10
GritLM-7B7B60.9253.7470.5361.8349.753.4522.7779.9463.7858.3173.33
BGE-M30.6B59.5652.1879.1160.3540.88-3.1120.180.7662.7954.6074.12
multilingual-e5-large-instruct0.6B63.2255.0880.1364.9450.75-0.4022.9180.8662.6157.1276.81
gte-Qwen2-1.5B-instruct1.5B59.4552.6962.5158.3252.050.7424.0281.5862.5860.7871.61
gte-Qwen2-7b-Instruct7B62.5155.9373.9261.5552.774.9425.4885.1365.5560.0873.98
text-embedding-3-large-58.9351.4162.1760.2746.89-2.6822.0379.1763.8959.2771.68
Cohere-embed-multilingual-v3.0-61.1253.2370.5062.9546.89-1.8922.7479.8864.0759.1674.80
Gemini Embedding-68.3759.5979.2871.8254.595.1829.1683.6365.5867.7179.40
Qwen3-Embedding-0.6B0.6B64.3356.0072.2266.8352.335.0924.5980.8361.4164.6476.17
Qwen3-Embedding-4B4B69.4560.8679.3672.3357.1511.5626.7785.0565.0869.6080.86
Qwen3-Embedding-8B8B70.5861.6980.8974.0057.6510.0628.6686.4065.6370.8881.08
Qwen3-VL-Embedding-2B2B63.8755.8469.5165.8652.503.8726.0878.5064.8067.1274.29
Qwen3-VL-Embedding-8B8B67.8858.8877.4871.9555.824.4628.5981.0865.7269.4175.41

Usage

Sentence Transformers

Install Sentence Transformers with pip install sentence-transformers, then use the model like this:

from sentence_transformers import SentenceTransformer

# Load the model
model = SentenceTransformer("Qwen/Qwen3-VL-Embedding-8B")

# Text queries
queries = [
    "A woman playing with her dog on a beach at sunset.",
    "Pet owner training dog outdoors near water.",
    "Woman surfing on waves during a sunny day.",
    "City skyline view from a high-rise building at night.",
]

# Documents: text, image, and text+image
documents = [
    "A woman shares a joyful moment with her golden retriever on a sun-drenched beach at sunset, as the dog offers its paw in a heartwarming display of companionship and trust.",
    "https://qianwen-res.oss-cn-beijing.aliyuncs.com/Qwen-VL/assets/demo.jpeg",
    {"text": "A woman shares a joyful moment with her golden retriever on a sun-drenched beach at sunset, as the dog offers its paw in a heartwarming display of companionship and trust.", "image": "https://qianwen-res.oss-cn-beijing.aliyuncs.com/Qwen-VL/assets/demo.jpeg"},
]

# Encode queries and documents
query_embeddings = model.encode(queries)
doc_embeddings = model.encode(documents)
print(query_embeddings.shape, doc_embeddings.shape)
# (4, 4096) (3, 4096)

# Compute similarities
similarities = model.similarity(query_embeddings, doc_embeddings)
print(similarities)
# tensor([[0.7438, 0.6556, 0.6244],
#         [0.4430, 0.3323, 0.3929],
#         [0.3685, 0.2310, 0.2874],
#         [0.0602, -0.0162, 0.0167]])

By default, all inputs are wrapped with the "Represent the user's input." instruction via a system prompt. You can customize this by passing a different prompt:

# With a custom prompt
model.encode(queries, prompt="Retrieve relevant documents for the query.")

Using transformers

  • requirements
transformers>=4.57.0
qwen-vl-utils>=0.0.14
torch==2.8.0

Basic Usage Example

from scripts.qwen3_vl_embedding import Qwen3VLEmbedder

# Define a list of query texts
queries = [
    {"text": "A woman playing with her dog on a beach at sunset."},
    {"text": "Pet owner training dog outdoors near water."},
    {"text": "Woman surfing on waves during a sunny day."},
    {"text": "City skyline view from a high-rise building at night."}
]

# Define a list of document texts and images
documents = [
    {"text": "A woman shares a joyful moment with her golden retriever on a sun-drenched beach at sunset, as the dog offers its paw in a heartwarming display of companionship and trust."},
    {"image": "https://qianwen-res.oss-cn-beijing.aliyuncs.com/Qwen-VL/assets/demo.jpeg"},
    {"text": "A woman shares a joyful moment with her golden retriever on a sun-drenched beach at sunset, as the dog offers its paw in a heartwarming display of companionship and trust.", "image": "https://qianwen-res.oss-cn-beijing.aliyuncs.com/Qwen-VL/assets/demo.jpeg"}
]

# Specify the model path
model_name_or_path = "Qwen/Qwen3-VL-Embedding-8B"

# Initialize the Qwen3VLEmbedder model
model = Qwen3VLEmbedder(model_name_or_path=model_name_or_path)
# We recommend enabling flash_attention_2 for better acceleration and memory saving,
# model = Qwen3VLEmbedder(model_name_or_path=model_name_or_path, torch_dtype=torch.float16, attn_implementation="flash_attention_2")

# Combine queries and documents into a single input list
inputs = queries + documents

# Process the inputs to get embeddings
embeddings = model.process(inputs)

# Compute similarity scores between query embeddings and document embeddings
similarity_scores = (embeddings[:4] @ embeddings[4:].T)

# Print out the similarity scores in a list format
print(similarity_scores.tolist())

# [[0.74267578125, 0.6630859375, 0.6328125], [0.443603515625, 0.33349609375, 0.396484375], [0.3671875, 0.2354736328125, 0.289306640625], [0.060821533203125, -0.01557159423828125, 0.0165863037109375]]

vLLM Basic Usage Example

import argparse
import numpy as np
import os
from typing import List, Dict, Any
from vllm import LLM, EngineArgs
from vllm.multimodal.utils import fetch_image


# Define a list of query texts
queries = [
    {"text": "A woman playing with her dog on a beach at sunset."},
    {"text": "Pet owner training dog outdoors near water."},
    {"text": "Woman surfing on waves during a sunny day."},
    {"text": "City skyline view from a high-rise building at night."}
]

# Define a list of document texts and images
documents = [
    {"text": "A woman shares a joyful moment with her golden retriever on a sun-drenched beach at sunset, as the dog offers its paw in a heartwarming display of companionship and trust."},
    {"image": "https://qianwen-res.oss-cn-beijing.aliyuncs.com/Qwen-VL/assets/demo.jpeg"},
    {"text": "A woman shares a joyful moment with her golden retriever on a sun-drenched beach at sunset, as the dog offers its paw in a heartwarming display of companionship and trust.", "image": "https://qianwen-res.oss-cn-beijing.aliyuncs.com/Qwen-VL/assets/demo.jpeg"}
]

def format_input_to_conversation(input_dict: Dict[str, Any], instruction: str = "Represent the user's input.") -> List[Dict]:
    content = []
    
    text = input_dict.get('text')
    image = input_dict.get('image')
    
    if image:
        image_content = None
        if isinstance(image, str):
            if image.startswith(('http', 'https', 'oss')):
                image_content = image
            else:
                abs_image_path = os.path.abspath(image)
                image_content = 'file://' + abs_image_path
        else:
            image_content = image
        
        if image_content:
            content.append({
                'type': 'image', 
                'image': image_content,
            })
    
    if text:
        content.append({'type': 'text', 'text': text})
    
    if not content:
        content.append({'type': 'text', 'text': ""})
    
    conversation = [
        {"role": "system", "content": [{"type": "text", "text": instruction}]},
        {"role": "user", "content": content}
    ]
    
    return conversation

def prepare_vllm_inputs(input_dict: Dict[str, Any], llm, instruction: str = "Represent the user's input.") -> Dict[str, Any]:
    text = input_dict.get('text')
    image = input_dict.get('image')
    
    conversation = format_input_to_conversation(input_dict, instruction)
    
    prompt_text = llm.llm_engine.tokenizer.apply_chat_template(
        conversation, 
        tokenize=False, 
        add_generation_prompt=True
    )
    
    multi_modal_data = None
    if image:
        if isinstance(image, str):
            if image.startswith(('http', 'https', 'oss')):
                try:
                    image_obj = fetch_image(image)
                    multi_modal_data = {"image": image_obj}
                except Exception as e:
                    print(f"Warning: Failed to fetch image {image}: {e}")
            else:
                abs_image_path = os.path.abspath(image)
                if os.path.exists(abs_image_path):
                    from PIL import Image
                    image_obj = Image.open(abs_image_path)
                    multi_modal_data = {"image": image_obj}
                else:
                    print(f"Warning: Image file not found: {abs_image_path}")
        else:
            multi_modal_data = {"image": image}
    
    result = {
        "prompt": prompt_text,
        "multi_modal_data": multi_modal_data
    }
    return result

def main():
    parser = argparse.ArgumentParser(description="Offline Similarity Check with vLLM")
    parser.add_argument("--model-path", type=str, default="models/Qwen3-VL-Embedding-8B", help="Path to the model")
    parser.add_argument("--dtype", type=str, default="bfloat16", help="Data type (e.g., bfloat16)")
    args = parser.parse_args()

    print(f"Loading model from {args.model_path}...")
    
    engine_args = EngineArgs(
        model=args.model_path,
        runner="pooling",
        dtype=args.dtype,
        trust_remote_code=True,
    )
    
    llm = LLM(**vars(engine_args))
    
    all_inputs = queries + documents
    vllm_inputs = [prepare_vllm_inputs(inp, llm) for inp in all_inputs]
    
    
    outputs = llm.embed(vllm_inputs)
    
    embeddings_list = []
    for i, output in enumerate(outputs):
        emb = output.outputs.embedding
        embeddings_list.append(emb)
        print(f"Input {i} embedding shape: {len(emb)}")
    
    embeddings = np.array(embeddings_list)
    print(f"\nEmbeddings shape: {embeddings.shape}")
    
    num_queries = len(queries)
    query_embeddings = embeddings[:num_queries]
    doc_embeddings = embeddings[num_queries:]
    
    similarity_scores = query_embeddings @ doc_embeddings.T
    
    print("\nSimilarity Scores:")
    print(similarity_scores.tolist())
    

if __name__ == "__main__":
    main()

SGLang Basic Usage Example

import argparse
import numpy as np
import torch
import os
from typing import List, Dict, Any
from sglang.srt.entrypoints.engine import Engine

# Define a list of query texts
queries = [
    {"text": "A woman playing with her dog on a beach at sunset."},
    {"text": "Pet owner training dog outdoors near water."},
    {"text": "Woman surfing on waves during a sunny day."},
    {"text": "City skyline view from a high-rise building at night."}
]

# Define a list of document texts and images
documents = [
    {"text": "A woman shares a joyful moment with her golden retriever on a sun-drenched beach at sunset, as the dog offers its paw in a heartwarming display of companionship and trust."},
    {"image": "https://qianwen-res.oss-cn-beijing.aliyuncs.com/Qwen-VL/assets/demo.jpeg"},
    {"text": "A woman shares a joyful moment with her golden retriever on a sun-drenched beach at sunset, as the dog offers its paw in a heartwarming display of companionship and trust.", "image": "https://qianwen-res.oss-cn-beijing.aliyuncs.com/Qwen-VL/assets/demo.jpeg"}
]

def format_input_to_conversation(input_dict: Dict[str, Any], instruction: str = "Represent the user's input.") -> List[Dict]:
    content = []
    
    text = input_dict.get('text')
    image = input_dict.get('image')

    if image:
        image_content = None
        if isinstance(image, str):
            if image.startswith(('http', 'oss')):
                image_content = image
            else:
                abs_image_path = os.path.abspath(image)
                image_content = 'file://' + abs_image_path
        else:
            image_content = image
        if image_content:
            content.append({
                'type': 'image', 'image': image_content,
            })

    if text:
        content.append({'type': 'text', 'text': text})

    if not content:
        content.append({'type': 'text', 'text': ""})

    conversation = [
        {"role": "system", "content": [{"type": "text", "text": instruction}]},
        {"role": "user", "content": content}
    ]

    return conversation

def convert_to_sglang_format(input_dict: Dict[str, Any], engine: Engine, instruction: str = "Represent the user's input.") -> Dict[str, Any]:
    conversation = format_input_to_conversation(input_dict, instruction)
    
    text_for_api = engine.tokenizer_manager.tokenizer.apply_chat_template(
        conversation, 
        tokenize=False, 
        add_generation_prompt=True
    )

    result = {"text": text_for_api}
    
    image = input_dict.get('image')
    if image and isinstance(image, str):
        result["image"] = image
        
        
    return result

def main():
    parser = argparse.ArgumentParser(description="Offline Similarity Check with SGLang")
    parser.add_argument("--model-path", type=str, default="models/Qwen3-VL-Embedding-8B", help="Path to the model")
    parser.add_argument("--dtype", type=str, default="bfloat16", help="Data type (e.g., bfloat16)")
    args = parser.parse_args()

    print(f"Loading model from {args.model_path}...")
    
    engine = Engine(
        model_path=args.model_path,
        is_embedding=True,
        dtype=args.dtype,
        trust_remote_code=True,
    )

    inputs = queries + documents
    sglang_inputs = [convert_to_sglang_format(inp, engine) for inp in inputs]
    print(sglang_inputs[:])
    print(f"sglang_inputs: {sglang_inputs}")
    print(f"Processing {len(sglang_inputs)} inputs...")

    prompts = [inp['text'] for inp in sglang_inputs]
    images = [inp.get('image') for inp in sglang_inputs]


    results = engine.encode(prompts, image_data=images)
    
    embeddings_list = []
    for res in results:
        embeddings_list.append(res['embedding'])
            
    embeddings = np.array(embeddings_list)
    print(f"Embeddings shape: {embeddings.shape}")

    num_queries = len(queries)
    query_embeddings = embeddings[:num_queries]
    doc_embeddings = embeddings[num_queries:]
    
    similarity_scores = (query_embeddings @ doc_embeddings.T)

    print("\nSimilarity Scores:")
    print(similarity_scores.tolist())

if __name__ == "__main__":
    main()

For more usage examples, please visit our GitHub repository.

Citation

If you find our work helpful, feel free to give us a cite.

@article{qwen3vlembedding,
  title={Qwen3-VL-Embedding and Qwen3-VL-Reranker: A Unified Framework for State-of-the-Art Multimodal Retrieval and Ranking},
  author={Li, Mingxin and Zhang, Yanzhao and Long, Dingkun and Chen Keqin and Song, Sibo and Bai, Shuai and Yang, Zhibo and Xie, Pengjun and Yang, An and Liu, Dayiheng and Zhou, Jingren and Lin, Junyang},
  journal={arXiv preprint arXiv:2601.04720},
  year={2026}
}

Как запустить

На своей GPU в ailist. Цена — по текущим предложениям провайдеров

GPU в ailist

Универсальный рантайм · sentence-transformers

Можно запустить

Подбираем GPU…

Класс архитектуры
Qwen3VLForConditionalGeneration
Ревизия весов
2c45655

0 моделей