Download scripts/card.py from Cross-Mergeability/model-merging-benchmark: direct link, hf CLI and curl.
- Browser
- Download file 5.87 kB
-
https://huggingface.co/datasets/Cross-Mergeability/model-merging-benchmark/resolve/main/scripts/card.py
- Command line
-
hf download hf://datasets/Cross-Mergeability/model-merging-benchmark/scripts/card.py
-
curl -L -o card.py https://huggingface.co/datasets/Cross-Mergeability/model-merging-benchmark/resolve/main/scripts/card.py
5.87 kB
| """Render the Hugging Face dataset card (README.md) from the built tables. Never edited by hand.""" | |
| import pandas as pd | |
| YAML = """--- | |
| license: cc-by-4.0 | |
| pretty_name: Model Merging & Capability Transfer Dataset | |
| tags: [model-merging, permutation-alignment, mergeability, language-models, negative-results] | |
| configs: | |
| - config_name: merged_models | |
| data_files: data/merged_models.parquet | |
| default: true | |
| - config_name: merges | |
| data_files: data/merges.parquet | |
| - config_name: evaluations | |
| data_files: data/evaluations.parquet | |
| - config_name: models | |
| data_files: data/models.parquet | |
| - config_name: summary | |
| data_files: data/summary.parquet | |
| --- | |
| """ | |
| def _tbl(df): | |
| cols = list(df.columns) | |
| out = ["| " + " | ".join(map(str, cols)) + " |", "|" + "---|" * len(cols)] | |
| for _, r in df.iterrows(): | |
| out.append("| " + " | ".join("" if pd.isna(v) else str(v) for v in r) + " |") | |
| return "\n".join(out) | |
| def render(merges, evals, models, flat, cov) -> str: | |
| fam = merges.groupby("experiment_family").agg( | |
| merges=("merge_id", "size"), | |
| methods=("merge_method", lambda s: ", ".join(sorted(set(s)))), | |
| unverified=("evaluation_status", lambda s: int((s != "complete").sum()))).reset_index() | |
| ev = flat[flat["result_status"] == "evaluated"] | |
| succ = ev.groupby("model_family").agg( | |
| comparisons=("merge_success", "size"), | |
| beats_best_parent=("merge_success", lambda s: int((s.astype(str) == "True").sum()))).reset_index() | |
| status = flat["result_status"].value_counts().rename_axis("result_status").reset_index(name="rows") | |
| return YAML + f""" | |
| # Model Merging & Capability Transfer Dataset | |
| A dataset of **merge experiments**, not just checkpoints. Every row says which two models were merged, how, under which alignment and configuration, and how the result scored on downstream tasks **next to both parents and the naive merge, measured under the same protocol**. Negative results, controls, unverified and incomplete runs are included, and their status is explicit. | |
| It contains {cov['merges']:,} merge experiments, {cov['evaluations']:,} evaluations of {len(models):,} checkpoints, and {len(flat):,} rows in the flat `merged_models` table. | |
| ## Configurations | |
| `merged_models` is the default configuration: one long-format row per pair × method × alignment × benchmark × task × metric, carrying parent, naive and merged scores and the derived merge loss, gain and success. `merges`, `evaluations` and `models` are the linked tables it is built from. `summary` holds the derived statistics. | |
| ```python | |
| from datasets import load_dataset | |
| flat = load_dataset("Cross-Mergeability/model-merging-benchmark", "merged_models")["train"] | |
| evals = load_dataset("Cross-Mergeability/model-merging-benchmark", "evaluations")["train"] | |
| ``` | |
| ## Experiment families | |
| {_tbl(fam)} | |
| ## How often a merge beats its better parent | |
| These counts are for comparisons where both parents and the merge were scored in the same experiment: | |
| {_tbl(succ)} | |
| ## Metrics | |
| All losses are signed so that **positive means worse than the better parent**: | |
| - **Merge loss.** For NLL, `merged − min(A, B)`. For accuracy, `max(A, B) − merged`. | |
| - **Merge gain.** `naive_merge_loss − method_merge_loss`. Positive means the method improved on plain averaging. It does **not** mean the result is useful. | |
| - **Merge success.** The merge strictly beats the better parent on that metric. | |
| - **Alignment gain.** Loss of the unaligned twin (same pair, method and configuration) minus loss of the aligned merge. | |
| NLL and accuracy are never mixed in one row. A parent is used as a baseline only when it was scored in the same `experiment_id`. | |
| ## Row status (`result_status`) | |
| {_tbl(status)} | |
| - **`evaluated`:** the merge and both parents were scored under one protocol. | |
| - **`parent_baseline_missing`:** the merge was scored but a parent was not, in that experiment. This happens, for example, for PolyPythia per-paradigm BLiMP, where only the parents' aggregate BLiMP was recorded, and for Beetle published NLL, where only the better-parent NLL was recorded. | |
| - **`naive_baseline_missing`:** there is no plain-average twin in the same experiment. | |
| - **`naive_baseline_not_applicable`:** the method has no plain-average twin by design (chat-vector transfer, OT fusion). | |
| - **`unverified`:** the source flags the value. | |
| Pair × method combinations that were never run have **no row**. | |
| ## Known limitations | |
| - **Copies a parent.** `copies_parent=True` marks rungs whose output is one parent's tensors, for example SVC/OPCM single-parent fills. They are not evidence of composition. | |
| - **Aligned equals naive.** In the published Beetle rungs, the aligned merges are byte-identical to the naive ones, because the aligner returned the identity; see `notes`. | |
| - **Calibration overlap.** | |
| - OT fusion is scored on sentences inside the set used to fit the transport plans, so it is `provisional`. | |
| - PolyPythia alignment is fitted on the same FLORES blocks it is scored on. | |
| - **Task arithmetic without a shared base.** Where the parents share no base, task arithmetic and TIES are parent interpolations, not conventional task vectors (see `merge_config`). | |
| - **MergeBench.** Rows are published scores, not re-evaluated, and the 5-expert merges have no `parent_a`/`parent_b`. | |
| - **Not recorded.** Parent checkpoint hashes, code commits, evaluation timestamps and most dataset revisions are absent from the historical result files and are left null. | |
| - **Wikitext-scored transport rungs.** The 56 Beetle transport rungs scored on wikitext are `unverified`. | |
| ## Provenance and reproduction | |
| Every row has a `source_file`, and `sources.json` lists every file each adapter read. Rebuild from the repository with `python -m merge_dataset.build_dataset`; the scripts are in `scripts/`. The tables are generated, never maintained by hand. | |
| ## Citation | |
| To be added by the authors. | |
| """ | |