BGE Reranker V2 M3 Q4_K_M GGUF

Description

Lightweight reranker model, possesses strong multilingual capabilities, easy to deploy, with fast inference.

Download Copy S3 URI

How to use

import sparknlp
from sparknlp.base import *
from sparknlp.annotator import *
from pyspark.ml import Pipeline
document = DocumentAssembler() \n    .setInputCol("text") \n    .setOutputCol("document")
reranker = AutoGGUFReranker.pretrained("bge_reranker_v2_m3_Q4_K_M") \n    .setInputCols(["document"]) \n    .setOutputCol("reranked_documents") \n    .setBatchSize(4) \n    .setQuery("A man is eating pasta.")
pipeline = Pipeline().setStages([document, reranker])
data = spark.createDataFrame([
    ["A man is eating food."],
    ["A man is eating a piece of bread."],
    ["The girl is carrying a baby."],
    ["A man is riding a horse."]
]).toDF("text")
result = pipeline.fit(data).transform(data)
result.select("reranked_documents").show(truncate = False)
# Each document will have a relevance_score in metadata showing how relevant it is to the query

Model Information

Model Name: bge_reranker_v2_m3_Q4_K_M
Compatibility: Spark NLP 6.1.2+
License: Open Source
Edition: Official
Input Labels: [document]
Output Labels: [reranked_documents]
Language: en
Size: 416.0 MB