Skip to content

Commit 5e1f42f

Browse files
authored
Merge pull request #1531 from hanhainebula/master
Update modeling_mapping for embedder and update README of BGE-Reasoner
2 parents 9d5ae8e + ffea23c commit 5e1f42f

File tree

4 files changed

+35
-4
lines changed

4 files changed

+35
-4
lines changed

FlagEmbedding/inference/embedder/decoder_only/base.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ class BaseLLMEmbedder(AbsEmbedder):
4040
degradation. Defaults to :data:`True`.
4141
query_instruction_for_retrieval (Optional[str], optional): Query instruction for retrieval tasks, which will be used with
4242
with :attr:`query_instruction_format`. Defaults to :data:`None`.
43-
query_instruction_format (str, optional): The template for :attr:`query_instruction_for_retrieval`. Defaults to :data:`"{}{}"`.
43+
query_instruction_format (str, optional): The template for :attr:`query_instruction_for_retrieval`. Defaults to :data:`"Instruct: {}\nQuery: {}"`.
4444
devices (Optional[Union[str, int, List[str], List[int]]], optional): Devices to use for model inference. Defaults to :data:`None`.
4545
trust_remote_code (bool, optional): trust_remote_code for HF datasets or models. Defaults to :data:`False`.
4646
cache_dir (Optional[str], optional): Cache directory for the model. Defaults to :data:`None`.

FlagEmbedding/inference/embedder/model_mapping.py

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,14 @@ class EmbedderConfig:
3838

3939
# BGE models mapping
4040
BGE_MAPPING = OrderedDict([
41+
(
42+
"bge-reasoner-embed-qwen3-8b-0923",
43+
EmbedderConfig(FlagLLMModel, PoolingMethod.LAST_TOKEN, query_instruction_format="Instruct: {}\nQuery: {}")
44+
),
45+
(
46+
"bge-code-v1",
47+
EmbedderConfig(FlagLLMModel, PoolingMethod.LAST_TOKEN, trust_remote_code=True, query_instruction_format="<instruct>{}\n<query>{}")
48+
),
4149
(
4250
"bge-en-icl",
4351
EmbedderConfig(FlagICLModel, PoolingMethod.LAST_TOKEN, query_instruction_format="<instruct>{}\n<query>{}")
@@ -100,6 +108,23 @@ class EmbedderConfig:
100108
),
101109
])
102110

111+
# Qwen3-Embedding models mapping
112+
QWEN3_EMBEDDING_MAPPING = OrderedDict([
113+
(
114+
"Qwen3-Embedding-0.6B",
115+
EmbedderConfig(FlagLLMModel, PoolingMethod.LAST_TOKEN, query_instruction_format="Instruct: {}\nQuery:{}")
116+
),
117+
(
118+
"Qwen3-Embedding-4B",
119+
EmbedderConfig(FlagLLMModel, PoolingMethod.LAST_TOKEN, query_instruction_format="Instruct: {}\nQuery:{}")
120+
),
121+
(
122+
"Qwen3-Embedding-8B",
123+
EmbedderConfig(FlagLLMModel, PoolingMethod.LAST_TOKEN, query_instruction_format="Instruct: {}\nQuery:{}")
124+
),
125+
])
126+
127+
103128
# E5 models mapping
104129
E5_MAPPING = OrderedDict([
105130
(
@@ -231,6 +256,7 @@ class EmbedderConfig:
231256
# Combine all mappings
232257
AUTO_EMBEDDER_MAPPING = OrderedDict()
233258
AUTO_EMBEDDER_MAPPING.update(BGE_MAPPING)
259+
AUTO_EMBEDDER_MAPPING.update(QWEN3_EMBEDDING_MAPPING)
234260
AUTO_EMBEDDER_MAPPING.update(E5_MAPPING)
235261
AUTO_EMBEDDER_MAPPING.update(GTE_MAPPING)
236262
AUTO_EMBEDDER_MAPPING.update(SFR_MAPPING)

research/BGE_Reasoner/README.md

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ We introduce **BGE-Reasoner**, an end-to-end reasoning-intensive information ret
1717
| ------------------ | --------------------- | ----------- | ------------------ | ------------------ |
1818
| Model | BGE-Reasoner-Rewriter | [🤗]() (TBA) | - | |
1919
| Model | BGE-Reasoner-Reranker | [🤗]() (TBA) | - | |
20-
| Model | BGE-Reasoner-Embed-Qwen3-8B-0923 | [🤗](https://huggingface.co/BAAI/bge-reasoner-embed-qwen3-8b-0923) | Sep 23, 2025 | nDCG@10 = 37.2 using original query, fine-tuned on [Qwen/Qwen3-8B](https://huggingface.co/Qwen/Qwen3-8B) with our latest refined training data (data to be released) |
21-
| Search Results | BGE-Reasoner-Embed-Qwen3-8B-0923 Search Results | [🤗](https://huggingface.co/BAAI/bge-reasoner-embed-qwen3-8b-0923/tree/main/search_results) | Sep 23, 2025 | nDCG@10 = 37.2 using original query |
20+
| Model | BGE-Reasoner-Embed-Qwen3-8B-0923 | [🤗](https://huggingface.co/BAAI/bge-reasoner-embed-qwen3-8b-0923) | Sep 23, 2025 | nDCG@10 = 37.1 using original query, fine-tuned on [Qwen/Qwen3-8B](https://huggingface.co/Qwen/Qwen3-8B) with our latest refined training data (data to be released) |
21+
| Search Results | BGE-Reasoner-Embed-Qwen3-8B-0923 Search Results | [🤗](https://huggingface.co/BAAI/bge-reasoner-embed-qwen3-8b-0923/tree/main/search_results) | Sep 23, 2025 | nDCG@10 = 37.1 using original query |
2222
| Search Results | BGE-Reasoner-Embed-0821 Search Results | [🤗](https://huggingface.co/datasets/hanhainebula/bright-search-results_bge-reasoner-embed-0821/tree/main) | Sep 4, 2025 | nDCG@10 = 32.5 using original query, submission to BRIGHT leaderboard on Aug 21, 2025 |
2323
| Training Data | BGE-Reasoner-Data | [🤗](https://huggingface.co/datasets/hanhainebula/bge-reasoner-data/tree/main/bge-reasoner-data-0904) | Sep 4, 2025 | part of our training data; full data to be released in the future |
2424
| Evaluation Scripts | - | (TBA) | - | |
@@ -72,7 +72,7 @@ Note:
7272

7373
**BGE-Reasoner-Embed-Qwen3-8B-0923**, fine-tuned on [Qwen/Qwen3-8B](https://huggingface.co/Qwen/Qwen3-8B) with our latest refined training data (data to be released), achieves strong performance on the BRIGHT benchmark:
7474

75-
- With original queries, it attains **nDCG@10 = 37.2**, an absolute improvement of **+8.3** over the previous best ([DIVER](https://arxiv.org/pdf/2508.07995): 28.9).
75+
- With original queries, it attains **nDCG@10 = 37.1**, an absolute improvement of **+8.2** over the previous best ([DIVER](https://arxiv.org/pdf/2508.07995): 28.9).
7676
- Using the GPT-4 reasoning queries provided by BRIGHT, the score increases to **39.7**, which is **+7.6** higher than DIVER’s corresponding result (32.1).
7777

7878
> On Sep 23, 2025, we released the first-stage search results of BGE-Reasoner-Embed-Qwen3-8B-0923 using original queries and GPT-4 reasoning queries (Top-2000 candidates; excluded IDs removed) [here](https://huggingface.co/BAAI/bge-reasoner-embed-qwen3-8b-0923/tree/main/search_results). The model checkpoint is available [here](https://huggingface.co/BAAI/bge-reasoner-embed-qwen3-8b-0923).
@@ -139,6 +139,11 @@ Note:
139139
The technical details for each component of **BGE-Reasoner** will be released soon. Please stay tuned!
140140

141141

142+
## Contact Information
143+
144+
Some resources are not yet publicly available. If you have urgent research needs for any of these resources (e.g., model checkpoints, search results, evaluation scripts) or have any questions, please contact Jianlyu Chen at [email protected].
145+
146+
142147
## Citation
143148

144149
TBA
10.3 KB
Loading

0 commit comments

Comments
 (0)