ldwang commited on
Commit
0725d0e
1 Parent(s): a6d78b9
Files changed (1) hide show
  1. README.md +172 -122
README.md CHANGED
@@ -2604,25 +2604,11 @@ pipeline_tag: sentence-similarity
2604
 
2605
 
2606
  <h1 align="center">FlagEmbedding</h1>
2607
- <p align="center">
2608
- <a href="https://github.com/FlagOpen/FlagEmbedding">
2609
- <img alt="Build" src="https://img.shields.io/badge/Contribution-Welcome-blue">
2610
- </a>
2611
- <a href="https://github.com/FlagOpen/FlagEmbedding/blob/master/LICENSE">
2612
- <img alt="License" src="https://img.shields.io/badge/LICENSE-MIT-green">
2613
- </a>
2614
- <a href="https://huggingface.co/C-MTEB">
2615
- <img alt="Build" src="https://img.shields.io/badge/C_MTEB-🤗-yellow">
2616
- </a>
2617
- <a href="https://github.com/FlagOpen/FlagEmbedding/tree/master/FlagEmbedding/baai_general_embedding">
2618
- <img alt="Build" src="https://img.shields.io/badge/FlagEmbedding-1.0-red">
2619
- </a>
2620
- </p>
2621
 
2622
  <h4 align="center">
2623
  <p>
2624
  <a href=#model-list>Model List</a> |
2625
- <a href=#frequently-asked-questions>FAQ</a> |
2626
  <a href=#usage>Usage</a> |
2627
  <a href="#evaluation">Evaluation</a> |
2628
  <a href="#train">Train</a> |
@@ -2631,14 +2617,21 @@ pipeline_tag: sentence-similarity
2631
  <p>
2632
  </h4>
2633
 
 
 
 
2634
 
2635
  [English](README.md) | [中文](https://github.com/FlagOpen/FlagEmbedding/blob/master/README_zh.md)
2636
 
2637
  FlagEmbedding can map any text to a low-dimensional dense vector which can be used for tasks like retrieval, classification, clustering, or semantic search.
2638
- And it also can be used in vector database for LLMs.
2639
 
2640
  ************* 🌟**Updates**🌟 *************
2641
- - 08/09/2023: BGE Models are integrated into **Langchain**, you can use it like [this](#using-langchain); C-MTEB **leaderboard** is [avaliable](https://huggingface.co/spaces/mteb/leaderboard).
 
 
 
 
2642
  - 08/05/2023: Release base-scale and small-scale models, **best performance among the models of the same size 🤗**
2643
  - 08/02/2023: Release `bge-large-*`(short for BAAI General Embedding) Models, **rank 1st on MTEB and C-MTEB benchmark!** :tada: :tada:
2644
  - 08/01/2023: We release the [Chinese Massive Text Embedding Benchmark](https://github.com/FlagOpen/FlagEmbedding/blob/master/C_MTEB) (**C-MTEB**), consisting of 31 test dataset.
@@ -2648,47 +2641,80 @@ And it also can be used in vector database for LLMs.
2648
 
2649
  `bge` is short for `BAAI general embedding`.
2650
 
2651
- | Model | Language | Description | query instruction for retrieval\* |
2652
- |:-------------------------------|:--------:| :--------:| :--------:|
2653
- | [BAAI/bge-large-en](https://huggingface.co/BAAI/bge-large-en) | English | :trophy: rank **1st** in [MTEB](https://huggingface.co/spaces/mteb/leaderboard) leaderboard | `Represent this sentence for searching relevant passages: ` |
2654
- | [BAAI/bge-base-en](https://huggingface.co/BAAI/bge-base-en) | English | rank **2nd** in [MTEB](https://huggingface.co/spaces/mteb/leaderboard) leaderboard | `Represent this sentence for searching relevant passages: ` |
2655
- | [BAAI/bge-small-en](https://huggingface.co/BAAI/bge-small-en) | English | a small-scale model but with competitive performance | `Represent this sentence for searching relevant passages: ` |
2656
- | [BAAI/bge-large-zh](https://huggingface.co/BAAI/bge-large-zh) | Chinese | :trophy: rank **1st** in [C-MTEB](https://github.com/FlagOpen/FlagEmbedding/tree/master/C_MTEB) benchmark | `为这个句子生成表示以用于检索相关文章:` |
2657
- | [BAAI/bge-large-zh-noinstruct](https://huggingface.co/BAAI/bge-large-zh-noinstruct) | Chinese | This model is trained without instruction, and rank **2nd** in [C-MTEB](https://github.com/FlagOpen/FlagEmbedding/tree/master/C_MTEB) benchmark | |
2658
- | [BAAI/bge-base-zh](https://huggingface.co/BAAI/bge-base-zh) | Chinese | a base-scale model but has similar ability with `bge-large-zh` | `为这个句子生成表示以用于检索相关文章:` |
2659
- | [BAAI/bge-small-zh](https://huggingface.co/BAAI/bge-small-zh) | Chinese | a small-scale model but with competitive performance | `为这个句子生成表示以用于检索相关文章:` |
 
 
 
 
 
 
 
 
 
 
 
 
 
2660
 
2661
- \*: If you need to search the **long** relevant passages to a **short** query (s2p retrieval task), you need to add the instruction to the query; in other cases, no instruction is needed, just use the original query directly. In all cases, **no instruction** need to be added to passages.
2662
 
2663
  ## Frequently asked questions
2664
 
2665
- 1. The similarity score between two dissimilar sentence is higher than 0.5
 
2666
 
2667
- The similarity distribution of the current BGE model is about in the interval \[0.6, 1\].
2668
- So a similarity score greater than 0.5 does not indicate that the two sentence are similar.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2669
 
2670
  For downstream tasks, such as passage retrieval or semantic similarity,
2671
  **what matters is the relative order of the scores, not the absolute value.**
2672
  If you need to filter similar sentences based on a similarity threshold,
2673
  please select an appropriate similarity threshold based on the similarity distribution on your data (such as 0.8, 0.85, or even 0.9).
2674
 
 
2675
 
2676
- 2. When do the query instruction need to be used
 
2677
 
 
 
2678
  For a retrieval task that uses short queries to find long related documents,
2679
  it is recommended to add instructions for these short queries.
2680
- For other tasks, it is recommended not to add instructions.
2681
- For example, in Quora task, which needs to use a short question to search another related short questions,
2682
- the instruction is not recommended to add.
2683
- The best method to decide whether to add instructions for queries is choosing the setting which can achieve better performance in your task.
2684
- In all cases, the documents/passages do not need to add the instruction, only need to consider whether to add the instruction for queries.
2685
 
2686
-
2687
 
2688
 
2689
  ## Usage
2690
 
2691
- Here are some examples to use `bge` models with
 
 
2692
  [FlagEmbedding](#using-flagembedding), [Sentence-Transformers](#using-sentence-transformers), [Langchain](#using-langchain), or [Huggingface Transformers](#using-huggingface-transformers).
2693
 
2694
  #### Using FlagEmbedding
@@ -2707,7 +2733,7 @@ embeddings_2 = model.encode(sentences_2)
2707
  similarity = embeddings_1 @ embeddings_2.T
2708
  print(similarity)
2709
 
2710
- # for s2p(short query to long passage) retrieval task, please use encode_queries() which will automatically add the instruction to each query
2711
  # corpus in retrieval task can still use encode() or encode_corpus(), since they don't need instruction
2712
  queries = ['query_1', 'query_2']
2713
  passages = ["样例文档-1", "样例文档-2"]
@@ -2715,15 +2741,15 @@ q_embeddings = model.encode_queries(queries)
2715
  p_embeddings = model.encode(passages)
2716
  scores = q_embeddings @ p_embeddings.T
2717
  ```
2718
- The value of argument `query_instruction_for_retrieval` see [Model List](https://github.com/FlagOpen/FlagEmbedding/tree/master#model-list).
2719
 
2720
- FlagModel will use all available GPUs when encoding, please set `os.environ["CUDA_VISIBLE_DEVICES"]` to choose GPU.
2721
- You also can set `os.environ["CUDA_VISIBLE_DEVICES"]=""` to make GPUs unavailable.
2722
 
2723
 
2724
  #### Using Sentence-Transformers
2725
 
2726
- Using this model also is easy when you have [sentence-transformers](https://www.SBERT.net) installed:
2727
 
2728
  ```
2729
  pip install -U sentence-transformers
@@ -2765,14 +2791,15 @@ model = HuggingFaceBgeEmbeddings(
2765
  model_name=model_name,
2766
  model_kwargs=model_kwargs,
2767
  encode_kwargs=encode_kwargs,
2768
- query_instruction="为这个句子生成表示以用于检索相关文章:"
2769
  )
 
2770
  ```
2771
 
2772
 
2773
  #### Using HuggingFace Transformers
2774
 
2775
- With transformers package, you can use the model like this: First, you pass your input through the transformer model, then you select the last hidden state of first token (i.e., [CLS]) as the sentence embedding.
2776
 
2777
  ```python
2778
  from transformers import AutoTokenizer, AutoModel
@@ -2783,6 +2810,7 @@ sentences = ["样例数据-1", "样例数据-2"]
2783
  # Load model from HuggingFace Hub
2784
  tokenizer = AutoTokenizer.from_pretrained('BAAI/bge-large-zh')
2785
  model = AutoModel.from_pretrained('BAAI/bge-large-zh')
 
2786
 
2787
  # Tokenize sentences
2788
  encoded_input = tokenizer(sentences, padding=True, truncation=True, return_tensors='pt')
@@ -2799,21 +2827,65 @@ sentence_embeddings = torch.nn.functional.normalize(sentence_embeddings, p=2, di
2799
  print("Sentence embeddings:", sentence_embeddings)
2800
  ```
2801
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2802
 
2803
  ## Evaluation
 
2804
  `baai-general-embedding` models achieve **state-of-the-art performance on both MTEB and C-MTEB leaderboard!**
2805
- More details and evaluation tools see our [scripts](https://github.com/FlagOpen/FlagEmbedding/blob/master/C_MTEB/README.md).
2806
 
2807
  - **MTEB**:
2808
 
2809
  | Model Name | Dimension | Sequence Length | Average (56) | Retrieval (15) |Clustering (11) | Pair Classification (3) | Reranking (4) | STS (10) | Summarization (1) | Classification (12) |
2810
  |:----:|:---:|:---:|:---:|:---:|:---:|:---:|:---:|:---:|:---:|:---:|
2811
- | [**bge-large-en**](https://huggingface.co/BAAI/bge-large-en) | 1024 | 512 | **63.98** | **53.9** | **46.98** | 85.8 | **59.48** | 81.56 | 32.06 | **76.21** |
2812
- | [**bge-base-en**](https://huggingface.co/BAAI/bge-base-en) | 768 | 512 | 63.36 | 53.0 | 46.32 | 85.86 | 58.7 | 81.84 | 29.27 | 75.27 |
 
 
 
2813
  | [gte-large](https://huggingface.co/thenlper/gte-large) | 1024 | 512 | 63.13 | 52.22 | 46.84 | 85.00 | 59.13 | 83.35 | 31.66 | 73.33 |
2814
  | [gte-base](https://huggingface.co/thenlper/gte-base) | 768 | 512 | 62.39 | 51.14 | 46.2 | 84.57 | 58.61 | 82.3 | 31.17 | 73.01 |
2815
  | [e5-large-v2](https://huggingface.co/intfloat/e5-large-v2) | 1024| 512 | 62.25 | 50.56 | 44.49 | 86.03 | 56.61 | 82.05 | 30.19 | 75.24 |
2816
- | [**bge-small-en**](https://huggingface.co/BAAI/bge-small-en) | 384 | 512 | 62.11 | 51.82 | 44.31 | 83.78 | 57.97 | 80.72 | 30.53 | 74.37 |
2817
  | [instructor-xl](https://huggingface.co/hkunlp/instructor-xl) | 768 | 512 | 61.79 | 49.26 | 44.74 | 86.62 | 57.29 | 83.06 | 32.32 | 61.79 |
2818
  | [e5-base-v2](https://huggingface.co/intfloat/e5-base-v2) | 768 | 512 | 61.5 | 50.29 | 43.80 | 85.73 | 55.91 | 81.05 | 30.28 | 73.84 |
2819
  | [gte-small](https://huggingface.co/thenlper/gte-small) | 384 | 512 | 61.36 | 49.46 | 44.89 | 83.54 | 57.7 | 82.07 | 30.42 | 72.31 |
@@ -2822,102 +2894,80 @@ More details and evaluation tools see our [scripts](https://github.com/FlagOpen/
2822
  | [sentence-t5-xxl](https://huggingface.co/sentence-transformers/sentence-t5-xxl) | 768 | 512 | 59.51 | 42.24 | 43.72 | 85.06 | 56.42 | 82.63 | 30.08 | 73.42 |
2823
  | [all-mpnet-base-v2](https://huggingface.co/sentence-transformers/all-mpnet-base-v2) | 768 | 514 | 57.78 | 43.81 | 43.69 | 83.04 | 59.36 | 80.28 | 27.49 | 65.07 |
2824
  | [sgpt-bloom-7b1-msmarco](https://huggingface.co/bigscience/sgpt-bloom-7b1-msmarco) | 4096 | 2048 | 57.59 | 48.22 | 38.93 | 81.9 | 55.65 | 77.74 | 33.6 | 66.19 |
2825
- | [all-MiniLM-L12-v2](https://huggingface.co/sentence-transformers/all-MiniLM-L12-v2) | 384 | 512 | 56.53 | 42.69 | 41.81 | 82.41 | 58.44 | 79.8 | 27.9 | 63.21 |
2826
- | [all-MiniLM-L6-v2](https://huggingface.co/sentence-transformers/all-MiniLM-L6-v2) | 384 | 512 | 56.26 | 41.95 | 42.35 | 82.37 | 58.04 | 78.9 | 30.81 | 63.05 |
2827
- | [contriever-base-msmarco](https://huggingface.co/nthakur/contriever-base-msmarco) | 768 | 512 | 56.00 | 41.88 | 41.1 | 82.54 | 53.14 | 76.51 | 30.36 | 66.68 |
2828
- | [sentence-t5-base](https://huggingface.co/sentence-transformers/sentence-t5-base) | 768 | 512 | 55.27 | 33.63 | 40.21 | 85.18 | 53.09 | 81.14 | 31.39 | 69.81 |
2829
 
2830
 
2831
 
2832
  - **C-MTEB**:
2833
- We create a benchmark C-MTEB for chinese text embedding which consists of 31 datasets from 6 tasks.
2834
  Please refer to [C_MTEB](https://github.com/FlagOpen/FlagEmbedding/blob/master/C_MTEB/README.md) for a detailed introduction.
2835
 
2836
  | Model | Embedding dimension | Avg | Retrieval | STS | PairClassification | Classification | Reranking | Clustering |
2837
  |:-------------------------------|:--------:|:--------:|:--------:|:--------:|:--------:|:--------:|:--------:|:--------:|
2838
- | [**bge-large-zh**](https://huggingface.co/BAAI/bge-large-zh) | 1024 | **64.20** | **71.53** | **53.23** | **78.94** | 72.26 | **65.11** | 48.39 |
2839
- | [**bge-large-zh-noinstruct**](https://huggingface.co/BAAI/bge-large-zh-noinstruct) | 1024 | 63.53 | 70.55 | 50.98 | 76.77 | **72.49** | 64.91 | **50.01** |
2840
- | [**BAAI/bge-base-zh**](https://huggingface.co/BAAI/bge-base-zh) | 768 | 62.96 | 69.53 | 52.05 | 77.5 | 70.98 | 64.91 | 47.63 |
2841
- | [**BAAI/bge-small-zh**](https://huggingface.co/BAAI/bge-small-zh) | 512 | 58.27 | 63.07 | 46.87 | 70.35 | 67.78 | 61.48 | 45.09 |
2842
- | [m3e-base](https://huggingface.co/moka-ai/m3e-base) | 768 | 57.10 |56.91 | 48.15 | 63.99 | 70.28 | 59.34 | 47.68 |
2843
- | [m3e-large](https://huggingface.co/moka-ai/m3e-large) | 1024 | 57.05 |54.75 | 48.64 | 64.3 | 71.22 | 59.66 | 48.88 |
2844
- | [text-embedding-ada-002(OpenAI)](https://platform.openai.com/docs/guides/embeddings/what-are-embeddings) | 1536 | 53.02 | 52.0 | 40.61 | 69.56 | 67.38 | 54.28 | 45.68 |
2845
- | [luotuo](https://huggingface.co/silk-road/luotuo-bert-medium) | 1024 | 49.37 | 44.4 | 39.41 | 66.62 | 65.29 | 49.25 | 44.39 |
2846
- | [text2vec](https://huggingface.co/shibing624/text2vec-base-chinese) | 768 | 47.63 | 38.79 | 41.71 | 67.41 | 65.18 | 49.45 | 37.66 |
2847
- | [text2vec-large](https://huggingface.co/GanymedeNil/text2vec-large-chinese) | 1024 | 47.36 | 41.94 | 41.98 | 70.86 | 63.42 | 49.16 | 30.02 |
2848
-
2849
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2850
 
2851
  ## Train
2852
- This section will introduce the way we used to train the general embedding.
2853
- The training scripts are in [FlagEmbedding](https://github.com/FlagOpen/FlagEmbedding/blob/master/FlagEmbedding/baai_general_embedding/README.md),
2854
- and we provide some examples to do [pre-train](https://github.com/FlagOpen/FlagEmbedding/blob/master/examples/pretrain/README.md) and [fine-tune](https://github.com/FlagOpen/FlagEmbedding/blob/master/examples/finetune/README.md).
2855
-
2856
-
2857
- **1. RetroMAE Pre-train**
2858
- We pre-train the model following the method [retromae](https://github.com/staoxiao/RetroMAE),
2859
- which shows promising improvement in retrieval task ([paper](https://aclanthology.org/2022.emnlp-main.35.pdf)).
2860
- The pre-training was conducted on 24 A100(40G) GPUs with a batch size of 720.
2861
- In retromae, the mask ratio of encoder and decoder are 0.3, 0.5 respectively.
2862
- We used the AdamW optimizer and the learning rate is 2e-5.
2863
-
2864
- **Pre-training data**:
2865
- - English:
2866
- - [Pile](https://pile.eleuther.ai/)
2867
- - [wikipedia](https://huggingface.co/datasets/wikipedia)
2868
- - [msmarco](https://huggingface.co/datasets/Tevatron/msmarco-passage-corpus)
2869
- - Chinese:
2870
- - [wudao](https://github.com/BAAI-WuDao/Data)
2871
-
2872
-
2873
- **2. Finetune**
2874
- We fine-tune the model using a contrastive objective.
2875
- The format of input data is a triple`(query, positive, negative)`.
2876
- Besides the negative in the triple, we also adopt in-batch negatives strategy.
2877
- We employ the cross-device negatives sharing method to share negatives among different GPUs,
2878
- which can dramatically **increase the number of negatives**.
2879
-
2880
- We trained our model on 48 A100(40G) GPUs with a large batch size of 32,784 (so there are **65,567** negatives for each query in a batch).
2881
- We used the AdamW optimizer and the learning rate is 1e-5.
2882
- The temperature for contrastive loss is 0.01.
2883
-
2884
- Besides, we add instruction to the query for s2p(short query to long passage) retrieval task in the training (add nothing to passages).
2885
- For English, the instruction is `Represent this sentence for searching relevant passages: `;
2886
- For Chinese, the instruction is `为这个句子生成表示以用于检索相关文章:`.
2887
- In the evaluation, the instruction should be added for queries in retrieval task, not be added for other tasks.
2888
- Noted that the instruction is not needed for passages.
2889
-
2890
- The finetune script is accessible in this repository: [FlagEmbedding](https://github.com/FlagOpen/FlagEmbedding/blob/master/FlagEmbedding/baai_general_embedding/README.md).
2891
- You can easily finetune your model with it.
2892
-
2893
- **Training data**:
2894
 
2895
- - For English, we collect 230M text pairs from [wikipedia](https://huggingface.co/datasets/wikipedia), [cc-net](https://github.com/facebookresearch/cc_net), and so on.
2896
 
2897
- - For chinese, we collect 120M text pairs from [wudao](https://github.com/BAAI-WuDao/Data), [simclue](https://github.com/CLUEbenchmark/SimCLUE), and so on.
 
 
 
 
2898
 
2899
- **The data collection is to be released in the future.**
2900
 
2901
 
2902
- ## Schedule
2903
- - [x] Chinese Massive Text Embedding Benchmark
2904
- - [x] release baai-general-embedding models
2905
- - [x] release codes for training
2906
- - [ ] Multilingual model
2907
- - [ ] Training Datasets
2908
- - [ ] ...
2909
 
2910
- We will continually update the embedding models and training codes,
2911
- hoping to promote the development of the embedding model community.
 
 
 
 
2912
 
2913
 
2914
  ## Contact
2915
- If you have any question or suggestion related to this project, feel free to open an issue or pull a request.
2916
  You also can email Shitao Xiao(stxiao@baai.ac.cn) and Zheng Liu(liuzheng@baai.ac.cn).
2917
 
2918
 
2919
  ## License
2920
- FlagEmbedding is licensed under [MIT License](https://github.com/FlagOpen/FlagEmbedding/blob/master/LICENSE). The released models can be used for commercial purposes free of charge.
2921
 
2922
 
2923
 
 
2604
 
2605
 
2606
  <h1 align="center">FlagEmbedding</h1>
2607
+
 
 
 
 
 
 
 
 
 
 
 
 
 
2608
 
2609
  <h4 align="center">
2610
  <p>
2611
  <a href=#model-list>Model List</a> |
 
2612
  <a href=#usage>Usage</a> |
2613
  <a href="#evaluation">Evaluation</a> |
2614
  <a href="#train">Train</a> |
 
2617
  <p>
2618
  </h4>
2619
 
2620
+ More details please refer to our Github: [FlagEmbedding](https://github.com/FlagOpen/FlagEmbedding).
2621
+
2622
+
2623
 
2624
  [English](README.md) | [中文](https://github.com/FlagOpen/FlagEmbedding/blob/master/README_zh.md)
2625
 
2626
  FlagEmbedding can map any text to a low-dimensional dense vector which can be used for tasks like retrieval, classification, clustering, or semantic search.
2627
+ And it also can be used in vector databases for LLMs.
2628
 
2629
  ************* 🌟**Updates**🌟 *************
2630
+ - 09/12/2023: New Release:
2631
+ - **New reranker model**: release a cross-encoder model bge-reranker-base, which is more powerful than embedding model. We recommend to use/fine-tune it to re-rank top-k documents returned by embedding models.
2632
+ - **update embedding model**: release bge-*-v1.5 embedding model to alleviate the issue of the similarity distribution, and enhance its retrieval ability without instruction.
2633
+ - 09/07/2023: Update [fine-tune code](https://github.com/FlagOpen/FlagEmbedding/blob/master/FlagEmbedding/baai_general_embedding/README.md): Add script to mine hard negatives and support adding instruction during fine-tuning.
2634
+ - 08/09/2023: BGE Models are integrated into **Langchain**, you can use it like [this](#using-langchain); C-MTEB **leaderboard** is [available](https://huggingface.co/spaces/mteb/leaderboard).
2635
  - 08/05/2023: Release base-scale and small-scale models, **best performance among the models of the same size 🤗**
2636
  - 08/02/2023: Release `bge-large-*`(short for BAAI General Embedding) Models, **rank 1st on MTEB and C-MTEB benchmark!** :tada: :tada:
2637
  - 08/01/2023: We release the [Chinese Massive Text Embedding Benchmark](https://github.com/FlagOpen/FlagEmbedding/blob/master/C_MTEB) (**C-MTEB**), consisting of 31 test dataset.
 
2641
 
2642
  `bge` is short for `BAAI general embedding`.
2643
 
2644
+ | Model | Language | | Description | query instruction for retrieval\* |
2645
+ |:-------------------------------|:--------:| :--------:| :--------:|:--------:|
2646
+ | [BAAI/bge-reranker-large](https://huggingface.co/BAAI/bge-reranker-large) | Chinese and English | [Inference](#usage-for-reranker) [Fine-tune](https://github.com/FlagOpen/FlagEmbedding/tree/master/examples/reranker) | a cross-encoder model which is more accurate but less efficient \** | |
2647
+ | [BAAI/bge-reranker-base](https://huggingface.co/BAAI/bge-reranker-base) | Chinese and English | [Inference](#usage-for-reranker) [Fine-tune](https://github.com/FlagOpen/FlagEmbedding/tree/master/examples/reranker) | a cross-encoder model which is more accurate but less efficient \** | |
2648
+ | [BAAI/bge-large-en-v1.5](https://huggingface.co/BAAI/bge-large-en-v1.5) | English | [Inference](#usage-for-embedding-model) [Fine-tune](https://github.com/FlagOpen/FlagEmbedding/tree/master/examples/finetune) | version 1.5 with more reasonable similarity distribution | `Represent this sentence for searching relevant passages: ` |
2649
+ | [BAAI/bge-base-en-v1.5](https://huggingface.co/BAAI/bge-base-en-v1.5) | English | [Inference](#usage-for-embedding-model) [Fine-tune](https://github.com/FlagOpen/FlagEmbedding/tree/master/examples/finetune) | version 1.5 with more reasonable similarity distribution | `Represent this sentence for searching relevant passages: ` |
2650
+ | [BAAI/bge-small-en-v1.5](https://huggingface.co/BAAI/bge-small-en-v1.5) | English | [Inference](#usage-for-embedding-model) [Fine-tune](https://github.com/FlagOpen/FlagEmbedding/tree/master/examples/finetune) | version 1.5 with more reasonable similarity distribution | `Represent this sentence for searching relevant passages: ` |
2651
+ | [BAAI/bge-large-zh-v1.5](https://huggingface.co/BAAI/bge-large-zh-v1.5) | Chinese | [Inference](#usage-for-embedding-model) [Fine-tune](https://github.com/FlagOpen/FlagEmbedding/tree/master/examples/finetune) | version 1.5 with more reasonable similarity distribution | `为这个句子生成表示以用于检索相关文章:` |
2652
+ | [BAAI/bge-base-zh-v1.5](https://huggingface.co/BAAI/bge-base-zh-v1.5) | Chinese | [Inference](#usage-for-embedding-model) [Fine-tune](https://github.com/FlagOpen/FlagEmbedding/tree/master/examples/finetune) | version 1.5 with more reasonable similarity distribution | `为这个句子生成表示以用于检索相关文章:` |
2653
+ | [BAAI/bge-small-zh-v1.5](https://huggingface.co/BAAI/bge-small-zh-v1.5) | Chinese | [Inference](#usage-for-embedding-model) [Fine-tune](https://github.com/FlagOpen/FlagEmbedding/tree/master/examples/finetune) | version 1.5 with more reasonable similarity distribution | `为这个句子生成表示以用于检索相关文章:` |
2654
+ | [BAAI/bge-large-en](https://huggingface.co/BAAI/bge-large-en) | English | [Inference](#usage-for-embedding-model) [Fine-tune](https://github.com/FlagOpen/FlagEmbedding/tree/master/examples/finetune) | :trophy: rank **1st** in [MTEB](https://huggingface.co/spaces/mteb/leaderboard) leaderboard | `Represent this sentence for searching relevant passages: ` |
2655
+ | [BAAI/bge-base-en](https://huggingface.co/BAAI/bge-base-en) | English | [Inference](#usage-for-embedding-model) [Fine-tune](https://github.com/FlagOpen/FlagEmbedding/tree/master/examples/finetune) | a base-scale model but with similar ability to `bge-large-en` | `Represent this sentence for searching relevant passages: ` |
2656
+ | [BAAI/bge-small-en](https://huggingface.co/BAAI/bge-small-en) | English | [Inference](#usage-for-embedding-model) [Fine-tune](https://github.com/FlagOpen/FlagEmbedding/tree/master/examples/finetune) |a small-scale model but with competitive performance | `Represent this sentence for searching relevant passages: ` |
2657
+ | [BAAI/bge-large-zh](https://huggingface.co/BAAI/bge-large-zh) | Chinese | [Inference](#usage-for-embedding-model) [Fine-tune](https://github.com/FlagOpen/FlagEmbedding/tree/master/examples/finetune) | :trophy: rank **1st** in [C-MTEB](https://github.com/FlagOpen/FlagEmbedding/tree/master/C_MTEB) benchmark | `为这个句子生成表示以用于检索相关文章:` |
2658
+ | [BAAI/bge-base-zh](https://huggingface.co/BAAI/bge-base-zh) | Chinese | [Inference](#usage-for-embedding-model) [Fine-tune](https://github.com/FlagOpen/FlagEmbedding/tree/master/examples/finetune) | a base-scale model but with similar ability to `bge-large-zh` | `为这个句子生成表示以用于检索相关文章:` |
2659
+ | [BAAI/bge-small-zh](https://huggingface.co/BAAI/bge-small-zh) | Chinese | [Inference](#usage-for-embedding-model) [Fine-tune](https://github.com/FlagOpen/FlagEmbedding/tree/master/examples/finetune) | a small-scale model but with competitive performance | `为这个句子生成表示以用于检索相关文章:` |
2660
+
2661
+
2662
+ \*: If you need to search the relevant passages to a query, we suggest to add the instruction to the query; in other cases, no instruction is needed, just use the original query directly. In all cases, **no instruction** needs to be added to passages.
2663
+
2664
+ \**: To balance the accuracy and time cost, cross-encoder is widely used to re-rank top-k documents retrieved by other simple models.
2665
+ For examples, use bge embedding model to retrieve top 100 relevant documents, and then use bge reranker to re-rank the top 100 document to get the final top-3 results.
2666
 
 
2667
 
2668
  ## Frequently asked questions
2669
 
2670
+ <details>
2671
+ <summary>1. How to fine-tune bge embedding model?</summary>
2672
 
2673
+ <!-- ### How to fine-tune bge embedding model? -->
2674
+ Following this [example](https://github.com/FlagOpen/FlagEmbedding/tree/master/examples/finetune) to prepare data and fine-tune your model.
2675
+ Some suggestions:
2676
+ - Mine hard negatives following this [example](https://github.com/FlagOpen/FlagEmbedding/tree/master/examples/finetune#data-format), which can improve the retrieval performance.
2677
+ - If you pre-train bge on your data, the pre-trained model cannot be directly used to calculate similarity, and it must be fine-tuned with contrastive learning before computing similarity.
2678
+ - If the accuracy of the fine-tuned model is still not high, it is recommended to use/fine-tune the cross-encoder model (bge-reranker) to re-rank top-k results. Hard negatives also are needed to fine-tune reranker.
2679
+
2680
+
2681
+ </details>
2682
+
2683
+ <details>
2684
+ <summary>2. The similarity score between two dissimilar sentences is higher than 0.5</summary>
2685
+
2686
+ <!-- ### The similarity score between two dissimilar sentences is higher than 0.5 -->
2687
+ **Suggest to use bge v1.5, which alleviates the issue of the similarity distribution.**
2688
+
2689
+ Since we finetune the models by contrastive learning with a temperature of 0.01,
2690
+ the similarity distribution of the current BGE model is about in the interval \[0.6, 1\].
2691
+ So a similarity score greater than 0.5 does not indicate that the two sentences are similar.
2692
 
2693
  For downstream tasks, such as passage retrieval or semantic similarity,
2694
  **what matters is the relative order of the scores, not the absolute value.**
2695
  If you need to filter similar sentences based on a similarity threshold,
2696
  please select an appropriate similarity threshold based on the similarity distribution on your data (such as 0.8, 0.85, or even 0.9).
2697
 
2698
+ </details>
2699
 
2700
+ <details>
2701
+ <summary>3. When does the query instruction need to be used</summary>
2702
 
2703
+ <!-- ### When does the query instruction need to be used -->
2704
+
2705
  For a retrieval task that uses short queries to find long related documents,
2706
  it is recommended to add instructions for these short queries.
2707
+ **The best method to decide whether to add instructions for queries is choosing the setting that achieves better performance on your task.**
2708
+ In all cases, the documents/passages do not need to add the instruction.
 
 
 
2709
 
2710
+ </details>
2711
 
2712
 
2713
  ## Usage
2714
 
2715
+ ### Usage for Embedding Model
2716
+
2717
+ Here are some examples for using `bge` models with
2718
  [FlagEmbedding](#using-flagembedding), [Sentence-Transformers](#using-sentence-transformers), [Langchain](#using-langchain), or [Huggingface Transformers](#using-huggingface-transformers).
2719
 
2720
  #### Using FlagEmbedding
 
2733
  similarity = embeddings_1 @ embeddings_2.T
2734
  print(similarity)
2735
 
2736
+ # for s2p(short query to long passage) retrieval task, suggest to use encode_queries() which will automatically add the instruction to each query
2737
  # corpus in retrieval task can still use encode() or encode_corpus(), since they don't need instruction
2738
  queries = ['query_1', 'query_2']
2739
  passages = ["样例文档-1", "样例文档-2"]
 
2741
  p_embeddings = model.encode(passages)
2742
  scores = q_embeddings @ p_embeddings.T
2743
  ```
2744
+ For the value of the argument `query_instruction_for_retrieval`, see [Model List](https://github.com/FlagOpen/FlagEmbedding/tree/master#model-list).
2745
 
2746
+ By default, FlagModel will use all available GPUs when encoding. Please set `os.environ["CUDA_VISIBLE_DEVICES"]` to select specific GPUs.
2747
+ You also can set `os.environ["CUDA_VISIBLE_DEVICES"]=""` to make all GPUs unavailable.
2748
 
2749
 
2750
  #### Using Sentence-Transformers
2751
 
2752
+ You can also use the `bge` models with [sentence-transformers](https://www.SBERT.net):
2753
 
2754
  ```
2755
  pip install -U sentence-transformers
 
2791
  model_name=model_name,
2792
  model_kwargs=model_kwargs,
2793
  encode_kwargs=encode_kwargs,
2794
+ query_instruction="为这个句子生成表示以用于检索相关文章:"
2795
  )
2796
+ model.query_instruction = "为这个句子生成表示以用于检索相关文章:"
2797
  ```
2798
 
2799
 
2800
  #### Using HuggingFace Transformers
2801
 
2802
+ With the transformers package, you can use the model like this: First, you pass your input through the transformer model, then you select the last hidden state of the first token (i.e., [CLS]) as the sentence embedding.
2803
 
2804
  ```python
2805
  from transformers import AutoTokenizer, AutoModel
 
2810
  # Load model from HuggingFace Hub
2811
  tokenizer = AutoTokenizer.from_pretrained('BAAI/bge-large-zh')
2812
  model = AutoModel.from_pretrained('BAAI/bge-large-zh')
2813
+ model.eval()
2814
 
2815
  # Tokenize sentences
2816
  encoded_input = tokenizer(sentences, padding=True, truncation=True, return_tensors='pt')
 
2827
  print("Sentence embeddings:", sentence_embeddings)
2828
  ```
2829
 
2830
+ ### Usage for Reranker
2831
+
2832
+ You can get a relevance score by inputting query and passage to the reranker.
2833
+ The reranker is optimized based cross-entropy loss, so the relevance score is not bounded to a specific range.
2834
+
2835
+
2836
+ #### Using FlagEmbedding
2837
+ ```
2838
+ pip install -U FlagEmbedding
2839
+ ```
2840
+
2841
+ Get relevance score:
2842
+ ```python
2843
+ from FlagEmbedding import FlagReranker
2844
+ reranker = FlagReranker('BAAI/bge-reranker-base', use_fp16=True) #use fp16 can speed up computing
2845
+
2846
+ score = reranker.compute_score(['query', 'passage'])
2847
+ print(score)
2848
+
2849
+ scores = reranker.compute_score([['what is panda?', 'hi'], ['what is panda?', 'The giant panda (Ailuropoda melanoleuca), sometimes called a panda bear or simply panda, is a bear species endemic to China.']])
2850
+ print(scores)
2851
+ ```
2852
+
2853
+
2854
+ #### Using Huggingface transformers
2855
+
2856
+ ```python
2857
+ import torch
2858
+ from transformers import AutoModelForSequenceClassification, AutoTokenizer, BatchEncoding, PreTrainedTokenizerFast
2859
+
2860
+ tokenizer = AutoTokenizer.from_pretrained('BAAI/bge-reranker-base')
2861
+ model = AutoModelForSequenceClassification.from_pretrained('BAAI/bge-reranker-base')
2862
+ model.eval()
2863
+
2864
+ pairs = [['what is panda?', 'hi'], ['what is panda?', 'The giant panda (Ailuropoda melanoleuca), sometimes called a panda bear or simply panda, is a bear species endemic to China.']]
2865
+ with torch.no_grad():
2866
+ inputs = tokenizer(pairs, padding=True, truncation=True, return_tensors='pt', max_length=512)
2867
+ scores = model(**inputs, return_dict=True).logits.view(-1, ).float()
2868
+ print(scores)
2869
+ ```
2870
 
2871
  ## Evaluation
2872
+
2873
  `baai-general-embedding` models achieve **state-of-the-art performance on both MTEB and C-MTEB leaderboard!**
2874
+ For more details and evaluation tools see our [scripts](https://github.com/FlagOpen/FlagEmbedding/blob/master/C_MTEB/README.md).
2875
 
2876
  - **MTEB**:
2877
 
2878
  | Model Name | Dimension | Sequence Length | Average (56) | Retrieval (15) |Clustering (11) | Pair Classification (3) | Reranking (4) | STS (10) | Summarization (1) | Classification (12) |
2879
  |:----:|:---:|:---:|:---:|:---:|:---:|:---:|:---:|:---:|:---:|:---:|
2880
+ | [BAAI/bge-large-en-v1.5](https://huggingface.co/BAAI/bge-large-en-v1.5) | 1024 | 512 | **64.23** | **54.29** | 46.08 | 87.12 | 60.03 | 83.11 | 31.61 | 75.97 |
2881
+ | [BAAI/bge-base-en-v1.5](https://huggingface.co/BAAI/bge-base-en-v1.5) | 768 | 512 | 63.55 | 53.25 | 45.77 | 86.55 | 58.86 | 82.4 | 31.07 | 75.53 |
2882
+ | [BAAI/bge-small-en-v1.5](https://huggingface.co/BAAI/bge-small-en-v1.5) | 384 | 512 | 62.17 |51.68 | 43.82 | 84.92 | 58.36 | 81.59 | 30.12 | 74.14 |
2883
+ | [bge-large-en](https://huggingface.co/BAAI/bge-large-en) | 1024 | 512 | 63.98 | 53.9 | 46.98 | 85.8 | 59.48 | 81.56 | 32.06 | 76.21 |
2884
+ | [bge-base-en](https://huggingface.co/BAAI/bge-base-en) | 768 | 512 | 63.36 | 53.0 | 46.32 | 85.86 | 58.7 | 81.84 | 29.27 | 75.27 |
2885
  | [gte-large](https://huggingface.co/thenlper/gte-large) | 1024 | 512 | 63.13 | 52.22 | 46.84 | 85.00 | 59.13 | 83.35 | 31.66 | 73.33 |
2886
  | [gte-base](https://huggingface.co/thenlper/gte-base) | 768 | 512 | 62.39 | 51.14 | 46.2 | 84.57 | 58.61 | 82.3 | 31.17 | 73.01 |
2887
  | [e5-large-v2](https://huggingface.co/intfloat/e5-large-v2) | 1024| 512 | 62.25 | 50.56 | 44.49 | 86.03 | 56.61 | 82.05 | 30.19 | 75.24 |
2888
+ | [bge-small-en](https://huggingface.co/BAAI/bge-small-en) | 384 | 512 | 62.11 | 51.82 | 44.31 | 83.78 | 57.97 | 80.72 | 30.53 | 74.37 |
2889
  | [instructor-xl](https://huggingface.co/hkunlp/instructor-xl) | 768 | 512 | 61.79 | 49.26 | 44.74 | 86.62 | 57.29 | 83.06 | 32.32 | 61.79 |
2890
  | [e5-base-v2](https://huggingface.co/intfloat/e5-base-v2) | 768 | 512 | 61.5 | 50.29 | 43.80 | 85.73 | 55.91 | 81.05 | 30.28 | 73.84 |
2891
  | [gte-small](https://huggingface.co/thenlper/gte-small) | 384 | 512 | 61.36 | 49.46 | 44.89 | 83.54 | 57.7 | 82.07 | 30.42 | 72.31 |
 
2894
  | [sentence-t5-xxl](https://huggingface.co/sentence-transformers/sentence-t5-xxl) | 768 | 512 | 59.51 | 42.24 | 43.72 | 85.06 | 56.42 | 82.63 | 30.08 | 73.42 |
2895
  | [all-mpnet-base-v2](https://huggingface.co/sentence-transformers/all-mpnet-base-v2) | 768 | 514 | 57.78 | 43.81 | 43.69 | 83.04 | 59.36 | 80.28 | 27.49 | 65.07 |
2896
  | [sgpt-bloom-7b1-msmarco](https://huggingface.co/bigscience/sgpt-bloom-7b1-msmarco) | 4096 | 2048 | 57.59 | 48.22 | 38.93 | 81.9 | 55.65 | 77.74 | 33.6 | 66.19 |
 
 
 
 
2897
 
2898
 
2899
 
2900
  - **C-MTEB**:
2901
+ We create the benchmark C-MTEB for Chinese text embedding which consists of 31 datasets from 6 tasks.
2902
  Please refer to [C_MTEB](https://github.com/FlagOpen/FlagEmbedding/blob/master/C_MTEB/README.md) for a detailed introduction.
2903
 
2904
  | Model | Embedding dimension | Avg | Retrieval | STS | PairClassification | Classification | Reranking | Clustering |
2905
  |:-------------------------------|:--------:|:--------:|:--------:|:--------:|:--------:|:--------:|:--------:|:--------:|
2906
+ | [**BAAI/bge-large-zh-v1.5**](https://huggingface.co/BAAI/bge-large-zh-v1.5) | 1024 | **64.53** | 70.46 | 56.25 | 81.6 | 69.13 | 65.84 | 48.99 |
2907
+ | [BAAI/bge-base-zh-v1.5](https://huggingface.co/BAAI/bge-base-zh-v1.5) | 768 | 63.13 | 69.49 | 53.72 | 79.75 | 68.07 | 65.39 | 47.53 |
2908
+ | [BAAI/bge-small-zh-v1.5](https://huggingface.co/BAAI/bge-small-zh-v1.5) | 512 | 57.82 | 61.77 | 49.11 | 70.41 | 63.96 | 60.92 | 44.18 |
2909
+ | [BAAI/bge-large-zh](https://huggingface.co/BAAI/bge-large-zh) | 1024 | 64.20 | 71.53 | 54.98 | 78.94 | 68.32 | 65.11 | 48.39 |
2910
+ | [bge-large-zh-noinstruct](https://huggingface.co/BAAI/bge-large-zh-noinstruct) | 1024 | 63.53 | 70.55 | 53 | 76.77 | 68.58 | 64.91 | 50.01 |
2911
+ | [BAAI/bge-base-zh](https://huggingface.co/BAAI/bge-base-zh) | 768 | 62.96 | 69.53 | 54.12 | 77.5 | 67.07 | 64.91 | 47.63 |
2912
+ | [multilingual-e5-large](https://huggingface.co/intfloat/multilingual-e5-large) | 1024 | 58.79 | 63.66 | 48.44 | 69.89 | 67.34 | 56.00 | 48.23 |
2913
+ | [BAAI/bge-small-zh](https://huggingface.co/BAAI/bge-small-zh) | 512 | 58.27 | 63.07 | 49.45 | 70.35 | 63.64 | 61.48 | 45.09 |
2914
+ | [m3e-base](https://huggingface.co/moka-ai/m3e-base) | 768 | 57.10 | 56.91 | 50.47 | 63.99 | 67.52 | 59.34 | 47.68 |
2915
+ | [m3e-large](https://huggingface.co/moka-ai/m3e-large) | 1024 | 57.05 | 54.75 | 50.42 | 64.3 | 68.2 | 59.66 | 48.88 |
2916
+ | [multilingual-e5-base](https://huggingface.co/intfloat/multilingual-e5-base) | 768 | 55.48 | 61.63 | 46.49 | 67.07 | 65.35 | 54.35 | 40.68 |
2917
+ | [multilingual-e5-small](https://huggingface.co/intfloat/multilingual-e5-small) | 384 | 55.38 | 59.95 | 45.27 | 66.45 | 65.85 | 53.86 | 45.26 |
2918
+ | [text-embedding-ada-002(OpenAI)](https://platform.openai.com/docs/guides/embeddings/what-are-embeddings) | 1536 | 53.02 | 52.0 | 43.35 | 69.56 | 64.31 | 54.28 | 45.68 |
2919
+ | [luotuo](https://huggingface.co/silk-road/luotuo-bert-medium) | 1024 | 49.37 | 44.4 | 42.78 | 66.62 | 61 | 49.25 | 44.39 |
2920
+ | [text2vec-base](https://huggingface.co/shibing624/text2vec-base-chinese) | 768 | 47.63 | 38.79 | 43.41 | 67.41 | 62.19 | 49.45 | 37.66 |
2921
+ | [text2vec-large](https://huggingface.co/GanymedeNil/text2vec-large-chinese) | 1024 | 47.36 | 41.94 | 44.97 | 70.86 | 60.66 | 49.16 | 30.02 |
2922
+
2923
+
2924
+ - **Reranking**:
2925
+ See [C_MTEB](https://github.com/FlagOpen/FlagEmbedding/blob/master/C_MTEB/) for evaluation script.
2926
+
2927
+ | Model | T2Reranking | T2RerankingZh2En\* | T2RerankingEn2Zh\* | MmarcoReranking | CMedQAv1 | CMedQAv2 | Avg |
2928
+ |:-------------------------------|:--------:|:--------:|:--------:|:--------:|:--------:|:--------:|:--------:|
2929
+ | text2vec-base-multilingual | 64.66 | 62.94 | 62.51 | 14.37 | 48.46 | 48.6 | 50.26 |
2930
+ | multilingual-e5-small | 65.62 | 60.94 | 56.41 | 29.91 | 67.26 | 66.54 | 57.78 |
2931
+ | multilingual-e5-large | 64.55 | 61.61 | 54.28 | 28.6 | 67.42 | 67.92 | 57.4 |
2932
+ | multilingual-e5-base | 64.21 | 62.13 | 54.68 | 29.5 | 66.23 | 66.98 | 57.29 |
2933
+ | m3e-base | 66.03 | 62.74 | 56.07 | 17.51 | 77.05 | 76.76 | 59.36 |
2934
+ | m3e-large | 66.13 | 62.72 | 56.1 | 16.46 | 77.76 | 78.27 | 59.57 |
2935
+ | bge-base-zh-v1.5 | 66.49 | 63.25 | 57.02 | 29.74 | 80.47 | 84.88 | 63.64 |
2936
+ | bge-large-zh-v1.5 | 65.74 | 63.39 | 57.03 | 28.74 | 83.45 | 85.44 | 63.97 |
2937
+ | [BAAI/bge-reranker-base](https://huggingface.co/BAAI/bge-reranker-base) | 67.28 | 63.95 | 60.45 | 35.46 | 81.26 | 84.1 | 65.42 |
2938
+ | [BAAI/bge-reranker-large](https://huggingface.co/BAAI/bge-reranker-large) | 67.6 | 64.03 | 61.44 | 37.16 | 82.15 | 84.18 | 66.09 |
2939
+
2940
+ \* : T2RerankingZh2En and T2RerankingEn2Zh are cross-language retrieval task
2941
 
2942
  ## Train
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2943
 
2944
+ ### BAAI Embedding
2945
 
2946
+ We pre-train the models using retromae and train them on large-scale pairs data using contrastive learning.
2947
+ **You can fine-tune the embedding model on your data following our [examples](https://github.com/FlagOpen/FlagEmbedding/tree/master/examples/finetune).**
2948
+ We also provide a [pre-train example](https://github.com/FlagOpen/FlagEmbedding/tree/master/examples/pretrain).
2949
+ Note that the goal of pre-training is to reconstruct the text, and the pre-trained model cannot be used for similarity calculation directly, it needs to be fine-tuned.
2950
+ More training details for bge see [baai_general_embedding](https://github.com/FlagOpen/FlagEmbedding/blob/master/FlagEmbedding/baai_general_embedding/README.md).
2951
 
 
2952
 
2953
 
2954
+ ### BGE Reranker
 
 
 
 
 
 
2955
 
2956
+ Cross-encoder will perform full-attention over the input pair,
2957
+ which is more accurate than embedding model (i.e., bi-encoder) but more time-consuming than embedding model.
2958
+ Therefore, it can be used to re-rank the top-k documents returned by embedding model.
2959
+ We train the cross-encoder on a multilingual pair data,
2960
+ The data format is the same as embedding model, so you can fine-tune it easily following our example.
2961
+ More details pelease refer to [./FlagEmbedding/reranker/README.md](./FlagEmbedding/reranker/README.md)
2962
 
2963
 
2964
  ## Contact
2965
+ If you have any question or suggestion related to this project, feel free to open an issue or pull request.
2966
  You also can email Shitao Xiao(stxiao@baai.ac.cn) and Zheng Liu(liuzheng@baai.ac.cn).
2967
 
2968
 
2969
  ## License
2970
+ FlagEmbedding is licensed under the [MIT License](https://github.com/FlagOpen/FlagEmbedding/blob/master/LICENSE). The released models can be used for commercial purposes free of charge.
2971
 
2972
 
2973