| --- |
| language: |
| - es |
| license: cc-by-sa-4.0 |
| multilinguality: monolingual |
| task_categories: |
| - text-classification |
| task_ids: [] |
| tags: |
| - mteb |
| - clustering |
| - wikipedia |
| - spanish |
| - embeddings |
| - evaluation |
| annotations_creators: |
| - derived |
| source_datasets: |
| - wikimedia/wikipedia |
| pretty_name: SpanishWikiClustering |
| size_categories: |
| - 10K<n<100K |
| --- |
| |
| # SpanishWikiClustering |
|
|
| Clustering benchmark for Spanish embedding models, designed for [MTEB](https://github.com/embeddings-benchmark/mteb) as **SpanishWikiClusteringP2P**. |
|
|
| Given opening paragraphs from Spanish Wikipedia articles, models must group them by topic without seeing the labels. This task format is inspired by [WikiClusteringP2P](https://github.com/jhrystrom/wiki-clustering) (Rystrøm, 2024), which covers 14 languages — but not Spanish. This dataset fills that gap. |
|
|
| ## Dataset |
|
|
| - **Source**: Spanish Wikipedia via CirrusSearch dump (December 2025) |
| - **Format**: MTEB clustering — `sentences` (list of texts) + `labels` (list of categories) |
| - **Samples**: 30 independent clustering tasks |
| - **Articles per sample**: 900 (100 per category, stratified) |
| - **Split**: test |
|
|
| ### Categories (9) |
|
|
| | Category | Pool size | |
| |----------|-----------| |
| | Psicología | 768K articles | |
| | Lenguaje | 210K articles | |
| | Ciencias_naturales | 210K articles | |
| | Geografía | 176K articles | |
| | Historia | 63K articles | |
| | Organizaciones | 23K articles | |
| | Literatura | 21K articles | |
| | Deporte | 12K articles | |
| | Fenómenos_naturales | 6K articles | |
|
|
| ## Usage |
|
|
| ```python |
| from datasets import load_dataset |
| |
| dataset = load_dataset("ClementeH/SpanishWikiClustering", split="test") |
| # 30 rows, each with 900 sentences and 900 labels |
| |
| sample = dataset[0] |
| print(len(sample["sentences"])) # 900 |
| print(set(sample["labels"])) # 9 categories |
| ``` |
|
|
| ### Evaluate with MTEB |
|
|
| ```python |
| import mteb |
| |
| model = mteb.get_model("intfloat/multilingual-e5-base") |
| task = mteb.get_task("SpanishWikiClusteringP2P") |
| results = mteb.evaluate(model, tasks=[task]) |
| ``` |
|
|
| ## Benchmark Results |
|
|
| Evaluated with MTEB's `v_measure` metric (higher is better). 30 samples of 900 articles each. |
|
|
| | Model | v_measure | |
| |-------|-----------| |
| | intfloat/multilingual-e5-large-instruct | **0.3679** | |
| | BAAI/bge-m3 | 0.3308 | |
| | sentence-transformers/paraphrase-multilingual-mpnet-base-v2 | 0.3296 | |
| | intfloat/multilingual-e5-large | 0.3249 | |
| | intfloat/multilingual-e5-base | 0.3226 | |
| | intfloat/multilingual-e5-small | 0.3194 | |
| | nomic-ai/nomic-embed-text-v1.5 | 0.3183 | |
| | sentence-transformers/distiluse-base-multilingual-cased-v2 | 0.2999 | |
| | sentence-transformers/stsb-xlm-r-multilingual | 0.2904 | |
| | Snowflake/snowflake-arctic-embed-m-v1.5 | 0.2883 | |
| | sentence-transformers/paraphrase-multilingual-MiniLM-L12-v2 | 0.2863 | |
| | sentence-transformers/LaBSE | 0.2861 | |
| | minishlab/potion-multilingual-128M | 0.2843 | |
| | sentence-transformers/static-similarity-mrl-multilingual-v1 | 0.2527 | |
| |
| For reference, `WikiClusteringP2P.v2` (e5-base) scores for comparable languages: Czech 0.3198, Albanian 0.2936, Danish 0.1920. |
| |
| ## Replication |
| |
| The pipeline to regenerate the dataset from scratch is at [Clemente-H/clustering_embeddings_es](https://github.com/Clemente-H/clustering_embeddings_es), adapted from [jhrystrom/wiki-clustering](https://github.com/jhrystrom/wiki-clustering) to support Spanish Wikipedia's MediaWiki 1.42+ schema. |
| |
| ```bash |
| git clone https://github.com/Clemente-H/clustering_embeddings_es |
| cd clustering_embeddings_es |
| pip install -r requirements.txt |
| |
| # Full pipeline (~10 GB download, ~20 GB RAM) |
| python run.py |
| |
| # Skip download if dumps are already in local_data/ |
| python run.py --skip-download --n-articles 900 --n-turns 30 |
| ``` |
| |
| ### Key adaptations vs. original wiki-clustering |
| |
| The original pipeline targets MediaWiki ≤1.41. Spanish Wikipedia runs MW 1.42+, which introduced breaking changes: |
| |
| 1. **`categorylinks` schema change**: `cl_to` (category name string) was replaced by `cl_target_id` (foreign key to the new `linktarget` table) |
| 2. **SQL encoding**: category names in SQL dumps are stored as latin1-misinterpreted UTF-8 — matching requires re-encoding before joining |
| 3. **CirrusSearch over XML**: the XML dump requires ~64 GB RAM; CirrusSearch is NDJSON, streamable with ~8 GB |
| 4. **Category curation**: Spanish Wikipedia's automatic top-level categories are too coarse (5 nodes). We use 9 thematic categories from the 2nd level, curated to avoid nesting, inflated person-profession categories, and semantic ambiguity |
| 5. **Two-list config**: `curated_categories` anchors the tree walk (prevents pool contamination from excluded categories); `sample_categories` is the subset used for labeling. Excluded categories must remain as anchors so their articles are not reassigned to neighboring pools |
| |
| ## Citation |
| |
| If you use this dataset, please cite: |
| |
| ```bibtex |
| @misc{henriquez2026spanishwikiclustering, |
| author = {Henriquez, Clemente}, |
| title = {{SpanishWikiClustering}: A Wikipedia-based Clustering Benchmark for Spanish}, |
| year = {2026}, |
| publisher = {Hugging Face}, |
| howpublished = {\url{https://huggingface.co/datasets/ClementeH/SpanishWikiClustering}}, |
| } |
| ``` |
| |
| If you use the replication pipeline, please also cite the original wiki-clustering work it is based on: |
| |
| ```bibtex |
| @misc{rystrom2024wikiclustering, |
| author = {Rystr{\o}m, Jonathan}, |
| title = {Wiki Clustering}, |
| year = {2024}, |
| howpublished = {\url{https://github.com/jhrystrom/wiki-clustering}}, |
| } |
| ``` |
| |
| If you use this dataset via MTEB, please also cite: |
| |
| ```bibtex |
| @article{muennighoff2022mteb, |
| author = {Muennighoff, Niklas and Tazi, Nouamane and Magne, Lo{\"i}c and Reimers, Nils}, |
| title = {{MTEB}: Massive Text Embedding Benchmark}, |
| journal = {arXiv preprint arXiv:2210.07316}, |
| year = {2022}, |
| url = {https://arxiv.org/abs/2210.07316}, |
| } |
|
|
| @article{enevoldsen2025mmteb, |
| title = {{MMTEB}: Massive Multilingual Text Embedding Benchmark}, |
| author = {Enevoldsen, Kenneth and others}, |
| journal = {arXiv preprint arXiv:2502.13595}, |
| year = {2025}, |
| url = {https://arxiv.org/abs/2502.13595}, |
| } |
| ``` |
| |