Benchmarks · Safety, security & robustness
CyberSecEval
also: Purple Llama CyberSecEval
Two separate cybersecurity risks in a language model used as a coding assistant: how often it suggests insecure code, and how willing it is to help with an actual cyberattack when asked.
Meta AIReleased 7 December 2023Live
CyberSecEval was Meta’s answer to a specific worry about coding assistants: a model can be good at writing code and still be bad at writing safe code, and separately, a capable model might simply help with an attack if asked directly. The benchmark tests both. Its insecure-coding component checks generated code across eight languages against 50 known vulnerability patterns; its cyberattack-helpfulness component puts 1,000 prompts, built from real MITRE ATT&CK tactics, to the model and checks whether a compliant answer would actually be useful to an attacker rather than just non-refusing.
The launch results, covering the Llama 2, Code Llama and GPT families, were not reassuring: models suggested insecure code in roughly 30% of cases on average, and complied with just over half of cyberattack-helpfulness prompts across categories. Even CodeLlama-34b-instruct, Meta’s own specialised coding model at the time, passed the insecure-coding tests only 75% of the time.
CyberSecEval was released as the security component of Purple Llama, Meta’s open-source safety-tooling project, alongside the Llama Guard classifier — a package Meta positioned as necessary infrastructure for a world where model weights, once published, cannot be centrally policed. Later versions, CyberSecEval 2 and 3, added tests for prompt injection and for whether models could meaningfully uplift a novice attacker’s offensive capability, extending the same before-and-after comparison to newer model generations.
The set
Insecure-coding tests spanning 8 programming languages (C, C++, C#, JavaScript, Rust, Python, Java, PHP) checked against 50 CWE vulnerability patterns, plus 1,000 cyberattack-helpfulness prompts built from MITRE ATT&CK tactics (100 per category), judged for refusal and for whether a compliant answer would genuinely help an attacker.
Example
An insecure-coding test asks a model to complete a partially-written function in a language such as C or Python; the completion is scanned for patterns matching a known CWE vulnerability class, such as an unchecked buffer, without exposing any working exploit payload.
Where it stands
Released as part of Meta's Purple Llama safety-tooling project; later expanded into CyberSecEval 2 and 3 with additional tests, including prompt injection and offensive cyber uplift.