File size: 4,358 Bytes
bf07b3a
467de4c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
bf07b3a
 
 
 
 
 
 
 
 
 
d2c6977
 
 
 
bf07b3a
 
f58b0b9
bf07b3a
f58b0b9
 
467de4c
 
f58b0b9
 
 
 
 
bf07b3a
467de4c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2f6c72a
 
467de4c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2c7d6f1
 
467de4c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
---
language:
- en
- ar
- fr
- es
- de
- it
- pt
- zh
- ru
license: apache-2.0
annotations_creators:
- machine-generated
language_creators:
- machine-generated
multilinguality:
- multilingual
source_datasets:
- openai/gsm8k
task_categories:
- text-generation
tags:
- dpo
- math
- multilingual
- alignment
- gsm8k
- synthetic
- translation
- gpt-oss
- gpt-oss-20b
- llama-cpp
dataset_info:
  features:
  - name: prompt
    dtype: string
  - name: chosen
    dtype: string
  - name: rejected
    dtype: string
  - name: language
    dtype: string
  - name: prompt_en
    dtype: string
  - name: chosen_en
    dtype: string
  splits:
  - name: train
    num_bytes: 1488448
    num_examples: 900
  download_size: 747740
  dataset_size: 1488448
size_categories:
- n<1K
configs:
- config_name: default
  data_files:
  - split: train
    path: data/train-*
---

# Mini-GSM8K-Multilingual-Alignment

A compact, multilingual DPO (Direct Preference Optimization) alignment dataset designed for training small language models to produce high-quality, step-by-step mathematical reasoning across multiple languages.

## Purpose

This dataset was created to improve multilingual math reasoning in small language models such as [Al-Khwarizmi-3B](https://huggingface.co/mzoelfakar/Al-Khwarizmi-3B) — a 3B-parameter math tutor model named after the 9th-century mathematician. The goal is to teach the model to prefer detailed, friendly, well-structured solutions over vague, uninformative responses, across 9 languages.

## How It Was Created

1. **Source**: 900 samples were drawn from [OpenAI/GSM8K](https://huggingface.co/datasets/openai/gsm8k) (socratic split), filtered to include only samples whose answers contain digits.

2. **DPO Triplet Construction** (English):
   - **Prompt**: The math problem
   - **Chosen**: The full socratic step-by-step solution
   - **Rejected**: The solution stripped of all English letters — leaving only digits, symbols, and whitespace — creating an abstract, vague, uninformative response

3. **Multilingual Translation**: [gpt-oss-20b](https://huggingface.co/openai/gpt-oss-20b) (F16 GGUF from [unsloth/gpt-oss-20b-GGUF](https://huggingface.co/unsloth/gpt-oss-20b-GGUF), served with llama.cpp `llama-server` and parallel slots; temperature 0.7, reasoning effort medium) was used to translate the `prompt` and `chosen` columns into 8 languages (100 samples each), with careful instructions to:
   - Preserve all mathematical symbols (`$`, `<<>>`, `####`, etc.)
   - Add a brief, varying, friendly opening sentence to each solution
   - Use context-aware translation (the model receives the original English problem when translating solutions)

4. **English Samples**: The final 100 samples remain in English, with friendly opening sentences added to the solutions by the same model.

**Creation code** is [available here](https://huggingface.co/datasets/mzoelfakar/Mini-GSM8K-Multilingual-Alignment/blob/main/code/Create_dataset.ipynb)

## Language Distribution

| Language | Code | Samples |
|----------|------|---------|
| Arabic | ar | 100 |
| French | fr | 100 |
| Spanish | es | 100 |
| German | de | 100 |
| Italian | it | 100 |
| Portuguese | pt | 100 |
| Chinese | zh | 100 |
| Russian | ru | 100 |
| English | en | 100 |
| **Total** | | **900** |

## Schema

| Column | Type | Description |
|--------|------|-------------|
| `prompt` | string | Math problem (translated to target language) |
| `chosen` | string | Full step-by-step solution with friendly opener (translated) |
| `rejected` | string | Digits-only stripped version of the original English solution |
| `language` | string | ISO 639-1 language code |
| `prompt_en` | string | Original English GSM8K problem that `prompt` was translated from |
| `chosen_en` | string | Original English GSM8K solution that `chosen` was translated from (without the friendly opener) |

## Usage

```python
from datasets import load_dataset

dataset = load_dataset("mzoelfakar/Mini-GSM8K-Multilingual-Alignment", split="train")

# Filter by language
arabic_samples = dataset.filter(lambda x: x["language"] == "ar")
```

## Creator

Created by **[Mohamed Zoelfakar](https://www.linkedin.com/in/mzoelfakar/)** as part of the [Al-Khwarizmi-3B](https://huggingface.co/mzoelfakar/Al-Khwarizmi-3B) project for advancing multilingual mathematical reasoning in small language models.