shubhamugare commited on
Commit
435a0a9
·
verified ·
1 Parent(s): c120ddf

Upload README.md with huggingface_hub

Browse files
Files changed (1) hide show
  1. README.md +171 -49
README.md CHANGED
@@ -1,51 +1,173 @@
1
  ---
2
- dataset_info:
3
- features:
4
- - name: id
5
- dtype: string
6
- - name: source_file
7
- dtype: string
8
- - name: original_function_name
9
- dtype: string
10
- - name: anonymized_function_name
11
- dtype: string
12
- - name: function_code
13
- dtype: string
14
- - name: includes
15
- list: string
16
- - name: dependencies
17
- list: string
18
- - name: has_bug
19
- dtype: bool
20
- - name: bug_types
21
- list: string
22
- - name: bug_line_offsets
23
- list: int32
24
- - name: bug_absolute_lines
25
- list: int32
26
- - name: bug_severities
27
- list: string
28
- - name: bug_traces
29
- list: string
30
- - name: category
31
- dtype: string
32
- - name: difficulty
33
- dtype: string
34
- - name: requires_interprocedural
35
- dtype: bool
36
- - name: start_line
37
- dtype: int32
38
- - name: end_line
39
- dtype: int32
40
- splits:
41
- - name: test
42
- num_bytes: 197434
43
- num_examples: 523
44
- download_size: 62235
45
- dataset_size: 197434
46
- configs:
47
- - config_name: default
48
- data_files:
49
- - split: test
50
- path: data/test-*
51
  ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  ---
2
+ license: mit
3
+ task_categories:
4
+ - text-classification
5
+ - text-generation
6
+ language:
7
+ - en
8
+ tags:
9
+ - code
10
+ - static-analysis
11
+ - bug-detection
12
+ - c
13
+ - memory-safety
14
+ size_categories:
15
+ - n<1K
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
16
  ---
17
+
18
+ # Infer Pulse Static Analysis Evaluation Dataset
19
+
20
+ ## Dataset Description
21
+
22
+ This dataset contains **523 C functions** extracted from Meta's [Infer](https://fbinfer.com/) static analyzer test suite, specifically the Pulse analyzer tests. It's designed for **evaluating** Large Language Models (LLMs) on static analysis tasks, particularly memory safety bug detection in C code.
23
+
24
+ **Note:** This is an evaluation-only dataset. All examples are provided in the `test` split.
25
+
26
+ ### Key Features
27
+
28
+ - **523 individual C functions** with ground truth bug annotations
29
+ - **51 unique source files** from Infer's test suite
30
+ - **5 bug categories**: NULL pointer dereference, memory leak, use-after-free, uninitialized value, resource leak
31
+ - **Smart anonymization**: Function names preserve semantic meaning while removing evaluation hints (`_bad`, `_ok` suffixes)
32
+ - **Multiple bugs per function**: Some functions contain multiple bug types (2.5% of dataset)
33
+ - **Realistic code**: Actual test cases from a production static analyzer
34
+
35
+ ## Dataset Statistics
36
+
37
+ - **Total examples:** 523
38
+ - **With bugs:** 217 (41.5%)
39
+ - **Safe (no bugs):** 306 (58.5%)
40
+ - **Unique source files:** 51
41
+
42
+ ### Bug Category Distribution
43
+
44
+ | Category | Count | Percentage |
45
+ |----------|-------|------------|
46
+ | safe | 306 | 58.5% |
47
+ | nullptr_dereference | 112 | 21.4% |
48
+ | other | 68 | 13.0% |
49
+ | memory_leak | 18 | 3.4% |
50
+ | uninitialized_value | 12 | 2.3% |
51
+ | use_after_free | 4 | 0.8% |
52
+ | resource_leak | 3 | 0.6% |
53
+
54
+ ### Difficulty Distribution
55
+
56
+ | Difficulty | Count | Percentage |
57
+ |------------|-------|------------|
58
+ | advanced | 523 | 100.0% |
59
+
60
+ ## Dataset Structure
61
+
62
+ Each example contains:
63
+
64
+ - **id**: Unique identifier
65
+ - **source_file**: Original file in Infer test suite
66
+ - **original_function_name**: Original name from Infer tests
67
+ - **anonymized_function_name**: Name with hints removed (e.g., `malloc_no_check_bad` → `malloc_no_check`)
68
+ - **function_code**: Complete C function code
69
+ - **includes**: Required #include statements
70
+ - **dependencies**: Helper functions/structs needed
71
+ - **has_bug**: Boolean indicating if function has bugs
72
+ - **bug_types**: List of bug types (NULLPTR_DEREFERENCE, MEMORY_LEAK, etc.)
73
+ - **bug_line_offsets**: Line numbers relative to function start
74
+ - **bug_absolute_lines**: Absolute line numbers in original file
75
+ - **bug_severities**: Bug severity levels
76
+ - **bug_traces**: Detailed trace information from Infer
77
+ - **category**: Primary bug category or "safe"
78
+ - **difficulty**: basic/intermediate/advanced
79
+ - **requires_interprocedural**: Whether analysis requires understanding function calls
80
+ - **start_line/end_line**: Location in original source file
81
+
82
+ ## Example
83
+
84
+ ```python
85
+ from datasets import load_dataset
86
+
87
+ dataset = load_dataset("YOUR_USERNAME/infer-pulse-eval")
88
+
89
+ # Get first test example
90
+ example = dataset['test'][0]
91
+
92
+ print(f"Function: {example['anonymized_function_name']}")
93
+ print(f"Has bug: {example['has_bug']}")
94
+ if example['has_bug']:
95
+ print(f"Bug types: {example['bug_types']}")
96
+ print(f"\nCode:\n{example['function_code']}")
97
+ ```
98
+
99
+ ## Intended Use
100
+
101
+ This dataset is designed for:
102
+
103
+ 1. **Evaluating LLMs on static analysis tasks**
104
+ 2. **Benchmarking bug detection capabilities**
105
+ 3. **Training models for code understanding**
106
+ 4. **Researching AI-assisted program analysis**
107
+
108
+ ### Evaluation Protocol
109
+
110
+ Send the LLM:
111
+ - System prompt with bug type definitions and analysis rules
112
+ - User prompt with the `function_code` and any needed `includes`
113
+
114
+ Expected LLM response format:
115
+ ```json
116
+ {
117
+ "has_bug": true|false,
118
+ "bugs": [
119
+ {
120
+ "type": "NULLPTR_DEREFERENCE",
121
+ "line": 3,
122
+ "explanation": "malloc can return NULL, dereferenced without check"
123
+ }
124
+ ]
125
+ }
126
+ ```
127
+
128
+ Compare against ground truth `has_bug` and `bug_types` fields.
129
+
130
+ ## Anonymization Strategy
131
+
132
+ Function names are "anonymized" by removing evaluation hints while **preserving semantic meaning**:
133
+
134
+ - **Removed**: `_bad`, `_ok`, `_good`, `_latent` suffixes, `FP_`, `FN_` prefixes
135
+ - **Preserved**: Descriptive parts (e.g., `malloc_no_check`, `use_after_free_simple`)
136
+
137
+ This maintains realistic code analysis conditions without giving away answers.
138
+
139
+ ## Data Source
140
+
141
+ All examples are extracted from Meta's Infer static analyzer:
142
+ - Repository: https://github.com/facebook/infer
143
+ - Test suite: `infer/tests/codetoanalyze/c/pulse/`
144
+ - Ground truth: `issues.exp` file from Infer's test expectations
145
+
146
+ ## License
147
+
148
+ MIT License (same as Infer project)
149
+
150
+ ## Citation
151
+
152
+ If you use this dataset, please cite:
153
+
154
+ ```bibtex
155
+ @misc{{infer-pulse-eval-2024,
156
+ title={{Infer Pulse Static Analysis Evaluation Dataset}},
157
+ author={{Extracted from Meta's Infer project}},
158
+ year={{2024}},
159
+ url={{https://github.com/facebook/infer}}
160
+ }}
161
+ ```
162
+
163
+ ## Contact
164
+
165
+ For questions or issues, please open an issue on the dataset repository.
166
+
167
+ ## Changelog
168
+
169
+ ### Version 1.0 (2024-11-08)
170
+ - Initial release
171
+ - 523 examples from 51 source files
172
+ - Smart anonymization preserving semantic meaning
173
+ - Multiple bugs per function support