Sentence Similarity
sentence-transformers
Safetensors
English
bert
feature-extraction
information-retrieval
job-matching
resume
recruitment
Eval Results (legacy)
text-embeddings-inference
Instructions to use KhajaHugging/bge-small-vectormatch with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- sentence-transformers
How to use KhajaHugging/bge-small-vectormatch with sentence-transformers:
from sentence_transformers import SentenceTransformer model = SentenceTransformer("KhajaHugging/bge-small-vectormatch") sentences = [ "That is a happy person", "That is a happy dog", "That is a very happy person", "Today is a sunny day" ] embeddings = model.encode(sentences) similarities = model.similarity(embeddings, embeddings) print(similarities.shape) # [4, 4] - Notebooks
- Google Colab
- Kaggle
Fine-tuned bge-small for CV→job retrieval (VectorMatch v1.1.0)
Browse files- 1_Pooling/config.json +5 -0
- 2_Normalize/config.json +4 -0
- README.md +77 -0
- config.json +35 -0
- config_sentence_transformers.json +14 -0
- model.safetensors +3 -0
- modules.json +20 -0
- sentence_bert_config.json +10 -0
- tokenizer.json +0 -0
- tokenizer_config.json +18 -0
- training_info.json +45 -0
1_Pooling/config.json
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"embedding_dimension": 384,
|
| 3 |
+
"pooling_mode": "cls",
|
| 4 |
+
"include_prompt": true
|
| 5 |
+
}
|
2_Normalize/config.json
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"module_input_name": "sentence_embedding",
|
| 3 |
+
"module_output_name": "sentence_embedding"
|
| 4 |
+
}
|
README.md
ADDED
|
@@ -0,0 +1,77 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: mit
|
| 3 |
+
language: en
|
| 4 |
+
library_name: sentence-transformers
|
| 5 |
+
pipeline_tag: sentence-similarity
|
| 6 |
+
base_model: BAAI/bge-small-en-v1.5
|
| 7 |
+
tags:
|
| 8 |
+
- sentence-transformers
|
| 9 |
+
- feature-extraction
|
| 10 |
+
- sentence-similarity
|
| 11 |
+
- information-retrieval
|
| 12 |
+
- job-matching
|
| 13 |
+
- resume
|
| 14 |
+
- recruitment
|
| 15 |
+
datasets:
|
| 16 |
+
- lang-uk/recruitment-dataset-job-descriptions-english
|
| 17 |
+
- lang-uk/recruitment-dataset-candidate-profiles-english
|
| 18 |
+
model-index:
|
| 19 |
+
- name: bge-small-vectormatch
|
| 20 |
+
results:
|
| 21 |
+
- task: {type: retrieval, name: CV → job retrieval}
|
| 22 |
+
dataset: {type: lang-uk/recruitment-dataset-job-descriptions-english, name: "Djinni jobs (25K corpus, 500 held-out CVs)"}
|
| 23 |
+
metrics:
|
| 24 |
+
- {type: precision_at_10, value: 0.664, name: "P@10 (dense only)"}
|
| 25 |
+
- {type: ndcg_at_10, value: 0.661, name: "nDCG@10 (dense only)"}
|
| 26 |
+
- {type: mrr, value: 0.740, name: "MRR (dense only)"}
|
| 27 |
+
---
|
| 28 |
+
|
| 29 |
+
# bge-small-vectormatch
|
| 30 |
+
|
| 31 |
+
**[BAAI/bge-small-en-v1.5](https://huggingface.co/BAAI/bge-small-en-v1.5) fine-tuned to match resumes (CVs) to job posts.**
|
| 32 |
+
Part of [VectorMatch](https://github.com/KhajaRaheelAhmedMohiuddin/vectormatch), a hybrid semantic job-matching engine benchmarked across six vector databases.
|
| 33 |
+
|
| 34 |
+
## Results (held-out test set)
|
| 35 |
+
|
| 36 |
+
25K real job posts; 500 real CVs never seen in training or model selection. A job is relevant if its role category matches the CV's (labels from the dataset, not from an LLM).
|
| 37 |
+
|
| 38 |
+
| Model | Retrieval | P@10 | nDCG@10 | MRR | Hit@1 |
|
| 39 |
+
|---|---|---:|---:|---:|---:|
|
| 40 |
+
| BM25 | keyword | 0.436 | 0.439 | 0.575 | 0.444 |
|
| 41 |
+
| bge-small-en-v1.5 (base) | dense | 0.566 | 0.570 | 0.695 | 0.598 |
|
| 42 |
+
| **bge-small-vectormatch** | **dense** | **0.664** | **0.661** | **0.740** | **0.642** |
|
| 43 |
+
| bge-small-vectormatch | hybrid (+ BM25, weighted RRF) | 0.667 | 0.667 | 0.755 | 0.666 |
|
| 44 |
+
|
| 45 |
+
**+17% P@10 over the base model** with the same size, latency and 384-d vectors, so it is a drop-in replacement in any vector database.
|
| 46 |
+
|
| 47 |
+
## Usage
|
| 48 |
+
|
| 49 |
+
```python
|
| 50 |
+
from sentence_transformers import SentenceTransformer
|
| 51 |
+
|
| 52 |
+
model = SentenceTransformer("KhajaHugging/bge-small-vectormatch")
|
| 53 |
+
query = "Represent this sentence for searching relevant passages: " + cv_text # same instruction as bge
|
| 54 |
+
q = model.encode(query, normalize_embeddings=True)
|
| 55 |
+
docs = model.encode(job_posts, normalize_embeddings=True)
|
| 56 |
+
scores = docs @ q
|
| 57 |
+
```
|
| 58 |
+
|
| 59 |
+
Use the bge query instruction for CVs/queries and no prefix for job posts. Vectors are L2-normalised: use inner product / cosine.
|
| 60 |
+
|
| 61 |
+
## Training
|
| 62 |
+
|
| 63 |
+
| | |
|
| 64 |
+
|---|---|
|
| 65 |
+
| Data | 8,702 (CV, matching job, hard-negative job) triples from the [Djinni dataset](https://huggingface.co/datasets/lang-uk/recruitment-dataset-job-descriptions-english) (MIT). CVs and jobs are **asserted disjoint** from the evaluation CVs and the search corpus. |
|
| 66 |
+
| Hard negatives | For each CV, the highest BM25-ranked job from a *different* category (lexically similar, wrong role). |
|
| 67 |
+
| Loss | InfoNCE (τ = 0.05) over in-batch + hard negatives, with **category-aware false-negative masking**: other in-batch jobs of the CV's own category are correct matches, so they are masked rather than pushed away. |
|
| 68 |
+
| Setup | 1 epoch, batch 32, AdamW lr 2e-5, linear warm-up/decay, max 256 tokens, CPU, gradient checkpointing. |
|
| 69 |
+
| Selection | Checkpoint chosen on the dev half of the evaluation CVs only (dev P@10 0.565 → 0.689). |
|
| 70 |
+
|
| 71 |
+
Training and evaluation code: [`scripts/build_training_set.py`](https://github.com/KhajaRaheelAhmedMohiuddin/vectormatch/blob/main/scripts/build_training_set.py), [`scripts/finetune_embedder.py`](https://github.com/KhajaRaheelAhmedMohiuddin/vectormatch/blob/main/scripts/finetune_embedder.py), [`scripts/eval_quality.py`](https://github.com/KhajaRaheelAhmedMohiuddin/vectormatch/blob/main/scripts/eval_quality.py).
|
| 72 |
+
|
| 73 |
+
## Limitations
|
| 74 |
+
|
| 75 |
+
- Trained on one IT-focused job board (Djinni; mostly Eastern-European tech roles, English texts). Expect weaker transfer to other domains.
|
| 76 |
+
- "Same category" is a proxy for relevance, and category labels are coarse (e.g. Python vs Data Science). Measured precision is conservative.
|
| 77 |
+
- Do not use as the sole basis for hiring decisions; rankings reflect patterns, including biases, in historical postings.
|
config.json
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"add_cross_attention": false,
|
| 3 |
+
"architectures": [
|
| 4 |
+
"BertModel"
|
| 5 |
+
],
|
| 6 |
+
"attention_probs_dropout_prob": 0.1,
|
| 7 |
+
"bos_token_id": null,
|
| 8 |
+
"classifier_dropout": null,
|
| 9 |
+
"dtype": "float32",
|
| 10 |
+
"eos_token_id": null,
|
| 11 |
+
"hidden_act": "gelu",
|
| 12 |
+
"hidden_dropout_prob": 0.1,
|
| 13 |
+
"hidden_size": 384,
|
| 14 |
+
"id2label": {
|
| 15 |
+
"0": "LABEL_0"
|
| 16 |
+
},
|
| 17 |
+
"initializer_range": 0.02,
|
| 18 |
+
"intermediate_size": 1536,
|
| 19 |
+
"is_decoder": false,
|
| 20 |
+
"label2id": {
|
| 21 |
+
"LABEL_0": 0
|
| 22 |
+
},
|
| 23 |
+
"layer_norm_eps": 1e-12,
|
| 24 |
+
"max_position_embeddings": 512,
|
| 25 |
+
"model_type": "bert",
|
| 26 |
+
"num_attention_heads": 12,
|
| 27 |
+
"num_hidden_layers": 12,
|
| 28 |
+
"pad_token_id": 0,
|
| 29 |
+
"position_embedding_type": "absolute",
|
| 30 |
+
"tie_word_embeddings": true,
|
| 31 |
+
"transformers_version": "5.23.0",
|
| 32 |
+
"type_vocab_size": 2,
|
| 33 |
+
"use_cache": false,
|
| 34 |
+
"vocab_size": 30522
|
| 35 |
+
}
|
config_sentence_transformers.json
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"__version__": {
|
| 3 |
+
"pytorch": "2.15.0+cu132",
|
| 4 |
+
"sentence_transformers": "6.3.0",
|
| 5 |
+
"transformers": "5.23.0"
|
| 6 |
+
},
|
| 7 |
+
"default_prompt_name": null,
|
| 8 |
+
"model_type": "SentenceTransformer",
|
| 9 |
+
"prompts": {
|
| 10 |
+
"document": "",
|
| 11 |
+
"query": ""
|
| 12 |
+
},
|
| 13 |
+
"similarity_fn_name": "cosine"
|
| 14 |
+
}
|
model.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:ac151cc2d7bdbcc449a1cc8de447eca1038d8f8352896d568571ecc1986d223b
|
| 3 |
+
size 133462128
|
modules.json
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
[
|
| 2 |
+
{
|
| 3 |
+
"idx": 0,
|
| 4 |
+
"name": "0",
|
| 5 |
+
"path": "",
|
| 6 |
+
"type": "sentence_transformers.base.modules.transformer.Transformer"
|
| 7 |
+
},
|
| 8 |
+
{
|
| 9 |
+
"idx": 1,
|
| 10 |
+
"name": "1",
|
| 11 |
+
"path": "1_Pooling",
|
| 12 |
+
"type": "sentence_transformers.sentence_transformer.modules.pooling.Pooling"
|
| 13 |
+
},
|
| 14 |
+
{
|
| 15 |
+
"idx": 2,
|
| 16 |
+
"name": "2",
|
| 17 |
+
"path": "2_Normalize",
|
| 18 |
+
"type": "sentence_transformers.base.modules.normalize.Normalize"
|
| 19 |
+
}
|
| 20 |
+
]
|
sentence_bert_config.json
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"transformer_task": "feature-extraction",
|
| 3 |
+
"modality_config": {
|
| 4 |
+
"text": {
|
| 5 |
+
"method": "forward",
|
| 6 |
+
"method_output_name": "last_hidden_state"
|
| 7 |
+
}
|
| 8 |
+
},
|
| 9 |
+
"module_output_name": "token_embeddings"
|
| 10 |
+
}
|
tokenizer.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
tokenizer_config.json
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"backend": "tokenizers",
|
| 3 |
+
"clean_up_tokenization_spaces": true,
|
| 4 |
+
"cls_token": "[CLS]",
|
| 5 |
+
"do_basic_tokenize": true,
|
| 6 |
+
"do_lower_case": true,
|
| 7 |
+
"is_local": false,
|
| 8 |
+
"local_files_only": false,
|
| 9 |
+
"mask_token": "[MASK]",
|
| 10 |
+
"model_max_length": 256,
|
| 11 |
+
"never_split": null,
|
| 12 |
+
"pad_token": "[PAD]",
|
| 13 |
+
"sep_token": "[SEP]",
|
| 14 |
+
"strip_accents": null,
|
| 15 |
+
"tokenize_chinese_chars": true,
|
| 16 |
+
"tokenizer_class": "BertTokenizer",
|
| 17 |
+
"unk_token": "[UNK]"
|
| 18 |
+
}
|
training_info.json
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"base_model": "BAAI/bge-small-en-v1.5",
|
| 3 |
+
"train_triples": 8702,
|
| 4 |
+
"epochs": 1.0,
|
| 5 |
+
"batch_size": 32,
|
| 6 |
+
"lr": 2e-05,
|
| 7 |
+
"temperature": 0.05,
|
| 8 |
+
"max_len": 256,
|
| 9 |
+
"best_step": 271,
|
| 10 |
+
"best_dev_nDCG@10": 0.6901458996588195,
|
| 11 |
+
"dev_docs": 4000,
|
| 12 |
+
"train_seconds": 12012.89306306839,
|
| 13 |
+
"loss": "InfoNCE, in-batch + 1 BM25 hard negative, category-aware false-negative masking",
|
| 14 |
+
"log": [
|
| 15 |
+
{
|
| 16 |
+
"step": 0,
|
| 17 |
+
"P@10": 0.565,
|
| 18 |
+
"nDCG@10": 0.5722611016200984
|
| 19 |
+
},
|
| 20 |
+
{
|
| 21 |
+
"step": 68,
|
| 22 |
+
"loss": 1.9253613948822021,
|
| 23 |
+
"P@10": 0.6746,
|
| 24 |
+
"nDCG@10": 0.6785215112772788
|
| 25 |
+
},
|
| 26 |
+
{
|
| 27 |
+
"step": 136,
|
| 28 |
+
"loss": 1.5598448514938354,
|
| 29 |
+
"P@10": 0.682,
|
| 30 |
+
"nDCG@10": 0.681709073363563
|
| 31 |
+
},
|
| 32 |
+
{
|
| 33 |
+
"step": 204,
|
| 34 |
+
"loss": 1.2491364479064941,
|
| 35 |
+
"P@10": 0.6888,
|
| 36 |
+
"nDCG@10": 0.6895515622613048
|
| 37 |
+
},
|
| 38 |
+
{
|
| 39 |
+
"step": 271,
|
| 40 |
+
"loss": 0.8976231217384338,
|
| 41 |
+
"P@10": 0.6888000000000001,
|
| 42 |
+
"nDCG@10": 0.6901458996588195
|
| 43 |
+
}
|
| 44 |
+
]
|
| 45 |
+
}
|