Datasets:
The full dataset viewer is not available (click to read why). Only showing a preview of the rows.
Error code: DatasetGenerationError
Exception: CastError
Message: Couldn't cast
input: string
output: string
reason: string
language: string
cwe: string
source: string
func_hash: string
provenance: string
to
{'input': Value('string'), 'output': Value('string'), 'reason': Value('string'), 'language': Value('string'), 'cwe': Value('string'), 'source': Value('string'), 'func_hash': Value('string')}
because column names don't match
Traceback: Traceback (most recent call last):
File "/usr/local/lib/python3.14/site-packages/datasets/builder.py", line 1827, in _prepare_split_single
for key, table in generator:
^^^^^^^^^
File "/src/services/worker/src/worker/job_runners/config/parquet_and_info.py", line 613, in wrapped
for item in generator(*args, **kwargs):
~~~~~~~~~^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.14/site-packages/datasets/packaged_modules/json/json.py", line 343, in _generate_tables
self._cast_table(pa_table, json_field_paths=json_field_paths),
~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.14/site-packages/datasets/packaged_modules/json/json.py", line 132, in _cast_table
pa_table = table_cast(pa_table, self.info.features.arrow_schema)
File "/usr/local/lib/python3.14/site-packages/datasets/table.py", line 2378, in table_cast
return cast_table_to_schema(table, schema)
File "/usr/local/lib/python3.14/site-packages/datasets/table.py", line 2306, in cast_table_to_schema
raise CastError(
...<3 lines>...
)
datasets.table.CastError: Couldn't cast
input: string
output: string
reason: string
language: string
cwe: string
source: string
func_hash: string
provenance: string
to
{'input': Value('string'), 'output': Value('string'), 'reason': Value('string'), 'language': Value('string'), 'cwe': Value('string'), 'source': Value('string'), 'func_hash': Value('string')}
because column names don't match
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/src/services/worker/src/worker/job_runners/config/parquet_and_info.py", line 1369, in compute_config_parquet_and_info_response
parquet_operations, partial, estimated_dataset_info = stream_convert_to_parquet(
~~~~~~~~~~~~~~~~~~~~~~~~~^
builder, max_dataset_size_bytes=max_dataset_size_bytes
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
)
^
File "/src/services/worker/src/worker/job_runners/config/parquet_and_info.py", line 948, in stream_convert_to_parquet
builder._prepare_split(split_generator=splits_generators[split], file_format="parquet")
~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.14/site-packages/datasets/builder.py", line 1694, in _prepare_split
for job_id, done, content in self._prepare_split_single(
~~~~~~~~~~~~~~~~~~~~~~~~~~^
gen_kwargs=gen_kwargs, job_id=job_id, **_prepare_split_args
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
):
^
File "/usr/local/lib/python3.14/site-packages/datasets/builder.py", line 1880, in _prepare_split_single
raise DatasetGenerationError("An error occurred while generating the dataset") from e
datasets.exceptions.DatasetGenerationError: An error occurred while generating the datasetNeed help to make the dataset viewer work? Make sure to review how to configure the dataset viewer, and open a discussion for direct support.
input string | output string | reason string | language string | cwe string | source string | func_hash string |
|---|---|---|---|---|---|---|
package controllers
import (
"compress/gzip"
"context"
"crypto/tls"
"html/template"
"net/http"
"net/url"
"time"
"github.com/NYTimes/gziphandler"
"github.com/gophish/gophish/auth"
"github.com/gophish/gophish/config"
ctx "github.com/gophish/gophish/context"
"github.com/gophish/gophish/controllers/api"
log ... | VULNERABLE | Matches CWE-1021 (CWE-1021). | Go | CWE-1021 | CrossVul | 880bcc1a969ff1790a7270ce88b9f766 |
package controllers
import (
"compress/gzip"
"context"
"crypto/tls"
"html/template"
"net/http"
"net/url"
"time"
"github.com/NYTimes/gziphandler"
"github.com/gophish/gophish/auth"
"github.com/gophish/gophish/config"
ctx "github.com/gophish/gophish/context"
"github.com/gophish/gophish/controllers/api"
log ... | NOT VULNERABLE | No exploitable security flaw identified. | Go | CWE-1021 | CrossVul | 4795bd422adb78e6662bedf2ec584535 |
<?php
/*
* LimeSurvey
* Copyright (C) 2007-2016 The LimeSurvey Project Team / Carsten Schmitz
* All rights reserved.
* License: GNU/GPL License v3 or later, see LICENSE.php
* LimeSurvey is free software. This version may have been modified pursuant
* to the GNU General Public License, and as distributed it includ... | VULNERABLE | Matches CWE-1021 (CWE-1021). | PHP | CWE-1021 | CrossVul | 766105b8794f900555f2a29d4b22c9bd |
<?php
/*
* LimeSurvey
* Copyright (C) 2007-2016 The LimeSurvey Project Team / Carsten Schmitz
* All rights reserved.
* License: GNU/GPL License v3 or later, see LICENSE.php
* LimeSurvey is free software. This version may have been modified pursuant
* to the GNU General Public License, and as distributed it includ... | NOT VULNERABLE | No exploitable security flaw identified. | PHP | CWE-1021 | CrossVul | 1605bc30ba85ea1de49e023e89914627 |
'use strict';
const util = require('util');
const net = require('net');
const HTTPParser = process.binding('http_parser').HTTPParser;
const assert = require('assert').ok;
const common = require('_http_common');
const parsers = common.parsers;
const freeParser = common.freeParser;
const debug = common.debug;
const CRLF... | VULNERABLE | Matches CWE-113 (CWE-113). | JavaScript | CWE-113 | CrossVul | 7596520d919f29ce619c79c07a26a60c |
'use strict';
const util = require('util');
const net = require('net');
const HTTPParser = process.binding('http_parser').HTTPParser;
const assert = require('assert').ok;
const common = require('_http_common');
const parsers = common.parsers;
const freeParser = common.freeParser;
const debug = common.debug;
const CRLF... | NOT VULNERABLE | No exploitable security flaw identified. | JavaScript | CWE-113 | CrossVul | 83fa8415247ba2df3a9fc7ce8663e1ac |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyrigt: (c) 2017, Yanis Guenane <yanis+ansible@guenane.org>
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
DOCUMENTATION = r'''
---
module... | VULNERABLE | Matches CWE-116 (CWE-116). | Python | CWE-116 | CrossVul | 5662633ce6d6167b26747eaaaeb80458 |
"#!/usr/bin/python\n# -*- coding: utf-8 -*-\n\n# Copyrigt: (c) 2017, Yanis Guenane <yanis+ansible@gu(...TRUNCATED) | NOT VULNERABLE | No exploitable security flaw identified. | Python | CWE-116 | CrossVul | b3abb87ce7682f0d6ed651a78fe12367 |
"#!/usr/bin/python\n# -*- coding: utf-8 -*-\n\n# Copyright: (c) 2016-2017, Yanis Guenane <yanis+ansi(...TRUNCATED) | VULNERABLE | Matches CWE-116 (CWE-116). | Python | CWE-116 | CrossVul | d8a4d7fe37699bf556598ca6c0d3a550 |
"#!/usr/bin/python\n# -*- coding: utf-8 -*-\n\n# Copyright: (c) 2016-2017, Yanis Guenane <yanis+ansi(...TRUNCATED) | NOT VULNERABLE | No exploitable security flaw identified. | Python | CWE-116 | CrossVul | d0f2ff9bac81334070ddf53e93ed3332 |
VulnTune: A Multi-Language Instruction-Tuning Dataset for LLM Vulnerability Detection
VulnTune is a multi-language corpus of 179,704 source-code samples labelled
VULNERABLE or NOT VULNERABLE, formatted for instruction-tuning (SFT / LoRA / PEFT)
of large language models for source-code vulnerability detection.
It merges and deduplicates public vulnerability datasets into one schema, with a CWE identifier, a short natural-language reason, and source provenance on every record. You can also use it as a standard binary classification benchmark (vulnerable vs. not vulnerable) for encoder models such as CodeBERT or UniXcoder.
Main use case: fine-tuning code LLMs to act as a vulnerability verifier, for example as a second stage that filters false positives from SAST tools (CodeQL, Semgrep, etc.) in CI/CD pipelines.
Dataset at a glance
| Total records | 179,704 (deduplicated by function hash) |
| Splits | train 144,007 / validation 17,927 / test 17,770 (≈ 80/10/10) |
| Label balance | 19,983 VULNERABLE (≈ 11.1%) / 159,721 NOT VULNERABLE |
| Languages | 20+ language tags (C/C++-dominant, see below) |
| Task | Single-task binary detection with a short reason |
| Format | JSONL, one record per line |
Label distribution per split
| Split | VULNERABLE | NOT VULNERABLE | Total | % vulnerable |
|---|---|---|---|---|
| train | 16,048 | 127,959 | 144,007 | 11.1% |
| validation | 1,945 | 15,982 | 17,927 | 10.8% |
| test | 1,990 | 15,780 | 17,770 | 11.2% |
Language distribution (all splits)
| Language | Records | Share |
|---|---|---|
| C/C++ | 162,626 | 90.50% |
| PHP | 4,411 | 2.45% |
| Python | 3,321 | 1.85% |
| JavaScript | 2,803 | 1.56% |
| Java | 2,396 | 1.33% |
| Ruby | 933 | 0.52% |
| Go | 497 | 0.28% |
| C# | 351 | 0.20% |
| Swift | 161 | 0.09% |
| Fortran | 144 | 0.08% |
| Kotlin | 72 | 0.04% |
| Other code (shell, Scala, Rust, Perl, ActionScript, CoffeeScript) | 228 | 0.13% |
| Non-code / config (xml, json, html, yaml, css) | 604 | 0.34% |
| unknown | 1,157 | 0.64% |
Data fields
| Field | Type | Description |
|---|---|---|
input |
string | The source code to analyse (usually a single function or file fragment). |
output |
string | Target label: VULNERABLE or NOT VULNERABLE. |
reason |
string | Short explanation of the label (e.g. the weakness involved, or "No exploitable security flaw identified"). |
language |
string | Programming language of input. |
cwe |
string | Associated CWE identifier (e.g. CWE-1021). For NOT VULNERABLE samples this is the CWE of the matching vulnerable (pre-patch) version, where one exists. |
source |
string | Upstream dataset the record comes from (e.g. CrossVul, Juliet, CVEfixes). |
func_hash |
string | MD5 hash of the normalised code, used for deduplication. |
Example (abbreviated)
{
"input": "func (as *AdminServer) registerRoutes() { ... }",
"output": "VULNERABLE",
"reason": "The router does not apply security-header middleware, so responses lack X-Frame-Options / CSP and the admin UI can be framed (clickjacking).",
"language": "Go",
"cwe": "CWE-1021",
"source": "CrossVul",
"func_hash": "880bcc1a969ff1790a7270ce88b9f766",
}
Many vulnerable samples have a matching patched version labelled NOT VULNERABLE
(for example, the same Go router with mid.ApplySecurityHeaders added). This helps the
model learn the actual fix instead of surface-level patterns.
Intended use
1. Instruction-tuning an LLM (main use)
The corpus is single-task, so the instruction is not repeated in every row. Apply it once as a system prompt when you format the data:
from datasets import load_dataset
ds = load_dataset("moayadterro/VulnTune")
SYSTEM_PROMPT = (
"You are a security code reviewer. Analyse the given code and answer "
"VULNERABLE or NOT VULNERABLE, followed by a one-sentence reason."
) # replace with the exact prompt that you would use
def to_chat(ex):
return {
"messages": [
{"role": "system", "content": SYSTEM_PROMPT},
{"role": "user", "content": f"Language: {ex['language']}\n\n```\n{ex['input']}\n```"},
{"role": "assistant", "content": f"{ex['output']}\nReason: {ex['reason']}"},
]
}
chat_ds = ds.map(to_chat, remove_columns=ds["train"].column_names)
# -> ready for TRL SFTTrainer / LoRA fine-tuning
2. Binary classification
ds = ds.map(lambda ex: {"label": int(ex["output"] == "VULNERABLE")})
Because only about 11% of samples are vulnerable, report precision, recall, F1 and MCC for the vulnerable class, not just accuracy. Also consider class weighting or resampling during training.
Source datasets
| Source | Origin | Licence |
|---|---|---|
| CrossVul | Hugging Face | Apache-2.0 |
| CVEfixes | Zenodo | CC BY 4.0 |
| code-security-vulnerability-dataset (ayshajavd) | Hugging Face |
The VulnTune compilation (schema, splits, and the reason/metadata fields) is released
under MIT. Individual records keep the licence of their upstream source. Please
also cite the original datasets when you use VulnTune.
Construction
- Each source is loaded and normalised into the common schema.
- Language tags are normalised and CWE IDs are mapped to the
CWE-<n>format. - Samples are deduplicated using
func_hash, both within and across sources. - Records are split into stratified 80/10/10 train/validation/test splits.
- The detection-only target (
VULNERABLE/NOT VULNERABLE) and a shortreasonare attached to each record.
Citation
@misc{terro2026vulntune,
title = {VulnTune: A Multi-Language Instruction-Tuning Dataset for LLM-Based Vulnerability Detection},
author = {Terro, Moayad},
year = {2026},
howpublished = {\url{https://huggingface.co/datasets/moayadterro/VulnTune}}
}
- Downloads last month
- 148