AI
RiskyPy: Automated Dataset Creation for Testing AI Code Security
Researchers introduce an automated pipeline to generate security-focused code datasets that align with model capabilities while assessing both functionality and vulnerability risks.
A new research pipeline called RiskyPy addresses a critical challenge in assessing the security of code generated by large language models: the need for test datasets that evaluate both whether code works and whether it's safe, while remaining calibrated to specific model capabilities.
The Challenge#
Existing security evaluation benchmarks for LLM-generated code are labor-intensive and often fail to match the actual proficiency levels of the models being tested. This mismatch makes it difficult to fairly and comprehensively measure how well security-improvement techniques actually work across different AI systems.
How RiskyPy Works#
The pipeline uses functionality and vulnerability canaries—specialized test patterns that help calibrate dataset generation to a target model's skill level. Researchers instantiated RiskyPy for Python code, covering 18 different vulnerability types drawn from the 2025 CWE Top 25, ultimately producing 101 distinct prompts designed to elicit both secure and insecure responses.
Initial Results#
Testing on two smaller models (Qwen3-4B and Seed-Coder-8B) revealed a productive middle ground for evaluation:
- Between 57–72% of generated prompts produced functional, executable code
- Only 5–10% of code generations were free of security issues (as flagged by Bandit, a Python security scanner)
This balance creates practical space for researchers to jointly measure both functionality preservation and security improvement when testing new approaches.
Why It Matters#
By automating the creation of calibrated security datasets, RiskyPy aims to standardize and scale how the research community evaluates LLM code generation safety—making it easier to track progress and compare different security-hardening techniques across models of varying sizes.

