MuSP-Bench / evaluation /README.md
milan477's picture
Add offline MuSP scorer and usage instructions
a97edac verified
|
Raw History Blame Contribute Delete
3.8 kB

MuSP offline scorer

This directory contains the reference answer normalizer, an optional task-dependent normalizer, a scoring CLI, and regression tests. It uses Node.js 20 or later, with no npm dependencies or model API calls.

Use the existing public question table

The CLI reads JSONL. Convert the existing data/questions.csv into a local answer-key JSONL file with Python's standard library. This preserves the public question IDs and accepted answers in that CSV:

python - <<'PYTHON'
import csv, json
from pathlib import Path
with Path("data/questions.csv").open(newline="", encoding="utf-8") as source, Path("questions-for-scoring.jsonl").open("w", encoding="utf-8") as output:
    for row in csv.DictReader(source):
        row["question_id"] = row.get("question_id") or row["id"]
        row["answers"] = json.loads(row["answers"])
        output.write(json.dumps(row, ensure_ascii=False) + "\n")
PYTHON

Use predictions in JSONL format, with one object per answer. Each row needs id or question_id and answer. Use IDs from the same question-file revision and null for a missing response. Include the full question text to enable stale-prompt checks. Optional model, representation, and collection fields distinguish multiple conditions. Do not supply both an editor question ID and a public ID from a different revision.

node evaluation/evaluate.mjs --questions questions-for-scoring.jsonl --predictions your-predictions.jsonl --output scored.jsonl --report scored.md
node evaluation/evaluate.mjs --questions questions-for-scoring.jsonl --predictions your-predictions.jsonl --scorer typed --output scored-typed.jsonl
node --test evaluation/pitch-name-normalization.test.mjs

If a release already supplies data/questions.jsonl, use it directly with --questions. Saved model predictions and a replacement answer key are not included in this scorer upload. Provide your own prediction file explicitly.

Scoring policies

The default reference matcher reproduces the existing deterministic normalization policy, including the hyphenated pitch-name correction. It supports pitch identity, conventional instrument aliases, timestamp spellings, response-wrapper cleanup, and a limited work-title rule. General-text fallback can erase meaningful case and punctuation.

The optional typed matcher uses answer-format-specific normalization for supported formats, preserving Roman-numeral/chord-quality case, numeric values, and ordered boundaries while retaining the established enharmonic policy. Other formats use the guarded reference matcher. Neither policy provides automatic timestamp tolerance, partial credit, or general semantic judgment. State the scorer policy and dataset revision when reporting results.

Blank reference entries are ignored. Explicit null predictions count as incorrect; omitted rows are not automatically added. Duplicate prediction rows and mismatched supplied question text are rejected. Include all expected rows, with nulls for missing responses, when comparing against a published denominator. The report prints full questions, IDs, modalities, reference answers, model answers, and correctness.

--compare-typed reports the number of judgments that differ and exits nonzero when they differ; it is a consistency check, not a requirement that future outputs receive identical grades. Before publication, both matchers agreed on all 5,842 locally saved answer slots in the corrected 2026-10-16 snapshot. Those predictions are not part of this upload, and this check does not establish equivalence on new outputs or other answer-key revisions.

This scorer upload does not change the dataset CSV, musical inputs, or historical results table. Rescoring runs locally and incurs no model inference cost.