File size: 9,694 Bytes
c7c6aad
a62f8c9
edf8866
 
 
 
 
 
 
 
 
 
 
 
 
 
c7c6aad
58232a1
c7c6aad
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
227df41
 
 
 
 
 
 
 
 
 
90afbe8
227df41
 
90afbe8
227df41
90afbe8
 
58232a1
 
 
 
 
 
 
 
 
 
bc9a107
 
58232a1
bc9a107
 
 
 
4bd52a9
 
 
 
 
 
 
 
 
 
599070c
 
4bd52a9
599070c
 
 
 
c7c6aad
 
 
 
 
 
 
227df41
 
 
 
 
 
58232a1
 
 
 
 
 
4bd52a9
 
 
 
 
 
c7c6aad
edf8866
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5c7999c
 
edf8866
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
a62f8c9
 
 
 
 
 
 
 
 
 
 
 
 
 
 
09d69d5
a62f8c9
 
 
 
 
 
 
 
 
 
 
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
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
---
license: cc-by-4.0
language:
- en
task_categories:
- text-classification
- token-classification
tags:
- process-reward-model
- prm
- hallucination-detection
- math
- reasoning
- step-level
size_categories:
- 10K<n<100K
dataset_info:
- config_name: SHARP-GSM8K
  features:
  - name: question
    dtype: string
  - name: steps
    list: string
  - name: step_labels
    list: int64
  splits:
  - name: train
    num_bytes: 4794720
    num_examples: 7559
  - name: test
    num_bytes: 600174
    num_examples: 840
  download_size: 4445298
  dataset_size: 5394894
- config_name: SHARP-GSM8K-SPAN
  features:
  - name: question
    dtype: string
  - name: model_answer
    list: string
  - name: hallucination_annotation
    list: string
  splits:
  - name: train
    num_bytes: 10270129
    num_examples: 7559
  - name: test
    num_bytes: 1389542
    num_examples: 840
  download_size: 10718610
  dataset_size: 11659671
- config_name: SHARP-Math
  features:
  - name: question
    dtype: string
  - name: steps
    list: string
  - name: step_labels
    list: int64
  splits:
  - name: train
    num_bytes: 8363185
    num_examples: 10021
  - name: test
    num_bytes: 986219
    num_examples: 1114
  download_size: 8320840
  dataset_size: 9349404
- config_name: SHARP-Math-SPAN
  features:
  - name: question
    dtype: string
  - name: model_answer
    list: string
  - name: hallucination_annotation
    list: string
  splits:
  - name: train
    num_bytes: 19132078
    num_examples: 10021
  - name: test
    num_bytes: 2151022
    num_examples: 1114
  download_size: 20271171
  dataset_size: 21283100
configs:
- config_name: SHARP-GSM8K
  data_files:
  - split: train
    path: SHARP-GSM8K/train-*
  - split: test
    path: SHARP-GSM8K/test-*
- config_name: SHARP-GSM8K-SPAN
  data_files:
  - split: train
    path: SHARP-GSM8K-SPAN/train-*
  - split: test
    path: SHARP-GSM8K-SPAN/test-*
- config_name: SHARP-Math
  data_files:
  - split: train
    path: SHARP-Math/train-*
  - split: test
    path: SHARP-Math/test-*
- config_name: SHARP-Math-SPAN
  data_files:
  - split: train
    path: SHARP-Math-SPAN/train-*
  - split: test
    path: SHARP-Math-SPAN/test-*
---

# SHARP

## Introduction

**SHARP** is a corpus for **step-level hallucination detection in mathematical reasoning**. Open 7B models
were asked to solve GSM8K and MATH problems, and a large teacher model then marked the exact fragments of
each solution that are wrong or unsupported. The result is a step-labelled corpus that can be used to train
Process Reward Models (PRMs), to benchmark error localization, or to study where small models go off the rails.

The corpus is published in two parallel views:

* **step view** — `SHARP-GSM8K`, `SHARP-Math`. Solutions split into steps with one binary label per step,
  cut at the first faulty step. This is the format used to train the SHARP PRMs.
* **span view** — `SHARP-GSM8K-SPAN`, `SHARP-Math-SPAN`. The same solutions, untruncated, carrying the raw
  `<HAL>...</HAL>` markup exactly as the annotator produced it.

Row *i* of a step subset and row *i* of the matching span subset describe the same solution, so the two views
can be joined by position.

## Subsets

| Config | Rows (train / test) | Fields |
|---|---|---|
| `SHARP-GSM8K` | 7,559 / 840 | `question`, `steps`, `step_labels` |
| `SHARP-GSM8K-SPAN` | 7,559 / 840 | `question`, `model_answer`, `hallucination_annotation` |
| `SHARP-Math` | 10,021 / 1,114 | `question`, `steps`, `step_labels` |
| `SHARP-Math-SPAN` | 10,021 / 1,114 | `question`, `model_answer`, `hallucination_annotation` |

### Step view

```json
{
  "question": "1 chocolate bar costs $1.50 and can be broken into 3 sections ...",
  "steps": [
    "Let's first determine the number of chocolate bars needed. ...",
    "Number of chocolate bars = Number of scouts * S'mores per scout / S'mores per bar ...",
    "Number of chocolate bars = 15 * 2 / 3 = 5 bars"
  ],
  "step_labels": [1, 1, 0]
}
```

`step_labels[i] == 1` means the step is sound, `0` means it contains a hallucination. Because every solution is
truncated at its first error, a row has **either no zero at all, or exactly one zero as its last label**. In other
words, `steps` is always a valid reasoning prefix, and the last step is the first place where the model went wrong.

### Span view

```json
{
  "question": "1 chocolate bar costs $1.50 and can be broken into 3 sections ...",
  "model_answer": ["Let's first determine ...", "Number of chocolate bars = ...", "..."],
  "hallucination_annotation": ["Let's first determine ...", "Number of chocolate bars = <HAL>15 * 2 / 3 = 5</HAL> bars", "..."]
}
```

`model_answer` is the untruncated generation split on blank lines; `hallucination_annotation` is the same text with
minimal erroneous fragments wrapped in `<HAL>...</HAL>`. Solutions with no error carry no tags.

## Pipeline

### 1. Problems

| | GSM8K | Math |
|---|---|---|
| Source | [openai/gsm8k](https://huggingface.co/datasets/openai/gsm8k) (`main`) | [qwedsacf/competition_math](https://huggingface.co/datasets/qwedsacf/competition_math) (`train`) |
| Unique problems | 8,399 | 11,135 |

The GSM8K part draws on both official splits — 7,464 problems come from `train` and 935 from `test` — so it must not
be used to evaluate a solver on GSM8K test. The train/test split published here is a split of SHARP itself, not of
the underlying benchmarks.

### 2. Generation

Solutions were sampled with vLLM, **four independent samples per problem**, temperature `0.7`, top-p `0.8`,
using a plain math system prompt asking for step-by-step reasoning with steps separated by blank lines.

| Generator | [mistralai/Mathstral-7B-v0.1](https://huggingface.co/mistralai/Mathstral-7B-v0.1) |


Deliberately choosing mid-sized generators is what makes the corpus useful: their solutions contain a realistic mix
of sound and faulty reasoning rather than being almost always right or almost always wrong.

### 3. Annotation

Every generation was annotated by [openai/gpt-oss-120b](https://huggingface.co/openai/gpt-oss-120b) served with vLLM.
The annotator receives the problem and the solution and returns the solution verbatim with the **minimal** wrong
fragments wrapped in `<HAL>...</HAL>`; a clean solution is returned as the literal string `No hallucinations`.
Annotations that failed to reproduce the source text were repaired or regenerated before the corpus was assembled.

### 4. Conversion to step labels

1. Split the annotated solution into steps on blank lines.
2. Label a step `0` if any `<HAL>` span intersects it, otherwise `1`.
3. Truncate `steps` and `step_labels` at the first `0`, keeping that step. A PRM therefore only ever sees a prefix
   that is correct up to its final step, which removes the ambiguity of scoring reasoning that continues after an
   error has already been made.


## Usage

```python
from datasets import load_dataset

step = load_dataset("ZaandaTeika/SHARP", "SHARP-Math", split="train")
span = load_dataset("ZaandaTeika/SHARP", "SHARP-Math-SPAN", split="train")

print(step[0]["step_labels"])                 # e.g. [1, 1, 1, 0]
print(span[0]["hallucination_annotation"][0])  # same solution with <HAL> markup
```

To build a PRM training example, append a `<extra_0>` marker to every step and join with blank lines:

```python
def build_prompt(question, steps):
    body = "\n\n".join(f"{s.strip()}<extra_0>" for s in steps)
    return f"Question: {question}\n\nSolution:\n{body}"
```

## Models trained on SHARP

| Model | Base | Supervision |
|---|---|---|
| [Qwen2.5-1.5B-SHARP-Span](https://huggingface.co/ZaandaTeika/Qwen2.5-1.5B-SHARP-Span) | Qwen2.5-Math-1.5B-Instruct | span |
| [Qwen2.5-1.5B-SHARP-Step](https://huggingface.co/ZaandaTeika/Qwen2.5-1.5B-SHARP-Step) | Qwen2.5-Math-1.5B-Instruct | step |
| [Qwen2.5-7B-SHARP-Span](https://huggingface.co/ZaandaTeika/Qwen2.5-7B-SHARP-Span) | Qwen2.5-Math-7B-Instruct | span |
| [Qwen2.5-7B-SHARP-Step](https://huggingface.co/ZaandaTeika/Qwen2.5-7B-SHARP-Step) | Qwen2.5-Math-7B-Instruct | step |

## Limitations

* **Labels are model-generated.** They come from GPT-OSS-120B, not from humans, and inherit its biases. Per-step
  agreement with an independent annotator is moderate (κ 0.689), so individual labels are noisier than the
  solution-level signal.
* **Step boundaries follow blank lines** in the generator's output. Where a model wrote a numbered list on
  consecutive lines, several logical steps can end up inside one step string.

## Source Data and Attribution

We sourced GSM8K from OpenAI's official repository:
<https://huggingface.co/datasets/openai/gsm8k>. This dataset is protected by the
[MIT](https://github.com/openai/grade-school-math/blob/master/LICENSE) license.

We sourced MATH from <https://huggingface.co/datasets/qwedsacf/competition_math>,
a mirror of the original release by Hendrycks et al. This dataset is protected by
the [MIT](https://github.com/hendrycks/math/blob/main/LICENSE) license.

Please defer to the GSM8K and MATH dataset cards for further details on their
collection and annotation process.

Reasoning traces were generated with
[Mathstral-7B-v0.1](https://huggingface.co/mistralai/Mathstral-7B-v0.1);
hallucination annotations were produced with
[gpt-oss-120b](https://huggingface.co/openai/gpt-oss-120b). All three are released
under the Apache 2.0 License, and gpt-oss-120b additionally carries the gpt-oss
usage policy. None of these licenses restrict the redistribution of model outputs.

## Additional Information

### Licensing Information

The reasoning traces and hallucination annotations we provide are licensed under
the [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/legalcode) license.