DuyTa commited on
Commit
47dd2d0
·
verified ·
1 Parent(s): 0ae4e58

Model card: fine-tuned BGE-M3 dense retriever (Qdrant CVE hard-negative trajectories)

Browse files
Files changed (1) hide show
  1. README.md +15 -14
README.md CHANGED
@@ -7,6 +7,7 @@ pipeline_tag: feature-extraction
7
  language:
8
  - en
9
  - vi
 
10
  tags:
11
  - sentence-transformers
12
  - feature-extraction
@@ -21,36 +22,34 @@ tags:
21
 
22
  # sec-embedding
23
 
24
- Domain-adapted **dense retriever** for CVE / cybersecurity search. Fine-tuned from [BAAI/bge-m3](https://huggingface.co/BAAI/bge-m3) (MIT) on a CVE investigation-trajectory dataset with **hard-negative mining** against a local Qdrant collection (`cve_kb`, NVD/MITRE core chunks).
25
 
26
- This is **not** a verbatim re-host of the base checkpoint. It is a contrastive LoRA fine-tune of bge-m3 for first-stage retrieval over the secAI CVE knowledge base.
27
 
28
  ## Training
29
 
30
- Recipe follows the secAI Colab trainer (`notebooks/BGE_M3_Colab.ipynb`):
31
 
32
  | | |
33
  |---|---|
34
  | Base | `BAAI/bge-m3` via Unsloth `FastSentenceTransformer` (`unsloth/bge-m3`) |
35
- | Architecture | Bi-encoder / dense embedding model (1024-d, same as bge-m3) |
36
- | Adapter | LoRA, `r=32`, target modules `key`, `query`, `value`, `dense` |
37
- | Loss | `CachedMultipleNegativesRankingLoss` (InfoNCE with in-batch negatives) |
38
  | Engine | `sentence-transformers` `SentenceTransformerTrainer` |
39
  | Max sequence length | 1024 |
40
  | Learning rate | 2e-5, bf16 |
41
 
42
- Each training example is a `(query, positive)` pair:
43
 
44
- - **Query** — a CVE investigation trajectory (Vietnamese or English): follow-up questions over CVE-ID, CWE, product, severity, year, CAPEC / ATT&CK, drawn from real KB metadata.
45
- - **Positive** — the matching CVE passage scrolled from the local Qdrant `cve_kb` collection.
46
- - **Hard negatives** — other CVE documents in the same mini-batch, all mined from that Qdrant index. In a homogeneous CVE corpus those in-batch negatives are near-misses (similar wording, wrong CVE), which is what Cached MNRL is trained to push apart.
47
 
48
- Source field on the dataset: `Qdrant cve_kb (NVD/MITRE)`. Full split is 40k train / 5k validation query–passage pairs.
49
 
50
  ## Usage
51
 
52
- Drop-in replacement for bge-m3 in sentence-transformers. Rebuild the Qdrant index with **this** checkpoint; mixing it with vanilla bge-m3 vectors collapses recall.
53
-
54
  ```python
55
  from sentence_transformers import SentenceTransformer
56
 
@@ -59,6 +58,8 @@ query_emb = model.encode("CVE-2021-44228 impact on log4j", normalize_embeddings=
59
  doc_emb = model.encode(passage, normalize_embeddings=True)
60
  ```
61
 
 
 
62
  ## Attribution & license
63
 
64
- Weights derive from [BAAI/bge-m3](https://huggingface.co/BAAI/bge-m3), released under the **MIT License**. All credit for the base model belongs to the BAAI authors. This card and the CVE/Qdrant fine-tune are part of the secAI retrieval stack.
 
7
  language:
8
  - en
9
  - vi
10
+ pretty_name: sec-embedding (fine-tuned BGE-M3)
11
  tags:
12
  - sentence-transformers
13
  - feature-extraction
 
22
 
23
  # sec-embedding
24
 
25
+ **This is a fine-tuned version of [BAAI/bge-m3](https://huggingface.co/BAAI/bge-m3)** for CVE / cybersecurity dense retrieval.
26
 
27
+ It was trained on a **CVE investigation-trajectory dataset** with **hard-negative mining** from a **local Qdrant** collection (`cve_kb`, NVD/MITRE core chunks). It is not a raw copy of the base checkpoint.
28
 
29
  ## Training
30
 
31
+ From `notebooks/BGE_M3_Colab.ipynb`:
32
 
33
  | | |
34
  |---|---|
35
  | Base | `BAAI/bge-m3` via Unsloth `FastSentenceTransformer` (`unsloth/bge-m3`) |
36
+ | Role | Bi-encoder / **dense retriever** (1024-d, same geometry as bge-m3) |
37
+ | Adapter | LoRA, `r=32`, modules `key`, `query`, `value`, `dense` |
38
+ | Loss | `CachedMultipleNegativesRankingLoss` (InfoNCE, in-batch hard negatives) |
39
  | Engine | `sentence-transformers` `SentenceTransformerTrainer` |
40
  | Max sequence length | 1024 |
41
  | Learning rate | 2e-5, bf16 |
42
 
43
+ Each example is a `(query, positive)` pair:
44
 
45
+ - **Query** — CVE investigation trajectory (Vietnamese or English) over CVE-ID, CWE, product, severity, year, CAPEC / ATT&CK, filled from real KB metadata.
46
+ - **Positive** — matching CVE passage from local Qdrant `cve_kb`.
47
+ - **Hard negatives** — other CVE documents in the same mini-batch, all mined from that Qdrant index (near-miss CVEs: similar wording, wrong ID).
48
 
49
+ Dataset source field: `Qdrant cve_kb (NVD/MITRE)`. Split: 40k train / 5k validation.
50
 
51
  ## Usage
52
 
 
 
53
  ```python
54
  from sentence_transformers import SentenceTransformer
55
 
 
58
  doc_emb = model.encode(passage, normalize_embeddings=True)
59
  ```
60
 
61
+ Rebuild the Qdrant index with **this** checkpoint. Mixing vectors with vanilla `BAAI/bge-m3` drops recall.
62
+
63
  ## Attribution & license
64
 
65
+ Derived from [BAAI/bge-m3](https://huggingface.co/BAAI/bge-m3) (**MIT License**). Credit for the base model belongs to the BAAI authors.