File size: 4,973 Bytes
9b3dd78
 
 
 
ee08135
9b3dd78
 
 
 
 
 
 
 
 
 
 
 
 
ee08135
9b3dd78
 
 
 
 
 
 
 
 
 
 
 
 
aa02235
9b3dd78
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
aa02235
9b3dd78
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
---
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