Shitao commited on
Commit
5a21248
1 Parent(s): cab5a40

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +26 -29
README.md CHANGED
@@ -17,7 +17,24 @@ In this project, we introduce BGE-M3, which is distinguished for its versatility
17
  - Multi-Granularity: It is able to process inputs of different granularities, spanning from short sentences to long documents of up to 8192 tokens.
18
 
19
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
20
  ## News:
 
 
21
  - 2024/3/8: **Thanks for the [experimental results](https://towardsdatascience.com/openai-vs-open-source-multilingual-embedding-models-e5ccb7c90f05) from @[Yannael](https://huggingface.co/Yannael). In this benchmark, BGE-M3 achieves top performance in both English and other languages, surpassing models such as OpenAI.**
22
  - 2024/3/2: Release unified fine-tuning [example](https://github.com/FlagOpen/FlagEmbedding/tree/master/examples/unified_finetune) and [data](https://huggingface.co/datasets/Shitao/bge-m3-data)
23
  - 2024/2/6: We release the [MLDR](https://huggingface.co/datasets/Shitao/MLDR) (a long document retrieval dataset covering 13 languages) and [evaluation pipeline](https://github.com/FlagOpen/FlagEmbedding/tree/master/C_MTEB/MLDR).
@@ -54,47 +71,25 @@ In this project, we introduce BGE-M3, which is distinguished for its versatility
54
  - Sparse retrieval (lexical matching): a vector of size equal to the vocabulary, with the majority of positions set to zero, calculating a weight only for tokens present in the text. e.g., BM25, [unicoil](https://arxiv.org/pdf/2106.14807.pdf), and [splade](https://arxiv.org/abs/2107.05720)
55
  - Multi-vector retrieval: use multiple vectors to represent a text, e.g., [ColBERT](https://arxiv.org/abs/2004.12832).
56
 
57
- **2. Comparison with BGE-v1.5 and other monolingual models**
58
-
59
- BGE-M3 is a multilingual model, and its ability in monolingual embedding retrieval may not surpass models specifically designed for single languages.
60
- However, we still recommend trying BGE-M3 because of its versatility (support for multiple languages and long texts).
61
- Moreover, it can simultaneously generate multiple representations, and using them together can enhance accuracy and generalization,
62
- unlike most existing models that can only perform dense retrieval.
63
 
64
- In the open-source community, there are many excellent models (e.g., jina-embedding, colbert, e5, etc),
65
- and users can choose a model that suits their specific needs based on practical considerations,
66
- such as whether to require multilingual or cross-language support, and whether to process long texts.
67
-
68
- **3. How to use BGE-M3 in other projects?**
69
 
70
  For embedding retrieval, you can employ the BGE-M3 model using the same approach as BGE.
71
  The only difference is that the BGE-M3 model no longer requires adding instructions to the queries.
72
- For sparse retrieval methods, most open-source libraries currently do not support direct utilization of the BGE-M3 model.
73
- Contributions from the community are welcome.
74
-
75
 
76
- In our experiments, we use [Pyserini](https://github.com/FlagOpen/FlagEmbedding/tree/master/C_MTEB/MLDR#hybrid-retrieval-dense--sparse) and Faiss to do hybrid retrieval.
77
- **Now you can ou can try the hybrid mode of BGE-M3 in [Vespa](https://github.com/vespa-engine/pyvespa/blob/master/docs/sphinx/source/examples/mother-of-all-embedding-models-cloud.ipynb
78
- ). Thanks @jobergum.**
79
 
80
 
81
- **4. How to fine-tune bge-M3 model?**
82
 
83
  You can follow the common in this [example](https://github.com/FlagOpen/FlagEmbedding/tree/master/examples/finetune)
84
  to fine-tune the dense embedding.
85
 
86
- If you want to fine-tune all embedding function of m3, you can refer to the [unified_fine-tuning example](https://github.com/FlagOpen/FlagEmbedding/tree/master/examples/unified_finetune)
87
 
88
 
89
 
90
- **5. Some suggestions for retrieval pipeline in RAG**
91
- We recommend to use following pipeline: hybrid retrieval + re-ranking.
92
- - Hybrid retrieval leverages the strengths of various methods, offering higher accuracy and stronger generalization capabilities.
93
- A classic example: using both embedding retrieval and the BM25 algorithm.
94
- Now, you can try to use BGE-M3, which supports both embedding and sparse retrieval.
95
- This allows you to obtain token weights (similar to the BM25) without any additional cost when generate dense embeddings.
96
- - As cross-encoder models, re-ranker demonstrates higher accuracy than bi-encoder embedding model.
97
- Utilizing the re-ranking model (e.g., [bge-reranker](https://github.com/FlagOpen/FlagEmbedding/tree/master/FlagEmbedding/reranker), [cohere-reranker](https://txt.cohere.com/rerank/)) after retrieval can further filter the selected text.
98
 
99
 
100
 
@@ -220,7 +215,6 @@ print(model.compute_score(sentence_pairs,
220
 
221
  We provide the evaluation script for [MKQA](https://github.com/FlagOpen/FlagEmbedding/tree/master/C_MTEB/MKQA) and [MLDR](https://github.com/FlagOpen/FlagEmbedding/tree/master/C_MTEB/MLDR)
222
 
223
-
224
  ### Benchmarks from the open-source community
225
  ![avatar](./imgs/others.webp)
226
  The BGE-M3 model emerged as the top performer on this benchmark (OAI is short for OpenAI).
@@ -269,7 +263,10 @@ The small-batch strategy is simple but effective, which also can used to fine-tu
269
  - MCLS: A simple method to improve the performance on long text without fine-tuning.
270
  If you have no enough resource to fine-tuning model with long text, the method is useful.
271
 
272
- Refer to our [report](https://arxiv.org/pdf/2402.03216.pdf) for more details.
 
 
 
273
 
274
 
275
 
 
17
  - Multi-Granularity: It is able to process inputs of different granularities, spanning from short sentences to long documents of up to 8192 tokens.
18
 
19
 
20
+
21
+ **Some suggestions for retrieval pipeline in RAG**
22
+
23
+ We recommend to use the following pipeline: hybrid retrieval + re-ranking.
24
+ - Hybrid retrieval leverages the strengths of various methods, offering higher accuracy and stronger generalization capabilities.
25
+ A classic example: using both embedding retrieval and the BM25 algorithm.
26
+ Now, you can try to use BGE-M3, which supports both embedding and sparse retrieval.
27
+ This allows you to obtain token weights (similar to the BM25) without any additional cost when generate dense embeddings.
28
+ To use hybrid retrieval, you can refer to [Vespa](https://github.com/vespa-engine/pyvespa/blob/master/docs/sphinx/source/examples/mother-of-all-embedding-models-cloud.ipynb
29
+ ) and [Milvus](https://github.com/milvus-io/pymilvus/blob/master/examples/hello_hybrid_sparse_dense.py).
30
+
31
+ - As cross-encoder models, re-ranker demonstrates higher accuracy than bi-encoder embedding model.
32
+ Utilizing the re-ranking model (e.g., [bge-reranker](https://github.com/FlagOpen/FlagEmbedding/tree/master/FlagEmbedding/reranker), [bge-reranker-v2](https://github.com/FlagOpen/FlagEmbedding/tree/master/FlagEmbedding/llm_reranker)) after retrieval can further filter the selected text.
33
+
34
+
35
  ## News:
36
+ - 2024/3/20: **Thanks Milvus team!** Now you can use hybrid retrieval of bge-m3 in Milvus: [pymilvus/examples
37
+ /hello_hybrid_sparse_dense.py](https://github.com/milvus-io/pymilvus/blob/master/examples/hello_hybrid_sparse_dense.py).
38
  - 2024/3/8: **Thanks for the [experimental results](https://towardsdatascience.com/openai-vs-open-source-multilingual-embedding-models-e5ccb7c90f05) from @[Yannael](https://huggingface.co/Yannael). In this benchmark, BGE-M3 achieves top performance in both English and other languages, surpassing models such as OpenAI.**
39
  - 2024/3/2: Release unified fine-tuning [example](https://github.com/FlagOpen/FlagEmbedding/tree/master/examples/unified_finetune) and [data](https://huggingface.co/datasets/Shitao/bge-m3-data)
40
  - 2024/2/6: We release the [MLDR](https://huggingface.co/datasets/Shitao/MLDR) (a long document retrieval dataset covering 13 languages) and [evaluation pipeline](https://github.com/FlagOpen/FlagEmbedding/tree/master/C_MTEB/MLDR).
 
71
  - Sparse retrieval (lexical matching): a vector of size equal to the vocabulary, with the majority of positions set to zero, calculating a weight only for tokens present in the text. e.g., BM25, [unicoil](https://arxiv.org/pdf/2106.14807.pdf), and [splade](https://arxiv.org/abs/2107.05720)
72
  - Multi-vector retrieval: use multiple vectors to represent a text, e.g., [ColBERT](https://arxiv.org/abs/2004.12832).
73
 
 
 
 
 
 
 
74
 
75
+ **2. How to use BGE-M3 in other projects?**
 
 
 
 
76
 
77
  For embedding retrieval, you can employ the BGE-M3 model using the same approach as BGE.
78
  The only difference is that the BGE-M3 model no longer requires adding instructions to the queries.
 
 
 
79
 
80
+ For hybrid retrieval, you can use [Vespa](https://github.com/vespa-engine/pyvespa/blob/master/docs/sphinx/source/examples/mother-of-all-embedding-models-cloud.ipynb
81
+ ) and [Milvus](https://github.com/milvus-io/pymilvus/blob/master/examples/hello_hybrid_sparse_dense.py).
 
82
 
83
 
84
+ **3. How to fine-tune bge-M3 model?**
85
 
86
  You can follow the common in this [example](https://github.com/FlagOpen/FlagEmbedding/tree/master/examples/finetune)
87
  to fine-tune the dense embedding.
88
 
89
+ If you want to fine-tune all embedding function of m3 (dense, sparse and colbert), you can refer to the [unified_fine-tuning example](https://github.com/FlagOpen/FlagEmbedding/tree/master/examples/unified_finetune)
90
 
91
 
92
 
 
 
 
 
 
 
 
 
93
 
94
 
95
 
 
215
 
216
  We provide the evaluation script for [MKQA](https://github.com/FlagOpen/FlagEmbedding/tree/master/C_MTEB/MKQA) and [MLDR](https://github.com/FlagOpen/FlagEmbedding/tree/master/C_MTEB/MLDR)
217
 
 
218
  ### Benchmarks from the open-source community
219
  ![avatar](./imgs/others.webp)
220
  The BGE-M3 model emerged as the top performer on this benchmark (OAI is short for OpenAI).
 
263
  - MCLS: A simple method to improve the performance on long text without fine-tuning.
264
  If you have no enough resource to fine-tuning model with long text, the method is useful.
265
 
266
+ Refer to our [report](https://arxiv.org/pdf/2402.03216.pdf) for more details.
267
+
268
+
269
+
270
 
271
 
272