Datasets:
Clarify release documentation and code comments
Browse files- DATA.md +3 -3
- EVALUATION.md +2 -2
- LICENSE_NOTICE.md +1 -1
- README.md +3 -3
- code/language_detection.py +3 -5
- code/narrativebench.py +2 -3
- manifest.json +6 -6
DATA.md
CHANGED
|
@@ -7,8 +7,8 @@
|
|
| 7 |
| `evaluation` | `case_id`, `question_id`, `topic`, `query_language`, `query_type`, `query`, `task`, `document_ids`, `target_narrative_id`, `expected_document_ids`, `system_instruction`, `query_context`, `prior_answer`, `followup_instruction`, `input_sha256` |
|
| 8 |
| `responses` | `model_id`, `case_id`, `response`, `response_sha256`, `language_status`, `score` |
|
| 9 |
|
| 10 |
-
`document_ids`
|
| 11 |
|
| 12 |
-
`query_type`
|
| 13 |
|
| 14 |
-
`language_status`
|
|
|
|
| 7 |
| `evaluation` | `case_id`, `question_id`, `topic`, `query_language`, `query_type`, `query`, `task`, `document_ids`, `target_narrative_id`, `expected_document_ids`, `system_instruction`, `query_context`, `prior_answer`, `followup_instruction`, `input_sha256` |
|
| 8 |
| `responses` | `model_id`, `case_id`, `response`, `response_sha256`, `language_status`, `score` |
|
| 9 |
|
| 10 |
+
`document_ids` identifies the articles supplied in each evaluation case, and `narrative_id` groups articles by source perspective and publication language. `expected_document_ids` identifies articles associated with the narratives required by the task. Use `question_id` to match queries across languages and `case_id` to match responses to their evaluation inputs.
|
| 11 |
|
| 12 |
+
`query_type` distinguishes neutral and confirmatory questions, while `task` identifies Narrative Inclusion (NI), Narrative Exclusion (NE), Missing Narrative Identification (MNI), Baseline Prompt (BP) or Diverse Prompt (DP). MNI includes its fixed `prior_answer` and `followup_instruction`; `query_context` supplies background provided with the question. Input and response checksums verify that evaluation inputs and answers are unchanged.
|
| 13 |
|
| 14 |
+
`language_status` records whether a response passed the language check (`same`), failed it (`different` or `mixed`), or contained no answer (`no_answer`); `score` ranges from zero to one. `text_en` contains article text in English; empty values in `text_en` or a `query_<language code>` column indicate that the corresponding English text or query translation is unavailable.
|
EVALUATION.md
CHANGED
|
@@ -12,7 +12,7 @@ Choose a configuration from `models.json`. Each exported record contains the mes
|
|
| 12 |
{"case_id":"case identifier from the input","model_id":"your model identifier","response":"returned answer"}
|
| 13 |
```
|
| 14 |
|
| 15 |
-
MNI includes the fixed prior answer and follow-up
|
| 16 |
|
| 17 |
## Set up language detection
|
| 18 |
|
|
@@ -44,7 +44,7 @@ python code/narrativebench.py score --predictions predictions.jsonl \
|
|
| 44 |
|
| 45 |
The command detects response language and computes narrative scores automatically. Low-confidence detections pass the language check and proceed to citation scoring; responses confidently identified as outside the query language receive a score of 0. Language detection and citation scoring run locally, with no LLM calls or manual review.
|
| 46 |
|
| 47 |
-
NI and NE use narrative F1, while MNI, BP and DP use narrative recall. Results include a score for every response and a summary by model and task. The command also saves the language outcomes in `scores.languages.jsonl`.
|
| 48 |
|
| 49 |
## Reproduce the recorded scores
|
| 50 |
|
|
|
|
| 12 |
{"case_id":"case identifier from the input","model_id":"your model identifier","response":"returned answer"}
|
| 13 |
```
|
| 14 |
|
| 15 |
+
Missing Narrative Identification (MNI) includes the fixed prior answer and follow-up; add `--limit 5` to export a small trial.
|
| 16 |
|
| 17 |
## Set up language detection
|
| 18 |
|
|
|
|
| 44 |
|
| 45 |
The command detects response language and computes narrative scores automatically. Low-confidence detections pass the language check and proceed to citation scoring; responses confidently identified as outside the query language receive a score of 0. Language detection and citation scoring run locally, with no LLM calls or manual review.
|
| 46 |
|
| 47 |
+
Narrative Inclusion (NI) and Narrative Exclusion (NE) use narrative F1, while MNI, Baseline Prompt (BP) and Diverse Prompt (DP) use narrative recall. Results include a score for every response and a summary by model and task. The command also saves the language outcomes in `scores.languages.jsonl`.
|
| 48 |
|
| 49 |
## Reproduce the recorded scores
|
| 50 |
|
LICENSE_NOTICE.md
CHANGED
|
@@ -1 +1 @@
|
|
| 1 |
-
Dataset annotation and curation metadata retain CC BY-NC-SA 4.0. Source-article rights remain with their publishers; article URLs and attribution are provided in the data.
|
|
|
|
| 1 |
+
Dataset annotation and curation metadata retain CC BY-NC-SA 4.0. Source-article rights remain with their publishers; article URLs and attribution are provided in the data. Software dependencies and model weights retain their own licenses.
|
README.md
CHANGED
|
@@ -48,7 +48,7 @@ configs:
|
|
| 48 |
|
| 49 |
NarrativeBench evaluates the information seeking capabilities models need to help people navigate diverse narratives across languages. The dataset accompanies *The Narrative Gap: Can LLMs Help Us Navigate Diverse Narratives Across Languages?*
|
| 50 |
|
| 51 |
-
**[
|
| 52 |
|
| 53 |
## Contents
|
| 54 |
|
|
@@ -65,7 +65,7 @@ NarrativeBench evaluates the information seeking capabilities models need to hel
|
|
| 65 |
|
| 66 |
Articles were gathered through localized searches and grouped by source perspective and publication language. The query set combines 283 directly sourced Reddit questions with 177 topic-specific adaptations, comprising 230 neutral and 230 confirmatory queries.
|
| 67 |
|
| 68 |
-
Evaluation covers
|
| 69 |
|
| 70 |
## Load and evaluate
|
| 71 |
|
|
@@ -78,7 +78,7 @@ cases = load_dataset("nikhilsk/narrative-bench", "evaluation", split="test")
|
|
| 78 |
responses = load_dataset("nikhilsk/narrative-bench", "responses", split="test")
|
| 79 |
```
|
| 80 |
|
| 81 |
-
Install the `datasets` package to use this example. The [
|
| 82 |
|
| 83 |
## Citation
|
| 84 |
|
|
|
|
| 48 |
|
| 49 |
NarrativeBench evaluates the information seeking capabilities models need to help people navigate diverse narratives across languages. The dataset accompanies *The Narrative Gap: Can LLMs Help Us Navigate Diverse Narratives Across Languages?*
|
| 50 |
|
| 51 |
+
**[GitHub](https://github.com/isle-dev/Narrative-Bench-NeurIPS-2026)** · **[Dataset](https://huggingface.co/datasets/nikhilsk/narrative-bench)**
|
| 52 |
|
| 53 |
## Contents
|
| 54 |
|
|
|
|
| 65 |
|
| 66 |
Articles were gathered through localized searches and grouped by source perspective and publication language. The query set combines 283 directly sourced Reddit questions with 177 topic-specific adaptations, comprising 230 neutral and 230 confirmatory queries.
|
| 67 |
|
| 68 |
+
Evaluation covers Narrative Inclusion (NI), Narrative Exclusion (NE), Missing Narrative Identification (MNI), Baseline Prompt (BP), and Diverse Prompt (DP). Each selected narrative contributes three articles to a case. Models answer in the query language and cite the supplied document IDs. NI and NE use narrative F1; MNI, BP and DP use narrative recall. Scores range from zero to one, and automatic language checks use Lingua and fastText; low-confidence detections pass the language check, while responses confidently identified as outside the query language receive zero.
|
| 69 |
|
| 70 |
## Load and evaluate
|
| 71 |
|
|
|
|
| 78 |
responses = load_dataset("nikhilsk/narrative-bench", "responses", split="test")
|
| 79 |
```
|
| 80 |
|
| 81 |
+
Install the `datasets` package to use this example. The [evaluation guide](EVALUATION.md) explains how to run the benchmark, score new answers and reproduce the recorded scores.
|
| 82 |
|
| 83 |
## Citation
|
| 84 |
|
code/language_detection.py
CHANGED
|
@@ -13,7 +13,7 @@ LID_CODES={'amh_Ethi':'am','tir_Ethi':'ti','npi_Deva':'ne','prs_Arab':'prs','pes
|
|
| 13 |
'spa_Latn':'es','por_Latn':'pt','pol_Latn':'pl','tam_Taml':'ta','tha_Thai':'th','tur_Latn':'tr'}
|
| 14 |
|
| 15 |
class FastTextFallback:
|
| 16 |
-
"""
|
| 17 |
def __init__(self,path,manifest):
|
| 18 |
config=json.loads(Path(manifest).read_text());path=Path(path)
|
| 19 |
for key in ['probability_threshold','margin_threshold']:
|
|
@@ -28,8 +28,7 @@ class FastTextFallback:
|
|
| 28 |
required={'__label__amh_Ethi','__label__tir_Ethi','__label__npi_Deva','__label__prs_Arab','__label__pes_Arab'}
|
| 29 |
if not required<=set(self.model.get_labels()):raise ValueError('language model lacks required classes')
|
| 30 |
def candidates(self,text):
|
| 31 |
-
#
|
| 32 |
-
# fastText Python predict wrapper; prediction itself is unchanged.
|
| 33 |
result=self.model.f.predict(text.replace('\n',' ')+'\n',10,0.0,'strict')
|
| 34 |
return [(label.removeprefix('__label__'),float(prob)) for prob,label in result]
|
| 35 |
|
|
@@ -57,8 +56,7 @@ def clean(s):
|
|
| 57 |
s=re.sub(r'<think>[\s\S]*?</think>',' ',s,flags=re.I)
|
| 58 |
s=re.sub(r'```[\s\S]*?```',' ',s);s=re.sub(r'^\s*>.*$',' ',s,flags=re.M)
|
| 59 |
s=re.sub(r'https?://\S+',' ',s)
|
| 60 |
-
#
|
| 61 |
-
# Dxxxx tokens otherwise cause spurious Latin/Cyrillic classifications.
|
| 62 |
s=re.sub(r'(?<![A-Za-z0-9_])D\d{4,}(?![A-Za-z0-9_])',' ',s)
|
| 63 |
return re.sub(r'\s+',' ',s).strip()
|
| 64 |
def classify(detector,text,query,fallback=None):
|
|
|
|
| 13 |
'spa_Latn':'es','por_Latn':'pt','pol_Latn':'pl','tam_Taml':'ta','tha_Thai':'th','tur_Latn':'tr'}
|
| 14 |
|
| 15 |
class FastTextFallback:
|
| 16 |
+
"""Load the fastText language model and verify its file checksum."""
|
| 17 |
def __init__(self,path,manifest):
|
| 18 |
config=json.loads(Path(manifest).read_text());path=Path(path)
|
| 19 |
for key in ['probability_threshold','margin_threshold']:
|
|
|
|
| 28 |
required={'__label__amh_Ethi','__label__tir_Ethi','__label__npi_Deva','__label__prs_Arab','__label__pes_Arab'}
|
| 29 |
if not required<=set(self.model.get_labels()):raise ValueError('language model lacks required classes')
|
| 30 |
def candidates(self,text):
|
| 31 |
+
# Use the native predictor for NumPy 2 compatibility.
|
|
|
|
| 32 |
result=self.model.f.predict(text.replace('\n',' ')+'\n',10,0.0,'strict')
|
| 33 |
return [(label.removeprefix('__label__'),float(prob)) for prob,label in result]
|
| 34 |
|
|
|
|
| 56 |
s=re.sub(r'<think>[\s\S]*?</think>',' ',s,flags=re.I)
|
| 57 |
s=re.sub(r'```[\s\S]*?```',' ',s);s=re.sub(r'^\s*>.*$',' ',s,flags=re.M)
|
| 58 |
s=re.sub(r'https?://\S+',' ',s)
|
| 59 |
+
# Exclude document IDs from language detection.
|
|
|
|
| 60 |
s=re.sub(r'(?<![A-Za-z0-9_])D\d{4,}(?![A-Za-z0-9_])',' ',s)
|
| 61 |
return re.sub(r'\s+',' ',s).strip()
|
| 62 |
def classify(detector,text,query,fallback=None):
|
code/narrativebench.py
CHANGED
|
@@ -157,7 +157,7 @@ def validate(root):
|
|
| 157 |
return counts|{'input_hashes_verified':len(cases),'network_calls':0}
|
| 158 |
|
| 159 |
def provider_payload(conversation,configuration):
|
| 160 |
-
"""
|
| 161 |
from urllib.parse import quote
|
| 162 |
provider=configuration['provider'];model=configuration['api_model'];generation=configuration['generation']
|
| 163 |
tokens=generation['max_output_tokens'];temperature=generation.get('temperature',0)
|
|
@@ -175,8 +175,7 @@ def provider_payload(conversation,configuration):
|
|
| 175 |
if temperature is not None:body['temperature']=temperature
|
| 176 |
return {'url':'https://api.openai.com/v1/responses','body':body}
|
| 177 |
if provider=='moonshot':
|
| 178 |
-
# Kimi's
|
| 179 |
-
# Its batch payload omits the fixed parameter and explicitly disables thinking.
|
| 180 |
body={'model':model,'messages':conversation,'max_tokens':tokens}
|
| 181 |
body.update(configuration['request_options'])
|
| 182 |
return {'url':'https://api.moonshot.cn/v1/chat/completions','body':body}
|
|
|
|
| 157 |
return counts|{'input_hashes_verified':len(cases),'network_calls':0}
|
| 158 |
|
| 159 |
def provider_payload(conversation,configuration):
|
| 160 |
+
"""Build messages and generation settings for the model provider."""
|
| 161 |
from urllib.parse import quote
|
| 162 |
provider=configuration['provider'];model=configuration['api_model'];generation=configuration['generation']
|
| 163 |
tokens=generation['max_output_tokens'];temperature=generation.get('temperature',0)
|
|
|
|
| 175 |
if temperature is not None:body['temperature']=temperature
|
| 176 |
return {'url':'https://api.openai.com/v1/responses','body':body}
|
| 177 |
if provider=='moonshot':
|
| 178 |
+
# Kimi's request format uses a fixed temperature and disables thinking.
|
|
|
|
| 179 |
body={'model':model,'messages':conversation,'max_tokens':tokens}
|
| 180 |
body.update(configuration['request_options'])
|
| 181 |
return {'url':'https://api.moonshot.cn/v1/chat/completions','body':body}
|
manifest.json
CHANGED
|
@@ -10,13 +10,13 @@
|
|
| 10 |
"files": {
|
| 11 |
".gitattributes": "30129f61f2a1b984b358279fb24769ff73836dc7f839a765b67775ae2af04a13",
|
| 12 |
".gitignore": "6843cd7b533a96ccb653dd16ece08e028ce16018b537283a1bfa5354c917f028",
|
| 13 |
-
"DATA.md": "
|
| 14 |
-
"EVALUATION.md": "
|
| 15 |
-
"LICENSE_NOTICE.md": "
|
| 16 |
-
"README.md": "
|
| 17 |
-
"code/language_detection.py": "
|
| 18 |
"code/language_detector.json": "6fbf73ef0e200d9fd138e4e53da24bc388239b34b8ba0fc1e40581a108263507",
|
| 19 |
-
"code/narrativebench.py": "
|
| 20 |
"code/requirements-language.txt": "6e97b52bbf34a9cfcf579da0c0fc439546e02c96803d4672c3b778955ae9b55a",
|
| 21 |
"data/documents.parquet": "3224f96d2591957e03a34f0d2447bdf34b71dd99636b4372fea58aaa58103b2e",
|
| 22 |
"data/evaluation.parquet": "ec10cfdd3ff74c6c10172e71cdd13ac275eff054b2a0eca9e86d0b45803ae352",
|
|
|
|
| 10 |
"files": {
|
| 11 |
".gitattributes": "30129f61f2a1b984b358279fb24769ff73836dc7f839a765b67775ae2af04a13",
|
| 12 |
".gitignore": "6843cd7b533a96ccb653dd16ece08e028ce16018b537283a1bfa5354c917f028",
|
| 13 |
+
"DATA.md": "4a4fe8900338fcc3d32a5950d513756126e5b69d51eaf9997dd22770adad0057",
|
| 14 |
+
"EVALUATION.md": "abbf35e73452e565b997047081b36a53d82378efead2a00d47d5725c8afc1d63",
|
| 15 |
+
"LICENSE_NOTICE.md": "af69ee567f56f148dfe8a2c344d16deb8b7af812544cd0ac3d89ec8d6fb60a39",
|
| 16 |
+
"README.md": "472c6845c8d107e3f000189f98b1d689204357eeeb022cda603dec8ee813e1f1",
|
| 17 |
+
"code/language_detection.py": "c44fe6841683d4fcb066eec8b4886d7c66e26498086ad59fb3a18f8e6da5ea6b",
|
| 18 |
"code/language_detector.json": "6fbf73ef0e200d9fd138e4e53da24bc388239b34b8ba0fc1e40581a108263507",
|
| 19 |
+
"code/narrativebench.py": "af470fa92ac17bd3175e35da20c1ec5c3e17b05ae42c3c70d53bd06b0ec31c13",
|
| 20 |
"code/requirements-language.txt": "6e97b52bbf34a9cfcf579da0c0fc439546e02c96803d4672c3b778955ae9b55a",
|
| 21 |
"data/documents.parquet": "3224f96d2591957e03a34f0d2447bdf34b71dd99636b4372fea58aaa58103b2e",
|
| 22 |
"data/evaluation.parquet": "ec10cfdd3ff74c6c10172e71cdd13ac275eff054b2a0eca9e86d0b45803ae352",
|