Stack-Smol-Docstrings
This dataset contains Python functions extracted from The Stack (small) dataset, selected for their high-quality docstrings and implementations. Each sample includes the function's docstring, implementation, and a masked version of the code where the function is replaced with a comment.
The dataset is designed for code completion tasks where a model needs to restore a function that has been replaced with a comment. The model is provided with:
- The full file context with the function replaced by a comment
- The docstring of the function
- The function name
The model's task is to generate code that replaces the comment with a proper implementation of the function based on the docstring and surrounding context.
Dataset Structure
Each sample contains:
function_name: Name of the functiondocstring: The function's docstringmasked_code: The full file with the function replaced by a commentimplementation: The original function implementationstart_line: The starting line number of the function in the original fileend_line: The ending line number of the function in the original filefile_content: The full original file content
Quality Filtering
Functions are filtered based on:
- Docstring quality (length, structure, descriptiveness)
- Implementation quality (no SQL strings, reasonable number of variables, sufficient complexity)