NanoCodeRAG / README.md
hotchpotch's picture
Update bm25 for reranking_hybrid candidates
d831b5d verified
|
Raw
History Blame
8.83 kB
metadata
configs:
  - config_name: bm25
    data_files:
      - split: NanoCodeRAGLibraryDocumentationSolutions
        path: bm25/NanoCodeRAGLibraryDocumentationSolutions-*
      - split: NanoCodeRAGOnlineTutorials
        path: bm25/NanoCodeRAGOnlineTutorials-*
      - split: NanoCodeRAGProgrammingSolutions
        path: bm25/NanoCodeRAGProgrammingSolutions-*
      - split: NanoCodeRAGStackoverflowPosts
        path: bm25/NanoCodeRAGStackoverflowPosts-*
  - config_name: corpus
    data_files:
      - split: NanoCodeRAGLibraryDocumentationSolutions
        path: corpus/NanoCodeRAGLibraryDocumentationSolutions-*
      - split: NanoCodeRAGOnlineTutorials
        path: corpus/NanoCodeRAGOnlineTutorials-*
      - split: NanoCodeRAGProgrammingSolutions
        path: corpus/NanoCodeRAGProgrammingSolutions-*
      - split: NanoCodeRAGStackoverflowPosts
        path: corpus/NanoCodeRAGStackoverflowPosts-*
  - config_name: qrels
    data_files:
      - split: NanoCodeRAGLibraryDocumentationSolutions
        path: qrels/NanoCodeRAGLibraryDocumentationSolutions-*
      - split: NanoCodeRAGOnlineTutorials
        path: qrels/NanoCodeRAGOnlineTutorials-*
      - split: NanoCodeRAGProgrammingSolutions
        path: qrels/NanoCodeRAGProgrammingSolutions-*
      - split: NanoCodeRAGStackoverflowPosts
        path: qrels/NanoCodeRAGStackoverflowPosts-*
  - config_name: queries
    data_files:
      - split: NanoCodeRAGLibraryDocumentationSolutions
        path: NanoCodeRAGLibraryDocumentationSolutions/queries/test.parquet
      - split: NanoCodeRAGOnlineTutorials
        path: NanoCodeRAGOnlineTutorials/queries/test.parquet
      - split: NanoCodeRAGProgrammingSolutions
        path: NanoCodeRAGProgrammingSolutions/queries/test.parquet
      - split: NanoCodeRAGStackoverflowPosts
        path: NanoCodeRAGStackoverflowPosts/queries/test.parquet
language:
  - code
tags:
  - information-retrieval
  - retrieval
  - nano
  - bm25
dataset_info:
  - config_name: bm25
    features:
      - name: query-id
        dtype: string
      - name: corpus-ids
        list: string
    splits:
      - name: NanoCodeRAGLibraryDocumentationSolutions
        num_bytes: 1180757
        num_examples: 200
      - name: NanoCodeRAGOnlineTutorials
        num_bytes: 1191012
        num_examples: 200
      - name: NanoCodeRAGProgrammingSolutions
        num_bytes: 1110671
        num_examples: 200
      - name: NanoCodeRAGStackoverflowPosts
        num_bytes: 1188297
        num_examples: 200
    download_size: 4676749
    dataset_size: 4670737
  - config_name: corpus
    features:
      - name: _id
        dtype: string
      - name: text
        dtype: string
    splits:
      - name: NanoCodeRAGLibraryDocumentationSolutions
        num_bytes: 17956921
        num_examples: 8683
      - name: NanoCodeRAGOnlineTutorials
        num_bytes: 57578239
        num_examples: 9997
      - name: NanoCodeRAGProgrammingSolutions
        num_bytes: 200886
        num_examples: 984
      - name: NanoCodeRAGStackoverflowPosts
        num_bytes: 47533159
        num_examples: 10000
    download_size: 56258007
    dataset_size: 123269205
  - config_name: qrels
    features:
      - name: query-id
        dtype: string
      - name: corpus-id
        dtype: string
    splits:
      - name: NanoCodeRAGLibraryDocumentationSolutions
        num_bytes: 3407
        num_examples: 200
      - name: NanoCodeRAGOnlineTutorials
        num_bytes: 3384
        num_examples: 200
      - name: NanoCodeRAGProgrammingSolutions
        num_bytes: 3547
        num_examples: 200
      - name: NanoCodeRAGStackoverflowPosts
        num_bytes: 3380
        num_examples: 200
    download_size: 13196
    dataset_size: 13718
  - config_name: queries
    features:
      - name: _id
        dtype: string
      - name: text
        dtype: string
    splits:
      - name: NanoCodeRAGLibraryDocumentationSolutions
        num_bytes: 81590
        num_examples: 200
      - name: NanoCodeRAGOnlineTutorials
        num_bytes: 12499
        num_examples: 200
      - name: NanoCodeRAGProgrammingSolutions
        num_bytes: 17812
        num_examples: 200
      - name: NanoCodeRAGStackoverflowPosts
        num_bytes: 44059
        num_examples: 200
    download_size: 81432
    dataset_size: 155960

NanoCodeRAG

This dataset is a Nano-style retrieval dataset. Nano-series evaluation can be run easily with the HAKARI-Bench.

NanoCodeRAG is derived from CodeRAG. It follows the Hugging Face Datasets layout convention used by sentence-transformers/NanoBEIR-en: each Nano split has separate corpus, queries, and qrels tables, and BM25 candidates are provided separately in a bm25 table. This layout follows the NanoBEIR-style evaluation approach summarized in NanoBEIR.

NanoCodeRAG contains 4 Nano retrieval splits derived from CodeRAG. Each split keeps up to 200 eligible queries and up to 10000 corpus documents, with exact duplicate query and document text removed where the generator records that policy.

Source Links

Data Layout

This dataset uses four Hugging Face Datasets configs:

  • corpus: documents with _id and text
  • queries: queries with _id and text
  • qrels: positive relevance labels with query-id and corpus-id
  • bm25: BM25 candidate lists with query-id and corpus-ids

Each config uses the same Nano split names. If the actual generated dataset uses a different schema, config name, path layout, or field name, revise this section before publishing the README.

Construction Steps

This dataset was built as follows. If the actual generation procedure differs, revise this section before publishing the README.

  1. Use CodeRAG as the upstream benchmark or dataset family.
  2. Load the source datasets recorded in manifest.json and per-split metadata files.
  3. Use the source benchmark evaluation split, preferring test when available as the source evaluation split policy.
  4. Create one Nano split for each selected source retrieval task.
  5. Keep up to 200 eligible queries per Nano split.
  6. Include qrels-positive documents for the selected queries.
  7. Fill the corpus from source corpus order up to 10000 documents.
  8. Remove exact duplicate document text within each split. If a removed duplicate was referenced by qrels, rewrite qrels to the kept document id when the generator records that policy.
  9. Store document title and body as a single text field when the source provides both.
  10. Generate BM25 top-100 candidates with the tokenization policy recorded per split.
  11. If a qrels-positive document is missing from the raw BM25 result, insert it into the final bm25 candidate list by replacing a tail non-positive candidate.

BM25 Subset Policy

The bm25 config is a candidate subset for first-stage retrieval and reranking. It is not a separate source dataset. Each row contains one query id and a ranked list of corpus ids.

BM25 candidates are generated from the selected corpus for each split. The configured candidate cap is top-100. When a qrels-positive document is not present in the raw BM25 result, the missing positive is forced into the final candidate list by replacing a tail candidate that is not positive for that query. Candidate ids are kept unique after replacement.

Split Mapping

Nano split Source task Source dataset Queries Corpus Qrels
NanoCodeRAGLibraryDocumentationSolutions CodeRAGLibraryDocumentationSolutions code-rag-bench/library-documentation 200 8683 200
NanoCodeRAGOnlineTutorials CodeRAGOnlineTutorials code-rag-bench/online-tutorials 200 9997 200
NanoCodeRAGProgrammingSolutions CodeRAGProgrammingSolutions code-rag-bench/programming-solutions 200 984 200
NanoCodeRAGStackoverflowPosts CodeRAGStackoverflowPosts code-rag-bench/stackoverflow-posts 200 10000 200

BM25 nDCG@10

nDCG@10 is computed from the included BM25 ranking against the included qrels.

Tokenizer policy summary: whitespace:python.

Nano split Tokenizer Forced BM25 positives BM25 nDCG@10
NanoCodeRAGLibraryDocumentationSolutions whitespace:python 85 0.2279
NanoCodeRAGOnlineTutorials whitespace:python 17 0.7472
NanoCodeRAGProgrammingSolutions whitespace:python 149 0.0138
NanoCodeRAGStackoverflowPosts whitespace:python 10 0.6902

Skipped Tasks

No source tasks were skipped.

License

NanoCodeRAG is a derived dataset. Users must comply with the licenses, terms, and attribution requirements of the upstream datasets and benchmarks.