Model reference · open weights

bge-en-icl

Available as managed deployment Embeddings BAAI Embeddings 1 variants 15k dl/mo

bge-en-icl is an open-weight embedding model from BAAI. AxForge deploys and operates it for you on dedicated EU-owned hardware — with the licence handled where one is required.

Available as managed deployment — configured and operated for you on dedicated EU hardware, quoted per deployment.

What it is

MakerBAAI
TypeEmbedding models
TaskEmbeddings
Parameters (lead)7.1B
Context32k tokens
Runs withsentence-transformers
Released2024-07-25
Popularity15k downloads / month
LicenceOpen weights

About

What bge-en-icl is

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'{task_description}\n{query}'

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

def get_new_queries(queries, query_max_len, examples_prefix, tokenizer):
    inputs = tokenizer(
        queries,
        max_length=query_max_len - len(tokenizer('', add_special_tokens=False)['input_ids']) - len(
            tokenizer('\n', 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', add_special_tokens=False)['input_ids']
    new_max_length = (len(prefix_ids) + len(suffix_ids) + query_max_len + 8) // 8

From the published model card. Full card on the HuggingFace links in the sidebar.

Benchmarks

Reported results

As published on the model card — the maker's own numbers, not measured by AxForge.

TaskDatasetMetricScore
ClassificationMTEB AmazonCounterfactualClassification (en)accuracy93.149
ClassificationMTEB AmazonCounterfactualClassification (en)ap72.561
ClassificationMTEB AmazonCounterfactualClassification (en)f189.718
ClassificationMTEB AmazonCounterfactualClassification (en)main_score93.149
ClassificationMTEB AmazonPolarityClassificationaccuracy96.984
ClassificationMTEB AmazonPolarityClassificationap95.623
ClassificationMTEB AmazonPolarityClassificationf196.983
ClassificationMTEB AmazonPolarityClassificationmain_score96.984
ClassificationMTEB AmazonReviewsClassification (en)accuracy61.462
ClassificationMTEB AmazonReviewsClassification (en)f160.573
ClassificationMTEB AmazonReviewsClassification (en)main_score61.462
RetrievalMTEB ArguAnamain_score83.080
RetrievalMTEB ArguAnandcg_at_166.501
RetrievalMTEB ArguAnandcg_at_380.109
RetrievalMTEB ArguAnandcg_at_581.897
RetrievalMTEB ArguAnandcg_at_1083.080
RetrievalMTEB ArguAnandcg_at_10083.599
RetrievalMTEB ArguAnandcg_at_100083.599
RetrievalMTEB ArguAnamap_at_166.501
RetrievalMTEB ArguAnamap_at_376.837
RetrievalMTEB ArguAnamap_at_577.847
RetrievalMTEB ArguAnamap_at_1078.355
RetrievalMTEB ArguAnamap_at_10078.474
RetrievalMTEB ArguAnamap_at_100078.474

Using it via the API

Call it like any OpenAI endpoint

Once AxForge deploys bge-en-icl for you, it answers on the OpenAI-compatible API — the same base URL and keys as every other model. (bge-en-icl below is illustrative; you get the exact model name on deployment.)

$ curl -sS https://api.axforge.ai/v1/embeddings \
  -H "Authorization: Bearer $AXFORGE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model":"bge-en-icl","input":"text to embed"}'

Create an account — your API key is available in the console. 5M tokens/month currently included with every new account at launch.

© 2026 AxForge · EU-hosted AI infrastructure Pricing Docs Trust Privacy Terms