Injecting the BM25 Score as Text Improves BERT-Based Re-rankers
Paper • 2301.09728 • Published
How to use Amdestya/ce-cat-distilbert with sentence-transformers:
from sentence_transformers import CrossEncoder
model = CrossEncoder("Amdestya/ce-cat-distilbert")
query = "Which planet is known as the Red Planet?"
passages = [
"Venus is often called Earth's twin because of its similar size and proximity.",
"Mars, known for its reddish appearance, is often referred to as the Red Planet.",
"Jupiter, the largest planet in our solar system, has a prominent red spot.",
"Saturn, famous for its rings, is sometimes mistaken for the Red Planet."
]
scores = model.predict([(query, passage) for passage in passages])
print(scores)MiniLM-L12 cross-encoder reranker trained under the configuration stated in §4 of Askari et al., "Injecting the BM25 Score as Text Improves BERT-Based Re-rankers", ECIR 2023: cross-entropy loss with early stopping on validation nDCG@10.
Paired with Amdestya/ce-bm25cat-distilbert — identical data,
schedule and seed; the arms differ only in the input construction.
text_a = f"{query}"
text_b = passage
# tokenises to: [CLS] query [SEP] passage [SEP]
Matched no-injection baseline. Do NOT inject anything into text_a -- this model has never seen a numeric token there.
from sentence_transformers import CrossEncoder
model = CrossEncoder("Amdestya/ce-cat-distilbert", max_length=256)
Outputs are raw logits (identity activation), unbounded, higher = more relevant.
| objective | cross-entropy on binary relevance |
| optimizer | Adam, lr 7e-06 |
| batch size | 32 |
| length caps | query 30, passage 200 tokens |
| stopping | early stopping on msmarco-passage/trec-dl-2020/judged nDCG@10, patience 3 |
| steps | 100000 |
| best validation nDCG@10 | 0.7016 |
| seed | 42 |
Built as a reference artifact for a dissertation study on reproducing IR papers with LLMs.
Base model
distilbert/distilbert-base-uncased