Datasets:
Modalities:
Text
Formats:
json
Size:
< 1K
ArXiv:
Tags:
benchmark
long-context
multi-hop-reasoning
source-internal-reasoning
evidence-withheld
document-qa
License:
Add Gemini-native judge compatibility to eval harness
Browse files- eval/config.json +1 -1
- eval/run_judge.py +41 -8
eval/config.json
CHANGED
|
@@ -15,7 +15,7 @@
|
|
| 15 |
"default": {"en": 2850000, "cjk": 850000}
|
| 16 |
},
|
| 17 |
|
| 18 |
-
"_judges_note": "3 non-contestant judges, averaged. The paper used Claude-Sonnet-4.6, Qwen3.5, and Gemini-2.5-Flash.
|
| 19 |
"judges": [
|
| 20 |
{"name": "sonnet", "base_url": "https://api.openai.com/v1/chat/completions", "model": "claude-sonnet-4-6", "api_key_env": "API_KEY", "max_tokens": 16384},
|
| 21 |
{"name": "qwen3.5", "base_url": "https://api.openai.com/v1/chat/completions", "model": "qwen3.5-plus", "api_key_env": "API_KEY", "max_tokens": 16384},
|
|
|
|
| 15 |
"default": {"en": 2850000, "cjk": 850000}
|
| 16 |
},
|
| 17 |
|
| 18 |
+
"_judges_note": "3 non-contestant judges, averaged. The paper used Claude-Sonnet-4.6, Qwen3.5, and Gemini-2.5-Flash. Chat endpoints are the default; for gateways exposing Gemini through native contents/candidates payloads, set api_type to gemini_native on that judge. api_key_env defaults to the top-level one if omitted. List one judge to grade with a single judge (the paper headline is the 3-judge average).",
|
| 19 |
"judges": [
|
| 20 |
{"name": "sonnet", "base_url": "https://api.openai.com/v1/chat/completions", "model": "claude-sonnet-4-6", "api_key_env": "API_KEY", "max_tokens": 16384},
|
| 21 |
{"name": "qwen3.5", "base_url": "https://api.openai.com/v1/chat/completions", "model": "qwen3.5-plus", "api_key_env": "API_KEY", "max_tokens": 16384},
|
eval/run_judge.py
CHANGED
|
@@ -7,8 +7,10 @@ exclusion). out_of_context_scope answers stay 0 (the model could not ingest the
|
|
| 7 |
|
| 8 |
Panel used in the paper (deliberately models NOT on the leaderboard):
|
| 9 |
Claude-Sonnet-4.6 · Qwen3.5 · Gemini-2.5-Flash
|
| 10 |
-
Supply your own judge endpoints in config.json -> "judges"
|
| 11 |
-
|
|
|
|
|
|
|
| 12 |
|
| 13 |
Output: results/<model>.scores.json
|
| 14 |
{ "per_judge": {judge: {qid: score_0_1}}, "average": {qid: mean_score}, "overall": pct }
|
|
@@ -37,6 +39,41 @@ def post(url, key, payload, timeout=180):
|
|
| 37 |
return None
|
| 38 |
|
| 39 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 40 |
def build_judge_prompt(question, rubric, response):
|
| 41 |
if isinstance(rubric, str):
|
| 42 |
try: rubric = ast.literal_eval(rubric)
|
|
@@ -65,14 +102,10 @@ def parse_total(content):
|
|
| 65 |
def judge_one(judge_cfg, key, question, rubric, response):
|
| 66 |
"""One judge's score in [0,1], or None on failure. total is a 0-100 sum -> /100, capped at 1."""
|
| 67 |
prompt = build_judge_prompt(question, rubric, response)
|
| 68 |
-
data = post(judge_cfg["base_url"], key,
|
| 69 |
-
{"model": judge_cfg["model"], "messages": [{"role": "user", "content": prompt}],
|
| 70 |
-
"max_tokens": judge_cfg.get("max_tokens", 16384), "temperature": 0.1})
|
| 71 |
if not data:
|
| 72 |
return None
|
| 73 |
-
content = (data
|
| 74 |
-
if not content and isinstance(data.get("content"), list): # Anthropic-native content blocks
|
| 75 |
-
content = "".join(b.get("text", "") for b in data["content"] if b.get("type") == "text")
|
| 76 |
tot = parse_total(content)
|
| 77 |
return None if tot is None else min(tot / 100.0, 1.0)
|
| 78 |
|
|
|
|
| 7 |
|
| 8 |
Panel used in the paper (deliberately models NOT on the leaderboard):
|
| 9 |
Claude-Sonnet-4.6 · Qwen3.5 · Gemini-2.5-Flash
|
| 10 |
+
Supply your own judge endpoints in config.json -> "judges". OpenAI-compatible chat endpoints are
|
| 11 |
+
the default; gateways that expose Gemini through native `contents`/`candidates` payloads can set
|
| 12 |
+
`"api_type": "gemini_native"` on that judge. Using a single judge is supported (list one) but the
|
| 13 |
+
paper headline is the 3-judge average.
|
| 14 |
|
| 15 |
Output: results/<model>.scores.json
|
| 16 |
{ "per_judge": {judge: {qid: score_0_1}}, "average": {qid: mean_score}, "overall": pct }
|
|
|
|
| 39 |
return None
|
| 40 |
|
| 41 |
|
| 42 |
+
def build_payload(judge_cfg, prompt):
|
| 43 |
+
api_type = judge_cfg.get("api_type", "chat")
|
| 44 |
+
max_tokens = judge_cfg.get("max_tokens", 16384)
|
| 45 |
+
temperature = judge_cfg.get("temperature", 0.1)
|
| 46 |
+
if api_type == "gemini_native":
|
| 47 |
+
return {
|
| 48 |
+
"model": judge_cfg["model"],
|
| 49 |
+
"contents": [{"role": "user", "parts": [{"text": prompt}]}],
|
| 50 |
+
"generationConfig": {
|
| 51 |
+
"maxOutputTokens": max_tokens,
|
| 52 |
+
"temperature": temperature,
|
| 53 |
+
},
|
| 54 |
+
}
|
| 55 |
+
return {
|
| 56 |
+
"model": judge_cfg["model"],
|
| 57 |
+
"messages": [{"role": "user", "content": prompt}],
|
| 58 |
+
"max_tokens": max_tokens,
|
| 59 |
+
"temperature": temperature,
|
| 60 |
+
}
|
| 61 |
+
|
| 62 |
+
|
| 63 |
+
def response_content(data):
|
| 64 |
+
content = (data.get("choices", [{}])[0].get("message", {}) or {}).get("content", "")
|
| 65 |
+
if not content and isinstance(data.get("content"), list): # Anthropic-native content blocks
|
| 66 |
+
content = "".join(b.get("text", "") for b in data["content"] if b.get("type") == "text")
|
| 67 |
+
if not content and isinstance(data.get("candidates"), list): # Gemini-native candidates
|
| 68 |
+
parts = []
|
| 69 |
+
for cand in data["candidates"]:
|
| 70 |
+
for part in ((cand.get("content") or {}).get("parts") or []):
|
| 71 |
+
if part.get("text"):
|
| 72 |
+
parts.append(part["text"])
|
| 73 |
+
content = "".join(parts)
|
| 74 |
+
return content
|
| 75 |
+
|
| 76 |
+
|
| 77 |
def build_judge_prompt(question, rubric, response):
|
| 78 |
if isinstance(rubric, str):
|
| 79 |
try: rubric = ast.literal_eval(rubric)
|
|
|
|
| 102 |
def judge_one(judge_cfg, key, question, rubric, response):
|
| 103 |
"""One judge's score in [0,1], or None on failure. total is a 0-100 sum -> /100, capped at 1."""
|
| 104 |
prompt = build_judge_prompt(question, rubric, response)
|
| 105 |
+
data = post(judge_cfg["base_url"], key, build_payload(judge_cfg, prompt))
|
|
|
|
|
|
|
| 106 |
if not data:
|
| 107 |
return None
|
| 108 |
+
content = response_content(data)
|
|
|
|
|
|
|
| 109 |
tot = parse_total(content)
|
| 110 |
return None if tot is None else min(tot / 100.0, 1.0)
|
| 111 |
|