Dataset Viewer
Auto-converted to Parquet Duplicate
instruction
stringclasses
6 values
input
stringlengths
0
38
output
stringlengths
1
55
El siguiente código contiene un error. Corrígelo.
```python if x > 0 print('ok') ```
```python if x > 0: print('ok') ```
¿Cuál es la salida del siguiente código?
```python print(pow(4, 1)) ```
4
¿Cuál es la salida del siguiente código?
```python print(7 + 8 * 5) ```
47
The following code contains an error. Fix it.
```python if x > 0 print('ok') ```
```python if x > 0: print('ok') ```
What is the output of the following code?
```python print(pow(1, 4)) ```
1
¿Cuál es la salida del siguiente código?
```python print(pow(11, 1)) ```
11
What is the output of the following code?
```python print(pow(20, 1)) ```
20
What is the output of the following code?
```python print(6 + 12 * 3) ```
42
What is the output of the following code?
```python print(18 + 8 * 3) ```
42
¿Cuál es la salida del siguiente código?
```python print(11 + 13 * 3) ```
50
What is the output of the following code?
```python print(pow(7, 4)) ```
2401
¿Cuál es la salida del siguiente código?
```python print(pow(8, 5)) ```
32768
¿Cuál es la salida del siguiente código?
```python print(17 + 16 * 1) ```
33
What is the output of the following code?
```python print(17 + 9 * 5) ```
62
¿Cuál es la salida del siguiente código?
```python print(15 + 1 * 3) ```
18
¿Cuál es la salida del siguiente código?
```python print(pow(18, 1)) ```
18
¿Cuál es la salida del siguiente código?
```python print(12 + 10 * 2) ```
32
¿Cuál es la salida del siguiente código?
```python print(3 + 16 * 1) ```
19
What is the output of the following code?
```python print(pow(18, 3)) ```
5832
What is the output of the following code?
```python print(15 + 17 * 4) ```
83
¿Cuál es la salida del siguiente código?
```python print(11 + 1 * 5) ```
16
¿Cuál es la salida del siguiente código?
```python print(11 + 3 * 5) ```
26
What is the output of the following code?
```python print(pow(7, 2)) ```
49
What is the output of the following code?
```python print(14 + 7 * 1) ```
21
¿Cuál es la salida del siguiente código?
```python print(pow(4, 4)) ```
256
What is the output of the following code?
```python print(pow(5, 2)) ```
25
¿Cuál es la salida del siguiente código?
```python print(15 + 18 * 1) ```
33
What is the output of the following code?
```python print(7 + 13 * 1) ```
20
What is the output of the following code?
```python print(pow(9, 3)) ```
729
¿Cuál es la salida del siguiente código?
```python print(2 + 19 * 5) ```
97
¿Cuál es la salida del siguiente código?
```python print(8 + 13 * 1) ```
21
What is the output of the following code?
```python print(9 + 7 * 3) ```
30
¿Cuál es la salida del siguiente código?
```python print(10 + 15 * 3) ```
55
¿Cuál es la salida del siguiente código?
```python print(pow(3, 2)) ```
9
What is the output of the following code?
```python print(pow(3, 3)) ```
27
¿Cuál es la salida del siguiente código?
```python print(pow(18, 3)) ```
5832
¿Cuál es la salida del siguiente código?
```python print(3 + 14 * 3) ```
45
¿Cuál es la salida del siguiente código?
```python print(pow(9, 4)) ```
6561
What is the output of the following code?
```python print(12 + 2 * 3) ```
18
What is the output of the following code?
```python print(14 + 8 * 3) ```
38
What is the output of the following code?
```python print(12 + 10 * 2) ```
32
¿Cuál es la salida del siguiente código?
```python print(13 + 11 * 3) ```
46
What is the output of the following code?
```python print(pow(2, 5)) ```
32
What is the output of the following code?
```python print(14 + 20 * 5) ```
114
¿Cuál es la salida del siguiente código?
```python print(9 + 2 * 4) ```
17
What is the output of the following code?
```python print(pow(18, 2)) ```
324
What is the output of the following code?
```python print(pow(19, 3)) ```
6859
¿Cuál es la salida del siguiente código?
```python print(17 + 16 * 2) ```
49
What is the output of the following code?
```python print(3 + 8 * 3) ```
27
What is the output of the following code?
```python print(pow(20, 4)) ```
160000
¿Cuál es la salida del siguiente código?
```python print(pow(5, 1)) ```
5
What is the output of the following code?
```python print(2 + 18 * 2) ```
38
What is the output of the following code?
```python print(pow(17, 5)) ```
1419857
¿Cuál es la salida del siguiente código?
```python print(9 + 17 * 4) ```
77
¿Cuál es la salida del siguiente código?
```python print(pow(10, 3)) ```
1000
¿Cuál es la salida del siguiente código?
```python print(pow(5, 2)) ```
25
What is the output of the following code?
```python print(18 + 15 * 4) ```
78
What is the output of the following code?
```python print(pow(13, 1)) ```
13
What is the output of the following code?
```python print(10 + 13 * 4) ```
62
What is the output of the following code?
```python print(pow(14, 1)) ```
14
What is the output of the following code?
```python print(6 + 15 * 2) ```
36
What is the output of the following code?
```python print(pow(13, 2)) ```
169
What is the output of the following code?
```python print(9 + 14 * 3) ```
51
¿Cuál es la salida del siguiente código?
```python print(12 + 8 * 1) ```
20
¿Cuál es la salida del siguiente código?
```python print(pow(19, 4)) ```
130321
¿Cuál es la salida del siguiente código?
```python print(pow(10, 4)) ```
10000
What is the output of the following code?
```python print(15 + 5 * 4) ```
35
What is the output of the following code?
```python print(pow(11, 1)) ```
11
What is the output of the following code?
```python print(pow(6, 2)) ```
36
What is the output of the following code?
```python print(pow(16, 2)) ```
256
¿Cuál es la salida del siguiente código?
```python print(7 + 11 * 1) ```
18
What is the output of the following code?
```python print(pow(9, 5)) ```
59049
¿Cuál es la salida del siguiente código?
```python print(10 + 1 * 5) ```
15
¿Cuál es la salida del siguiente código?
```python print(pow(18, 2)) ```
324
¿Cuál es la salida del siguiente código?
```python print(2 + 9 * 4) ```
38
¿Cuál es la salida del siguiente código?
```python print(pow(5, 5)) ```
3125
¿Cuál es la salida del siguiente código?
```python print(4 + 18 * 4) ```
76
¿Cuál es la salida del siguiente código?
```python print(20 + 4 * 2) ```
28
¿Cuál es la salida del siguiente código?
```python print(6 + 8 * 2) ```
22
What is the output of the following code?
```python print(pow(15, 4)) ```
50625
What is the output of the following code?
```python print(10 + 15 * 1) ```
25
¿Cuál es la salida del siguiente código?
```python print(5 + 9 * 2) ```
23
What is the output of the following code?
```python print(pow(20, 3)) ```
8000
What is the output of the following code?
```python print(pow(13, 5)) ```
371293
¿Cuál es la salida del siguiente código?
```python print(pow(14, 5)) ```
537824
¿Cuál es la salida del siguiente código?
```python print(pow(19, 1)) ```
19
What is the output of the following code?
```python print(pow(16, 4)) ```
65536
What is the output of the following code?
```python print(pow(4, 3)) ```
64
What is the output of the following code?
```python print(11 + 4 * 4) ```
27
What is the output of the following code?
```python print(20 + 16 * 4) ```
84
¿Cuál es la salida del siguiente código?
```python print(10 + 15 * 4) ```
70
¿Cuál es la salida del siguiente código?
```python print(6 + 10 * 5) ```
56
What is the output of the following code?
```python print(16 + 8 * 4) ```
48
¿Cuál es la salida del siguiente código?
```python print(pow(3, 4)) ```
81
What is the output of the following code?
```python print(19 + 19 * 4) ```
95
What is the output of the following code?
```python print(pow(12, 5)) ```
248832
What is the output of the following code?
```python print(pow(7, 5)) ```
16807
What is the output of the following code?
```python print(pow(2, 4)) ```
16
¿Cuál es la salida del siguiente código?
```python print(pow(16, 2)) ```
256
What is the output of the following code?
```python print(11 + 20 * 4) ```
91
End of preview. Expand in Data Studio

PyMini – A Compact Python Instruction Dataset for Small Language Models

PyMini is a synthetic instruction dataset built by Inserloft to teach Python programming to small language models (<2B parameters). It covers fundamental Python concepts through a diverse set of tasks — code prediction, bug fixing, function completion, explanation, and conceptual Q&A. Available in English, Spanish, or bilingual versions.

Dataset Description

PyMini provides a high-quality, compact, and fully synthetic dataset for fine-tuning models that need a solid grasp of Python without unnecessary complexity. Every example is generated programmatically, avoiding license issues and giving exact control over difficulty and coverage.

  • Languages: English (en), Spanish (es), or mixed (both)
  • Number of examples: Configurable; default release contains ~49,200 examples (balanced across task types)
  • Format: Parquet (native), auto-converted from the original generation output
  • Generated with: Python script (no web scraping, no copyrighted code)

Dataset Structure

Each example is a JSON object with three fields:

{
  "instruction": "string (the task description)",
  "input": "string (code snippet or empty)",
  "output": "string (the expected answer/code/explanation)"
}

Example (English):

{
  "instruction": "What is the output of the following code?",
  "input": "```python\nprint(3 + 4 * 5)\n```",
  "output": "23"
}

The input field may be empty for tasks like "Write a function...".

Task Types and Distribution

Task Type Description Approx. Weight
Predict Output Given a code snippet, predict what it prints or evaluates to. 25%
Fix Bug Correct syntax or logical errors in provided code. 15%
Fill Missing Line Complete a partially written function body to fulfill its purpose. 15%
Write Function Write a whole function from a natural language specification. 20%
Explain Code Explain in plain language what a piece of code does. 15%
Concept Question Answer a theoretical question about Python (e.g., "What is a list?"). 10%
Convert Code Transform a loop into a comprehension or vice versa. 5%

All code examples are self-contained and focus on core Python: variables, types, conditionals, loops, functions, lists, dictionaries, sets, file handling, exceptions, basic OOP, and comprehensions.

Usage

Load the dataset directly with the Hugging Face datasets library:

from datasets import load_dataset

dataset = load_dataset("inserloft/PyMini", split="train")
print(dataset[0])

The dataset is stored natively in Parquet format, so it loads quickly and works out of the box with the datasets library, Dataset Viewer, and any Parquet-based tooling (pandas, DuckDB, Polars, etc.):

import pandas as pd

df = pd.read_parquet("hf://datasets/inserloft/PyMini/train.parquet")
print(df.head())

Data Fields

  • instruction (str): Task description in the chosen language.
  • input (str): Optional code block (formatted with ```python fences) or empty string.
  • output (str): Expected response (may contain code blocks, explanations, or short answers).

Data Splits

The default release includes a single training split. For evaluation, we recommend either:

  • Holding out a random 5–10% of the data, or
  • Using a separate, handcrafted test set of real-world Python problems.

Generation Process

PyMini is entirely synthetic, generated by a Python script that randomly combines templates and safe code evaluation to produce diverse examples. Key aspects of the generation:

  • Deduplication: A hash-based deduplication step prevents exact duplicate examples.
  • Reproducibility: The script uses a fixed random seed (42) for reproducible generation.
  • Safety: All code snippets are evaluated in a restricted environment (no file system access, limited built-ins).
  • Customization: Adjust the number of examples, language (--lang es/en/both), and task weights by modifying the script.

The generation script is included in the repository (generate_pymini.py). Output is converted to Parquet for storage and distribution on the Hub.

Intended Use

This dataset is intended for fine-tuning small language models (under ~2 billion parameters) to improve their Python understanding and code generation abilities. It is particularly suitable for:

  • Code assistants that must explain or fix Python code.
  • Educational tools that teach Python basics.
  • Lightweight models running in resource-constrained environments (edge, mobile).

Out-of-Scope Use

PyMini is not designed for:

  • Large-scale production code generation.
  • Mastering advanced Python libraries (NumPy, pandas, Django, etc.).
  • Security-sensitive code auditing.

The examples are deliberately simple and may not cover edge cases of real-world software.

Bias, Risks, and Limitations

  • Synthetic nature: The dataset was generated from templates, so it may lack the stylistic variance of human-written code.
  • Language coverage: While bilingual, the vocabulary is limited to common Python terminology. Colloquial expressions or complex natural language instructions may be underrepresented.
  • No malicious code: The dataset does not include security vulnerabilities or harmful patterns; it is purely educational.
  • Potential overfitting: Because of the templated generation, models may memorize patterns rather than generalizing to unseen code. Evaluate on diverse, real-world test sets.

License

This dataset is released under the MIT License. You are free to use, modify, and distribute it for both research and commercial purposes.

Citation

If you use PyMini in your work, please cite it as:

@misc{pymini2025,
  title        = {PyMini: A Compact Python Instruction Dataset for Small Language Models},
  author       = {Inserloft},
  year         = 2025,
  howpublished = {\url{https://huggingface.co/datasets/inserloft/PyMini}}
}

Contributing

Feel free to open issues or pull requests if you have suggestions for new task types, additional languages, or improvements to the generation script.

Contact

For questions, reach out via the Hugging Face community tab or through inserloft.com.

Downloads last month
60