--- 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.