DuyTa commited on
Commit
c06bbac
·
verified ·
1 Parent(s): cf764ed

Model card: fine-tuned Qwen3 listwise generative reranker (Qdrant CVE hard negatives)

Browse files
Files changed (1) hide show
  1. README.md +14 -13
README.md CHANGED
@@ -7,6 +7,7 @@ pipeline_tag: text-ranking
7
  language:
8
  - en
9
  - vi
 
10
  tags:
11
  - reranker
12
  - cross-encoder
@@ -21,48 +22,48 @@ tags:
21
 
22
  # sec-rerank
23
 
24
- Domain-adapted **listwise generative reranker** for CVE / cybersecurity search. Fine-tuned from [Qwen/Qwen3-Reranker-0.6B](https://huggingface.co/Qwen/Qwen3-Reranker-0.6B) (Apache-2.0) on grouped query–document examples whose **hard negatives were mined from a local Qdrant** collection (`cve_kb`).
25
 
26
- This is a **second-stage ranker**, not an embedding model. It does not produce dense vectors. It reorders first-stage retrieval candidates (e.g. from [`DuyTa/sec-embedding`](https://huggingface.co/DuyTa/sec-embedding)) by scoring each `(query, document)` pair with the native Qwen3-Reranker generative head.
27
 
28
  ## Training
29
 
30
- Recipe follows the secAI Colab trainer (`notebooks/Qwen3_Reranker_Colab.ipynb`):
31
 
32
  | | |
33
  |---|---|
34
  | Base | `Qwen/Qwen3-Reranker-0.6B` |
35
- | Task | SWIFT `generative_reranker` (causal-LM reranker, not a bi-encoder) |
36
  | Loss | **listwise reranking** (`--loss_type listwise_reranker`) |
37
  | Tuner | full-parameter SFT (`--tuner_type full`) |
38
  | Engine | [ms-swift](https://github.com/modelscope/ms-swift) `swift sft` |
39
  | Max length | 2048 |
40
  | Learning rate | 6e-6 |
41
 
42
- Project `(query, positive, negative)` rows are converted to SWIFT's **grouped ranking** schema before training:
43
 
44
  - `messages` — system instruction + user query
45
  - `positive_messages` — gold CVE passage
46
- - `negative_messages` — hard-negative CVE passage(s)
47
 
48
- Instruction used at train time:
49
 
50
  > Given a Vietnamese cybersecurity search query, retrieve passages from the CVE knowledge base that directly answer it.
51
 
52
- SWIFT fills the native Qwen3-Reranker `{Instruction}` slot from that system message. Do not inject `<|im_start|>` or `<think>` into the JSONL.
53
 
54
  ### Hard-negative mining
55
 
56
- Positives and negatives are real CVE core-chunk text from the local Qdrant `cve_kb` (NVD/MITRE). For each query, the negative is a **near-miss CVE** from the same collection — typically a different CWE (`hard_negative_type: different_cwe`) so lexical overlap is high but the relevant document is wrong. That is the listwise signal: rank the gold passage above mined hard negatives for the same query.
57
 
58
- Full split is 33.6k train / 4.2k validation grouped examples.
59
 
60
  ## Inference
61
 
62
- Keep the Qwen3-Reranker prompt format. The model scores a candidate by the generative yes/no head; higher score = more relevant. Use it only to **rerank** a short candidate list from dense / hybrid retrieval, not as a first-stage embedder.
63
 
64
  ```python
65
- # vLLM / OpenAI-compatible rerank endpoint (secAI serving stack)
66
  # POST /v1/rerank
67
  {
68
  "model": "DuyTa/sec-rerank",
@@ -73,4 +74,4 @@ Keep the Qwen3-Reranker prompt format. The model scores a candidate by the gener
73
 
74
  ## Attribution & license
75
 
76
- Weights derive from [Qwen/Qwen3-Reranker-0.6B](https://huggingface.co/Qwen/Qwen3-Reranker-0.6B), released under **Apache-2.0**. All credit for the base reranker belongs to the Qwen team. This card and the Qdrant listwise fine-tune are part of the secAI retrieval stack.
 
7
  language:
8
  - en
9
  - vi
10
+ pretty_name: sec-rerank (fine-tuned Qwen3-Reranker)
11
  tags:
12
  - reranker
13
  - cross-encoder
 
22
 
23
  # sec-rerank
24
 
25
+ **This is a fine-tuned version of [Qwen/Qwen3-Reranker-0.6B](https://huggingface.co/Qwen/Qwen3-Reranker-0.6B)** a **listwise generative reranker** (second-stage ranker), not an embedding model.
26
 
27
+ It was trained on grouped query–document examples whose **hard negatives were mined from a local Qdrant** collection (`cve_kb`) built from CVE investigation trajectories. It does not emit dense vectors; it reorders first-stage candidates (e.g. from [`DuyTa/sec-embedding`](https://huggingface.co/DuyTa/sec-embedding)).
28
 
29
  ## Training
30
 
31
+ From `notebooks/Qwen3_Reranker_Colab.ipynb` (ms-swift):
32
 
33
  | | |
34
  |---|---|
35
  | Base | `Qwen/Qwen3-Reranker-0.6B` |
36
+ | Task | `generative_reranker` (causal-LM reranker / cross-encoder scoring) |
37
  | Loss | **listwise reranking** (`--loss_type listwise_reranker`) |
38
  | Tuner | full-parameter SFT (`--tuner_type full`) |
39
  | Engine | [ms-swift](https://github.com/modelscope/ms-swift) `swift sft` |
40
  | Max length | 2048 |
41
  | Learning rate | 6e-6 |
42
 
43
+ `(query, positive, negative)` rows are converted to SWIFT **grouped ranking** schema:
44
 
45
  - `messages` — system instruction + user query
46
  - `positive_messages` — gold CVE passage
47
+ - `negative_messages` — Qdrant-mined hard-negative CVE passage(s)
48
 
49
+ Train-time instruction:
50
 
51
  > Given a Vietnamese cybersecurity search query, retrieve passages from the CVE knowledge base that directly answer it.
52
 
53
+ SWIFT fills the native Qwen3-Reranker `{Instruction}` slot from that system message.
54
 
55
  ### Hard-negative mining
56
 
57
+ Positives and negatives are real CVE core-chunk text from local Qdrant `cve_kb` (NVD/MITRE). The negative is a **near-miss CVE** from the same collection — typically a different CWE (`hard_negative_type: different_cwe`): high lexical overlap, wrong document. The listwise objective ranks the gold passage above those mined hard negatives.
58
 
59
+ Split: 33.6k train / 4.2k validation grouped examples.
60
 
61
  ## Inference
62
 
63
+ Score each `(query, document)` with the native Qwen3-Reranker generative yes/no head. Use only to **rerank** a short candidate list from dense / hybrid retrieval.
64
 
65
  ```python
66
+ # vLLM / OpenAI-compatible rerank endpoint
67
  # POST /v1/rerank
68
  {
69
  "model": "DuyTa/sec-rerank",
 
74
 
75
  ## Attribution & license
76
 
77
+ Derived from [Qwen/Qwen3-Reranker-0.6B](https://huggingface.co/Qwen/Qwen3-Reranker-0.6B) (**Apache-2.0**). Credit for the base reranker belongs to the Qwen team.