Skip to content

Add INCLUDE multilingual MCQ benchmark#1483

Open
naymaraq wants to merge 8 commits into
mainfrom
dkaramyan/include
Open

Add INCLUDE multilingual MCQ benchmark#1483
naymaraq wants to merge 8 commits into
mainfrom
dkaramyan/include

Conversation

@naymaraq

@naymaraq naymaraq commented Jun 14, 2026

Copy link
Copy Markdown
Collaborator

Add the INCLUDE benchmark (CohereLabs/include-base-44) with prepare.py, include_benchmark_utils.py, and dataset config. Prompts are rendered in-language per sample (task instruction, options, and answer prefix), zero-shot, graded via the multichoice eval type.

Summary by CodeRabbit

  • New Features
    • Added multilingual dataset processing utilities for the INCLUDE benchmark dataset
    • New dataset preparation tool available via CLI for formatting and normalizing multiple-choice questions
    • Automatic answer extraction with language-specific prompt templates and metadata handling for dataset entries

Signed-off-by: naymaraq <dkaramyan@nvidia.com>
@naymaraq
naymaraq force-pushed the dkaramyan/include branch from 3e420d2 to 97f7522 Compare June 14, 2026 15:14
naymaraq added 7 commits June 14, 2026 19:17
Signed-off-by: naymaraq <dkaramyan@nvidia.com>
Signed-off-by: naymaraq <dkaramyan@nvidia.com>
Signed-off-by: naymaraq <dkaramyan@nvidia.com>
Signed-off-by: naymaraq <dkaramyan@nvidia.com>
Signed-off-by: naymaraq <dkaramyan@nvidia.com>
Signed-off-by: naymaraq <dkaramyan@nvidia.com>
Signed-off-by: naymaraq <dkaramyan@nvidia.com>
@naymaraq
naymaraq marked this pull request as ready for review June 15, 2026 07:49
@naymaraq
naymaraq requested a review from shuoyangd June 15, 2026 07:49
@coderabbitai

coderabbitai Bot commented Jun 15, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

Adds a new nemo_skills/dataset/include package implementing support for the multilingual "include-base-44" multiple-choice benchmark. The package includes evaluation configuration constants, a utilities module with per-language prompt templates, MCQ field builders, and answer-extraction regex helpers, plus a CLI preparation script that loads HuggingFace dataset splits and writes formatted JSONL output.

Changes

INCLUDE Multilingual MCQ Dataset Module

Layer / File(s) Summary
Package config and data contracts
nemo_skills/dataset/include/__init__.py, nemo_skills/dataset/include/include_benchmark_utils.py
__init__.py exports METRICS_TYPE="multichoice" and GENERATION_ARGS constants. include_benchmark_utils.py defines the MCQFormat namedtuple, Schema field constants, and load_include_datasets to fetch per-language HuggingFace splits.
Language templates, regexes, and prompt builders
nemo_skills/dataset/include/include_benchmark_utils.py
Defines LETTER_REGEX, GREEDY_REGEX, and MCQ_FORMATS with per-language prompt templates/answer prefixes for all supported languages, plus SUPPORTED_LANGUAGES. Implements digit_to_letter, build_extract_regex (placeholder-anchored with greedy fallback), normalize_entry_field, copy_other_fields, build_prompt, and get_mcq_fields.
Dataset preparation pipeline and CLI
nemo_skills/dataset/include/prepare.py
Implements format_entry to produce per-entry output dicts with answer letter conversion, extraction regex, normalized category, and merged MCQ fields; collect_entries to aggregate across languages with tqdm; write_data_to_file for JSONL output; and a main/__main__ CLI with --split and --languages arguments.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The pull request title 'Add INCLUDE multilingual MCQ benchmark' accurately describes the main change: adding a new multilingual multiple-choice question benchmark based on the INCLUDE dataset.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch dkaramyan/include

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@nemo_skills/dataset/include/include_benchmark_utils.py`:
- Around line 285-286: In the normalize_entry_field function, replace the use of
entry.get(key, "") with direct dictionary access entry[key]. This ensures that
if a schema field is missing from the dataset, the code will fail immediately
with a clear KeyError rather than silently substituting an empty string and
potentially corrupting data, which aligns with the coding guideline to not use
.get() for fields expected to be present.
- Line 186: The task string variable contains unescaped zero-width-space
characters (appearing as invisible spaces in the Dutch text "Hieronder staan
​​meerkeuzevragen") that cause syntax errors. Replace these zero-width-space
characters with their properly escaped Unicode representation using \u200b.
Locate the task string containing the Dutch template prompt and replace each
zero-width-space with the escaped form to ensure the string is properly
formatted and syntactically valid.

In `@nemo_skills/dataset/include/prepare.py`:
- Around line 50-55: In the collect_entries function, add the strict=True
parameter to the zip() call that pairs datasets and languages. Change
zip(datasets, languages) to zip(datasets, languages, strict=True) to ensure that
both lists have matching lengths and raise a clear error if they do not, rather
than silently ignoring mismatched elements.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 3b619224-aa69-414d-9e23-e9aa2bc5ecb6

📥 Commits

Reviewing files that changed from the base of the PR and between da85a88 and 6e48dd4.

📒 Files selected for processing (3)
  • nemo_skills/dataset/include/__init__.py
  • nemo_skills/dataset/include/include_benchmark_utils.py
  • nemo_skills/dataset/include/prepare.py

),
"Dutch": MCQFormat(
answer_prefix="Antwoord: Laten we stap voor stap nadenken.",
task='Hieronder staan ​​meerkeuzevragen (met antwoorden) over {subject}. Denk stap voor stap en eindig uw antwoord met "{ans_suffix}", waarbij X de letter van het juiste antwoord is.',

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical | ⚡ Quick win

Fix zero-width-space characters in Dutch template.

Line 186 contains unescaped zero-width-space characters that will cause a Python syntax error. These must be escaped as \u200b.

🔧 Proposed fix
-        task='Hieronder staan ​​meerkeuzevragen (met antwoorden) over {subject}. Denk stap voor stap en eindig uw antwoord met "{ans_suffix}", waarbij X de letter van het juiste antwoord is.',
+        task='Hieronder staan\u200b\u200bmeerkeuzevragen (met antwoorden) over {subject}. Denk stap voor stap en eindig uw antwoord met "{ans_suffix}", waarbij X de letter van het juiste antwoord is.',
🧰 Tools
🪛 Ruff (0.15.15)

[error] 186-186: Invalid unescaped character zero-width-space, use "\u200B" instead

Replace with escape sequence

(PLE2515)


[error] 186-186: Invalid unescaped character zero-width-space, use "\u200B" instead

Replace with escape sequence

(PLE2515)

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@nemo_skills/dataset/include/include_benchmark_utils.py` at line 186, The task
string variable contains unescaped zero-width-space characters (appearing as
invisible spaces in the Dutch text "Hieronder staan ​​meerkeuzevragen") that
cause syntax errors. Replace these zero-width-space characters with their
properly escaped Unicode representation using \u200b. Locate the task string
containing the Dutch template prompt and replace each zero-width-space with the
escaped form to ensure the string is properly formatted and syntactically valid.

Comment on lines +285 to +286
def normalize_entry_field(entry, key):
return (entry.get(key, "") or "").replace(" ", "_")

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Use direct dictionary access instead of .get() for expected schema fields.

The function uses .get(key, "") with an empty string default for fields that are defined in the Schema and expected to be present in the dataset. Per the coding guidelines: "Don't use .get() for accessing dictionary keys if the code expects them to be present; use direct access data[key_name] to fail with a clear error instead of silently corrupting data."

If a schema field is missing from the dataset, the code should fail immediately with a clear KeyError rather than silently substituting an empty string, which could corrupt the prepared data.

🛡️ Proposed fix
 def normalize_entry_field(entry, key):
-    return (entry.get(key, "") or "").replace(" ", "_")
+    value = entry[key]
+    return (value or "").replace(" ", "_")

As per coding guidelines: "Don't use .get() for accessing dictionary keys if the code expects them to be present; use direct access data[key_name] to fail with a clear error instead of silently corrupting data."

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@nemo_skills/dataset/include/include_benchmark_utils.py` around lines 285 -
286, In the normalize_entry_field function, replace the use of entry.get(key,
"") with direct dictionary access entry[key]. This ensures that if a schema
field is missing from the dataset, the code will fail immediately with a clear
KeyError rather than silently substituting an empty string and potentially
corrupting data, which aligns with the coding guideline to not use .get() for
fields expected to be present.

Source: Coding guidelines

Comment on lines +50 to +55
def collect_entries(languages, datasets):
entries = []
for dataset, lang in zip(datasets, languages):
for entry in tqdm(dataset, desc=f"Preparing {lang} dataset"):
entries.append(format_entry(entry=entry, language=lang))
return entries

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Add strict=True to zip() for safer iteration.

The zip() call pairs datasets and languages without strict=True, which could silently ignore mismatched list lengths. Although the validation in main() should prevent this, adding strict=True provides an explicit safety check that will raise a clear error if the lists unexpectedly differ in length.

🔒 Proposed fix
 def collect_entries(languages, datasets):
     entries = []
-    for dataset, lang in zip(datasets, languages):
+    for dataset, lang in zip(datasets, languages, strict=True):
         for entry in tqdm(dataset, desc=f"Preparing {lang} dataset"):
             entries.append(format_entry(entry=entry, language=lang))
     return entries
🧰 Tools
🪛 Ruff (0.15.15)

[warning] 52-52: zip() without an explicit strict= parameter

Add explicit value for parameter strict=

(B905)

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@nemo_skills/dataset/include/prepare.py` around lines 50 - 55, In the
collect_entries function, add the strict=True parameter to the zip() call that
pairs datasets and languages. Change zip(datasets, languages) to zip(datasets,
languages, strict=True) to ensure that both lists have matching lengths and
raise a clear error if they do not, rather than silently ignoring mismatched
elements.

@naymaraq
naymaraq requested a review from AlexGrinch June 16, 2026 06:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant