moddemod commited on
Commit
6b3ffe8
·
verified ·
1 Parent(s): 4e2109c

Add English dataset card and verified usage examples

Browse files

Document both JSONL views, release statistics, training and full-corpus retrieval protocols. Add checksum-verified preparation, loading, evaluation, and structural audit helpers. Preserve the original data archive and legacy files.

README.md ADDED
@@ -0,0 +1,285 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ pretty_name: XArch — Cross-Architecture Binary Function Retrieval
3
+ license: other
4
+ license_name: source-project-licenses
5
+ license_link: https://huggingface.co/datasets/moddemod/xarch#licensing-and-attribution
6
+ task_categories:
7
+ - sentence-similarity
8
+ - text-retrieval
9
+ tags:
10
+ - binary-code
11
+ - assembly
12
+ - cross-architecture
13
+ - function-retrieval
14
+ - contrastive-learning
15
+ - reconstruction
16
+ size_categories:
17
+ - 100K<n<1M
18
+ viewer: false
19
+ ---
20
+
21
+ # XArch: Cross-Architecture Binary Functions
22
+
23
+ **252,672 functions · 35,472 source-function groups · 835,966 positive pairs · 8 architecture configurations**
24
+
25
+ XArch provides source-linked assembly functions and positive correspondences for cross-architecture binary code similarity research. It supports embedding adaptation, contrastive learning, cross-architecture reconstruction, and function retrieval against complete target-architecture corpora.
26
+
27
+ The release derives from **BinAtlas/noinline**, covering **20 software projects compiled with GCC 6 at O0**. Architecture configurations are `arm32`, `arm64`, `mips32`, `mips64`, `ppc32`, `ppc64`, `x86`, and `x64`.
28
+
29
+ **Start with the function view for retrieval evaluation. Use the pair view for paired training.** The two views have different schemas and should be loaded separately.
30
+
31
+ ## Quick start
32
+
33
+ The canonical data is distributed as a verified `.tar.gz` archive. The examples below download it, extract the requested view, and load the resulting JSONL files. Native dataset-viewer configurations are not provided for this archive release; the viewer is disabled to avoid interpreting metadata or statistics as training examples.
34
+
35
+ ### 1. Download and extract
36
+
37
+ Python 3.10 or newer is supported by the preparation script.
38
+
39
+ ```bash
40
+ pip install huggingface_hub datasets
41
+ ```
42
+
43
+ Download the preparation helper from this repository:
44
+
45
+ ```python
46
+ from huggingface_hub import hf_hub_download
47
+ import subprocess
48
+ import sys
49
+
50
+ script = hf_hub_download(
51
+ repo_id="moddemod/xarch",
52
+ filename="examples/prepare_dataset.py",
53
+ repo_type="dataset",
54
+ )
55
+ subprocess.run(
56
+ [sys.executable, script, "--output-dir", "./data", "--view", "functions"],
57
+ check=True,
58
+ )
59
+ ```
60
+
61
+ This creates `./data/xarch-bbdisasm-v2/` with the function files for all three splits. The helper verifies the archive checksum and the selected files against the release manifest. It stages extraction and refuses conflicting existing files.
62
+
63
+ To extract **both views**, replace `"functions"` with `"both"`. To extract only a split, add `"--splits", "test"` to the argument list. Selecting a view reduces extracted disk usage; it still downloads the complete archive.
64
+
65
+ The archive is approximately **489 MB**. The function files occupy **0.93 GB** uncompressed; both views together occupy **6.83 GB**, excluding caches and temporary extraction space. These are decimal GB values.
66
+
67
+ Already downloaded the archive? Run the helper locally with its neighboring checksum file:
68
+
69
+ ```bash
70
+ python examples/prepare_dataset.py \
71
+ --archive /path/to/xarch-bbdisasm-v2.tar.gz \
72
+ --output-dir ./data --view both
73
+ ```
74
+
75
+ ### 2. Load the function view
76
+
77
+ ```python
78
+ from datasets import load_dataset
79
+ from pathlib import Path
80
+
81
+ root = Path("./data/xarch-bbdisasm-v2")
82
+ functions = load_dataset(
83
+ "json",
84
+ data_files={
85
+ split: str(root / f"{split}.functions.jsonl")
86
+ for split in ("train", "validation", "test")
87
+ },
88
+ streaming=True,
89
+ )
90
+ row = next(iter(functions["train"]))
91
+ print(row["arch"], row["id"])
92
+ print(row["text"][:200])
93
+ ```
94
+
95
+ `streaming=True` iterates over the extracted local files without materializing the entire view as an Arrow dataset. Remove it if random access is needed and sufficient disk space is available.
96
+
97
+ ### 3. Load the pair view
98
+
99
+ First extract `--view pairs` or `--view both`, then load only the pair files:
100
+
101
+ ```python
102
+ pairs = load_dataset(
103
+ "json",
104
+ data_files={
105
+ split: str(root / f"{split}.jsonl")
106
+ for split in ("train", "validation", "test")
107
+ },
108
+ streaming=True,
109
+ )
110
+ pair = next(iter(pairs["train"]))
111
+ anchor, positive = pair["query"], pair["positive"]
112
+ source_arch, target_arch = pair["query_arch"], pair["positive_arch"]
113
+ ```
114
+
115
+ Do not use a broad `*.jsonl` pattern: it mixes the function and pair schemas. The release does not require IDA, the original binaries, or the original project's custom LLM2Vec loader.
116
+
117
+ ## Release contents
118
+
119
+ The archive contains:
120
+
121
+ ```text
122
+ xarch-bbdisasm-v2/
123
+ ├── train.functions.jsonl
124
+ ├── validation.functions.jsonl
125
+ ├── test.functions.jsonl
126
+ ├── train.jsonl
127
+ ├── validation.jsonl
128
+ ├── test.jsonl
129
+ ├── summary.json
130
+ ├── SHA256SUMS
131
+ ├── README.txt
132
+ └── example_read.py
133
+ ```
134
+
135
+ The repository additionally provides [preparation](examples/prepare_dataset.py), [JSONL inspection](examples/load_jsonl.py), and [retrieval evaluation](examples/evaluate_retrieval.py) helpers. The original archive and legacy files retain their existing names and contents.
136
+
137
+ ## Dataset statistics
138
+
139
+ | Split | Functions | Source groups | Positive pairs |
140
+ |---|---:|---:|---:|
141
+ | Train | 199,408 | 27,946 | 660,178 |
142
+ | Validation | 26,277 | 3,771 | 85,857 |
143
+ | Test | 26,987 | 3,755 | 89,931 |
144
+ | **Total** | **252,672** | **35,472** | **835,966** |
145
+
146
+ | Configuration | Train | Validation | Test | Total |
147
+ |---|---:|---:|---:|---:|
148
+ | ARM32 | 24,237 | 3,202 | 3,282 | 30,721 |
149
+ | ARM64 | 24,447 | 3,220 | 3,306 | 30,973 |
150
+ | MIPS32 | 24,761 | 3,237 | 3,334 | 31,332 |
151
+ | MIPS64 | 24,767 | 3,249 | 3,321 | 31,337 |
152
+ | PPC32 | 24,710 | 3,251 | 3,338 | 31,299 |
153
+ | PPC64 | 24,777 | 3,254 | 3,325 | 31,356 |
154
+ | x86 | 25,830 | 3,439 | 3,543 | 32,812 |
155
+ | x64 | 25,879 | 3,425 | 3,538 | 32,842 |
156
+
157
+ Additional release inventories are available under [`statistics/`](https://huggingface.co/datasets/moddemod/xarch/tree/main/statistics): architecture counts, project counts, source-group coverage, and all **168 split–direction combinations** (56 directions for each split). These are data inventories, not model-performance measurements.
158
+
159
+ Published pairs follow the release's original orientation; their count is not the number of all ordered source–target retrieval combinations. Groups represented in more architectures contribute more positive pairs.
160
+
161
+ ## Record schemas
162
+
163
+ ### Function view: `*.functions.jsonl`
164
+
165
+ Each line is one function. The fields are:
166
+
167
+ | Field | Meaning |
168
+ |---|---|
169
+ | `id` | Function identifier within the release |
170
+ | `group_id` | Source-linked identity used to define known correspondences |
171
+ | `split` | `train`, `validation`, or `test` |
172
+ | `arch` | One of the eight configuration identifiers listed above |
173
+ | `project`, `artifact` | Source-project and binary-artifact provenance |
174
+ | `num_blocks`, `num_instructions` | Function-size metadata |
175
+ | `opcode_hash` | SHA256 of the ordered instruction-mnemonic sequence |
176
+ | `text` | Full exported assembly text, with newline-separated instructions |
177
+
178
+ ### Pair view: `train.jsonl`, `validation.jsonl`, `test.jsonl`
179
+
180
+ Each line is one cross-architecture positive pair:
181
+
182
+ | Fields | Meaning |
183
+ |---|---|
184
+ | `group_id`, `split` | Shared source identity and partition |
185
+ | `query_id`, `positive_id` | IDs referencing the corresponding function records |
186
+ | `query_arch`, `positive_arch` | Source and target architecture configurations |
187
+ | `query`, `positive` | Assembly text of the two functions |
188
+
189
+ All records are UTF-8 JSON Lines. Escaped newlines in a raw JSON line become actual newlines after parsing with `json.loads`.
190
+
191
+ ## Training recipes
192
+
193
+ - **Embedding adaptation / InfoNCE:** use `query` and `positive` as paired inputs. If constructing in-batch negatives, treat all known same-group counterparts as positives rather than accidental negatives. The release contains no explicit negative labels.
194
+ - **Cross-architecture reconstruction:** condition on `query` and `positive_arch`, with `positive` as the target implementation. Source/target architecture metadata can be used in the instruction; group IDs should remain supervision metadata.
195
+ - **Reranker training:** construct and audit negatives from the training split only. Exclude known same-group counterparts and check model-visible input collisions after tokenization/truncation. Different group IDs alone do not prove semantic non-equivalence.
196
+
197
+ Use assembly text, optionally with an architecture instruction, as the model input. Keep function IDs, group IDs, and project/artifact identity out of benchmark encoder inputs. Model tokenizers may truncate long functions even though the stored text is not truncated.
198
+
199
+ ## Retrieval evaluation
200
+
201
+ Use the **function view**, not sampled pair rows, to construct the evaluation corpus.
202
+
203
+ For each ordered source→target direction:
204
+
205
+ 1. Select source-configuration functions from a fixed split.
206
+ 2. Include **every target-configuration function from the same split** in the candidate corpus.
207
+ 3. Define relevance by equal `group_id`.
208
+ 4. Exclude queries with no known counterpart in the target corpus and report how many were excluded.
209
+ 5. Rank candidates by embedding similarity and evaluate against all known relevant candidates.
210
+
211
+ Eight configurations give **56 ordered cross-architecture directions**. A full-ranking MRR uses the first relevant rank in the entire candidate corpus. Recall@K measures the fraction of relevant functions retrieved; Hit@K measures whether any relevant function is retrieved. NDCG@K uses binary relevance. Macro-average direction-level results for equal weighting across directions, and label query-weighted or ISA-family-specific averages separately.
212
+
213
+ The example evaluator first writes deterministic, ID-sorted query and candidate files:
214
+
215
+ ```bash
216
+ python examples/evaluate_retrieval.py \
217
+ --dataset-dir ./data/xarch-bbdisasm-v2 --split test \
218
+ --source arm64 --target x64 --output-dir ./eval_arm64_x64
219
+ ```
220
+
221
+ For this release, the test `arm64→x64` plan contains **3,300 eligible queries**, **3,538 candidates**, and **6 excluded queries**.
222
+
223
+ Encode `queries.jsonl` and `candidates.jsonl` in **exactly their exported row order**, using only their `text` and any chosen architecture instruction. Save the two matrices as `.npy` files, then run:
224
+
225
+ ```bash
226
+ pip install numpy
227
+ python examples/evaluate_retrieval.py \
228
+ --dataset-dir ./data/xarch-bbdisasm-v2 --split test \
229
+ --source arm64 --target x64 --output-dir ./eval_arm64_x64 \
230
+ --query-embeddings queries.npy --candidate-embeddings candidates.npy
231
+ ```
232
+
233
+ The evaluator normalizes vectors, performs exact cosine ranking, and resolves ties by ascending candidate ID. Report checkpoint identity, candidate/query counts, input token limit, pooling, tie handling, split, and aggregation alongside model metrics.
234
+
235
+ ## Construction and split integrity
236
+
237
+ Source correspondence uses DWARF information and binary-artifact metadata rather than bare function names. Curation retains functions with at least five basic blocks, performs cross-split opcode-hash deduplication with priority **test > validation > train**, and removes groups represented in fewer than two configurations.
238
+
239
+ The opcode hash uses an ordered JSON array of lowercased, stripped instruction mnemonics, without operands or architecture tags. Functions are exported in ascending basic-block-address order and original instruction order within blocks. No block markers, function-name headers, instruction normalization, or export-time truncation are added.
240
+
241
+ The final-release [structural audit](statistics/final_release_audit.json) reports zero cross-split source-group overlap, cross-split stored opcode-hash overlap, duplicate IDs within splits, empty disassembly, functions below the block threshold, or groups below the architecture threshold. These structural checks are not a manual semantic-equivalence audit. The [audit script](statistics/audit_xarch.py) can regenerate the inventories from the extracted release.
242
+
243
+ ## Scope and limitations
244
+
245
+ - **Source-group-disjoint, not project-disjoint.** All 20 projects occur in every split. Do not randomly re-split pair rows: functions in the same source group must remain together.
246
+ - **Fixed compilation scope.** This release does not establish generalization across optimization levels, compiler families, or unseen projects.
247
+ - **Source-linked correspondence, not a formal proof.** Same-group implementations are known correspondences; unrelated group IDs do not establish different semantics.
248
+ - **Assembly-text export.** Original machine bytes and complete control-flow edges are not included. Reconstruction can learn from assembly targets, but generated assembly is not automatically verified as executable or semantically equivalent.
249
+ - **No model results implied.** Dataset inventories, structural checks, and example scripts do not establish any model's retrieval performance.
250
+
251
+ ## Versioning and integrity
252
+
253
+ The data release identifier is **`ppc64_entry_repaired_v2`** (2026-10-09). This documentation update does not change the archive or its records. The retained technical identifier is also recorded in `summary.json`.
254
+
255
+ For reproducible experiments, record the dataset repository commit and source-file checksums. With a complete extraction, verify all packaged files using:
256
+
257
+ ```bash
258
+ cd data/xarch-bbdisasm-v2
259
+ sha256sum -c SHA256SUMS
260
+ ```
261
+
262
+ For a selectively extracted view, the preparation helper verifies only the selected files and accompanying metadata; the full checksum command will also mention the intentionally unextracted files.
263
+
264
+ ## Licensing and attribution
265
+
266
+ This export does not assign a new blanket license to the underlying code. Source-project licenses and notices have not been consolidated into the package. Project and artifact fields preserve attribution; users should consult the relevant upstream projects before redistribution or other use.
267
+
268
+ Please acknowledge the **BinAtlas/noinline** source collection and the underlying software projects, in addition to this derived text release.
269
+
270
+ ## Citation
271
+
272
+ To cite this dataset release:
273
+
274
+ ```bibtex
275
+ @misc{xarch_dataset_2026,
276
+ author = {{moddemod}},
277
+ title = {{XArch: Cross-Architecture Binary Functions}},
278
+ year = {2026},
279
+ howpublished = {Hugging Face dataset repository},
280
+ url = {https://huggingface.co/datasets/moddemod/xarch},
281
+ note = {Data release: ppc64_entry_repaired_v2}
282
+ }
283
+ ```
284
+
285
+ For questions, reproducibility issues, or corrections, use the repository's **Community** tab and include the release/commit, file name, and minimal reproduction steps.
examples/evaluate_retrieval.py ADDED
@@ -0,0 +1,96 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Create an exact cross-architecture plan and optionally score aligned embeddings."""
2
+ import argparse
3
+ import hashlib
4
+ import json
5
+ from pathlib import Path
6
+
7
+ ARCHES = ['arm32', 'arm64', 'mips32', 'mips64', 'ppc32', 'ppc64', 'x86', 'x64']
8
+
9
+
10
+ def plan(records, source, target):
11
+ candidates = sorted([r for r in records if r['arch'] == target], key=lambda r: r['id'])
12
+ relevant = {r['group_id'] for r in candidates}
13
+ source_rows = sorted([r for r in records if r['arch'] == source], key=lambda r: r['id'])
14
+ queries = [r for r in source_rows if r['group_id'] in relevant]
15
+ return queries, candidates, len(source_rows) - len(queries)
16
+
17
+
18
+ def metrics(query_vectors, candidate_vectors, queries, candidates, cutoffs=(1, 10, 50)):
19
+ import numpy as np
20
+ q = np.asarray(query_vectors, dtype=np.float32)
21
+ d = np.asarray(candidate_vectors, dtype=np.float32)
22
+ if q.ndim != 2 or d.ndim != 2 or q.shape[1] != d.shape[1]:
23
+ raise ValueError('Embeddings must be two matrices with the same feature dimension')
24
+ if len(q) != len(queries) or len(d) != len(candidates) or not len(q) or not len(d):
25
+ raise ValueError('Embedding rows must match a nonempty exported plan exactly')
26
+ if not np.isfinite(q).all() or not np.isfinite(d).all():
27
+ raise ValueError('Embeddings contain non-finite values')
28
+ qnorm = np.linalg.norm(q, axis=1, keepdims=True)
29
+ dnorm = np.linalg.norm(d, axis=1, keepdims=True)
30
+ if (qnorm <= 0).any() or (dnorm <= 0).any():
31
+ raise ValueError('Zero-norm embeddings are not valid')
32
+ q, d = q / qnorm, d / dnorm
33
+ dg = np.array([r['group_id'] for r in candidates])
34
+ scores = {'mrr': []}
35
+ for k in cutoffs:
36
+ scores.update({f'{m}@{k}': [] for m in ['recall', 'hit', 'ndcg']})
37
+ for start in range(0, len(q), 128):
38
+ similarities = q[start:start + 128] @ d.T
39
+ # Candidate IDs were sorted in the plan, so stable sorting resolves ties.
40
+ orders = np.argsort(-similarities, axis=1, kind='stable')
41
+ for offset, order in enumerate(orders):
42
+ gold = dg == queries[start + offset]['group_id']
43
+ ranked = gold[order]
44
+ count = int(gold.sum())
45
+ if count == 0:
46
+ raise ValueError('Plan contains a query with no known counterpart')
47
+ scores['mrr'].append(1. / (np.flatnonzero(ranked)[0] + 1))
48
+ for k in cutoffs:
49
+ found = ranked[:k]
50
+ scores[f'recall@{k}'].append(float(found.sum()) / count)
51
+ scores[f'hit@{k}'].append(float(found.any()))
52
+ discounts = 1. / np.log2(np.arange(2, len(found) + 2))
53
+ ideal = (1. / np.log2(np.arange(2, min(k, count) + 2))).sum()
54
+ scores[f'ndcg@{k}'].append(float((found * discounts).sum() / ideal))
55
+ return {key: float(np.mean(values)) for key, values in scores.items()}
56
+
57
+
58
+ def main():
59
+ p = argparse.ArgumentParser(description=__doc__)
60
+ p.add_argument('--dataset-dir', required=True)
61
+ p.add_argument('--split', choices=['validation', 'test'], default='test')
62
+ p.add_argument('--source', choices=ARCHES, required=True)
63
+ p.add_argument('--target', choices=ARCHES, required=True)
64
+ p.add_argument('--output-dir', required=True)
65
+ p.add_argument('--query-embeddings', type=Path)
66
+ p.add_argument('--candidate-embeddings', type=Path)
67
+ args = p.parse_args()
68
+ if args.source == args.target:
69
+ p.error('Source and target must differ for this cross-architecture example')
70
+ if bool(args.query_embeddings) != bool(args.candidate_embeddings):
71
+ p.error('Provide both embedding files or neither')
72
+ source = Path(args.dataset_dir) / f'{args.split}.functions.jsonl'
73
+ with source.open(encoding='utf-8') as stream:
74
+ records = [json.loads(line) for line in stream]
75
+ queries, candidates, skipped = plan(records, args.source, args.target)
76
+ out = Path(args.output_dir)
77
+ out.mkdir(parents=True, exist_ok=True)
78
+ for filename, rows in [('queries.jsonl', queries), ('candidates.jsonl', candidates)]:
79
+ with (out / filename).open('w', encoding='utf-8') as stream:
80
+ for row in rows:
81
+ stream.write(json.dumps(row, ensure_ascii=False) + '\n')
82
+ signature = hashlib.sha256(source.read_bytes()).hexdigest()
83
+ result = {'split': args.split, 'direction': args.source + '->' + args.target,
84
+ 'queries': len(queries), 'candidates': len(candidates), 'skipped_queries': skipped,
85
+ 'source_sha256': signature, 'ordering': 'function ID ascending',
86
+ 'relevance': 'same group_id', 'candidate_scope': 'all target-architecture functions in split'}
87
+ if args.query_embeddings:
88
+ import numpy as np
89
+ result['metrics'] = metrics(np.load(args.query_embeddings, allow_pickle=False),
90
+ np.load(args.candidate_embeddings, allow_pickle=False), queries, candidates)
91
+ (out / 'report.json').write_text(json.dumps(result, indent=2) + '\n')
92
+ print(json.dumps(result, indent=2))
93
+
94
+
95
+ if __name__ == '__main__':
96
+ main()
examples/load_jsonl.py ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Inspect either XArch JSONL schema without loading the whole split into RAM."""
2
+ import argparse
3
+ import itertools
4
+ import json
5
+ from pathlib import Path
6
+
7
+
8
+ def iter_records(dataset_dir, split='train', view='functions'):
9
+ suffix = '.functions.jsonl' if view == 'functions' else '.jsonl'
10
+ path = Path(dataset_dir) / (split + suffix)
11
+ with path.open(encoding='utf-8') as stream:
12
+ for line in stream:
13
+ yield json.loads(line)
14
+
15
+
16
+ def main():
17
+ p = argparse.ArgumentParser(description=__doc__)
18
+ p.add_argument('--dataset-dir', required=True)
19
+ p.add_argument('--view', choices=['functions', 'pairs'], default='functions')
20
+ p.add_argument('--split', choices=['train', 'validation', 'test'], default='train')
21
+ p.add_argument('--limit', type=int, default=2)
22
+ args = p.parse_args()
23
+ for record in itertools.islice(iter_records(args.dataset_dir, args.split, args.view), args.limit):
24
+ example = dict(record)
25
+ for name in ['text', 'query', 'positive']:
26
+ if name in example:
27
+ example[name] = example[name][:240]
28
+ print(json.dumps(example, indent=2, ensure_ascii=False))
29
+
30
+
31
+ if __name__ == '__main__':
32
+ main()
examples/prepare_dataset.py ADDED
@@ -0,0 +1,120 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Download and verify XArch, then extract the requested JSONL view (Python 3.10+)."""
2
+ import argparse
3
+ import hashlib
4
+ import json
5
+ from pathlib import Path, PurePosixPath
6
+ import shutil
7
+ import tarfile
8
+ import tempfile
9
+
10
+ REPO = 'moddemod/xarch'
11
+ ARCHIVE = 'xarch-bbdisasm-v2.tar.gz'
12
+ RELEASE = 'xarch-bbdisasm-v2'
13
+ SPLITS = ['train', 'validation', 'test']
14
+ METADATA = {'README.txt', 'summary.json', 'SHA256SUMS', 'example_read.py'}
15
+
16
+
17
+ def sha256(path):
18
+ h = hashlib.sha256()
19
+ with Path(path).open('rb') as stream:
20
+ for block in iter(lambda: stream.read(1024 * 1024), b''):
21
+ h.update(block)
22
+ return h.hexdigest()
23
+
24
+
25
+ def extract_verified(archive, output_dir, views, splits, expected_sha256):
26
+ archive, output_dir = Path(archive), Path(output_dir).resolve()
27
+ if sha256(archive) != expected_sha256:
28
+ raise ValueError('Archive SHA256 mismatch; no dataset files were replaced.')
29
+ selected = {f'{s}.functions.jsonl' for s in splits} if 'functions' in views else set()
30
+ if 'pairs' in views:
31
+ selected |= {f'{s}.jsonl' for s in splits}
32
+ wanted = selected | METADATA
33
+ output_dir.mkdir(parents=True, exist_ok=True)
34
+ with tempfile.TemporaryDirectory(prefix='.xarch-stage-', dir=output_dir) as temp:
35
+ staging = Path(temp)
36
+ seen = set()
37
+ with tarfile.open(archive, 'r|gz') as tar:
38
+ for member in tar:
39
+ relative = PurePosixPath(member.name)
40
+ if relative.is_absolute() or '..' in relative.parts or not relative.parts or relative.parts[0] != RELEASE:
41
+ raise ValueError('Unsafe or unexpected archive path')
42
+ if not member.isdir() and not member.isfile():
43
+ raise ValueError('Only regular files and directories are accepted')
44
+ if not member.isfile():
45
+ continue
46
+ if len(relative.parts) != 2:
47
+ raise ValueError('Unexpected nested file')
48
+ name = relative.name
49
+ if name not in wanted:
50
+ continue
51
+ if name in seen:
52
+ raise ValueError('Duplicate archive member')
53
+ seen.add(name)
54
+ with tar.extractfile(member) as source, (staging / name).open('wb') as target:
55
+ shutil.copyfileobj(source, target, length=1024 * 1024)
56
+ if seen != wanted:
57
+ raise ValueError('Requested files or release metadata are missing')
58
+ summary = json.loads((staging / 'summary.json').read_text())
59
+ for name in selected:
60
+ spec = summary['files'][name]
61
+ if (staging / name).stat().st_size != spec['bytes'] or sha256(staging / name) != spec['sha256']:
62
+ raise ValueError('Extracted JSONL does not match the release manifest')
63
+ checksums = {}
64
+ for line in (staging / 'SHA256SUMS').read_text().splitlines():
65
+ checksum, name = line.split(maxsplit=1)
66
+ checksums[name.lstrip('*')] = checksum
67
+ for name in wanted - {'SHA256SUMS'}:
68
+ if sha256(staging / name) != checksums[name]:
69
+ raise ValueError('Release checksum mismatch: ' + name)
70
+ target = output_dir / RELEASE
71
+ if target.is_symlink():
72
+ raise FileExistsError('The destination release directory must not be a symlink')
73
+ target.mkdir(exist_ok=True)
74
+ # Check every destination before replacing anything. A partial extraction
75
+ # may be extended with another view, but conflicting files are refused.
76
+ for name in wanted:
77
+ if (target / name).is_symlink():
78
+ raise FileExistsError('Refusing an existing symlink: ' + str(target / name))
79
+ if (target / name).exists() and sha256(target / name) != sha256(staging / name):
80
+ raise FileExistsError('Conflicting existing file: ' + str(target / name))
81
+ for name in sorted(wanted):
82
+ if not (target / name).exists():
83
+ (staging / name).replace(target / name)
84
+ return target
85
+
86
+
87
+ def main():
88
+ parser = argparse.ArgumentParser(description=__doc__)
89
+ parser.add_argument('--output-dir', default='./data')
90
+ parser.add_argument('--view', choices=['functions', 'pairs', 'both'], default='functions')
91
+ parser.add_argument('--splits', nargs='+', choices=SPLITS, default=SPLITS)
92
+ parser.add_argument('--revision', default='main')
93
+ parser.add_argument('--archive', type=Path, help='Use an already downloaded archive')
94
+ parser.add_argument('--expected-sha256', help='Optional explicit checksum for --archive')
95
+ args = parser.parse_args()
96
+ if args.archive:
97
+ archive = args.archive
98
+ checksum_file = archive.with_name(archive.name + '.sha256')
99
+ if args.expected_sha256:
100
+ checksum = args.expected_sha256
101
+ elif checksum_file.exists():
102
+ checksum = checksum_file.read_text().split()[0]
103
+ else:
104
+ parser.error('Provide the neighboring .sha256 file or --expected-sha256')
105
+ revision = 'local archive'
106
+ else:
107
+ from huggingface_hub import HfApi, hf_hub_download
108
+ # Resolve main once so both downloaded files belong to the same commit.
109
+ revision = HfApi().dataset_info(REPO, revision=args.revision).sha
110
+ archive = hf_hub_download(REPO, ARCHIVE, repo_type='dataset', revision=revision)
111
+ checksum_file = hf_hub_download(REPO, ARCHIVE + '.sha256', repo_type='dataset', revision=revision)
112
+ checksum = Path(checksum_file).read_text().split()[0]
113
+ views = ['functions', 'pairs'] if args.view == 'both' else [args.view]
114
+ target = extract_verified(archive, args.output_dir, views, args.splits, checksum)
115
+ print(json.dumps({'dataset_dir': str(target), 'views': views, 'splits': args.splits,
116
+ 'revision': revision, 'archive_sha256': checksum}, indent=2))
117
+
118
+
119
+ if __name__ == '__main__':
120
+ main()
statistics/architecture_inventory.csv ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
 
1
+ arch,train,validation,test,total
2
+ arm32,24237,3202,3282,30721
3
+ arm64,24447,3220,3306,30973
4
+ mips32,24761,3237,3334,31332
5
+ mips64,24767,3249,3321,31337
6
+ ppc32,24710,3251,3338,31299
7
+ ppc64,24777,3254,3325,31356
8
+ x86,25830,3439,3543,32812
9
+ x64,25879,3425,3538,32842
statistics/audit_xarch.py ADDED
@@ -0,0 +1,95 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Recompute paper inventory and structural checks from the released JSONL.
2
+
3
+ This audits the final release. It cannot reconstruct unknown intermediate
4
+ filter counts or assess semantic label correctness.
5
+ """
6
+ import argparse
7
+ import collections
8
+ import csv
9
+ import hashlib
10
+ import itertools
11
+ import json
12
+ from pathlib import Path
13
+
14
+ ARCHS = ['arm32', 'arm64', 'mips32', 'mips64', 'ppc32', 'ppc64', 'x86', 'x64']
15
+
16
+
17
+ def main():
18
+ parser = argparse.ArgumentParser()
19
+ parser.add_argument('--dataset', type=Path, required=True)
20
+ parser.add_argument('--output', type=Path, required=True)
21
+ args = parser.parse_args()
22
+ args.output.mkdir(parents=True, exist_ok=True)
23
+ counts, source_hashes, groups, opcodes, identifiers, per_arch = {}, {}, {}, {}, {}, {}
24
+ checks = collections.Counter()
25
+ for split in ['train', 'validation', 'test']:
26
+ path = args.dataset / f'{split}.functions.jsonl'
27
+ digest = hashlib.sha256()
28
+ groups[split] = collections.defaultdict(collections.Counter)
29
+ opcodes[split], identifiers[split] = set(), set()
30
+ projects, functions = set(), 0
31
+ with path.open('rb') as source:
32
+ for raw in source:
33
+ digest.update(raw)
34
+ row = json.loads(raw)
35
+ arch = row['arch']
36
+ assert arch in ARCHS
37
+ functions += 1
38
+ projects.add(row['project'])
39
+ groups[split][row['group_id']][arch] += 1
40
+ checks['repeated_ids_within_split'] += row['id'] in identifiers[split]
41
+ identifiers[split].add(row['id'])
42
+ checks['functions_below_five_blocks'] += row['num_blocks'] < 5
43
+ checks['empty_disassembly_records'] += not row['text'].strip()
44
+ checks['incorrect_split_labels'] += row['split'] != split
45
+ checks['missing_opcode_hashes'] += not bool(row['opcode_hash'])
46
+ opcodes[split].add(row['opcode_hash'])
47
+ source_hashes[split] = digest.hexdigest()
48
+ checks['groups_below_two_architectures'] += sum(len(x) < 2 for x in groups[split].values())
49
+ per_arch[split] = {a: sum(x[a] for x in groups[split].values()) for a in ARCHS}
50
+ counts[split] = {'functions': functions, 'groups': len(groups[split]),
51
+ 'projects': len(projects), 'architectures': per_arch[split]}
52
+ overlaps = []
53
+ for a, b in itertools.combinations(counts, 2):
54
+ g = len(set(groups[a]) & set(groups[b]))
55
+ h = len(opcodes[a] & opcodes[b])
56
+ checks['cross_split_group_overlaps'] += g
57
+ checks['cross_split_opcode_overlaps'] += h
58
+ overlaps.append({'split_a': a, 'split_b': b, 'shared_groups': g, 'shared_opcode_hashes': h})
59
+ manifest = json.loads((args.dataset / 'summary.json').read_text())
60
+ for split, value in counts.items():
61
+ assert value['functions'] == manifest['counts'][split]['functions']
62
+ assert value['groups'] == manifest['counts'][split]['groups']
63
+ assert source_hashes[split] == manifest['files'][f'{split}.functions.jsonl']['sha256']
64
+ value['positive_pairs'] = manifest['counts'][split]['positive_pairs']
65
+ summary = {'counts': counts, 'source_sha256': source_hashes, 'structural_checks': dict(checks),
66
+ 'split_overlaps': overlaps, 'manual_correspondence_audit': 'pending',
67
+ 'intermediate_construction_counts': 'not recoverable from final records alone'}
68
+ (args.output / 'final_release_audit.json').write_text(json.dumps(summary, indent=2))
69
+ with (args.output / 'architecture_inventory.csv').open('w', newline='') as file:
70
+ writer = csv.DictWriter(file, fieldnames=['arch', 'train', 'validation', 'test', 'total'])
71
+ writer.writeheader()
72
+ for arch in ARCHS:
73
+ record = {'arch': arch, **{s: per_arch[s][arch] for s in counts}}
74
+ record['total'] = sum(per_arch[s][arch] for s in counts)
75
+ writer.writerow(record)
76
+ directions = []
77
+ for split in counts:
78
+ for a, b in itertools.permutations(ARCHS, 2):
79
+ valid = sum(g[a] for g in groups[split].values() if g[b] > 0)
80
+ pairs = sum(g[a] * g[b] for g in groups[split].values())
81
+ directions.append({'split': split, 'source_arch': a, 'target_arch': b,
82
+ 'source_functions': per_arch[split][a],
83
+ 'eligible_queries': valid, 'excluded_queries': per_arch[split][a] - valid,
84
+ 'candidate_functions': per_arch[split][b], 'known_positive_combinations': pairs})
85
+ with (args.output / 'direction_inventory.csv').open('w', newline='') as file:
86
+ writer = csv.DictWriter(file, fieldnames=list(directions[0]))
87
+ writer.writeheader()
88
+ writer.writerows(directions)
89
+ print(json.dumps({'functions': sum(x['functions'] for x in counts.values()),
90
+ 'groups': sum(x['groups'] for x in counts.values()), 'checks': dict(checks),
91
+ 'direction_rows': len(directions)}, indent=2))
92
+
93
+
94
+ if __name__ == '__main__':
95
+ main()
statistics/direction_inventory.csv ADDED
@@ -0,0 +1,169 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ split,source_arch,target_arch,source_functions,eligible_queries,excluded_queries,candidate_functions,known_positive_combinations
2
+ train,arm32,arm64,24237,22772,1465,24447,22772
3
+ train,arm32,mips32,24237,24171,66,24761,24171
4
+ train,arm32,mips64,24237,22860,1377,24767,22860
5
+ train,arm32,ppc32,24237,24112,125,24710,24112
6
+ train,arm32,ppc64,24237,22799,1438,24777,22799
7
+ train,arm32,x86,24237,23982,255,25830,23982
8
+ train,arm32,x64,24237,22735,1502,25879,22735
9
+ train,arm64,arm32,24447,22772,1675,24237,22772
10
+ train,arm64,mips32,24447,22974,1473,24761,22974
11
+ train,arm64,mips64,24447,24396,51,24767,24396
12
+ train,arm64,ppc32,24447,22922,1525,24710,22922
13
+ train,arm64,ppc64,24447,24320,127,24777,24320
14
+ train,arm64,x86,24447,22822,1625,25830,22822
15
+ train,arm64,x64,24447,24292,155,25879,24292
16
+ train,mips32,arm32,24761,24171,590,24237,24171
17
+ train,mips32,arm64,24761,22974,1787,24447,22974
18
+ train,mips32,mips64,24761,23261,1500,24767,23261
19
+ train,mips32,ppc32,24761,24492,269,24710,24492
20
+ train,mips32,ppc64,24761,23098,1663,24777,23098
21
+ train,mips32,x86,24761,24343,418,25830,24343
22
+ train,mips32,x64,24761,22973,1788,25879,22973
23
+ train,mips64,arm32,24767,22860,1907,24237,22860
24
+ train,mips64,arm64,24767,24396,371,24447,24396
25
+ train,mips64,mips32,24767,23261,1506,24761,23261
26
+ train,mips64,ppc32,24767,23044,1723,24710,23044
27
+ train,mips64,ppc64,24767,24543,224,24777,24543
28
+ train,mips64,x86,24767,22928,1839,25830,22928
29
+ train,mips64,x64,24767,24380,387,25879,24380
30
+ train,ppc32,arm32,24710,24112,598,24237,24112
31
+ train,ppc32,arm64,24710,22922,1788,24447,22922
32
+ train,ppc32,mips32,24710,24492,218,24761,24492
33
+ train,ppc32,mips64,24710,23044,1666,24767,23044
34
+ train,ppc32,ppc64,24710,23175,1535,24777,23175
35
+ train,ppc32,x86,24710,24290,420,25830,24290
36
+ train,ppc32,x64,24710,22952,1758,25879,22952
37
+ train,ppc64,arm32,24777,22799,1978,24237,22799
38
+ train,ppc64,arm64,24777,24320,457,24447,24320
39
+ train,ppc64,mips32,24777,23098,1679,24761,23098
40
+ train,ppc64,mips64,24777,24543,234,24767,24543
41
+ train,ppc64,ppc32,24777,23175,1602,24710,23175
42
+ train,ppc64,x86,24777,22905,1872,25830,22905
43
+ train,ppc64,x64,24777,24320,457,25879,24320
44
+ train,x86,arm32,25830,23982,1848,24237,23982
45
+ train,x86,arm64,25830,22822,3008,24447,22822
46
+ train,x86,mips32,25830,24343,1487,24761,24343
47
+ train,x86,mips64,25830,22928,2902,24767,22928
48
+ train,x86,ppc32,25830,24290,1540,24710,24290
49
+ train,x86,ppc64,25830,22905,2925,24777,22905
50
+ train,x86,x64,25830,24317,1513,25879,24317
51
+ train,x64,arm32,25879,22735,3144,24237,22735
52
+ train,x64,arm64,25879,24292,1587,24447,24292
53
+ train,x64,mips32,25879,22973,2906,24761,22973
54
+ train,x64,mips64,25879,24380,1499,24767,24380
55
+ train,x64,ppc32,25879,22952,2927,24710,22952
56
+ train,x64,ppc64,25879,24320,1559,24777,24320
57
+ train,x64,x86,25879,24317,1562,25830,24317
58
+ validation,arm32,arm64,3202,2963,239,3220,2963
59
+ validation,arm32,mips32,3202,3195,7,3237,3195
60
+ validation,arm32,mips64,3202,2969,233,3249,2969
61
+ validation,arm32,ppc32,3202,3190,12,3251,3190
62
+ validation,arm32,ppc64,3202,2957,245,3254,2957
63
+ validation,arm32,x86,3202,3148,54,3439,3148
64
+ validation,arm32,x64,3202,2925,277,3425,2925
65
+ validation,arm64,arm32,3220,2963,257,3202,2963
66
+ validation,arm64,mips32,3220,2974,246,3237,2974
67
+ validation,arm64,mips64,3220,3216,4,3249,3216
68
+ validation,arm64,ppc32,3220,2967,253,3251,2967
69
+ validation,arm64,ppc64,3220,3202,18,3254,3202
70
+ validation,arm64,x86,3220,2939,281,3439,2939
71
+ validation,arm64,x64,3220,3165,55,3425,3165
72
+ validation,mips32,arm32,3237,3195,42,3202,3195
73
+ validation,mips32,arm64,3237,2974,263,3220,2974
74
+ validation,mips32,mips64,3237,3001,236,3249,3001
75
+ validation,mips32,ppc32,3237,3213,24,3251,3213
76
+ validation,mips32,ppc64,3237,2976,261,3254,2976
77
+ validation,mips32,x86,3237,3171,66,3439,3171
78
+ validation,mips32,x64,3237,2943,294,3425,2943
79
+ validation,mips64,arm32,3249,2969,280,3202,2969
80
+ validation,mips64,arm64,3249,3216,33,3220,3216
81
+ validation,mips64,mips32,3249,3001,248,3237,3001
82
+ validation,mips64,ppc32,3249,2979,270,3251,2979
83
+ validation,mips64,ppc64,3249,3218,31,3254,3218
84
+ validation,mips64,x86,3249,2948,301,3439,2948
85
+ validation,mips64,x64,3249,3175,74,3425,3175
86
+ validation,ppc32,arm32,3251,3190,61,3202,3190
87
+ validation,ppc32,arm64,3251,2967,284,3220,2967
88
+ validation,ppc32,mips32,3251,3213,38,3237,3213
89
+ validation,ppc32,mips64,3251,2979,272,3249,2979
90
+ validation,ppc32,ppc64,3251,2997,254,3254,2997
91
+ validation,ppc32,x86,3251,3184,67,3439,3184
92
+ validation,ppc32,x64,3251,2941,310,3425,2941
93
+ validation,ppc64,arm32,3254,2957,297,3202,2957
94
+ validation,ppc64,arm64,3254,3202,52,3220,3202
95
+ validation,ppc64,mips32,3254,2976,278,3237,2976
96
+ validation,ppc64,mips64,3254,3218,36,3249,3218
97
+ validation,ppc64,ppc32,3254,2997,257,3251,2997
98
+ validation,ppc64,x86,3254,2954,300,3439,2954
99
+ validation,ppc64,x64,3254,3162,92,3425,3162
100
+ validation,x86,arm32,3439,3148,291,3202,3148
101
+ validation,x86,arm64,3439,2939,500,3220,2939
102
+ validation,x86,mips32,3439,3171,268,3237,3171
103
+ validation,x86,mips64,3439,2948,491,3249,2948
104
+ validation,x86,ppc32,3439,3184,255,3251,3184
105
+ validation,x86,ppc64,3439,2954,485,3254,2954
106
+ validation,x86,x64,3439,3185,254,3425,3185
107
+ validation,x64,arm32,3425,2925,500,3202,2925
108
+ validation,x64,arm64,3425,3165,260,3220,3165
109
+ validation,x64,mips32,3425,2943,482,3237,2943
110
+ validation,x64,mips64,3425,3175,250,3249,3175
111
+ validation,x64,ppc32,3425,2941,484,3251,2941
112
+ validation,x64,ppc64,3425,3162,263,3254,3162
113
+ validation,x64,x86,3425,3185,240,3439,3185
114
+ test,arm32,arm64,3282,3120,162,3306,3120
115
+ test,arm32,mips32,3282,3280,2,3334,3280
116
+ test,arm32,mips64,3282,3124,158,3321,3124
117
+ test,arm32,ppc32,3282,3273,9,3338,3273
118
+ test,arm32,ppc64,3282,3119,163,3325,3119
119
+ test,arm32,x86,3282,3276,6,3543,3276
120
+ test,arm32,x64,3282,3121,161,3538,3121
121
+ test,arm64,arm32,3306,3120,186,3282,3120
122
+ test,arm64,mips32,3306,3133,173,3334,3133
123
+ test,arm64,mips64,3306,3304,2,3321,3304
124
+ test,arm64,ppc32,3306,3127,179,3338,3127
125
+ test,arm64,ppc64,3306,3298,8,3325,3298
126
+ test,arm64,x86,3306,3130,176,3543,3130
127
+ test,arm64,x64,3306,3300,6,3538,3300
128
+ test,mips32,arm32,3334,3280,54,3282,3280
129
+ test,mips32,arm64,3334,3133,201,3306,3133
130
+ test,mips32,mips64,3334,3148,186,3321,3148
131
+ test,mips32,ppc32,3334,3316,18,3338,3316
132
+ test,mips32,ppc64,3334,3140,194,3325,3140
133
+ test,mips32,x86,3334,3311,23,3543,3311
134
+ test,mips32,x64,3334,3139,195,3538,3139
135
+ test,mips64,arm32,3321,3124,197,3282,3124
136
+ test,mips64,arm64,3321,3304,17,3306,3304
137
+ test,mips64,mips32,3321,3148,173,3334,3148
138
+ test,mips64,ppc32,3321,3136,185,3338,3136
139
+ test,mips64,ppc64,3321,3305,16,3325,3305
140
+ test,mips64,x86,3321,3136,185,3543,3136
141
+ test,mips64,x64,3321,3309,12,3538,3309
142
+ test,ppc32,arm32,3338,3273,65,3282,3273
143
+ test,ppc32,arm64,3338,3127,211,3306,3127
144
+ test,ppc32,mips32,3338,3316,22,3334,3316
145
+ test,ppc32,mips64,3338,3136,202,3321,3136
146
+ test,ppc32,ppc64,3338,3147,191,3325,3147
147
+ test,ppc32,x86,3338,3308,30,3543,3308
148
+ test,ppc32,x64,3338,3136,202,3538,3136
149
+ test,ppc64,arm32,3325,3119,206,3282,3119
150
+ test,ppc64,arm64,3325,3298,27,3306,3298
151
+ test,ppc64,mips32,3325,3140,185,3334,3140
152
+ test,ppc64,mips64,3325,3305,20,3321,3305
153
+ test,ppc64,ppc32,3325,3147,178,3338,3147
154
+ test,ppc64,x86,3325,3136,189,3543,3136
155
+ test,ppc64,x64,3325,3301,24,3538,3301
156
+ test,x86,arm32,3543,3276,267,3282,3276
157
+ test,x86,arm64,3543,3130,413,3306,3130
158
+ test,x86,mips32,3543,3311,232,3334,3311
159
+ test,x86,mips64,3543,3136,407,3321,3136
160
+ test,x86,ppc32,3543,3308,235,3338,3308
161
+ test,x86,ppc64,3543,3136,407,3325,3136
162
+ test,x86,x64,3543,3358,185,3538,3358
163
+ test,x64,arm32,3538,3121,417,3282,3121
164
+ test,x64,arm64,3538,3300,238,3306,3300
165
+ test,x64,mips32,3538,3139,399,3334,3139
166
+ test,x64,mips64,3538,3309,229,3321,3309
167
+ test,x64,ppc32,3538,3136,402,3338,3136
168
+ test,x64,ppc64,3538,3301,237,3325,3301
169
+ test,x64,x86,3538,3358,180,3543,3358
statistics/final_release_audit.json ADDED
@@ -0,0 +1,89 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "counts": {
3
+ "train": {
4
+ "functions": 199408,
5
+ "groups": 27946,
6
+ "projects": 20,
7
+ "architectures": {
8
+ "arm32": 24237,
9
+ "arm64": 24447,
10
+ "mips32": 24761,
11
+ "mips64": 24767,
12
+ "ppc32": 24710,
13
+ "ppc64": 24777,
14
+ "x86": 25830,
15
+ "x64": 25879
16
+ },
17
+ "positive_pairs": 660178
18
+ },
19
+ "validation": {
20
+ "functions": 26277,
21
+ "groups": 3771,
22
+ "projects": 20,
23
+ "architectures": {
24
+ "arm32": 3202,
25
+ "arm64": 3220,
26
+ "mips32": 3237,
27
+ "mips64": 3249,
28
+ "ppc32": 3251,
29
+ "ppc64": 3254,
30
+ "x86": 3439,
31
+ "x64": 3425
32
+ },
33
+ "positive_pairs": 85857
34
+ },
35
+ "test": {
36
+ "functions": 26987,
37
+ "groups": 3755,
38
+ "projects": 20,
39
+ "architectures": {
40
+ "arm32": 3282,
41
+ "arm64": 3306,
42
+ "mips32": 3334,
43
+ "mips64": 3321,
44
+ "ppc32": 3338,
45
+ "ppc64": 3325,
46
+ "x86": 3543,
47
+ "x64": 3538
48
+ },
49
+ "positive_pairs": 89931
50
+ }
51
+ },
52
+ "source_sha256": {
53
+ "train": "1950762e8f6f4d2a891fc526884a795c4fb14fabad2521c1e4a957b321efa2a2",
54
+ "validation": "98b741756680dc4d3bea70e4e407a79471dfcf935f3b60494a403de1cffc1d03",
55
+ "test": "c7ecae760f483bdfad81dc30216424e73d9375de6550551d6576c35a624b77e3"
56
+ },
57
+ "structural_checks": {
58
+ "repeated_ids_within_split": 0,
59
+ "functions_below_five_blocks": 0,
60
+ "empty_disassembly_records": 0,
61
+ "incorrect_split_labels": 0,
62
+ "missing_opcode_hashes": 0,
63
+ "groups_below_two_architectures": 0,
64
+ "cross_split_group_overlaps": 0,
65
+ "cross_split_opcode_overlaps": 0
66
+ },
67
+ "split_overlaps": [
68
+ {
69
+ "split_a": "train",
70
+ "split_b": "validation",
71
+ "shared_groups": 0,
72
+ "shared_opcode_hashes": 0
73
+ },
74
+ {
75
+ "split_a": "train",
76
+ "split_b": "test",
77
+ "shared_groups": 0,
78
+ "shared_opcode_hashes": 0
79
+ },
80
+ {
81
+ "split_a": "validation",
82
+ "split_b": "test",
83
+ "shared_groups": 0,
84
+ "shared_opcode_hashes": 0
85
+ }
86
+ ],
87
+ "manual_correspondence_audit": "pending",
88
+ "intermediate_construction_counts": "not recoverable from final records alone"
89
+ }
statistics/group_coverage_histogram.csv ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ split,architecture_coverage,source_groups
2
+ train,2,1836
3
+ train,3,235
4
+ train,4,2768
5
+ train,5,49
6
+ train,6,165
7
+ train,7,420
8
+ train,8,22473
9
+ validation,2,283
10
+ validation,3,48
11
+ validation,4,455
12
+ validation,5,2
13
+ validation,6,45
14
+ validation,7,37
15
+ validation,8,2901
16
+ test,2,262
17
+ test,3,25
18
+ test,4,329
19
+ test,6,8
20
+ test,7,24
21
+ test,8,3107
statistics/project_inventory.csv ADDED
@@ -0,0 +1,61 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ split,project,functions
2
+ train,ImageMagick,16520
3
+ train,PuTTy,14963
4
+ train,curl,6776
5
+ train,fmt,12029
6
+ train,json,6889
7
+ train,leveldb,3395
8
+ train,libnet,910
9
+ train,libtiff,2584
10
+ train,libwebp,3659
11
+ train,nmap,18587
12
+ train,openjpeg,3884
13
+ train,openldap,15105
14
+ train,openssl,44607
15
+ train,sqlite,23111
16
+ train,unrar,2570
17
+ train,xerces_c,15302
18
+ train,xz,1913
19
+ train,yaml_cpp,1342
20
+ train,zeromq,3822
21
+ train,zlib,1440
22
+ validation,ImageMagick,2184
23
+ validation,PuTTy,1995
24
+ validation,curl,866
25
+ validation,fmt,2336
26
+ validation,json,811
27
+ validation,leveldb,431
28
+ validation,libnet,136
29
+ validation,libtiff,320
30
+ validation,libwebp,404
31
+ validation,nmap,2579
32
+ validation,openjpeg,593
33
+ validation,openldap,1839
34
+ validation,openssl,5927
35
+ validation,sqlite,2921
36
+ validation,unrar,285
37
+ validation,xerces_c,1640
38
+ validation,xz,282
39
+ validation,yaml_cpp,166
40
+ validation,zeromq,426
41
+ validation,zlib,136
42
+ test,ImageMagick,2247
43
+ test,PuTTy,1900
44
+ test,curl,982
45
+ test,fmt,2129
46
+ test,json,606
47
+ test,leveldb,518
48
+ test,libnet,136
49
+ test,libtiff,331
50
+ test,libwebp,476
51
+ test,nmap,2585
52
+ test,openjpeg,526
53
+ test,openldap,1896
54
+ test,openssl,6374
55
+ test,sqlite,2685
56
+ test,unrar,346
57
+ test,xerces_c,2053
58
+ test,xz,232
59
+ test,yaml_cpp,222
60
+ test,zeromq,603
61
+ test,zlib,140