mirianokradze commited on
Commit
5bc4751
·
verified ·
1 Parent(s): ead330c

Desearch Embedding 8B: LoRA adapter on Qwen3-Embedding-8B, model card with /search A/B results

Browse files
.gitattributes CHANGED
@@ -33,3 +33,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
 
 
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
36
+ tokenizer.json filter=lfs diff=lfs merge=lfs -text
1_Pooling/config.json ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ {
2
+ "embedding_dimension": 4096,
3
+ "pooling_mode": "lasttoken",
4
+ "include_prompt": true
5
+ }
README.md ADDED
@@ -0,0 +1,102 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: apache-2.0
3
+ base_model: Qwen/Qwen3-Embedding-8B
4
+ library_name: sentence-transformers
5
+ pipeline_tag: sentence-similarity
6
+ tags: [sentence-transformers, embeddings, retrieval, news, search]
7
+ ---
8
+
9
+ # Desearch Embedding 8B
10
+
11
+ A LoRA fine-tune of [Qwen/Qwen3-Embedding-8B](https://huggingface.co/Qwen/Qwen3-Embedding-8B) for web and news search, built by
12
+ Desearch. Shipped as a LoRA adapter on the base model: a bf16 merge keeps only 27% of the tuned change, so the change stays in its own fp32 path.
13
+
14
+ ## Usage
15
+
16
+ ```python
17
+ from sentence_transformers import SentenceTransformer
18
+
19
+ model = SentenceTransformer("desearch/Desearch-Embedding-8B")
20
+ queries = model.encode(["who won the 2026 Tour de France"], prompt_name="query")
21
+ documents = model.encode(["Passage text"])
22
+ scores = model.similarity(queries, documents)
23
+ ```
24
+
25
+ Queries take the instruction prompt `Instruct: Given a web search query, retrieve relevant passages that answer the query\nQuery:`; documents take none, exactly as the base
26
+ model. A document can be a paragraph chunk, a page head (title and opening text) or a whole page
27
+ up to 2,048 tokens; training covered all three.
28
+
29
+ ## Training
30
+
31
+ Desearch Embedding 8B adds two LoRA adapters (rank 32 on every attention and MLP projection) to
32
+ Qwen/Qwen3-Embedding-8B, one trained on news and one on reference pages and Wikipedia, then fuses them
33
+ into a single adapter by a weighted sum chosen on held-out questions.
34
+
35
+ **Documents.** 16,000 documents: news articles from 69 outlets, Wikipedia pages and
36
+ reference pages from the open web, plus Wikipedia pages linked from them for multi-hop questions.
37
+ Every article from the news evaluation week, and every gold page of the public benchmarks below,
38
+ was excluded before sampling.
39
+
40
+ **Questions.** An LLM wrote 98,307 search questions in the styles people use: keywords,
41
+ natural questions, details from deep in a page, questions with a typo, the central fact of a news
42
+ story with its date, single-answer factual questions, and questions that need two linked pages. A
43
+ second LLM pass graded every candidate passage as answering the question, on topic, or not
44
+ relevant. Only passages graded not relevant became negatives, and every passage graded as
45
+ answering became a positive.
46
+
47
+ **What the model learns from.** Each positive is trained in the three forms a search index embeds:
48
+ a paragraph chunk, the page head (title and first 1,500 characters) and the full page (up to 2,048
49
+ tokens). Training uses a contrastive loss (temperature 0.02) with in-batch negatives shared across
50
+ GPUs and up to two graded hard negatives per row, and masks any candidate that scores well above
51
+ the positive, so a relevant page that was never graded is not pushed away.
52
+
53
+
54
+ ## Evaluation
55
+
56
+ Every comparison is paired, question by question, against the base model under identical settings,
57
+ with an exact sign test. Numbers below are from the held-out half of each question set; the other
58
+ half chose the adapter strength (scale 1.0).
59
+
60
+ Gold-URL retrieval on a production `/search` index of 44,779 pages, embedded once with Qwen3-Embedding-8B and once with Desearch Embedding 8B; every question is scored by the unchanged desearch-search-evals harness. Cells read base → tuned; a question counts at gold@k when a reference page is in the top k.
61
+
62
+ **Fast mode, public benchmarks**
63
+
64
+ | fast | n | gold@1 | gold@5 | gold@10 | recall@10 | wins / losses at gold@1 |
65
+ |---|---|---|---|---|---|---|
66
+ | All | 766 | 85.6% → 86.0% | 96.0% → 96.0% | 96.7% → 97.4% | 82.3% → 83.0% | 15 / 12 (p 0.701) |
67
+ | FRAMES | 399 | 88.7% → 88.7% | 98.5% → 98.2% | 98.7% → 99.0% | 82.7% → 83.0% | 10 / 10 (p 1.000) |
68
+ | SealQA | 137 | 70.8% → 71.5% | 84.7% → 86.1% | 88.3% → 91.2% | 88.3% → 90.3% | 3 / 2 (p 1.000) |
69
+ | SimpleQA-Verified | 230 | 89.1% → 90.0% | 98.3% → 97.8% | 98.3% → 98.3% | 78.2% → 78.6% | 2 / 0 (p 0.500) |
70
+
71
+ **Fast mode, news**
72
+
73
+ | fast | n | gold@1 | gold@5 | gold@10 | recall@10 | wins / losses at gold@1 |
74
+ |---|---|---|---|---|---|---|
75
+ | All | 246 | 78.0% → 77.6% | 95.1% → 95.9% | 97.2% → 97.6% | 94.2% → 94.0% | 5 / 6 (p 1.000) |
76
+
77
+ **Balanced mode, public benchmarks**
78
+
79
+ | balanced | n | gold@1 | gold@5 | gold@10 | recall@10 | wins / losses at gold@1 |
80
+ |---|---|---|---|---|---|---|
81
+ | All | 766 | 87.7% → 87.9% | 96.6% → 96.3% | 97.4% → 97.1% | 84.2% → 83.9% | 19 / 18 (p 1.000) |
82
+ | FRAMES | 399 | 91.0% → 89.7% | 99.2% → 98.2% | 99.5% → 99.0% | 86.2% → 85.3% | 10 / 15 (p 0.424) |
83
+ | SealQA | 137 | 73.0% → 76.6% | 86.1% → 88.3% | 89.8% → 89.8% | 88.9% → 89.4% | 6 / 1 (p 0.125) |
84
+ | SimpleQA-Verified | 230 | 90.9% → 91.3% | 98.3% → 97.8% | 98.3% → 98.3% | 77.7% → 78.4% | 3 / 2 (p 1.000) |
85
+
86
+ **Balanced mode, news**
87
+
88
+ | balanced | n | gold@1 | gold@5 | gold@10 | recall@10 | wins / losses at gold@1 |
89
+ |---|---|---|---|---|---|---|
90
+ | All | 246 | 77.6% → 80.5% | 95.5% → 95.9% | 98.0% → 98.0% | 95.1% → 94.9% | 12 / 5 (p 0.143) |
91
+
92
+
93
+ ## Limitations
94
+
95
+ - English only; trained and evaluated on English pages and questions.
96
+ - Queries need the instruction prompt; documents are encoded without one, as with the base model.
97
+ - The reported gains come from one search stack (dense retrieval fused with keyword search) and
98
+ from the question sets described above. Other corpora and pipelines may see different results.
99
+ - Load it as an adapter on Qwen/Qwen3-Embedding-8B. Merging the change into bf16 base weights keeps
100
+ only about 27% of it; merge in fp32 if a single set of weights is required.
101
+ - Pages are trained up to 2,048 tokens; longer pages should be split before encoding.
102
+
adapter_config.json ADDED
@@ -0,0 +1,51 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "alora_invocation_tokens": null,
3
+ "alpha_pattern": {},
4
+ "arrow_config": null,
5
+ "auto_mapping": null,
6
+ "base_model_name_or_path": "Qwen/Qwen3-Embedding-8B",
7
+ "bias": "none",
8
+ "corda_config": null,
9
+ "ensure_weight_tying": false,
10
+ "eva_config": null,
11
+ "exclude_modules": null,
12
+ "fan_in_fan_out": false,
13
+ "inference_mode": false,
14
+ "init_lora_weights": true,
15
+ "kasa_config": null,
16
+ "layer_replication": null,
17
+ "layers_pattern": null,
18
+ "layers_to_transform": null,
19
+ "loftq_config": {},
20
+ "lora_alpha": 64,
21
+ "lora_bias": false,
22
+ "lora_dropout": 0.0,
23
+ "lora_ga_config": null,
24
+ "megatron_config": null,
25
+ "megatron_core": "megatron.core",
26
+ "modules_to_save": null,
27
+ "monteclora_config": null,
28
+ "peft_type": "LORA",
29
+ "peft_version": "0.21.0",
30
+ "qalora_group_size": 16,
31
+ "r": 64,
32
+ "rank_pattern": {},
33
+ "revision": null,
34
+ "target_modules": [
35
+ "q_proj",
36
+ "up_proj",
37
+ "down_proj",
38
+ "k_proj",
39
+ "v_proj",
40
+ "o_proj",
41
+ "gate_proj"
42
+ ],
43
+ "target_parameters": null,
44
+ "task_type": "FEATURE_EXTRACTION",
45
+ "trainable_token_indices": null,
46
+ "use_bdlora": null,
47
+ "use_dora": false,
48
+ "use_qalora": false,
49
+ "use_rslora": false,
50
+ "velora_config": null
51
+ }
adapter_model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:e90337b12edca2257dcc386318e6740e3caeec949e92398eb131a16f9a678b20
3
+ size 698416704
chat_template.jinja ADDED
@@ -0,0 +1,54 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {%- if tools %}
2
+ {{- '<|im_start|>system\n' }}
3
+ {%- if messages[0]['role'] == 'system' %}
4
+ {{- messages[0]['content'] }}
5
+ {%- else %}
6
+ {{- 'You are a helpful assistant.' }}
7
+ {%- endif %}
8
+ {{- "\n\n# Tools\n\nYou may call one or more functions to assist with the user query.\n\nYou are provided with function signatures within <tools></tools> XML tags:\n<tools>" }}
9
+ {%- for tool in tools %}
10
+ {{- "\n" }}
11
+ {{- tool | tojson }}
12
+ {%- endfor %}
13
+ {{- "\n</tools>\n\nFor each function call, return a json object with function name and arguments within <tool_call></tool_call> XML tags:\n<tool_call>\n{\"name\": <function-name>, \"arguments\": <args-json-object>}\n</tool_call><|im_end|>\n" }}
14
+ {%- else %}
15
+ {%- if messages[0]['role'] == 'system' %}
16
+ {{- '<|im_start|>system\n' + messages[0]['content'] + '<|im_end|>\n' }}
17
+ {%- else %}
18
+ {{- '<|im_start|>system\nYou are a helpful assistant.<|im_end|>\n' }}
19
+ {%- endif %}
20
+ {%- endif %}
21
+ {%- for message in messages %}
22
+ {%- if (message.role == "user") or (message.role == "system" and not loop.first) or (message.role == "assistant" and not message.tool_calls) %}
23
+ {{- '<|im_start|>' + message.role + '\n' + message.content + '<|im_end|>' + '\n' }}
24
+ {%- elif message.role == "assistant" %}
25
+ {{- '<|im_start|>' + message.role }}
26
+ {%- if message.content %}
27
+ {{- '\n' + message.content }}
28
+ {%- endif %}
29
+ {%- for tool_call in message.tool_calls %}
30
+ {%- if tool_call.function is defined %}
31
+ {%- set tool_call = tool_call.function %}
32
+ {%- endif %}
33
+ {{- '\n<tool_call>\n{"name": "' }}
34
+ {{- tool_call.name }}
35
+ {{- '", "arguments": ' }}
36
+ {{- tool_call.arguments | tojson }}
37
+ {{- '}\n</tool_call>' }}
38
+ {%- endfor %}
39
+ {{- '<|im_end|>\n' }}
40
+ {%- elif message.role == "tool" %}
41
+ {%- if (loop.index0 == 0) or (messages[loop.index0 - 1].role != "tool") %}
42
+ {{- '<|im_start|>user' }}
43
+ {%- endif %}
44
+ {{- '\n<tool_response>\n' }}
45
+ {{- message.content }}
46
+ {{- '\n</tool_response>' }}
47
+ {%- if loop.last or (messages[loop.index0 + 1].role != "tool") %}
48
+ {{- '<|im_end|>\n' }}
49
+ {%- endif %}
50
+ {%- endif %}
51
+ {%- endfor %}
52
+ {%- if add_generation_prompt %}
53
+ {{- '<|im_start|>assistant\n' }}
54
+ {%- endif %}
config_sentence_transformers.json ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "__version__": {
3
+ "pytorch": "2.13.0+cu130",
4
+ "sentence_transformers": "5.7.0",
5
+ "transformers": "5.15.0"
6
+ },
7
+ "default_prompt_name": null,
8
+ "model_type": "SentenceTransformer",
9
+ "prompts": {
10
+ "document": "",
11
+ "query": "Instruct: Given a web search query, retrieve relevant passages that answer the query\nQuery:"
12
+ },
13
+ "similarity_fn_name": "cosine"
14
+ }
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.sentence_transformer.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
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:ff800fee44eacd1a1c8c2f96b890ade65d722550ab6693efa8d2c368f40a5853
3
+ size 11423209
tokenizer_config.json ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "add_prefix_space": false,
3
+ "backend": "tokenizers",
4
+ "bos_token": null,
5
+ "clean_up_tokenization_spaces": false,
6
+ "eos_token": "<|im_end|>",
7
+ "errors": "replace",
8
+ "is_local": false,
9
+ "local_files_only": false,
10
+ "model_max_length": 2048,
11
+ "pad_token": "<|endoftext|>",
12
+ "padding_side": "left",
13
+ "split_special_tokens": false,
14
+ "tokenizer_class": "Qwen2Tokenizer",
15
+ "unk_token": null
16
+ }