Text Ranking
Transformers
Safetensors
English
Vietnamese
qwen3
text-generation
reranker
cross-encoder
listwise-reranking
generative-reranker
cve
cybersecurity
qdrant
secAI
Instructions to use DuyTa/sec-rerank with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use DuyTa/sec-rerank with Transformers:
# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("DuyTa/sec-rerank") model = AutoModelForCausalLM.from_pretrained("DuyTa/sec-rerank", device_map="auto") - Notebooks
- Google Colab
- Kaggle
Model card: fine-tuned Qwen3 listwise generative reranker (Qdrant CVE hard negatives)
Browse files
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 |
-
|
| 25 |
|
| 26 |
-
|
| 27 |
|
| 28 |
## Training
|
| 29 |
|
| 30 |
-
|
| 31 |
|
| 32 |
| | |
|
| 33 |
|---|---|
|
| 34 |
| Base | `Qwen/Qwen3-Reranker-0.6B` |
|
| 35 |
-
| Task |
|
| 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 |
-
|
| 43 |
|
| 44 |
- `messages` — system instruction + user query
|
| 45 |
- `positive_messages` — gold CVE passage
|
| 46 |
-
- `negative_messages` — hard-negative CVE passage(s)
|
| 47 |
|
| 48 |
-
|
| 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.
|
| 53 |
|
| 54 |
### Hard-negative mining
|
| 55 |
|
| 56 |
-
Positives and negatives are real CVE core-chunk text from
|
| 57 |
|
| 58 |
-
|
| 59 |
|
| 60 |
## Inference
|
| 61 |
|
| 62 |
-
|
| 63 |
|
| 64 |
```python
|
| 65 |
-
# vLLM / OpenAI-compatible rerank endpoint
|
| 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 |
-
|
|
|
|
| 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.
|