Datasets:

Modalities:
Text
Formats:
parquet
Languages:
code
ArXiv:
Libraries:
Datasets
pandas
License:
Samoed's picture
Add dataset card
68e8f07 verified
metadata
annotations_creators:
  - derived
language:
  - code
license: mit
multilinguality: monolingual
source_datasets:
  - code-search-net/code_search_net
task_categories:
  - text-retrieval
task_ids: []
dataset_info:
  - config_name: go-corpus
    features:
      - name: id
        dtype: string
      - name: text
        dtype: string
      - name: title
        dtype: string
    splits:
      - name: test
        num_bytes: 687923
        num_examples: 1000
    download_size: 305126
    dataset_size: 687923
  - config_name: go-qrels
    features:
      - name: query-id
        dtype: string
      - name: corpus-id
        dtype: string
      - name: score
        dtype: int64
    splits:
      - name: test
        num_bytes: 131084
        num_examples: 1000
    download_size: 30642
    dataset_size: 131084
  - config_name: go-queries
    features:
      - name: id
        dtype: string
      - name: text
        dtype: string
    splits:
      - name: test
        num_bytes: 136105
        num_examples: 1000
    download_size: 82017
    dataset_size: 136105
  - config_name: java-corpus
    features:
      - name: id
        dtype: string
      - name: text
        dtype: string
      - name: title
        dtype: string
    splits:
      - name: test
        num_bytes: 591398
        num_examples: 1000
    download_size: 186606
    dataset_size: 591398
  - config_name: java-qrels
    features:
      - name: query-id
        dtype: string
      - name: corpus-id
        dtype: string
      - name: score
        dtype: int64
    splits:
      - name: test
        num_bytes: 176341
        num_examples: 1000
    download_size: 34953
    dataset_size: 176341
  - config_name: java-queries
    features:
      - name: id
        dtype: string
      - name: text
        dtype: string
    splits:
      - name: test
        num_bytes: 701958
        num_examples: 1000
    download_size: 255486
    dataset_size: 701958
  - config_name: javascript-corpus
    features:
      - name: id
        dtype: string
      - name: text
        dtype: string
      - name: title
        dtype: string
    splits:
      - name: test
        num_bytes: 1551805
        num_examples: 1000
    download_size: 571030
    dataset_size: 1551805
  - config_name: javascript-qrels
    features:
      - name: query-id
        dtype: string
      - name: corpus-id
        dtype: string
      - name: score
        dtype: int64
    splits:
      - name: test
        num_bytes: 141801
        num_examples: 1000
    download_size: 39930
    dataset_size: 141801
  - config_name: javascript-queries
    features:
      - name: id
        dtype: string
      - name: text
        dtype: string
    splits:
      - name: test
        num_bytes: 202696
        num_examples: 1000
    download_size: 112208
    dataset_size: 202696
  - config_name: php-corpus
    features:
      - name: id
        dtype: string
      - name: text
        dtype: string
      - name: title
        dtype: string
    splits:
      - name: test
        num_bytes: 856887
        num_examples: 1000
    download_size: 333818
    dataset_size: 856887
  - config_name: php-qrels
    features:
      - name: query-id
        dtype: string
      - name: corpus-id
        dtype: string
      - name: score
        dtype: int64
    splits:
      - name: test
        num_bytes: 151365
        num_examples: 1000
    download_size: 33419
    dataset_size: 151365
  - config_name: php-queries
    features:
      - name: id
        dtype: string
      - name: text
        dtype: string
    splits:
      - name: test
        num_bytes: 173189
        num_examples: 1000
    download_size: 88243
    dataset_size: 173189
  - config_name: python-corpus
    features:
      - name: id
        dtype: string
      - name: text
        dtype: string
      - name: title
        dtype: string
    splits:
      - name: test
        num_bytes: 1008096
        num_examples: 1000
    download_size: 397446
    dataset_size: 1008096
  - config_name: python-qrels
    features:
      - name: query-id
        dtype: string
      - name: corpus-id
        dtype: string
      - name: score
        dtype: int64
    splits:
      - name: test
        num_bytes: 152118
        num_examples: 1000
    download_size: 32945
    dataset_size: 152118
  - config_name: python-queries
    features:
      - name: id
        dtype: string
      - name: text
        dtype: string
    splits:
      - name: test
        num_bytes: 477722
        num_examples: 1000
    download_size: 232579
    dataset_size: 477722
  - config_name: ruby-corpus
    features:
      - name: id
        dtype: string
      - name: text
        dtype: string
      - name: title
        dtype: string
    splits:
      - name: test
        num_bytes: 713048
        num_examples: 1000
    download_size: 300121
    dataset_size: 713048
  - config_name: ruby-qrels
    features:
      - name: query-id
        dtype: string
      - name: corpus-id
        dtype: string
      - name: score
        dtype: int64
    splits:
      - name: test
        num_bytes: 142286
        num_examples: 1000
    download_size: 43267
    dataset_size: 142286
  - config_name: ruby-queries
    features:
      - name: id
        dtype: string
      - name: text
        dtype: string
    splits:
      - name: test
        num_bytes: 324866
        num_examples: 1000
    download_size: 169887
    dataset_size: 324866
configs:
  - config_name: go-corpus
    data_files:
      - split: test
        path: go-corpus/test-*
  - config_name: go-qrels
    data_files:
      - split: test
        path: go-qrels/test-*
  - config_name: go-queries
    data_files:
      - split: test
        path: go-queries/test-*
  - config_name: java-corpus
    data_files:
      - split: test
        path: java-corpus/test-*
  - config_name: java-qrels
    data_files:
      - split: test
        path: java-qrels/test-*
  - config_name: java-queries
    data_files:
      - split: test
        path: java-queries/test-*
  - config_name: javascript-corpus
    data_files:
      - split: test
        path: javascript-corpus/test-*
  - config_name: javascript-qrels
    data_files:
      - split: test
        path: javascript-qrels/test-*
  - config_name: javascript-queries
    data_files:
      - split: test
        path: javascript-queries/test-*
  - config_name: php-corpus
    data_files:
      - split: test
        path: php-corpus/test-*
  - config_name: php-qrels
    data_files:
      - split: test
        path: php-qrels/test-*
  - config_name: php-queries
    data_files:
      - split: test
        path: php-queries/test-*
  - config_name: python-corpus
    data_files:
      - split: test
        path: python-corpus/test-*
  - config_name: python-qrels
    data_files:
      - split: test
        path: python-qrels/test-*
  - config_name: python-queries
    data_files:
      - split: test
        path: python-queries/test-*
  - config_name: ruby-corpus
    data_files:
      - split: test
        path: ruby-corpus/test-*
  - config_name: ruby-qrels
    data_files:
      - split: test
        path: ruby-qrels/test-*
  - config_name: ruby-queries
    data_files:
      - split: test
        path: ruby-queries/test-*
tags:
  - mteb
  - text

CodeSearchNetRetrieval

An MTEB dataset
Massive Text Embedding Benchmark

The dataset is a collection of code snippets and their corresponding natural language queries. The task is to retrieve the most relevant code snippet for a given query.

Task category t2t
Domains Programming, Written
Reference https://huggingface.co/datasets/code_search_net/

Source datasets:

How to evaluate on this task

You can evaluate an embedding model on this dataset using the following code:

import mteb

task = mteb.get_task("CodeSearchNetRetrieval")
evaluator = mteb.MTEB([task])

model = mteb.get_model(YOUR_MODEL)
evaluator.run(model)

To learn more about how to run models on mteb task check out the GitHub repository.

Citation

If you use this dataset, please cite the dataset as well as mteb, as this dataset likely includes additional processing as a part of the MMTEB Contribution.


@article{husain2019codesearchnet,
  author = {Husain, Hamel and Wu, Ho-Hsiang and Gazit, Tiferet and Allamanis, Miltiadis and Brockschmidt, Marc},
  journal = {arXiv preprint arXiv:1909.09436},
  title = {{CodeSearchNet} challenge: Evaluating the state of semantic code search},
  year = {2019},
}


@article{enevoldsen2025mmtebmassivemultilingualtext,
  title={MMTEB: Massive Multilingual Text Embedding Benchmark},
  author={Kenneth Enevoldsen and Isaac Chung and Imene Kerboua and Márton Kardos and Ashwin Mathur and David Stap and Jay Gala and Wissam Siblini and Dominik Krzemiński and Genta Indra Winata and Saba Sturua and Saiteja Utpala and Mathieu Ciancone and Marion Schaeffer and Gabriel Sequeira and Diganta Misra and Shreeya Dhakal and Jonathan Rystrøm and Roman Solomatin and Ömer Çağatan and Akash Kundu and Martin Bernstorff and Shitao Xiao and Akshita Sukhlecha and Bhavish Pahwa and Rafał Poświata and Kranthi Kiran GV and Shawon Ashraf and Daniel Auras and Björn Plüster and Jan Philipp Harries and Loïc Magne and Isabelle Mohr and Mariya Hendriksen and Dawei Zhu and Hippolyte Gisserot-Boukhlef and Tom Aarsen and Jan Kostkan and Konrad Wojtasik and Taemin Lee and Marek Šuppa and Crystina Zhang and Roberta Rocca and Mohammed Hamdy and Andrianos Michail and John Yang and Manuel Faysse and Aleksei Vatolin and Nandan Thakur and Manan Dey and Dipam Vasani and Pranjal Chitale and Simone Tedeschi and Nguyen Tai and Artem Snegirev and Michael Günther and Mengzhou Xia and Weijia Shi and Xing Han Lù and Jordan Clive and Gayatri Krishnakumar and Anna Maksimova and Silvan Wehrli and Maria Tikhonova and Henil Panchal and Aleksandr Abramov and Malte Ostendorff and Zheng Liu and Simon Clematide and Lester James Miranda and Alena Fenogenova and Guangyu Song and Ruqiya Bin Safi and Wen-Ding Li and Alessia Borghini and Federico Cassano and Hongjin Su and Jimmy Lin and Howard Yen and Lasse Hansen and Sara Hooker and Chenghao Xiao and Vaibhav Adlakha and Orion Weller and Siva Reddy and Niklas Muennighoff},
  publisher = {arXiv},
  journal={arXiv preprint arXiv:2502.13595},
  year={2025},
  url={https://arxiv.org/abs/2502.13595},
  doi = {10.48550/arXiv.2502.13595},
}

@article{muennighoff2022mteb,
  author = {Muennighoff, Niklas and Tazi, Nouamane and Magne, Loïc and Reimers, Nils},
  title = {MTEB: Massive Text Embedding Benchmark},
  publisher = {arXiv},
  journal={arXiv preprint arXiv:2210.07316},
  year = {2022}
  url = {https://arxiv.org/abs/2210.07316},
  doi = {10.48550/ARXIV.2210.07316},
}

Dataset Statistics

Dataset Statistics

The following code contains the descriptive statistics from the task. These can also be obtained using:

import mteb

task = mteb.get_task("CodeSearchNetRetrieval")

desc_stats = task.metadata.descriptive_stats
{
    "test": {
        "num_samples": 12000,
        "number_of_characters": 6496327,
        "documents_text_statistics": {
            "total_text_length": 4552253,
            "min_text_length": 69,
            "average_text_length": 758.7088333333334,
            "max_text_length": 334374,
            "unique_texts": 6000
        },
        "documents_image_statistics": null,
        "queries_text_statistics": {
            "total_text_length": 1944074,
            "min_text_length": 2,
            "average_text_length": 324.01233333333334,
            "max_text_length": 17533,
            "unique_texts": 5765
        },
        "queries_image_statistics": null,
        "relevant_docs_statistics": {
            "num_relevant_docs": 6000,
            "min_relevant_docs_per_query": 1,
            "average_relevant_docs_per_query": 1.0,
            "max_relevant_docs_per_query": 1,
            "unique_relevant_docs": 6000
        },
        "top_ranked_statistics": null,
        "hf_subset_descriptive_stats": {
            "python": {
                "num_samples": 2000,
                "number_of_characters": 1329388,
                "documents_text_statistics": {
                    "total_text_length": 862842,
                    "min_text_length": 91,
                    "average_text_length": 862.842,
                    "max_text_length": 10914,
                    "unique_texts": 1000
                },
                "documents_image_statistics": null,
                "queries_text_statistics": {
                    "total_text_length": 466546,
                    "min_text_length": 8,
                    "average_text_length": 466.546,
                    "max_text_length": 8636,
                    "unique_texts": 982
                },
                "queries_image_statistics": null,
                "relevant_docs_statistics": {
                    "num_relevant_docs": 1000,
                    "min_relevant_docs_per_query": 1,
                    "average_relevant_docs_per_query": 1.0,
                    "max_relevant_docs_per_query": 1,
                    "unique_relevant_docs": 1000
                },
                "top_ranked_statistics": null
            },
            "javascript": {
                "num_samples": 2000,
                "number_of_characters": 1601650,
                "documents_text_statistics": {
                    "total_text_length": 1415632,
                    "min_text_length": 95,
                    "average_text_length": 1415.632,
                    "max_text_length": 334374,
                    "unique_texts": 1000
                },
                "documents_image_statistics": null,
                "queries_text_statistics": {
                    "total_text_length": 186018,
                    "min_text_length": 2,
                    "average_text_length": 186.018,
                    "max_text_length": 7657,
                    "unique_texts": 951
                },
                "queries_image_statistics": null,
                "relevant_docs_statistics": {
                    "num_relevant_docs": 1000,
                    "min_relevant_docs_per_query": 1,
                    "average_relevant_docs_per_query": 1.0,
                    "max_relevant_docs_per_query": 1,
                    "unique_relevant_docs": 1000
                },
                "top_ranked_statistics": null
            },
            "go": {
                "num_samples": 2000,
                "number_of_characters": 688942,
                "documents_text_statistics": {
                    "total_text_length": 563729,
                    "min_text_length": 69,
                    "average_text_length": 563.729,
                    "max_text_length": 15904,
                    "unique_texts": 1000
                },
                "documents_image_statistics": null,
                "queries_text_statistics": {
                    "total_text_length": 125213,
                    "min_text_length": 14,
                    "average_text_length": 125.213,
                    "max_text_length": 1501,
                    "unique_texts": 988
                },
                "queries_image_statistics": null,
                "relevant_docs_statistics": {
                    "num_relevant_docs": 1000,
                    "min_relevant_docs_per_query": 1,
                    "average_relevant_docs_per_query": 1.0,
                    "max_relevant_docs_per_query": 1,
                    "unique_relevant_docs": 1000
                },
                "top_ranked_statistics": null
            },
            "ruby": {
                "num_samples": 2000,
                "number_of_characters": 891452,
                "documents_text_statistics": {
                    "total_text_length": 577634,
                    "min_text_length": 79,
                    "average_text_length": 577.634,
                    "max_text_length": 8171,
                    "unique_texts": 1000
                },
                "documents_image_statistics": null,
                "queries_text_statistics": {
                    "total_text_length": 313818,
                    "min_text_length": 5,
                    "average_text_length": 313.818,
                    "max_text_length": 17533,
                    "unique_texts": 978
                },
                "queries_image_statistics": null,
                "relevant_docs_statistics": {
                    "num_relevant_docs": 1000,
                    "min_relevant_docs_per_query": 1,
                    "average_relevant_docs_per_query": 1.0,
                    "max_relevant_docs_per_query": 1,
                    "unique_relevant_docs": 1000
                },
                "top_ranked_statistics": null
            },
            "java": {
                "num_samples": 2000,
                "number_of_characters": 1110647,
                "documents_text_statistics": {
                    "total_text_length": 420287,
                    "min_text_length": 106,
                    "average_text_length": 420.287,
                    "max_text_length": 9142,
                    "unique_texts": 1000
                },
                "documents_image_statistics": null,
                "queries_text_statistics": {
                    "total_text_length": 690360,
                    "min_text_length": 2,
                    "average_text_length": 690.36,
                    "max_text_length": 6473,
                    "unique_texts": 956
                },
                "queries_image_statistics": null,
                "relevant_docs_statistics": {
                    "num_relevant_docs": 1000,
                    "min_relevant_docs_per_query": 1,
                    "average_relevant_docs_per_query": 1.0,
                    "max_relevant_docs_per_query": 1,
                    "unique_relevant_docs": 1000
                },
                "top_ranked_statistics": null
            },
            "php": {
                "num_samples": 2000,
                "number_of_characters": 874248,
                "documents_text_statistics": {
                    "total_text_length": 712129,
                    "min_text_length": 108,
                    "average_text_length": 712.129,
                    "max_text_length": 15584,
                    "unique_texts": 1000
                },
                "documents_image_statistics": null,
                "queries_text_statistics": {
                    "total_text_length": 162119,
                    "min_text_length": 5,
                    "average_text_length": 162.119,
                    "max_text_length": 1240,
                    "unique_texts": 911
                },
                "queries_image_statistics": null,
                "relevant_docs_statistics": {
                    "num_relevant_docs": 1000,
                    "min_relevant_docs_per_query": 1,
                    "average_relevant_docs_per_query": 1.0,
                    "max_relevant_docs_per_query": 1,
                    "unique_relevant_docs": 1000
                },
                "top_ranked_statistics": null
            }
        }
    }
}

This dataset card was automatically generated using MTEB