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
Restore model card: Qwen3 listwise generative reranker fine-tune on Qdrant hard negatives
Browse files
README.md
CHANGED
|
@@ -1,19 +1,76 @@
|
|
| 1 |
---
|
| 2 |
license: apache-2.0
|
| 3 |
base_model: Qwen/Qwen3-Reranker-0.6B
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4 |
tags:
|
| 5 |
- reranker
|
| 6 |
- cross-encoder
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 7 |
- secAI
|
| 8 |
---
|
| 9 |
|
| 10 |
# sec-rerank
|
| 11 |
|
| 12 |
-
|
| 13 |
-
under the `secAI` project namespace, served as the reranker in the secAI retrieval pipeline
|
| 14 |
-
(via vLLM, pooling runner, sequence-classification mode). Weights are unmodified from the
|
| 15 |
-
base model.
|
| 16 |
|
| 17 |
-
|
| 18 |
|
| 19 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
---
|
| 2 |
license: apache-2.0
|
| 3 |
base_model: Qwen/Qwen3-Reranker-0.6B
|
| 4 |
+
base_model_relation: finetune
|
| 5 |
+
library_name: transformers
|
| 6 |
+
pipeline_tag: text-ranking
|
| 7 |
+
language:
|
| 8 |
+
- en
|
| 9 |
+
- vi
|
| 10 |
tags:
|
| 11 |
- reranker
|
| 12 |
- cross-encoder
|
| 13 |
+
- text-ranking
|
| 14 |
+
- listwise-reranking
|
| 15 |
+
- generative-reranker
|
| 16 |
+
- cve
|
| 17 |
+
- cybersecurity
|
| 18 |
+
- qdrant
|
| 19 |
- secAI
|
| 20 |
---
|
| 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",
|
| 69 |
+
"query": "CVE-2021-44228 JNDI lookup on log4j",
|
| 70 |
+
"documents": ["...", "..."]
|
| 71 |
+
}
|
| 72 |
+
```
|
| 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.
|