| --- |
| license: other |
| task_categories: |
| - text-generation |
| language: |
| - en |
| - es |
| tags: |
| - python |
| - code |
| - synthetic |
| - inserloft |
| - inserloft-research |
| - parquet |
| - programming |
| size_categories: |
| - 100M<n<1B |
| pretty_name: PyMAX |
| extra_gated_heading: "PyMAX Terms of Use" |
| extra_gated_prompt: > |
| **IMPORTANT:** By requesting access to PyMAX, you confirm that you have read and agree to the following terms: |
| |
| 1. **Free Use:** You may use this dataset for any purpose, including commercial, academic, or personal projects, free of charge. |
| 2. **Mandatory Attribution:** If you use PyMAX in your research, to train a model, or in any publication, you MUST explicitly mention **"PyMAX by Inserloft Research (Research.Inserloft.com)"** in the System Card, Model Card, or documentation where you cite public datasets used. |
| extra_gated_fields: |
| Full Name: text |
| Organization: text |
| Email: text |
| I agree to cite PyMAX by Inserloft Research in my Model Card or documentation: checkbox |
| extra_gated_button_content: "Accept terms and request access" |
| --- |
| |
| <!-- BANNER START --> |
| <p align="center"> |
| <img src="https://huggingface.co/datasets/Inserloft/PyMAX/resolve/main/img/banner.png" alt="PyMAX Banner" width="100%"> |
| </p> |
| <!-- BANNER END --> |
|
|
| <p align="center"> |
| <strong>The largest synthetic Python dataset for training and fine-tuning LLMs.</strong> |
| </p> |
|
|
| <p align="center"> |
| <img alt="Examples" src="https://img.shields.io/badge/Examples-500%2C000%2C000-FF9D00?style=for-the-badge&logo=python&logoColor=white"> |
| <img alt="Format" src="https://img.shields.io/badge/Format-Parquet-0B0F19?style=for-the-badge&logo=apachespark&logoColor=white"> |
| <img alt="License" src="https://img.shields.io/badge/License-Free%20(Attribution%20Required)-FF9D00?style=for-the-badge"> |
| <img alt="Size" src="https://img.shields.io/badge/Size-16GB-0B0F19?style=for-the-badge"> |
| <img alt="Generator" src="https://img.shields.io/badge/Generator-NaNo%203.4-FF9D00?style=for-the-badge"> |
| </p> |
|
|
| --- |
|
|
| ## ๐ Overview |
|
|
| **PyMAX** is a massive, high-quality synthetic dataset of **500 million Python code examples** created by **Inserloft Research**. It is specifically designed to train and fine-tune Large Language Models (LLMs) specialized in programming, code generation, and software development tasks. |
|
|
| This dataset bridges the gap between general-purpose models and specialized coding models, providing an unprecedented volume of Python-specific training data in a clean, structured, and ready-to-use format. PyMAX is not just a collection of prompts and responses; it is a **foundational-grade dataset** enriched with technical metadata, syntactic validation, and conversational alignment for modern LLMs. |
|
|
| --- |
|
|
| ## ๐ฅ Key Features |
|
|
| | Feature | Description | |
| |---------|-------------| |
| | **Scale** | 500,000,000 examples (100 Parquet shards) | |
| | **Languages** | English (50%) & Spanish (50%) | |
| | **Format** | Parquet (Snappy compression), optimized for streaming | |
| | **Size** | ~60 GB compressed | |
| | **Generator** | Enhanced Python script leveraging multiprocessing and AST analysis | |
| | **Topics** | Basic syntax, OOP, data structures, algorithms, web dev, snippets, etc. | |
| | **Structure** | Prompt, Response, Code, Explanation, Metadata, Messages, Test Code, Safety Flags | |
| | **Validation** | Automatic syntactic validation via `ast.parse` | |
| | **Metadata** | Complexity scores, imports, docstring detection, algorithmic complexity, tags | |
| | **Quality** | 100% synthetic generation with rigorous filtering and deduplication | |
| | **Use Cases** | Code LLMs, fine-tuning, instruction tuning, RLHF, evaluation | |
|
|
| --- |
|
|
| ## ๐ฏ Use Cases |
|
|
| - **Fine-tuning Code LLMs:** Train models like CodeLlama, StarCoder, or custom architectures. |
| - **Instruction Tuning:** Build models that understand natural language programming instructions. |
| - **Benchmarking:** Evaluate coding capability of LLMs. |
| - **Education:** Create AI tutors for Python learning. |
| - **Research:** Study code generation, program synthesis, and software engineering. |
| - **Execution-Based Evaluation:** Leverage included test cases for pass/fail scoring. |
| - **Safety-Aware Training:** Filter examples using the built-in `is_safe` flag. |
|
|
| --- |
|
|
| ## ๐ Dataset Structure |
|
|
| Each example in PyMAX contains the following fields: |
|
|
| | Field | Type | Description | |
| |-------|------|-------------| |
| | `prompt` | `string` | A question or instruction about Python (English or Spanish) | |
| | `response` | `string` | Detailed explanation followed by code block | |
| | `code` | `string` | The raw source code | |
| | `explanation` | `string` | Textual explanation of the code | |
| | `messages` | `list` | Conversational format (ChatML): `[{"role": "user", "content": prompt}, {"role": "assistant", "content": response}]` | |
| | `test_code` | `string` | Validation code (assertions) for execution-based checking | |
| | `metadata` | `dict` | Contains: `topic`, `subtopic`, `difficulty`, `language`, `python_version` | |
| | `syntax_valid` | `bool` | Whether the code passes `ast.parse` (always `True` after filtering) | |
| | `imports` | `list` | List of all imported libraries extracted from the AST | |
| | `has_docstring` | `bool` | Whether the main module/function/class includes a docstring | |
| | `complexity_score` | `int` | Sum of lines of code + number of AST nodes | |
| | `hash` | `string` | SHA-256 hash of `prompt + response` for deduplication | |
| | `time_complexity` | `string` | Algorithmic time complexity (e.g., "O(N)") | |
| | `space_complexity` | `string` | Algorithmic space complexity (e.g., "O(1)") | |
| | `code_length` | `int` | Number of characters in the `code` field | |
| | `tags` | `list` | Array combining topic, subtopic, and difficulty (e.g., `["data_structures", "lists", "beginner"]`) | |
| | `is_safe` | `bool` | Whether the code avoids dangerous calls (`eval`, `exec`, `os.system`, `subprocess`) | |
|
|
| --- |
|
|
| ## ๐๏ธ Topics Covered |
|
|
| - **Basic Syntax:** Variables, operators, data types. |
| - **Control Structures:** Conditionals, loops, comprehensions. |
| - **Functions:** Definitions, decorators, generators, closures. |
| - **OOP:** Classes, inheritance, polymorphism, magic methods. |
| - **Data Structures:** Lists, dicts, sets, tuples, custom structures. |
| - **Algorithms:** Sorting, searching, dynamic programming. |
| - **File I/O:** Reading/writing files, serialization. |
| - **Web Development:** Flask, Django, FastAPI basics. |
| - **Testing:** Unit tests, mocking, pytest. |
| - **Concurrency:** Threading, asyncio, multiprocessing. |
| - **Snippets:** Short modular code blocks (utilities, math ops, list manipulations) for focused training. |
|
|
| --- |
|
|
| ## ๐ How to Use |
|
|
| ### Installation |
| ```python |
| # Install datasets library |
| pip install datasets |
| |
| # Load PyMAX (requires access approval) |
| from datasets import load_dataset |
| |
| dataset = load_dataset("Inserloft/PyMAX", split="train") |
| ``` |
|
|
| ### Access a Single Example |
| ```python |
| example = dataset[0] |
| print(example["prompt"]) |
| print(example["code"]) |
| print(example["messages"]) # Conversational format |
| print(example["test_code"]) # Assertions for validation |
| print(example["time_complexity"])# "O(N)" |
| ``` |
|
|
| ### Stream Large Batches |
| ```python |
| from datasets import load_dataset |
| |
| dataset = load_dataset("Inserloft/PyMAX", split="train", streaming=True) |
| for batch in dataset.iter(batch_size=1000): |
| process(batch) |
| ``` |
|
|
| --- |
|
|
| ## ๐ Technical Details |
|
|
| | Metric | Value | |
| |--------|-------| |
| | Total Examples | 500,000,000 | |
| | Languages | English (50%), Spanish (50%) | |
| | Format | Parquet (Snappy compression) | |
| | Compressed Size | ~60 GB | |
| | Number of Shards | 100 (each ~5 million examples) | |
| | Generation Time | ~1.3 hours (4770 seconds) on 48-core infrastructure | |
| | Parallelism | `multiprocessing.Pool` with 48 workers | |
| | Batch Size | 5,000,000 rows per batch (avoids memory overflow) | |
| | Syntax Validation | Automated via `ast.parse` | |
| | Deduplication | SHA-256 hash of `prompt+response` | |
| | Safety Check | Flags dangerous calls (`eval`, `exec`, `os.system`, `subprocess`) | |
| | Python Version Compatibility | 3.10+ | |
|
|
| --- |
|
|
| ## โ๏ธ Dataset Generation Pipeline |
|
|
| PyMAX was generated using an enhanced Python script by **NaNo 3.4** (Inserloft's proprietary AI model). The pipeline includes: |
|
|
| 1. **Extreme Parallel Processing:** Utilizes `multiprocessing.Pool` with 48 workers, fully leveraging the available hardware. |
| 2. **Strategic Batching:** Data is generated and packaged in stable chunks of 5 million rows per batch, resulting in exactly 100 Parquet files. This prevents OOM errors and enables efficient streaming. |
| 3. **AST Analysis:** Each code snippet is parsed using Python's `ast` module to: |
| - Validate syntax (`syntax_valid`). |
| - Extract imports (`imports`). |
| - Detect docstrings (`has_docstring`). |
| - Compute complexity score (lines + AST nodes). |
| 4. **Metadata Enrichment:** Algorithmic complexity (`time_complexity`, `space_complexity`), code length, and unified tags are automatically calculated. |
| 5. **Conversational Alignment:** Each example is converted into a ChatML-compatible `messages` list, making the dataset instantly ready for instruction tuning. |
| 6. **Test Case Injection:** Each example includes a `test_code` snippet with assertions, enabling execution-based evaluation and potential RLHF workflows. |
| 7. **Safety Filtering:** A scanner flags examples containing `eval`, `exec`, `os.system`, or `subprocess` calls, marking them with `is_safe=False` for optional exclusion. |
|
|
| --- |
|
|
| ## โ๏ธ License & Terms |
|
|
| This dataset is free to use for any purpose (commercial, academic, or personal) without requiring a paid license. The only condition is mandatory attribution: |
|
|
| **"PyMAX by Inserloft Research (Research.Inserloft.com)"** |
|
|
| You must include this citation in your System Card, Model Card, or documentation where you reference public datasets used. |
|
|
| --- |
|
|
| ## ๐๏ธ Citation |
|
|
| If you use PyMAX in your research or publications, please cite: |
|
|
| ```bibtex |
| @misc{pymax2026, |
| title={PyMAX: Ultra Dataset for Python Learning}, |
| author={Inserloft Research}, |
| year={2026}, |
| month={August}, |
| url={https://huggingface.co/datasets/Inserloft/PyMAX}, |
| } |
| ``` |
|
|
| --- |
|
|
| ## ๐ฅ About Inserloft Research |
|
|
| Inserloft Research is an AI research organization focused on creating high-quality datasets and models for programming and software development. We specialize in synthetic data generation, code intelligence, and LLM fine-tuning. |
|
|
| ### ๐ Website: [Research.Inserloft.com](https://Research.Inserloft.com) |
| ### ๐ง Contact: Inserloft@gmail.com |
|
|
| --- |
|
|
| ## ๐ Changelog |
|
|
| - **2026-08-24 (v1.0):** Initial release (250M examples, 8GB). |
| - **2026-08-24 (v2.0):** Major upgrade: 500M examples, AST validation, enriched metadata, ChatML format, test cases, safety flags, and optimized generation pipeline. |
|
|
| --- |
|
|
| <p align="center"> <sub>ยฉ 2026 Inserloft Research. All rights reserved.</sub> </p> |