release: Mantoz — population-scale evaluation with simulated personas
This commit is contained in:
@@ -0,0 +1,4 @@
|
||||
FROM python:3.13-alpine
|
||||
# ponytail: POSIX verifier only; replace shim with bash package if scripts need Bash syntax.
|
||||
RUN printf '#!/bin/sh\nexec /bin/sh "$@"\n' > /bin/bash && chmod +x /bin/bash
|
||||
WORKDIR /app
|
||||
@@ -0,0 +1,3 @@
|
||||
Ответьте: почему кофе часто воспринимается горьким?
|
||||
|
||||
Запишите свободный ответ в UTF-8 в `/app/answer.txt`. Не пишите туда JSON или служебный текст.
|
||||
@@ -0,0 +1,25 @@
|
||||
{
|
||||
"question": "Почему кофе часто воспринимается горьким?",
|
||||
"max_score": 10,
|
||||
"pass_score": 6,
|
||||
"criteria": [
|
||||
{
|
||||
"id": "caffeine",
|
||||
"weight": 4,
|
||||
"terms": ["кофеин"],
|
||||
"stems": ["кофеин"]
|
||||
},
|
||||
{
|
||||
"id": "chlorogenic_acids",
|
||||
"weight": 4,
|
||||
"terms": ["хлорогеновые кислоты", "хлорогеновых кислот"],
|
||||
"stems": ["хлороген", "кислот"]
|
||||
},
|
||||
{
|
||||
"id": "causal_explanation",
|
||||
"weight": 2,
|
||||
"terms": ["потому что", "из-за"],
|
||||
"stems": ["из-за"]
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
schema_version = "1.4"
|
||||
|
||||
[metadata]
|
||||
title = "open-answer"
|
||||
environment = "open-answer"
|
||||
|
||||
[verifier]
|
||||
timeout_sec = 300.0
|
||||
|
||||
[agent]
|
||||
timeout_sec = 300.0
|
||||
|
||||
[environment]
|
||||
build_timeout_sec = 600.0
|
||||
@@ -0,0 +1,25 @@
|
||||
{
|
||||
"question": "Почему кофе часто воспринимается горьким?",
|
||||
"max_score": 10,
|
||||
"pass_score": 6,
|
||||
"criteria": [
|
||||
{
|
||||
"id": "caffeine",
|
||||
"weight": 4,
|
||||
"terms": ["кофеин"],
|
||||
"stems": ["кофеин"]
|
||||
},
|
||||
{
|
||||
"id": "chlorogenic_acids",
|
||||
"weight": 4,
|
||||
"terms": ["хлорогеновые кислоты", "хлорогеновых кислот"],
|
||||
"stems": ["хлороген", "кислот"]
|
||||
},
|
||||
{
|
||||
"id": "causal_explanation",
|
||||
"weight": 2,
|
||||
"terms": ["потому что", "из-за"],
|
||||
"stems": ["из-за"]
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,68 @@
|
||||
#!/bin/sh
|
||||
# Task-owned рубричный верификатор. Два разных профиля, сырьё и
|
||||
# расхождение
|
||||
# сохраняются рядом с reward для последующего спора по вердикту.
|
||||
mkdir -p /logs/verifier
|
||||
python3 - <<'PY'
|
||||
import json
|
||||
import re
|
||||
from pathlib import Path
|
||||
|
||||
# ponytail: файл рубрики продублирован: Harbor монтирует только tests/;
|
||||
# убрать копию, когда verifier получит read-only mount корня задачи.
|
||||
rubric = json.loads(Path("/tests/rubric.yaml").read_text("utf-8"))
|
||||
|
||||
|
||||
def opinion(judge_id, answer, stem_mode=False):
|
||||
text = " ".join(answer.casefold().split())
|
||||
score = 0
|
||||
passed, missed = [], []
|
||||
for criterion in rubric["criteria"]:
|
||||
criterion_id = criterion["id"]
|
||||
terms, stems = criterion["terms"], criterion["stems"]
|
||||
if stem_mode:
|
||||
found = all(stem in text for stem in stems)
|
||||
else:
|
||||
found = any(
|
||||
re.search(rf"(?<!\w){re.escape(term)}(?!\w)", text)
|
||||
for term in terms
|
||||
)
|
||||
(passed if found else missed).append(criterion_id)
|
||||
score += criterion["weight"] if found else 0
|
||||
rationale = (
|
||||
f"найдены: {', '.join(passed) or 'нет'}; "
|
||||
f"не найдены: {', '.join(missed) or 'нет'}"
|
||||
)
|
||||
raw = json.dumps(
|
||||
{"judge": judge_id, "score": score, "rationale": rationale},
|
||||
ensure_ascii=False,
|
||||
)
|
||||
return {"id": judge_id, "score": score, "rationale": rationale, "raw": raw}
|
||||
|
||||
|
||||
try:
|
||||
answer = Path("/app/answer.txt").read_text("utf-8").strip()
|
||||
except (OSError, UnicodeDecodeError):
|
||||
answer = ""
|
||||
judges = [opinion("rules-exact-v1", answer), opinion("rules-stem-v1", answer, True)]
|
||||
scores = [judge["score"] for judge in judges]
|
||||
score = sum(scores) / len(scores)
|
||||
disagreement = max(scores) - min(scores)
|
||||
verdict = {
|
||||
"score": score,
|
||||
"rationale": (
|
||||
f"Среднее {score:g} по {len(judges)} судьям; "
|
||||
f"диапазон расхождения {disagreement:g}."
|
||||
),
|
||||
"raw": "\n".join(judge["raw"] for judge in judges),
|
||||
"judges": judges,
|
||||
"disagreement": disagreement,
|
||||
"aggregation_method": "arithmetic_mean",
|
||||
}
|
||||
Path("/logs/verifier/verdict.json").write_text(
|
||||
json.dumps(verdict, ensure_ascii=False, indent=2) + "\n", encoding="utf-8"
|
||||
)
|
||||
Path("/logs/verifier/reward.txt").write_text(
|
||||
"1" if score >= rubric["pass_score"] else "0"
|
||||
)
|
||||
PY
|
||||
Reference in New Issue
Block a user