From: BAAI <huggingface.co/BAAI>Newsgroups: alt.freeweights.embedSubject:

bge-en-icl

Date: 2026-11-14Commit: 971c7e1Signed: 2DC28CC7B26A283B ✓

Feature extraction model with 7.1B parameters. Safetensors weights, 28.4 GB in all. Published by BAAI under Apache-2.0.

7.1B params28.4GBbge-en-iclsafetensorspermissive
FactsParams7.1BSize28.4 GBFormatssafetensorsTaskfeature extractionLicenseApache-2.0From sourcepermissive
$ fw get BAAI/bge-en-icl
# manifest sha256 5ac93350bf20… · 28.4 GB · 17 files
$ fw verify ./bge-en-icl BAAI/bge-en-icl
From sourceHosted (signed)BAAI/bge-en-iclLast check: 2026-11-14 21:08 UTC

Get help: custom fine-tune or private deploy. We review your setup before we quote.

Works with

Evaluate with

Overview

Size
28.4 GB
Weights
28.4 GB (safetensors)
Parameters
7.1B
Formats
safetensors
Task
feature extraction
License
Apache-2.0 (permissive)
Files
17, each with a sha256
Publisher
BAAI
Added
2026-11-14
Section
alt.freeweights.embed
Lineage

Original release from the publisher.

Where these bytes come from
Publisher at the pinned commit→You

Sources are tried in order. A file counts only when its size and sha256 match the manifest. Sources are checked when you ask for them, not on a timer.

Sources
BadgeHostLast checkResult
From sourcehuggingface.co2026-11-14 21:08 UTCpassed

Model card

From the publisher at commit 971c7e1. Shown as plain text with links; images open at the publisher.

FlagEmbedding#

For more details please refer to our Github: FlagEmbedding.

BGE-EN-ICL primarily demonstrates the following capabilities:

  • In-context learning ability: By providing few-shot examples in the query, it can significantly enhance the model's ability to handle new tasks.
  • Outstanding performance: The model has achieved state-of-the-art (SOTA) performance on both BEIR and AIR-Bench.

📑 Open-source Plan#

  • [x] Checkpoint
  • [x] Training Data
  • [x] Technical Report
  • [ ] Evaluation Pipeline

The technical report for BGE-EN-ICL can be found in Making Text Embedders Few-Shot Learners

Data List#

DataIntroduction
public-dataPublic data identical to e5-mistral
full-dataThe full dataset we used for training

Usage#

Using FlagEmbedding#
git clone https://github.com/FlagOpen/FlagEmbedding.git
cd FlagEmbedding
pip install -e .
from FlagEmbedding import FlagICLModel
queries = ["how much protein should a female eat", "summit define"]
documents = [
    "As a general guideline, the CDC's average requirement of protein for women ages 19 to 70 is 46 grams per day. But, as you can see from this chart, you'll need to increase that if you're expecting or training for a marathon. Check out the chart below to see how much protein you should be eating each day.",
    "Definition of summit for English Language Learners. : 1  the highest point of a mountain : the top of a mountain. : 2  the highest level. : 3  a meeting or series of meetings between the leaders of two or more governments."
]
examples = [
  {'instruct': 'Given a web search query, retrieve relevant passages that answer the query.',
   'query': 'what is a virtual interface',
   'response': "A virtual interface is a software-defined abstraction that mimics the behavior and characteristics of a physical network interface. It allows multiple logical network connections to share the same physical network interface, enabling efficient utilization of network resources. Virtual interfaces are commonly used in virtualization technologies such as virtual machines and containers to provide network connectivity without requiring dedicated hardware. They facilitate flexible network configurations and help in isolating network traffic for security and management purposes."},
  {'instruct': 'Given a web search query, retrieve relevant passages that answer the query.',
   'query': 'causes of back pain in female for a week',
   'response': "Back pain in females lasting a week can stem from various factors. Common causes include muscle strain due to lifting heavy objects or improper posture, spinal issues like herniated discs or osteoporosis, menstrual cramps causing referred pain, urinary tract infections, or pelvic inflammatory disease. Pregnancy-related changes can also contribute. Stress and lack of physical activity may exacerbate symptoms. Proper diagnosis by a healthcare professional is crucial for effective treatment and management."}
]
model = FlagICLModel('BAAI/bge-en-icl', 
                     query_instruction_for_retrieval="Given a web search query, retrieve relevant passages that answer the query.",
                     examples_for_task=examples,  # set `examples_for_task=None` to use model without examples
                     use_fp16=True) # Setting use_fp16 to True speeds up computation with a slight performance degradation
embeddings_1 = model.encode_queries(queries)
embeddings_2 = model.encode_corpus(documents)
similarity = embeddings_1 @ embeddings_2.T
print(similarity)

By default, FlagICLModel will use all available GPUs when encoding. Please set os.environ["CUDA_VISIBLE_DEVICES"] to select specific GPUs. You also can set os.environ["CUDA_VISIBLE_DEVICES"]="" to make all GPUs unavailable.

Using HuggingFace Transformers#

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.

import torch
import torch.nn.functional as F

from torch import Tensor
from transformers import AutoTokenizer, AutoModel


def last_token_pool(last_hidden_states: Tensor,
                 attention_mask: Tensor) -> Tensor:
    left_padding = (attention_mask[:, -1].sum() == attention_mask.shape[0])
    if left_padding:
        return last_hidden_states[:, -1]
    else:
        sequence_lengths = attention_mask.sum(dim=1) - 1
        batch_size = last_hidden_states.shape[0]
        return last_hidden_states[torch.arange(batch_size, device=last_hidden_states.device), sequence_lengths]


def get_detailed_instruct(task_description: str, query: str) -> str:
    return f'<instruct>{task_description}\n<query>{query}'

def get_detailed_example(task_description: str, query: str, response: str) -> str:
    return f'<instruct>{task_description}\n<query>{query}\n<response>{response}'

def get_new_queries(queries, query_max_len, examples_prefix, tokenizer):
    inputs = tokenizer(
        queries,
        max_length=query_max_len - len(tokenizer('<s>', add_special_tokens=False)['input_ids']) - len(
            tokenizer('\n<response></s>', add_special_tokens=False)['input_ids']),
        return_token_type_ids=False,
        truncation=True,
        return_tensors=None,
        add_special_tokens=False
    )
    prefix_ids = tokenizer(examples_prefix, add_special_tokens=False)['input_ids']
    suffix_ids = tokenizer('\n<response>', add_special_tokens=False)['input_ids']
    new_max_length = (len(prefix_ids) + len(suffix_ids) + query_max_len + 8) // 8 * 8 + 8
    new_queries = tokenizer.batch_decode(inputs['input_ids'])
    for i in range(len(new_queries)):
        new_queries[i] = examples_prefix + new_queries[i] + '\n<response>'
    return new_max_length, new_queries

task = 'Given a web search query, retrieve relevant passages that answer the query.'
examples = [
  {'instruct': 'Given a web search query, retrieve relevant passages that answer the query.',
   'query': 'what is a virtual interface',
   'response': "A virtual interface is a software-defined abstraction that mimics the behavior and characteristics of a physical network interface. It allows multiple logical network connections to share the same physical network interface, enabling efficient utilization of network resources. Virtual interfaces are commonly used in virtualization technologies such as virtual machines and containers to provide network connectivity without requiring dedicated hardware. They facilitate flexible network configurations and help in isolating network traffic for security and management purposes."},
  {'instruct': 'Given a web search query, retrieve relevant passages that answer the query.',
   'query': 'causes of back pain in female for a week',
   'response': "Back pain in females lasting a week can stem from various factors. Common causes include muscle strain due to lifting heavy objects or improper posture, spinal issues like herniated discs or osteoporosis, menstrual cramps causing referred pain, urinary tract infections, or pelvic inflammatory disease. Pregnancy-related changes can also contribute. Stress and lack of physical activity may exacerbate symptoms. Proper diagnosis by a healthcare professional is crucial for effective treatment and management."}
]
examples = [get_detailed_example(e['instruct'], e['query'], e['response']) for e in examples]
examples_prefix = '\n\n'.join(examples) + '\n\n' # if there not exists any examples, just set examples_prefix = ''
queries = [
    get_detailed_instruct(task, 'how much protein should a female eat'),
    get_detailed_instruct(task, 'summit define')
]
documents = [
    "As a general guideline, the CDC's average requirement of protein for women ages 19 to 70 is 46 grams per day. But, as you can see from this chart, you'll need to increase that if you're expecting or training for a marathon. Check out the chart below to see how much protein you should be eating each day.",
    "Definition of summit for English Language Learners. : 1  the highest point of a mountain : the top of a mountain. : 2  the highest level. : 3  a meeting or series of meetings between the leaders of two or more governments."
]
query_max_len, doc_max_len = 512, 512

tokenizer = AutoTokenizer.from_pretrained('BAAI/bge-en-icl')
model = AutoModel.from_pretrained('BAAI/bge-en-icl')
model.eval()

new_query_max_len, new_queries = get_new_queries(queries, query_max_len, examples_prefix, tokenizer)

query_batch_dict = tokenizer(new_queries, max_length=new_query_max_len, padding=True, truncation=True, return_tensors='pt')
doc_batch_dict = tokenizer(documents, max_length=doc_max_len, padding=True, truncation=True, return_tensors='pt')

with torch.no_grad():
    query_outputs = model(**query_batch_dict)
    query_embeddings = last_token_pool(query_outputs.last_hidden_state, query_batch_dict['attention_mask'])
    doc_outputs = model(**doc_batch_dict)
    doc_embeddings = last_token_pool(doc_outputs.last_hidden_state, doc_batch_dict['attention_mask'])
    
# normalize embeddings
query_embeddings = F.normalize(query_embeddings, p=2, dim=1)
doc_embeddings = F.normalize(doc_embeddings, p=2, dim=1)
scores = (query_embeddings @ doc_embeddings.T) * 100
print(scores.tolist())

Evaluation#

bge-en-icl achieve state-of-the-art performance on both MTEB and AIR-Bench leaderboard!

Image: BEIR

Image: BEIR

QA (en, nDCG@10):

AIR-Bench_24.04wikiwebnewshealthcarelawfinancearxivmsmarcoALL (8)
e5-mistral-7b-instruct61.6744.4148.1856.3219.3254.7944.7859.0348.56
SFR-Embedding-Mistral63.4651.2752.2158.7623.2756.9447.7558.9951.58
NV-Embed-v162.8450.4251.4658.5320.6549.8946.1060.2750.02
Linq-Embed-Mistral61.0448.4149.4460.1820.3450.0447.5660.5049.69
gte-Qwen2-7B-instruct63.4651.2054.0754.2022.3158.2040.2758.3950.26
stella_en_1.5B_v561.9950.8853.8758.8123.2257.2644.8161.3851.53
bge-en-icl zero-shot64.6154.4055.1157.2525.1054.8148.4663.7152.93
bge-en-icl few-shot64.9455.1156.0258.8528.2957.1650.0464.5054.36

Long-Doc (en, Recall@10):

AIR-Bench_24.04arxiv (4)book (2)healthcare (5)law (4)ALL (15)
text-embedding-3-large74.5373.1665.8364.4768.77
e5-mistral-7b-instruct72.1472.4468.4462.9268.49
SFR-Embedding-Mistral72.7972.4167.9464.8369.00
NV-Embed-v177.6575.4972.3869.5573.45
Linq-Embed-Mistral75.4673.8171.5868.5872.11
gte-Qwen2-7B-instruct63.9368.5165.5965.2665.45
stella_en_1.5B_v573.1774.3870.0269.3271.25
bge-en-icl zero-shot78.3078.2173.6567.0973.75
bge-en-icl few-shot79.6379.3674.8067.7974.83

Model List#

bge is short for BAAI general embedding.

ModelLanguageDescriptionquery instruction for retrieval [1]
BAAI/bge-en-iclEnglish-A LLM-based embedding model with in-context learning capabilities, which can fully leverage the model's potential based on a few shot examplesProvide instructions and few-shot examples freely based on the given task.
BAAI/bge-m3MultilingualInference Fine-tuneMulti-Functionality(dense retrieval, sparse retrieval, multi-vector(colbert)), Multi-Linguality, and Multi-Granularity(8192 tokens)
BAAI/llm-embedderEnglishInference Fine-tunea unified embedding model to support diverse retrieval augmentation needs for LLMsSee README
BAAI/bge-reranker-largeChinese and EnglishInference Fine-tunea cross-encoder model which is more accurate but less efficient [2]
BAAI/bge-reranker-baseChinese and EnglishInference Fine-tunea cross-encoder model which is more accurate but less efficient [2]
BAAI/bge-large-en-v1.5EnglishInference Fine-tuneversion 1.5 with more reasonable similarity distributionRepresent this sentence for searching relevant passages:
BAAI/bge-base-en-v1.5EnglishInference Fine-tuneversion 1.5 with more reasonable similarity distributionRepresent this sentence for searching relevant passages:
BAAI/bge-small-en-v1.5EnglishInference Fine-tuneversion 1.5 with more reasonable similarity distributionRepresent this sentence for searching relevant passages:
BAAI/bge-large-zh-v1.5ChineseInference Fine-tuneversion 1.5 with more reasonable similarity distribution为这个句子生成表示以用于检索相关文章:
BAAI/bge-base-zh-v1.5ChineseInference Fine-tuneversion 1.5 with more reasonable similarity distribution为这个句子生成表示以用于检索相关文章:
BAAI/bge-small-zh-v1.5ChineseInference Fine-tuneversion 1.5 with more reasonable similarity distribution为这个句子生成表示以用于检索相关文章:
BAAI/bge-large-enEnglishInference Fine-tune:trophy: rank 1st in MTEB leaderboardRepresent this sentence for searching relevant passages:
BAAI/bge-base-enEnglishInference Fine-tunea base-scale model but with similar ability to bge-large-enRepresent this sentence for searching relevant passages:
BAAI/bge-small-enEnglishInference Fine-tunea small-scale model but with competitive performanceRepresent this sentence for searching relevant passages:
BAAI/bge-large-zhChineseInference Fine-tune:trophy: rank 1st in C-MTEB benchmark为这个句子生成表示以用于检索相关文章:
BAAI/bge-base-zhChineseInference Fine-tunea base-scale model but with similar ability to bge-large-zh为这个句子生成表示以用于检索相关文章:
BAAI/bge-small-zhChineseInference Fine-tunea small-scale model but with competitive performance为这个句子生成表示以用于检索相关文章:

Citation#

If you find this repository useful, please consider giving a star :star: and citation

@misc{li2024makingtextembeddersfewshot,
      title={Making Text Embedders Few-Shot Learners}, 
      author={Chaofan Li and MingHao Qin and Shitao Xiao and Jianlyu Chen and Kun Luo and Yingxia Shao and Defu Lian and Zheng Liu},
      year={2024},
      eprint={2409.15700},
      archivePrefix={arXiv},
      primaryClass={cs.IR},
      url={https://arxiv.org/abs/2409.15700}, 
}
@misc{bge_embedding,
      title={C-Pack: Packaged Resources To Advance General Chinese Embedding}, 
      author={Shitao Xiao and Zheng Liu and Peitian Zhang and Niklas Muennighoff},
      year={2023},
      eprint={2309.07597},
      archivePrefix={arXiv},
      primaryClass={cs.CL}
}

License#

FlagEmbedding is licensed under the MIT License.

Files

17 files · 28.4 GBWeights 28.4 GB (safetensors). Sizes and sha256 from the signed manifest.
Hide all 17 files with their sha256
FileSizesha256
.gitattributes1.52 KB11ad7efa24975ee4b0c3c3a38ed18737f0658a5f75a0a96787b576a78a023361
1_Pooling/config.json289 B143817164f90eb94a190e9cb2f99f8e6946801a2f5bff4dbec03400feb0c9089
README.md68.1 KBab48e567115084dd13670ce2be2a32042308b9aaff2809837fb2f3bbfbcd8d2c
added_tokens.json69 Bbf1ff6bdefaff16c564a2287425c86f703a4fe696447d8717efb030e2969785b
config.json625 B5dd7037206d1dc46c1731ef2ba3dc07a6ec8937a87a5a10d862be8a88c510274
model-00001-of-00003.safetensors9.89 GB551284e17713ba93f9c078ea0b7114788ecc670847651f7e82f55c33a95dfd39
model-00002-of-00003.safetensors10.00 GBe38a3e6db4861026eb6467f88ce6b413e2b487669f9b3cb5b5a140f33b7a7075
model-00003-of-00003.safetensors8.56 GBfcdd47d649e6bd5418d3489eec1cad8ee7fef2f4be7d64a59908ffaac3c60111
model.safetensors.index.json22.2 KB8dfe747b932ce35dd11b3ebc75263409d89851e4b906bc75c47b3c1436b95db1
modules.json229 B8f4b264b80206c830bebbdcae377e137925650a433b689343a63bdc9b3145460
results/BEIR.png90.2 KB9017a9e0f2f50f9f540f449b8c0942e49aad4fc1f7a99060256927392cc32b0e
results/MTEB.png65.9 KBd2ef27937ad41df7545c7c5353a1f1937cd2721a2a7f52017c1434c17429e53c
sentence_bert_config.json55 B1140b92d307aec9383d897169c9f489f3a568787b80bf760f5d7cc9d25169a65
special_tokens_map.json640 B610ed3e64c3a20a96829be0374ccbe7a5189360729fa34ae2b7a831f223a6f56
tokenizer.json1.80 MB1553b589b62de31b3a572262ceac59d6d9033f751c879a7f3670a454beb8a7d9
tokenizer.model493 KBdadfd56d766715c61d2ef780a525ab43b8e6da4de6865bda3d95fdef5e134055
tokenizer_config.json1.55 KB5df672fe94ed895ce93d559988ff5e57c3bbb11de3571029b15f590f1278b5fa
VersionsEach time the pinned upstream commit or file list changed in this repo. Newest first.
Upstream commitDateContents
971c7e1445 pinned now manifest updated, same commit2026-11-14 21:08 UTC17 files · 28.4 GB
971c7e14452026-11-14 21:08 UTC17 files · 28.4 GB

Use it

$ fw get BAAI/bge-en-icl
# manifest sha256 5ac93350bf20… · 28.4 GB · 17 files
$ fw verify ./bge-en-icl BAAI/bge-en-icl
fw.pyChecks the signature and every sha256, tries each source in order, resumes.
$ python3 fw.py get https://freeweights.allternit.com/manifests/BAAI/bge-en-icl.json --dir ./bge-en-icl $ python3 fw.py verify ./bge-en-icl ./BAAI__bge-en-icl.json
hfThe Hugging Face CLI with one setting. Same repo id.
$ HF_ENDPOINT=https://freeweights.allternit.com hf download BAAI/bge-en-icl --revision 971c7e1445cc86656ca0bd85ed770b8675a40bb5 --local-dir ./bge-en-icl
transformersLoad the weights in Python.
import os os.environ["HF_ENDPOINT"] = "https://freeweights.allternit.com" from transformers import AutoModel, AutoTokenizer tok = AutoTokenizer.from_pretrained("BAAI/bge-en-icl", revision="971c7e1445cc86656ca0bd85ed770b8675a40bb5") model = AutoModel.from_pretrained("BAAI/bge-en-icl", revision="971c7e1445cc86656ca0bd85ed770b8675a40bb5", device_map="auto")
sentence-transformersEmbed text with sentence-transformers.
import os os.environ["HF_ENDPOINT"] = "https://freeweights.allternit.com" from sentence_transformers import SentenceTransformer model = SentenceTransformer("BAAI/bge-en-icl", revision="971c7e1445cc86656ca0bd85ed770b8675a40bb5") vectors = model.encode(["Hello"])

License

Name
Apache License 2.0
Id
Apache-2.0
Class
Permissive
Redistribution
yes
Listing
Hosted (signed)
Decided
License as declared by the publisher. No person read it. 2026-11-14
Text in
README.md
Text sha256
ab48e567115084dd13670ce2be2a32042308b9aaff2809837fb2f3bbfbcd8d2c
Terms gate
No extra terms beyond the license.

Read the license text

Licenses are checked against the license table. A custom license passes only after a person reads it.

Provenance

From: BAAI <huggingface.co/BAAI>Newsgroups: alt.freeweights.embedSubject: bge-en-iclDate: 2026-11-14Commit: 971c7e1Signed: 2DC28CC7B26A283B ✓
Upstream
BAAI/bge-en-icl
Pinned commit
971c7e1445cc86656ca0bd85ed770b8675a40bb5
Manifest
bge-en-icl.json · .minisig
Manifest sha256
5ac93350bf20779f7feb90a069accad5ef7be54cb1fc9f374d99b2527103a3ad
Signature
minisign, Ed25519, key 2DC28CC7B26A283B
Created
2026-11-14 21:08 UTC
Generator
freeweights-manifest/0.1.0
Takedowns
None.

How to verify

$ curl -O https://freeweights.allternit.com/manifests/BAAI/bge-en-icl.json $ curl -O https://freeweights.allternit.com/manifests/BAAI/bge-en-icl.json.minisig $ minisign -Vm bge-en-icl.json -P RWQ7KGqyx4zCLXtUFOqvfv8L3g+8fpKJ1FsuxPyOYMF+4KufbUxKq1Oq $ shasum -a 256 <file> # compare with the Files tab

A manifest whose signature fails must be rejected. A file whose size or sha256 does not match must be discarded. Verify a download

Model tree

No related models in this catalog.Nothing here lists this model as its parent, and it names no parent.
Get it
Download
$ HF_ENDPOINT=https://freeweights.allternit.com hf download BAAI/bge-en-icl
Open in Freeweights Studio

Pull, verify and run it in the Allternit app on Desktop, web or phone.

Signed manifest
minisign, key 2DC28CC7B26A283B. bge-en-icl.json. Provenance. Takedown history: none.
From: sentence-transformers <huggingface.co/sentence-transformers>Subject: all-MiniLM-L6-v1
From: unsloth <huggingface.co/unsloth>Subject: all-MiniLM-L6-v2
From: mlx-community <huggingface.co/mlx-community>Subject: all-MiniLM-L6-v2-4bit
From: sentence-transformers <huggingface.co/sentence-transformers>Subject: all-mpnet-base-v1
From: sentence-transformers <huggingface.co/sentence-transformers>Subject: allenai-specter
From: sentence-transformers <huggingface.co/sentence-transformers>Subject: bert-base-nli-max-tokens