BAAI/bge-reranker-v2-m3

BAAI/bge-reranker-v2-m3 is a lightweight reranker model with strong multilingual capabilities. It’s easy to deploy and offers fast inference.

Model details

CategoryDetails
Model NameBAAI/bge-reranker-v2-m3
VersionOriginal
Model CategoryReranker
Size568M parameters
HuggingFace ModelBAAI/bge-reranker-v2-m3
LicenseApache 2.0

Capabilities

FeatureDetails
Azion Long-term Support (LTS)
Context Length8k tokens
Supports LoRA
Input dataText

Usage

Rerank example

This is an example of a basic rerank request using this model:

const modelResponse = await Azion.AI.run("baai-bge-reranker-v2-m3", {
"query": "What is deep learning?",
"documents": [
"Deep learning is a subset of machine learning that uses neural networks with many layers",
"The weather is nice today",
"Deep learning enables computers to learn from large amounts of data",
"I like pizza"
]
})
PropertyTypeDescription
querystringThe search query or prompt to rank the documents against.
documentsstring[]An array of documents to be ranked based on their relevance to the query.

Score example

This is an example of a basic score request using this model:

const modelResponse = await Azion.AI.run("baai-bge-reranker-v2-m3", {
"text_1": "What is deep learning?",
"text_2": [
"Deep learning is a subset of machine learning that uses neural networks with many layers",
"The weather is nice today",
"Deep learning enables computers to learn from large amounts of data",
"I like pizza"
]
})
PropertyTypeDescription
text_1stringThe first text input for the model to process.
text_2string[]An array of text inputs for the model to process and give a score.

Response example:

{
"id": "rerank-356bf11f0e794f3c8f726bec7ba698bb",
"model": "baai-bge-reranker-v2-m3",
"usage": {
"total_tokens": 78
},
"results": [
{
"index": 0,
"document": {
"text": "Deep learning is a subset of machine learning that uses neural networks with many layers"
},
"relevance_score": 0.99951171875
},
{
"index": 2,
"document": {
"text": "Deep learning enables computers to learn from large amounts of data"
},
"relevance_score": 0.98291015625
},
{
"index": 3,
"document": {
"text": "I like pizza"
},
"relevance_score": 0.00001621246337890625
},
{
"index": 1,
"document": {
"text": "The weather is nice today"
},
"relevance_score": 0.000016033649444580078
}
]
}
PropertyTypeDescription
idstringUnique identifier for the rerank request.
modelstringThe name of the model used for reranking.
usage.total_tokensnumberThe total number of tokens used in the request.
results[]object[]An array of reranked result objects.
results[].indexnumberThe index of the document in the input list.
results[].documentobjectThe document object containing the text.
results[].document.textstringThe textual content of the document.
results[].relevance_scorenumberThe relevance score assigned to the document by the model.

JSON schema

{
"$schema": "http://json-schema.org/draft-07/schema#",
"type": "object",
"required": [
"query",
"documents"
],
"properties": {
"query": {
"type": "string"
},
"documents": {
"type": "array",
"items": {
"type": "string"
}
},
"top_n": {
"type": "integer"
},
"max_tokens_per_doc": {
"type": "integer"
}
}
}