|
Download dataset_upload/README.md from LucasLoading/stable: direct link, hf CLI and curl.
- Browser
- Download file 12.5 kB
-
https://huggingface.co/datasets/LucasLoading/stable/resolve/main/dataset_upload/README.md
- Command line
-
hf download hf://datasets/LucasLoading/stable/dataset_upload/README.md
-
curl -L -o README.md https://huggingface.co/datasets/LucasLoading/stable/resolve/main/dataset_upload/README.md
12.5 kB
| license: cc-by-4.0 | |
| task_categories: | |
| - question-answering | |
| - text-generation | |
| language: | |
| - en | |
| - zh | |
| - fr | |
| - es | |
| - de | |
| - ru | |
| size_categories: | |
| - 10K<n<100K | |
| pretty_name: Fact Knowledge Stability Benchmark | |
| tags: | |
| - factual-knowledge | |
| - robustness | |
| - consistency | |
| - interpretability | |
| - multilingual | |
| configs: | |
| - config_name: queries | |
| default: true | |
| data_files: data/evaluation_queries_44416.jsonl | |
| - config_name: facts | |
| data_files: data/benchmark_facts_2592.jsonl | |
| # Fact Knowledge Stability Benchmark | |
| **2,592 facts Γ 44,416 queries.** Does a model that knows a fact still know it | |
| when you rephrase the question, change the answer format, add distracting | |
| context, or ask in another language? | |
| The benchmark pairs **behavioural** stability (what the model *says* across | |
| perturbations) with **internal** stability (what its residual stream *does* | |
| across the same perturbations), so the two can be compared on identical inputs. | |
| ```python | |
| from datasets import load_dataset | |
| queries = load_dataset("LucasLoading/stable", "queries", split="train") | |
| facts = load_dataset("LucasLoading/stable", "facts", split="train") | |
| ``` | |
| --- | |
| ## Read this before you report a number | |
| Four properties of this benchmark will silently distort results if you do not | |
| account for them. They are design decisions, not defects, and each is flagged | |
| per-row in the data. | |
| **1. The facts were selected to be easy.** Candidates were kept only if **all | |
| five** filter models (Gemma-2-2B-it, Qwen2.5-7B, Mistral-7B-v0.3, Llama-3.1-8B, | |
| Gemma-2-9B-it) produced the correct first token. That is **10,601 of 1,783,541 | |
| cloze prompts β 0.59%**. This is deliberate: to attribute instability to | |
| *expression* rather than to *ignorance*, the model has to know the fact in the | |
| first place. The consequence is that absolute stability scores run high, and | |
| that the four filter models present in a comparison enjoy a selection advantage | |
| over models that had no say in what was kept. | |
| **2. 750 of 2,592 facts (28.9%) are answerable by copying the subject string.** | |
| `Airbus A318 β manufacturer β Airbus`. Every fact and every query carries | |
| `answer_in_subject_surface`; report those two subsets separately. | |
| **3. Only four of the eight condition families belong in the main average.** | |
| Use each row's own boolean, never a hard-coded family list: | |
| | flag | rows | meaning | | |
| |---|---:|---| | |
| | `use_for_main_forward` | 39,260 | anchor + paraphrase + format + context + multilingual | | |
| | `use_for_reverse_analysis` | 634 | target slot is the **subject**; report separately | | |
| | `use_for_recognition_analysis` | 3,412 | diagnostic only | | |
| | *(none of the above)* | 1,110 | `reverse_illposed`; diagnostic only | | |
| **4. `anchor` is the unperturbed baseline, and it holds exactly one query per | |
| fact.** Its within-family agreement is therefore 1.0 by construction. Including | |
| it as a fifth equally-weighted family puts a floor under any family-balanced | |
| consistency score. `configs/metrics.yaml:main_families` controls this; drop | |
| `anchor` from that list to score the four perturbation families only. | |
| --- | |
| ## Contents | |
| ``` | |
| data/ | |
| benchmark_facts_2592.jsonl 2,592 facts / 21 relations | |
| evaluation_queries_44416.jsonl 44,416 queries / 8 condition families / 6 languages | |
| configs/ | |
| metrics.yaml metric hyper-parameters β layer window, whitening, tau_b, bootstrap | |
| models.yaml the 20 evaluated models + decoding config + judge | |
| relations.yaml 21 relations, with the two optional exclusion switches | |
| eval_conditions.yaml condition registry the three booleans are derived from | |
| protocol/ | |
| evaluation_protocol.md BCS/BES (Β§4-6), ISS (Β§7), KTS (Β§8-11) [Chinese] | |
| jlens_spec.md Jacobian-transported ISS [Chinese] | |
| dataset_construction.md how the benchmark was built (archival) [Chinese] | |
| reconstruction_differences.md documented deviations D1, C1, F1, F2, N1, N2 | |
| runner/ | |
| eval_run.py generation -> outputs/evaluation/<model>.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/<model>/ | |
| 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. | |