CodeSearchNet
DatasetFree6M functions across 6 languages paired with documentation.
Capabilities8 decomposed
multi-language code function extraction and normalization
Medium confidenceExtracts 6 million functions from public GitHub repositories across Python, Java, JavaScript, PHP, Ruby, and Go using language-specific AST parsers and tokenizers. Each function is normalized to a canonical representation with consistent formatting, removing language-specific syntax variations while preserving semantic structure. The extraction pipeline handles edge cases like nested functions, lambdas, and anonymous classes through recursive AST traversal and scope-aware filtering.
Uses language-specific AST parsers rather than regex-based extraction, enabling structurally-aware function boundary detection and handling of nested/anonymous functions. Normalizes across 6 languages to a common representation while preserving semantic equivalence, unlike single-language extraction tools.
Provides 6 million consistently-extracted functions across 6 languages in a single unified schema, whereas alternatives like GitHub's own code search or language-specific datasets require separate pipelines and lack cross-language normalization.
code-to-documentation paired dataset creation
Medium confidencePairs extracted functions with their associated docstrings (docstrings, comments, and inline documentation) to create 6 million code-documentation tuples. The pairing logic uses heuristic matching (proximity-based, AST-aware comment association) and filtering to ensure semantic alignment between code and documentation. Removes low-quality pairs (undocumented functions, trivial stubs) through statistical filtering and manual validation on a subset.
Implements language-aware docstring extraction and proximity-based pairing using AST scope information, rather than simple regex matching. Includes statistical filtering to remove low-quality pairs, creating a curated dataset rather than raw extracted pairs.
Provides 6 million validated code-documentation pairs across 6 languages in a single benchmark, whereas alternatives like Stack Overflow or API documentation datasets are either smaller, single-language, or lack code-level granularity.
code search benchmark and evaluation framework
Medium confidenceProvides a standardized evaluation framework with train/validation/test splits and metrics (Mean Reciprocal Rank, NDCG, precision@k) for assessing code search system performance. The benchmark includes query sets (natural language queries paired with relevant code functions) and baseline implementations, enabling reproducible comparison of different code search approaches. Evaluation is performed at function-level granularity with relevance judgments derived from docstring-query similarity and manual validation.
Provides function-level code search evaluation with multi-language support and docstring-derived relevance judgments, whereas most IR benchmarks (TREC, MS MARCO) focus on document-level retrieval in natural language. Includes baseline implementations for reproducibility.
Offers a standardized, reproducible benchmark for code search across 6 languages with 6 million functions, whereas alternatives like GitHub's code search lack public evaluation sets and baselines, and academic datasets like StackOverflow are smaller or less diverse.
language-agnostic code representation and embedding space
Medium confidenceEnables training of polyglot code understanding models that learn a shared embedding space across 6 programming languages. The representation is derived from normalized function code and documentation, allowing models to map semantically equivalent functions in different languages to nearby points in embedding space. This is achieved through contrastive learning objectives (e.g., code-documentation pairs as positive examples, random negatives) that learn language-invariant code semantics.
Creates a unified embedding space for 6 languages through contrastive learning on code-documentation pairs, rather than training separate language-specific models. Enables zero-shot cross-language code search and transfer learning.
Provides a single multi-language code embedding model trained on 6 million functions, whereas alternatives like language-specific CodeBERT variants require separate models per language and lack cross-language transfer capabilities.
code clone and similarity detection dataset
Medium confidenceEnables training and evaluation of code clone detection systems by providing a large corpus of functions with implicit similarity relationships derived from documentation and code structure. The dataset can be used to identify Type-1 (exact) and Type-2 (syntactically similar) clones through embedding similarity, and to train models that detect semantic clones (Type-3/4) that perform similar functionality despite different syntax. Similarity is computed via cosine distance in embedding space or explicit clone annotation.
Provides 6 million functions across 6 languages for clone detection training, with implicit similarity relationships derived from documentation and embeddings rather than explicit manual annotations. Enables multi-language clone detection in a single model.
Offers a large-scale, multi-language clone detection corpus with 6 million functions, whereas alternatives like BigCloneBench are smaller, single-language, or require explicit manual clone annotations that don't scale.
code understanding model training corpus
Medium confidenceServes as a large-scale, pre-training corpus for code understanding models like CodeBERT and GraphCodeBERT. The dataset provides 6 million code-documentation pairs that enable self-supervised and supervised pre-training objectives (masked language modeling, code-documentation matching, contrastive learning). The corpus is diverse across languages and domains, reducing domain bias and improving generalization to downstream tasks.
Provides 6 million code-documentation pairs across 6 languages for pre-training, enabling multi-language code models with shared representations. Includes diverse open-source code reducing domain bias compared to single-domain or single-language pre-training corpora.
Offers a larger, more diverse pre-training corpus than language-specific datasets, and enables multi-language model development unlike single-language alternatives like CodeSearchNet's predecessors or GitHub's internal datasets.
code search query generation and relevance assessment
Medium confidenceProvides mechanisms to generate natural language queries from code functions and assess relevance between queries and code. Queries are generated from docstrings and function signatures through extractive and abstractive summarization, or manually curated. Relevance assessment uses docstring-query similarity (BM25, embedding-based) and optional manual validation to create ground truth for evaluation. This enables creation of query-code relevance judgments for benchmark evaluation.
Generates queries from docstrings and assesses relevance at scale using embedding-based and BM25 similarity, enabling automatic creation of query-code relevance judgments without manual annotation. Supports both extractive and abstractive query generation.
Provides automatic query generation and relevance assessment for 6 million functions, whereas alternatives like manual query annotation or Stack Overflow-based queries are smaller, more expensive, or less diverse.
multi-language code tokenization and vocabulary
Medium confidenceProvides language-aware tokenization and shared vocabulary for code across 6 programming languages. Tokenization handles language-specific syntax (operators, keywords, delimiters) while creating a unified vocabulary that maps tokens from different languages to shared semantic categories. This enables models to process code from any supported language using a single tokenizer and vocabulary, reducing model complexity and enabling cross-language transfer.
Provides language-aware tokenization with a unified vocabulary across 6 languages, enabling single-model processing of multi-language code. Uses language-specific syntax rules while maintaining semantic equivalence across languages.
Offers a single shared vocabulary for 6 languages, whereas alternatives like separate language-specific tokenizers require multiple models or complex language-switching logic.
Capabilities are decomposed by AI analysis. Each maps to specific user intents and improves with match feedback.
Related Artifactssharing capabilities
Artifacts that share capabilities with CodeSearchNet, ranked by overlap. Discovered automatically through the match graph.
xCodeEval
Dataset by NTU-NLP-sg. 6,96,087 downloads.
xCodeEval
Multilingual code evaluation across 17 languages.
The Stack v2
67 TB permissively licensed code dataset across 600+ languages.
commitpackft
Dataset by bigcode. 3,61,352 downloads.
StarCoderData
250GB curated code dataset for StarCoder training.
fabric
Apply AI to everyday challenges in the comfort of your terminal. Help’s to get better results with tried and tested library of prompt...
Best For
- ✓ML researchers training code understanding models across multiple languages
- ✓Teams building code search engines that need to index diverse codebases uniformly
- ✓Organizations evaluating code similarity and duplication at scale
- ✓Researchers developing code-to-text and text-to-code models (CodeBERT, GraphCodeBERT training)
- ✓Teams building semantic code search engines that match natural language queries to code
- ✓ML practitioners needing large-scale paired data for contrastive learning objectives
- ✓ML researchers evaluating code search and code understanding models
- ✓Teams implementing code search systems who need baseline performance targets
Known Limitations
- ⚠Extraction quality varies by language — PHP and Ruby have lower precision than Python/Java due to less mature AST tooling
- ⚠Functions extracted from public GitHub only — no proprietary or private codebase coverage
- ⚠Normalized representation loses some language-specific idioms and patterns that may be important for domain-specific tasks
- ⚠No function-level dependency graph — extracted functions are isolated without call-chain context
- ⚠Documentation quality is highly variable — many functions have minimal or misleading docstrings
- ⚠Pairing heuristics may incorrectly associate comments with wrong functions in dense code blocks
Requirements
Input / Output
UnfragileRank
UnfragileRank is computed from adoption signals, documentation quality, ecosystem connectivity, match graph feedback, and freshness. No artifact can pay for a higher rank.
About
GitHub and Microsoft Research's benchmark dataset for code search containing 6 million functions across 6 programming languages (Python, Java, JavaScript, PHP, Ruby, Go) paired with natural language documentation. Both a dataset for training code understanding models and a benchmark for evaluating code search systems. Functions extracted from public GitHub repositories with associated docstrings. Influenced the development of CodeBERT, GraphCodeBERT, and subsequent code understanding models.
Categories
Alternatives to CodeSearchNet
The GitHub for AI — 500K+ models, datasets, Spaces, Inference API, hub for open-source AI.
Compare →FLUX, Stable Diffusion, SDXL, SD3, LoRA, Fine Tuning, DreamBooth, Training, Automatic1111, Forge WebUI, SwarmUI, DeepFake, TTS, Animation, Text To Video, Tutorials, Guides, Lectures, Courses, ComfyUI, Google Colab, RunPod, Kaggle, NoteBooks, ControlNet, TTS, Voice Cloning, AI, AI News, ML, ML News,
Compare →Are you the builder of CodeSearchNet?
Claim this artifact to get a verified badge, access match analytics, see which intents users search for, and manage your listing.
Get the weekly brief
New tools, rising stars, and what's actually worth your time. No spam.
Data Sources
Looking for something else?
Search →