Views
No views yet
1git clone https://github.com/artefactory/BERT-as-a-Judge.git
2cd BERT-as-a-Judge
3pip install -e .1from bert_judge.judges import BERTJudge
2
3# 1) Initialize the judge
4judge = BERTJudge(
5 model_path="artefactory/BERTJudge",
6 trust_remote_code=True,
7 dtype="bfloat16",
8)
9
10# 2) Define one question, one reference, and several candidate answers
11question = "What is the capital of France?"
12reference = "Paris"
13candidates = [
14 "Paris.",
15 "The capital of France is Paris.",
16 "I'm hesitating between Paris and London. I would say Paris.",
17 "London.",
18 "The capital of France is London.",
19 "I'm hesitating between Paris and London. I would say London.",
20]
21
22# 3) Predict scores (one score per candidate)
23scores = judge.predict(
24 questions=[question] * len(candidates),
25 references=[reference] * len(candidates),
26 candidates=candidates,
27 batch_size=1,
28)
29
30print(scores)BERTJudge-<Candidate_Format>-<Input_Structure>-<Additional_Info>.Free: Trained on unconstrained model generations.Formatted: Trained on outputs that adhere to specific structural constraints. For optimized evaluation under the formatted setup, candidate outputs should ideally conclude with "Final answer: <final_answer>" (see the paper for details).QCR: The input sequence consists of [Question, Candidate, Reference].CR: The input sequence consists only of [Candidate, Reference].OOD: Indicates evaluation of Out-of-Distribution performance (where specific generative models were withheld during training).100k/200k/500k: Denotes the total training steps (default regime being 1 million).BERTJudge-Free-QCR, available as artefactory/BERTJudge.@article{gisserotboukhlef2026bertasajudgerobustalternativelexical,
title={BERT-as-a-Judge: A Robust Alternative to Lexical Methods for Efficient Reference-Based LLM Evaluation},
author={Gisserot-Boukhlef, Hippolyte and Boizard, Nicolas and Malherbe, Emmanuel and Hudelot, C{\'e}line and Colombo, Pierre},
year={2026},
eprint={2604.09497},
archivePrefix={arXiv},
primaryClass={cs.CL},
url={https://arxiv.org/abs/2604.09497}
}