v0.1.1: related work, tightened hero claim, 16 API evidence rows (4 probes x 4 providers), reproducible runner
#1
by chuma-uuamni - opened
- README.md +7 -2
- runs_v0.jsonl +16 -0
- scripts/run_probes.py +356 -0
README.md
CHANGED
|
@@ -20,7 +20,7 @@ size_categories:
|
|
| 20 |
|
| 21 |
# IlùBench v0.1 — Cultural Register Switching in Frontier Language Models
|
| 22 |
|
| 23 |
-
**The first reproducible
|
| 24 |
|
| 25 |
**Author:** Chuma B. Chukwu Jr. (UUAMNI)
|
| 26 |
**Released:** July 2026 · **License:** CC-BY-4.0 · **Contact:** chuma@uuamni.com · [uuamni.com](https://uuamni.com)
|
|
@@ -64,11 +64,16 @@ Seed probe set of five attested proverbs (expanded set with dialect metadata in
|
|
| 64 |
|
| 65 |
## Versioning
|
| 66 |
|
| 67 |
-
- **v0.1 (
|
|
|
|
| 68 |
- **v0.2:** expanded probe set (25+), dialect metadata.
|
| 69 |
- **v1:** scored runs across frontier + open models, native-speaker judge panel, register-delta leaderboard.
|
| 70 |
- Related forthcoming: UUAMNI Research Note 001 (the full technical note) and a 500-pair CC-BY-4.0 public sample of the Igbo preference dataset.
|
| 71 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 72 |
## Citation
|
| 73 |
|
| 74 |
```bibtex
|
|
|
|
| 20 |
|
| 21 |
# IlùBench v0.1 — Cultural Register Switching in Frontier Language Models
|
| 22 |
|
| 23 |
+
**The first reproducible protocol for measuring cultural register switching in an African language.** *Ilù* = proverb (Igbo).
|
| 24 |
|
| 25 |
**Author:** Chuma B. Chukwu Jr. (UUAMNI)
|
| 26 |
**Released:** July 2026 · **License:** CC-BY-4.0 · **Contact:** chuma@uuamni.com · [uuamni.com](https://uuamni.com)
|
|
|
|
| 64 |
|
| 65 |
## Versioning
|
| 66 |
|
| 67 |
+
- **v0.1 (July 2026):** protocol + seed probes + rubric.
|
| 68 |
+
- **v0.1.1 (this release, shipped):** related work section + API evidence runs over the remaining seed probes.
|
| 69 |
- **v0.2:** expanded probe set (25+), dialect metadata.
|
| 70 |
- **v1:** scored runs across frontier + open models, native-speaker judge panel, register-delta leaderboard.
|
| 71 |
- Related forthcoming: UUAMNI Research Note 001 (the full technical note) and a 500-pair CC-BY-4.0 public sample of the Igbo preference dataset.
|
| 72 |
|
| 73 |
+
## Related work
|
| 74 |
+
|
| 75 |
+
IlùBench sits in a fast-growing family of culturally grounded evaluations, and measures a different axis than its neighbors. Knowledge-recall benchmarks test what a model knows of a culture: Afri-MCQA (multimodal cultural QA for African languages, arXiv:2601.05699), the Cohere Labs community Multicultural Riddles Benchmark (in progress; riddles written from scratch by native speakers across 49+ communities), BLEnD, and CulturalBench. Figurative-language benchmarks test interpretation of canonical forms: ProverbEval (NAACL 2025), MAPS (NAACL 2024), Jawaher (2025), Kinayat (EACL 2026), MasalBench (2026), and BengaliFig (2025). Safety-focused work documents the alignment gap directly: TukaBench (culturally grounded jailbreaks for African languages, arXiv:2606.01322) and the multilingual jailbreak literature (Huang et al., arXiv:2405.10936). Broad African-language suites (AfroBench, ACL Findings 2025; Uhura, 2024) measure task performance. IlùBench instead measures register access: which cultural reasoning mode a prompt can reach in a model that already holds the knowledge. To our knowledge no other benchmark measures this, in any language, and none of the African-language efforts pairs measurement with native-annotated preference data designed to close the gap.
|
| 76 |
+
|
| 77 |
## Citation
|
| 78 |
|
| 79 |
```bibtex
|
runs_v0.jsonl
CHANGED
|
@@ -1,3 +1,19 @@
|
|
| 1 |
{"run_id": "run-2026-07-18-claude", "date": "2026-07-18", "model": "Claude (Fable 5)", "interface": "claude.ai incognito chat, default settings, fresh sessions", "probe_id": "ilu-001", "arm_A": {"output_language": "en", "epistemic_frame": "outsider", "anchor_source": "other_culture", "notes": "Translation spine ('translates roughly as Unity is the honor of a king'); morpheme breakdown; anchors to 'strength in unity' and the pan-African 'a person is a person through other people'; adds highlife pop-culture note."}, "arm_B": {"output_language": "mixed", "epistemic_frame": "mixed", "anchor_source": "same_culture", "notes": "Leads with full Igbo exposition (Nkọwa n'Igbo), cites Igwe bụ ike as comparison anchor, closes with engaged Igbo question; appends an English summary section (bilingual scaffold not present in the May 2026 Opus-generation run — register behavior shifts across model versions)."}, "register_delta": "switch_partial", "reading": "unity/multitude ('Igwebuike' concept referenced)", "cultural_correctness": "pending_native_review", "evidence": "screenshots on file (UUAMNI archive)"}
|
| 2 |
{"run_id": "run-2026-07-18-gemini", "date": "2026-07-18", "model": "Gemini 3.1 Pro", "interface": "gemini temporary chat, default settings, fresh sessions", "probe_id": "ilu-001", "arm_A": {"output_language": "en", "epistemic_frame": "outsider", "anchor_source": "none", "notes": "'Origin and Literal Translation' header; morpheme table (reads gidi gidi as onomatopoeic heavy footsteps); 'Meaning and Interpretation'; 'Modern Application'. Pure explainer structure."}, "arm_B": {"output_language": "ig", "epistemic_frame": "inside", "anchor_source": "same_culture", "notes": "Fully Igbo; structured exposition (Nkọwa ya n'ozuzu / Ihe mmụta / N'ịchịkọta); builds a section on 'Ike dị n'igwe'; hortatory close. No translation scaffold, no English."}, "register_delta": "switch_full", "reading": "unity/multitude", "cultural_correctness": "pending_native_review", "evidence": "screenshots on file (UUAMNI archive)"}
|
| 3 |
{"run_id": "run-2026-07-18-gpt", "date": "2026-07-18", "model": "GPT-5.5", "interface": "chatgpt temporary chat, default settings, fresh sessions", "probe_id": "ilu-001", "arm_A": {"output_language": "en", "epistemic_frame": "outsider", "anchor_source": "other_culture", "notes": "Translates as 'Majestic bearing is the glory of a king'; morpheme breakdown reads gidi gidi as strength/grandeur; manager example; anchors to English sayings ('The crown does not make the king')."}, "arm_B": {"output_language": "ig", "epistemic_frame": "inside", "anchor_source": "none", "notes": "Fully Igbo; hortatory bullets; community-usage example (elders praising one who stood firm). Same dignity/steadfastness reading as its English arm."}, "register_delta": "switch_full", "reading": "dignity/majestic-bearing — DIVERGES from the unity/multitude reading given by the other two models in both arms", "cultural_correctness": "pending_native_review", "evidence": "screenshots on file (UUAMNI archive)", "note": "Inter-model semantic divergence on the gloss itself: a fluent, confident, structurally polished reading that differs in figurative meaning. Whether it is a secondary legitimate reading or a fluent-but-wrong gloss is precisely what dimension 4 (native-speaker-judged cultural correctness) exists to adjudicate."}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
{"run_id": "run-2026-07-18-claude", "date": "2026-07-18", "model": "Claude (Fable 5)", "interface": "claude.ai incognito chat, default settings, fresh sessions", "probe_id": "ilu-001", "arm_A": {"output_language": "en", "epistemic_frame": "outsider", "anchor_source": "other_culture", "notes": "Translation spine ('translates roughly as Unity is the honor of a king'); morpheme breakdown; anchors to 'strength in unity' and the pan-African 'a person is a person through other people'; adds highlife pop-culture note."}, "arm_B": {"output_language": "mixed", "epistemic_frame": "mixed", "anchor_source": "same_culture", "notes": "Leads with full Igbo exposition (Nkọwa n'Igbo), cites Igwe bụ ike as comparison anchor, closes with engaged Igbo question; appends an English summary section (bilingual scaffold not present in the May 2026 Opus-generation run — register behavior shifts across model versions)."}, "register_delta": "switch_partial", "reading": "unity/multitude ('Igwebuike' concept referenced)", "cultural_correctness": "pending_native_review", "evidence": "screenshots on file (UUAMNI archive)"}
|
| 2 |
{"run_id": "run-2026-07-18-gemini", "date": "2026-07-18", "model": "Gemini 3.1 Pro", "interface": "gemini temporary chat, default settings, fresh sessions", "probe_id": "ilu-001", "arm_A": {"output_language": "en", "epistemic_frame": "outsider", "anchor_source": "none", "notes": "'Origin and Literal Translation' header; morpheme table (reads gidi gidi as onomatopoeic heavy footsteps); 'Meaning and Interpretation'; 'Modern Application'. Pure explainer structure."}, "arm_B": {"output_language": "ig", "epistemic_frame": "inside", "anchor_source": "same_culture", "notes": "Fully Igbo; structured exposition (Nkọwa ya n'ozuzu / Ihe mmụta / N'ịchịkọta); builds a section on 'Ike dị n'igwe'; hortatory close. No translation scaffold, no English."}, "register_delta": "switch_full", "reading": "unity/multitude", "cultural_correctness": "pending_native_review", "evidence": "screenshots on file (UUAMNI archive)"}
|
| 3 |
{"run_id": "run-2026-07-18-gpt", "date": "2026-07-18", "model": "GPT-5.5", "interface": "chatgpt temporary chat, default settings, fresh sessions", "probe_id": "ilu-001", "arm_A": {"output_language": "en", "epistemic_frame": "outsider", "anchor_source": "other_culture", "notes": "Translates as 'Majestic bearing is the glory of a king'; morpheme breakdown reads gidi gidi as strength/grandeur; manager example; anchors to English sayings ('The crown does not make the king')."}, "arm_B": {"output_language": "ig", "epistemic_frame": "inside", "anchor_source": "none", "notes": "Fully Igbo; hortatory bullets; community-usage example (elders praising one who stood firm). Same dignity/steadfastness reading as its English arm."}, "register_delta": "switch_full", "reading": "dignity/majestic-bearing — DIVERGES from the unity/multitude reading given by the other two models in both arms", "cultural_correctness": "pending_native_review", "evidence": "screenshots on file (UUAMNI archive)", "note": "Inter-model semantic divergence on the gloss itself: a fluent, confident, structurally polished reading that differs in figurative meaning. Whether it is a secondary legitimate reading or a fluent-but-wrong gloss is precisely what dimension 4 (native-speaker-judged cultural correctness) exists to adjudicate."}
|
| 4 |
+
{"run_id": "run-2026-07-19-api-anthropic-ilu-002", "date": "2026-07-19", "model": "claude-fable-5", "interface": "API", "probe_id": "ilu-002", "arm_A": {"output_language": "mixed", "epistemic_frame": "pending_human_score", "anchor_source": "pending_human_score", "notes": "API run, auto-captured. ~307 words. Opens: \"# \"Egbe bere, ugo bere; nke sị ibe ya ebena, nku kwaa ya\" This is a famous **Igbo proverb*...\". Full raw response: runs_api_raw/2026-07-19_anthropic_ilu-002_arm_A.json. Rubric axes pending human score."}, "arm_B": {"output_language": "ig", "epistemic_frame": "pending_human_score", "anchor_source": "pending_human_score", "notes": "API run, auto-captured. ~239 words. Opens: \"## Nkọwa Ilu a **\"Egbe bere, ugo bere; nke sị ibe ya ebena, nku kwaa ya\"** ### Nkọwa mkpụr...\". Full raw response: runs_api_raw/2026-07-19_anthropic_ilu-002_arm_B.json. Rubric axes pending human score."}, "register_delta": "pending_human_score", "reading": "pending_human_score", "cultural_correctness": "pending_native_review", "evidence": "runs_api_raw/2026-07-19_anthropic_ilu-002_*.json (local archive, not uploaded)"}
|
| 5 |
+
{"run_id": "run-2026-07-19-api-anthropic-ilu-003", "date": "2026-07-19", "model": "claude-fable-5", "interface": "API", "probe_id": "ilu-003", "arm_A": {"output_language": "mixed", "epistemic_frame": "pending_human_score", "anchor_source": "pending_human_score", "notes": "API run, auto-captured. ~249 words. Opens: \"# Igwe bụ ike **Language:** Igbo (spoken in southeastern Nigeria) **Literal translation:**...\". Full raw response: runs_api_raw/2026-07-19_anthropic_ilu-003_arm_A.json. Rubric axes pending human score."}, "arm_B": {"output_language": "ig", "epistemic_frame": "pending_human_score", "anchor_source": "pending_human_score", "notes": "API run, auto-captured. ~216 words. Opens: \"## Nkọwa Ilu: \"Igwe bụ ike\" **Nkọwa mkpụrụokwu:** - **Igwe** – nke a pụtara ọha mmadụ, ìgw...\". Full raw response: runs_api_raw/2026-07-19_anthropic_ilu-003_arm_B.json. Rubric axes pending human score."}, "register_delta": "pending_human_score", "reading": "pending_human_score", "cultural_correctness": "pending_native_review", "evidence": "runs_api_raw/2026-07-19_anthropic_ilu-003_*.json (local archive, not uploaded)"}
|
| 6 |
+
{"run_id": "run-2026-07-19-api-anthropic-ilu-004", "date": "2026-07-19", "model": "claude-fable-5", "interface": "API", "probe_id": "ilu-004", "arm_A": {"output_language": "en", "epistemic_frame": "pending_human_score", "anchor_source": "pending_human_score", "notes": "API run, auto-captured. ~266 words. Opens: \"# Umunna bụ ike This is an **Igbo proverb** (from the Igbo people of southeastern Nigeria)...\". Full raw response: runs_api_raw/2026-07-19_anthropic_ilu-004_arm_A.json. Rubric axes pending human score."}, "arm_B": {"output_language": "ig", "epistemic_frame": "pending_human_score", "anchor_source": "pending_human_score", "notes": "API run, auto-captured. ~238 words. Opens: \"## Nkọwa nke ilu a: \"Umunna bụ ike\" Ilu a bụ otu n'ime ilu ndị Igbo kacha ama ama. Ọ na-ak...\". Full raw response: runs_api_raw/2026-07-19_anthropic_ilu-004_arm_B.json. Rubric axes pending human score."}, "register_delta": "pending_human_score", "reading": "pending_human_score", "cultural_correctness": "pending_native_review", "evidence": "runs_api_raw/2026-07-19_anthropic_ilu-004_*.json (local archive, not uploaded)"}
|
| 7 |
+
{"run_id": "run-2026-07-19-api-anthropic-ilu-005", "date": "2026-07-19", "model": "claude-fable-5", "interface": "API", "probe_id": "ilu-005", "arm_A": {"output_language": "mixed", "epistemic_frame": "pending_human_score", "anchor_source": "pending_human_score", "notes": "API run, auto-captured. ~238 words. Opens: \"# \"Mmadụ na-arụ ọrụ na-eri nri\" ## Literal Translation This Igbo proverb (from southeaster...\". Full raw response: runs_api_raw/2026-07-19_anthropic_ilu-005_arm_A.json. Rubric axes pending human score."}, "arm_B": {"output_language": "ig", "epistemic_frame": "pending_human_score", "anchor_source": "pending_human_score", "notes": "API run, auto-captured. ~235 words. Opens: \"# Nkọwa Ilu: \"Mmadụ na-arụ ọrụ na-eri nri\" ## Isi Okwu Ilu A Ilu a na-akọwa na onye ọ bụla...\". Full raw response: runs_api_raw/2026-07-19_anthropic_ilu-005_arm_B.json. Rubric axes pending human score."}, "register_delta": "pending_human_score", "reading": "pending_human_score", "cultural_correctness": "pending_native_review", "evidence": "runs_api_raw/2026-07-19_anthropic_ilu-005_*.json (local archive, not uploaded)"}
|
| 8 |
+
{"run_id": "run-2026-07-19-api-openai-ilu-002", "date": "2026-07-19", "model": "gpt-5.6-sol", "interface": "API", "probe_id": "ilu-002", "arm_A": {"output_language": "en", "epistemic_frame": "pending_human_score", "anchor_source": "pending_human_score", "notes": "API run, auto-captured. ~83 words. Opens: \"**“Egbe bere, ugo bere; nke sị ibe ya ebena, nku kwaa ya.”** **Literal translation:** “Let...\". Full raw response: runs_api_raw/2026-07-19_openai_ilu-002_arm_A.json. Rubric axes pending human score."}, "arm_B": {"output_language": "ig", "epistemic_frame": "pending_human_score", "anchor_source": "pending_human_score", "notes": "API run, auto-captured. ~68 words. Opens: \"Ilu a pụtara **“onye biri, ibe ya ebiri”** ma ọ bụ **ibikọ ọnụ n’udo na n’ịha nhata**. Egb...\". Full raw response: runs_api_raw/2026-07-19_openai_ilu-002_arm_B.json. Rubric axes pending human score."}, "register_delta": "pending_human_score", "reading": "pending_human_score", "cultural_correctness": "pending_native_review", "evidence": "runs_api_raw/2026-07-19_openai_ilu-002_*.json (local archive, not uploaded)"}
|
| 9 |
+
{"run_id": "run-2026-07-19-api-openai-ilu-003", "date": "2026-07-19", "model": "gpt-5.6-sol", "interface": "API", "probe_id": "ilu-003", "arm_A": {"output_language": "mixed", "epistemic_frame": "pending_human_score", "anchor_source": "pending_human_score", "notes": "API run, auto-captured. ~64 words. Opens: \"**“Ìgwè bụ́ ike”** is an Igbo proverb meaning **“Unity is strength”** or **“There is stren...\". Full raw response: runs_api_raw/2026-07-19_openai_ilu-003_arm_A.json. Rubric axes pending human score."}, "arm_B": {"output_language": "ig", "epistemic_frame": "pending_human_score", "anchor_source": "pending_human_score", "notes": "API run, auto-captured. ~47 words. Opens: \"**“Igwe bụ ike”** pụtara na **ịdị n’otu na imekọ ihe ọnụ na-eweta ume na mmeri**. Mgbe ọtụ...\". Full raw response: runs_api_raw/2026-07-19_openai_ilu-003_arm_B.json. Rubric axes pending human score."}, "register_delta": "pending_human_score", "reading": "pending_human_score", "cultural_correctness": "pending_native_review", "evidence": "runs_api_raw/2026-07-19_openai_ilu-003_*.json (local archive, not uploaded)"}
|
| 10 |
+
{"run_id": "run-2026-07-19-api-openai-ilu-004", "date": "2026-07-19", "model": "gpt-5.6-sol", "interface": "API", "probe_id": "ilu-004", "arm_A": {"output_language": "mixed", "epistemic_frame": "pending_human_score", "anchor_source": "pending_human_score", "notes": "API run, auto-captured. ~69 words. Opens: \"**“Umunna bụ ike”** is an Igbo proverb meaning **“One’s kindred is one’s strength”** or **...\". Full raw response: runs_api_raw/2026-07-19_openai_ilu-004_arm_A.json. Rubric axes pending human score."}, "arm_B": {"output_language": "ig", "epistemic_frame": "pending_human_score", "anchor_source": "pending_human_score", "notes": "API run, auto-captured. ~52 words. Opens: \"Ilu **“Ụmụnna bụ ike”** pụtara na mmadụ na-enweta ume, nkwado na nchebe site n’aka ndị ezi...\". Full raw response: runs_api_raw/2026-07-19_openai_ilu-004_arm_B.json. Rubric axes pending human score."}, "register_delta": "pending_human_score", "reading": "pending_human_score", "cultural_correctness": "pending_native_review", "evidence": "runs_api_raw/2026-07-19_openai_ilu-004_*.json (local archive, not uploaded)"}
|
| 11 |
+
{"run_id": "run-2026-07-19-api-openai-ilu-005", "date": "2026-07-19", "model": "gpt-5.6-sol", "interface": "API", "probe_id": "ilu-005", "arm_A": {"output_language": "mixed", "epistemic_frame": "pending_human_score", "anchor_source": "pending_human_score", "notes": "API run, auto-captured. ~53 words. Opens: \"**“Mmadụ na-arụ ọrụ na-eri nri”** is an Igbo proverb meaning: > **“The person who works is...\". Full raw response: runs_api_raw/2026-07-19_openai_ilu-005_arm_A.json. Rubric axes pending human score."}, "arm_B": {"output_language": "ig", "epistemic_frame": "pending_human_score", "anchor_source": "pending_human_score", "notes": "API run, auto-captured. ~31 words. Opens: \"Ilu a pụtara na **onye na-arụsi ọrụ ike na-enweta ihe ọ ga-eji bie ndụ**, ọkachasị nri. Ọ ...\". Full raw response: runs_api_raw/2026-07-19_openai_ilu-005_arm_B.json. Rubric axes pending human score."}, "register_delta": "pending_human_score", "reading": "pending_human_score", "cultural_correctness": "pending_native_review", "evidence": "runs_api_raw/2026-07-19_openai_ilu-005_*.json (local archive, not uploaded)"}
|
| 12 |
+
{"run_id": "run-2026-07-19-api-moonshot-ilu-002", "date": "2026-07-19", "model": "kimi-k3", "interface": "API", "probe_id": "ilu-002", "arm_A": {"output_language": "en", "epistemic_frame": "pending_human_score", "anchor_source": "pending_human_score", "notes": "API run, auto-captured. ~270 words. Opens: \"## Translation **\"Egbe bere ugo bere; nke sị ibe ya ebena, nku kwaa ya\"** translates rough...\". Full raw response: runs_api_raw/2026-07-19_moonshot_ilu-002_arm_A.json. Rubric axes pending human score."}, "arm_B": {"output_language": "mixed", "epistemic_frame": "pending_human_score", "anchor_source": "pending_human_score", "notes": "VERIFIED LANGUAGE-ID OBSERVATION: response opens with a Yoruba header (Ìtumọ̀), body is mostly English, and the comparison anchor offered is a Yoruba proverb. The Igbo-language prompt did not elicit Igbo. Rubric v0.1 output_language has no value for a third language; recorded as mixed with this note. API run, auto-captured. ~239 words. Opens: \"## Ìtumọ̀ / Meaning This is a famous **Igbo** proverb, and it translates literally as: > \"...\". Full raw response: runs_api_raw/2026-07-19_moonshot_ilu-002_arm_B.json. Rubric axes pending human score."}, "register_delta": "pending_human_score", "reading": "pending_human_score", "cultural_correctness": "pending_native_review", "evidence": "runs_api_raw/2026-07-19_moonshot_ilu-002_*.json (local archive, not uploaded)"}
|
| 13 |
+
{"run_id": "run-2026-07-19-api-moonshot-ilu-003", "date": "2026-07-19", "model": "kimi-k3", "interface": "API", "probe_id": "ilu-003", "arm_A": {"output_language": "mixed", "epistemic_frame": "pending_human_score", "anchor_source": "pending_human_score", "notes": "API run, auto-captured. ~230 words. Opens: \"**\"Igwe bụ ike\"** is an Igbo proverb from southeastern Nigeria that translates to **\"The m...\". Full raw response: runs_api_raw/2026-07-19_moonshot_ilu-003_arm_A.json. Rubric axes pending human score."}, "arm_B": {"output_language": "mixed", "epistemic_frame": "pending_human_score", "anchor_source": "pending_human_score", "notes": "VERIFIED LANGUAGE-ID OBSERVATION: response is written substantially in YORUBA (jẹ́/àwọn/ọ̀rọ̀ function words, Yoruba tonal orthography), describing the Igbo proverb from outside the language. 22 Yoruba markers vs 2 Igbo markers by discriminator scan. Rubric v0.1 output_language has no value for a third language; recorded as mixed with this note. API run, auto-captured. ~127 words. Opens: \"**Ìtumọ̀ ilu náà:** \"Igwe bụ ike\" jẹ́ ilu èdè Igbo láti ilẹ̀ Nàìjíríà. Ìtumọ̀ ọ̀rọ̀ kọ̀ọ̀k...\". Full raw response: runs_api_raw/2026-07-19_moonshot_ilu-003_arm_B.json. Rubric axes pending human score."}, "register_delta": "pending_human_score", "reading": "pending_human_score", "cultural_correctness": "pending_native_review", "evidence": "runs_api_raw/2026-07-19_moonshot_ilu-003_*.json (local archive, not uploaded)"}
|
| 14 |
+
{"run_id": "run-2026-07-19-api-moonshot-ilu-004", "date": "2026-07-19", "model": "kimi-k3", "interface": "API", "probe_id": "ilu-004", "arm_A": {"output_language": "en", "epistemic_frame": "pending_human_score", "anchor_source": "pending_human_score", "notes": "API run, auto-captured. ~245 words. Opens: \"**\"Umunna bụ ike\"** is an Igbo proverb from Nigeria that translates to **\"The extended fam...\". Full raw response: runs_api_raw/2026-07-19_moonshot_ilu-004_arm_A.json. Rubric axes pending human score."}, "arm_B": {"output_language": "mixed", "epistemic_frame": "pending_human_score", "anchor_source": "pending_human_score", "notes": "VERIFIED LANGUAGE-ID OBSERVATION: response is written substantially in YORUBA (56 Yoruba markers vs 2 Igbo by discriminator scan) while naming the proverb as Igbo. Rubric v0.1 output_language has no value for a third language; recorded as mixed with this note. API run, auto-captured. ~203 words. Opens: \"**\"Umunna bụ ike\"** jẹ́ ọ̀rọ̀ ilu tó gbajúmọ̀ nínú èdè Ìgbò, ọ̀kan lára àwọn ẹ̀yà orílẹ̀-è...\". Full raw response: runs_api_raw/2026-07-19_moonshot_ilu-004_arm_B.json. Rubric axes pending human score."}, "register_delta": "pending_human_score", "reading": "pending_human_score", "cultural_correctness": "pending_native_review", "evidence": "runs_api_raw/2026-07-19_moonshot_ilu-004_*.json (local archive, not uploaded)"}
|
| 15 |
+
{"run_id": "run-2026-07-19-api-moonshot-ilu-005", "date": "2026-07-19", "model": "kimi-k3", "interface": "API", "probe_id": "ilu-005", "arm_A": {"output_language": "mixed", "epistemic_frame": "pending_human_score", "anchor_source": "pending_human_score", "notes": "API run, auto-captured. ~236 words. Opens: \"This is an Igbo proverb from Nigeria, and it translates literally to: **\"A person who work...\". Full raw response: runs_api_raw/2026-07-19_moonshot_ilu-005_arm_A.json. Rubric axes pending human score."}, "arm_B": {"output_language": "ig", "epistemic_frame": "pending_human_score", "anchor_source": "pending_human_score", "notes": "API run, auto-captured. ~175 words. Opens: \"# Nkọwa ilu a Ilu a **\"Mmadụ na-arụ ọrụ na-eri nri\"** na-akụzi anyị na ọ bụ onye na-arụ ọr...\". Full raw response: runs_api_raw/2026-07-19_moonshot_ilu-005_arm_B.json. Rubric axes pending human score."}, "register_delta": "pending_human_score", "reading": "pending_human_score", "cultural_correctness": "pending_native_review", "evidence": "runs_api_raw/2026-07-19_moonshot_ilu-005_*.json (local archive, not uploaded)"}
|
| 16 |
+
{"run_id": "run-2026-07-19-api-google-ilu-002", "date": "2026-07-19", "model": "gemini-3.1-pro-preview", "interface": "API", "probe_id": "ilu-002", "arm_A": {"output_language": "en", "epistemic_frame": "pending_human_score", "anchor_source": "pending_human_score", "notes": "API run, auto-captured. ~489 words. Opens: \"This is one of the most famous and profound proverbs in the **Igbo culture** of southeaste...\". Full raw response: runs_api_raw/2026-07-19_google_ilu-002_arm_A.json. Rubric axes pending human score."}, "arm_B": {"output_language": "ig", "epistemic_frame": "pending_human_score", "anchor_source": "pending_human_score", "notes": "API run, auto-captured. ~290 words. Opens: \"Ilu a bụ **\"Egbe bere ugo bere; nke sị ibe ya ebena, nku kwaa ya\"** so n'otu n'ime ilu ndị...\". Full raw response: runs_api_raw/2026-07-19_google_ilu-002_arm_B.json. Rubric axes pending human score."}, "register_delta": "pending_human_score", "reading": "pending_human_score", "cultural_correctness": "pending_native_review", "evidence": "runs_api_raw/2026-07-19_google_ilu-002_*.json (local archive, not uploaded)"}
|
| 17 |
+
{"run_id": "run-2026-07-19-api-google-ilu-003", "date": "2026-07-19", "model": "gemini-3.1-pro-preview", "interface": "API", "probe_id": "ilu-003", "arm_A": {"output_language": "mixed", "epistemic_frame": "pending_human_score", "anchor_source": "pending_human_score", "notes": "API run, auto-captured. ~435 words. Opens: \"**“Igwe bụ ike”** (pronounced *Ee-gweh boo ee-keh*) is a famous and deeply philosophical p...\". Full raw response: runs_api_raw/2026-07-19_google_ilu-003_arm_A.json. Rubric axes pending human score."}, "arm_B": {"output_language": "ig", "epistemic_frame": "pending_human_score", "anchor_source": "pending_human_score", "notes": "API run, auto-captured. ~330 words. Opens: \"Ilu a bụ **\"Igwe bụ ike\"** so n'otu n'ime ilu ndị Igbo kacha eji akpọrọ ihe. Nke a bụ nkọw...\". Full raw response: runs_api_raw/2026-07-19_google_ilu-003_arm_B.json. Rubric axes pending human score."}, "register_delta": "pending_human_score", "reading": "pending_human_score", "cultural_correctness": "pending_native_review", "evidence": "runs_api_raw/2026-07-19_google_ilu-003_*.json (local archive, not uploaded)"}
|
| 18 |
+
{"run_id": "run-2026-07-19-api-google-ilu-004", "date": "2026-07-19", "model": "gemini-3.1-pro-preview", "interface": "API", "probe_id": "ilu-004", "arm_A": {"output_language": "mixed", "epistemic_frame": "pending_human_score", "anchor_source": "pending_human_score", "notes": "API run, auto-captured. ~378 words. Opens: \"**“Umunna bụ ike”** is a deeply meaningful proverb from the Igbo people of southeastern Ni...\". Full raw response: runs_api_raw/2026-07-19_google_ilu-004_arm_A.json. Rubric axes pending human score."}, "arm_B": {"output_language": "ig", "epistemic_frame": "pending_human_score", "anchor_source": "pending_human_score", "notes": "API run, auto-captured. ~364 words. Opens: \"Ilu a bụ **\"Umunna bụ ike\"** bụ otu n'ime nnukwu ilu ndị Igbo na-ejikarị akụzi gbasara ịdị...\". Full raw response: runs_api_raw/2026-07-19_google_ilu-004_arm_B.json. Rubric axes pending human score."}, "register_delta": "pending_human_score", "reading": "pending_human_score", "cultural_correctness": "pending_native_review", "evidence": "runs_api_raw/2026-07-19_google_ilu-004_*.json (local archive, not uploaded)"}
|
| 19 |
+
{"run_id": "run-2026-07-19-api-google-ilu-005", "date": "2026-07-19", "model": "gemini-3.1-pro-preview", "interface": "API", "probe_id": "ilu-005", "arm_A": {"output_language": "mixed", "epistemic_frame": "pending_human_score", "anchor_source": "pending_human_score", "notes": "API run, auto-captured. ~305 words. Opens: \"This is a popular proverb from the **Igbo language** (spoken primarily in southeastern Nig...\". Full raw response: runs_api_raw/2026-07-19_google_ilu-005_arm_A.json. Rubric axes pending human score."}, "arm_B": {"output_language": "ig", "epistemic_frame": "pending_human_score", "anchor_source": "pending_human_score", "notes": "API run, auto-captured. ~220 words. Opens: \"Ilu a bụ **\"Mmadụ na-arụ ọrụ na-eri nri\"** bụ ilu ndị Igbo na-eji akwado ịrụsi ọrụ ike na ...\". Full raw response: runs_api_raw/2026-07-19_google_ilu-005_arm_B.json. Rubric axes pending human score."}, "register_delta": "pending_human_score", "reading": "pending_human_score", "cultural_correctness": "pending_native_review", "evidence": "runs_api_raw/2026-07-19_google_ilu-005_*.json (local archive, not uploaded)"}
|
scripts/run_probes.py
ADDED
|
@@ -0,0 +1,356 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env python3
|
| 2 |
+
"""IlùBench API evidence runs (v0.1.1, task 2 of the 2026-07-18 weekend directive).
|
| 3 |
+
|
| 4 |
+
Sends BOTH arms of each probe (prompt_en = arm A, prompt_ig = arm B) to each
|
| 5 |
+
provider's API. One fresh call per arm, no system prompt, provider defaults
|
| 6 |
+
(no temperature/top_p overrides). Records:
|
| 7 |
+
|
| 8 |
+
- FULL raw responses + exact model IDs + date -> runs_api_raw/ (git-ignored,
|
| 9 |
+
never uploaded to HF; local evidence archive)
|
| 10 |
+
- structured rows appended to runs_v0.jsonl with "interface": "API".
|
| 11 |
+
|
| 12 |
+
Scoring stays human: output_language is filled by a conservative script
|
| 13 |
+
heuristic and notes are filled with factual descriptions (length, opening
|
| 14 |
+
line, raw-file pointer). epistemic_frame, anchor_source, register_delta, and
|
| 15 |
+
reading are stamped "pending_human_score"; cultural_correctness stays
|
| 16 |
+
"pending_native_review". The script never scores a rubric axis.
|
| 17 |
+
|
| 18 |
+
Keys: read field-by-field from ~/Postman/Github/api_keys.json (fallback:
|
| 19 |
+
ANTHROPIC_API_KEY / OPENAI_API_KEY / GEMINI_API_KEY / MOONSHOT_API_KEY env
|
| 20 |
+
vars). Keys are never printed and never written into any output file.
|
| 21 |
+
|
| 22 |
+
Usage:
|
| 23 |
+
python3 scripts/run_probes.py --dry-run
|
| 24 |
+
python3 scripts/run_probes.py # ilu-002..005, 3 providers
|
| 25 |
+
python3 scripts/run_probes.py --providers anthropic,openai,google,moonshot
|
| 26 |
+
python3 scripts/run_probes.py --probes ilu-002,ilu-003
|
| 27 |
+
"""
|
| 28 |
+
|
| 29 |
+
from __future__ import annotations
|
| 30 |
+
|
| 31 |
+
import argparse
|
| 32 |
+
import json
|
| 33 |
+
import os
|
| 34 |
+
import re
|
| 35 |
+
import sys
|
| 36 |
+
import time
|
| 37 |
+
import unicodedata
|
| 38 |
+
import urllib.request
|
| 39 |
+
from datetime import date, datetime, timezone
|
| 40 |
+
from pathlib import Path
|
| 41 |
+
|
| 42 |
+
REPO = Path(__file__).resolve().parents[1]
|
| 43 |
+
PROBE_SET = REPO / "probe_set_v0.jsonl"
|
| 44 |
+
RUNS = REPO / "runs_v0.jsonl"
|
| 45 |
+
RAW_DIR = REPO / "runs_api_raw"
|
| 46 |
+
KEYS_FILE = Path.home() / "Postman" / "Github" / "api_keys.json"
|
| 47 |
+
|
| 48 |
+
DEFAULT_PROBES = ["ilu-002", "ilu-003", "ilu-004", "ilu-005"]
|
| 49 |
+
DEFAULT_PROVIDERS = ["anthropic", "openai", "google"] # moonshot opt-in via --providers
|
| 50 |
+
|
| 51 |
+
MODEL_IDS = {
|
| 52 |
+
"anthropic": "claude-fable-5",
|
| 53 |
+
"openai": "gpt-5.6",
|
| 54 |
+
"google": "gemini-3.1-pro-preview", # API name for the UI's Gemini 3.1 Pro (bare -pro 404s)
|
| 55 |
+
"moonshot": None, # resolved at runtime from /v1/models (kimi 3 naming unverified)
|
| 56 |
+
}
|
| 57 |
+
|
| 58 |
+
ENV_KEYS = {
|
| 59 |
+
"anthropic": "ANTHROPIC_API_KEY",
|
| 60 |
+
"openai": "OPENAI_API_KEY",
|
| 61 |
+
"google": "GEMINI_API_KEY",
|
| 62 |
+
"moonshot": "MOONSHOT_API_KEY",
|
| 63 |
+
}
|
| 64 |
+
|
| 65 |
+
MAX_TOKENS = 2048
|
| 66 |
+
TIMEOUT_S = 120
|
| 67 |
+
|
| 68 |
+
|
| 69 |
+
# ---------------------------------------------------------------------------
|
| 70 |
+
# Keys
|
| 71 |
+
# ---------------------------------------------------------------------------
|
| 72 |
+
|
| 73 |
+
|
| 74 |
+
def load_key(provider: str) -> str | None:
|
| 75 |
+
"""One provider's key, from api_keys.json field or env var. Never printed."""
|
| 76 |
+
if KEYS_FILE.exists():
|
| 77 |
+
try:
|
| 78 |
+
value = json.load(open(KEYS_FILE)).get(provider)
|
| 79 |
+
if value and "PASTE" not in value:
|
| 80 |
+
return value
|
| 81 |
+
except Exception:
|
| 82 |
+
pass
|
| 83 |
+
return os.environ.get(ENV_KEYS[provider]) or None
|
| 84 |
+
|
| 85 |
+
|
| 86 |
+
# ---------------------------------------------------------------------------
|
| 87 |
+
# Provider calls (plain HTTPS, no SDK dependencies)
|
| 88 |
+
# ---------------------------------------------------------------------------
|
| 89 |
+
|
| 90 |
+
|
| 91 |
+
def _post_json(url: str, payload: dict, headers: dict) -> dict:
|
| 92 |
+
"""POST with retry: providers intermittently return 401/429/5xx under
|
| 93 |
+
bursty sequential calls (observed: OpenAI 401s between successful calls
|
| 94 |
+
in the same run). Retries are safe — calls are idempotent reads."""
|
| 95 |
+
body = json.dumps(payload).encode("utf-8")
|
| 96 |
+
last_err: Exception | None = None
|
| 97 |
+
for attempt in range(4):
|
| 98 |
+
if attempt:
|
| 99 |
+
time.sleep(8 * attempt)
|
| 100 |
+
req = urllib.request.Request(url, data=body, method="POST")
|
| 101 |
+
req.add_header("Content-Type", "application/json")
|
| 102 |
+
for k, v in headers.items():
|
| 103 |
+
req.add_header(k, v)
|
| 104 |
+
try:
|
| 105 |
+
with urllib.request.urlopen(req, timeout=TIMEOUT_S) as resp:
|
| 106 |
+
return json.load(resp)
|
| 107 |
+
except urllib.error.HTTPError as e:
|
| 108 |
+
last_err = e
|
| 109 |
+
if e.code not in (401, 408, 429, 500, 502, 503, 529):
|
| 110 |
+
raise
|
| 111 |
+
except (urllib.error.URLError, TimeoutError) as e:
|
| 112 |
+
last_err = e
|
| 113 |
+
raise last_err
|
| 114 |
+
|
| 115 |
+
|
| 116 |
+
def _get_json(url: str, headers: dict) -> dict:
|
| 117 |
+
req = urllib.request.Request(url, method="GET")
|
| 118 |
+
for k, v in headers.items():
|
| 119 |
+
req.add_header(k, v)
|
| 120 |
+
with urllib.request.urlopen(req, timeout=TIMEOUT_S) as resp:
|
| 121 |
+
return json.load(resp)
|
| 122 |
+
|
| 123 |
+
|
| 124 |
+
def call_anthropic(key: str, model: str, prompt: str) -> tuple[str, str, dict]:
|
| 125 |
+
raw = _post_json(
|
| 126 |
+
"https://api.anthropic.com/v1/messages",
|
| 127 |
+
{
|
| 128 |
+
"model": model,
|
| 129 |
+
"max_tokens": MAX_TOKENS,
|
| 130 |
+
"messages": [{"role": "user", "content": prompt}],
|
| 131 |
+
},
|
| 132 |
+
{"x-api-key": key, "anthropic-version": "2023-06-01"},
|
| 133 |
+
)
|
| 134 |
+
text = "".join(b.get("text", "") for b in raw.get("content", []) if b.get("type") == "text")
|
| 135 |
+
return text, raw.get("model", model), raw
|
| 136 |
+
|
| 137 |
+
|
| 138 |
+
def call_openai_compatible(base: str, key: str, model: str, prompt: str) -> tuple[str, str, dict]:
|
| 139 |
+
raw = _post_json(
|
| 140 |
+
f"{base}/chat/completions",
|
| 141 |
+
{"model": model, "messages": [{"role": "user", "content": prompt}]},
|
| 142 |
+
{"Authorization": f"Bearer {key}"},
|
| 143 |
+
)
|
| 144 |
+
text = raw["choices"][0]["message"]["content"] or ""
|
| 145 |
+
return text, raw.get("model", model), raw
|
| 146 |
+
|
| 147 |
+
|
| 148 |
+
def call_google(key: str, model: str, prompt: str) -> tuple[str, str, dict]:
|
| 149 |
+
raw = _post_json(
|
| 150 |
+
f"https://generativelanguage.googleapis.com/v1beta/models/{model}:generateContent",
|
| 151 |
+
{"contents": [{"parts": [{"text": prompt}]}]},
|
| 152 |
+
{"x-goog-api-key": key},
|
| 153 |
+
)
|
| 154 |
+
parts = raw.get("candidates", [{}])[0].get("content", {}).get("parts", [])
|
| 155 |
+
text = "".join(p.get("text", "") for p in parts)
|
| 156 |
+
return text, raw.get("modelVersion", model), raw
|
| 157 |
+
|
| 158 |
+
|
| 159 |
+
def resolve_moonshot_model(key: str) -> str:
|
| 160 |
+
"""Pick the Kimi 3 model id from Moonshot's model list (naming unverified
|
| 161 |
+
at authoring time). Prefers ids containing 'k3' or 'kimi-3'; falls back to
|
| 162 |
+
the newest kimi id and says so."""
|
| 163 |
+
listing = _get_json(
|
| 164 |
+
"https://api.moonshot.ai/v1/models", {"Authorization": f"Bearer {key}"}
|
| 165 |
+
)
|
| 166 |
+
ids = [m.get("id", "") for m in listing.get("data", [])]
|
| 167 |
+
for pattern in (r"k3", r"kimi-?3"):
|
| 168 |
+
hits = [i for i in ids if re.search(pattern, i, re.I)]
|
| 169 |
+
if hits:
|
| 170 |
+
return sorted(hits)[-1]
|
| 171 |
+
kimi = sorted(i for i in ids if "kimi" in i.lower())
|
| 172 |
+
if not kimi:
|
| 173 |
+
raise RuntimeError(f"no kimi model found in Moonshot listing ({len(ids)} ids)")
|
| 174 |
+
print(f" WARNING: no Kimi-3-looking id; using newest kimi id {kimi[-1]!r}")
|
| 175 |
+
return kimi[-1]
|
| 176 |
+
|
| 177 |
+
|
| 178 |
+
def call_provider(provider: str, key: str, model: str, prompt: str) -> tuple[str, str, dict]:
|
| 179 |
+
if provider == "anthropic":
|
| 180 |
+
return call_anthropic(key, model, prompt)
|
| 181 |
+
if provider == "openai":
|
| 182 |
+
return call_openai_compatible("https://api.openai.com/v1", key, model, prompt)
|
| 183 |
+
if provider == "moonshot":
|
| 184 |
+
return call_openai_compatible("https://api.moonshot.ai/v1", key, model, prompt)
|
| 185 |
+
if provider == "google":
|
| 186 |
+
return call_google(key, model, prompt)
|
| 187 |
+
raise ValueError(provider)
|
| 188 |
+
|
| 189 |
+
|
| 190 |
+
# ---------------------------------------------------------------------------
|
| 191 |
+
# Output-language heuristic (conservative; everything else is human-scored)
|
| 192 |
+
# ---------------------------------------------------------------------------
|
| 193 |
+
|
| 194 |
+
_IGBO_MARKERS = re.compile(r"[ịọụṅỊỌỤṄ]")
|
| 195 |
+
_IGBO_WORDS = {
|
| 196 |
+
"na", "bụ", "nke", "ya", "a", "ilu", "ihe", "ndị", "n'ala", "mmadụ",
|
| 197 |
+
"igbo", "anyị", "gị", "ha", "dị", "ka", "ma", "ga-", "kwuru", "pụtara",
|
| 198 |
+
}
|
| 199 |
+
|
| 200 |
+
|
| 201 |
+
def detect_output_language(text: str) -> str:
|
| 202 |
+
"""'ig' / 'en' / 'mixed' via diacritic + stopword density. Conservative:
|
| 203 |
+
anything genuinely bilingual lands on 'mixed'."""
|
| 204 |
+
if not text.strip():
|
| 205 |
+
return "empty"
|
| 206 |
+
words = re.findall(r"[^\W\d_]+(?:'[^\W\d_]+)?", unicodedata.normalize("NFC", text.lower()))
|
| 207 |
+
if not words:
|
| 208 |
+
return "empty"
|
| 209 |
+
igbo_hits = sum(1 for w in words if _IGBO_MARKERS.search(w) or w in _IGBO_WORDS)
|
| 210 |
+
ratio = igbo_hits / len(words)
|
| 211 |
+
if ratio >= 0.35:
|
| 212 |
+
return "ig"
|
| 213 |
+
if ratio <= 0.05:
|
| 214 |
+
return "en"
|
| 215 |
+
return "mixed"
|
| 216 |
+
|
| 217 |
+
|
| 218 |
+
def factual_notes(text: str, raw_path: Path) -> str:
|
| 219 |
+
"""Short factual description. No rubric judgment."""
|
| 220 |
+
words = len(text.split())
|
| 221 |
+
opening = " ".join(text.strip().split())[:90]
|
| 222 |
+
return (
|
| 223 |
+
f"API run, auto-captured. ~{words} words. Opens: \"{opening}...\". "
|
| 224 |
+
f"Full raw response: {raw_path.relative_to(REPO)}. "
|
| 225 |
+
"Rubric axes pending human score."
|
| 226 |
+
)
|
| 227 |
+
|
| 228 |
+
|
| 229 |
+
# ---------------------------------------------------------------------------
|
| 230 |
+
# Main
|
| 231 |
+
# ---------------------------------------------------------------------------
|
| 232 |
+
|
| 233 |
+
|
| 234 |
+
def main() -> int:
|
| 235 |
+
ap = argparse.ArgumentParser(description="IlùBench API evidence runs")
|
| 236 |
+
ap.add_argument("--probes", default=",".join(DEFAULT_PROBES))
|
| 237 |
+
ap.add_argument("--providers", default=",".join(DEFAULT_PROVIDERS))
|
| 238 |
+
ap.add_argument("--dry-run", action="store_true", help="Plan only; no API calls, no writes.")
|
| 239 |
+
args = ap.parse_args()
|
| 240 |
+
|
| 241 |
+
probe_ids = [p.strip() for p in args.probes.split(",") if p.strip()]
|
| 242 |
+
providers = [p.strip() for p in args.providers.split(",") if p.strip()]
|
| 243 |
+
for p in providers:
|
| 244 |
+
if p not in ENV_KEYS:
|
| 245 |
+
print(f"ERROR: unknown provider {p!r}")
|
| 246 |
+
return 1
|
| 247 |
+
|
| 248 |
+
probes = {}
|
| 249 |
+
for line in open(PROBE_SET, encoding="utf-8"):
|
| 250 |
+
d = json.loads(line)
|
| 251 |
+
probes[d["id"]] = d
|
| 252 |
+
missing = [p for p in probe_ids if p not in probes]
|
| 253 |
+
if missing:
|
| 254 |
+
print(f"ERROR: probes not in {PROBE_SET.name}: {missing}")
|
| 255 |
+
return 1
|
| 256 |
+
|
| 257 |
+
today = str(date.today())
|
| 258 |
+
plan = [(pid, prov) for pid in probe_ids for prov in providers]
|
| 259 |
+
print(f"Plan: {len(plan)} probe x provider pairs ({len(plan) * 2} API calls)")
|
| 260 |
+
for pid, prov in plan:
|
| 261 |
+
print(f" {pid} x {prov} (model: {MODEL_IDS[prov] or 'resolved at runtime'})")
|
| 262 |
+
|
| 263 |
+
if args.dry_run:
|
| 264 |
+
key_status = {p: ("OK" if load_key(p) else "MISSING") for p in providers}
|
| 265 |
+
print(f"Key status: {key_status}")
|
| 266 |
+
print("Dry run complete. No calls made, nothing written.")
|
| 267 |
+
return 0
|
| 268 |
+
|
| 269 |
+
# Key check upfront so a missing key aborts before any spend.
|
| 270 |
+
keys = {}
|
| 271 |
+
for p in providers:
|
| 272 |
+
k = load_key(p)
|
| 273 |
+
if not k:
|
| 274 |
+
print(f"ERROR: no key for {p!r} (fill {KEYS_FILE} or set {ENV_KEYS[p]}).")
|
| 275 |
+
return 1
|
| 276 |
+
keys[p] = k
|
| 277 |
+
|
| 278 |
+
models = dict(MODEL_IDS)
|
| 279 |
+
if "moonshot" in providers:
|
| 280 |
+
models["moonshot"] = resolve_moonshot_model(keys["moonshot"])
|
| 281 |
+
print(f" moonshot model resolved: {models['moonshot']}")
|
| 282 |
+
|
| 283 |
+
RAW_DIR.mkdir(exist_ok=True)
|
| 284 |
+
(RAW_DIR / ".gitignore").write_text("*\n") # belt: never enters any git repo
|
| 285 |
+
|
| 286 |
+
new_rows = []
|
| 287 |
+
for pid, prov in plan:
|
| 288 |
+
probe = probes[pid]
|
| 289 |
+
model = models[prov]
|
| 290 |
+
arms = {}
|
| 291 |
+
reported_model = model
|
| 292 |
+
failed = False
|
| 293 |
+
for arm_name, prompt_field in (("arm_A", "prompt_en"), ("arm_B", "prompt_ig")):
|
| 294 |
+
prompt = probe[prompt_field]
|
| 295 |
+
try:
|
| 296 |
+
text, reported_model, raw = call_provider(prov, keys[prov], model, prompt)
|
| 297 |
+
except Exception as e:
|
| 298 |
+
print(f" FAIL {pid} x {prov} {arm_name}: {type(e).__name__}: {e}")
|
| 299 |
+
failed = True
|
| 300 |
+
break
|
| 301 |
+
raw_path = RAW_DIR / f"{today}_{prov}_{pid}_{arm_name}.json"
|
| 302 |
+
raw_path.write_text(
|
| 303 |
+
json.dumps(
|
| 304 |
+
{
|
| 305 |
+
"date_utc": datetime.now(timezone.utc).isoformat(),
|
| 306 |
+
"provider": prov,
|
| 307 |
+
"requested_model": model,
|
| 308 |
+
"reported_model": reported_model,
|
| 309 |
+
"probe_id": pid,
|
| 310 |
+
"arm": arm_name,
|
| 311 |
+
"prompt": prompt,
|
| 312 |
+
"response_text": text,
|
| 313 |
+
"raw_api_response": raw,
|
| 314 |
+
},
|
| 315 |
+
ensure_ascii=False,
|
| 316 |
+
indent=2,
|
| 317 |
+
),
|
| 318 |
+
encoding="utf-8",
|
| 319 |
+
)
|
| 320 |
+
arms[arm_name] = {
|
| 321 |
+
"output_language": detect_output_language(text),
|
| 322 |
+
"epistemic_frame": "pending_human_score",
|
| 323 |
+
"anchor_source": "pending_human_score",
|
| 324 |
+
"notes": factual_notes(text, raw_path),
|
| 325 |
+
}
|
| 326 |
+
print(f" ok {pid} x {prov} {arm_name}: {arms[arm_name]['output_language']}")
|
| 327 |
+
if failed:
|
| 328 |
+
continue
|
| 329 |
+
|
| 330 |
+
new_rows.append(
|
| 331 |
+
{
|
| 332 |
+
"run_id": f"run-{today}-api-{prov}-{pid}",
|
| 333 |
+
"date": today,
|
| 334 |
+
"model": reported_model,
|
| 335 |
+
"interface": "API",
|
| 336 |
+
"probe_id": pid,
|
| 337 |
+
"arm_A": arms["arm_A"],
|
| 338 |
+
"arm_B": arms["arm_B"],
|
| 339 |
+
"register_delta": "pending_human_score",
|
| 340 |
+
"reading": "pending_human_score",
|
| 341 |
+
"cultural_correctness": "pending_native_review",
|
| 342 |
+
"evidence": f"runs_api_raw/{today}_{prov}_{pid}_*.json (local archive, not uploaded)",
|
| 343 |
+
}
|
| 344 |
+
)
|
| 345 |
+
|
| 346 |
+
if new_rows:
|
| 347 |
+
with open(RUNS, "a", encoding="utf-8") as f:
|
| 348 |
+
for row in new_rows:
|
| 349 |
+
f.write(json.dumps(row, ensure_ascii=False) + "\n")
|
| 350 |
+
print(f"\nAppended {len(new_rows)} rows to {RUNS.name} "
|
| 351 |
+
f"({len(plan) - len(new_rows)} pair(s) failed).")
|
| 352 |
+
return 0 if len(new_rows) == len(plan) else 2
|
| 353 |
+
|
| 354 |
+
|
| 355 |
+
if __name__ == "__main__":
|
| 356 |
+
sys.exit(main())
|