task_categories:text-generation task_categories:conversational task_categories:text2text-generation language:en code python reasoning region:us
---
dataset_info:
  features:
  - name: type
    dtype: int64
  - name: instruction
    dtype: string
  - name: input
    dtype: string
  - name: output
    dtype: string
  splits:
  - name: train
    num_bytes: 44253001
    num_examples: 89898
  download_size: 10073876
  dataset_size: 44253001
task_categories:
- text-generation
- conversational
- text2text-generation
language:
- en
tags:
- code
- python
- reasoning
pretty_name: SPP python reasoning tasks
---
# Dataset Card for "SPP_30K_verified_tasks"

### Dataset Summary

This is an augmented version of the [Synthetic Python Problems(SPP) Dataset](https://huggingface.co/datasets/wuyetao/spp).

This dataset has been generated from the subset of the data has been de-duplicated and verified using a Python interpreter. (SPP_30k_verified.jsonl).
The original dataset contains small Python functions that include a docstring with a small description of what the function does and some calling examples 
for the function. 

The current dataset includes three different tasks:
  - Type 1: give the code as input and ask the model to generate some example calls along the expected return value
  - Type 2: give the description and the example calling calls and ask the model to write the function.
  - Type 3: give the the function and the example calls without the expected value as input and ask the model to write what the function should return.


For example:
```python
def lowest_prime_factor(n):
    """ Find the smallest prime factor of a given number.
    Examples:
    >>> lowest_prime_factor(12)
    2
    >>> lowest_prime_factor(14)
    2
    >>> lowest_prime_factor(8)
    2
    """
    smallest = 2
    while(n % smallest!= 0):
        smallest+=1
    return smallest
```


First task:
```
INSTRUCTION:
Execute the following function with several example calls, showing the values returned in each case.
INPUT:
def lowest_prime_factor(n):
    smallest = 2
    while(n % smallest!= 0):
        smallest+=1
    return smallest

OUTPUT:
Sure, here you have several example calls along the return values they will generate.
"""
>>> lowest_prime_factor(12)
2
>>> lowest_prime_factor(14)
2
>>> lowest_prime_factor(8)
2
"""
```

Second task:
```
INSTRUCTION:
Follow the task given and refer to the provided calling examples as you create the function's body.
INPUT:
Find the smallest prime factor of a given number.
Examples:
>>> lowest_prime_factor(12)
2
>>> lowest_prime_factor(14)
2
>>> lowest_prime_factor(8)
2
OUTPUT:
Of course, here's a function implementation based on the provided calling examples and task.
""" python
def lowest_prime_factor(n):
    smallest = 2
    while(n % smallest!= 0):
        smallest+=1
    return smallest
"""
```

Third task:
```
INSTRUCTION:
Examine the given function and the accompanying instance function calls, and outline the specific output generated by each call.
INPUT:
def lowest_prime_factor(n):
    smallest = 2
    while(n % smallest!= 0):
        smallest+=1
    return smallest

Function calls:
>>> lowest_prime_factor(12)
>>> lowest_prime_factor(14)
>>> lowest_prime_factor(8)
OUTPUT:
Sure thing, here you have the specific output generated by each function call.
>>> lowest_prime_factor(12)
2
>>> lowest_prime_factor(14)
2
>>> lowest_prime_factor(8)
2
```

### Languages

The dataset is in English.

### Data Splits

There are no splits (Only training).

## Dataset Creation

August of 2023

### Curation Rationale

This dataset was created to improve the Python 3 reasoning/understanding capabilities of LLMs.

### Source Data

The source dataset can be found at [Synthetic Python Problems(SPP) Dataset](https://huggingface.co/datasets/wuyetao/spp).

### Annotations

The dataset includes an instruction, input, output and type columns.  
The type colum indicates the type of task (from 1 to 3).

#### Annotation process

The responses were generated parsing the docstrings of the functions.