This reranking model is built from
cmarkea/bloomz-560m-dpo-chat
model and aims to measure the semantic correspondence
between a question (query) and a context. With its normalized scoring, it helps to filter the query/context matchings outputted by a retriever in an ODQA (Open-Domain
Question Answering) context. Moreover, it allows to reorder the results using a more efficient modeling approach than the retriever one. However, this modeling type is
not conducive to direct database searching due to its high computational cost.
Developed to be language-agnostic, this model supports both French and English. Consequently, it can effectively score in a cross-language context without being
influenced by its behavior in a monolingual context (English or French).
Dataset
The training dataset is composed of the
mMARCO
dataset, consisting of query/positive/hard negative triplets.
Additionally, we have included
SQuAD
data from the "train" split, forming query/positive/hard negative triplets. In
order to generate hard negative data for SQuAD, we considered contexts from the same theme as the query but from a different set of queries. Hence, the negative
observations belong to the same themes as the queries but presumably do not contain the answer to the question.
Finally, the triplets are flattened to obtain pairs of query/context sentences with a label 1 if query/positive and a label 0 if query/negative. In each element of the
pair (query and context), the language, French or English, is randomly and uniformly chosen.
Evaluation
To assess the performance of the reranker, we will make use of the "validation" split of the
SQuAD
dataset. We will
select the first question from each paragraph, along with the paragraph constituting the context that should be ranked Top-1 for an Oracle modeling. What's intriguing
is that the number of themes is limited, and each context from a corresponding theme that does not match the query is considered as a hard negative (other contexts
outside the theme are simple negatives). Thus, we can construct the following table, with each theme showing the number of contexts and associated query:
Theme name
Context number
Theme name
Context number
Normans
39
Civil_disobedience
26
Computational_complexity_theory
48
Construction
22
Southern_California
39
Private_school
26
Sky_(United_Kingdom)
22
Harvard_University
30
Victoria_(Australia)
25
Jacksonville,_Florida
21
Huguenot
44
Economic_inequality
44
Steam_engine
46
University_of_Chicago
37
Oxygen
43
Yuan_dynasty
47
1973_oil_crisis
24
Immune_system
49
European_Union_law
40
Intergovernmental_Panel_on_Climate_Change
24
Amazon_rainforest
21
Prime_number
31
Ctenophora
31
Rhine
44
Fresno,_California
28
Scottish_Parliament
39
Packet_switching
23
Islamism
39
Black_Death
23
Imperialism
39
Geology
25
Warsaw
49
Pharmacy
26
French_and_Indian_War
46
Force
44
The evaluation corpus consists of 1204 pairs of query/context to be ranked.
Firstly, the evaluation scores were computed in cases where both the query and the context are in the same language (French/French).
As observed, the cross-language context does not significantly impact the behavior of our models. If the model were used in a context of reranking and filtering the
Top-K results from a search, a threshold of 0.8 could be applied to filter the contexts outputted by the retriever, thereby reducing noise issues present in the contexts
for RAG-type applications.
How to Use Bloomz-560m-reranking
The following example is based on the API Pipeline of the Transformers library.
from transformers import pipeline
reranker = pipeline(
task='feature-extraction',
model='cmarkea/bloomz-560m-reranking',
top_k=None
)
similarities = reranker(
[
dict(
text=context, # the model was trained with context in `text`
text_pair=query # and query in `text_pair` argument.
)
for context in contexts
]
)
contexts_reranked = sorted(
filter(
lambda x: x[0]['label'] == "LABEL_1",
zip(similarities, contexts)
),
key=lambda x: x[0],
reverse=True
)
score, contexts_cleaned = zip(
*filter(
lambda x: x[0] >= 0.8,
contexts_reranked
)
)
bloomz-560m-reranking huggingface.co is an AI model on huggingface.co that provides bloomz-560m-reranking's model effect (), which can be used instantly with this cmarkea bloomz-560m-reranking model. huggingface.co supports a free trial of the bloomz-560m-reranking model, and also provides paid use of the bloomz-560m-reranking. Support call bloomz-560m-reranking model through api, including Node.js, Python, http.
bloomz-560m-reranking huggingface.co is an online trial and call api platform, which integrates bloomz-560m-reranking's modeling effects, including api services, and provides a free online trial of bloomz-560m-reranking, you can try bloomz-560m-reranking online for free by clicking the link below.
cmarkea bloomz-560m-reranking online free url in huggingface.co:
bloomz-560m-reranking is an open source model from GitHub that offers a free installation service, and any user can find bloomz-560m-reranking on GitHub to install. At the same time, huggingface.co provides the effect of bloomz-560m-reranking install, users can directly use bloomz-560m-reranking installed effect in huggingface.co for debugging and trial. It also supports api for free installation.
bloomz-560m-reranking install url in huggingface.co: