AI
New Security-Focused Dataset Trains AI Code Generators to Build Safer Software
Researchers release SecureCode, a 2,185-example dataset designed to teach AI models how to avoid both traditional web vulnerabilities and emerging risks in large language model applications.
AI-powered coding assistants can be a developer's best friend—but they're also introducing security risks at scale. A new academic dataset aims to fix this by teaching large language models to generate inherently safer code.
The Problem: AI That Writes Vulnerable Code#
Current AI coding assistants produce insecure code roughly 45% of the time when handling security-sensitive tasks. This matters because these tools are widely deployed in development workflows, amplifying the potential for vulnerabilities to slip into production systems. Despite this risk, no widely available training dataset has combined both traditional web security practices and protections specific to AI/ML systems in a format ready for model fine-tuning.
SecureCode: A Unified Training Blueprint#
Researchers have released SecureCode, a production-grade dataset containing 2,185 multi-turn conversation examples spanning two critical domains:
- Web application security: 1,435 examples covering the OWASP Top 10 2021 vulnerabilities across 11 programming languages and 9 frameworks. All scenarios are grounded in documented CVEs and real security incidents.
- AI/ML security: 750 examples addressing all 10 OWASP LLM Top 10 2025 risk categories, including protections for popular frameworks like LangChain, OpenAI, and Hugging Face.
Each training example follows a structured four-turn dialogue: an initial feature request, vulnerable and secure code implementations paired with attack demonstrations, advanced security probing, and operational hardening guidance.
Rigorous Quality Assurance#
The dataset underwent multi-layered vetting. Automated structural checks were paired with review from seven different specialist AI perspectives—totaling over 10,500 individual assessments—followed by an eight-stage remediation workflow. The AI/ML examples achieved a mean quality score of 93.8 out of 100 (with minimal variance of 0.93).
Beyond raw code examples, each scenario includes SIEM integration strategies, infrastructure hardening recommendations, and testing approaches using real production frameworks.

