asmachta / README.md
noamor's picture
Rename data file to asmachta.json to match the repo name
aa02235 verified
|
Raw
History Blame Contribute Delete
4.97 kB
---
license: mit
language:
- he
pretty_name: Asmachta - Hebrew Attributed QA
task_categories:
- question-answering
- summarization
size_categories:
- n<1K
tags:
- hebrew
- grounding
- hallucination-detection
- attribution
- faithfulness
---
# Asmachta — Hebrew Attributed QA
131 Hebrew question-answer records for testing whether a model's generated
answer is actually grounded in its source document. Every claim in
`reference_answer` carries a character-exact quoted span from
`source_text` — checkable with string equality, no judge model needed. A
third of the questions are deliberately unanswerable, so you can measure
hallucination-vs-abstention directly instead of inferring it.
## Quick start
```python
import json
with open("asmachta.json", encoding="utf-8") as f:
records = json.load(f)
record = records[0]
print(record["question"])
print(record["reference_answer"])
for claim in record["claims"]:
print(" claim:", claim["text"])
for span in claim["attribution"]:
excerpt = record["source_text"][span["start_char"]:span["end_char"]]
assert excerpt == span["source_excerpt"] # always true, that's the point
print(" supported by:", excerpt)
```
## Fields
| Field | Meaning |
| --- | --- |
| `id` | Record ID |
| `genre` | `dialogue` (Knesset), `encyclopedic` (Wikipedia), or `journalistic` (news) |
| `difficulty` | `0` = unanswerable by design, `1` = simple, `2` = complex/multi-span |
| `question` / `source_text` | The question and the document to answer it from |
| `reference_answer` | Gold answer, decomposed into `claims` |
| `claims[].attribution[]` | `start_char`/`end_char`/`source_excerpt`/`verified` — the span in `source_text` that backs this claim, checked character-for-character |
| `human_ratings` | Four annotators' 0–2 scores on 5 quality dimensions — indicative, not precise ground truth |
Unanswerable (`difficulty=0`) records have empty `claims` — there's
nothing to attribute when the correct answer is "not in the document."
## Running and scoring your own model
`score.py` (included in this repo, no dependencies beyond the standard
library) checks whether a model's quoted evidence for a claim actually
occurs in `source_text` — exact match, then whitespace-normalized, then
a fuzzy match for copying artifacts. It expects model output in the
format:
```
1. <claim text> [<verbatim quote from source_text>]
2. <claim text> [<verbatim quote from source_text>]
```
A minimal end-to-end example — call your model on every record, then
score each response:
```python
import json
from score import score_model_output
with open("asmachta.json", encoding="utf-8") as f:
records = json.load(f)
PROMPT = """ענה על השאלה אך ורק על סמך המסמך הבא. פרק את תשובתך למשפטים
נפרדים ("טענות"). אחרי כל טענה, בסוגריים מרובעים, צטט קטע מדויק ומילולי
מהמסמך שתומך בה. פורמט: מספור עוקב החל מ-1, טענה אחת בכל שורה.
מסמך:
{source_text}
שאלה:
{question}
תשובה:"""
def call_your_model(prompt: str) -> str:
# Plug in your own inference call here.
raise NotImplementedError
results = []
for record in records:
if record["difficulty"] == 0:
continue # unanswerable items need a different check -- see below
prompt = PROMPT.format(source_text=record["source_text"], question=record["question"])
output = call_your_model(prompt)
scored = score_model_output(output, record["source_text"])
results.append({"id": record["id"], **scored})
overall = sum(r["precision"] for r in results if r["precision"] is not None) / len(results)
print(f"verified-quote rate: {overall:.3f} over {len(results)} records")
```
For `difficulty=0` (unanswerable) records, score whether your model
correctly declines instead — for example, by checking whether its raw
output signals "not in the document" rather than attempting a citation.
There's no single fixed phrase to check for: judge it however fits your
model's expected refusal style.
### A note on format compliance
`score.py` only scores output that matches the format above. A model
that has the right answer but doesn't follow this exact structure — for
instance, a reasoning model that leaves extra text before or after its
numbered claims — will score as ungrounded on `precision`, not because
the content was wrong, but because nothing could be parsed. That's a
different failure mode from actually getting the answer wrong, and it's
worth keeping the two separate in your own evaluation rather than
letting a low score stand in for both. If you're comparing models with
different formatting reliability, consider checking format compliance
and grounding as two distinct things.
## License
MIT. See [LICENSE.md](LICENSE.md).
## Credits
Dataset design: Tal Geva.
Annotation project: Eyal Rosenstein.
Maintenance and consulting: Noam Ordan