Datasets:
license: apache-2.0
language:
- en
task_categories:
- text-generation
- question-answering
tags:
- math
- synthetic
- instruction-tuning
- sft
- arithmetic
- catastrophic-forgetting-prevention
size_categories:
- 10M<n<100M
π Legend-Math Dataset
Welcome to the Legend-Math dataset! This is a massive, highly optimized, and meticulously generated dataset containing 10 Million rows of diverse mathematical problems. It is designed to transform any Large Language Model (LLM) into a mathematical genius through Supervised Fine-Tuning (SFT).
π Dataset Overview
- Name: Legend-Math
- Size: 10,000,000 (10 Million) Records
- Total Tokens: ~350 Million Tokens (Approx. 35 tokens per row)
- Format: JSONL (OpenAI ChatML / Messages format)
- Language: English / Universal Math
- Use Case: Supervised Fine-Tuning (SFT), Continuous Pre-Training (CPT)
π§ What Will the Model Learn? (Capabilities)
By fine-tuning your model on Legend-Math, it will master:
- Basic Arithmetic: High-accuracy Addition, Subtraction, Multiplication, Division, and Modulo operations (+, -, *, /, %).
- Multi-Step Equations: Solving complex BODMAS/PEMDAS expressions systematically.
- Advanced Mathematics:
- Exponential calculations and powers (e.g., $x^y$).
- Exact Geometry calculations using
Pi(Ο). - High-precision Square Roots.
- Trigonometry (Sine, Cosine, Tangent).
- Precision & Accuracy: The answers are generated via Python's execution engine, ensuring 0% hallucination in the dataset's ground truth.
π Model SFT Capability (How large a model can you train?)
With ~350 Million high-quality instruction-response tokens, this dataset is powerful enough to fine-tune models of virtually any size:
- Small Models (1B - 3B): Perfect for making edge-device math assistants (e.g., TinyLlama, Qwen-1.5-1.8B).
- Medium Models (7B - 14B): Ideal for robust SFT on models like Llama-3-8B, Mistral-7B, or Qwen-7B. It will easily push their math benchmarks (GSM8K, MATH) to top-tier levels.
- Large Models (30B - 70B+): You can safely use this for continuous pre-training or aggressive SFT on models like Llama-3-70B or Mixtral to create a specialized, world-class Math Oracle.
π‘οΈ Why Choose Legend-Math? (The Secret Sauce)
1. Zero Catastrophic Forgetting π§ π‘
One of the biggest problems with fine-tuning a model heavily on Math is Catastrophic Forgettingβthe model becomes great at math but forgets how to hold a normal conversation or loses its natural language charm. Legend-Math solves this natively! Every 50,000th row in this dataset injects a high-quality programming joke. This periodic language-shift acts as a memory refresher, ensuring the model retains its conversational skills, humor, and general language abilities while mastering math.
2. Ready-to-Train Format π οΈ
No data wrangling required. The dataset is already formatted in the exact schema expected by modern fine-tuning libraries (Axolotl, LLaMA-Factory, Unsloth, Hugging Face TRL).
3. Computationally Perfect π―
Unlike scraped datasets that contain human errors or LLM hallucinations, every single math problem here was dynamically generated and computed.
π Dataset Structure
Each record in the dataset is structured as follows:
{
"id": "6790b369d262461abba8c3f3de1425d9",
"date": "2026-06-30 09:29:40",
"tokens": 14,
"messages": [
{
"role": "user",
"content": "Calculate the exact area of a circle with radius 45. Use pi."
},
{
"role": "assistant",
"content": "6361.7251"
}
]
}