--- license: cc-by-4.0 task_categories: - question-answering - text-generation language: - en - zh - fr - es - de - ru size_categories: - 10K outputs/evaluation/.jsonl scoring_full.py five-label scorer (correct/incorrect/ambiguous/abstain/unparseable) test_scoring.py 31 unit tests for the scorer common.py metrics/ extract_hidden.py query-end residual states -> outputs/hidden// iss.py Internal State Stability kts.py Knowledge Topology Stability (KTS-Geo + KTS-ID) judge_run.py semantic clustering of answers (needs a judge model) bcs_bes.py BCS / BES / behaviour classification joint.py internal x external correlation make_table.py main table jlens.py states.py mcommon.py OUTPUT_SCHEMA.md what your model must emit to be scorable ``` **Not included:** the upstream corpora, the dataset build scripts, and the hidden-state tensors (1.6–15 GB per model, regenerate with `extract_hidden.py`). --- ## Condition families | family | queries | facts | role | |---|---:|---:|---| | anchor | 2,592 | 2,592 | unperturbed baseline (1 per fact) | | paraphrase | 10,053 | 2,592 | main | | format | 7,776 | 2,592 | main | | context | 6,829 | 2,591 | main | | multilingual | 12,010 | 2,402 | main (zh/fr/es/de/ru) | | reverse | 634 | 253 | subject slot; reported separately | | recognition | 3,412 | 2,585 | diagnostic | | reverse_illposed | 1,110 | 1,110 | diagnostic | Coverage is ragged on purpose — multilingual covers 2,402 facts, context 2,591 — so both readings are mandatory (`coverage_modes` in `configs/metrics.yaml`): `complete_family` (facts carrying all five) and `full_set` (each fact averaged over the families it actually has). --- ## Evaluating your own model Everything below is CPU-only except `eval_run.py`, `extract_hidden.py` and `judge_run.py`. ```bash pip install -r requirements.txt # optional: keep large outputs off the checkout export FKS_OUTPUTS=/path/to/large/disk/fks_work # 1. generate (44,416 queries) python runner/eval_run.py --model my-model --model-path org/my-model # 2. score to five labels -> outputs/evaluation/my-model.scored.jsonl python runner/scoring_full.py --gen outputs/evaluation/my-model.jsonl # 3. your own metrics on top of the labels, or the ones shipped here: python metrics/judge_run.py --model my-model # semantic clustering [GPU] python metrics/bcs_bes.py --model my-model # BCS / BES / behaviour python metrics/extract_hidden.py --model my-model # residual states [GPU] python metrics/iss.py --model my-model --transport raw --device cpu python metrics/kts.py --model my-model --transport raw --device cpu ``` A model not listed in `configs/models.yaml` needs either an entry there or `--model-path`; `metrics/*.py` read `n_layers`/`d_model` from that file, so add an entry before running the internal metrics. ### The decoding protocol is part of the benchmark Numbers are not comparable unless generation matches `configs/models.yaml:generation` exactly: ```yaml do_sample: false # greedy num_beams: 1 temperature: 0.0 max_new_tokens: 24 max_prompt_len: 192 # effective value; the 96 in models.yaml is raised by eval_run.py dtype: bfloat16 use_chat_template: false # <-- base and instruct get the IDENTICAL raw string seed: 20260101 ``` `use_chat_template: false` is not an oversight. Four of the twenty models are instruction-tuned; applying a chat template to only those would confound post-training with prompt format. The prompt itself is built by `runner/eval_run.py:build_prompt` — anchor gets the instruction wrapper, perturbed queries carry their own surface form (that *is* the perturbation) and receive only a bare `Answer:` cue. `extract_hidden.py` imports that same function rather than re-deriving it, so ISS and BCS are always measured on the identical prompt. ### Share the scorer, not just the data `runner/scoring_full.py` is shipped so that label boundaries — negation handling, year granularity, alias matching — are identical across submissions. Re-implementing the five-label extractor makes numbers incomparable in ways that are very hard to see. Run `python runner/test_scoring.py` (31 tests) to confirm it behaves the same on your machine. --- ## Metrics **External** (from `runner/` + `metrics/judge_run.py` + `metrics/bcs_bes.py`): - **BCS** — family-balanced maximum probability over answer clusters. Graded, and note it has a high floor: a model choosing at random between two answers scores ≈0.61, not 0.5. - **BES** — entropy-based, `1 - H(p)/log A`. Chance floor ≈0.06. - **Behaviour classes** — Stable Correct / Stable Wrong / Stable Abstention / Unstable, at a pre-registered `tau_b = 0.8` with 0.7/0.9 sensitivity reported. **Internal** (from `metrics/extract_hidden.py` + `iss.py` + `kts.py`): - **ISS** — same-fact cross-condition similarity, corrected against same-relation background: `(S⁺ − S⁻)/(1 − S⁻)`. 0 means "no better than background". - **KTS-Geo** — Spearman between within-relation pairwise distance matrices under two conditions; invariant to rotation, translation and isotropic scaling. Reported as `(ρ+1)/2` in the summary files, so **its floor is 0.5** — use the `kts_geo_raw_spearman` field for anything scale-sensitive. - **KTS-ID** — chance-corrected cross-condition nearest-neighbour retrieval of the fact itself among same-relation facts. Layer window: `{l : l/(L−1) ≥ 0.4}` (protocol §7.10). Layer `l` is the *output* of decoder block `l`, i.e. `hidden_states[l+1]` in HuggingFace indexing. The `jlens_window` integers in `models.yaml` are a redundant assertion checked at extraction time, not the definition. `metrics/judge_run.py` clusters answers with an instruction-tuned judge (default `Qwen/Qwen2.5-32B-Instruct`, ~65 GB). It shares pretraining lineage with the four Qwen models in the evaluated set and may favour their phrasing; `configs/models.yaml:auxiliary_models.judge.known_bias` records the mitigation. The judge is never itself evaluated. --- ## Data schema `benchmark_facts_2592.jsonl` | field | type | notes | |---|---|---| | `fact_id` | str | `fact_000602` | | `subject`, `object` | obj | `canonical`, `entity_id` (Wikidata Q-id), `aliases[]` | | `relation` | obj | `relation_id`, `source_relations[]`, `direction` | | `qualification_question` | str | canonical question; identical to the anchor query | | `sources`, `source_records` | list | provenance | | `is_functional` | bool | single-valued; true for all benchmark facts | | `answer_type`, `answer_granularity` | str | drives the scorer's year/entity handling | | `answer_in_subject_surface` | bool | **750 true** — see caveat 2 | | `spec_6_2_flag` | bool | 846 true (`developer of` / `manufacturer of`) | `evaluation_queries_44416.jsonl` | field | type | notes | |---|---|---| | `query_id`, `fact_id`, `relation` | str | | | `condition_family`, `variant_id`, `language` | str | | | `query` | str | the surface form actually shown to the model | | `target_slot` | str | `object`, or `subject` for reverse | | `gold_canonical`, `gold_aliases[]` | str/list | what the scorer accepts | | `is_assisted`, `is_well_posed` | bool | | | `use_for_main_forward` / `_reverse_analysis` / `_recognition_analysis` | bool | see caveat 3 | | `answer_in_subject_surface` | bool | inherited from the fact | --- ## Known deviations Recorded in full in `protocol/reconstruction_differences.md`: - **D1** — two `context` queries whose distractor literally contained the gold string were removed by a rule-based guard: 44,418 → **44,416**. The spec counts in `configs/eval_conditions.yaml` still read 44,418 and are reconciled in that file's `accepted_deviations` block. - **C1** — `developer of` / `manufacturer of` (846 facts) are flagged rather than dropped; `relations.yaml:drop_spec_6_2_flagged` produces the compliant 1,746-fact / 19-relation variant. - **F1** — the 28.9% copy-answerable subset (caveat 2). - **F2** — 808 exactly duplicated triples among the 8,107 candidates, absorbed during entity-aware grouping. - **N2** — `capital_of` direction is not normalised; annotated explicitly with `direction: inverse` + `inverse_of: capital`. ## Licence and attribution Released under **CC BY 4.0**, inheriting the terms of its sources. Facts derive from **CounterFact** (MIT), **LAMA / T-REx** (CC BY 4.0), **LAMA / Google-RE**, **LAMA / ConceptNet**, and **PopQA** (MIT); entity ids and aliases come from **Wikidata** (CC0). Please cite the original datasets alongside this one.