Downloads · 30 days
297
7% of all-time downloads
naver/xprovence-reranker-bgem3-v2
xprovence-reranker-bgem3-v2 is a text ranking model from naver. Use it for the text ranking task on the model card, and read the license before you ship it in a product. It is set up for transformers. The card lists the license as cc-by-nc-nd-4.0.
<img src="https://cdn-uploads.huggingface.co/production/uploads/6273df31c3b822dad2d1eef2/4n-bxYfiMPC2LoLM2m7pg.png" alt="image/png" width="600"
Downloads · 30 days
297
7% of all-time downloads
All-time downloads
4.5K
Public
Parameters
568M
2.3 GB on disk
Likes
18
Public
Click a slice to open those files.
.safetensors2.3 GB · 99%
From the Hugging Face model README
XProvence is a Zero Cost context pruning model that seamlessly integrates with reranker for retrieval-augmented generation, particularly optimized for question answering. Given a user question and a retrieved passage, XProvence removes sentences from the passage that are not relevant to the user question. This speeds up generation and reduces context noise, in a plug-and-play manner for any LLM.
XProvence is a multilingual version of Provence supporting 16 languages natively. It also supports 100+ languages through cross lingual transfer, since it is based on BGE-m3 which is pretrained on 100+ languages.
Paper: XProvence: Zero-Cost Multilingual Context Pruning for Retrieval-Augmented Generation (ECIR'26)
Developed by: Naver Labs Europe
License: XProvence is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 license [CC BY-NC-ND 4.0 license].
License file
XProvenceTraining and evaluation code & data are available in the Bergen repo
XProvence uses spacy:
pip install spacy
python -m spacy download xx_sent_ud_sm
Pruning a single context for a single question:
from transformers import AutoModel
xprovence = AutoModel.from_pretrained("naver/xprovence-reranker-bgem3-v2", trust_remote_code=True)
context = "Shepherd’s pie. History. In early cookery books, the dish was a means of using leftover roasted meat of any kind, and the pie dish was lined on the sides and bottom with mashed potato, as well as having a mashed potato crust on top. Variations and similar dishes. Other potato-topped pies include: The modern ”Cumberland pie” is a version with either beef or lamb and a layer of bread- crumbs and cheese on top. In medieval times, and modern-day Cumbria, the pastry crust had a filling of meat with fruits and spices.. In Quebec, a varia- tion on the cottage pie is called ”Paˆte ́ chinois”. It is made with ground beef on the bottom layer, canned corn in the middle, and mashed potato on top.. The ”shepherdess pie” is a vegetarian version made without meat, or a vegan version made without meat and dairy.. In the Netherlands, a very similar dish called ”philosopher’s stew” () often adds ingredients like beans, apples, prunes, or apple sauce.. In Brazil, a dish called in refers to the fact that a manioc puree hides a layer of sun-dried meat."
question = 'What goes on the bottom of Shepherd’s pie?'
xprovence_output = xprovence.process(question, context)
# print(f"XProvence Output: {xprovence_output}")
# XProvence Output: {'pruned_context': 'In early cookery books, the dish was a means of using leftover roasted meat of any kind, and the pie dish was lined on the sides and bottom with mashed potato, as well as having a mashed potato crust on top. It is made with ground beef on the bottom layer, canned corn in the middle, and mashed potato on top.. The ”shepherdess pie” is a vegetarian version made without meat, or a vegan version made without meat and dairy..', 'reranking_score': 3.260809, 'compression_rate': 59.50334288443171}
You can also pass a list of questions and a list of lists of contexts (multiple contexts per question to be pruned) for batched processing.
Setting always_select_title=True will keep the first sentence "Shepherd’s pie". This is especially useful for Wikipedia articles where the title is often needed to understand the context.
More details on how the title is defined are given below.
xprovence_output = xprovence.process(question, context, always_select_title=True)
# print(f"XProvence Output: {xprovence_output}")
# XProvence Output: {'pruned_context': 'Shepherd’s pie. In early cookery books, the dish was a means of using leftover roasted meat of any kind, and the pie dish was lined on the sides and bottom with mashed potato, as well as having a mashed potato crust on top. It is made with ground beef on the bottom layer, canned corn in the middle, and mashed potato on top.. The ”shepherdess pie” is a vegetarian version made without meat, or a vegan version made without meat and dairy..', 'reranking_score': 3.260809, 'compression_rate': 57.97516714422159}
Interface of the process function:
question: Union[List[str], str]: an input question (str) or a list of input questions (for batched processing)context: Union[List[List[str]], str]: context(s) to be pruned. This can be either a single string (in case of a singe str question), or a list of lists contexts (a list of contexts per question), with len(contexts) equal to len(questions)title: Optional[Union[List[List[str]], str]], default: “first_sentence”: an optional argument for defining titles. If title=first_sentence, then the first sentence of each context is assumed to be the title. If title=None, then it is assumed that no titles are provided. Titles can be also passed as a list of lists of str, i.e. titles shaped the same way as contexts. Titles are only used if always_select_title=True.threshold (float, \(\in [0, 1]\), default 0.3): which threshold to use for context pruning. We recommend 0.3 for more conservative pruning (no performance drop or lowest performance drops) and 0.7 for higher compression, but this value can be further tuned to meet the specific use case requirements.always_select_title (bool, default: True): if True, the first sentence (title) will be included into the selection each time the model select a non-empty selection of sentences. This is important, e.g., for Wikipedia passages, to provide proper contextualization for the next sentences.batch_size (int, default: 32)reorder (bool, default: False): if True, the provided contexts for each question will be reordered according to the computed question-passage relevance scores. If False, the original user-provided order of contexts will be preserved.top_k (int, default: 5): if reorder=True, specifies the number of top-ranked passages to keep for each question.enable_warnings (bool, default: True): whether the user prefers the warning about model usage to be printed, e.g. too long contexts or questions.This work is licensed under CC BY-NC-ND 4.0.
@misc{mohamed2026xprovence,
title={XProvence: Zero-Cost Multilingual Context Pruning for Retrieval-Augmented Generation},
author={Mohamed, Youssef and Elhoseiny, Mohamed and Formal, Thibault and Chirkova, Nadezhda},
year={2026},
eprint={2601.18886},
archivePrefix={arXiv},
primaryClass={cs.CL},
url={https://arxiv.org/abs/2601.18886},
}