pretty_name: MediaWiki Code2Code Search
license: other
license_name: apache-2.0-tooling-plus-upstream-foss
license_link: LICENSE.md
language:
- code
task_categories:
- text-retrieval
- sentence-similarity
- feature-extraction
tags:
- code
- code-search
- code-retrieval
- semantic-search
- neural-retrieval
- mediawiki
- wikimedia
- faiss
- embeddings
- bm25
- swhid
- software-heritage
size_categories:
- 1M<n<10M
source_datasets:
- original
configs:
- config_name: default
data_files:
- split: train
path: data/train-*.parquet
MediaWiki Code2Code Search — Dataset
Pre-computed retrieval artifacts for MediaWiki Code2Code Search, a neural system for the semantic discovery of open-source software entities (functions, types, templates) across the MediaWiki / Wikimedia ecosystem.
This Hugging Face dataset is a complementary mirror of the pre-computed artifacts archived on
Zenodo (10.5281/zenodo.20586256). The Hugging Face copy
makes the corpus browsable in the dataset Viewer and easy to pull with the datasets /
huggingface_hub libraries.
If you use this dataset, please cite the paper (see Citation). Zenodo is the archival home of the artifacts; the paper is the reference to cite.
- Code / system: https://github.com/ftosoni/mediawiki-code2code-search
- Paper: MediaWiki Code2Code Search: Neural Retrieval for the Semantic Discovery of Open-Source Software Entities — Francesco Tosoni, Sant'Anna School of Advanced Studies, Pisa. A peer-reviewed version is forthcoming in SoftwareX. See Citation.
Contents
| File | Size | Format | Description |
|---|---|---|---|
data/train-*.parquet (9 shards) |
~172 MiB | Parquet (zstd) | The full snippets table, exposed for the dataset Viewer and load_dataset. Same 1,289,452 rows as snippets.db. |
snippets.db |
1.74 GiB | SQLite | Serving metadata + code for every entity (single snippets table). |
embeddings.npy |
4.92 GiB | NumPy float32 |
Dense embeddings, shape (1289452, 1024), L2-normalised, from Qwen/Qwen3-Embedding-0.6B. Row i aligns with snippets.db row id = i. |
mediawiki.index |
168.6 MiB | FAISS | IndexIVFPQ (L2) with an IndexFlatL2 coarse quantizer, 128 sub-quantizers × 8 bits, dim 1024. Built over the embeddings above. |
bm25_index.pkl |
423.6 MiB | Pickle | BM25 lexical baseline built over the code field (identifier tokeniser; keywords and tokens shorter than three characters dropped). |
Note on
.npy/.index/.pkl: these binary artifacts do not render in the Viewer by design; the Parquet shards provide the browsable view of the same underlying rows.Also on Zenodo only: the raw pre-migration corpus
raw_snippets.json(~1.75 GiB) lives in the Zenodo record but is intentionally not mirrored here — its content is already captured bysnippets.dband the Parquet shards.
Data fields (snippets table / Parquet)
| Column | Type | Description |
|---|---|---|
id |
int64 | Row id; aligns with the corresponding row of embeddings.npy. |
original_id |
string | Upstream extraction id (content hash). |
swhid |
string | SWHID of the source content, with origin= and lines= qualifiers — resolvable on Software Heritage for exact provenance and upstream licensing. |
sha1 |
string | SHA-1 of the source blob. |
repo_name |
string | Upstream repository name. |
repo_group |
string | Repository group / namespace. |
filepath |
string | Path of the source file within the repository. |
name |
string | Entity name / signature (e.g. check_dumps_log_path(path)). |
type |
string | One of function, type, template. |
code |
string | Source snippet text for the entity (see Licensing). |
Corpus statistics
- 1,289,452 structural entities:
function: 1,050,748type: 237,653template: 1,051
- 2,242 active repositories (distinct
(repo_group, repo_name)pairs) across the MediaWiki / Wikimedia ecosystem. - 12 programming languages extracted via language-specific structural parsing.
- Embedding model:
Qwen/Qwen3-Embedding-0.6B(1024-dim). Retrieval is nearest-neighbour by Euclidean (L2) distance over L2-normalised vectors.
Usage
Browse the corpus in the Viewer above, or load it programmatically.
Tabular rows (Parquet) with datasets:
from datasets import load_dataset
ds = load_dataset("ftosoni/mediawiki-code2code-search", split="train")
print(ds)
print(ds[0]["name"], ds[0]["type"])
print(ds[0]["swhid"])
Raw serving artifacts with huggingface_hub:
from huggingface_hub import hf_hub_download
repo = "ftosoni/mediawiki-code2code-search"
db = hf_hub_download(repo, "snippets.db", repo_type="dataset")
emb = hf_hub_download(repo, "embeddings.npy", repo_type="dataset")
index = hf_hub_download(repo, "mediawiki.index", repo_type="dataset")
bm25 = hf_hub_download(repo, "bm25_index.pkl", repo_type="dataset")
import numpy as np, faiss
X = np.load(emb, mmap_mode="r") # (1289452, 1024) float32, L2-normalised
faiss_index = faiss.read_index(index) # IndexIVFPQ (L2)
embeddings.npy row i corresponds to snippets.db row id = i and to FAISS vector i.
Licensing (important)
This dataset combines two distinct layers, and they carry different licenses:
- Tooling / packaging (schema, indexes, embeddings, this card): Apache-2.0, matching the canonical Zenodo record.
- The
codesnippets insnippets.db/ the Parquet shards are derived from upstream MediaWiki / Wikimedia repositories, each under its own free/open-source license (predominantly GPL-2.0-or-later, with some MIT / BSD / Apache-2.0 and others). These upstream licenses govern the snippet text; redistribution here relies on their permission to redistribute.
There is no per-row license column. Instead, every entity carries an swhid with an
origin= qualifier, so the exact upstream repository — and therefore its authoritative license and
copyright — can be resolved on Software Heritage and at
the origin repository. Snippets are fragments and may not carry their file's original license
header; consult the origin before reuse.
See LICENSE.md for the full statement.
Citation
Please cite the paper:
@misc{tosoni2026mediawikicode2codesearchneural,
title = {MediaWiki Code2Code Search: Neural Retrieval for the Semantic Discovery of Open-Source Software Entities},
author = {Francesco Tosoni},
year = {2026},
eprint = {2607.26766},
archivePrefix = {arXiv},
primaryClass = {cs.IR},
url = {https://arxiv.org/abs/2607.26766}
}
The pre-computed artifacts are archived on Zenodo: 10.5281/zenodo.20586256. A peer-reviewed version of the paper is forthcoming in SoftwareX.
Acknowledgements
Corpus derived from the MediaWiki / Wikimedia software ecosystem. Provenance is tracked with
SWHID identifiers resolvable on
Software Heritage. Embeddings computed with
Qwen/Qwen3-Embedding-0.6B; indexing with
FAISS.