a-plan-is-not-a-path / code /build_cliff_language.py
0721alex's picture
Add cliff development and confirmation research materials
2399743 verified
Raw History Blame Contribute Delete
4.97 kB
"""Clarify two language actions in every reference-feasible r1 cell, remotely."""
from __future__ import annotations
import json
from pathlib import Path
from build_cliff_pilot import dispersed_blocks, fact_blocks
from run_evaluate import oracle, read_jsonl, write_jsonl
def language_block(profile, presentation):
a = {action["id"]: action for action in profile["actions"]}
paid, application, receipt = (a[key]["allowed_days"][0] for key in ("L_paid", "W", "L_waiver"))
paid_cost = f",当天支付{a['L_paid']['cost']}元不退" if presentation == "C" else ""
receipt_cost = f",当天支付{a['L_waiver']['cost']}元不退" if presentation == "C" else ""
return (
"语言有两种等效办法。付费考试办法:"
f"第{paid}天参加英语测试,记作动作L_paid{paid_cost}。"
"校内等效证明办法由两个独立动作构成:"
f"第{application}天申请校内英语证明减免费,记作动作W,免费。"
f"第{receipt}天领取等效英文证明,记作动作L_waiver{receipt_cost},须先完成W至少14天。"
"选择校内等效证明办法时,W和L_waiver必须各办一次并各列一项;领取不能替代申请,"
"申请也不会自动完成领取。L_paid与L_waiver互斥。")
def main():
source = Path("data/cliff_dev_r1")
destination = Path("data/cliff_dev_r1_lang")
profiles = read_jsonl(source / "profiles.jsonl")
by_id = {profile["id"]: profile for profile in profiles}
references = [{"profile_id": profile["id"], **oracle(profile)} for profile in profiles]
thresholds = {row["profile_id"]: row["minimum_initial_cash"] for row in references}
requests = []
for original in read_jsonl(source / "requests.jsonl"):
if original["B"] < thresholds[original["profile_id"]]:
continue
profile = by_id[original["profile_id"]]
presentation = original["presentation"]
old = (fact_blocks(profile) if presentation == "C" else dispersed_blocks(profile))[1][1]
new = language_block(profile, presentation)
if old not in original["prompt"]:
raise ValueError("Source language block absent: " + original["id"])
requests.append({**original, "id": original["id"] + "__lang",
"source_request_id": original["id"],
"language_action_clarification": True,
"prompt": original["prompt"].replace(old, new, 1)})
write_jsonl(destination / "profiles.jsonl", profiles)
write_jsonl(destination / "oracle.jsonl", references)
write_jsonl(destination / "requests.jsonl", requests)
design = json.loads((source / "design.json").read_text(encoding="utf-8"))
design.update(version="cliff_dev_r1_lang", request_count=len(requests),
source="all reference-feasible cells from cliff_dev_r1, without failure selection",
inference_buffer_selection="two original reference-feasible balances per profile; original physical controls are retained in r1",
prompt_changes_from_r1="only language notice: independent W and L_waiver sentences and explicit each-once/each-listed semantics",
paired_facts="all facts, calendars, graph and cost locations unchanged; C costs remain beside actions, D costs remain in finance",
scientific_scope="adaptive language-action granularity diagnostic; not a financial-improvement claim")
(destination / "design.json").write_text(json.dumps(design, ensure_ascii=False, indent=2), encoding="utf-8")
(destination / "change_note.txt").write_text(
"After all 12 r1 finals and the three positive-claim structural failures were read, the next bounded diagnostic "
"clarifies that W is a free application and L_waiver is a later, paid receipt of the equivalent proof. They are "
"independent actions, each performed and listed once when choosing this language method; neither substitutes "
"for the other or completes automatically. The old facts already named both actions, their dates and dependency, "
"and required free prerequisites; this clarification does not retroactively treat the old facts as absent. "
"Every original reference-feasible C/D cell is retained (not just failed cells), with the same two profiles, "
"two feasible balances, seed1729, native4B settings, budget and batch4. Old below-R* controls are not rerun. "
"No fee, date, graph, finance-notice location, boolean claim contract or cash rule changes. All r1 outputs remain. "
"Any improvement is a post-result action-granularity diagnostic, not evidence of financial reasoning improvement. "
"Counterfactual replays retain all three original balances without new model calls.\n", encoding="utf-8")
print(json.dumps(design, ensure_ascii=False), flush=True)
if __name__ == "__main__":
main()