Qwen3-Embedding与Qwen3-Reranker模型解析:传统BERT<[bos_never_used_51bce0c785ca2f68081bfa7d91973934]>策略与新一代嵌入检索架构

Qwen3-Embedding - a Qwen Collection

Qwen3-Reranker - a Qwen Collection

Qwen3-Embedding-8B

传统BERT模型([CLS]策略):[CLS] 句子A [SEP] 句子B [SEP]
Qwen3模型([EOS]策略):[EOS] 标记的最终向量能够代表整句话的含义

  1. 词元嵌入(Token Embedding)
  2. 上下文感知(Contextualization)——Word2Vec/BERT/Qwen
  3. 句子嵌入(Sentence Embedding)

    Qwen3-Embedding-8B部署

    1、拉取官方镜像
    1
    docker pull vllm/vllm-openai:v0.9.2

2、Qwen3-Embedding-8B服务启动命令(首次大约150秒)

1
sudo docker run -itd --gpus 'device=3' --restart always --name qwen3-8b-embd -p 8006:8000 -v /data/models/Qwen3-Embedding-8B:/models vllm/vllm-openai:v0.9.2 --served-model-name qwen3-8b-embd --model /models --tensor-parallel-size 1  --trust-remote-code --task embed --max-model-len 8192 --api-key <YOUR_API_KEY>


3、启动日志

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
INFO 07-11 01:03:23 [__init__.py:244] Automatically detected platform cuda.
INFO 07-11 01:03:28 [api_server.py:1395] vLLM API server version 0.9.2
INFO 07-11 01:03:28 [cli_args.py:325] non-default args: {'api_key': '4f5be719ea054374882f9b506198e922', 'model': '/models', 'task': 'embed', 'trust_remote_code': True, 'max_model_len': 8192, 'served_model_name': ['qwen3-8b-embd']}
INFO 07-11 01:03:35 [config.py:516] Found sentence-transformers modules configuration.
INFO 07-11 01:03:35 [config.py:536] Found pooling configuration.
INFO 07-11 01:03:35 [config.py:1472] Using max model len 8192
INFO 07-11 01:03:35 [arg_utils.py:1596] (Enabling) chunked prefill by default
INFO 07-11 01:03:35 [arg_utils.py:1599] (Enabling) prefix caching by default
INFO 07-11 01:03:35 [config.py:2285] Chunked prefill is enabled with max_num_batched_tokens=2048.
INFO 07-11 01:03:41 [__init__.py:244] Automatically detected platform cuda.
INFO 07-11 01:03:43 [core.py:526] Waiting for init message from front-end.
INFO 07-11 01:03:43 [core.py:69] Initializing a V1 LLM engine (v0.9.2) with config: model='/models', speculative_config=None, tokenizer='/models', skip_tokenizer_init=False, tokenizer_mode=auto, revision=None, override_neuron_config={}, tokenizer_revision=None, trust_remote_code=True, dtype=torch.bfloat16, max_seq_len=8192, download_dir=None, load_format=LoadFormat.AUTO, tensor_parallel_size=1, pipeline_parallel_size=1, disable_custom_all_reduce=False, quantization=None, enforce_eager=False, kv_cache_dtype=auto, device_config=cuda, decoding_config=DecodingConfig(backend='auto', disable_fallback=False, disable_any_whitespace=False, disable_additional_properties=False, reasoning_backend=''), observability_config=ObservabilityConfig(show_hidden_metrics_for_version=None, otlp_traces_endpoint=None, collect_detailed_traces=None), seed=0, served_model_name=qwen3-8b-embd, num_scheduler_steps=1, multi_step_stream_outputs=True, enable_prefix_caching=True, chunked_prefill_enabled=True, use_async_output_proc=False, pooler_config=PoolerConfig(pooling_type='LAST', normalize=True, softmax=None, step_tag_id=None, returned_token_ids=None), compilation_config={"level":3,"debug_dump_path":"","cache_dir":"","backend":"","custom_ops":[],"splitting_ops":["vllm.unified_attention","vllm.unified_attention_with_output"],"use_inductor":true,"compile_sizes":[],"inductor_compile_config":{"enable_auto_functionalized_v2":false},"inductor_passes":{},"use_cudagraph":true,"cudagraph_num_of_warmups":1,"cudagraph_capture_sizes":[512,504,496,488,480,472,464,456,448,440,432,424,416,408,400,392,384,376,368,360,352,344,336,328,320,312,304,296,288,280,272,264,256,248,240,232,224,216,208,200,192,184,176,168,160,152,144,136,128,120,112,104,96,88,80,72,64,56,48,40,32,24,16,8,4,2,1],"cudagraph_copy_inputs":false,"full_cuda_graph":false,"max_capture_size":512,"local_cache_dir":null}
[W711 01:03:53.062773030 socket.cpp:200] [c10d] The hostname of the client socket cannot be retrieved. err=-3
[W711 01:04:02.123465433 socket.cpp:200] [c10d] The hostname of the client socket cannot be retrieved. err=-3
INFO 07-11 01:04:03 [parallel_state.py:1076] rank 0 in world size 1 is assigned as DP rank 0, PP rank 0, TP rank 0, EP rank 0
INFO 07-11 01:04:03 [topk_topp_sampler.py:49] Using FlashInfer for top-p & top-k sampling.
INFO 07-11 01:04:03 [gpu_model_runner.py:1770] Starting to load model /models...
INFO 07-11 01:04:03 [gpu_model_runner.py:1775] Loading model from scratch...
INFO 07-11 01:04:03 [cuda.py:284] Using Flash Attention backend on V1 engine.
Loading safetensors checkpoint shards: 100% 4/4 [00:02<00:00, 1.46it/s]
INFO 07-11 01:04:06 [default_loader.py:272] Loading weights took 2.75 seconds
INFO 07-11 01:04:06 [gpu_model_runner.py:1801] Model loading took 14.1062 GiB and 3.064098 seconds
INFO 07-11 01:04:15 [backends.py:508] Using cache directory: /root/.cache/vllm/torch_compile_cache/c35cfc3919/rank_0_0/backbone for vLLM's torch.compile
INFO 07-11 01:04:15 [backends.py:519] Dynamo bytecode transform time: 8.59 s
INFO 07-11 01:04:22 [backends.py:181] Cache the graph of shape None for later use
INFO 07-11 01:04:59 [backends.py:193] Compiling a graph for general shape takes 43.80 s
INFO 07-11 01:05:15 [monitor.py:34] torch.compile takes 52.38 s in total
INFO 07-11 01:05:16 [gpu_worker.py:232] Available KV cache memory: 56.77 GiB
INFO 07-11 01:05:16 [kv_cache_utils.py:716] GPU KV cache size: 413,408 tokens
INFO 07-11 01:05:16 [kv_cache_utils.py:720] Maximum concurrency for 8,192 tokens per request: 50.46x
Capturing CUDA graph shapes: 100% 67/67 [00:25<00:00, 2.65it/s]
INFO 07-11 01:05:42 [gpu_model_runner.py:2326] Graph capturing finished in 25 secs, took 0.62 GiB
INFO 07-11 01:05:42 [core.py:172] init engine (profile, create kv cache, warmup model) took 95.36 seconds
INFO 07-11 01:05:42 [loggers.py:137] Engine 000: vllm cache_config_info with initialization after num_gpu_blocks is: 25838
INFO 07-11 01:05:42 [api_server.py:1457] Starting vLLM API server 0 on http://0.0.0.0:8000
INFO 07-11 01:05:42 [launcher.py:29] Available routes are:
INFO 07-11 01:05:42 [launcher.py:37] Route: /openapi.json, Methods: GET, HEAD
INFO 07-11 01:05:42 [launcher.py:37] Route: /docs, Methods: GET, HEAD
INFO 07-11 01:05:42 [launcher.py:37] Route: /docs/oauth2-redirect, Methods: GET, HEAD
INFO 07-11 01:05:42 [launcher.py:37] Route: /redoc, Methods: GET, HEAD
INFO 07-11 01:05:42 [launcher.py:37] Route: /health, Methods: GET
INFO 07-11 01:05:42 [launcher.py:37] Route: /load, Methods: GET
INFO 07-11 01:05:42 [launcher.py:37] Route: /ping, Methods: POST
INFO 07-11 01:05:42 [launcher.py:37] Route: /ping, Methods: GET
INFO 07-11 01:05:42 [launcher.py:37] Route: /tokenize, Methods: POST
INFO 07-11 01:05:42 [launcher.py:37] Route: /detokenize, Methods: POST
INFO 07-11 01:05:42 [launcher.py:37] Route: /v1/models, Methods: GET
INFO 07-11 01:05:42 [launcher.py:37] Route: /version, Methods: GET
INFO 07-11 01:05:42 [launcher.py:37] Route: /v1/chat/completions, Methods: POST
INFO 07-11 01:05:42 [launcher.py:37] Route: /v1/completions, Methods: POST
INFO 07-11 01:05:42 [launcher.py:37] Route: /v1/embeddings, Methods: POST
INFO 07-11 01:05:42 [launcher.py:37] Route: /pooling, Methods: POST
INFO 07-11 01:05:42 [launcher.py:37] Route: /classify, Methods: POST
INFO 07-11 01:05:42 [launcher.py:37] Route: /score, Methods: POST
INFO 07-11 01:05:42 [launcher.py:37] Route: /v1/score, Methods: POST
INFO 07-11 01:05:42 [launcher.py:37] Route: /v1/audio/transcriptions, Methods: POST
INFO 07-11 01:05:42 [launcher.py:37] Route: /v1/audio/translations, Methods: POST
INFO 07-11 01:05:42 [launcher.py:37] Route: /rerank, Methods: POST
INFO 07-11 01:05:42 [launcher.py:37] Route: /v1/rerank, Methods: POST
INFO 07-11 01:05:42 [launcher.py:37] Route: /v2/rerank, Methods: POST
INFO 07-11 01:05:42 [launcher.py:37] Route: /invocations, Methods: POST
INFO 07-11 01:05:42 [launcher.py:37] Route: /metrics, Methods: GET
INFO: Started server process [1]
INFO: Waiting for application startup.
INFO: Application startup complete.


4、服务调用

1
2
3
4
5
6
7
8
9
10
curl --location 'http://10.39.214.102:8006/v1/embeddings' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer <YOUR_API_KEY>' \
--data '{
"model": "qwen3-8b-embd",
"input": [
"你好",
"你是谁"
]
}'


5、返回结果(8B为4096维的向量,0.6B为1024维的向量)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
{
"id": "embd-9fef32e2297c4d31a13f8d4a4d1d1fa3",
"object": "list",
"created": 1752221187,
"model": "qwen3-8b-embd",
"data": [
{
"index": 0,
"object": "embedding",
"embedding": []
},
{
"index": 1,
"object": "embedding",
"embedding": []
}
],
"usage": {
"prompt_tokens": 5,
"total_tokens": 5,
"completion_tokens": 0,
"prompt_tokens_details": null
}
}

Qwen3-Reranker

传统rerank拼接方式:[CLS]Query[SEP]Document
qwen3-reranker拼接方式:

1
2
3
4
5
6
7
8
<|im_start|>system
Judge whether the Document meets the requirements based on the Query and the
Instruct provided. Note that the answer can only be "yes" or "no".<|im_end|>
<|im_start|>user
<Instruct>: {用户自定义的指令}
<Query>: {用户的查询}
<Document>: {候选文档}<|im_end|>
<|im_start|>assistant

具体做法是:模型的主要任务是预测 assistant 后最可能出现的词元,即”yes”或”no”,并计算它们各自的概率。最终的相关性分数通过如下公式归一化得到:
score = P(“yes”) / (P(“yes”) + P(“no”))

Qwen3-Reranker-8B部署

1、拉取官方镜像

1
docker pull vllm/vllm-openai:v0.9.2

2、Qwen3-Reranker-8B服务启动命令

1
sudo docker run -itd --gpus 'device=3' --restart always --name qwen3-reranker-8b -p 8007:8000 -v /data/models/Qwen3-Reranker-8B:/models --name qwen3-reranker-8b  vllm/vllm-openai:v0.9.2 --task score --model /models --served-model-name qwen3-reranker-8b --tensor-parallel-size 1  --trust-remote-code --max-model-len 8192 --api-key <YOUR_API_KEY>
1
python3 -m vllm.entrypoints.openai.api_server --host 0.0.0.0 --port 8080 --max-model-len 8192 --tensor-parallel-size 1 --served-model-name qwen3-reranker-8b --model /data/modelRepository/reranker/reranker_qwen3-8b --trust-remote-code --api-key <YOUR_API_KEY> --task score


3、启动日志

text
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
INFO 07-11 01:14:23 [__init__.py:244] Automatically detected platform cuda.
INFO 07-11 01:14:27 [api_server.py:1395] vLLM API server version 0.9.2
INFO 07-11 01:14:27 [cli_args.py:325] non-default args: {'api_key': 'cc78f1ca0ec04b1a9512c80b124f3b5a', 'model': '/models', 'task': 'score', 'trust_remote_code': True, 'max_model_len': 8192, 'served_model_name': ['qwen3-8b-reanker']}
INFO 07-11 01:14:33 [config.py:1472] Using max model len 8192
INFO 07-11 01:14:33 [arg_utils.py:1596] (Disabling) chunked prefill by default
INFO 07-11 01:14:33 [arg_utils.py:1599] (Disabling) prefix caching by default
INFO 07-11 01:14:33 [config.py:4601] Only "last" pooling supports chunked prefill and prefix caching; disabling both.
INFO 07-11 01:14:38 [__init__.py:244] Automatically detected platform cuda.
INFO 07-11 01:14:40 [core.py:526] Waiting for init message from front-end.
INFO 07-11 01:14:40 [core.py:69] Initializing a V1 LLM engine (v0.9.2) with config: model='/models', speculative_config=None, tokenizer='/models', skip_tokenizer_init=False, tokenizer_mode=auto, revision=None, override_neuron_config={}, tokenizer_revision=None, trust_remote_code=True, dtype=torch.bfloat16, max_seq_len=8192, download_dir=None, load_format=LoadFormat.AUTO, tensor_parallel_size=1, pipeline_parallel_size=1, disable_custom_all_reduce=False, quantization=None, enforce_eager=False, kv_cache_dtype=auto, device_config=cuda, decoding_config=DecodingConfig(backend='auto', disable_fallback=False, disable_any_whitespace=False, disable_additional_properties=False, reasoning_backend=''), observability_config=ObservabilityConfig(show_hidden_metrics_for_version=None, otlp_traces_endpoint=None, collect_detailed_traces=None), seed=0, served_model_name=qwen3-8b-reanker, num_scheduler_steps=1, multi_step_stream_outputs=True, enable_prefix_caching=False, chunked_prefill_enabled=False, use_async_output_proc=False, pooler_config=PoolerConfig(pooling_type=None, normalize=None, softmax=None, step_tag_id=None, returned_token_ids=None), compilation_config={"level":3,"debug_dump_path":"","cache_dir":"","backend":"","custom_ops":[],"splitting_ops":["vllm.unified_attention","vllm.unified_attention_with_output"],"use_inductor":true,"compile_sizes":[],"inductor_compile_config":{"enable_auto_functionalized_v2":false},"inductor_passes":{},"use_cudagraph":true,"cudagraph_num_of_warmups":1,"cudagraph_capture_sizes":[512,504,496,488,480,472,464,456,448,440,432,424,416,408,400,392,384,376,368,360,352,344,336,328,320,312,304,296,288,280,272,264,256,248,240,232,224,216,208,200,192,184,176,168,160,152,144,136,128,120,112,104,96,88,80,72,64,56,48,40,32,24,16,8,4,2,1],"cudagraph_copy_inputs":false,"full_cuda_graph":false,"max_capture_size":512,"local_cache_dir":null}
[W711 01:14:51.281911158 socket.cpp:200] [c10d] The hostname of the client socket cannot be retrieved. err=-3
[W711 01:14:52.990551410 socket.cpp:200] [c10d] The hostname of the client socket cannot be retrieved. err=-3
INFO 07-11 01:14:52 [parallel_state.py:1076] rank 0 in world size 1 is assigned as DP rank 0, PP rank 0, TP rank 0, EP rank 0
INFO 07-11 01:14:52 [topk_topp_sampler.py:49] Using FlashInfer for top-p & top-k sampling.
INFO 07-11 01:14:52 [gpu_model_runner.py:1770] Starting to load model /models...
INFO 07-11 01:14:53 [gpu_model_runner.py:1775] Loading model from scratch...
INFO 07-11 01:14:53 [cuda.py:284] Using Flash Attention backend on V1 engine.
Loading safetensors checkpoint shards: 100% 5/5 [00:02<00:00, 1.85it/s]
INFO 07-11 01:14:56 [default_loader.py:272] Loading weights took 2.77 seconds
INFO 07-11 01:14:56 [gpu_model_runner.py:1801] Model loading took 14.1062 GiB and 3.095366 seconds
INFO 07-11 01:15:05 [backends.py:508] Using cache directory: /root/.cache/vllm/torch_compile_cache/0b084e5eb2/rank_0_0/backbone for vLLM's torch.compile
INFO 07-11 01:15:05 [backends.py:519] Dynamo bytecode transform time: 8.62 s
INFO 07-11 01:15:12 [backends.py:181] Cache the graph of shape None for later use
INFO 07-11 01:15:49 [backends.py:193] Compiling a graph for general shape takes 43.54 s
INFO 07-11 01:16:09 [monitor.py:34] torch.compile takes 52.16 s in total
INFO 07-11 01:16:10 [gpu_worker.py:232] Available KV cache memory: 56.17 GiB
INFO 07-11 01:16:10 [kv_cache_utils.py:716] GPU KV cache size: 408,976 tokens
INFO 07-11 01:16:10 [kv_cache_utils.py:720] Maximum concurrency for 8,192 tokens per request: 49.92x
Capturing CUDA graph shapes: 100% 67/67 [00:23<00:00, 2.85it/s]
INFO 07-11 01:16:33 [gpu_model_runner.py:2326] Graph capturing finished in 24 secs, took 0.62 GiB
INFO 07-11 01:16:33 [core.py:172] init engine (profile, create kv cache, warmup model) took 97.37 seconds
INFO 07-11 01:16:34 [config.py:4601] Only "last" pooling supports chunked prefill and prefix caching; disabling both.
INFO 07-11 01:16:34 [loggers.py:137] Engine 000: vllm cache_config_info with initialization after num_gpu_blocks is: 25561
INFO 07-11 01:16:34 [api_server.py:1457] Starting vLLM API server 0 on http://0.0.0.0:8000
INFO 07-11 01:16:34 [launcher.py:29] Available routes are:
INFO 07-11 01:16:34 [launcher.py:37] Route: /openapi.json, Methods: GET, HEAD
INFO 07-11 01:16:34 [launcher.py:37] Route: /docs, Methods: GET, HEAD
INFO 07-11 01:16:34 [launcher.py:37] Route: /docs/oauth2-redirect, Methods: GET, HEAD
INFO 07-11 01:16:34 [launcher.py:37] Route: /redoc, Methods: GET, HEAD
INFO 07-11 01:16:34 [launcher.py:37] Route: /health, Methods: GET
INFO 07-11 01:16:34 [launcher.py:37] Route: /load, Methods: GET
INFO 07-11 01:16:34 [launcher.py:37] Route: /ping, Methods: POST
INFO 07-11 01:16:34 [launcher.py:37] Route: /ping, Methods: GET
INFO 07-11 01:16:34 [launcher.py:37] Route: /tokenize, Methods: POST
INFO 07-11 01:16:34 [launcher.py:37] Route: /detokenize, Methods: POST
INFO 07-11 01:16:34 [launcher.py:37] Route: /v1/models, Methods: GET
INFO 07-11 01:16:34 [launcher.py:37] Route: /version, Methods: GET
INFO 07-11 01:16:34 [launcher.py:37] Route: /v1/chat/completions, Methods: POST
INFO 07-11 01:16:34 [launcher.py:37] Route: /v1/completions, Methods: POST
INFO 07-11 01:16:34 [launcher.py:37] Route: /v1/embeddings, Methods: POST
INFO 07-11 01:16:34 [launcher.py:37] Route: /pooling, Methods: POST
INFO 07-11 01:16:34 [launcher.py:37] Route: /classify, Methods: POST
INFO 07-11 01:16:34 [launcher.py:37] Route: /score, Methods: POST
INFO 07-11 01:16:34 [launcher.py:37] Route: /v1/score, Methods: POST
INFO 07-11 01:16:34 [launcher.py:37] Route: /v1/audio/transcriptions, Methods: POST
INFO 07-11 01:16:34 [launcher.py:37] Route: /v1/audio/translations, Methods: POST
INFO 07-11 01:16:34 [launcher.py:37] Route: /rerank, Methods: POST
INFO 07-11 01:16:34 [launcher.py:37] Route: /v1/rerank, Methods: POST
INFO 07-11 01:16:34 [launcher.py:37] Route: /v2/rerank, Methods: POST
INFO 07-11 01:16:34 [launcher.py:37] Route: /invocations, Methods: POST
INFO 07-11 01:16:34 [launcher.py:37] Route: /metrics, Methods: GET
INFO: Started server process [1]
INFO: Waiting for application startup.
INFO: Application startup complete


4、服务调用

1
2
3
4
5
6
7
8
9
10
11
12
13
curl --location 'http://10.39.214.102:8007/v1/rerank' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer <YOUR_API_KEY>' \
--data '{
"query": "用户赞扬客服",
"documents": [
"客户表扬",
"客户漫骂",
"客户一直漫骂",
"客户骂人",
"客户举报"
]
}'


5、返回结果

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
{
"id": "rerank-7e362bad742b4ff6ae394235ecf0b580",
"model": "qwen3-8b-reanker",
"usage": {
"total_tokens": 34
},
"results": [
{
"index": 0,
"document": {
"text": "客户表扬"
},
"relevance_score": 0.90227872133255
},
{
"index": 4,
"document": {
"text": "客户举报"
},
"relevance_score": 0.8827481269836426
},
{
"index": 1,
"document": {
"text": "客户漫骂"
},
"relevance_score": 0.8798506855964661
},
{
"index": 2,
"document": {
"text": "客户一直漫骂"
},
"relevance_score": 0.8711763620376587
},
{
"index": 3,
"document": {
"text": "客户骂人"
},
"relevance_score": 0.828831136226654
}
]
}

Qwen3-Reranker-0.6B部署

1、拉取官方镜像

1
docker pull vllm/vllm-openai:v0.9.2

2、Qwen3-Reranker-0.6B服务启动命令

1
sudo docker run -itd --gpus 'device=1' --restart always --name qwen3-reranker-0.6b -p 30001:8000 -v /data/models/Qwen3-Reranker-0.6B:/models --name qwen3-reranker-0.6b  vllm/vllm-openai:v0.9.2 --task score --model /models --served-model-name qwen3-reranker-0.6b --tensor-parallel-size 1  --gpu-memory-utilization 0.1 --trust-remote-code --max-model-len 8192 --api-key <YOUR_API_KEY>

3、启动日志

4、服务调用

1
2
3
4
5
6
7
8
9
10
11
12
13
curl --location 'http://10.39.214.102:30001/v1/rerank' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer <YOUR_API_KEY>' \
--data '{
"query": "用户赞扬客服",
"documents": [
"客户表扬",
"客户漫骂",
"客户一直漫骂",
"客户骂人",
"客户举报"
]
}'

Qwen3-Reranker-0.6B接口文档

  1. 请求地址:http://10.39.214.102:30001/v1/rerank
  2. 调用方式:HTTP post
  3. 接口描述:重排序接口,计算query和documents的相似度
  4. 请求参数:
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    {
    "query": "用户赞扬客服",
    "documents": [
    "客户表扬",
    "客户漫骂",
    "客户一直漫骂",
    "客户骂人",
    "客户举报"
    ]
    }
  • 参数说明:
    • query:用户查询
    • documents:待查询匹配的文档
  1. 返回参数:
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    {
    "id": "rerank-c5a62003353d4db8afb9e48cc694128b",
    "model": "qwen3-0.6b-reanker",
    "usage": {
    "total_tokens": 34
    },
    "results": [
    {
    "index": 0,
    "document": {
    "text": "客户表扬"
    },
    "relevance_score": 0.798099935054779
    },
    {
    "index": 4,
    "document": {
    "text": "客户举报"
    },
    "relevance_score": 0.7582945227622986
    },
    {
    "index": 1,
    "document": {
    "text": "客户漫骂"
    },
    "relevance_score": 0.711263120174408
    },
    {
    "index": 2,
    "document": {
    "text": "客户一直漫骂"
    },
    "relevance_score": 0.6950579881668091
    },
    {
    "index": 3,
    "document": {
    "text": "客户骂人"
    },
    "relevance_score": 0.6752427816390991
    }
    ]
    }
  • 参数说明:
    • id:模型请求id
    • model:模型名称
    • usage:总token数目
    • results:返回结果
      • index:文档索引
      • document:文档内容
      • relevance_score:相似度分数(从高往低排序)
本文结束 感谢您的阅读