WideChaos's picture
Polish dataset card and add bilingual evaluation cover
62c1e29 verified
|
Raw History Blame Contribute Delete
11.4 kB
metadata
pretty_name: Bilingual Patch Contracts
license: apache-2.0
language:
  - en
  - zh
multilinguality: multilingual
size_categories:
  - n<1K
source_datasets:
  - original
annotations_creators:
  - expert-generated
language_creators:
  - expert-generated
task_categories:
  - text-generation
tags:
  - evaluation
  - instruction-following
  - structured-output
  - json
  - code-switching
  - synthetic
configs:
  - config_name: default
    data_files:
      - split: evaluation
        path: patch_contracts.jsonl

Bilingual Patch Contracts

Bilingual Patch Contracts: English, Chinese and mixed-language inputs with strict JSON evaluation

Strict JSON state-update diagnostics in English, Chinese and mixed Chinese-English.

Run the scoring tutorial on Kaggle · Kaggle dataset · Original benchmark and model runs

中文导读

这个小型诊断集检查模型能否按顺序修改 JSON 状态,并准确返回规定的字段、类型和值。十二个语义场景各含英文、中文和中英混合版本,共 36 条提示,覆盖纠正、否定、空值、列表、单位换算、条件和字面量处理。

使用 prompt 作为完整模型输入,以 expected_state 为标准答案。CSV 中的状态列需用 json.loads 解析;JSONL 中则直接是对象。按 pair_id 比较同一场景的三个语言版本。自然语言规则和指令随语言变化,JSON 字段名与路由枚举统一使用英文。

答案全部公开,三个语言版本相互关联。它适合定位结构化输出问题;小样本结果不能推导通用模型排名。数据集没有新增模型成绩,Notebook 中的合成示例用于验证评分程序。

Overview

A small public diagnostic set for one question: when a model is told to apply a few edits to a JSON state and return only the new JSON object, does it get every value right, and does that change when the instructions are written in English, Chinese, or code-switched Chinese-English?

Valid JSON is not enough. The cases probe corrections ("set to 90, then correct it to zero"), negation, null versus "null" versus "", tag order and case, unit conversion to integer minutes, conditionals evaluated mid-sequence, instruction-like text that must be stored literally, and Unicode/backslash escaping.

This is the dataset form of my existing Bilingual Patch Contracts Kaggle benchmark (task version 2). Prompts and answers are copied byte for byte from that task; nothing was re-authored for this release.

Records 36 prompts
Independent semantic scenarios 12 (pair_id)
Variants per scenario 3 instruction languages: en, zh, mixed
Split one public evaluation split; no train split
Dataset version 1.0.0
License Apache-2.0 (data, scorer, tools and notebook)

Important: public answers, correlated variants

  • Answers are public. expected_state ships with every prompt. Use this as a diagnostic evaluation set. It is not a secret held-out test, and scores on it say nothing about held-out generalization if the data was seen during training or prompt tuning.
  • 36 prompts are not 36 independent samples. The three variants of a pair_id share one initial state and one expected answer. Report results per group (for example "groups passing in all three languages: k/12"). The 12 scenarios are hand-written diagnostics, not sampled from a population of tasks, so results support no significance claim and no general model ranking.
  • There is no train/validation/test split, and translated variants must not be used to make one.

Fields

Field Type Meaning
id string <pair_id>-<instruction_language>
pair_id string Semantic scenario; all three variants share initial and expected state
family string Failure family probed: correction, negation, null, list, units, conditional, literal
instruction_language string Language of the natural-language text (rules preamble and instruction body): en, zh, or mixed
contract_language string Language of the wire contract, i.e. JSON keys and route values. Always en: every variant asks for the same canonical English keys and values
preamble string Rules text before the initial state, in instruction_language
initial_state object (JSONL) / JSON text (CSV) State before the edits
instruction string Instruction body
prompt string The complete original prompt sent in the benchmark
expected_state object (JSONL) / JSON text (CSV) Oracle state after the edits

Each instruction language has its own natural-language rules preamble (en: "Apply the instructions below…", zh: "按顺序把下面的指令…", mixed: "按顺序 apply…"); there is no common English preamble. What every variant shares in English is only the wire contract: the five JSON keys and the route values email/sms/none.

prompt is exactly preamble + "\n\nInitial state / 初始状态:\n" + json.dumps(initial_state, ensure_ascii=False) + "\n\nInstructions / 指令:\n" + instruction. The release checks verify this for all 36 rows.

Every state has the keys route ("email", "sms" or "none"), delay_minutes (non-negative integer or null), active (boolean), tags (list of unique strings, order matters) and note (string or null).

Files

  • patch_contracts.jsonl: canonical UTF-8 dataset, one object per line; initial and expected states are JSON objects
  • patch_contracts.csv: the same 36 rows as quoted UTF-8 CSV; state columns are JSON text
  • manifest.json: version, source SHA-256, counts, field definitions and data-file hashes
  • strict_scorer.py: strict JSON parser, schema validation and exact-value scoring; Python standard library only
  • LICENSE and NOTICE: Apache-2.0 terms, copyright, attribution and provenance
  • README.md: dataset card, usage, scoring and limitations
  • cover.png: cover artwork; excluded from the evaluation split by the explicit JSONL configuration

Quick start

Load directly from the Hub:

from datasets import load_dataset

ds = load_dataset(
    "WideChaos/bilingual-patch-contracts",
    split="evaluation",
)
assert len(ds) == 36
print(ds[0]["prompt"])

For reproducible reports, pass revision="<commit-sha>" to pin the dataset version. Evaluate the complete prompt without appending expected_state to the input. Keep failed calls in the denominator and report paired results across the three languages.

The Kaggle notebook demonstrates the strict scorer and a response-file adapter. It runs offline and uses labeled synthetic fixtures; those fixture scores are not model measurements.

Local files

Standard library only:

import json
rows = [json.loads(line) for line in open("patch_contracts.jsonl", encoding="utf-8")]
assert len(rows) == 36

With the datasets library, after downloading the files:

from datasets import load_dataset
ds = load_dataset("json", data_files={"evaluation": "patch_contracts.jsonl"})["evaluation"]

CSV state columns are JSON text: json.loads(row["expected_state"]).

Scoring rule

A response passes only if the whole response text parses as one JSON object with exactly the five keys, the required types and every expected value. No Markdown fence stripping, no extraction of the first {...}, no output repair, no model judge. Key order, whitespace and equivalent Unicode escapes do not matter; tag order does. Booleans are not integers. Malformed text, duplicate keys, NaN/Infinity and numeric overflow fail at parse time; valid JSON with a non-object root, wrong key set, wrong types or wrong values fails the schema/value check.

strict_scorer.py implements this rule. Its pass/fail verdict matches the scorer of the published Kaggle task; it additionally reports overflow at parse time and returns failure labels. The companion Kaggle notebook demonstrates it with labeled synthetic fixtures and includes a response-file adapter that refuses unknown, duplicate or missing ids, so a failed call cannot shrink the denominator below 36.

Results already published (not produced by this release)

Real model runs exist only on the Kaggle benchmark page, from task version 2 published on 2026-10-01: one run per prompt, temperature 0, seed 0, plain text prompts without JSON mode or schema enforcement. See that page for models and scores. This release contains no model responses and adds no new measurements. Any fixture scores in the notebook are synthetic scorer demonstrations, not model performance or rankings.

Source and creation

All prompts, states and answers are original synthetic material that I wrote for the benchmark: hand-authored English, Chinese and code-switched variants of 12 scenarios. No external dataset, scraped text, user data, employer material or model-generated output is included.

Limitations and bias

  • Small: 12 scenarios across 7 failure families. A ceiling score means the set is too easy for that system, not that it is production-safe.
  • Translations are hand-authored by one person; phrasing, length and difficulty are not perfectly matched across languages.
  • mixed reflects one author's Chinese-English code-switching style, not a representative sample of real code-switched text.
  • One fixed schema with five keys; it does not cover tool calling, nested objects, long contexts, latency or general multilingual ability.
  • Answers are public and may appear in future training data, which would make scores on this set uninformative.

Maintenance and feedback

This is dataset version 1.0.0, a fixed diagnostic release. Documentation and presentation updates do not change the prompts or answers. For a suspected error, open a discussion with the prompt id, expected behavior and a minimal reproduction. Remove private prompts, credentials and user data before posting.

License and attribution

Everything in this release, data and code alike, is licensed under the Apache License, Version 2.0 (Apache-2.0), full text in LICENSE. This keeps the license under which the public Kaggle benchmark was already released; this release does not relicense it. Copyright 2026 Renchao Wu; keep NOTICE when redistributing.

Attribution: "Bilingual Patch Contracts" by Renchao Wu, Apache-2.0, https://www.kaggle.com/benchmarks/xover2022/bilingual-patch-contracts

@misc{wu2026bilingualpatchcontracts,
  author = {Renchao Wu},
  title  = {Bilingual Patch Contracts},
  year   = {2026},
  note   = {Dataset version 1.0.0},
  url    = {https://www.kaggle.com/benchmarks/xover2022/bilingual-patch-contracts}
}