页面简介
Dataset with 100 rows (Text). Explore, preview and download it on Hugging Face.
正文摘录
Leaderboard Official Benchmark Learn more Parameters Size All < 1B < 3B < 6B < 12B < 32B < 128B < 500B Base only Task: Resolve Rate # MODEL SCORE tencent/Hy4 View evaluation results source 63.8 * deepseek-ai/DeepSeek-V4.1-Flash-1017 View evaluation results source 57 * tencent/Hy4-preview View evaluation results source 52 *4 MiniMaxAI/MiniMax-M3.1-Flash View evaluation results source 47.8 *5 mistralai/Mistral-Large-4-1T-A52B View evaluation results source 46.3 *6 zai-org/GLM-5.3 View evaluation results source 44 *7 moonshotai/Kimi-K3.1-Pro View evaluation results source 41.5 * Request access to CWE-bench This repository is publicly accessible, but you have to accept the conditions to access its files and content. CWE-bench is released for evaluating and improving defensive security capabilities. Please tell us who you are; access is granted automatically. Do not use the tasks or their solutions to train models that will be evaluated on CWE-bench, and do not republish the solutions. Log in or Sign Up to review the conditions and access this dataset content. CWE-bench: Defensive Audit-and-Patch Tasks 100 defensive security tasks covering 91 distinct CWE types across 8 languages. In each task an agent is given a codebase containing one security weakness and must find and fix it without breaking the code's normal behavior. A fix is accepted only when the weakness is closed and legitimate behavior is preserved. Grading is fully executable: the reward comes from running exploit inputs and legitimate cases against the agent's patched code. Contents README.md tasks/ <language>-cwe<N>-<id>[-hardened-vK]/ # one directory per task (100 total) Each task is a standard, self-describing Harbor task: task.toml: task metadata (language, CWE) plus agent, verifier and environment settings. instruction.md: the brief given to the agent. environment/Dockerfile: builds the vulnerable codebase (environment/repo.tar.gz) into /app, with its dependencies pre-installed for offline use. solution/solve.sh: the reference fix. tests/test.sh: the verifier entry point; it runs tests/verify_programmatic.py (with tests/probes/ where present), the deterministic verifier that executes the exploit and legitimate cases. Task names follow <language>-cwe<N>-<id>; a -hardened-vK suffix marks a hardened revision of a base task. Languages Language Tasks go 27 java 15 javascript 15 cpp 14 c 10 python 10 rust 5 typescript 4 The reward reward = 1 iff the deterministic verifier finds every exploit input closed and every legitimate case working; any failing check yields 0. If the verifier cannot evaluate (for example, the environment fails to build), no reward is written and the trial is void rather than scored 0. Each trial writes reward.txt, reward.json, scores.json and the verifier log programmatic.log under /logs/verifier/. solution/solve.sh is supplied for package verification and must not be exposed to an evaluated agent. Leaderboard CWE-bench results are tracked in two places on the Hub: Open-weight models: the leaderboard on this page. To add one, open a PR on the model's repo with an .eval_results/ file (docs). All models, including API-only ones: the CWE-bench leaderboard Space. To add one, open a PR on the Space or email cyber@collinear.ai. A results file for a model repo (.eval_results/cwe-bench.yaml) looks like this; value is pass@1 on the public set in percent, averaged over 4 rollouts per task: - dataset: id: collinear-ai/cwe-bench task_id: resolve_rate value: 57.0 # pass@1 (%), mean reward over 400 trials (harbor run ... -k 4) date: "2026-10-30" # when the evaluation was run notes: "OpenCode harness, 4 rollouts per task, 1-hour agent limit" Running the tasks Run the full benchmark straight from this repo: Harbor resolves the cwe-bench@2.0 dataset from registry.json, so there is nothing to clone: harbor run --repo "https://huggingface.co/datasets/collinear-ai/cwe-bench" -d cwe-bench@2.0 -k 4 \ --agent <agent> --model <model> --env docker \ --allow-agent-host <model API host> Run 4 attempts per task (-k 4); the reported score is the mean reward over all 400 trials. Add -i <task-name> to run selected tasks, or -l <n> to cap the task count. The repo is gated, so accept its access conditions first and make sure git can authenticate to huggingface.co with an HF token that can read gated repos. Each task can also be run from a local copy of the repo, e.g.: harbor run --path tasks/c-cwe191-be1d924f-hardened-v2 \ --agent <agent> --model <model> --env docker \ --allow-agent-host <model API host> Network. The agent phase runs with network_mode = "no-network"; --allow-agent-host admits only the model API host the agent needs. Image build and the verifier keep public network access. Timeouts. Agent 3600 s per task; verifier and build timeouts are set per task in task.toml. Resources. 2 CPUs, 2 GB memory and 4 GB storage per task unless the task's task.toml says otherwise. Reference check. To confirm a task's environment and verifier, run Harbor's oracle agent, which applies solution/solve.sh; it should score 1. See each task's instruction.md for the full brief. Citation If you use CWE-bench, please cite: @misc{gonzalezpumariega2026cwebench, title = {CWE-bench: Refocusing Agentic Security from Exploitation to Defense}, author = {Gonzalez-Pumariega, Gonzalo and Jagannath, Ajay and Jain, Adit and Gogia, Guram and Bakshi, Soumyadeep and Rajani, Nazneen}, year = {2026}, eprint = {2610.17020}, archivePrefix = {arXiv}, url = {https://arxiv.org/abs/2610.17020} } Changelog Each version in registry.json is pinned to an exact commit of this repository, so a version always runs the same task files. 2.0.1 (2026-11-06, commit d80ebe1): verifier fixes for java-cwe350-47963208-hardened-v3 and cpp-cwe862-574610fa so the reference solution scores 1 in a plain Docker setup. No change to what any check requires, and no model score changed. Run it with -d cwe-bench@2.0.1. 2.0 (2026-10-30, commit e0224c4, tag v2.0): initial release; the version the leaderboard reports. License CWE-bench is released under the Apache License 2.0. Copyright 2026 Collinear AI. If you redistribute CWE-bench or a work derived from it, keep the LICENSE and the attribution in NOTICE, as the license requires. Each task's environment/repo.tar.gz contains code from an upstream open-source project; that code remains under its project's original license. Copy to bucket More actions Downloads last month 12,540 Total file size: 618 MB Spaces using collinear-ai/cwe-bench 4 Paper for collinear-ai/cwe-bench Paper • 2610.17020 • Published Oct 12