Complete Qwen MKA CoMe MLP-only comparison and independent audits; instance retained
Browse filesThis view is limited to 50 files because it contains too many changes. See raw diff
- runs/vast-paper_revision-come-attn-fit-20261126-62646539/20261126-qwen3-base-mka-come-mlp-fit/catalog/README.md +5 -0
- runs/vast-paper_revision-come-attn-fit-20261126-62646539/20261126-qwen3-base-mka-come-mlp-fit/catalog/backup_audit.json +31 -0
- runs/vast-paper_revision-come-attn-fit-20261126-62646539/20261126-qwen3-base-mka-come-mlp-fit/catalog/code/abprune_compact.py +284 -0
- runs/vast-paper_revision-come-attn-fit-20261126-62646539/20261126-qwen3-base-mka-come-mlp-fit/catalog/code/bootstrap_llama31_come_fit2.sh +52 -0
- runs/vast-paper_revision-come-attn-fit-20261126-62646539/20261126-qwen3-base-mka-come-mlp-fit/catalog/code/collect_qwen_mlp_fit_comparison.py +68 -0
- runs/vast-paper_revision-come-attn-fit-20261126-62646539/20261126-qwen3-base-mka-come-mlp-fit/catalog/code/come.py +612 -0
- runs/vast-paper_revision-come-attn-fit-20261126-62646539/20261126-qwen3-base-mka-come-mlp-fit/catalog/code/eval_llama31_8b_12bench.py +194 -0
- runs/vast-paper_revision-come-attn-fit-20261126-62646539/20261126-qwen3-base-mka-come-mlp-fit/catalog/code/eval_llama31_fit_ablation_one.sh +63 -0
- runs/vast-paper_revision-come-attn-fit-20261126-62646539/20261126-qwen3-base-mka-come-mlp-fit/catalog/code/evaluate_abprune_compact_ppl.py +187 -0
- runs/vast-paper_revision-come-attn-fit-20261126-62646539/20261126-qwen3-base-mka-come-mlp-fit/catalog/code/evaluate_hchc_wikitext2_ppl.py +152 -0
- runs/vast-paper_revision-come-attn-fit-20261126-62646539/20261126-qwen3-base-mka-come-mlp-fit/catalog/code/finalize_qwen_mlp_fit_comparison.py +222 -0
- runs/vast-paper_revision-come-attn-fit-20261126-62646539/20261126-qwen3-base-mka-come-mlp-fit/catalog/code/fit_ablation_come.py +54 -0
- runs/vast-paper_revision-come-attn-fit-20261126-62646539/20261126-qwen3-base-mka-come-mlp-fit/catalog/code/fit_ablation_mka.py +482 -0
- runs/vast-paper_revision-come-attn-fit-20261126-62646539/20261126-qwen3-base-mka-come-mlp-fit/catalog/code/fuse_layers.py +0 -0
- runs/vast-paper_revision-come-attn-fit-20261126-62646539/20261126-qwen3-base-mka-come-mlp-fit/catalog/code/fuse_layers_distill.py +0 -0
- runs/vast-paper_revision-come-attn-fit-20261126-62646539/20261126-qwen3-base-mka-come-mlp-fit/catalog/code/inspect_qwen_mlp_fit_run.py +50 -0
- runs/vast-paper_revision-come-attn-fit-20261126-62646539/20261126-qwen3-base-mka-come-mlp-fit/catalog/code/launch_llama31_come_fit2.sh +123 -0
- runs/vast-paper_revision-come-attn-fit-20261126-62646539/20261126-qwen3-base-mka-come-mlp-fit/catalog/code/launch_qwen_mlp_fit_comparison.py +281 -0
- runs/vast-paper_revision-come-attn-fit-20261126-62646539/20261126-qwen3-base-mka-come-mlp-fit/catalog/code/monitor_qwen_mlp_fit_local.ps1 +24 -0
- runs/vast-paper_revision-come-attn-fit-20261126-62646539/20261126-qwen3-base-mka-come-mlp-fit/catalog/code/offline_eval_policy.py +26 -0
- runs/vast-paper_revision-come-attn-fit-20261126-62646539/20261126-qwen3-base-mka-come-mlp-fit/catalog/code/package_final_fit_backup.py +60 -0
- runs/vast-paper_revision-come-attn-fit-20261126-62646539/20261126-qwen3-base-mka-come-mlp-fit/catalog/code/prepare_lmeval9_local_cache.py +108 -0
- runs/vast-paper_revision-come-attn-fit-20261126-62646539/20261126-qwen3-base-mka-come-mlp-fit/catalog/code/prepare_offline_ppl_cache.py +30 -0
- runs/vast-paper_revision-come-attn-fit-20261126-62646539/20261126-qwen3-base-mka-come-mlp-fit/catalog/code/prepare_qwen_mlp_fit_calibrations.py +98 -0
- runs/vast-paper_revision-come-attn-fit-20261126-62646539/20261126-qwen3-base-mka-come-mlp-fit/catalog/code/project_commit.txt +1 -0
- runs/vast-paper_revision-come-attn-fit-20261126-62646539/20261126-qwen3-base-mka-come-mlp-fit/catalog/code/run_external_abprune_instruct_order.py +140 -0
- runs/vast-paper_revision-come-attn-fit-20261126-62646539/20261126-qwen3-base-mka-come-mlp-fit/catalog/code/run_llama31_base_fit_ablation.py +926 -0
- runs/vast-paper_revision-come-attn-fit-20261126-62646539/20261126-qwen3-base-mka-come-mlp-fit/catalog/code/run_llama31_come_fit_arm.sh +37 -0
- runs/vast-paper_revision-come-attn-fit-20261126-62646539/20261126-qwen3-base-mka-come-mlp-fit/catalog/code/run_qwen_mlp_fit_arm.sh +37 -0
- runs/vast-paper_revision-come-attn-fit-20261126-62646539/20261126-qwen3-base-mka-come-mlp-fit/catalog/code/source_feature_transport.py +342 -0
- runs/vast-paper_revision-come-attn-fit-20261126-62646539/20261126-qwen3-base-mka-come-mlp-fit/catalog/code/verify_public_experiment_backups.py +105 -0
- runs/vast-paper_revision-come-attn-fit-20261126-62646539/20261126-qwen3-base-mka-come-mlp-fit/catalog/comparison.csv +7 -0
- runs/vast-paper_revision-come-attn-fit-20261126-62646539/20261126-qwen3-base-mka-come-mlp-fit/catalog/comparison.json +498 -0
- runs/vast-paper_revision-come-attn-fit-20261126-62646539/20261126-qwen3-base-mka-come-mlp-fit/catalog/manifest.json +447 -0
- runs/vast-paper_revision-come-attn-fit-20261126-62646539/20261126-qwen3-base-mka-come-mlp-fit/catalog/project_commit.txt +1 -0
- runs/vast-paper_revision-come-attn-fit-20261126-62646539/20261126-qwen3-base-mka-come-mlp-fit/catalog/report_ko.md +174 -0
- runs/vast-paper_revision-come-attn-fit-20261126-62646539/20261126-qwen3-base-mka-come-mlp-fit/catalog/results/backup_audit.json +31 -0
- runs/vast-paper_revision-come-attn-fit-20261126-62646539/20261126-qwen3-base-mka-come-mlp-fit/catalog/results/come/audit/cycle_01_fit.json +308 -0
- runs/vast-paper_revision-come-attn-fit-20261126-62646539/20261126-qwen3-base-mka-come-mlp-fit/catalog/results/come/audit/cycle_02_fit.json +308 -0
- runs/vast-paper_revision-come-attn-fit-20261126-62646539/20261126-qwen3-base-mka-come-mlp-fit/catalog/results/come/audit/cycle_03_fit.json +308 -0
- runs/vast-paper_revision-come-attn-fit-20261126-62646539/20261126-qwen3-base-mka-come-mlp-fit/catalog/results/come/audit/cycle_04_fit.json +309 -0
- runs/vast-paper_revision-come-attn-fit-20261126-62646539/20261126-qwen3-base-mka-come-mlp-fit/catalog/results/come/audit/cycle_05_fit.json +308 -0
- runs/vast-paper_revision-come-attn-fit-20261126-62646539/20261126-qwen3-base-mka-come-mlp-fit/catalog/results/come/audit/cycle_06_fit.json +309 -0
- runs/vast-paper_revision-come-attn-fit-20261126-62646539/20261126-qwen3-base-mka-come-mlp-fit/catalog/results/come/audit/cycle_07_fit.json +308 -0
- runs/vast-paper_revision-come-attn-fit-20261126-62646539/20261126-qwen3-base-mka-come-mlp-fit/catalog/results/come/audit/cycle_08_fit.json +309 -0
- runs/vast-paper_revision-come-attn-fit-20261126-62646539/20261126-qwen3-base-mka-come-mlp-fit/catalog/results/come/audit/cycle_09_fit.json +308 -0
- runs/vast-paper_revision-come-attn-fit-20261126-62646539/20261126-qwen3-base-mka-come-mlp-fit/catalog/results/come/audit/data_fingerprints.json +14 -0
- runs/vast-paper_revision-come-attn-fit-20261126-62646539/20261126-qwen3-base-mka-come-mlp-fit/catalog/results/come/audit/selection.json +662 -0
- runs/vast-paper_revision-come-attn-fit-20261126-62646539/20261126-qwen3-base-mka-come-mlp-fit/catalog/results/come/audit/selection_inputs.json +6 -0
- runs/vast-paper_revision-come-attn-fit-20261126-62646539/20261126-qwen3-base-mka-come-mlp-fit/catalog/results/come/compact_metadata.json +110 -0
runs/vast-paper_revision-come-attn-fit-20261126-62646539/20261126-qwen3-base-mka-come-mlp-fit/catalog/README.md
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Qwen3-8B Base25%(9/36removed), native MKA/CoMe with MLP-only FiT, bothbatch1.
|
| 2 |
+
|
| 3 |
+
Bench12 excludes MMLU/CMMLU; allthree are reported separately. Native no-FiT references and historical ABPrune controls retain their provenance. Same512x1024FiT IDs/masks/LR/loss/epoch/batch1,3trainable MLP projections,8frozen attention/normweights includingQK. OriginalMKA100x512cache restored; CoMe94x2048legacyrecipe and firststage exactly matched, not a historical immutable-token/full9stage replay claim.
|
| 4 |
+
|
| 5 |
+
Raw evaluations,18stageaudits,source,receipts and independent137model-fileverification included. Final reconstructible weights are at separate immutable prefixes in summary.json, not duplicated here. No raw token caches or private pooled features. Five-minute progress snapshots preserved. Instance62646539 explicitly retained running and idle; completion does not authorize return.
|
runs/vast-paper_revision-come-attn-fit-20261126-62646539/20261126-qwen3-base-mka-come-mlp-fit/catalog/backup_audit.json
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"verified": true,
|
| 3 |
+
"records": [
|
| 4 |
+
{
|
| 5 |
+
"verified": true,
|
| 6 |
+
"repo_id": "LJYAI/paper_revision",
|
| 7 |
+
"path_in_repo": "runs/vast-paper_revision-come-attn-fit-20261126-62646539/20261126-qwen3-base-mka-come-mlp-fit/mka",
|
| 8 |
+
"revision": "7a479c20426d817bb0cb7157c7b5a790b76267f3",
|
| 9 |
+
"files": 68,
|
| 10 |
+
"bytes": 1931474221,
|
| 11 |
+
"manifest_sha256": "0c3ce4c30e1cdbb272d6d98e225fe61cfc547371c1e0a649f3ab042683f468e8",
|
| 12 |
+
"all_payload_hashes_verified": true,
|
| 13 |
+
"lfs_files": 5,
|
| 14 |
+
"git_blob_files_read_back": 63,
|
| 15 |
+
"verification": "Immutable inventory/sizes, server LFS SHA256, independently downloaded Git blobs"
|
| 16 |
+
},
|
| 17 |
+
{
|
| 18 |
+
"verified": true,
|
| 19 |
+
"repo_id": "LJYAI/paper_revision",
|
| 20 |
+
"path_in_repo": "runs/vast-paper_revision-come-attn-fit-20261126-62646539/20261126-qwen3-base-mka-come-mlp-fit/come",
|
| 21 |
+
"revision": "43e28d03f09794f7caac7eb99db3a6ac3ff020f4",
|
| 22 |
+
"files": 69,
|
| 23 |
+
"bytes": 2317161299,
|
| 24 |
+
"manifest_sha256": "d04c75128b2fb4e58fad0cda085b408facc54183bfc538a76e3c3a399b8d5de5",
|
| 25 |
+
"all_payload_hashes_verified": true,
|
| 26 |
+
"lfs_files": 6,
|
| 27 |
+
"git_blob_files_read_back": 63,
|
| 28 |
+
"verification": "Immutable inventory/sizes, server LFS SHA256, independently downloaded Git blobs"
|
| 29 |
+
}
|
| 30 |
+
]
|
| 31 |
+
}
|
runs/vast-paper_revision-come-attn-fit-20261126-62646539/20261126-qwen3-base-mka-come-mlp-fit/catalog/code/abprune_compact.py
ADDED
|
@@ -0,0 +1,284 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""Package and reconstruct compact ABPrune stage checkpoints.
|
| 2 |
+
|
| 3 |
+
ABPrune already writes ``fused_layer.pt`` for every cycle. This utility makes
|
| 4 |
+
those files portable by pairing them with an explicit, immutable stage record;
|
| 5 |
+
the dense base model plus that record is sufficient to reconstruct a student.
|
| 6 |
+
"""
|
| 7 |
+
from __future__ import annotations
|
| 8 |
+
|
| 9 |
+
import argparse, hashlib, json, shutil
|
| 10 |
+
from pathlib import Path
|
| 11 |
+
from typing import Any
|
| 12 |
+
|
| 13 |
+
import torch
|
| 14 |
+
|
| 15 |
+
|
| 16 |
+
def copy_stage_state(src: Path, dst: Path, *, hard_link: bool = False) -> None:
|
| 17 |
+
"""Optionally share immutable stage bytes within one experiment filesystem."""
|
| 18 |
+
if not hard_link:
|
| 19 |
+
shutil.copy2(src, dst)
|
| 20 |
+
elif dst.exists():
|
| 21 |
+
if not src.samefile(dst):
|
| 22 |
+
raise FileExistsError(f"Refusing to replace existing non-linked stage: {dst}")
|
| 23 |
+
else:
|
| 24 |
+
# Fail instead of silently consuming space if cross-device linking is
|
| 25 |
+
# unavailable. The caller explicitly selected the storage strategy.
|
| 26 |
+
dst.hardlink_to(src)
|
| 27 |
+
|
| 28 |
+
|
| 29 |
+
def sha256(path: Path) -> str:
|
| 30 |
+
h = hashlib.sha256()
|
| 31 |
+
with path.open("rb") as f:
|
| 32 |
+
for chunk in iter(lambda: f.read(8 * 1024 * 1024), b""):
|
| 33 |
+
h.update(chunk)
|
| 34 |
+
return h.hexdigest()
|
| 35 |
+
|
| 36 |
+
|
| 37 |
+
def post_merge_scale(source_cycle: Path) -> dict | None:
|
| 38 |
+
"""Return the deployable post-merge scale stored for a cycle, if present."""
|
| 39 |
+
metadata_path = source_cycle / "cycle_metadata.json"
|
| 40 |
+
if not metadata_path.is_file():
|
| 41 |
+
return None
|
| 42 |
+
metadata = json.loads(metadata_path.read_text(encoding="utf-8"))
|
| 43 |
+
distill = metadata.get("distill", {})
|
| 44 |
+
scale = distill.get("post_merge_nll_scale") or {}
|
| 45 |
+
source = "post_merge_nll"
|
| 46 |
+
if not scale.get("enabled"):
|
| 47 |
+
scale = (distill.get("reparam_stats") or {}).get("residual_scale") or {}
|
| 48 |
+
source = "scale_aware_fit"
|
| 49 |
+
if not scale.get("enabled"):
|
| 50 |
+
return None
|
| 51 |
+
gamma = scale["gamma"]
|
| 52 |
+
cumulative_gamma = scale["cumulative_gamma"]
|
| 53 |
+
if not isinstance(gamma, list):
|
| 54 |
+
gamma = float(gamma)
|
| 55 |
+
else:
|
| 56 |
+
gamma = [float(value) for value in gamma]
|
| 57 |
+
if not isinstance(cumulative_gamma, list):
|
| 58 |
+
cumulative_gamma = float(cumulative_gamma)
|
| 59 |
+
else:
|
| 60 |
+
cumulative_gamma = [float(value) for value in cumulative_gamma]
|
| 61 |
+
result = {
|
| 62 |
+
"enabled": True,
|
| 63 |
+
"mode": scale.get("mode", "residual"),
|
| 64 |
+
"scale_parameterization": scale.get("scale_parameterization", "scalar"),
|
| 65 |
+
"gamma": gamma,
|
| 66 |
+
"cumulative_gamma": cumulative_gamma,
|
| 67 |
+
"source": source,
|
| 68 |
+
}
|
| 69 |
+
for field in (
|
| 70 |
+
"optimization_mode",
|
| 71 |
+
"gamma_gradient_sources",
|
| 72 |
+
"theta_gradient_sources",
|
| 73 |
+
"nll_used",
|
| 74 |
+
):
|
| 75 |
+
if field in scale:
|
| 76 |
+
result[field] = scale[field]
|
| 77 |
+
if "cumulative_gamma_statistics" in scale:
|
| 78 |
+
result["cumulative_gamma_statistics"] = scale["cumulative_gamma_statistics"]
|
| 79 |
+
if "raw" in scale and "ppl" in scale["raw"]:
|
| 80 |
+
result["calibration_raw_ppl"] = float(scale["raw"]["ppl"])
|
| 81 |
+
if "fitted" in scale and "ppl" in scale["fitted"]:
|
| 82 |
+
result["calibration_fitted_ppl"] = float(scale["fitted"]["ppl"])
|
| 83 |
+
return result
|
| 84 |
+
|
| 85 |
+
|
| 86 |
+
def read_compact_metadata(compact_stage: Path) -> dict[str, Any]:
|
| 87 |
+
return json.loads((compact_stage / "metadata.json").read_text(encoding="utf-8"))
|
| 88 |
+
|
| 89 |
+
|
| 90 |
+
def compact_scale_targets(metadata: dict[str, Any]) -> list[dict[str, Any]]:
|
| 91 |
+
"""Return residual scales and current student indices for a compact stage."""
|
| 92 |
+
if metadata.get("format") == "abprune_compact_stage_v2":
|
| 93 |
+
active = [int(value) for value in metadata["active_original_layers"]]
|
| 94 |
+
current_index = {original: index for index, original in enumerate(active)}
|
| 95 |
+
targets = []
|
| 96 |
+
for state in metadata.get("retained_layer_states", []):
|
| 97 |
+
scale = state.get("post_merge_scale") or {}
|
| 98 |
+
if scale.get("enabled") and scale.get("mode") == "residual":
|
| 99 |
+
original = int(state["original_layer"])
|
| 100 |
+
targets.append(
|
| 101 |
+
{
|
| 102 |
+
"original_layer": original,
|
| 103 |
+
"student_index": current_index[original],
|
| 104 |
+
"scale": scale,
|
| 105 |
+
}
|
| 106 |
+
)
|
| 107 |
+
return targets
|
| 108 |
+
|
| 109 |
+
scale = metadata.get("post_merge_scale") or {}
|
| 110 |
+
if scale.get("enabled") and scale.get("mode") == "residual":
|
| 111 |
+
return [
|
| 112 |
+
{
|
| 113 |
+
"original_layer": int(metadata["anchor_index"]),
|
| 114 |
+
"student_index": int(metadata["anchor_index"]),
|
| 115 |
+
"scale": scale,
|
| 116 |
+
}
|
| 117 |
+
]
|
| 118 |
+
return []
|
| 119 |
+
|
| 120 |
+
|
| 121 |
+
def _package_topology_aware(args, source: Path, out: Path, order: list[int]) -> None:
|
| 122 |
+
"""Package cycles whose recipients may switch between pair boundaries."""
|
| 123 |
+
if int(getattr(args, "start_cycle", 1)) != 1:
|
| 124 |
+
raise ValueError("topology-aware compact packaging must start at cycle 1")
|
| 125 |
+
|
| 126 |
+
removed: set[int] = set()
|
| 127 |
+
latest_states: dict[int, dict[str, Any]] = {}
|
| 128 |
+
stages: list[dict[str, Any]] = []
|
| 129 |
+
original_layer_count: int | None = None
|
| 130 |
+
|
| 131 |
+
for cycle in range(1, args.cycles + 1):
|
| 132 |
+
source_cycle = source / f"cycle_{cycle}"
|
| 133 |
+
src = source_cycle / "fused_layer.pt"
|
| 134 |
+
if not src.is_file():
|
| 135 |
+
raise FileNotFoundError(src)
|
| 136 |
+
cycle_metadata_path = source_cycle / "cycle_metadata.json"
|
| 137 |
+
if not cycle_metadata_path.is_file():
|
| 138 |
+
raise FileNotFoundError(cycle_metadata_path)
|
| 139 |
+
cycle_metadata = json.loads(cycle_metadata_path.read_text(encoding="utf-8"))
|
| 140 |
+
recipient = int(cycle_metadata["recipient_original_layer"])
|
| 141 |
+
removed_original = int(cycle_metadata["removed_original_layer"])
|
| 142 |
+
recipient_side = str(cycle_metadata["recipient_side"])
|
| 143 |
+
if recipient_side not in {"left", "right"}:
|
| 144 |
+
raise ValueError(f"invalid recipient_side at cycle {cycle}: {recipient_side}")
|
| 145 |
+
if original_layer_count is None:
|
| 146 |
+
original_layer_count = int(cycle_metadata["num_layers_before"])
|
| 147 |
+
if removed_original in removed:
|
| 148 |
+
raise ValueError(f"original layer {removed_original} removed more than once")
|
| 149 |
+
if recipient in removed:
|
| 150 |
+
raise ValueError(f"cycle {cycle} selects removed recipient {recipient}")
|
| 151 |
+
|
| 152 |
+
removed.add(removed_original)
|
| 153 |
+
latest_states.pop(removed_original, None)
|
| 154 |
+
latest_states[recipient] = {
|
| 155 |
+
"original_layer": recipient,
|
| 156 |
+
"source_cycle": cycle,
|
| 157 |
+
"recipient_side": recipient_side,
|
| 158 |
+
"source_state": src,
|
| 159 |
+
"post_merge_scale": post_merge_scale(source_cycle),
|
| 160 |
+
}
|
| 161 |
+
|
| 162 |
+
stage_dir = out / f"stage_{cycle:02d}"
|
| 163 |
+
stage_dir.mkdir(exist_ok=True)
|
| 164 |
+
retained_states = []
|
| 165 |
+
for original, record in sorted(latest_states.items()):
|
| 166 |
+
state_name = f"layer_original_{original:04d}.pt"
|
| 167 |
+
state_path = stage_dir / state_name
|
| 168 |
+
copy_stage_state(record["source_state"], state_path, hard_link=bool(getattr(args, "hard_link", False)))
|
| 169 |
+
packaged = {
|
| 170 |
+
"original_layer": original,
|
| 171 |
+
"state_file": state_name,
|
| 172 |
+
"sha256": sha256(state_path),
|
| 173 |
+
"source_cycle": int(record["source_cycle"]),
|
| 174 |
+
"recipient_side": record["recipient_side"],
|
| 175 |
+
}
|
| 176 |
+
if record["post_merge_scale"] is not None:
|
| 177 |
+
packaged["post_merge_scale"] = record["post_merge_scale"]
|
| 178 |
+
retained_states.append(packaged)
|
| 179 |
+
|
| 180 |
+
assert original_layer_count is not None
|
| 181 |
+
active = [
|
| 182 |
+
original
|
| 183 |
+
for original in range(original_layer_count)
|
| 184 |
+
if original not in removed
|
| 185 |
+
]
|
| 186 |
+
meta = {
|
| 187 |
+
"format": "abprune_compact_stage_v2",
|
| 188 |
+
"model": args.model,
|
| 189 |
+
"base_model_revision": args.base_revision,
|
| 190 |
+
"run_id": args.run_id,
|
| 191 |
+
"target_prune_count": args.cycles,
|
| 192 |
+
"stage": cycle,
|
| 193 |
+
"removed_count": len(removed),
|
| 194 |
+
"original_layer_count": original_layer_count,
|
| 195 |
+
"layer_order": order,
|
| 196 |
+
"latest_pair_index": order[cycle - 1],
|
| 197 |
+
"latest_recipient_side": recipient_side,
|
| 198 |
+
"latest_recipient_original_layer": recipient,
|
| 199 |
+
"latest_removed_original_layer": removed_original,
|
| 200 |
+
"removed_original_layers": sorted(removed),
|
| 201 |
+
"active_original_layers": active,
|
| 202 |
+
"retained_layer_states": retained_states,
|
| 203 |
+
"source_cycle": f"cycle_{cycle}",
|
| 204 |
+
}
|
| 205 |
+
(stage_dir / "metadata.json").write_text(
|
| 206 |
+
json.dumps(meta, indent=2) + "\n", encoding="utf-8"
|
| 207 |
+
)
|
| 208 |
+
stages.append(meta)
|
| 209 |
+
|
| 210 |
+
manifest = {
|
| 211 |
+
"format": "abprune_compact_manifest_v2",
|
| 212 |
+
"model": args.model,
|
| 213 |
+
"base_model_revision": args.base_revision,
|
| 214 |
+
"run_id": args.run_id,
|
| 215 |
+
"target_prune_count": args.cycles,
|
| 216 |
+
"original_layer_count": original_layer_count,
|
| 217 |
+
"layer_order": order,
|
| 218 |
+
"stages": stages,
|
| 219 |
+
}
|
| 220 |
+
(out / "manifest.json").write_text(
|
| 221 |
+
json.dumps(manifest, indent=2) + "\n", encoding="utf-8"
|
| 222 |
+
)
|
| 223 |
+
|
| 224 |
+
|
| 225 |
+
def package(args):
|
| 226 |
+
source = Path(args.run_root); out = Path(args.output_root); out.mkdir(parents=True, exist_ok=True)
|
| 227 |
+
order = [int(x) for x in args.layer_order.replace(',', ' ').split()]
|
| 228 |
+
start_cycle = int(getattr(args, "start_cycle", 1))
|
| 229 |
+
expected_order = args.cycles - start_cycle + 1
|
| 230 |
+
if not 1 <= start_cycle <= args.cycles:
|
| 231 |
+
raise ValueError("start_cycle must be between 1 and cycles")
|
| 232 |
+
if len(order) != expected_order:
|
| 233 |
+
raise ValueError("layer_order length must equal cycles - start_cycle + 1")
|
| 234 |
+
first_metadata_path = source / f"cycle_{start_cycle}" / "cycle_metadata.json"
|
| 235 |
+
if first_metadata_path.is_file():
|
| 236 |
+
first_metadata = json.loads(first_metadata_path.read_text(encoding="utf-8"))
|
| 237 |
+
topology_fields = {
|
| 238 |
+
"recipient_side",
|
| 239 |
+
"recipient_original_layer",
|
| 240 |
+
"removed_original_layer",
|
| 241 |
+
}
|
| 242 |
+
if topology_fields.issubset(first_metadata):
|
| 243 |
+
_package_topology_aware(args, source, out, order)
|
| 244 |
+
return
|
| 245 |
+
stages = []
|
| 246 |
+
for cycle in range(start_cycle, args.cycles + 1):
|
| 247 |
+
order_index = cycle - start_cycle
|
| 248 |
+
source_cycle = source / f"cycle_{cycle}"
|
| 249 |
+
src = source_cycle / "fused_layer.pt"
|
| 250 |
+
if not src.exists(): raise FileNotFoundError(src)
|
| 251 |
+
dst_dir = out / f"stage_{cycle:02d}"; dst_dir.mkdir(exist_ok=True)
|
| 252 |
+
dst = dst_dir / "anchor_layer.pt"; copy_stage_state(src, dst, hard_link=bool(getattr(args, "hard_link", False)))
|
| 253 |
+
meta = {
|
| 254 |
+
"format": "abprune_compact_stage_v1", "model": args.model,
|
| 255 |
+
"base_model_revision": args.base_revision, "run_id": args.run_id,
|
| 256 |
+
"target_prune_count": args.cycles, "stage": cycle,
|
| 257 |
+
"removed_count": cycle, "anchor_index": order[order_index],
|
| 258 |
+
"layer_order": order,
|
| 259 |
+
"packaged_stage_range": [start_cycle, args.cycles],
|
| 260 |
+
"removed_original_layers": list(range(order[order_index] + 1, order[order_index] + cycle + 1)),
|
| 261 |
+
"source_cycle": f"cycle_{cycle}", "anchor_state_file": "anchor_layer.pt",
|
| 262 |
+
"sha256": sha256(dst),
|
| 263 |
+
}
|
| 264 |
+
scale = post_merge_scale(source_cycle)
|
| 265 |
+
if scale is not None:
|
| 266 |
+
meta["post_merge_scale"] = scale
|
| 267 |
+
(dst_dir / "metadata.json").write_text(json.dumps(meta, indent=2) + "\n", encoding="utf-8")
|
| 268 |
+
stages.append(meta)
|
| 269 |
+
manifest = {"format": "abprune_compact_manifest_v1", "model": args.model,
|
| 270 |
+
"base_model_revision": args.base_revision, "run_id": args.run_id,
|
| 271 |
+
"target_prune_count": args.cycles, "layer_order": order, "stages": stages}
|
| 272 |
+
(out / "manifest.json").write_text(json.dumps(manifest, indent=2) + "\n", encoding="utf-8")
|
| 273 |
+
|
| 274 |
+
|
| 275 |
+
def main():
|
| 276 |
+
p = argparse.ArgumentParser(); p.add_argument("--run-root", required=True); p.add_argument("--output-root", required=True)
|
| 277 |
+
p.add_argument("--model", required=True); p.add_argument("--base-revision", required=True); p.add_argument("--run-id", required=True)
|
| 278 |
+
p.add_argument("--cycles", type=int, required=True); p.add_argument("--layer-order", required=True)
|
| 279 |
+
p.add_argument("--start-cycle", type=int, default=1)
|
| 280 |
+
p.add_argument("--hard-link", action="store_true", help="Hard-link immutable stage weights on the same filesystem")
|
| 281 |
+
package(p.parse_args())
|
| 282 |
+
|
| 283 |
+
|
| 284 |
+
if __name__ == "__main__": main()
|
runs/vast-paper_revision-come-attn-fit-20261126-62646539/20261126-qwen3-base-mka-come-mlp-fit/catalog/code/bootstrap_llama31_come_fit2.sh
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env bash
|
| 2 |
+
set -euo pipefail
|
| 3 |
+
project="$1"; external="$2"; root="$3"; base_model="$4"; inst_model="$5"
|
| 4 |
+
export HF_HOME=/workspace/.hf_home HF_TOKEN_PATH=/root/.cache/huggingface/token
|
| 5 |
+
export HF_DATASETS_CACHE=/workspace/.hf_datasets36 HF_DATASETS_TRUST_REMOTE_CODE=1
|
| 6 |
+
export PYTHONUNBUFFERED=1 TOKENIZERS_PARALLELISM=false OMP_NUM_THREADS=4 HF_XET_HIGH_PERFORMANCE=1
|
| 7 |
+
mkdir -p "$root" "$(dirname "$external")"
|
| 8 |
+
trap 'rc=$?; if ((rc)); then touch "$root/BOOTSTRAP_FAILED"; fi' EXIT
|
| 9 |
+
python -m pip install 'transformers==5.15.1' 'datasets==3.6.0' 'huggingface_hub==1.33.0' \
|
| 10 |
+
'lm_eval==0.4.12' accelerate scipy scikit-learn sentencepiece protobuf pytest
|
| 11 |
+
if [[ ! -d "$external/.git" ]]; then git clone "$project/vendor/abprune_experiment_base_39e.bundle" "$external"; fi
|
| 12 |
+
python - "$external" <<'PY'
|
| 13 |
+
from huggingface_hub import hf_hub_download
|
| 14 |
+
from pathlib import Path
|
| 15 |
+
import hashlib,shutil,sys
|
| 16 |
+
r=Path(sys.argv[1]);prefix='runs/vast-paper_revision-llama31-base-fit4-54645332-20261007/20261007-llama-base-fit4/wa/code/'
|
| 17 |
+
for n in ['fuse_layers.py','fuse_layers_distill.py','source_feature_transport.py']:
|
| 18 |
+
p=Path(hf_hub_download('LJYAI/paper_revision',prefix+n,revision='61734e7b1a77fd279fe1e2584f7a0fdc26c175c2'))
|
| 19 |
+
shutil.copy2(p,r/'src'/n); print('PINNED_SOURCE',n,hashlib.sha256(p.read_bytes()).hexdigest(),flush=True)
|
| 20 |
+
PY
|
| 21 |
+
if ! grep -q '^def model_is_sharded' "$external/src/progressive_loader.py"; then
|
| 22 |
+
git -C "$external" apply "$project/patches/0005-Add-progressive-loader-device-helpers.patch"
|
| 23 |
+
fi
|
| 24 |
+
git -C "$external" apply --check "$project/patches/abprune_transport_instruction_masks.patch"
|
| 25 |
+
git -C "$external" apply "$project/patches/abprune_transport_instruction_masks.patch"
|
| 26 |
+
python -m compileall -q "$external/src"
|
| 27 |
+
touch "$root/DEPS_READY"
|
| 28 |
+
python - "$root" "$base_model" "$inst_model" <<'PY'
|
| 29 |
+
from concurrent.futures import ThreadPoolExecutor
|
| 30 |
+
from pathlib import Path
|
| 31 |
+
from huggingface_hub import snapshot_download
|
| 32 |
+
from datasets import load_dataset
|
| 33 |
+
import sys
|
| 34 |
+
root=Path(sys.argv[1])
|
| 35 |
+
def prepare(family,model_id,model_rev,local,dataset,data_rev):
|
| 36 |
+
def model():
|
| 37 |
+
return snapshot_download(model_id,revision=model_rev,local_dir=local,
|
| 38 |
+
allow_patterns=['*.json','*.safetensors','tokenizer*','*.model','*.jinja'],max_workers=12)
|
| 39 |
+
def data():
|
| 40 |
+
snapshot_download(dataset,repo_type='dataset',revision=data_rev,max_workers=12)
|
| 41 |
+
return len(load_dataset(dataset,name=None,split='train',revision=data_rev,trust_remote_code=True))
|
| 42 |
+
with ThreadPoolExecutor(max_workers=2) as p:
|
| 43 |
+
for f in [p.submit(model),p.submit(data)]: print(family,'SNAPSHOT_READY',f.result(),flush=True)
|
| 44 |
+
(root/(family.upper()+'_READY')).touch()
|
| 45 |
+
with ThreadPoolExecutor(max_workers=2) as p:
|
| 46 |
+
jobs=[p.submit(prepare,'base','meta-llama/Llama-3.1-8B','d04e592bb4f6aa9cfee91e2e20afa771667e1d4b',sys.argv[2],
|
| 47 |
+
'DKYoon/SlimPajama-6B','b5f90f419b7489cdba26fdbc8c022fcb5562f968'),
|
| 48 |
+
p.submit(prepare,'instruct','meta-llama/Llama-3.1-8B-Instruct','0e9e39f249a16976918f6564b8830bc894c89659',sys.argv[3],
|
| 49 |
+
'Open-Orca/SlimOrca','ce9ed009ef3292bac33d3520afaf5ec804066120')]
|
| 50 |
+
for f in jobs:f.result()
|
| 51 |
+
PY
|
| 52 |
+
touch "$root/BOOTSTRAP_COMPLETE"
|
runs/vast-paper_revision-come-attn-fit-20261126-62646539/20261126-qwen3-base-mka-come-mlp-fit/catalog/code/collect_qwen_mlp_fit_comparison.py
ADDED
|
@@ -0,0 +1,68 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""Collect the Qwen3-8B-Base native MKA/CoMe batch-one MLP FiT results."""
|
| 2 |
+
import argparse
|
| 3 |
+
import json
|
| 4 |
+
import math
|
| 5 |
+
from pathlib import Path
|
| 6 |
+
|
| 7 |
+
|
| 8 |
+
FIT_IDS = "5d9d4cc2f81d8712b932806c0c2b2992dce9bd3e6c7a143f1f670649b8bfe693"
|
| 9 |
+
FIT_MASK = "c8e7f8e30cd532b82e6af4b98d596bc7106f29f9fb2b398b44355e624898a30d"
|
| 10 |
+
|
| 11 |
+
|
| 12 |
+
def main():
|
| 13 |
+
parser = argparse.ArgumentParser(description=__doc__)
|
| 14 |
+
parser.add_argument("root", type=Path)
|
| 15 |
+
parser.add_argument("--output", type=Path)
|
| 16 |
+
a = parser.parse_args()
|
| 17 |
+
rows = []
|
| 18 |
+
for method in ("mka", "come"):
|
| 19 |
+
run = a.root / "full" / method
|
| 20 |
+
scores = json.loads((run / "eval/final_14bench.json").read_text())["task_scores"]
|
| 21 |
+
tasks = [name for name in scores if name not in ("mmlu", "cmmlu")]
|
| 22 |
+
assert len(tasks) == 12 and len(scores) == 14
|
| 23 |
+
assert all(math.isfinite(value) and 0 <= value <= 1 for value in scores.values())
|
| 24 |
+
fits = [json.loads((run / "audit" / f"cycle_{cycle:02d}_fit.json").read_text())
|
| 25 |
+
for cycle in range(1, 10)]
|
| 26 |
+
for fit in fits:
|
| 27 |
+
assert fit["trained"] and fit["num_trainable_mlp_gates"] == 3
|
| 28 |
+
assert fit["num_trainable_attn_gates"] == fit["num_trainable_other_gates"] == 0
|
| 29 |
+
assert fit["runtime"]["batch_size"] == 1
|
| 30 |
+
assert fit["ablation"]["frozen_attention_norm_unchanged"]
|
| 31 |
+
assert len(fit["ablation"]["frozen_attention_norm_expected_sha256"]) == 8
|
| 32 |
+
fingerprints = json.loads((run / "audit/data_fingerprints.json").read_text())
|
| 33 |
+
distill = fingerprints["distill_loader"]
|
| 34 |
+
assert distill["sequences"] == 512 and distill["sha256"] == FIT_IDS
|
| 35 |
+
assert distill["attention_mask_sha256"] == FIT_MASK
|
| 36 |
+
ppl = json.loads((run / "eval/final_ppl.json").read_text())
|
| 37 |
+
metrics = ppl.get("metrics", ppl)
|
| 38 |
+
value = next((metrics[key] for key in ("ppl", "perplexity") if key in metrics), None)
|
| 39 |
+
assert value is not None and math.isfinite(value) and value > 0
|
| 40 |
+
native = json.loads((run / "audit/selection_inputs.json").read_text())
|
| 41 |
+
rows.append({"arm": method, "method": method, "batch_size": 1, "fit_scope": "mlp",
|
| 42 |
+
"bench12": sum(scores[key] for key in tasks) / 12,
|
| 43 |
+
"mmlu": scores["mmlu"], "cmmlu": scores["cmmlu"], "ppl": value,
|
| 44 |
+
"task_scores": scores,
|
| 45 |
+
"training_wall_seconds": json.loads((run / "training_elapsed.json").read_text())["wall_seconds"],
|
| 46 |
+
"fit_seconds": sum(fit["runtime"]["seconds"] for fit in fits),
|
| 47 |
+
"peak_allocated_bytes": max(fit["runtime"]["peak_allocated_bytes"] for fit in fits),
|
| 48 |
+
"peak_reserved_bytes": max(fit["runtime"]["peak_reserved_bytes"] for fit in fits),
|
| 49 |
+
"optimizer_updates_per_stage": 512, "fit_input_sha256": FIT_IDS,
|
| 50 |
+
"fit_mask_sha256": FIT_MASK, "selection_input_sha256": native["input_ids_sha256"],
|
| 51 |
+
"selection_inputs": native, "cycles": fits,
|
| 52 |
+
"selection_trace": json.loads((run / "audit/selection.json").read_text()),
|
| 53 |
+
"backup": json.loads((a.root / f"{method}_backup.json").read_text())})
|
| 54 |
+
result = {"model": "Qwen/Qwen3-8B-Base", "model_revision": "49e3418fbbbca6ecbdf9608b4d22e5a407081db4",
|
| 55 |
+
"model_variant": "Base", "original_layers": 36, "removed_blocks": 9,
|
| 56 |
+
"fit_scope": "mlp", "batch_size": 1, "accuracy_scale": "fraction", "rows": rows,
|
| 57 |
+
"smoke": json.loads((a.root / "smoke_summary.json").read_text()),
|
| 58 |
+
"selection_provenance": json.loads((a.root / "selection_provenance.json").read_text()),
|
| 59 |
+
"qualification": "Both methods retain their own historical native selection data; identical pinned SlimPajama512x1024 FiT examples/masks/LR/loss/epochs and512updates perstage; attention and allnorms frozen duringFiT"}
|
| 60 |
+
output = a.output or a.root / "summary.json"
|
| 61 |
+
output.parent.mkdir(parents=True, exist_ok=True)
|
| 62 |
+
output.write_text(json.dumps(result, indent=2) + "\n")
|
| 63 |
+
for row in rows:
|
| 64 |
+
print({key: row[key] for key in ("arm", "batch_size", "bench12", "mmlu", "cmmlu", "ppl", "training_wall_seconds")})
|
| 65 |
+
|
| 66 |
+
|
| 67 |
+
if __name__ == "__main__":
|
| 68 |
+
main()
|
runs/vast-paper_revision-come-attn-fit-20261126-62646539/20261126-qwen3-base-mka-come-mlp-fit/catalog/code/come.py
ADDED
|
@@ -0,0 +1,612 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""Native Hugging Face implementation of CoMe structured layer pruning.
|
| 2 |
+
|
| 3 |
+
This module implements the pruning-only portion of CoMe for decoder-only
|
| 4 |
+
models whose blocks use Llama-style attention and gated MLP projections. It
|
| 5 |
+
intentionally does not implement post-pruning distillation.
|
| 6 |
+
"""
|
| 7 |
+
|
| 8 |
+
from __future__ import annotations
|
| 9 |
+
|
| 10 |
+
import json
|
| 11 |
+
import math
|
| 12 |
+
from dataclasses import asdict, dataclass
|
| 13 |
+
from pathlib import Path
|
| 14 |
+
from typing import Iterable, Sequence
|
| 15 |
+
|
| 16 |
+
import torch
|
| 17 |
+
from torch import Tensor, nn
|
| 18 |
+
from tqdm.auto import tqdm
|
| 19 |
+
|
| 20 |
+
|
| 21 |
+
@dataclass
|
| 22 |
+
class CalibrationScores:
|
| 23 |
+
"""Scores collected from one pass over the calibration sequences."""
|
| 24 |
+
|
| 25 |
+
block_importance: list[float]
|
| 26 |
+
pair_similarity: list[float]
|
| 27 |
+
attention_groups: list[Tensor]
|
| 28 |
+
mlp_neurons: list[Tensor]
|
| 29 |
+
|
| 30 |
+
|
| 31 |
+
@dataclass
|
| 32 |
+
class MergeRecord:
|
| 33 |
+
step: int
|
| 34 |
+
left_index: int
|
| 35 |
+
source_layers: list[list[int]]
|
| 36 |
+
retention_ratios: list[float]
|
| 37 |
+
retained_attention_groups: list[int]
|
| 38 |
+
retained_mlp_neurons: list[int]
|
| 39 |
+
pair_score: float
|
| 40 |
+
|
| 41 |
+
|
| 42 |
+
def allocate_retained_channels(total: int, ratios: Sequence[float]) -> list[int]:
|
| 43 |
+
"""Allocate exactly ``total`` channels, putting rounding slack in the max arm."""
|
| 44 |
+
|
| 45 |
+
if total < 1:
|
| 46 |
+
raise ValueError("total must be positive")
|
| 47 |
+
if not ratios or any(value < 0 for value in ratios):
|
| 48 |
+
raise ValueError("ratios must be a non-empty sequence of non-negative values")
|
| 49 |
+
ratio_sum = float(sum(ratios))
|
| 50 |
+
if ratio_sum <= 0:
|
| 51 |
+
normalized = [1.0 / len(ratios)] * len(ratios)
|
| 52 |
+
else:
|
| 53 |
+
normalized = [float(value) / ratio_sum for value in ratios]
|
| 54 |
+
|
| 55 |
+
largest = max(range(len(normalized)), key=normalized.__getitem__)
|
| 56 |
+
counts = [0] * len(normalized)
|
| 57 |
+
for index, ratio in enumerate(normalized):
|
| 58 |
+
if index != largest:
|
| 59 |
+
counts[index] = math.floor(total * ratio)
|
| 60 |
+
counts[largest] = total - sum(counts)
|
| 61 |
+
return counts
|
| 62 |
+
|
| 63 |
+
|
| 64 |
+
def gqa_projection_indices(
|
| 65 |
+
groups: Tensor,
|
| 66 |
+
*,
|
| 67 |
+
num_attention_heads: int,
|
| 68 |
+
num_key_value_heads: int,
|
| 69 |
+
head_dim: int,
|
| 70 |
+
) -> tuple[Tensor, Tensor]:
|
| 71 |
+
"""Return Q and KV row indices for complete GQA groups.
|
| 72 |
+
|
| 73 |
+
Hugging Face stores query heads contiguously by KV group. Expanding a KV
|
| 74 |
+
mask with ``repeat`` mixes these groups for GQA models; this explicit
|
| 75 |
+
mapping keeps all query heads belonging to each selected KV head together.
|
| 76 |
+
"""
|
| 77 |
+
|
| 78 |
+
if num_attention_heads % num_key_value_heads:
|
| 79 |
+
raise ValueError("num_attention_heads must be divisible by num_key_value_heads")
|
| 80 |
+
queries_per_kv = num_attention_heads // num_key_value_heads
|
| 81 |
+
q_parts: list[Tensor] = []
|
| 82 |
+
kv_parts: list[Tensor] = []
|
| 83 |
+
for group in groups.to(dtype=torch.long, device="cpu").tolist():
|
| 84 |
+
if group < 0 or group >= num_key_value_heads:
|
| 85 |
+
raise IndexError(f"KV group {group} is outside [0, {num_key_value_heads})")
|
| 86 |
+
q_start = group * queries_per_kv * head_dim
|
| 87 |
+
kv_start = group * head_dim
|
| 88 |
+
q_parts.append(torch.arange(q_start, q_start + queries_per_kv * head_dim))
|
| 89 |
+
kv_parts.append(torch.arange(kv_start, kv_start + head_dim))
|
| 90 |
+
empty = torch.empty(0, dtype=torch.long)
|
| 91 |
+
return (
|
| 92 |
+
torch.cat(q_parts) if q_parts else empty,
|
| 93 |
+
torch.cat(kv_parts) if kv_parts else empty,
|
| 94 |
+
)
|
| 95 |
+
|
| 96 |
+
|
| 97 |
+
def _copy_tensor(target: Tensor, value: Tensor) -> None:
|
| 98 |
+
with torch.no_grad():
|
| 99 |
+
target.copy_(value.to(device=target.device, dtype=target.dtype))
|
| 100 |
+
|
| 101 |
+
|
| 102 |
+
def _selected_indices(scores: Tensor, count: int) -> Tensor:
|
| 103 |
+
if count == 0:
|
| 104 |
+
return torch.empty(0, dtype=torch.long)
|
| 105 |
+
if count > scores.numel():
|
| 106 |
+
raise ValueError(f"cannot select {count} values from {scores.numel()} scores")
|
| 107 |
+
# Sorting the selected indices preserves the original within-layer order.
|
| 108 |
+
return torch.sort(torch.topk(scores.float(), count, largest=True).indices).values.cpu()
|
| 109 |
+
|
| 110 |
+
|
| 111 |
+
def _cat_selected(
|
| 112 |
+
modules: Sequence[nn.Linear],
|
| 113 |
+
indices: Sequence[Tensor],
|
| 114 |
+
*,
|
| 115 |
+
dimension: int,
|
| 116 |
+
) -> Tensor:
|
| 117 |
+
chunks = []
|
| 118 |
+
for module, selected in zip(modules, indices, strict=True):
|
| 119 |
+
chunks.append(torch.index_select(module.weight.detach(), dimension, selected.to(module.weight.device)))
|
| 120 |
+
return torch.cat(chunks, dim=dimension)
|
| 121 |
+
|
| 122 |
+
|
| 123 |
+
def _weighted_optional_bias(modules: Sequence[nn.Linear], ratios: Sequence[float]) -> Tensor | None:
|
| 124 |
+
biases = [module.bias for module in modules]
|
| 125 |
+
if all(bias is None for bias in biases):
|
| 126 |
+
return None
|
| 127 |
+
if any(bias is None for bias in biases):
|
| 128 |
+
raise ValueError("projection bias presence differs across the layers being merged")
|
| 129 |
+
assert all(bias is not None for bias in biases)
|
| 130 |
+
result = torch.zeros_like(biases[0])
|
| 131 |
+
for bias, ratio in zip(biases, ratios, strict=True):
|
| 132 |
+
result.add_(bias.detach().to(result.device), alpha=float(ratio))
|
| 133 |
+
return result
|
| 134 |
+
|
| 135 |
+
|
| 136 |
+
def merge_attention(
|
| 137 |
+
layers: Sequence[nn.Module],
|
| 138 |
+
ratios: Sequence[float],
|
| 139 |
+
group_scores: Sequence[Tensor],
|
| 140 |
+
) -> list[int]:
|
| 141 |
+
"""Merge attention projections in-place into the first decoder layer."""
|
| 142 |
+
|
| 143 |
+
attentions = [layer.self_attn for layer in layers]
|
| 144 |
+
first = attentions[0]
|
| 145 |
+
q_heads = int(first.config.num_attention_heads)
|
| 146 |
+
kv_heads = int(first.config.num_key_value_heads)
|
| 147 |
+
head_dim = int(getattr(first, "head_dim", first.q_proj.out_features // q_heads))
|
| 148 |
+
counts = allocate_retained_channels(kv_heads, ratios)
|
| 149 |
+
groups = [_selected_indices(score, count) for score, count in zip(group_scores, counts, strict=True)]
|
| 150 |
+
q_indices: list[Tensor] = []
|
| 151 |
+
kv_indices: list[Tensor] = []
|
| 152 |
+
for selected in groups:
|
| 153 |
+
q_index, kv_index = gqa_projection_indices(
|
| 154 |
+
selected,
|
| 155 |
+
num_attention_heads=q_heads,
|
| 156 |
+
num_key_value_heads=kv_heads,
|
| 157 |
+
head_dim=head_dim,
|
| 158 |
+
)
|
| 159 |
+
q_indices.append(q_index)
|
| 160 |
+
kv_indices.append(kv_index)
|
| 161 |
+
|
| 162 |
+
q_modules = [attention.q_proj for attention in attentions]
|
| 163 |
+
k_modules = [attention.k_proj for attention in attentions]
|
| 164 |
+
v_modules = [attention.v_proj for attention in attentions]
|
| 165 |
+
o_modules = [attention.o_proj for attention in attentions]
|
| 166 |
+
q_weight = _cat_selected(q_modules, q_indices, dimension=0)
|
| 167 |
+
k_weight = _cat_selected(k_modules, kv_indices, dimension=0)
|
| 168 |
+
v_weight = _cat_selected(v_modules, kv_indices, dimension=0)
|
| 169 |
+
o_weight = _cat_selected(o_modules, q_indices, dimension=1)
|
| 170 |
+
|
| 171 |
+
_copy_tensor(first.q_proj.weight, q_weight)
|
| 172 |
+
_copy_tensor(first.k_proj.weight, k_weight)
|
| 173 |
+
_copy_tensor(first.v_proj.weight, v_weight)
|
| 174 |
+
_copy_tensor(first.o_proj.weight, o_weight)
|
| 175 |
+
for destination, source_modules, selected in (
|
| 176 |
+
(first.q_proj, q_modules, q_indices),
|
| 177 |
+
(first.k_proj, k_modules, kv_indices),
|
| 178 |
+
(first.v_proj, v_modules, kv_indices),
|
| 179 |
+
):
|
| 180 |
+
biases = [module.bias for module in source_modules]
|
| 181 |
+
if not all(bias is None for bias in biases):
|
| 182 |
+
if any(bias is None for bias in biases):
|
| 183 |
+
raise ValueError("projection bias presence differs across merged layers")
|
| 184 |
+
bias_chunks = [
|
| 185 |
+
torch.index_select(module.bias.detach(), 0, index.to(module.bias.device))
|
| 186 |
+
for module, index in zip(source_modules, selected, strict=True)
|
| 187 |
+
]
|
| 188 |
+
assert destination.bias is not None
|
| 189 |
+
_copy_tensor(destination.bias, torch.cat(bias_chunks))
|
| 190 |
+
merged_o_bias = _weighted_optional_bias(o_modules, ratios)
|
| 191 |
+
if merged_o_bias is not None:
|
| 192 |
+
assert first.o_proj.bias is not None
|
| 193 |
+
_copy_tensor(first.o_proj.bias, merged_o_bias)
|
| 194 |
+
|
| 195 |
+
# Qwen3 applies a shared per-head RMSNorm after Q/K projection. It cannot
|
| 196 |
+
# be sliced by group, so use the same convex merge as other shared values.
|
| 197 |
+
for norm_name in ("q_norm", "k_norm"):
|
| 198 |
+
norms = [getattr(attention, norm_name, None) for attention in attentions]
|
| 199 |
+
if all(norm is None for norm in norms):
|
| 200 |
+
continue
|
| 201 |
+
if any(norm is None for norm in norms):
|
| 202 |
+
raise ValueError(f"{norm_name} presence differs across merged layers")
|
| 203 |
+
destination = norms[0]
|
| 204 |
+
merged = torch.zeros_like(destination.weight)
|
| 205 |
+
for norm, ratio in zip(norms, ratios, strict=True):
|
| 206 |
+
merged.add_(norm.weight.detach().to(merged.device), alpha=float(ratio))
|
| 207 |
+
_copy_tensor(destination.weight, merged)
|
| 208 |
+
|
| 209 |
+
return counts
|
| 210 |
+
|
| 211 |
+
|
| 212 |
+
def merge_mlp(
|
| 213 |
+
layers: Sequence[nn.Module],
|
| 214 |
+
ratios: Sequence[float],
|
| 215 |
+
neuron_scores: Sequence[Tensor],
|
| 216 |
+
) -> list[int]:
|
| 217 |
+
"""Merge gated MLP projections in-place into the first decoder layer."""
|
| 218 |
+
|
| 219 |
+
mlps = [layer.mlp for layer in layers]
|
| 220 |
+
intermediate_size = int(mlps[0].gate_proj.out_features)
|
| 221 |
+
counts = allocate_retained_channels(intermediate_size, ratios)
|
| 222 |
+
selected = [_selected_indices(score, count) for score, count in zip(neuron_scores, counts, strict=True)]
|
| 223 |
+
|
| 224 |
+
for name in ("gate_proj", "up_proj"):
|
| 225 |
+
modules = [getattr(mlp, name) for mlp in mlps]
|
| 226 |
+
merged = _cat_selected(modules, selected, dimension=0)
|
| 227 |
+
destination = getattr(mlps[0], name)
|
| 228 |
+
_copy_tensor(destination.weight, merged)
|
| 229 |
+
biases = [module.bias for module in modules]
|
| 230 |
+
if not all(bias is None for bias in biases):
|
| 231 |
+
if any(bias is None for bias in biases):
|
| 232 |
+
raise ValueError(f"{name} bias presence differs across merged layers")
|
| 233 |
+
bias_chunks = [
|
| 234 |
+
torch.index_select(module.bias.detach(), 0, index.to(module.bias.device))
|
| 235 |
+
for module, index in zip(modules, selected, strict=True)
|
| 236 |
+
]
|
| 237 |
+
assert destination.bias is not None
|
| 238 |
+
_copy_tensor(destination.bias, torch.cat(bias_chunks))
|
| 239 |
+
|
| 240 |
+
down_modules = [mlp.down_proj for mlp in mlps]
|
| 241 |
+
_copy_tensor(mlps[0].down_proj.weight, _cat_selected(down_modules, selected, dimension=1))
|
| 242 |
+
merged_bias = _weighted_optional_bias(down_modules, ratios)
|
| 243 |
+
if merged_bias is not None:
|
| 244 |
+
assert mlps[0].down_proj.bias is not None
|
| 245 |
+
_copy_tensor(mlps[0].down_proj.bias, merged_bias)
|
| 246 |
+
return counts
|
| 247 |
+
|
| 248 |
+
|
| 249 |
+
def merge_norms(layers: Sequence[nn.Module]) -> None:
|
| 250 |
+
"""Average the two residual-stream norms into the destination block."""
|
| 251 |
+
|
| 252 |
+
for name in ("input_layernorm", "post_attention_layernorm"):
|
| 253 |
+
norms = [getattr(layer, name) for layer in layers]
|
| 254 |
+
destination = norms[0]
|
| 255 |
+
_copy_tensor(destination.weight, torch.stack([norm.weight.detach().to(destination.weight.device) for norm in norms]).mean(0))
|
| 256 |
+
destination_bias = getattr(destination, "bias", None)
|
| 257 |
+
if destination_bias is not None:
|
| 258 |
+
source_biases = [getattr(norm, "bias", None) for norm in norms]
|
| 259 |
+
if any(bias is None for bias in source_biases):
|
| 260 |
+
raise ValueError(f"{name} bias presence differs across merged layers")
|
| 261 |
+
_copy_tensor(
|
| 262 |
+
destination_bias,
|
| 263 |
+
torch.stack([bias.detach().to(destination_bias.device) for bias in source_biases]).mean(0),
|
| 264 |
+
)
|
| 265 |
+
|
| 266 |
+
|
| 267 |
+
def compute_retention_ratios(
|
| 268 |
+
importance: Sequence[float],
|
| 269 |
+
*,
|
| 270 |
+
power: float,
|
| 271 |
+
minimum: float,
|
| 272 |
+
) -> list[float]:
|
| 273 |
+
if power < 0:
|
| 274 |
+
raise ValueError("power must be non-negative")
|
| 275 |
+
if not 0 <= minimum <= 1:
|
| 276 |
+
raise ValueError("minimum must be in [0, 1]")
|
| 277 |
+
values = [max(float(value), 0.0) ** power for value in importance]
|
| 278 |
+
total = sum(values)
|
| 279 |
+
ratios = [value / total for value in values] if total > 0 else [1 / len(values)] * len(values)
|
| 280 |
+
largest = max(range(len(ratios)), key=ratios.__getitem__)
|
| 281 |
+
if ratios[largest] < minimum:
|
| 282 |
+
if len(ratios) == 1:
|
| 283 |
+
return [1.0]
|
| 284 |
+
remainder = sum(ratios) - ratios[largest]
|
| 285 |
+
scale = (1.0 - minimum) / remainder if remainder > 0 else 0.0
|
| 286 |
+
ratios = [ratio * scale for ratio in ratios]
|
| 287 |
+
ratios[largest] = minimum
|
| 288 |
+
return ratios
|
| 289 |
+
|
| 290 |
+
|
| 291 |
+
class _ProjectionScoreCollector:
|
| 292 |
+
def __init__(self, modules: Sequence[nn.Linear]):
|
| 293 |
+
self.scores = [torch.zeros(module.in_features, dtype=torch.float64) for module in modules]
|
| 294 |
+
self._handles = []
|
| 295 |
+
for index, module in enumerate(modules):
|
| 296 |
+
self._handles.append(module.register_forward_pre_hook(self._hook(index)))
|
| 297 |
+
|
| 298 |
+
def _hook(self, index: int):
|
| 299 |
+
def collect(module: nn.Linear, inputs: tuple[Tensor, ...]) -> None:
|
| 300 |
+
activation = inputs[0].detach().float().abs()
|
| 301 |
+
reduce_dims = tuple(range(activation.ndim - 1))
|
| 302 |
+
activation_sum = activation.sum(dim=reduce_dims)
|
| 303 |
+
weight_l1 = module.weight.detach().float().abs().sum(dim=0)
|
| 304 |
+
self.scores[index].add_((activation_sum * weight_l1).double().cpu())
|
| 305 |
+
|
| 306 |
+
return collect
|
| 307 |
+
|
| 308 |
+
def close(self) -> None:
|
| 309 |
+
for handle in self._handles:
|
| 310 |
+
handle.remove()
|
| 311 |
+
|
| 312 |
+
|
| 313 |
+
def _angular_distance(left: Tensor, right: Tensor, *, last_token_only: bool) -> Tensor:
|
| 314 |
+
if last_token_only:
|
| 315 |
+
left = left[:, -1:, :]
|
| 316 |
+
right = right[:, -1:, :]
|
| 317 |
+
cosine = torch.nn.functional.cosine_similarity(left.float(), right.float(), dim=-1)
|
| 318 |
+
if last_token_only:
|
| 319 |
+
return torch.acos(cosine.clamp(0, 1)) / math.pi
|
| 320 |
+
return 1 - cosine
|
| 321 |
+
|
| 322 |
+
|
| 323 |
+
@torch.inference_mode()
|
| 324 |
+
def collect_calibration_scores(
|
| 325 |
+
model: nn.Module,
|
| 326 |
+
batches: Iterable[dict[str, Tensor]],
|
| 327 |
+
*,
|
| 328 |
+
sbi_metric: str = "angular_last",
|
| 329 |
+
) -> CalibrationScores:
|
| 330 |
+
"""Collect CoMe block, adjacent-pair, attention, and MLP scores."""
|
| 331 |
+
|
| 332 |
+
if sbi_metric not in {"angular_last", "cosine_all"}:
|
| 333 |
+
raise ValueError("sbi_metric must be 'angular_last' or 'cosine_all'")
|
| 334 |
+
backbone = model.model
|
| 335 |
+
layers = list(backbone.layers)
|
| 336 |
+
attention = _ProjectionScoreCollector([layer.self_attn.o_proj for layer in layers])
|
| 337 |
+
mlp = _ProjectionScoreCollector([layer.mlp.down_proj for layer in layers])
|
| 338 |
+
block_sums = torch.zeros(len(layers), dtype=torch.float64)
|
| 339 |
+
pair_sums = torch.zeros(len(layers) - 1, dtype=torch.float64)
|
| 340 |
+
block_count = 0
|
| 341 |
+
pair_count = 0
|
| 342 |
+
input_device = model.get_input_embeddings().weight.device
|
| 343 |
+
try:
|
| 344 |
+
for batch in tqdm(batches, desc=f"CoMe calibration ({len(layers)} layers)"):
|
| 345 |
+
prepared = {key: value.to(input_device) for key, value in batch.items()}
|
| 346 |
+
outputs = backbone(
|
| 347 |
+
**prepared,
|
| 348 |
+
use_cache=False,
|
| 349 |
+
output_hidden_states=True,
|
| 350 |
+
return_dict=True,
|
| 351 |
+
)
|
| 352 |
+
hidden = outputs.hidden_states
|
| 353 |
+
for index in range(len(layers)):
|
| 354 |
+
distance = _angular_distance(hidden[index], hidden[index + 1], last_token_only=False)
|
| 355 |
+
block_sums[index] += distance.double().sum().cpu()
|
| 356 |
+
batch_token_count = hidden[0].shape[0] * hidden[0].shape[1]
|
| 357 |
+
block_count += batch_token_count
|
| 358 |
+
for index in range(len(layers) - 1):
|
| 359 |
+
distance = _angular_distance(
|
| 360 |
+
hidden[index],
|
| 361 |
+
hidden[index + 2],
|
| 362 |
+
last_token_only=sbi_metric == "angular_last",
|
| 363 |
+
)
|
| 364 |
+
pair_sums[index] += distance.double().sum().cpu()
|
| 365 |
+
pair_count += hidden[0].shape[0] if sbi_metric == "angular_last" else batch_token_count
|
| 366 |
+
finally:
|
| 367 |
+
attention.close()
|
| 368 |
+
mlp.close()
|
| 369 |
+
|
| 370 |
+
if block_count == 0:
|
| 371 |
+
raise ValueError("calibration batches are empty")
|
| 372 |
+
attention_groups: list[Tensor] = []
|
| 373 |
+
for layer, score in zip(layers, attention.scores, strict=True):
|
| 374 |
+
attn = layer.self_attn
|
| 375 |
+
q_heads = int(attn.config.num_attention_heads)
|
| 376 |
+
kv_heads = int(attn.config.num_key_value_heads)
|
| 377 |
+
head_dim = int(getattr(attn, "head_dim", attn.q_proj.out_features // q_heads))
|
| 378 |
+
queries_per_kv = q_heads // kv_heads
|
| 379 |
+
expected = kv_heads * queries_per_kv * head_dim
|
| 380 |
+
if score.numel() != expected:
|
| 381 |
+
raise ValueError(f"unexpected attention input width {score.numel()} (expected {expected})")
|
| 382 |
+
attention_groups.append(score.reshape(kv_heads, queries_per_kv, head_dim).mean((1, 2)))
|
| 383 |
+
return CalibrationScores(
|
| 384 |
+
block_importance=(block_sums / block_count).tolist(),
|
| 385 |
+
pair_similarity=(pair_sums / max(pair_count, 1)).tolist(),
|
| 386 |
+
attention_groups=attention_groups,
|
| 387 |
+
mlp_neurons=mlp.scores,
|
| 388 |
+
)
|
| 389 |
+
|
| 390 |
+
|
| 391 |
+
def _choose_pair(pair_scores: Sequence[float], lineage: Sequence[Sequence[int]], allow_repeat: bool) -> int:
|
| 392 |
+
candidates = []
|
| 393 |
+
for index, score in enumerate(pair_scores):
|
| 394 |
+
repeated = len(lineage[index]) > 1 or len(lineage[index + 1]) > 1
|
| 395 |
+
if allow_repeat or not repeated:
|
| 396 |
+
candidates.append((float(score), index))
|
| 397 |
+
if not candidates:
|
| 398 |
+
raise RuntimeError(
|
| 399 |
+
"no legal adjacent pair remains; use --allow-repeat or choose a target at least ceil(original_layers / 2)"
|
| 400 |
+
)
|
| 401 |
+
return min(candidates)[1]
|
| 402 |
+
|
| 403 |
+
|
| 404 |
+
def _update_config_after_delete(model: nn.Module, deleted_index: int) -> None:
|
| 405 |
+
model.config.num_hidden_layers = len(model.model.layers)
|
| 406 |
+
if hasattr(model.config, "layer_types") and model.config.layer_types is not None:
|
| 407 |
+
layer_types = list(model.config.layer_types)
|
| 408 |
+
if deleted_index < len(layer_types):
|
| 409 |
+
del layer_types[deleted_index]
|
| 410 |
+
model.config.layer_types = layer_types
|
| 411 |
+
for index, layer in enumerate(model.model.layers):
|
| 412 |
+
if hasattr(layer.self_attn, "layer_idx"):
|
| 413 |
+
layer.self_attn.layer_idx = index
|
| 414 |
+
|
| 415 |
+
|
| 416 |
+
@torch.inference_mode()
|
| 417 |
+
def progressive_prune(
|
| 418 |
+
model: nn.Module,
|
| 419 |
+
calibration_batches: Sequence[dict[str, Tensor]],
|
| 420 |
+
*,
|
| 421 |
+
target_layers: int,
|
| 422 |
+
power: float = 1.0,
|
| 423 |
+
minimum_retention: float = 0.0,
|
| 424 |
+
allow_repeat: bool = False,
|
| 425 |
+
sbi_metric: str = "angular_last",
|
| 426 |
+
) -> list[MergeRecord]:
|
| 427 |
+
"""Progressively merge adjacent layer pairs until ``target_layers`` remain."""
|
| 428 |
+
|
| 429 |
+
original_layers = len(model.model.layers)
|
| 430 |
+
if not 1 <= target_layers <= original_layers:
|
| 431 |
+
raise ValueError(f"target_layers must be in [1, {original_layers}]")
|
| 432 |
+
if not allow_repeat and target_layers < math.ceil(original_layers / 2):
|
| 433 |
+
raise ValueError("without repeated merges, target_layers cannot be below ceil(original_layers / 2)")
|
| 434 |
+
lineage: list[list[int]] = [[index] for index in range(original_layers)]
|
| 435 |
+
records: list[MergeRecord] = []
|
| 436 |
+
model.eval()
|
| 437 |
+
model.config.use_cache = False
|
| 438 |
+
|
| 439 |
+
while len(model.model.layers) > target_layers:
|
| 440 |
+
scores = collect_calibration_scores(model, calibration_batches, sbi_metric=sbi_metric)
|
| 441 |
+
left = _choose_pair(scores.pair_similarity, lineage, allow_repeat)
|
| 442 |
+
indices = [left, left + 1]
|
| 443 |
+
leaf_count = sum(len(lineage[index]) for index in indices)
|
| 444 |
+
adjusted_minimum = minimum_retention
|
| 445 |
+
if allow_repeat and minimum_retention > 0 and leaf_count > 2:
|
| 446 |
+
adjusted_minimum = minimum_retention ** (1 / (leaf_count - 1))
|
| 447 |
+
ratios = compute_retention_ratios(
|
| 448 |
+
[scores.block_importance[index] for index in indices],
|
| 449 |
+
power=power,
|
| 450 |
+
minimum=adjusted_minimum,
|
| 451 |
+
)
|
| 452 |
+
print(
|
| 453 |
+
f"CoMe step {len(records) + 1}: merge current layers {left}/{left + 1} "
|
| 454 |
+
f"(sources {lineage[left]} + {lineage[left + 1]}, ratios={ratios})",
|
| 455 |
+
flush=True,
|
| 456 |
+
)
|
| 457 |
+
merge_layers = [model.model.layers[index] for index in indices]
|
| 458 |
+
attention_counts = merge_attention(
|
| 459 |
+
merge_layers,
|
| 460 |
+
ratios,
|
| 461 |
+
[scores.attention_groups[index] for index in indices],
|
| 462 |
+
)
|
| 463 |
+
mlp_counts = merge_mlp(
|
| 464 |
+
merge_layers,
|
| 465 |
+
ratios,
|
| 466 |
+
[scores.mlp_neurons[index] for index in indices],
|
| 467 |
+
)
|
| 468 |
+
merge_norms(merge_layers)
|
| 469 |
+
records.append(
|
| 470 |
+
MergeRecord(
|
| 471 |
+
step=len(records) + 1,
|
| 472 |
+
left_index=left,
|
| 473 |
+
source_layers=[list(lineage[index]) for index in indices],
|
| 474 |
+
retention_ratios=ratios,
|
| 475 |
+
retained_attention_groups=attention_counts,
|
| 476 |
+
retained_mlp_neurons=mlp_counts,
|
| 477 |
+
pair_score=float(scores.pair_similarity[left]),
|
| 478 |
+
)
|
| 479 |
+
)
|
| 480 |
+
del model.model.layers[left + 1]
|
| 481 |
+
lineage[left] = lineage[left] + lineage[left + 1]
|
| 482 |
+
del lineage[left + 1]
|
| 483 |
+
_update_config_after_delete(model, left + 1)
|
| 484 |
+
if torch.cuda.is_available():
|
| 485 |
+
torch.cuda.empty_cache()
|
| 486 |
+
return records
|
| 487 |
+
|
| 488 |
+
|
| 489 |
+
def build_wikitext2_calibration(
|
| 490 |
+
tokenizer,
|
| 491 |
+
*,
|
| 492 |
+
samples: int,
|
| 493 |
+
sequence_length: int,
|
| 494 |
+
seed: int,
|
| 495 |
+
) -> list[dict[str, Tensor]]:
|
| 496 |
+
"""Reproduce CoMe's shuffled WikiText-2 prefix calibration stream.
|
| 497 |
+
|
| 498 |
+
The upstream ``nsamples`` argument counts shuffled dataset rows, not 2,048
|
| 499 |
+
token windows. Full windows are carved from their concatenated token stream
|
| 500 |
+
and the short tail is discarded.
|
| 501 |
+
"""
|
| 502 |
+
|
| 503 |
+
from datasets import load_dataset
|
| 504 |
+
|
| 505 |
+
dataset = load_dataset("wikitext", "wikitext-2-raw-v1", split="train").shuffle(seed=seed)
|
| 506 |
+
selected = dataset.select(range(min(samples, len(dataset))))
|
| 507 |
+
text = "\n\n".join(selected["text"])
|
| 508 |
+
token_ids = tokenizer(text, return_tensors="pt").input_ids[0]
|
| 509 |
+
windows = token_ids.numel() // sequence_length
|
| 510 |
+
if windows == 0:
|
| 511 |
+
raise ValueError("selected WikiText-2 rows contain fewer tokens than sequence_length")
|
| 512 |
+
batches = []
|
| 513 |
+
for index in range(windows):
|
| 514 |
+
start = index * sequence_length
|
| 515 |
+
input_ids = token_ids[start : start + sequence_length].unsqueeze(0)
|
| 516 |
+
batches.append({"input_ids": input_ids, "attention_mask": torch.ones_like(input_ids)})
|
| 517 |
+
return batches
|
| 518 |
+
|
| 519 |
+
|
| 520 |
+
def build_slimpajama_calibration(
|
| 521 |
+
tokenizer,
|
| 522 |
+
*,
|
| 523 |
+
rows: int,
|
| 524 |
+
sequence_length: int,
|
| 525 |
+
seed: int,
|
| 526 |
+
shuffle_buffer: int = 10_000,
|
| 527 |
+
) -> list[dict[str, Tensor]]:
|
| 528 |
+
"""Pack full windows after concatenating shuffled SlimPajama rows.
|
| 529 |
+
|
| 530 |
+
This mirrors upstream CoMe's WikiText loader: ``nsamples`` counts dataset
|
| 531 |
+
rows, not model-forward windows.
|
| 532 |
+
"""
|
| 533 |
+
|
| 534 |
+
from datasets import load_dataset
|
| 535 |
+
|
| 536 |
+
if rows < 1:
|
| 537 |
+
raise ValueError("rows must be positive")
|
| 538 |
+
dataset = load_dataset(
|
| 539 |
+
"DKYoon/SlimPajama-6B",
|
| 540 |
+
split="train",
|
| 541 |
+
streaming=True,
|
| 542 |
+
).shuffle(seed=seed, buffer_size=shuffle_buffer)
|
| 543 |
+
token_buffer: list[int] = []
|
| 544 |
+
selected_rows = 0
|
| 545 |
+
for row in dataset:
|
| 546 |
+
text = row.get("text")
|
| 547 |
+
selected_rows += 1
|
| 548 |
+
if isinstance(text, str):
|
| 549 |
+
token_buffer.extend(tokenizer.encode(text, add_special_tokens=False))
|
| 550 |
+
if selected_rows == rows:
|
| 551 |
+
break
|
| 552 |
+
if selected_rows != rows:
|
| 553 |
+
raise RuntimeError(f"could only read {selected_rows}/{rows} SlimPajama rows")
|
| 554 |
+
windows = len(token_buffer) // sequence_length
|
| 555 |
+
if windows == 0:
|
| 556 |
+
raise ValueError("selected SlimPajama rows contain fewer tokens than sequence_length")
|
| 557 |
+
batches: list[dict[str, Tensor]] = []
|
| 558 |
+
for index in range(windows):
|
| 559 |
+
start = index * sequence_length
|
| 560 |
+
input_ids = torch.tensor(token_buffer[start : start + sequence_length], dtype=torch.long).unsqueeze(0)
|
| 561 |
+
batches.append({"input_ids": input_ids, "attention_mask": torch.ones_like(input_ids)})
|
| 562 |
+
return batches
|
| 563 |
+
|
| 564 |
+
|
| 565 |
+
def batch_calibration(
|
| 566 |
+
samples: Sequence[dict[str, Tensor]], batch_size: int
|
| 567 |
+
) -> list[dict[str, Tensor]]:
|
| 568 |
+
if batch_size < 1:
|
| 569 |
+
raise ValueError("batch_size must be positive")
|
| 570 |
+
batches = []
|
| 571 |
+
for start in range(0, len(samples), batch_size):
|
| 572 |
+
chunk = samples[start : start + batch_size]
|
| 573 |
+
batches.append({key: torch.cat([item[key] for item in chunk], dim=0) for key in chunk[0]})
|
| 574 |
+
return batches
|
| 575 |
+
|
| 576 |
+
|
| 577 |
+
def save_merge_metadata(
|
| 578 |
+
output_dir: str | Path,
|
| 579 |
+
*,
|
| 580 |
+
source_model: str,
|
| 581 |
+
records: Sequence[MergeRecord],
|
| 582 |
+
arguments: dict,
|
| 583 |
+
) -> None:
|
| 584 |
+
path = Path(output_dir) / "come_pruning.json"
|
| 585 |
+
payload = {
|
| 586 |
+
"method": "CoMe structured pruning (no distillation)",
|
| 587 |
+
"source_model": source_model,
|
| 588 |
+
"arguments": arguments,
|
| 589 |
+
"merges": [asdict(record) for record in records],
|
| 590 |
+
}
|
| 591 |
+
path.write_text(json.dumps(payload, indent=2, ensure_ascii=False) + "\n", encoding="utf-8")
|
| 592 |
+
|
| 593 |
+
|
| 594 |
+
def enable_torch24_dtensor_save_compat() -> None:
|
| 595 |
+
"""Expose PyTorch 2.4's private DTensor where Transformers 4.52 expects it."""
|
| 596 |
+
|
| 597 |
+
try:
|
| 598 |
+
import torch.distributed.tensor as public_tensor
|
| 599 |
+
except ImportError:
|
| 600 |
+
return
|
| 601 |
+
if hasattr(public_tensor, "DTensor"):
|
| 602 |
+
return
|
| 603 |
+
try:
|
| 604 |
+
from torch.distributed._tensor import DTensor
|
| 605 |
+
except ImportError:
|
| 606 |
+
return
|
| 607 |
+
public_tensor.DTensor = DTensor
|
| 608 |
+
# Transformers 4.52 imports this name only when it detects torch >= 2.5,
|
| 609 |
+
# but save_pretrained references it unconditionally on torch 2.4.
|
| 610 |
+
import transformers.modeling_utils as modeling_utils
|
| 611 |
+
|
| 612 |
+
mode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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env python3
|
| 2 |
+
"""Evaluate the lm-eval portion of the requested Llama benchmark suite.
|
| 3 |
+
|
| 4 |
+
RACE-H/M, C3, CMNLI, and CHID are evaluated with their canonical OpenCompass
|
| 5 |
+
PPL task definitions by the companion launcher. This script handles the
|
| 6 |
+
remaining eight tasks plus full zero-shot MMLU and CMMLU.
|
| 7 |
+
"""
|
| 8 |
+
|
| 9 |
+
from __future__ import annotations
|
| 10 |
+
|
| 11 |
+
import argparse
|
| 12 |
+
import json
|
| 13 |
+
import os
|
| 14 |
+
from pathlib import Path
|
| 15 |
+
from typing import Any
|
| 16 |
+
|
| 17 |
+
import torch
|
| 18 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
| 19 |
+
|
| 20 |
+
|
| 21 |
+
TASKS = (
|
| 22 |
+
"piqa",
|
| 23 |
+
"winogrande",
|
| 24 |
+
"hellaswag",
|
| 25 |
+
"arc_challenge",
|
| 26 |
+
"arc_easy",
|
| 27 |
+
"openbookqa",
|
| 28 |
+
"sciq",
|
| 29 |
+
"mmlu",
|
| 30 |
+
"cmmlu",
|
| 31 |
+
)
|
| 32 |
+
|
| 33 |
+
# Use normalized accuracy where the standard harness exposes it. The
|
| 34 |
+
# extraction code falls back to plain accuracy for tasks/versions without it.
|
| 35 |
+
PREFERRED_METRICS = {
|
| 36 |
+
"piqa": "acc_norm,none",
|
| 37 |
+
"hellaswag": "acc_norm,none",
|
| 38 |
+
"arc_challenge": "acc_norm,none",
|
| 39 |
+
"arc_easy": "acc_norm,none",
|
| 40 |
+
"openbookqa": "acc_norm,none",
|
| 41 |
+
"sciq": "acc_norm,none",
|
| 42 |
+
}
|
| 43 |
+
|
| 44 |
+
|
| 45 |
+
def _score(task: str, result: dict[str, Any]) -> tuple[str, float]:
|
| 46 |
+
preferred = PREFERRED_METRICS.get(task, "acc,none")
|
| 47 |
+
candidates = (preferred, "acc_norm,none", "acc,none")
|
| 48 |
+
for metric in candidates:
|
| 49 |
+
value = result.get(metric)
|
| 50 |
+
if value is not None:
|
| 51 |
+
return metric, float(value)
|
| 52 |
+
available = sorted(key for key in result if "," in key and not key.endswith("_stderr,none"))
|
| 53 |
+
raise KeyError(f"No supported accuracy metric for {task}; available={available}")
|
| 54 |
+
|
| 55 |
+
|
| 56 |
+
def _load_model(args: argparse.Namespace):
|
| 57 |
+
if args.compact_stage is None:
|
| 58 |
+
model = AutoModelForCausalLM.from_pretrained(
|
| 59 |
+
args.model,
|
| 60 |
+
revision=args.revision,
|
| 61 |
+
torch_dtype=torch.bfloat16,
|
| 62 |
+
attn_implementation="eager",
|
| 63 |
+
local_files_only=args.local_files_only,
|
| 64 |
+
).cuda().eval()
|
| 65 |
+
tokenizer = AutoTokenizer.from_pretrained(
|
| 66 |
+
args.model,
|
| 67 |
+
revision=args.revision,
|
| 68 |
+
local_files_only=args.local_files_only,
|
| 69 |
+
)
|
| 70 |
+
return model, tokenizer
|
| 71 |
+
|
| 72 |
+
if args.cycle is None or args.anchor is None:
|
| 73 |
+
raise ValueError("--compact-stage requires --cycle and --anchor")
|
| 74 |
+
from fusegpt.abprune_stagewise_geometry import load_compact_model
|
| 75 |
+
|
| 76 |
+
model = load_compact_model(
|
| 77 |
+
args.model,
|
| 78 |
+
args.compact_stage,
|
| 79 |
+
cycle=args.cycle,
|
| 80 |
+
anchor=args.anchor,
|
| 81 |
+
dtype=torch.bfloat16,
|
| 82 |
+
device=torch.device("cuda"),
|
| 83 |
+
attn="eager",
|
| 84 |
+
revision=args.revision,
|
| 85 |
+
)
|
| 86 |
+
tokenizer = AutoTokenizer.from_pretrained(
|
| 87 |
+
args.model, revision=args.revision, local_files_only=args.local_files_only)
|
| 88 |
+
return model, tokenizer
|
| 89 |
+
|
| 90 |
+
|
| 91 |
+
def main() -> None:
|
| 92 |
+
parser = argparse.ArgumentParser()
|
| 93 |
+
parser.add_argument("--model", required=True)
|
| 94 |
+
parser.add_argument("--revision", default=None)
|
| 95 |
+
parser.add_argument("--local-files-only", action="store_true")
|
| 96 |
+
parser.add_argument("--compact-stage", type=Path, default=None)
|
| 97 |
+
parser.add_argument("--cycle", type=int, default=None)
|
| 98 |
+
parser.add_argument("--anchor", type=int, default=None)
|
| 99 |
+
parser.add_argument("--batch-size", default="auto:4")
|
| 100 |
+
parser.add_argument("--limit", type=float, default=None)
|
| 101 |
+
parser.add_argument("--output", type=Path, required=True)
|
| 102 |
+
parser.add_argument("--dataset-cache", type=Path, default=None)
|
| 103 |
+
parser.add_argument("--tasks", nargs="+", choices=TASKS, default=list(TASKS),
|
| 104 |
+
help="Evaluate a subset without repeating already scored tasks")
|
| 105 |
+
args = parser.parse_args()
|
| 106 |
+
if len(set(args.tasks)) != len(args.tasks):
|
| 107 |
+
parser.error("--tasks must not contain duplicates")
|
| 108 |
+
|
| 109 |
+
# CMMLU is still distributed through a Hugging Face dataset loading
|
| 110 |
+
# script. Opt in explicitly so non-interactive experiment jobs do not
|
| 111 |
+
# stop at the datasets trust prompt.
|
| 112 |
+
os.environ.setdefault("HF_DATASETS_TRUST_REMOTE_CODE", "1")
|
| 113 |
+
|
| 114 |
+
from lm_eval import evaluator
|
| 115 |
+
from lm_eval.models.huggingface import HFLM
|
| 116 |
+
|
| 117 |
+
if args.dataset_cache is not None:
|
| 118 |
+
from prepare_lmeval9_local_cache import install_local_loader
|
| 119 |
+
install_local_loader(args.dataset_cache)
|
| 120 |
+
|
| 121 |
+
model, tokenizer = _load_model(args)
|
| 122 |
+
model.config.use_cache = False
|
| 123 |
+
if getattr(model, "generation_config", None) is not None:
|
| 124 |
+
model.generation_config.use_cache = False
|
| 125 |
+
for layer_idx, layer in enumerate(model.model.layers):
|
| 126 |
+
if hasattr(layer, "self_attn") and hasattr(layer.self_attn, "layer_idx"):
|
| 127 |
+
layer.self_attn.layer_idx = layer_idx
|
| 128 |
+
|
| 129 |
+
lm = HFLM(
|
| 130 |
+
pretrained=model,
|
| 131 |
+
tokenizer=tokenizer,
|
| 132 |
+
backend="causal",
|
| 133 |
+
batch_size=args.batch_size,
|
| 134 |
+
)
|
| 135 |
+
raw = evaluator.simple_evaluate(
|
| 136 |
+
model=lm,
|
| 137 |
+
tasks=args.tasks,
|
| 138 |
+
num_fewshot=0,
|
| 139 |
+
batch_size=args.batch_size,
|
| 140 |
+
random_seed=0,
|
| 141 |
+
numpy_random_seed=1234,
|
| 142 |
+
torch_random_seed=1234,
|
| 143 |
+
fewshot_random_seed=1234,
|
| 144 |
+
bootstrap_iters=0,
|
| 145 |
+
limit=args.limit,
|
| 146 |
+
)
|
| 147 |
+
|
| 148 |
+
scores: dict[str, float] = {}
|
| 149 |
+
metrics: dict[str, str] = {}
|
| 150 |
+
for task in args.tasks:
|
| 151 |
+
source = raw.get("groups", {}) if task in {"mmlu", "cmmlu"} else raw["results"]
|
| 152 |
+
if task not in source:
|
| 153 |
+
raise KeyError(
|
| 154 |
+
f"Requested task {task!r} missing from lm-eval results: "
|
| 155 |
+
f"results={sorted(raw['results'])}, groups={sorted(raw.get('groups', {}))}"
|
| 156 |
+
)
|
| 157 |
+
metric, value = _score(task, source[task])
|
| 158 |
+
metrics[task] = metric
|
| 159 |
+
scores[task] = value
|
| 160 |
+
|
| 161 |
+
report = {
|
| 162 |
+
"model": args.model,
|
| 163 |
+
"revision": args.revision,
|
| 164 |
+
"compact_stage": str(args.compact_stage) if args.compact_stage else None,
|
| 165 |
+
"cycle": args.cycle,
|
| 166 |
+
"anchor": args.anchor,
|
| 167 |
+
"tasks": args.tasks,
|
| 168 |
+
"num_fewshot": 0,
|
| 169 |
+
"batch_size": args.batch_size,
|
| 170 |
+
"limit": args.limit,
|
| 171 |
+
"dataset_cache": str(args.dataset_cache) if args.dataset_cache else None,
|
| 172 |
+
"preferred_metrics": metrics,
|
| 173 |
+
"task_scores": scores,
|
| 174 |
+
"macro_mean_all_rows": sum(scores.values()) / len(scores),
|
| 175 |
+
"lm_eval_results": raw["results"],
|
| 176 |
+
"lm_eval_groups": raw.get("groups"),
|
| 177 |
+
"lm_eval_versions": raw.get("versions"),
|
| 178 |
+
"lm_eval_config": raw.get("config"),
|
| 179 |
+
}
|
| 180 |
+
args.output.parent.mkdir(parents=True, exist_ok=True)
|
| 181 |
+
args.output.write_text(
|
| 182 |
+
json.dumps(report, indent=2, ensure_ascii=False, default=str) + "\n",
|
| 183 |
+
encoding="utf-8",
|
| 184 |
+
)
|
| 185 |
+
print(
|
| 186 |
+
json.dumps(
|
| 187 |
+
{"task_scores": scores, "macro_mean_all_rows": report["macro_mean_all_rows"]},
|
| 188 |
+
indent=2,
|
| 189 |
+
)
|
| 190 |
+
)
|
| 191 |
+
|
| 192 |
+
|
| 193 |
+
if __name__ == "__main__":
|
| 194 |
+
main()
|
runs/vast-paper_revision-come-attn-fit-20261126-62646539/20261126-qwen3-base-mka-come-mlp-fit/catalog/code/eval_llama31_fit_ablation_one.sh
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env bash
|
| 2 |
+
set -euo pipefail
|
| 3 |
+
project="$1"; root="$2"; model="$3"; data="$4"; python="$5"
|
| 4 |
+
anchor="$6"; cycles="$7"; gpu="$8"
|
| 5 |
+
stage="$root/compact/stage_$(printf '%02d' "$cycles")"
|
| 6 |
+
export HF_HOME=/workspace/.hf_home HF_TOKEN_PATH=/root/.cache/huggingface/token
|
| 7 |
+
export HF_DATASETS_CACHE=/workspace/.hf_datasets36 HF_DATASETS_TRUST_REMOTE_CODE=1
|
| 8 |
+
export TOKENIZERS_PARALLELISM=false PYTHONUNBUFFERED=1 PYTHONPATH="$project/src"
|
| 9 |
+
revision="${MODEL_REVISION:-49e3418fbbbca6ecbdf9608b4d22e5a407081db4}"
|
| 10 |
+
if [[ -n "${LMEVAL_LOCAL_CACHE:-}" ]]; then
|
| 11 |
+
export HF_HUB_OFFLINE=1 HF_DATASETS_OFFLINE=1 TRANSFORMERS_OFFLINE=1
|
| 12 |
+
[[ -d "$model" ]] || { echo 'Offline bench requires a local model directory'; exit 1; }
|
| 13 |
+
"$python" "$project/scripts/prepare_lmeval9_local_cache.py" "$LMEVAL_LOCAL_CACHE" --validate-local
|
| 14 |
+
for file in race/test/high.jsonl race/test/middle.jsonl CLUE/C3/dev_0.json CLUE/cmnli/cmnli_public/dev.json FewCLUE/chid/dev_few_all.json; do
|
| 15 |
+
[[ -s "$data/$file" ]] || { echo "Offline OpenCompass input missing: $file"; exit 1; }
|
| 16 |
+
done
|
| 17 |
+
echo 'STRICT_OFFLINE_BENCH_PREFLIGHT_OK'
|
| 18 |
+
fi
|
| 19 |
+
opencompass_gpu="$gpu"; lmeval_gpu="${9:-$gpu}"
|
| 20 |
+
if [[ -f "$root/eval/gpu_assignment.json" ]]; then
|
| 21 |
+
read -r opencompass_gpu lmeval_gpu < <("$python" - "$root/eval/gpu_assignment.json" <<'PY'
|
| 22 |
+
import json, sys
|
| 23 |
+
assignment = json.load(open(sys.argv[1]))
|
| 24 |
+
values = [assignment[key] for key in ("opencompass_gpu", "lmeval_gpu")]
|
| 25 |
+
assert all(type(value) is int and value >= 0 for value in values)
|
| 26 |
+
print(*values)
|
| 27 |
+
PY
|
| 28 |
+
)
|
| 29 |
+
fi
|
| 30 |
+
run_opencompass() {
|
| 31 |
+
[[ -f "$root/eval/final_opencompass5.json" ]] && return 0
|
| 32 |
+
CUDA_VISIBLE_DEVICES="$opencompass_gpu" "$python" "$project/scripts/eval_opencompass_ppl_fast.py" \
|
| 33 |
+
--model "$model" --revision "$revision" --tokenizer "$model" \
|
| 34 |
+
--compact-stage "$stage" --cycle "$cycles" --anchor "$anchor" \
|
| 35 |
+
--data-root "$data" --max-batch 32 --token-budget 8192 \
|
| 36 |
+
--output "$root/eval/final_opencompass5.json"
|
| 37 |
+
}
|
| 38 |
+
run_lmeval() {
|
| 39 |
+
[[ -f "$root/eval/final_lmeval9.json" ]] && return 0
|
| 40 |
+
local cache_args=()
|
| 41 |
+
if [[ -n "${LMEVAL_LOCAL_CACHE:-}" ]]; then
|
| 42 |
+
[[ -f "$LMEVAL_LOCAL_CACHE/manifest.json" ]] || return 1
|
| 43 |
+
cache_args=(--dataset-cache "$LMEVAL_LOCAL_CACHE" --local-files-only)
|
| 44 |
+
export HF_HUB_OFFLINE=1 HF_DATASETS_OFFLINE=1
|
| 45 |
+
fi
|
| 46 |
+
CUDA_VISIBLE_DEVICES="$lmeval_gpu" "$python" "$project/scripts/eval_llama31_8b_12bench.py" \
|
| 47 |
+
--model "$model" --revision "$revision" --compact-stage "$stage" \
|
| 48 |
+
--cycle "$cycles" --anchor "$anchor" --batch-size auto:4 \
|
| 49 |
+
--output "$root/eval/final_lmeval9.json" "${cache_args[@]}"
|
| 50 |
+
}
|
| 51 |
+
if [[ "$opencompass_gpu" != "$lmeval_gpu" ]]; then
|
| 52 |
+
echo "Parallel evaluation: OpenCompass GPU=$opencompass_gpu; lm-eval GPU=$lmeval_gpu"
|
| 53 |
+
run_opencompass >> "$root/logs/eval_opencompass.log" 2>&1 & oc_pid=$!
|
| 54 |
+
run_lmeval >> "$root/logs/eval_lmeval.log" 2>&1 & lm_pid=$!
|
| 55 |
+
status=0
|
| 56 |
+
wait "$oc_pid" || status=1
|
| 57 |
+
wait "$lm_pid" || status=1
|
| 58 |
+
if ((status)); then exit 1; fi
|
| 59 |
+
else
|
| 60 |
+
run_opencompass >> "$root/logs/eval14.log" 2>&1
|
| 61 |
+
run_lmeval >> "$root/logs/eval14.log" 2>&1
|
| 62 |
+
fi
|
| 63 |
+
"$python" "$project/scripts/aggregate_transport_rho_fit_14bench.py" "$root"
|
runs/vast-paper_revision-come-attn-fit-20261126-62646539/20261126-qwen3-base-mka-come-mlp-fit/catalog/code/evaluate_abprune_compact_ppl.py
ADDED
|
@@ -0,0 +1,187 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env python3
|
| 2 |
+
"""Evaluate an unscaled or residual-scaled compact ABPrune checkpoint."""
|
| 3 |
+
|
| 4 |
+
from __future__ import annotations
|
| 5 |
+
|
| 6 |
+
import argparse
|
| 7 |
+
import json
|
| 8 |
+
from contextlib import ExitStack
|
| 9 |
+
from pathlib import Path
|
| 10 |
+
import sys
|
| 11 |
+
|
| 12 |
+
from offline_eval_policy import apply_run_offline_policy
|
| 13 |
+
|
| 14 |
+
OFFLINE_POLICY = apply_run_offline_policy(sys.argv)
|
| 15 |
+
|
| 16 |
+
import torch
|
| 17 |
+
|
| 18 |
+
from evaluate_hchc_wikitext2_ppl import evaluate_perplexity, packed_wikitext_tokens
|
| 19 |
+
from fusegpt.abprune_residual_scale import residual_scale_hook
|
| 20 |
+
from fusegpt.abprune_compact import compact_scale_targets, read_compact_metadata
|
| 21 |
+
from fusegpt.abprune_stagewise_geometry import load_compact_model
|
| 22 |
+
from fusegpt.hadamard_channel_fusion import linear_patch_hook
|
| 23 |
+
|
| 24 |
+
|
| 25 |
+
def main() -> None:
|
| 26 |
+
parser = argparse.ArgumentParser()
|
| 27 |
+
parser.add_argument("--model", required=True)
|
| 28 |
+
parser.add_argument("--revision", required=True)
|
| 29 |
+
parser.add_argument("--compact-stage", type=Path, required=True)
|
| 30 |
+
parser.add_argument("--output", type=Path, required=True)
|
| 31 |
+
parser.add_argument("--anchor", type=int, default=None)
|
| 32 |
+
parser.add_argument("--cycles", type=int, required=True)
|
| 33 |
+
parser.add_argument("--original-layers", type=int, required=True)
|
| 34 |
+
parser.add_argument("--seq-len", type=int, default=2048)
|
| 35 |
+
parser.add_argument("--batch-size", type=int, default=4)
|
| 36 |
+
parser.add_argument("--device", default="cuda")
|
| 37 |
+
parser.add_argument("--apply-post-merge-scale", action="store_true")
|
| 38 |
+
parser.add_argument("--linear-patch", type=Path, default=None)
|
| 39 |
+
args = parser.parse_args()
|
| 40 |
+
|
| 41 |
+
# Long training supervisors may be asked to stop after model construction.
|
| 42 |
+
# A run-local marker makes that request durable without killing training.
|
| 43 |
+
run_root = args.output.parent.parent
|
| 44 |
+
if (run_root / "DEFER_EVAL").exists():
|
| 45 |
+
print(f"[eval] deferred by {run_root / 'DEFER_EVAL'}", flush=True)
|
| 46 |
+
raise SystemExit(75)
|
| 47 |
+
|
| 48 |
+
device = torch.device(args.device)
|
| 49 |
+
model = load_compact_model(
|
| 50 |
+
args.model,
|
| 51 |
+
args.compact_stage,
|
| 52 |
+
cycle=args.cycles,
|
| 53 |
+
anchor=args.anchor,
|
| 54 |
+
dtype=torch.bfloat16,
|
| 55 |
+
device=device,
|
| 56 |
+
attn="eager",
|
| 57 |
+
revision=args.revision,
|
| 58 |
+
)
|
| 59 |
+
model.eval()
|
| 60 |
+
expected_depth = args.original_layers - args.cycles
|
| 61 |
+
if len(model.model.layers) != expected_depth:
|
| 62 |
+
raise RuntimeError(
|
| 63 |
+
f"Unexpected decoder depth: {len(model.model.layers)} != {expected_depth}"
|
| 64 |
+
)
|
| 65 |
+
|
| 66 |
+
from transformers import AutoTokenizer
|
| 67 |
+
|
| 68 |
+
if OFFLINE_POLICY and not Path(args.model).is_dir():
|
| 69 |
+
raise ValueError('Strict offline PPL requires a local model directory')
|
| 70 |
+
tokenizer = AutoTokenizer.from_pretrained(
|
| 71 |
+
args.model, revision=args.revision, local_files_only=bool(OFFLINE_POLICY))
|
| 72 |
+
applied_scales = []
|
| 73 |
+
scale_stack = ExitStack()
|
| 74 |
+
linear_patch = None
|
| 75 |
+
if args.apply_post_merge_scale:
|
| 76 |
+
metadata = read_compact_metadata(args.compact_stage)
|
| 77 |
+
targets = compact_scale_targets(metadata)
|
| 78 |
+
if not targets:
|
| 79 |
+
raise RuntimeError(
|
| 80 |
+
"--apply-post-merge-scale requires enabled residual scale metadata"
|
| 81 |
+
)
|
| 82 |
+
for target in targets:
|
| 83 |
+
stored_scale = target["scale"]["cumulative_gamma"]
|
| 84 |
+
applied = (
|
| 85 |
+
torch.tensor(stored_scale, device=device, dtype=torch.float32)
|
| 86 |
+
if isinstance(stored_scale, list)
|
| 87 |
+
else float(stored_scale)
|
| 88 |
+
)
|
| 89 |
+
scale_stack.enter_context(
|
| 90 |
+
residual_scale_hook(model, int(target["student_index"]), applied)
|
| 91 |
+
)
|
| 92 |
+
applied_scales.append(
|
| 93 |
+
{
|
| 94 |
+
"original_layer": int(target["original_layer"]),
|
| 95 |
+
"student_index": int(target["student_index"]),
|
| 96 |
+
"value": applied,
|
| 97 |
+
}
|
| 98 |
+
)
|
| 99 |
+
if args.linear_patch is not None:
|
| 100 |
+
linear_patch = json.loads(args.linear_patch.read_text(encoding="utf-8"))
|
| 101 |
+
patch_scale = torch.tensor(
|
| 102 |
+
linear_patch["scale"], device=device, dtype=torch.float32
|
| 103 |
+
)
|
| 104 |
+
patch_anchor = int(linear_patch["anchor_student_index"])
|
| 105 |
+
scale_stack.enter_context(
|
| 106 |
+
linear_patch_hook(
|
| 107 |
+
model.model.layers[patch_anchor],
|
| 108 |
+
patch_scale,
|
| 109 |
+
hadamard=linear_patch["mode"] == "hadamard",
|
| 110 |
+
)
|
| 111 |
+
)
|
| 112 |
+
|
| 113 |
+
with scale_stack:
|
| 114 |
+
tokens = packed_wikitext_tokens(
|
| 115 |
+
tokenizer, "test", dataset_cache=(
|
| 116 |
+
Path(OFFLINE_POLICY['wikitext_cache']) if OFFLINE_POLICY else None))
|
| 117 |
+
metrics = evaluate_perplexity(
|
| 118 |
+
model=model,
|
| 119 |
+
tokens=tokens,
|
| 120 |
+
sequence_length=args.seq_len,
|
| 121 |
+
batch_size=args.batch_size,
|
| 122 |
+
)
|
| 123 |
+
|
| 124 |
+
report = {
|
| 125 |
+
"model": args.model,
|
| 126 |
+
"revision": args.revision,
|
| 127 |
+
"compact_stage": str(args.compact_stage),
|
| 128 |
+
"dataset": "Salesforce/wikitext:wikitext-2-raw-v1:test",
|
| 129 |
+
"offline_policy": OFFLINE_POLICY,
|
| 130 |
+
"protocol": (
|
| 131 |
+
"HCHC experiment.py: filter empty rows, join with double newline, "
|
| 132 |
+
"then tokenize the complete stream once"
|
| 133 |
+
),
|
| 134 |
+
"sequence_length": args.seq_len,
|
| 135 |
+
"batch_size": args.batch_size,
|
| 136 |
+
"dtype": "bfloat16",
|
| 137 |
+
"metrics": metrics,
|
| 138 |
+
"anchor": args.anchor,
|
| 139 |
+
"cycles": args.cycles,
|
| 140 |
+
"original_layers": args.original_layers,
|
| 141 |
+
"decoder_layers": len(model.model.layers),
|
| 142 |
+
"post_merge_residual_scale": (
|
| 143 |
+
applied_scales[0]["value"].tolist()
|
| 144 |
+
if len(applied_scales) == 1
|
| 145 |
+
and torch.is_tensor(applied_scales[0]["value"])
|
| 146 |
+
else (
|
| 147 |
+
applied_scales[0]["value"]
|
| 148 |
+
if len(applied_scales) == 1
|
| 149 |
+
else None
|
| 150 |
+
)
|
| 151 |
+
),
|
| 152 |
+
"post_merge_residual_scales": [
|
| 153 |
+
{
|
| 154 |
+
"original_layer": item["original_layer"],
|
| 155 |
+
"student_index": item["student_index"],
|
| 156 |
+
"parameterization": (
|
| 157 |
+
"vector" if torch.is_tensor(item["value"]) else "scalar"
|
| 158 |
+
),
|
| 159 |
+
"value": (
|
| 160 |
+
item["value"].tolist()
|
| 161 |
+
if torch.is_tensor(item["value"])
|
| 162 |
+
else item["value"]
|
| 163 |
+
),
|
| 164 |
+
}
|
| 165 |
+
for item in applied_scales
|
| 166 |
+
],
|
| 167 |
+
"parameterization": (
|
| 168 |
+
"X_interface <- X_interface H D H.T"
|
| 169 |
+
if linear_patch and linear_patch["mode"] == "hadamard"
|
| 170 |
+
else (
|
| 171 |
+
"X_interface <- X_interface D"
|
| 172 |
+
if linear_patch
|
| 173 |
+
else (
|
| 174 |
+
"h_out = h_in + gamma * (block(h_in) - h_in)"
|
| 175 |
+
if applied_scales else "unscaled compact ABPrune"
|
| 176 |
+
)
|
| 177 |
+
)
|
| 178 |
+
),
|
| 179 |
+
"linear_patch": linear_patch,
|
| 180 |
+
}
|
| 181 |
+
args.output.parent.mkdir(parents=True, exist_ok=True)
|
| 182 |
+
args.output.write_text(json.dumps(report, indent=2) + "\n", encoding="utf-8")
|
| 183 |
+
print(json.dumps(report, indent=2), flush=True)
|
| 184 |
+
|
| 185 |
+
|
| 186 |
+
if __name__ == "__main__":
|
| 187 |
+
main()
|
runs/vast-paper_revision-come-attn-fit-20261126-62646539/20261126-qwen3-base-mka-come-mlp-fit/catalog/code/evaluate_hchc_wikitext2_ppl.py
ADDED
|
@@ -0,0 +1,152 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env python3
|
| 2 |
+
"""Evaluate a saved causal LM with the HCHC WikiText-2 PPL protocol."""
|
| 3 |
+
|
| 4 |
+
from __future__ import annotations
|
| 5 |
+
|
| 6 |
+
import argparse
|
| 7 |
+
import json
|
| 8 |
+
import math
|
| 9 |
+
from pathlib import Path
|
| 10 |
+
from typing import Any
|
| 11 |
+
|
| 12 |
+
import torch
|
| 13 |
+
from datasets import load_dataset, load_from_disk
|
| 14 |
+
|
| 15 |
+
|
| 16 |
+
def primary(output: Any) -> torch.Tensor:
|
| 17 |
+
if torch.is_tensor(output):
|
| 18 |
+
return output
|
| 19 |
+
if isinstance(output, (tuple, list)) and output and torch.is_tensor(output[0]):
|
| 20 |
+
return output[0]
|
| 21 |
+
raise TypeError(f"Unsupported decoder-layer output type: {type(output)!r}")
|
| 22 |
+
|
| 23 |
+
|
| 24 |
+
def replace_primary(output: Any, hidden: torch.Tensor) -> Any:
|
| 25 |
+
if torch.is_tensor(output):
|
| 26 |
+
return hidden
|
| 27 |
+
if isinstance(output, tuple):
|
| 28 |
+
return (hidden, *output[1:])
|
| 29 |
+
if isinstance(output, list):
|
| 30 |
+
return [hidden, *output[1:]]
|
| 31 |
+
raise TypeError(f"Unsupported decoder-layer output type: {type(output)!r}")
|
| 32 |
+
|
| 33 |
+
|
| 34 |
+
def register_residual_scale_hook(layer, gamma: float):
|
| 35 |
+
"""Install h_out = h_in + gamma * (block(h_in) - h_in)."""
|
| 36 |
+
scale = torch.tensor(gamma, device=next(layer.parameters()).device)
|
| 37 |
+
|
| 38 |
+
def hook(_module, inputs, output):
|
| 39 |
+
if not inputs or not torch.is_tensor(inputs[0]):
|
| 40 |
+
raise RuntimeError("Could not capture decoder-layer residual input")
|
| 41 |
+
layer_input = inputs[0]
|
| 42 |
+
corrected = layer_input + scale * (primary(output) - layer_input)
|
| 43 |
+
return replace_primary(output, corrected)
|
| 44 |
+
|
| 45 |
+
return layer.register_forward_hook(hook)
|
| 46 |
+
|
| 47 |
+
|
| 48 |
+
def packed_wikitext_tokens(tokenizer, split: str, *, dataset_cache: Path | None = None) -> torch.Tensor:
|
| 49 |
+
"""Reproduce the canonical HCHC WikiText-2 packing protocol."""
|
| 50 |
+
if dataset_cache is not None:
|
| 51 |
+
dataset = load_from_disk(str(dataset_cache))[split]
|
| 52 |
+
else:
|
| 53 |
+
dataset = load_dataset(
|
| 54 |
+
"Salesforce/wikitext", "wikitext-2-raw-v1", split=split
|
| 55 |
+
)
|
| 56 |
+
text = "\n\n".join(row for row in dataset["text"] if row.strip())
|
| 57 |
+
return tokenizer(
|
| 58 |
+
text, add_special_tokens=False, return_tensors="pt"
|
| 59 |
+
).input_ids[0]
|
| 60 |
+
|
| 61 |
+
|
| 62 |
+
@torch.no_grad()
|
| 63 |
+
def evaluate_perplexity(
|
| 64 |
+
model,
|
| 65 |
+
tokens: torch.Tensor,
|
| 66 |
+
sequence_length: int,
|
| 67 |
+
batch_size: int,
|
| 68 |
+
) -> dict[str, float | int]:
|
| 69 |
+
num_sequences = tokens.numel() // sequence_length
|
| 70 |
+
ids = tokens[: num_sequences * sequence_length].view(num_sequences, sequence_length)
|
| 71 |
+
total_nll = 0.0
|
| 72 |
+
total_predicted_tokens = 0
|
| 73 |
+
model.eval()
|
| 74 |
+
for start in range(0, num_sequences, batch_size):
|
| 75 |
+
batch = ids[start : start + batch_size].to("cuda")
|
| 76 |
+
output = model(input_ids=batch, labels=batch, use_cache=False)
|
| 77 |
+
predicted = batch.shape[0] * (batch.shape[1] - 1)
|
| 78 |
+
total_nll += output.loss.float().item() * predicted
|
| 79 |
+
total_predicted_tokens += predicted
|
| 80 |
+
mean_nll = total_nll / total_predicted_tokens
|
| 81 |
+
return {
|
| 82 |
+
"nll": mean_nll,
|
| 83 |
+
"perplexity": math.exp(mean_nll),
|
| 84 |
+
"tokens": total_predicted_tokens,
|
| 85 |
+
"sequences": num_sequences,
|
| 86 |
+
"source_tokens": int(tokens.numel()),
|
| 87 |
+
}
|
| 88 |
+
|
| 89 |
+
|
| 90 |
+
def main() -> None:
|
| 91 |
+
parser = argparse.ArgumentParser()
|
| 92 |
+
parser.add_argument("--model", type=Path, required=True)
|
| 93 |
+
parser.add_argument("--output", type=Path, required=True)
|
| 94 |
+
parser.add_argument("--sequence-length", type=int, default=2048)
|
| 95 |
+
parser.add_argument("--batch-size", type=int, default=8)
|
| 96 |
+
parser.add_argument("--residual-anchor", type=int)
|
| 97 |
+
parser.add_argument("--residual-gamma", type=float)
|
| 98 |
+
args = parser.parse_args()
|
| 99 |
+
|
| 100 |
+
if (args.residual_anchor is None) != (args.residual_gamma is None):
|
| 101 |
+
parser.error("--residual-anchor and --residual-gamma must be supplied together")
|
| 102 |
+
|
| 103 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
| 104 |
+
|
| 105 |
+
tokenizer = AutoTokenizer.from_pretrained(args.model, local_files_only=True)
|
| 106 |
+
model = AutoModelForCausalLM.from_pretrained(
|
| 107 |
+
args.model,
|
| 108 |
+
torch_dtype=torch.bfloat16,
|
| 109 |
+
local_files_only=True,
|
| 110 |
+
low_cpu_mem_usage=True,
|
| 111 |
+
attn_implementation="sdpa",
|
| 112 |
+
).to("cuda")
|
| 113 |
+
model.config.use_cache = False
|
| 114 |
+
|
| 115 |
+
handle = None
|
| 116 |
+
if args.residual_gamma is not None:
|
| 117 |
+
if args.residual_anchor >= len(model.model.layers):
|
| 118 |
+
raise ValueError(
|
| 119 |
+
f"Residual anchor {args.residual_anchor} is outside decoder depth "
|
| 120 |
+
f"{len(model.model.layers)}"
|
| 121 |
+
)
|
| 122 |
+
handle = register_residual_scale_hook(
|
| 123 |
+
model.model.layers[args.residual_anchor], args.residual_gamma
|
| 124 |
+
)
|
| 125 |
+
|
| 126 |
+
tokens = packed_wikitext_tokens(tokenizer, "test")
|
| 127 |
+
try:
|
| 128 |
+
metrics = evaluate_perplexity(
|
| 129 |
+
model, tokens, args.sequence_length, args.batch_size
|
| 130 |
+
)
|
| 131 |
+
finally:
|
| 132 |
+
if handle is not None:
|
| 133 |
+
handle.remove()
|
| 134 |
+
|
| 135 |
+
report = {
|
| 136 |
+
"model": str(args.model),
|
| 137 |
+
"dataset": "Salesforce/wikitext:wikitext-2-raw-v1:test",
|
| 138 |
+
"protocol": "HCHC experiment.py: non-empty rows joined with double newline before one-shot tokenization",
|
| 139 |
+
"sequence_length": args.sequence_length,
|
| 140 |
+
"batch_size": args.batch_size,
|
| 141 |
+
"dtype": "bfloat16",
|
| 142 |
+
"residual_anchor": args.residual_anchor,
|
| 143 |
+
"residual_gamma": args.residual_gamma,
|
| 144 |
+
"metrics": metrics,
|
| 145 |
+
}
|
| 146 |
+
args.output.parent.mkdir(parents=True, exist_ok=True)
|
| 147 |
+
args.output.write_text(json.dumps(report, indent=2) + "\n", encoding="utf-8")
|
| 148 |
+
print(json.dumps(report, indent=2), flush=True)
|
| 149 |
+
|
| 150 |
+
|
| 151 |
+
if __name__ == "__main__":
|
| 152 |
+
main()
|
runs/vast-paper_revision-come-attn-fit-20261126-62646539/20261126-qwen3-base-mka-come-mlp-fit/catalog/code/finalize_qwen_mlp_fit_comparison.py
ADDED
|
@@ -0,0 +1,222 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""Register the completed native Qwen Base MKA/CoMe MLP-only FiT comparison."""
|
| 2 |
+
import csv
|
| 3 |
+
import io
|
| 4 |
+
import json
|
| 5 |
+
import math
|
| 6 |
+
from pathlib import Path
|
| 7 |
+
import re
|
| 8 |
+
import subprocess
|
| 9 |
+
|
| 10 |
+
|
| 11 |
+
RESULT = "qwen3_base_mka_come_mlp_fit_20261126"
|
| 12 |
+
STATE = "qwen3-mlp-fit-20261126"
|
| 13 |
+
MODEL = "Qwen/Qwen3-8B-Base"
|
| 14 |
+
REVISION = "49e3418fbbbca6ecbdf9608b4d22e5a407081db4"
|
| 15 |
+
SESSION = "vast-paper_revision-come-attn-fit-20261126-62646539"
|
| 16 |
+
EXPERIMENT = "20261126-qwen3-base-mka-come-mlp-fit"
|
| 17 |
+
NOTE = "2026-11-26_qwen3-base-mka-come-mlp-fit.md"
|
| 18 |
+
NATIVE_HASHES = {"mka": "4f47034e02892bf464998e540be8bd7bc0718f83f6bc9d354c887cc2874cada9",
|
| 19 |
+
"come": "0e958e9f08255ee1a4bb4f029d8e7af94c8a26c6b31366a9223fb7629ebf53e3"}
|
| 20 |
+
FIT_IDS = "5d9d4cc2f81d8712b932806c0c2b2992dce9bd3e6c7a143f1f670649b8bfe693"
|
| 21 |
+
FIT_MASK = "c8e7f8e30cd532b82e6af4b98d596bc7106f29f9fb2b398b44355e624898a30d"
|
| 22 |
+
TASKS12 = ("race_high", "race_middle", "c3", "cmnli", "chid", "piqa", "winogrande",
|
| 23 |
+
"hellaswag", "arc_challenge", "arc_easy", "openbookqa", "sciq")
|
| 24 |
+
|
| 25 |
+
|
| 26 |
+
def load(path):
|
| 27 |
+
return json.loads(path.read_text(encoding="utf-8-sig"))
|
| 28 |
+
|
| 29 |
+
|
| 30 |
+
def mean12(scores):
|
| 31 |
+
assert set(scores) == set(TASKS12) | {"mmlu", "cmmlu"}
|
| 32 |
+
assert all(math.isfinite(value) and 0 <= value <= 1 for value in scores.values())
|
| 33 |
+
return sum(scores[key] for key in TASKS12) / 12
|
| 34 |
+
|
| 35 |
+
|
| 36 |
+
def validate_metrics(row):
|
| 37 |
+
for key in ("bench12", "mmlu", "cmmlu"):
|
| 38 |
+
assert math.isfinite(row[key]) and 0 <= row[key] <= 1
|
| 39 |
+
assert math.isfinite(row["ppl"]) and row["ppl"] > 0
|
| 40 |
+
if "task_scores" in row:
|
| 41 |
+
assert abs(mean12(row["task_scores"]) - row["bench12"]) < 1e-12
|
| 42 |
+
assert row["task_scores"]["mmlu"] == row["mmlu"]
|
| 43 |
+
assert row["task_scores"]["cmmlu"] == row["cmmlu"]
|
| 44 |
+
|
| 45 |
+
|
| 46 |
+
def main():
|
| 47 |
+
import argparse
|
| 48 |
+
parser = argparse.ArgumentParser(description=__doc__)
|
| 49 |
+
parser.parse_args()
|
| 50 |
+
repo = Path(__file__).resolve().parents[1]
|
| 51 |
+
root = repo / "results" / RESULT
|
| 52 |
+
summary = load(root / "summary.json")
|
| 53 |
+
assert summary["model"] == MODEL and summary["model_revision"] == REVISION
|
| 54 |
+
assert summary["model_variant"] == "Base" and summary["original_layers"] == 36
|
| 55 |
+
assert summary["removed_blocks"] == 9 and summary["fit_scope"] == "mlp" and summary["batch_size"] == 1
|
| 56 |
+
assert len(summary["rows"]) == 2 and {row["arm"] for row in summary["rows"]} == {"mka", "come"}
|
| 57 |
+
audit = load(repo / "outputs" / STATE / "model_backup_audit.json")
|
| 58 |
+
assert audit["verified"] and len(audit["records"]) == 2
|
| 59 |
+
assert all(record["verified"] and record["all_payload_hashes_verified"] for record in audit["records"])
|
| 60 |
+
audited = {(record["path_in_repo"], record["revision"]) for record in audit["records"]}
|
| 61 |
+
source_commit = subprocess.check_output(["git", "rev-parse", "HEAD"], cwd=repo).decode().strip()
|
| 62 |
+
catalog = repo / "results/instruct_pruning_experiment_catalog.csv"
|
| 63 |
+
with catalog.open(encoding="utf-8-sig", newline="") as stream:
|
| 64 |
+
reader = csv.DictReader(stream)
|
| 65 |
+
fields, original_rows = reader.fieldnames, list(reader)
|
| 66 |
+
existing = {row["record_id"]: row for row in original_rows}
|
| 67 |
+
assert len(existing) == len(original_rows)
|
| 68 |
+
|
| 69 |
+
native = load(root / "native_references.json")
|
| 70 |
+
assert native["model"] == MODEL and native["model_revision"] == REVISION and native["removed_blocks"] == 9
|
| 71 |
+
assert len(native["rows"]) == 2
|
| 72 |
+
comparison = []
|
| 73 |
+
for reference in native["rows"]:
|
| 74 |
+
assert reference["model"] == MODEL and reference["removed_blocks"] == 9
|
| 75 |
+
assert reference["fit_scope"] == "none" and reference["accuracy_scale"] == "fraction"
|
| 76 |
+
validate_metrics(reference)
|
| 77 |
+
comparison.append({**reference, "new_run": False})
|
| 78 |
+
assert {row["method"] for row in comparison} == {"MKA without FiT", "CoMe without FiT"}
|
| 79 |
+
mka_reference = next(row for row in comparison if row["method"] == "MKA without FiT")
|
| 80 |
+
assert mka_reference["selection_input_sha256"] == NATIVE_HASHES["mka"]
|
| 81 |
+
|
| 82 |
+
nofit_source = "results/qwen3_8b_base_nofit_bench14_20261009/summary.json"
|
| 83 |
+
nofit = next(row for row in load(repo / nofit_source)["rows"] if row["transport"] == "on")
|
| 84 |
+
assert nofit["model"] == MODEL and nofit["removed_blocks"] == 9 and not nofit["fit"]
|
| 85 |
+
assert abs(mean12(nofit["task_scores"]) - nofit["zs12_avg"]) < 1e-12
|
| 86 |
+
comparison.append({"method": "ABPrune without FiT", "fit_scope": "none", "fit_batch": None,
|
| 87 |
+
"bench12": nofit["zs12_avg"], "mmlu": nofit["mmlu"], "cmmlu": nofit["cmmlu"],
|
| 88 |
+
"ppl": nofit["ppl"], "task_scores": nofit["task_scores"],
|
| 89 |
+
"source": nofit_source + "/on", "new_run": False,
|
| 90 |
+
"hf_path": nofit["backup"]["path_in_repo"], "hf_revision": nofit["backup"]["revision"]})
|
| 91 |
+
ab = existing["qwen3_base_transport_9block"]
|
| 92 |
+
assert ab["model_name"] == MODEL and ab["model_revision"] == REVISION
|
| 93 |
+
assert ab["model_variant"] == "Base" and int(ab["blocks_removed"]) == 9
|
| 94 |
+
ab_scores = {key: float(ab[key]) for key in TASKS12 + ("mmlu", "cmmlu")}
|
| 95 |
+
assert abs(mean12(ab_scores) - float(ab["zs12_mean"])) < 1e-12
|
| 96 |
+
comparison.append({"method": "ABPrune + MLP FiT", "fit_scope": "mlp", "fit_batch": 1,
|
| 97 |
+
"bench12": float(ab["zs12_mean"]), "mmlu": float(ab["mmlu"]),
|
| 98 |
+
"cmmlu": float(ab["cmmlu"]), "ppl": float(ab["ppl"]), "task_scores": ab_scores,
|
| 99 |
+
"source": "results/instruct_pruning_experiment_catalog.csv#qwen3_base_transport_9block",
|
| 100 |
+
"new_run": False, "qualification": "Historical canonical catalog; PPL retained at its recorded six-decimal precision"})
|
| 101 |
+
|
| 102 |
+
additions = []
|
| 103 |
+
for row in summary["rows"]:
|
| 104 |
+
validate_metrics(row)
|
| 105 |
+
arm, receipt = row["arm"], row["backup"]
|
| 106 |
+
assert row["batch_size"] == 1 and row["fit_scope"] == "mlp"
|
| 107 |
+
assert row["optimizer_updates_per_stage"] == 512
|
| 108 |
+
assert row["fit_input_sha256"] == FIT_IDS and row["fit_mask_sha256"] == FIT_MASK
|
| 109 |
+
assert row["selection_input_sha256"] == NATIVE_HASHES[arm]
|
| 110 |
+
assert receipt["verified"] and (receipt["path_in_repo"], receipt["revision"]) in audited
|
| 111 |
+
assert receipt["path_in_repo"] == f"runs/{SESSION}/{EXPERIMENT}/{arm}"
|
| 112 |
+
assert re.fullmatch(r"[0-9a-f]{40}", receipt["revision"])
|
| 113 |
+
execution_commit = (root / arm / "execution_commit.txt").read_text().strip()
|
| 114 |
+
assert re.fullmatch(r"[0-9a-f]{40}", execution_commit)
|
| 115 |
+
assert len(row["cycles"]) == 9
|
| 116 |
+
for fit in row["cycles"]:
|
| 117 |
+
assert fit["trained"] and fit["num_trainable_mlp_gates"] == 3
|
| 118 |
+
assert fit["num_trainable_attn_gates"] == fit["num_trainable_other_gates"] == 0
|
| 119 |
+
assert fit["runtime"]["batch_size"] == 1 and fit["runtime"]["dataset_tokens"] == 524288
|
| 120 |
+
proof = fit["ablation"]
|
| 121 |
+
assert proof["fit_scope"] == "mlp" and not proof["norms_trainable"]
|
| 122 |
+
assert proof["frozen_attention_norm_unchanged"] and not proof["source_feature_transport"]
|
| 123 |
+
frozen = proof["frozen_attention_norm_expected_sha256"]
|
| 124 |
+
assert len(frozen) == 8
|
| 125 |
+
assert proof["frozen_attention_norm_before_sha256"] == proof["frozen_attention_norm_after_sha256"] == frozen
|
| 126 |
+
calibration = ({"samples": 100, "sequence_length": 512, "seed": 0,
|
| 127 |
+
"geometry": "native MKA dynamic adjacent NPIB", "source": "immutable original saved native token cache"}
|
| 128 |
+
if arm == "mka" else
|
| 129 |
+
{"rows": 256, "packed_windows": 94, "sequence_length": 2048, "seed": 10,
|
| 130 |
+
"metric": "angular_last", "minimum_retention": 0, "power": 1, "allow_repeat": True,
|
| 131 |
+
"source": "legacy native loader reconstructed and frozen; original saved token cache absent"})
|
| 132 |
+
calibration.update(dataset="DKYoon/SlimPajama-6B", revision="b5f90f419b7489cdba26fdbc8c022fcb5562f968",
|
| 133 |
+
batch_size=1, input_ids_sha256=NATIVE_HASHES[arm],
|
| 134 |
+
attention_mask_sha256=row["selection_inputs"].get("attention_mask_sha256"))
|
| 135 |
+
settings = {"method": f"native stagewise {arm} + MLP-only FiT", "selection": calibration,
|
| 136 |
+
"training": {"dataset": "DKYoon/SlimPajama-6B", "revision": "b5f90f419b7489cdba26fdbc8c022fcb5562f968",
|
| 137 |
+
"samples": 512, "sequence_length": 1024, "tokens_per_stage": 524288,
|
| 138 |
+
"epochs_per_stage": 1, "batch_size": 1, "grad_accumulation": 1,
|
| 139 |
+
"optimizer_updates_per_stage": 512, "lr": 1e-4, "weight_decay": 0, "clip": 1,
|
| 140 |
+
"hidden_mse": 1, "mlp_mse": 1, "attention_mse": 0, "kl_weight": .02,
|
| 141 |
+
"temperature": 4, "seed": 42, "teacher": "previous_cycle", "scope": "mlp",
|
| 142 |
+
"trainable_projection_tensors": 3, "attention_trainable": False,
|
| 143 |
+
"norms_trainable": False, "input_ids_sha256": FIT_IDS, "mask_sha256": FIT_MASK},
|
| 144 |
+
"initialization": {"attention": "native MKA weighted merge" if arm == "mka" else "native CoMe channel merge",
|
| 145 |
+
"mlp": "native MKA weighted merge" if arm == "mka" else "native CoMe channel merge",
|
| 146 |
+
"qk_norms": "recipient anchor Wa" if arm == "mka" else "CoMe retention-ratio weighted merge",
|
| 147 |
+
"residual_norms": "recipient anchor Wa" if arm == "mka" else "CoMe pair mean",
|
| 148 |
+
"frozen_attention_norm_tensors": 8, "source_feature_transport": False},
|
| 149 |
+
"selection_provenance": summary["selection_provenance"][arm]}
|
| 150 |
+
comparison.append({"method": "MKA + MLP FiT" if arm == "mka" else "CoMe + MLP FiT",
|
| 151 |
+
"label": "MKA + MLP FiT" if arm == "mka" else "CoMe + MLP FiT",
|
| 152 |
+
"fit_scope": "mlp", "fit_batch": 1,
|
| 153 |
+
**{key: row[key] for key in ("bench12", "mmlu", "cmmlu", "ppl", "training_wall_seconds",
|
| 154 |
+
"selection_input_sha256", "fit_input_sha256", "fit_mask_sha256")},
|
| 155 |
+
"source": f"results/{RESULT}/{arm}/final_14bench.json", "new_run": True,
|
| 156 |
+
"hf_path": receipt["path_in_repo"], "hf_revision": receipt["revision"]})
|
| 157 |
+
record_id = f"qwen3_base_{arm}_mlp_fit_batch1_9block_20261126"
|
| 158 |
+
record = {key: "" for key in fields}
|
| 159 |
+
record.update({"record_id": record_id, "model_name": MODEL, "model_revision": REVISION,
|
| 160 |
+
"model_variant": "Base", "method": "MKA+MLP-FiT" if arm == "mka" else "CoMe+MLP-FiT",
|
| 161 |
+
"blocks_removed": 9, "selector": f"Native {arm} frozen calibration; dynamic reselection after stagewise FiT",
|
| 162 |
+
"removed_interval": "non-contiguous; see selection trace", "ppl": row["ppl"],
|
| 163 |
+
"zs12_count": 12, "zs12_mean": row["bench12"], "mmlu": row["mmlu"], "cmmlu": row["cmmlu"],
|
| 164 |
+
"zs12_results_json": json.dumps({key: row["task_scores"][key] for key in TASKS12}, separators=(",", ":")),
|
| 165 |
+
"macro14_mean": sum(row["task_scores"].values()) / 14, "metric_scale": "accuracy_fraction_0_to_1",
|
| 166 |
+
"experiment_settings": f"Native {arm}; FiT512x1024/1epoch/LR1e-4/batch1/seed42/MLP3/frozen-attention-and-all4norms",
|
| 167 |
+
"experiment_settings_json": json.dumps(settings, separators=(",", ":")),
|
| 168 |
+
"experiment_date": "2026-11-26", "status": "complete", "storage_host": SESSION,
|
| 169 |
+
"vast_instance": 62646539, "weight_path": f"/workspace/{STATE}/full/{arm}/compact/stage_09",
|
| 170 |
+
"hf_backup_path": f"hf://LJYAI/paper_revision/{receipt['path_in_repo']}@{receipt['revision']}",
|
| 171 |
+
"backup_status": "verified_huggingface_backup", "journal_commit": source_commit,
|
| 172 |
+
"code_commit": execution_commit,
|
| 173 |
+
"protocol_path": f"hf://LJYAI/paper_revision/{receipt['path_in_repo']}/protocol.md@{receipt['revision']}",
|
| 174 |
+
"ppl_result_path": f"results/{RESULT}/{arm}/final_ppl.json",
|
| 175 |
+
"bench14_result_path": f"results/{RESULT}/{arm}/final_14bench.json",
|
| 176 |
+
"evaluation_protocol": "Qwen Base pinned49e3418; no chat template; WikiText2 packed2048 BF16; canonical OpenCompass5 full-prompt PPL; lm-eval0.4.12 zero-shot auto:4, offline131 cache",
|
| 177 |
+
"experiment_log": "exp_md/" + NOTE,
|
| 178 |
+
"notes": "Native selection retained; exact same512x1024 FiT data/masks as historical Qwen Base controls. Train only3 MLP projections; freeze attention4+QKnorm2+residualnorm2 with exact hashes at all9 stages. CoMe only first-stage native-score equality verified, not an allstage replay; MKA same first pair with documented numerical NPIB/lambda differences. Instance explicitly retained running."})
|
| 179 |
+
record.update(row["task_scores"])
|
| 180 |
+
record = {key: str(value) if value is not None else "" for key, value in record.items() if key in fields}
|
| 181 |
+
if record_id in existing:
|
| 182 |
+
for key in ("zs12_mean", "mmlu", "cmmlu", "ppl", "hf_backup_path", "experiment_settings_json"):
|
| 183 |
+
assert existing[record_id][key] == record[key], f"Existing record conflicts: {record_id}/{key}"
|
| 184 |
+
else:
|
| 185 |
+
additions.append(record)
|
| 186 |
+
assert len(comparison) == 6
|
| 187 |
+
for row in comparison:
|
| 188 |
+
validate_metrics(row)
|
| 189 |
+
comparison_result = {"model": MODEL, "model_revision": REVISION, "removed_blocks": 9,
|
| 190 |
+
"original_layers": 36, "accuracy_scale": "fraction", "rows": comparison,
|
| 191 |
+
"qualification": "Historical controls are not fresh reruns. Native MKA and CoMe keep different geometry/selection calibration. New arms match Qwen Base FiT512x1024 examples/masks/LR/loss/epochs, batch1 and512updates/stage. CoMe reconstructed legacy inputs match first native selection exactly; original saved token cache absent. MKA uses original saved tokens but numerical NPIB/lambda differs slightly with same first selected pair. Do not claim full native replay equivalence or substitute a Bench14 mean for Bench12/MMLU/CMMLU."}
|
| 192 |
+
payload = catalog.read_bytes()
|
| 193 |
+
if additions:
|
| 194 |
+
assert payload.endswith(b"\n")
|
| 195 |
+
buffer = io.StringIO(newline="")
|
| 196 |
+
writer = csv.DictWriter(buffer, fields, quoting=csv.QUOTE_ALL, lineterminator="\n")
|
| 197 |
+
writer.writerows(additions)
|
| 198 |
+
updated = payload + buffer.getvalue().encode("utf-8")
|
| 199 |
+
parsed = list(csv.DictReader(io.StringIO(updated.decode("utf-8-sig"))))
|
| 200 |
+
assert parsed[:len(original_rows)] == original_rows
|
| 201 |
+
assert len(parsed) == len(original_rows) + len(additions)
|
| 202 |
+
assert len({row["record_id"] for row in parsed}) == len(parsed)
|
| 203 |
+
temporary = catalog.with_suffix(".csv.partial")
|
| 204 |
+
temporary.write_bytes(updated)
|
| 205 |
+
temporary.replace(catalog)
|
| 206 |
+
(root / "comparison.json").write_text(json.dumps(comparison_result, indent=2) + "\n", encoding="utf-8")
|
| 207 |
+
with (root / "comparison.csv").open("w", encoding="utf-8-sig", newline="") as stream:
|
| 208 |
+
columns = ["method", "label", "fit_scope", "fit_batch", "bench12_pct", "mmlu_pct", "cmmlu_pct", "ppl",
|
| 209 |
+
"training_wall_seconds", "new_run", "source", "selection_input_sha256", "fit_input_sha256",
|
| 210 |
+
"fit_mask_sha256", "hf_revision"]
|
| 211 |
+
writer = csv.DictWriter(stream, columns)
|
| 212 |
+
writer.writeheader()
|
| 213 |
+
for row in comparison:
|
| 214 |
+
record = {key: row.get(key, "") for key in columns}
|
| 215 |
+
record.update({key + "_pct": row[key] * 100 for key in ("bench12", "mmlu", "cmmlu")})
|
| 216 |
+
writer.writerow(record)
|
| 217 |
+
(root / "backup_audit.json").write_text(json.dumps(audit, indent=2) + "\n", encoding="utf-8")
|
| 218 |
+
print(f"QWEN_MLP_FIT_COMPARISON_WRITTEN rows={len(comparison)} canonical_additions={len(additions)}")
|
| 219 |
+
|
| 220 |
+
|
| 221 |
+
if __name__ == "__main__":
|
| 222 |
+
main()
|
runs/vast-paper_revision-come-attn-fit-20261126-62646539/20261126-qwen3-base-mka-come-mlp-fit/catalog/code/fit_ablation_come.py
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""CoMe initialization for stagewise full-block additive-U fitting.
|
| 2 |
+
|
| 3 |
+
Use native CoMe selection/channel allocation; never mutate the teacher model.
|
| 4 |
+
Instruction calibration trims right padding before native CoMe scoring, so
|
| 5 |
+
angular-last measures the last valid token and channel scores omit padding.
|
| 6 |
+
"""
|
| 7 |
+
from __future__ import annotations
|
| 8 |
+
|
| 9 |
+
import copy
|
| 10 |
+
|
| 11 |
+
import torch
|
| 12 |
+
|
| 13 |
+
from fusegpt import come
|
| 14 |
+
|
| 15 |
+
|
| 16 |
+
def valid_calibration_batches(loader):
|
| 17 |
+
batches = []
|
| 18 |
+
for item in loader:
|
| 19 |
+
ids, masks = (item["input_ids"], item["attention_mask"]) if isinstance(item, dict) else item[:2]
|
| 20 |
+
for row, mask in zip(ids, masks, strict=True):
|
| 21 |
+
n = int(mask.sum())
|
| 22 |
+
if n < 1 or not bool(mask[:n].all()) or bool(mask[n:].any()):
|
| 23 |
+
raise ValueError("CoMe calibration requires nonempty right-padded records")
|
| 24 |
+
batches.append({"input_ids": row[:n][None, :], "attention_mask": mask[:n][None, :]})
|
| 25 |
+
return batches
|
| 26 |
+
|
| 27 |
+
|
| 28 |
+
def select_and_initialize(model, loader, lineage, *, minimum=.97, power=1.):
|
| 29 |
+
scores = come.collect_calibration_scores(
|
| 30 |
+
model, valid_calibration_batches(loader), sbi_metric="angular_last")
|
| 31 |
+
left = come._choose_pair(scores.pair_similarity, lineage, allow_repeat=True)
|
| 32 |
+
indices = [left, left + 1]
|
| 33 |
+
leaves = sum(len(lineage[i]) for i in indices)
|
| 34 |
+
adjusted = minimum ** (1 / (leaves - 1)) if leaves > 2 and minimum > 0 else minimum
|
| 35 |
+
ratios = come.compute_retention_ratios(
|
| 36 |
+
[scores.block_importance[i] for i in indices], power=power, minimum=adjusted)
|
| 37 |
+
# Small block copies only. Native helpers modify these, never the live
|
| 38 |
+
# previous-cycle teacher or the layer objects used to collect scores.
|
| 39 |
+
pair = [copy.deepcopy(model.model.layers[i]).cpu() for i in indices]
|
| 40 |
+
attention = come.merge_attention(pair, ratios, [scores.attention_groups[i] for i in indices])
|
| 41 |
+
mlp = come.merge_mlp(pair, ratios, [scores.mlp_neurons[i] for i in indices])
|
| 42 |
+
come.merge_norms(pair)
|
| 43 |
+
initial = {n: p.detach().float().clone() for n, p in pair[0].named_parameters()}
|
| 44 |
+
audit = {
|
| 45 |
+
"source_lineage": [list(lineage[i]) for i in indices],
|
| 46 |
+
"retention_ratios": ratios, "retained_attention_groups": attention,
|
| 47 |
+
"retained_mlp_neurons": mlp, "pair_score": scores.pair_similarity[left],
|
| 48 |
+
"minimum_retention": minimum, "adjusted_minimum": adjusted,
|
| 49 |
+
"power": power, "allow_repeat": True, "sbi_metric": "angular_last",
|
| 50 |
+
"calibration_padding": "trim_right_padding_before_native_CoMe_scoring",
|
| 51 |
+
"teacher_mutated_during_initialization": False,
|
| 52 |
+
}
|
| 53 |
+
del pair, scores
|
| 54 |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an exact reproduction of the paper: use sequence-level pooled activations,
|
| 4 |
+
recompute geometry after every merge, and resolve NPIB ties back-to-front.
|
| 5 |
+
The seven projection weights are fused; residual and Q/K norms stay at anchor.
|
| 6 |
+
"""
|
| 7 |
+
|
| 8 |
+
from __future__ import annotations
|
| 9 |
+
|
| 10 |
+
import hashlib
|
| 11 |
+
import math
|
| 12 |
+
import random
|
| 13 |
+
from collections.abc import Callable, Iterable, Sequence
|
| 14 |
+
from dataclasses import asdict, dataclass
|
| 15 |
+
|
| 16 |
+
import numpy as np
|
| 17 |
+
import torch
|
| 18 |
+
from scipy.linalg import eigh
|
| 19 |
+
from scipy.spatial.distance import pdist, squareform
|
| 20 |
+
from sklearn.feature_selection import mutual_info_regression
|
| 21 |
+
from sklearn.neighbors import NearestNeighbors
|
| 22 |
+
from torch import Tensor, nn
|
| 23 |
+
|
| 24 |
+
PROJECTION_WEIGHTS = (
|
| 25 |
+
"mlp.down_proj.weight",
|
| 26 |
+
"mlp.up_proj.weight",
|
| 27 |
+
"mlp.gate_proj.weight",
|
| 28 |
+
"self_attn.k_proj.weight",
|
| 29 |
+
"self_attn.o_proj.weight",
|
| 30 |
+
"self_attn.q_proj.weight",
|
| 31 |
+
"self_attn.v_proj.weight",
|
| 32 |
+
)
|
| 33 |
+
UPSTREAM = "https://github.com/SempraETY/Pruning-via-Merging"
|
| 34 |
+
UPSTREAM_COMMIT = "3b60b002a0963266e2f4ca78f133b4e091bc607a"
|
| 35 |
+
|
| 36 |
+
|
| 37 |
+
@dataclass(frozen=True)
|
| 38 |
+
class GeometryConfig:
|
| 39 |
+
sigma: float = 8.0
|
| 40 |
+
alpha: float = 0.5
|
| 41 |
+
dimensions: int = 2
|
| 42 |
+
mi_neighbors: int = 5
|
| 43 |
+
entropy_neighbors: int = 50
|
| 44 |
+
beta: float = 1.0
|
| 45 |
+
seed: int = 0
|
| 46 |
+
pooling: str = "mean"
|
| 47 |
+
|
| 48 |
+
def validate(self) -> None:
|
| 49 |
+
if not math.isfinite(self.sigma) or self.sigma <= 0:
|
| 50 |
+
raise ValueError("sigma must be positive and finite")
|
| 51 |
+
if not math.isfinite(self.alpha) or not 0 <= self.alpha <= 1:
|
| 52 |
+
raise ValueError("alpha must be finite and in [0, 1]")
|
| 53 |
+
if self.dimensions < 1 or min(self.mi_neighbors, self.entropy_neighbors) < 1:
|
| 54 |
+
raise ValueError("dimensions and neighbor counts must be positive")
|
| 55 |
+
if not math.isfinite(self.beta) or self.beta < 0:
|
| 56 |
+
raise ValueError("beta must be non-negative and finite")
|
| 57 |
+
if self.pooling not in {"mean", "last"}:
|
| 58 |
+
raise ValueError("pooling must be 'mean' or 'last'")
|
| 59 |
+
|
| 60 |
+
|
| 61 |
+
def sample_slimpajama(
|
| 62 |
+
tokenizer,
|
| 63 |
+
*,
|
| 64 |
+
samples: int = 100,
|
| 65 |
+
sequence_length: int = 512,
|
| 66 |
+
seed: int = 0,
|
| 67 |
+
revision: str = "b5f90f419b7489cdba26fdbc8c022fcb5562f968",
|
| 68 |
+
shuffle_buffer: int = 10000,
|
| 69 |
+
max_documents: int = 100000,
|
| 70 |
+
documents: Iterable[dict] | None = None,
|
| 71 |
+
) -> tuple[list[dict[str, Tensor]], dict]:
|
| 72 |
+
"""Exactly one random fixed-length, no-BOS window from each distinct document.
|
| 73 |
+
|
| 74 |
+
Unlike CoMe's row-packing loader, ``samples`` is the number of sequences.
|
| 75 |
+
Persist returned IDs and provenance; do not sample again between stages.
|
| 76 |
+
"""
|
| 77 |
+
if min(samples, sequence_length, shuffle_buffer, max_documents) < 1:
|
| 78 |
+
raise ValueError("sampling counts, length and buffer must be positive")
|
| 79 |
+
if documents is None:
|
| 80 |
+
from datasets import load_dataset
|
| 81 |
+
|
| 82 |
+
documents = load_dataset(
|
| 83 |
+
"DKYoon/SlimPajama-6B", revision=revision, split="train", streaming=True
|
| 84 |
+
).shuffle(seed=seed, buffer_size=shuffle_buffer)
|
| 85 |
+
rng = random.Random(seed)
|
| 86 |
+
batches, records, seen = [], [], set()
|
| 87 |
+
iterator = iter(documents)
|
| 88 |
+
try:
|
| 89 |
+
for row_index, row in enumerate(iterator):
|
| 90 |
+
if row_index >= max_documents:
|
| 91 |
+
break
|
| 92 |
+
text = row.get("text")
|
| 93 |
+
if not isinstance(text, str) or not text.strip():
|
| 94 |
+
continue
|
| 95 |
+
digest = hashlib.sha256(text.encode("utf-8")).hexdigest()
|
| 96 |
+
if digest in seen:
|
| 97 |
+
continue
|
| 98 |
+
seen.add(digest)
|
| 99 |
+
ids = tokenizer.encode(text, add_special_tokens=False)
|
| 100 |
+
if len(ids) < sequence_length:
|
| 101 |
+
continue
|
| 102 |
+
start = rng.randrange(len(ids) - sequence_length + 1)
|
| 103 |
+
tensor = torch.tensor(
|
| 104 |
+
ids[start : start + sequence_length], dtype=torch.long
|
| 105 |
+
)[None, :]
|
| 106 |
+
batches.append(
|
| 107 |
+
{"input_ids": tensor, "attention_mask": torch.ones_like(tensor)}
|
| 108 |
+
)
|
| 109 |
+
records.append(
|
| 110 |
+
{
|
| 111 |
+
"stream_row": row_index,
|
| 112 |
+
"document_sha256": digest,
|
| 113 |
+
"document_tokens": len(ids),
|
| 114 |
+
"window_start": start,
|
| 115 |
+
}
|
| 116 |
+
)
|
| 117 |
+
if len(batches) == samples:
|
| 118 |
+
break
|
| 119 |
+
finally:
|
| 120 |
+
close = getattr(iterator, "close", None)
|
| 121 |
+
if close is not None:
|
| 122 |
+
close()
|
| 123 |
+
if len(batches) != samples:
|
| 124 |
+
raise RuntimeError(
|
| 125 |
+
f"Only found {len(batches)}/{samples} distinct sufficiently long documents"
|
| 126 |
+
)
|
| 127 |
+
checksum = hashlib.sha256()
|
| 128 |
+
for batch in batches:
|
| 129 |
+
checksum.update(batch["input_ids"].numpy().astype("<i8").tobytes())
|
| 130 |
+
metadata = {
|
| 131 |
+
"dataset": "DKYoon/SlimPajama-6B",
|
| 132 |
+
"revision": revision,
|
| 133 |
+
"split": "train",
|
| 134 |
+
"samples": samples,
|
| 135 |
+
"sequence_length": sequence_length,
|
| 136 |
+
"seed": seed,
|
| 137 |
+
"shuffle_buffer": shuffle_buffer,
|
| 138 |
+
"add_special_tokens": False,
|
| 139 |
+
"sampling": "one random window per distinct document",
|
| 140 |
+
"input_ids_sha256": checksum.hexdigest(),
|
| 141 |
+
"records": records,
|
| 142 |
+
}
|
| 143 |
+
return batches, metadata
|
| 144 |
+
|
| 145 |
+
|
| 146 |
+
@torch.inference_mode()
|
| 147 |
+
def collect_features(
|
| 148 |
+
model: nn.Module, batches: Sequence[dict[str, Tensor]], *, pooling: str = "mean"
|
| 149 |
+
) -> list[np.ndarray]:
|
| 150 |
+
"""One backbone forward per batch; block hooks avoid hidden-state off-by-one.
|
| 151 |
+
|
| 152 |
+
Collect outputs *before* the final backbone norm, including the final block.
|
| 153 |
+
Pool only valid tokens; activations are CPU float32 after pooling.
|
| 154 |
+
"""
|
| 155 |
+
if pooling not in {"mean", "last"} or not batches:
|
| 156 |
+
raise ValueError("valid pooling and nonempty calibration batches are required")
|
| 157 |
+
layers = model.model.layers
|
| 158 |
+
features: list[list[Tensor]] = [[] for _ in layers]
|
| 159 |
+
current_mask: Tensor | None = None
|
| 160 |
+
|
| 161 |
+
def hook(index):
|
| 162 |
+
def capture(module, inputs, output):
|
| 163 |
+
hidden = output[0] if isinstance(output, (tuple, list)) else output
|
| 164 |
+
mask = current_mask.to(hidden.device, dtype=torch.bool)
|
| 165 |
+
if hidden.shape[:2] != mask.shape or (mask.sum(-1) == 0).any():
|
| 166 |
+
raise ValueError("block output and valid-token mask do not match")
|
| 167 |
+
if pooling == "mean":
|
| 168 |
+
value = (hidden.float() * mask[:, :, None]).sum(1) / mask.sum(1)[
|
| 169 |
+
:, None
|
| 170 |
+
]
|
| 171 |
+
else:
|
| 172 |
+
positions = torch.arange(mask.shape[1], device=mask.device)[None, :]
|
| 173 |
+
last = positions.expand_as(mask).masked_fill(~mask, -1).max(1).values
|
| 174 |
+
value = hidden[
|
| 175 |
+
torch.arange(hidden.shape[0], device=hidden.device), last
|
| 176 |
+
].float()
|
| 177 |
+
if not torch.isfinite(value).all():
|
| 178 |
+
raise FloatingPointError(f"nonfinite activation in block {index}")
|
| 179 |
+
features[index].append(value.cpu())
|
| 180 |
+
|
| 181 |
+
return capture
|
| 182 |
+
|
| 183 |
+
handles = [layer.register_forward_hook(hook(i)) for i, layer in enumerate(layers)]
|
| 184 |
+
was_training = model.training
|
| 185 |
+
model.eval()
|
| 186 |
+
try:
|
| 187 |
+
device = model.get_input_embeddings().weight.device
|
| 188 |
+
for batch in batches:
|
| 189 |
+
prepared = {key: value.to(device) for key, value in batch.items()}
|
| 190 |
+
current_mask = prepared.get(
|
| 191 |
+
"attention_mask", torch.ones_like(prepared["input_ids"])
|
| 192 |
+
)
|
| 193 |
+
model.model(**prepared, use_cache=False, return_dict=True)
|
| 194 |
+
finally:
|
| 195 |
+
for handle in handles:
|
| 196 |
+
handle.remove()
|
| 197 |
+
model.train(was_training)
|
| 198 |
+
expected = sum(batch["input_ids"].shape[0] for batch in batches)
|
| 199 |
+
arrays = [torch.cat(parts, dim=0).numpy() for parts in features]
|
| 200 |
+
if any(array.shape[0] != expected for array in arrays):
|
| 201 |
+
raise RuntimeError("not all calibration examples reached each decoder block")
|
| 202 |
+
return arrays
|
| 203 |
+
|
| 204 |
+
|
| 205 |
+
def diffusion_embedding(
|
| 206 |
+
features: np.ndarray, config: GeometryConfig
|
| 207 |
+
) -> tuple[np.ndarray, dict]:
|
| 208 |
+
"""Correctly shaped sample-by-sample diffusion kernel, following upstream SVD geometry."""
|
| 209 |
+
config.validate()
|
| 210 |
+
x = np.asarray(features, dtype=np.float64)
|
| 211 |
+
if x.ndim != 2 or not np.isfinite(x).all() or len(x) <= config.dimensions + 1:
|
| 212 |
+
raise ValueError(
|
| 213 |
+
"features must be finite [samples, features], samples > dimensions + 1"
|
| 214 |
+
)
|
| 215 |
+
distance = squareform(pdist(x, metric="euclidean"))
|
| 216 |
+
if distance.max() <= np.finfo(float).eps:
|
| 217 |
+
raise ValueError(
|
| 218 |
+
"constant calibration features: cannot estimate manifold geometry"
|
| 219 |
+
)
|
| 220 |
+
kernel = np.exp(-np.sqrt(distance / config.sigma))
|
| 221 |
+
p = kernel.sum(0)
|
| 222 |
+
normalized = kernel / np.outer(p, p) ** config.alpha
|
| 223 |
+
v = np.sqrt(normalized.sum(0))
|
| 224 |
+
operator = normalized / np.outer(v, v)
|
| 225 |
+
condition = float(np.linalg.cond(operator))
|
| 226 |
+
regularization = 1e-6 if not math.isfinite(condition) or condition > 1e12 else 0.0
|
| 227 |
+
if regularization:
|
| 228 |
+
operator += regularization * np.eye(len(x))
|
| 229 |
+
values, vectors = eigh(
|
| 230 |
+
operator, subset_by_index=(len(x) - config.dimensions - 1, len(x) - 1)
|
| 231 |
+
)
|
| 232 |
+
values, vectors = values[::-1], vectors[:, ::-1]
|
| 233 |
+
# Fix arbitrary eigenvector signs; the leading vector of this positive kernel is positive.
|
| 234 |
+
for dim in range(vectors.shape[1]):
|
| 235 |
+
if vectors[np.argmax(np.abs(vectors[:, dim])), dim] < 0:
|
| 236 |
+
vectors[:, dim] *= -1
|
| 237 |
+
if np.any(np.abs(vectors[:, 0]) < 1e-12):
|
| 238 |
+
raise FloatingPointError(
|
| 239 |
+
"diffusion normalization has a near-zero leading eigenvector"
|
| 240 |
+
)
|
| 241 |
+
embedding = vectors[:, 1:] / vectors[:, :1]
|
| 242 |
+
if not np.isfinite(embedding).all():
|
| 243 |
+
raise FloatingPointError("nonfinite diffusion embedding")
|
| 244 |
+
# Upstream uses per-axis rank normalization before its KNN estimators.
|
| 245 |
+
embedding = np.argsort(
|
| 246 |
+
np.argsort(embedding, axis=0, kind="stable"), axis=0, kind="stable"
|
| 247 |
+
) / len(x)
|
| 248 |
+
return embedding, {
|
| 249 |
+
"samples": len(x),
|
| 250 |
+
"condition_number": condition if math.isfinite(condition) else None,
|
| 251 |
+
"regularization": regularization,
|
| 252 |
+
"eigenvalues": values.tolist(),
|
| 253 |
+
}
|
| 254 |
+
|
| 255 |
+
|
| 256 |
+
def entropy_knn(x: np.ndarray, neighbors: int) -> float:
|
| 257 |
+
"""Upstream differential-entropy estimator, evaluated in log space."""
|
| 258 |
+
n, dimensions = x.shape
|
| 259 |
+
k = min(neighbors, n - 1)
|
| 260 |
+
distances = NearestNeighbors(n_neighbors=k + 1).fit(x).kneighbors(x)[0][:, -1]
|
| 261 |
+
if np.any(distances <= 0) or not np.isfinite(distances).all():
|
| 262 |
+
raise FloatingPointError(
|
| 263 |
+
"duplicate/degenerate manifold points in entropy estimator"
|
| 264 |
+
)
|
| 265 |
+
return float(math.log(n / k) + dimensions * np.log(distances).mean())
|
| 266 |
+
|
| 267 |
+
|
| 268 |
+
def npib_matrix(
|
| 269 |
+
embeddings: Sequence[np.ndarray], config: GeometryConfig
|
| 270 |
+
) -> tuple[np.ndarray, list[float]]:
|
| 271 |
+
"""Match upstream axis-wise MI average and symmetric sqrt(H_i*H_j) normalization.
|
| 272 |
+
|
| 273 |
+
Differential entropies can be negative. Preserve upstream's formula when
|
| 274 |
+
their product is positive; fail clearly for zero/negative products or NaNs.
|
| 275 |
+
This estimator is a heuristic, not a guaranteed [0, 1] similarity.
|
| 276 |
+
"""
|
| 277 |
+
config.validate()
|
| 278 |
+
if not embeddings or len({x.shape for x in embeddings}) != 1:
|
| 279 |
+
raise ValueError("embeddings must have identical sample/coordinate shapes")
|
| 280 |
+
n = len(embeddings[0])
|
| 281 |
+
if n < 3 or any(not np.isfinite(x).all() for x in embeddings):
|
| 282 |
+
raise ValueError("need at least three finite manifold points")
|
| 283 |
+
entropies = [entropy_knn(x, config.entropy_neighbors) for x in embeddings]
|
| 284 |
+
scores = np.empty((len(embeddings), len(embeddings)), dtype=np.float64)
|
| 285 |
+
for i, left in enumerate(embeddings):
|
| 286 |
+
for j in range(i, len(embeddings)):
|
| 287 |
+
right = embeddings[j]
|
| 288 |
+
product = entropies[i] * entropies[j]
|
| 289 |
+
if not math.isfinite(product) or product <= 1e-12:
|
| 290 |
+
raise FloatingPointError(
|
| 291 |
+
f"invalid entropy product at ({i}, {j}): {entropies[i]}, {entropies[j]}"
|
| 292 |
+
)
|
| 293 |
+
mi = np.mean(
|
| 294 |
+
[
|
| 295 |
+
np.mean(
|
| 296 |
+
mutual_info_regression(
|
| 297 |
+
left,
|
| 298 |
+
right[:, dim],
|
| 299 |
+
n_neighbors=min(config.mi_neighbors, n - 1),
|
| 300 |
+
random_state=config.seed,
|
| 301 |
+
)
|
| 302 |
+
)
|
| 303 |
+
for dim in range(right.shape[1])
|
| 304 |
+
]
|
| 305 |
+
)
|
| 306 |
+
scores[i, j] = scores[j, i] = mi / math.sqrt(product)
|
| 307 |
+
if not np.isfinite(scores).all():
|
| 308 |
+
raise FloatingPointError("NPIB contains nonfinite scores")
|
| 309 |
+
return scores, entropies
|
| 310 |
+
|
| 311 |
+
|
| 312 |
+
def upstream_lambda(
|
| 313 |
+
scores: np.ndarray, left: int, right: int, beta: float = 1.0
|
| 314 |
+
) -> float:
|
| 315 |
+
"""Exactly upstream's sigmoid(beta * row_mean_i / (row_mean_i + row_mean_j))."""
|
| 316 |
+
means = np.mean(scores[[left, right]], axis=1)
|
| 317 |
+
total = float(means.sum())
|
| 318 |
+
if not np.isfinite(means).all() or (means < 0).any() or total <= 1e-12:
|
| 319 |
+
raise FloatingPointError(
|
| 320 |
+
"cannot compute upstream lambda from nonpositive/nonfinite row means"
|
| 321 |
+
)
|
| 322 |
+
if not math.isfinite(beta) or beta < 0:
|
| 323 |
+
raise ValueError("beta must be non-negative and finite")
|
| 324 |
+
value = beta * float(means[0]) / total
|
| 325 |
+
return 1.0 / (1.0 + math.exp(-value))
|
| 326 |
+
|
| 327 |
+
|
| 328 |
+
def select_pair(
|
| 329 |
+
scores: np.ndarray,
|
| 330 |
+
*,
|
| 331 |
+
selection: str = "npib",
|
| 332 |
+
protected_first: int = 0,
|
| 333 |
+
protected_last: int = 0,
|
| 334 |
+
) -> int:
|
| 335 |
+
"""Adjacent pairs only; NPIB descending, and deeper pair wins exact ties."""
|
| 336 |
+
n = len(scores)
|
| 337 |
+
if scores.shape != (n, n) or not np.isfinite(scores).all():
|
| 338 |
+
raise ValueError("scores must be a finite square matrix")
|
| 339 |
+
if min(protected_first, protected_last) < 0:
|
| 340 |
+
raise ValueError("protected layer counts must be non-negative")
|
| 341 |
+
candidates = range(protected_first, n - protected_last - 1)
|
| 342 |
+
if not candidates:
|
| 343 |
+
raise ValueError("no eligible adjacent pair remains")
|
| 344 |
+
if selection == "back-to-front":
|
| 345 |
+
return candidates[-1]
|
| 346 |
+
if selection != "npib":
|
| 347 |
+
raise ValueError("selection must be 'npib' or 'back-to-front'")
|
| 348 |
+
return max(candidates, key=lambda i: (float(scores[i, i + 1]), i))
|
| 349 |
+
|
| 350 |
+
|
| 351 |
+
@torch.inference_mode()
|
| 352 |
+
def merge_pair(model: nn.Module, left: int, ratio: float) -> int:
|
| 353 |
+
"""FP32 weighted sum copied into real parameters, then delete the right block."""
|
| 354 |
+
layers = model.model.layers
|
| 355 |
+
if (
|
| 356 |
+
not 0 <= left < len(layers) - 1
|
| 357 |
+
or not math.isfinite(ratio)
|
| 358 |
+
or not 0 <= ratio <= 1
|
| 359 |
+
):
|
| 360 |
+
raise ValueError("invalid adjacent pair or merge ratio")
|
| 361 |
+
destination, source = layers[left], layers[left + 1]
|
| 362 |
+
pairs = []
|
| 363 |
+
for name in PROJECTION_WEIGHTS:
|
| 364 |
+
pairs.append((destination.get_parameter(name), source.get_parameter(name)))
|
| 365 |
+
# Qwen2.5 has Q/K/V biases. Fuse them with the same coefficient;
|
| 366 |
+
# Llama and Qwen3 (bias-free projections) retain their existing behavior.
|
| 367 |
+
module_name = name.rsplit('.', 1)[0]
|
| 368 |
+
a_bias = getattr(destination.get_submodule(module_name), 'bias', None)
|
| 369 |
+
b_bias = getattr(source.get_submodule(module_name), 'bias', None)
|
| 370 |
+
if (a_bias is None) != (b_bias is None):
|
| 371 |
+
raise ValueError('projection bias presence differs between merge layers')
|
| 372 |
+
if a_bias is not None:
|
| 373 |
+
pairs.append((a_bias, b_bias))
|
| 374 |
+
# Validate all shapes/values/config before any model mutation.
|
| 375 |
+
if any(a.shape != b.shape for a, b in pairs):
|
| 376 |
+
raise ValueError("projection shapes differ between merge layers")
|
| 377 |
+
if any(not torch.isfinite(p).all() for pair in pairs for p in pair):
|
| 378 |
+
raise FloatingPointError("nonfinite source weight")
|
| 379 |
+
configs = [model.config, model.model.config]
|
| 380 |
+
for config in configs:
|
| 381 |
+
types = getattr(config, "layer_types", None)
|
| 382 |
+
if types is not None and len(types) != len(layers):
|
| 383 |
+
raise ValueError("config.layer_types length does not match decoder depth")
|
| 384 |
+
changed = 0
|
| 385 |
+
for target, other in pairs:
|
| 386 |
+
merged = torch.lerp(
|
| 387 |
+
other.detach().to(target.device, dtype=torch.float32), target.float(), ratio
|
| 388 |
+
)
|
| 389 |
+
merged = merged.to(target.dtype)
|
| 390 |
+
if not torch.isfinite(merged).all():
|
| 391 |
+
raise FloatingPointError("merge overflow after conversion to model dtype")
|
| 392 |
+
changed += int(not torch.equal(target, merged))
|
| 393 |
+
target.copy_(merged)
|
| 394 |
+
del layers[left + 1]
|
| 395 |
+
handled = set()
|
| 396 |
+
for config in configs:
|
| 397 |
+
if id(config) in handled:
|
| 398 |
+
continue
|
| 399 |
+
handled.add(id(config))
|
| 400 |
+
config.num_hidden_layers = len(layers)
|
| 401 |
+
if getattr(config, "layer_types", None) is not None:
|
| 402 |
+
config.layer_types = list(config.layer_types[: left + 1]) + list(
|
| 403 |
+
config.layer_types[left + 2 :]
|
| 404 |
+
)
|
| 405 |
+
for index, layer in enumerate(layers):
|
| 406 |
+
if hasattr(layer.self_attn, "layer_idx"):
|
| 407 |
+
layer.self_attn.layer_idx = index
|
| 408 |
+
return changed
|
| 409 |
+
|
| 410 |
+
|
| 411 |
+
def progressive_prune(
|
| 412 |
+
model: nn.Module,
|
| 413 |
+
batches: Sequence[dict[str, Tensor]],
|
| 414 |
+
*,
|
| 415 |
+
target_layers: int,
|
| 416 |
+
geometry: GeometryConfig | None = None,
|
| 417 |
+
selection: str = "npib",
|
| 418 |
+
protected_first: int = 0,
|
| 419 |
+
protected_last: int = 0,
|
| 420 |
+
on_stage: Callable[[nn.Module, dict], None] | None = None,
|
| 421 |
+
) -> list[dict]:
|
| 422 |
+
"""Recompute activations/manifolds/NPIB on fixed data after every accepted merge.
|
| 423 |
+
|
| 424 |
+
No threshold or forced fallbacks; stop at the requested exact depth. Repeated
|
| 425 |
+
merging of a previously merged block is allowed and recorded in its lineage.
|
| 426 |
+
"""
|
| 427 |
+
geometry = geometry or GeometryConfig()
|
| 428 |
+
geometry.validate()
|
| 429 |
+
depth = len(model.model.layers)
|
| 430 |
+
if min(protected_first, protected_last) < 0 or not 1 <= target_layers <= depth:
|
| 431 |
+
raise ValueError("invalid target depth or protected counts")
|
| 432 |
+
if target_layers < protected_first + protected_last + 1:
|
| 433 |
+
raise ValueError("target depth would remove protected layers")
|
| 434 |
+
if selection not in {"npib", "back-to-front"}:
|
| 435 |
+
raise ValueError("invalid selection mode")
|
| 436 |
+
lineage = [[i] for i in range(depth)]
|
| 437 |
+
records = []
|
| 438 |
+
model.eval()
|
| 439 |
+
while len(model.model.layers) > target_layers:
|
| 440 |
+
step = len(records) + 1
|
| 441 |
+
print(
|
| 442 |
+
f"MKA stage {step}: collecting features for {len(lineage)} layers",
|
| 443 |
+
flush=True,
|
| 444 |
+
)
|
| 445 |
+
features = collect_features(model, batches, pooling=geometry.pooling)
|
| 446 |
+
results = [diffusion_embedding(x, geometry) for x in features]
|
| 447 |
+
del features
|
| 448 |
+
scores, entropies = npib_matrix([x[0] for x in results], geometry)
|
| 449 |
+
left = select_pair(
|
| 450 |
+
scores,
|
| 451 |
+
selection=selection,
|
| 452 |
+
protected_first=protected_first,
|
| 453 |
+
protected_last=protected_last,
|
| 454 |
+
)
|
| 455 |
+
ratio = upstream_lambda(scores, left, left + 1, geometry.beta)
|
| 456 |
+
record = {
|
| 457 |
+
"step": step,
|
| 458 |
+
"selection": selection,
|
| 459 |
+
"left_index": left,
|
| 460 |
+
"source_layers": [lineage[left][:], lineage[left + 1][:]],
|
| 461 |
+
"pair_npib": float(scores[left, left + 1]),
|
| 462 |
+
"lambda_left": ratio,
|
| 463 |
+
"lambda_right": 1 - ratio,
|
| 464 |
+
"row_means": scores.mean(1).tolist(),
|
| 465 |
+
"npib_matrix": scores.tolist(),
|
| 466 |
+
"entropies": entropies,
|
| 467 |
+
"geometry": asdict(geometry),
|
| 468 |
+
"manifolds": [x[1] for x in results],
|
| 469 |
+
}
|
| 470 |
+
record["changed_parameter_tensors"] = merge_pair(model, left, ratio)
|
| 471 |
+
lineage[left] += lineage.pop(left + 1)
|
| 472 |
+
record["lineage_after"] = [x[:] for x in lineage]
|
| 473 |
+
record["remaining_layers"] = len(lineage)
|
| 474 |
+
records.append(record)
|
| 475 |
+
print(
|
| 476 |
+
f"MKA stage {step}: merge {left}/{left + 1}, NPIB={record['pair_npib']:.6g}, "
|
| 477 |
+
f"lambda={ratio:.6g}, remaining={len(lineage)}",
|
| 478 |
+
flush=True,
|
| 479 |
+
)
|
| 480 |
+
if on_stage is not None:
|
| 481 |
+
on_stage(model, record)
|
| 482 |
+
return records
|
runs/vast-paper_revision-come-attn-fit-20261126-62646539/20261126-qwen3-base-mka-come-mlp-fit/catalog/code/fuse_layers.py
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
runs/vast-paper_revision-come-attn-fit-20261126-62646539/20261126-qwen3-base-mka-come-mlp-fit/catalog/code/fuse_layers_distill.py
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
runs/vast-paper_revision-come-attn-fit-20261126-62646539/20261126-qwen3-base-mka-come-mlp-fit/catalog/code/inspect_qwen_mlp_fit_run.py
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""Read-only compact snapshot of Qwen Base MKA/CoMe nine-stage FiT runs."""
|
| 2 |
+
import argparse
|
| 3 |
+
import json
|
| 4 |
+
from pathlib import Path
|
| 5 |
+
import subprocess
|
| 6 |
+
import time
|
| 7 |
+
|
| 8 |
+
|
| 9 |
+
def log_tail(path):
|
| 10 |
+
with path.open("rb") as stream:
|
| 11 |
+
stream.seek(max(0, path.stat().st_size - 65536))
|
| 12 |
+
text = stream.read().decode("utf-8", errors="replace")
|
| 13 |
+
lines = text.replace("\r", "\n").splitlines()
|
| 14 |
+
return next((line for line in reversed(lines) if line.strip()), "")[-500:]
|
| 15 |
+
|
| 16 |
+
|
| 17 |
+
def main():
|
| 18 |
+
p = argparse.ArgumentParser(description=__doc__)
|
| 19 |
+
p.add_argument("root", type=Path)
|
| 20 |
+
a = p.parse_args()
|
| 21 |
+
root = a.root
|
| 22 |
+
snapshot = {"utc": time.strftime("%Y-%m-%dT%H:%M:%SZ", time.gmtime()),
|
| 23 |
+
"status": json.loads((root / "status.json").read_text()), "arms": {}}
|
| 24 |
+
for name in ("mka", "come"):
|
| 25 |
+
run = root / "full" / name
|
| 26 |
+
audits = sorted((run / "audit").glob("cycle_*_fit.json"))
|
| 27 |
+
row = {"trained_cycles": len(audits), "total_cycles": 9,
|
| 28 |
+
"training_complete": (run / "TRAIN_COMPLETE").exists(),
|
| 29 |
+
"evaluation_complete": (run / "EVAL_COMPLETE").exists(),
|
| 30 |
+
"backup_complete": (run / "BACKUP_COMPLETE").exists()}
|
| 31 |
+
for key, relative in (("training", "logs/train.log"), ("evaluation", "logs/eval14.log")):
|
| 32 |
+
path = run / relative
|
| 33 |
+
if path.exists():
|
| 34 |
+
row[key + "_last_line"] = log_tail(path)
|
| 35 |
+
row[key + "_log_age_seconds"] = time.time() - path.stat().st_mtime
|
| 36 |
+
if audits:
|
| 37 |
+
try:
|
| 38 |
+
row["last_fit_runtime"] = json.loads(audits[-1].read_text()).get("runtime")
|
| 39 |
+
except json.JSONDecodeError:
|
| 40 |
+
# A writer may be publishing this newest audit during the read.
|
| 41 |
+
row["last_fit_audit_pending"] = True
|
| 42 |
+
snapshot["arms"][name] = row
|
| 43 |
+
snapshot["gpu"] = subprocess.check_output(
|
| 44 |
+
["nvidia-smi", "--query-gpu=index,utilization.gpu,memory.used", "--format=csv,noheader"],
|
| 45 |
+
text=True).splitlines()
|
| 46 |
+
print(json.dumps(snapshot, ensure_ascii=True))
|
| 47 |
+
|
| 48 |
+
|
| 49 |
+
if __name__ == "__main__":
|
| 50 |
+
main()
|
runs/vast-paper_revision-come-attn-fit-20261126-62646539/20261126-qwen3-base-mka-come-mlp-fit/catalog/code/launch_llama31_come_fit2.sh
ADDED
|
@@ -0,0 +1,123 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env bash
|
| 2 |
+
set -euo pipefail
|
| 3 |
+
project="$1"; external="$2"; root="$3"; base_model="$4"; inst_model="$5"; alias="$6"
|
| 4 |
+
scope="${7:-full}"; fit=(--fit-full-block); experiment=20261008-llama31-come-fullblock-fit2
|
| 5 |
+
protocol=exp_md/2026-10-08_llama31-come-stagewise-fullblock-fit2.md
|
| 6 |
+
if [[ "$scope" == mlp ]]; then
|
| 7 |
+
fit=(--fit-come-mlp); experiment=20261008-llama31-come-mlp-fit2
|
| 8 |
+
protocol=exp_md/2026-10-08_llama31-come-stagewise-mlp-fit2.md
|
| 9 |
+
elif [[ "$scope" != full ]]; then exit 2; fi
|
| 10 |
+
export HF_HOME=/workspace/.hf_home HF_TOKEN_PATH=/root/.cache/huggingface/token
|
| 11 |
+
export HF_DATASETS_CACHE=/workspace/.hf_datasets36 HF_DATASETS_TRUST_REMOTE_CODE=1
|
| 12 |
+
export PYTHONUNBUFFERED=1 TOKENIZERS_PARALLELISM=false OMP_NUM_THREADS=4
|
| 13 |
+
export PYTHONPATH="$project/src:$external/src"
|
| 14 |
+
mkdir -p "$root"
|
| 15 |
+
trap 'rc=$?; if ((rc)); then touch "$root/FAILED"; fi' EXIT
|
| 16 |
+
while [[ ! -f "$root/DEPS_READY" ]]; do [[ ! -f "$root/BOOTSTRAP_FAILED" ]] || exit 1; sleep 3; done
|
| 17 |
+
python -m pytest -q "$project/tests/test_come.py" > "$root/unit_tests.log" 2>&1
|
| 18 |
+
python "$project/scripts/run_llama31_base_fit_ablation.py" --external-root "$external" \
|
| 19 |
+
--initializer come "${fit[@]}" --audit-root "$root/algebra" --self-test >> "$root/unit_tests.log" 2>&1
|
| 20 |
+
# Evaluation preparation runs independently: it must never block fitting or PPL.
|
| 21 |
+
prepare_eval() (
|
| 22 |
+
[[ ! -f "$root/EVAL_READY" ]] || exit 0
|
| 23 |
+
trap 'rc=$?; if ((rc)); then touch "$root/EVAL_PREP_FAILED"; fi' EXIT
|
| 24 |
+
mkdir -p "$root/eval_data"
|
| 25 |
+
while [[ ! -f "$root/EVAL_ASSETS_READY" ]]; do sleep 3; done
|
| 26 |
+
tar -xzf "$root/opencompass5-data.tar.gz" -C "$root/eval_data"
|
| 27 |
+
if [[ -f "$root/lmeval-cache-131.tar.gz" ]]; then
|
| 28 |
+
mkdir -p "$root/lmeval_cache"
|
| 29 |
+
tar -xzf "$root/lmeval-cache-131.tar.gz" -C "$root/lmeval_cache"
|
| 30 |
+
else
|
| 31 |
+
# Slow SSH cache transfers must not turn into GPU-idle serialization.
|
| 32 |
+
# Warm common archives once, then materialize identical task definitions in
|
| 33 |
+
# parallel. Retry preserves completed source.json caches after extraction races.
|
| 34 |
+
python - <<'PY'
|
| 35 |
+
import datasets
|
| 36 |
+
from concurrent.futures import ThreadPoolExecutor
|
| 37 |
+
jobs=[('cais/mmlu','anatomy'),('haonan-li/cmmlu','anatomy'),('Salesforce/wikitext','wikitext-2-raw-v1')]
|
| 38 |
+
with ThreadPoolExecutor(max_workers=3) as p:
|
| 39 |
+
for f in [p.submit(datasets.load_dataset,*j,trust_remote_code=True) for j in jobs]:f.result()
|
| 40 |
+
PY
|
| 41 |
+
for attempt in 1 2 3; do
|
| 42 |
+
python "$project/scripts/prepare_lmeval9_local_cache.py" "$root/lmeval_cache" --workers 8 && break
|
| 43 |
+
[[ "$attempt" -lt 3 ]] || exit 1
|
| 44 |
+
done
|
| 45 |
+
fi
|
| 46 |
+
HF_HUB_OFFLINE=1 HF_DATASETS_OFFLINE=1 python "$project/scripts/prepare_lmeval9_local_cache.py" \
|
| 47 |
+
"$root/lmeval_cache" --validate-local
|
| 48 |
+
python "$project/scripts/prepare_offline_ppl_cache.py" "$root"
|
| 49 |
+
touch "$root/EVAL_READY"
|
| 50 |
+
)
|
| 51 |
+
prepare_eval > "$root/eval_prepare.log" 2>&1 & eval_pid=$!
|
| 52 |
+
run_job() (
|
| 53 |
+
family="$1"; gpu="$2"; model="$base_model"; revision=d04e592bb4f6aa9cfee91e2e20afa771667e1d4b
|
| 54 |
+
if [[ "$family" == instruct ]]; then model="$inst_model"; revision=0e9e39f249a16976918f6564b8830bc894c89659; fi
|
| 55 |
+
ready="${family^^}_READY"
|
| 56 |
+
trap 'rc=$?; if ((rc)); then touch "$root/FAILED" "$root/${family}_FAILED"; fi' EXIT
|
| 57 |
+
while [[ ! -f "$root/$ready" ]]; do [[ ! -f "$root/BOOTSTRAP_FAILED" ]] || exit 1; sleep 3; done
|
| 58 |
+
smoke="$root/smoke/$family"
|
| 59 |
+
if [[ ! -f "$smoke/SMOKE_VERIFIED" ]]; then
|
| 60 |
+
if [[ ! -f "$smoke/TRAIN_COMPLETE" ]]; then
|
| 61 |
+
bash "$project/scripts/run_llama31_come_fit_arm.sh" "$project" "$external" "$smoke" "$model" "$family" "$gpu" smoke "$scope"
|
| 62 |
+
fi
|
| 63 |
+
python - "$smoke" "$scope" <<'PY'
|
| 64 |
+
import json,sys
|
| 65 |
+
from pathlib import Path
|
| 66 |
+
r=Path(sys.argv[1])
|
| 67 |
+
mlp=sys.argv[2]=='mlp'
|
| 68 |
+
for c in (1,2):
|
| 69 |
+
f=json.loads((r/f'audit/cycle_{c:02d}_fit.json').read_text()); ab=f['ablation']
|
| 70 |
+
assert f['trained'] and f['additive_u'] and ab['fit_scope']==('mlp' if mlp else 'full_block_including_norms')
|
| 71 |
+
assert ab['attention_initialization']=='CoMe_channel_merge' and ab['norms_trainable']==(not mlp)
|
| 72 |
+
assert not ab['fisher_computed'] and not ab['source_feature_transport']
|
| 73 |
+
count=3 if mlp else 9
|
| 74 |
+
assert f['num_trainable_attn_gates']==(0 if mlp else 4) and f['num_trainable_mlp_gates']==3 and f['num_trainable_other_gates']==(0 if mlp else 2)
|
| 75 |
+
for phase in f['first_grad_summary'].values():
|
| 76 |
+
assert phase['u']['num_tensors']==count and phase['u']['num_tensors_without_grad']==0 and phase['u']['l2']>0
|
| 77 |
+
d=f['u_delta_summary']['per_tensor']
|
| 78 |
+
assert len(d)==count and all(v['rms']>0 for v in d.values()), d
|
| 79 |
+
assert sum('layernorm' in k for k in d)==(0 if mlp else 2)
|
| 80 |
+
if mlp:
|
| 81 |
+
assert len(ab['frozen_CoMe_parameters'])==6
|
| 82 |
+
print('TWO_CYCLES_FIT_SCOPE_UPDATES_VERIFIED',sys.argv[2],flush=True)
|
| 83 |
+
PY
|
| 84 |
+
touch "$smoke/SMOKE_VERIFIED"
|
| 85 |
+
fi
|
| 86 |
+
output="$root/full/$family"
|
| 87 |
+
if [[ ! -f "$output/TRAIN_COMPLETE" ]]; then
|
| 88 |
+
bash "$project/scripts/run_llama31_come_fit_arm.sh" "$project" "$external" "$output" "$model" "$family" "$gpu" full "$scope"
|
| 89 |
+
fi
|
| 90 |
+
mkdir -p "$output/eval"
|
| 91 |
+
export MODEL_REVISION="$revision"
|
| 92 |
+
if [[ ! -f "$output/eval/final_ppl.json" ]]; then
|
| 93 |
+
CUDA_VISIBLE_DEVICES="$gpu" python "$project/scripts/evaluate_abprune_compact_ppl.py" \
|
| 94 |
+
--model "$model" --revision "$revision" --compact-stage "$output/compact/stage_08" \
|
| 95 |
+
--anchor 21 --cycles 8 --original-layers 32 --seq-len 2048 --batch-size 8 \
|
| 96 |
+
--output "$output/eval/final_ppl.json" > "$output/logs/ppl.log" 2>&1
|
| 97 |
+
fi
|
| 98 |
+
while [[ ! -f "$root/EVAL_READY" ]]; do [[ ! -f "$root/EVAL_PREP_FAILED" ]] || exit 1; sleep 3; done
|
| 99 |
+
export LMEVAL_LOCAL_CACHE="$root/lmeval_cache"
|
| 100 |
+
bash "$project/scripts/eval_llama31_fit_ablation_one.sh" "$project" "$output" "$model" \
|
| 101 |
+
"$root/eval_data/data" "$(command -v python)" 21 8 "$gpu"
|
| 102 |
+
touch "$output/EVAL_COMPLETE"
|
| 103 |
+
backup="$root/backup/$family"
|
| 104 |
+
if [[ ! -d "$backup" ]]; then
|
| 105 |
+
python "$project/scripts/package_final_fit_backup.py" "$output" "$backup" "$project" "$external" --protocol "$protocol"
|
| 106 |
+
git -C "$project" rev-parse HEAD > "$backup/code/project_commit.txt"
|
| 107 |
+
python "$project/scripts/write_tree_manifest.py" "$backup"
|
| 108 |
+
fi
|
| 109 |
+
# Evaluation stays offline; uploading must explicitly override inherited flags.
|
| 110 |
+
HF_HUB_OFFLINE=0 HF_DATASETS_OFFLINE=0 TRANSFORMERS_OFFLINE=0 \
|
| 111 |
+
python "$project/scripts/upload_verified_hf_tree.py" "$backup" --repo-id LJYAI/paper_revision \
|
| 112 |
+
--path-in-repo "runs/$alias/$experiment/$family" \
|
| 113 |
+
--commit-message "Llama31 $family CoMe stagewise $scope FiT final weights PPL bench14" > "$root/${family}_backup.json"
|
| 114 |
+
touch "$output/BACKUP_COMPLETE"
|
| 115 |
+
)
|
| 116 |
+
run_job base 0 > "$root/base_pipeline.log" 2>&1 & base_pid=$!
|
| 117 |
+
run_job instruct 1 > "$root/instruct_pipeline.log" 2>&1 & inst_pid=$!
|
| 118 |
+
failed=0
|
| 119 |
+
for pid in "$base_pid" "$inst_pid" "$eval_pid"; do wait "$pid" || failed=1; done
|
| 120 |
+
((failed == 0)) || exit 1
|
| 121 |
+
python "$project/scripts/collect_llama31_come_fit2.py" "$root"
|
| 122 |
+
touch "$root/COMPLETE"
|
| 123 |
+
echo "CoMe $scope FiT evaluated/backed up; retain instance pending user instruction."
|
runs/vast-paper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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""Compare native MKA and CoMe Qwen3-8B-Base MLP-only FiT, batch one."""
|
| 2 |
+
import argparse
|
| 3 |
+
from concurrent.futures import ThreadPoolExecutor
|
| 4 |
+
import hashlib
|
| 5 |
+
import json
|
| 6 |
+
import os
|
| 7 |
+
from pathlib import Path
|
| 8 |
+
import shutil
|
| 9 |
+
import subprocess
|
| 10 |
+
import sys
|
| 11 |
+
import threading
|
| 12 |
+
import time
|
| 13 |
+
|
| 14 |
+
|
| 15 |
+
MODEL_ID = "Qwen/Qwen3-8B-Base"
|
| 16 |
+
REVISION = "49e3418fbbbca6ecbdf9608b4d22e5a407081db4"
|
| 17 |
+
FIT_IDS = "5d9d4cc2f81d8712b932806c0c2b2992dce9bd3e6c7a143f1f670649b8bfe693"
|
| 18 |
+
FIT_MASK = "c8e7f8e30cd532b82e6af4b98d596bc7106f29f9fb2b398b44355e624898a30d"
|
| 19 |
+
|
| 20 |
+
|
| 21 |
+
def main():
|
| 22 |
+
parser = argparse.ArgumentParser(description=__doc__)
|
| 23 |
+
for name in ("project", "external", "root"):
|
| 24 |
+
parser.add_argument("--" + name, type=Path, required=True)
|
| 25 |
+
parser.add_argument("--model", required=True)
|
| 26 |
+
parser.add_argument("--session", required=True)
|
| 27 |
+
parser.add_argument("--eval-root", type=Path, required=True)
|
| 28 |
+
for method in ("mka", "come"):
|
| 29 |
+
parser.add_argument(f"--{method}-selection", type=Path, required=True)
|
| 30 |
+
parser.add_argument(f"--{method}-selection-metadata", type=Path)
|
| 31 |
+
parser.add_argument(f"--{method}-selection-hash", required=True)
|
| 32 |
+
parser.add_argument("--come-minimum-retention", type=float, default=0,
|
| 33 |
+
help="Historical native Qwen Base CoMe uses zero, unlike the Llama control")
|
| 34 |
+
parser.add_argument("--expected-fit-hash", default=FIT_IDS)
|
| 35 |
+
parser.add_argument("--expected-fit-mask-hash", default=FIT_MASK)
|
| 36 |
+
parser.add_argument("--smoke-only", action="store_true",
|
| 37 |
+
help="Stop after the two validated one-stage 64-sequence probes")
|
| 38 |
+
parser.add_argument("--experiment-id", default="20261126-qwen3-base-mka-come-mlp-fit")
|
| 39 |
+
parser.add_argument("--protocol", default="exp_md/2026-11-26_qwen3-base-mka-come-mlp-fit.md")
|
| 40 |
+
a = parser.parse_args()
|
| 41 |
+
root = a.root.resolve()
|
| 42 |
+
root.mkdir(parents=True, exist_ok=True)
|
| 43 |
+
assert a.expected_fit_hash == FIT_IDS and a.expected_fit_mask_hash == FIT_MASK
|
| 44 |
+
assert a.come_minimum_retention == 0, "Preserve the historical Qwen Base CoMe minimum retention"
|
| 45 |
+
env = dict(os.environ, HF_HOME="/workspace/.hf_home", HF_TOKEN_PATH="/root/.cache/huggingface/token",
|
| 46 |
+
HF_DATASETS_CACHE="/workspace/.hf_datasets36", HF_DATASETS_TRUST_REMOTE_CODE="1",
|
| 47 |
+
HF_HUB_OFFLINE="1", HF_DATASETS_OFFLINE="1", TRANSFORMERS_OFFLINE="1",
|
| 48 |
+
PYTHONUNBUFFERED="1", TOKENIZERS_PARALLELISM="false", OMP_NUM_THREADS="4",
|
| 49 |
+
PYTHONPATH=f"{a.project}/src:{a.external}/src")
|
| 50 |
+
lock = threading.RLock()
|
| 51 |
+
state = {"experiment": a.experiment_id, "session": a.session, "model": MODEL_ID,
|
| 52 |
+
"model_revision": REVISION, "removed_blocks": 9, "original_layers": 36,
|
| 53 |
+
"fit_scope": "mlp", "fit_batch_size": 1, "scope": ["mka", "come"],
|
| 54 |
+
"phase": "validation", "arms": {}, "auto_return": False,
|
| 55 |
+
"instance_return_policy": "explicit_user_instruction_only"}
|
| 56 |
+
|
| 57 |
+
def save():
|
| 58 |
+
with lock:
|
| 59 |
+
state["updated_utc"] = time.strftime("%Y-%m-%dT%H:%M:%SZ", time.gmtime())
|
| 60 |
+
temporary = root / "status.partial"
|
| 61 |
+
temporary.write_text(json.dumps(state, indent=2) + "\n")
|
| 62 |
+
temporary.replace(root / "status.json")
|
| 63 |
+
|
| 64 |
+
def run(command, log, gpu=None, check=True):
|
| 65 |
+
child = dict(env)
|
| 66 |
+
if gpu is not None:
|
| 67 |
+
child["CUDA_VISIBLE_DEVICES"] = str(gpu)
|
| 68 |
+
log.parent.mkdir(parents=True, exist_ok=True)
|
| 69 |
+
with log.open("a") as stream:
|
| 70 |
+
result = subprocess.run([str(x) for x in command], cwd=a.project, env=child,
|
| 71 |
+
stdout=stream, stderr=subprocess.STDOUT)
|
| 72 |
+
if check and result.returncode:
|
| 73 |
+
raise RuntimeError(f"Command failed ({result.returncode}); see {log}")
|
| 74 |
+
return result.returncode
|
| 75 |
+
|
| 76 |
+
def training_command(method, output, gpu, cycles=9, tokens=524288):
|
| 77 |
+
return ["bash", a.project / "scripts/run_qwen_mlp_fit_arm.sh", a.project, a.external,
|
| 78 |
+
output, a.model, method, root / "calibration" / f"{method}.pt",
|
| 79 |
+
getattr(a, f"{method}_selection_hash"), gpu, cycles, tokens,
|
| 80 |
+
a.expected_fit_hash, a.expected_fit_mask_hash, a.come_minimum_retention]
|
| 81 |
+
|
| 82 |
+
def validate_fit(method, fit, tokens):
|
| 83 |
+
assert fit["trained"] and fit["num_trainable_mlp_gates"] == 3
|
| 84 |
+
assert fit["num_trainable_attn_gates"] == fit["num_trainable_other_gates"] == 0
|
| 85 |
+
audit = fit["ablation"]
|
| 86 |
+
assert audit["fit_scope"] == "mlp" and not audit["norms_trainable"]
|
| 87 |
+
assert audit["attention_initialization"] == ("MKA_merge" if method == "mka" else "CoMe_channel_merge")
|
| 88 |
+
assert not audit["source_feature_transport"] and audit["frozen_attention_norm_unchanged"]
|
| 89 |
+
frozen = audit["frozen_attention_norm_expected_sha256"]
|
| 90 |
+
assert len(frozen) == 8, "Qwen frozen tensors: attention4, QK norms2, residual norms2"
|
| 91 |
+
assert audit["frozen_attention_norm_before_sha256"] == frozen
|
| 92 |
+
assert audit["frozen_attention_norm_after_sha256"] == frozen
|
| 93 |
+
assert fit["runtime"]["batch_size"] == 1 and fit["runtime"]["dataset_tokens"] == tokens
|
| 94 |
+
shapes = fit["runtime"]["actual_forward_shapes"]
|
| 95 |
+
assert shapes and all(name.endswith(":1x1024") for name in shapes), shapes
|
| 96 |
+
assert fit["first_grad_summary"]["joint"]["u"]["num_tensors_without_grad"] == 0
|
| 97 |
+
updates = fit["u_delta_summary"]["per_tensor"]
|
| 98 |
+
assert len(updates) == 3 and all(record["rms"] > 0 for record in updates.values())
|
| 99 |
+
|
| 100 |
+
def validate_inputs(method, output, full=False):
|
| 101 |
+
native = json.loads((output / "audit/selection_inputs.json").read_text())
|
| 102 |
+
assert native["input_ids_sha256"] == getattr(a, f"{method}_selection_hash")
|
| 103 |
+
fingerprints = json.loads((output / "audit/data_fingerprints.json").read_text())
|
| 104 |
+
distill = fingerprints["distill_loader"]
|
| 105 |
+
assert distill["sequences"] == (512 if full else 64)
|
| 106 |
+
if full:
|
| 107 |
+
assert distill["sha256"] == a.expected_fit_hash
|
| 108 |
+
assert distill["attention_mask_sha256"] == a.expected_fit_mask_hash
|
| 109 |
+
return distill
|
| 110 |
+
|
| 111 |
+
def smoke(method, gpu):
|
| 112 |
+
out = root / "probes" / method
|
| 113 |
+
path = out / "audit/cycle_01_fit.json"
|
| 114 |
+
if not ((out / "TRAIN_COMPLETE").exists() and path.is_file()):
|
| 115 |
+
run(training_command(method, out, gpu, cycles=1, tokens=65536), root / f"{method}_smoke.log")
|
| 116 |
+
fit = json.loads(path.read_text())
|
| 117 |
+
validate_fit(method, fit, 65536)
|
| 118 |
+
data = validate_inputs(method, out)
|
| 119 |
+
return {"method": method, "gpu": gpu, "completed": True, "batch_size": 1,
|
| 120 |
+
"fit_runtime": fit["runtime"], "distill_loader": data,
|
| 121 |
+
"frozen_tensor_count": len(fit["ablation"]["frozen_attention_norm_expected_sha256"]),
|
| 122 |
+
"selection": json.loads((out / "audit/selection.json").read_text())}
|
| 123 |
+
|
| 124 |
+
def complete_arm(method, gpu):
|
| 125 |
+
out = root / "full" / method
|
| 126 |
+
with lock:
|
| 127 |
+
state["arms"][method] = {"phase": "training", "gpu": gpu, "batch_size": 1,
|
| 128 |
+
"started_utc": time.strftime("%Y-%m-%dT%H:%M:%SZ", time.gmtime())}
|
| 129 |
+
save()
|
| 130 |
+
if not (out / "TRAIN_COMPLETE").exists():
|
| 131 |
+
started = time.time()
|
| 132 |
+
run(training_command(method, out, gpu), root / f"{method}_pipeline.log")
|
| 133 |
+
(out / "training_elapsed.json").write_text(json.dumps({
|
| 134 |
+
"wall_seconds": time.time() - started,
|
| 135 |
+
"completed_utc": time.strftime("%Y-%m-%dT%H:%M:%SZ", time.gmtime())}, indent=2) + "\n")
|
| 136 |
+
for cycle in range(1, 10):
|
| 137 |
+
validate_fit(method, json.loads((out / "audit" / f"cycle_{cycle:02d}_fit.json").read_text()), 524288)
|
| 138 |
+
validate_inputs(method, out, full=True)
|
| 139 |
+
with lock:
|
| 140 |
+
state["arms"][method]["phase"] = "evaluation"
|
| 141 |
+
save()
|
| 142 |
+
(out / "eval").mkdir(exist_ok=True)
|
| 143 |
+
if not (out / "eval/final_ppl.json").exists():
|
| 144 |
+
run([sys.executable, a.project / "scripts/evaluate_abprune_compact_ppl.py",
|
| 145 |
+
"--model", a.model, "--revision", REVISION, "--compact-stage", out / "compact/stage_09",
|
| 146 |
+
"--anchor", 12, "--cycles", 9, "--original-layers", 36,
|
| 147 |
+
"--seq-len", 2048, "--batch-size", 8, "--output", out / "eval/final_ppl.json"],
|
| 148 |
+
root / f"{method}_ppl.log", gpu)
|
| 149 |
+
evaluation_env = dict(env, LMEVAL_LOCAL_CACHE=str(a.eval_root / "lmeval_cache"), MODEL_REVISION=REVISION)
|
| 150 |
+
with (root / f"{method}_eval.log").open("a") as stream:
|
| 151 |
+
subprocess.run(["bash", str(a.project / "scripts/eval_llama31_fit_ablation_one.sh"),
|
| 152 |
+
str(a.project), str(out), a.model, str(a.eval_root / "eval_data/data"),
|
| 153 |
+
sys.executable, "12", "9", str(gpu)], env=evaluation_env,
|
| 154 |
+
stdout=stream, stderr=subprocess.STDOUT, check=True)
|
| 155 |
+
(out / "EVAL_COMPLETE").touch()
|
| 156 |
+
with lock:
|
| 157 |
+
state["arms"][method]["phase"] = "backup"
|
| 158 |
+
save()
|
| 159 |
+
backup = root / "backup" / method
|
| 160 |
+
if not backup.exists():
|
| 161 |
+
run([sys.executable, a.project / "scripts/package_final_fit_backup.py", out, backup,
|
| 162 |
+
a.project, a.external, "--protocol", a.protocol, "--cycles", 9, "--original-layers", 36],
|
| 163 |
+
root / f"{method}_backup.log")
|
| 164 |
+
for filename in ("launch_qwen_mlp_fit_comparison.py", "run_qwen_mlp_fit_arm.sh",
|
| 165 |
+
"collect_qwen_mlp_fit_comparison.py", "prepare_qwen_mlp_fit_calibrations.py",
|
| 166 |
+
"inspect_qwen_mlp_fit_run.py", "monitor_qwen_mlp_fit_local.ps1"):
|
| 167 |
+
shutil.copy2(a.project / "scripts" / filename, backup / "code" / filename)
|
| 168 |
+
shutil.copy2(a.project / "src/fusegpt/fit_ablation_mka.py", backup / "code/fit_ablation_mka.py")
|
| 169 |
+
for filename in ("selection_provenance.json", "smoke_summary.json", "first_native_validation.json"):
|
| 170 |
+
shutil.copy2(root / filename, backup / filename)
|
| 171 |
+
shutil.copy2(out / "training_elapsed.json", backup / "training_elapsed.json")
|
| 172 |
+
(backup / "code/project_commit.txt").write_text(subprocess.check_output(
|
| 173 |
+
["git", "rev-parse", "HEAD"], cwd=a.project, text=True))
|
| 174 |
+
run([sys.executable, a.project / "scripts/write_tree_manifest.py", backup], root / f"{method}_backup.log")
|
| 175 |
+
upload_env = dict(env, HF_HUB_OFFLINE="0", HF_DATASETS_OFFLINE="0", TRANSFORMERS_OFFLINE="0")
|
| 176 |
+
with (root / f"{method}_backup.json").open("w") as stream:
|
| 177 |
+
subprocess.run([sys.executable, str(a.project / "scripts/upload_verified_hf_tree.py"), str(backup),
|
| 178 |
+
"--repo-id", "LJYAI/paper_revision", "--path-in-repo",
|
| 179 |
+
f"runs/{a.session}/{a.experiment_id}/{method}", "--commit-message",
|
| 180 |
+
f"Native {method} Qwen3 Base MLP-only FiT batch1"], env=upload_env,
|
| 181 |
+
stdout=stream, check=True)
|
| 182 |
+
(out / "BACKUP_COMPLETE").touch()
|
| 183 |
+
with lock:
|
| 184 |
+
state["arms"][method]["phase"] = "complete"
|
| 185 |
+
save()
|
| 186 |
+
|
| 187 |
+
save()
|
| 188 |
+
try:
|
| 189 |
+
import torch
|
| 190 |
+
provenance = {}
|
| 191 |
+
(root / "calibration").mkdir(exist_ok=True)
|
| 192 |
+
for method in ("mka", "come"):
|
| 193 |
+
source = getattr(a, f"{method}_selection")
|
| 194 |
+
batches = torch.load(source, weights_only=True, map_location="cpu")
|
| 195 |
+
checksum, mask_sum = hashlib.sha256(), hashlib.sha256()
|
| 196 |
+
sequences = 0
|
| 197 |
+
lengths = set()
|
| 198 |
+
for batch in batches:
|
| 199 |
+
ids, mask = batch["input_ids"], batch["attention_mask"]
|
| 200 |
+
assert ids.ndim == 2 and ids.shape == mask.shape and bool(mask.any())
|
| 201 |
+
if method == "come":
|
| 202 |
+
assert bool(mask.all()), "Native CoMe windows must be unpadded"
|
| 203 |
+
checksum.update(ids.numpy().astype("<i8").tobytes())
|
| 204 |
+
mask_sum.update(mask.numpy().astype("<i8").tobytes())
|
| 205 |
+
sequences += ids.shape[0]
|
| 206 |
+
lengths.add(ids.shape[1])
|
| 207 |
+
assert checksum.hexdigest() == getattr(a, f"{method}_selection_hash")
|
| 208 |
+
if method == "mka":
|
| 209 |
+
assert sequences == 100 and lengths == {512}
|
| 210 |
+
else:
|
| 211 |
+
assert sequences == 94 and lengths == {2048}
|
| 212 |
+
metadata_path = getattr(a, f"{method}_selection_metadata") or source.with_suffix(".json")
|
| 213 |
+
metadata = json.loads(metadata_path.read_text())
|
| 214 |
+
provenance[method] = {"input_ids_sha256": checksum.hexdigest(),
|
| 215 |
+
"attention_mask_sha256": mask_sum.hexdigest(), "sequences": sequences,
|
| 216 |
+
"sequence_lengths": sorted(lengths), "source": str(source),
|
| 217 |
+
"native_metadata": metadata, "independent_of_fit_loader": True}
|
| 218 |
+
destination = root / "calibration" / f"{method}.pt"
|
| 219 |
+
if source.resolve() != destination.resolve():
|
| 220 |
+
if destination.exists():
|
| 221 |
+
assert destination.read_bytes() == source.read_bytes()
|
| 222 |
+
else:
|
| 223 |
+
shutil.copy2(source, destination)
|
| 224 |
+
destination.with_suffix(".json").write_text(json.dumps(provenance[method], indent=2) + "\n")
|
| 225 |
+
(root / "selection_provenance.json").write_text(json.dumps(provenance, indent=2) + "\n")
|
| 226 |
+
config = json.loads((Path(a.model) / "config.json").read_text())
|
| 227 |
+
assert config["num_hidden_layers"] == 36 and config["model_type"] == "qwen3"
|
| 228 |
+
assert (a.project / a.protocol).is_file()
|
| 229 |
+
policy = json.loads((a.eval_root / "full/batch1/offline_eval.json").read_text())
|
| 230 |
+
assert (Path(policy["wikitext_cache"]) / "dataset_dict.json").is_file()
|
| 231 |
+
for method in ("mka", "come"):
|
| 232 |
+
path = root / "full" / method / "offline_eval.json"
|
| 233 |
+
path.parent.mkdir(parents=True, exist_ok=True)
|
| 234 |
+
path.write_text(json.dumps(policy, indent=2) + "\n")
|
| 235 |
+
for name in ("race/test/high.jsonl", "race/test/middle.jsonl", "CLUE/C3/dev_0.json",
|
| 236 |
+
"CLUE/cmnli/cmnli_public/dev.json", "FewCLUE/chid/dev_few_all.json"):
|
| 237 |
+
assert (a.eval_root / "eval_data/data" / name).is_file(), name
|
| 238 |
+
run([sys.executable, a.project / "scripts/prepare_lmeval9_local_cache.py",
|
| 239 |
+
a.eval_root / "lmeval_cache", "--validate-local"], root / "eval_prepare.log")
|
| 240 |
+
(root / "offline_preflight.json").write_text(json.dumps({
|
| 241 |
+
"eval_root": str(a.eval_root), "strict_offline": True, "lmeval131_validated": True,
|
| 242 |
+
"wikitext_policy": policy}, indent=2) + "\n")
|
| 243 |
+
for method, flag in (("mka", "--fit-mka-mlp"), ("come", "--fit-come-mlp")):
|
| 244 |
+
run([sys.executable, a.project / "scripts/run_llama31_base_fit_ablation.py",
|
| 245 |
+
"--external-root", a.external, "--initializer", method, flag,
|
| 246 |
+
"--original-layers", 36, "--model-id", MODEL_ID, "--base-revision", REVISION,
|
| 247 |
+
"--audit-root", root / "algebra" / method, "--self-test"], root / "tests.log", 0)
|
| 248 |
+
state["phase"] = "smoke"
|
| 249 |
+
save()
|
| 250 |
+
with ThreadPoolExecutor(max_workers=2) as pool:
|
| 251 |
+
results = [pool.submit(smoke, "mka", 0), pool.submit(smoke, "come", 1)]
|
| 252 |
+
probes = [result.result() for result in results]
|
| 253 |
+
assert probes[0]["distill_loader"] == probes[1]["distill_loader"]
|
| 254 |
+
smoke_summary = {"model": MODEL_ID, "batch_size": 1, "samples_per_probe": 64,
|
| 255 |
+
"probes": probes, "full_fit_input_sha256": a.expected_fit_hash,
|
| 256 |
+
"full_fit_mask_sha256": a.expected_fit_mask_hash}
|
| 257 |
+
(root / "smoke_summary.json").write_text(json.dumps(smoke_summary, indent=2) + "\n")
|
| 258 |
+
if a.smoke_only:
|
| 259 |
+
state["phase"] = "smoke_complete"
|
| 260 |
+
save()
|
| 261 |
+
(root / "SMOKE_COMPLETE").touch()
|
| 262 |
+
return
|
| 263 |
+
state["phase"] = "production"
|
| 264 |
+
save()
|
| 265 |
+
with ThreadPoolExecutor(max_workers=2) as pool:
|
| 266 |
+
jobs = [pool.submit(complete_arm, "mka", 0), pool.submit(complete_arm, "come", 1)]
|
| 267 |
+
for job in jobs:
|
| 268 |
+
job.result()
|
| 269 |
+
state["phase"] = "complete"
|
| 270 |
+
save()
|
| 271 |
+
(root / "COMPLETE").touch()
|
| 272 |
+
except Exception as error:
|
| 273 |
+
state["phase"] = "failed"
|
| 274 |
+
state["error"] = str(error)
|
| 275 |
+
save()
|
| 276 |
+
(root / "FAILED").touch()
|
| 277 |
+
raise
|
| 278 |
+
|
| 279 |
+
|
| 280 |
+
if __name__ == "__main__":
|
| 281 |
+
main()
|
runs/vast-paper_revision-come-attn-fit-20261126-62646539/20261126-qwen3-base-mka-come-mlp-fit/catalog/code/monitor_qwen_mlp_fit_local.ps1
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
[CmdletBinding()]
|
| 2 |
+
param(
|
| 3 |
+
[ValidatePattern('^[A-Za-z0-9._-]+$')][string]$HostAlias = 'vast-paper_revision-come-attn-fit-20261126-62646539',
|
| 4 |
+
[ValidateRange(1,86400)][int]$IntervalSeconds = 300,
|
| 5 |
+
[ValidatePattern('^/[A-Za-z0-9._/-]+$')][string]$RemoteProject = '/workspace/paper_revision/sessions/vast-paper_revision-come-attn-fit-20261126-62646539',
|
| 6 |
+
[ValidatePattern('^/[A-Za-z0-9._/-]+$')][string]$RemoteRoot = '/workspace/qwen3-mlp-fit-20261126',
|
| 7 |
+
[string]$StateDirectory,
|
| 8 |
+
[switch]$Once
|
| 9 |
+
)
|
| 10 |
+
$ErrorActionPreference = 'Stop'
|
| 11 |
+
$repo = (Resolve-Path (Join-Path $PSScriptRoot '..')).Path
|
| 12 |
+
if (-not $StateDirectory) { $StateDirectory = Join-Path $repo 'outputs/qwen3-mlp-fit-20261126' }
|
| 13 |
+
[IO.Directory]::CreateDirectory($StateDirectory) | Out-Null
|
| 14 |
+
$log = Join-Path $StateDirectory 'progress.jsonl'
|
| 15 |
+
$remote = "python $RemoteProject/scripts/inspect_qwen_mlp_fit_run.py $RemoteRoot"
|
| 16 |
+
do {
|
| 17 |
+
$snapshot = & ssh -o BatchMode=yes -o ConnectTimeout=20 $HostAlias $remote 2>$null
|
| 18 |
+
if ($LASTEXITCODE -ne 0) { throw 'Read-only SSH progress check failed.' }
|
| 19 |
+
$state = ($snapshot -join "`n") | ConvertFrom-Json
|
| 20 |
+
$snapshot | Add-Content -LiteralPath $log -Encoding utf8
|
| 21 |
+
'{0} 상태={1} 학습단계: mka={2}/9 come={3}/9' -f $state.utc,$state.status.phase,$state.arms.mka.trained_cycles,$state.arms.come.trained_cycles
|
| 22 |
+
if ($Once -or $state.status.phase -in @('complete','failed')) { break }
|
| 23 |
+
Start-Sleep -Seconds $IntervalSeconds
|
| 24 |
+
} while ($true)
|
runs/vast-paper_revision-come-attn-fit-20261126-62646539/20261126-qwen3-base-mka-come-mlp-fit/catalog/code/offline_eval_policy.py
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""Run-local offline policy, applied before importing Hugging Face libraries."""
|
| 2 |
+
import json
|
| 3 |
+
import os
|
| 4 |
+
from pathlib import Path
|
| 5 |
+
|
| 6 |
+
|
| 7 |
+
def apply_run_offline_policy(argv):
|
| 8 |
+
output = None
|
| 9 |
+
for index, value in enumerate(argv):
|
| 10 |
+
if value == '--output' and index + 1 < len(argv):
|
| 11 |
+
output = argv[index + 1]
|
| 12 |
+
elif value.startswith('--output='):
|
| 13 |
+
output = value.split('=', 1)[1]
|
| 14 |
+
if output is None:
|
| 15 |
+
return None
|
| 16 |
+
policy_path = Path(output).parent.parent / 'offline_eval.json'
|
| 17 |
+
if not policy_path.is_file():
|
| 18 |
+
return None
|
| 19 |
+
policy = json.loads(policy_path.read_text())
|
| 20 |
+
cache = Path(policy['wikitext_cache'])
|
| 21 |
+
if not (cache / 'dataset_dict.json').is_file():
|
| 22 |
+
raise FileNotFoundError(f'Offline WikiText cache missing: {cache}; no online fallback')
|
| 23 |
+
for key in ('HF_HUB_OFFLINE', 'HF_DATASETS_OFFLINE', 'TRANSFORMERS_OFFLINE'):
|
| 24 |
+
os.environ[key] = '1'
|
| 25 |
+
print('STRICT_OFFLINE_RUN_POLICY_APPLIED', flush=True)
|
| 26 |
+
return policy
|
runs/vast-paper_revision-come-attn-fit-20261126-62646539/20261126-qwen3-base-mka-come-mlp-fit/catalog/code/package_final_fit_backup.py
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""Final compact reconstruction only; exclude intermediate/duplicate weights."""
|
| 2 |
+
import argparse
|
| 3 |
+
import json
|
| 4 |
+
from pathlib import Path
|
| 5 |
+
import shutil
|
| 6 |
+
|
| 7 |
+
p = argparse.ArgumentParser()
|
| 8 |
+
p.add_argument("run", type=Path)
|
| 9 |
+
p.add_argument("output", type=Path)
|
| 10 |
+
p.add_argument("project", type=Path)
|
| 11 |
+
p.add_argument("external", type=Path)
|
| 12 |
+
p.add_argument("--protocol", default="exp_md/2026-10-08_llama31-come-stagewise-fullblock-fit2.md")
|
| 13 |
+
p.add_argument("--cycles", type=int, default=8)
|
| 14 |
+
p.add_argument("--original-layers", type=int, default=32)
|
| 15 |
+
a = p.parse_args()
|
| 16 |
+
if a.output.exists():
|
| 17 |
+
raise FileExistsError(a.output)
|
| 18 |
+
stage_name = f"stage_{a.cycles:02d}"
|
| 19 |
+
stage = a.run / "compact" / stage_name
|
| 20 |
+
meta = json.loads((stage / "metadata.json").read_text())
|
| 21 |
+
assert meta["stage"] == a.cycles and meta["removed_count"] == a.cycles
|
| 22 |
+
if meta.get("format") == "abprune_compact_stage_v2":
|
| 23 |
+
assert len(meta["active_original_layers"]) == a.original_layers - a.cycles
|
| 24 |
+
expected = {s["state_file"] for s in meta["retained_layer_states"]}
|
| 25 |
+
else:
|
| 26 |
+
assert meta["format"] == "abprune_compact_stage_v1"
|
| 27 |
+
anchor = int(meta["anchor_index"])
|
| 28 |
+
assert meta["removed_original_layers"] == list(range(anchor + 1, anchor + 1 + a.cycles))
|
| 29 |
+
assert anchor + a.cycles < a.original_layers
|
| 30 |
+
expected = {meta["anchor_state_file"]}
|
| 31 |
+
assert expected == {f.name for f in stage.glob("*.pt")}
|
| 32 |
+
assert len(expected) >= 1
|
| 33 |
+
shutil.copytree(stage, a.output / "compact" / stage_name)
|
| 34 |
+
if (a.run / "offline_eval.json").is_file():
|
| 35 |
+
shutil.copy2(a.run / "offline_eval.json", a.output / "offline_eval.json")
|
| 36 |
+
if (a.run.parent.parent / "offline_preflight.json").is_file():
|
| 37 |
+
shutil.copy2(a.run.parent.parent / "offline_preflight.json", a.output / "offline_preflight.json")
|
| 38 |
+
for folder in ("audit", "eval", "logs"):
|
| 39 |
+
shutil.copytree(a.run / folder, a.output / folder)
|
| 40 |
+
for f in (a.run / "run").glob("cycle_*/cycle_metadata.json"):
|
| 41 |
+
d = a.output / "stage_metadata" / f.parent.name
|
| 42 |
+
d.mkdir(parents=True, exist_ok=True)
|
| 43 |
+
shutil.copy2(f, d / f.name)
|
| 44 |
+
code = a.output / "code"
|
| 45 |
+
code.mkdir()
|
| 46 |
+
for name in ("run_llama31_base_fit_ablation.py", "run_llama31_come_fit_arm.sh",
|
| 47 |
+
"bootstrap_llama31_come_fit2.sh", "launch_llama31_come_fit2.sh",
|
| 48 |
+
"package_final_fit_backup.py", "run_external_abprune_instruct_order.py",
|
| 49 |
+
"offline_eval_policy.py", "evaluate_abprune_compact_ppl.py",
|
| 50 |
+
"evaluate_hchc_wikitext2_ppl.py", "eval_llama31_fit_ablation_one.sh",
|
| 51 |
+
"eval_llama31_8b_12bench.py", "prepare_lmeval9_local_cache.py",
|
| 52 |
+
"prepare_offline_ppl_cache.py"):
|
| 53 |
+
shutil.copy2(a.project / "scripts" / name, code / name)
|
| 54 |
+
for name in ("come.py", "fit_ablation_come.py", "abprune_compact.py"):
|
| 55 |
+
shutil.copy2(a.project / "src/fusegpt" / name, code / name)
|
| 56 |
+
for name in ("fuse_layers.py", "fuse_layers_distill.py", "source_feature_transport.py"):
|
| 57 |
+
shutil.copy2(a.external / "src" / name, code / name)
|
| 58 |
+
shutil.copy2(a.project / a.protocol, a.output / "protocol.md")
|
| 59 |
+
assert set(a.output.rglob("*.pt")) == {a.output / "compact" / stage_name / n for n in expected}
|
| 60 |
+
print("FINAL_ONLY_BACKUP", len(expected), "retained blocks", flush=True)
|
runs/vast-paper_revision-come-attn-fit-20261126-62646539/20261126-qwen3-base-mka-come-mlp-fit/catalog/code/prepare_lmeval9_local_cache.py
ADDED
|
@@ -0,0 +1,108 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""Materialize the exact harness datasets once, without changing task definitions."""
|
| 2 |
+
import argparse
|
| 3 |
+
from concurrent.futures import ThreadPoolExecutor, as_completed
|
| 4 |
+
import hashlib
|
| 5 |
+
import json
|
| 6 |
+
from pathlib import Path
|
| 7 |
+
import time
|
| 8 |
+
|
| 9 |
+
import datasets
|
| 10 |
+
from lm_eval.tasks import TaskManager
|
| 11 |
+
|
| 12 |
+
|
| 13 |
+
def cache_key(path, name, kwargs):
|
| 14 |
+
return hashlib.sha256(json.dumps([path, name, kwargs], sort_keys=True).encode()).hexdigest()
|
| 15 |
+
|
| 16 |
+
|
| 17 |
+
def specs():
|
| 18 |
+
manager = TaskManager()
|
| 19 |
+
names = ["piqa", "winogrande", "hellaswag", "arc_challenge", "arc_easy", "openbookqa", "sciq"]
|
| 20 |
+
entries = [manager.task_index[n] for n in names]
|
| 21 |
+
entries += [e for e in manager.task_index.values()
|
| 22 |
+
if e.yaml_path and e.yaml_path.parent.name == "default"
|
| 23 |
+
and (e.cfg or {}).get("dataset_path") == "cais/mmlu"]
|
| 24 |
+
entries += [e for e in manager.task_index.values()
|
| 25 |
+
if (e.cfg or {}).get("dataset_path") == "haonan-li/cmmlu"]
|
| 26 |
+
unique = {}
|
| 27 |
+
for entry in entries:
|
| 28 |
+
cfg = entry.cfg
|
| 29 |
+
path, name, kwargs = cfg["dataset_path"], cfg.get("dataset_name"), cfg.get("dataset_kwargs") or {}
|
| 30 |
+
unique[cache_key(path, name, kwargs)] = {"path": path, "name": name, "kwargs": kwargs}
|
| 31 |
+
assert len(unique) == 131, len(unique)
|
| 32 |
+
return unique
|
| 33 |
+
|
| 34 |
+
|
| 35 |
+
def materialize(root, key, spec, offline):
|
| 36 |
+
target = root / key
|
| 37 |
+
metadata = target / "source.json"
|
| 38 |
+
if metadata.is_file():
|
| 39 |
+
return key, json.loads(metadata.read_text())
|
| 40 |
+
start = time.monotonic()
|
| 41 |
+
try:
|
| 42 |
+
data = datasets.load_dataset(spec["path"], spec["name"], **spec["kwargs"])
|
| 43 |
+
except Exception:
|
| 44 |
+
if offline:
|
| 45 |
+
return key, None
|
| 46 |
+
raise
|
| 47 |
+
data.save_to_disk(str(target))
|
| 48 |
+
report = {**spec, "splits": {k: {"rows": len(v), "fingerprint": v._fingerprint}
|
| 49 |
+
for k, v in data.items()}}
|
| 50 |
+
metadata.write_text(json.dumps(report, indent=2) + "\n")
|
| 51 |
+
restored = datasets.load_from_disk(str(target))
|
| 52 |
+
assert {k: len(v) for k, v in restored.items()} == {k: len(v) for k, v in data.items()}
|
| 53 |
+
assert all(restored[k].features == data[k].features for k in data)
|
| 54 |
+
assert all(restored[k].data.table.equals(data[k].data.table) for k in data)
|
| 55 |
+
print("READY", spec["path"], spec["name"], round(time.monotonic() - start, 2), flush=True)
|
| 56 |
+
return key, report
|
| 57 |
+
|
| 58 |
+
|
| 59 |
+
def install_local_loader(root):
|
| 60 |
+
manifest = json.loads((root / "manifest.json").read_text())
|
| 61 |
+
assert len(manifest) == 131
|
| 62 |
+
memo = {}
|
| 63 |
+
|
| 64 |
+
def local_load(path, name=None, **kwargs):
|
| 65 |
+
key = cache_key(path, name, kwargs)
|
| 66 |
+
if key not in manifest:
|
| 67 |
+
raise RuntimeError(f"Unprepared dataset request: {path}/{name}; no online fallback")
|
| 68 |
+
if key not in memo:
|
| 69 |
+
memo[key] = datasets.load_from_disk(str(root / key))
|
| 70 |
+
print("LOCAL_DATASET", path, name, flush=True)
|
| 71 |
+
return memo[key]
|
| 72 |
+
|
| 73 |
+
datasets.load_dataset = local_load
|
| 74 |
+
|
| 75 |
+
|
| 76 |
+
if __name__ == "__main__":
|
| 77 |
+
parser = argparse.ArgumentParser()
|
| 78 |
+
parser.add_argument("root", type=Path)
|
| 79 |
+
parser.add_argument("--offline-export", action="store_true")
|
| 80 |
+
parser.add_argument("--validate-local", action="store_true",
|
| 81 |
+
help="Validate a complete transferred cache without Hub requests")
|
| 82 |
+
parser.add_argument("--workers", type=int, default=8)
|
| 83 |
+
args = parser.parse_args()
|
| 84 |
+
args.root.mkdir(parents=True, exist_ok=True)
|
| 85 |
+
sources = specs()
|
| 86 |
+
if args.validate_local:
|
| 87 |
+
manifest = json.loads((args.root / "manifest.json").read_text())
|
| 88 |
+
assert set(manifest) == set(sources), "Task configuration mismatch"
|
| 89 |
+
for key, spec in sources.items():
|
| 90 |
+
report = manifest[key]
|
| 91 |
+
assert all(report[k] == v for k, v in spec.items())
|
| 92 |
+
assert json.loads((args.root / key / "source.json").read_text()) == report
|
| 93 |
+
data = datasets.load_from_disk(str(args.root / key))
|
| 94 |
+
assert {k: len(v) for k, v in data.items()} == {
|
| 95 |
+
k: v["rows"] for k, v in report["splits"].items()}
|
| 96 |
+
print("VALIDATED_LOCAL", len(manifest), "NO_HUB_REQUESTS", flush=True)
|
| 97 |
+
raise SystemExit(0)
|
| 98 |
+
completed = {}
|
| 99 |
+
with ThreadPoolExecutor(max_workers=1 if args.offline_export else args.workers) as executor:
|
| 100 |
+
futures = [executor.submit(materialize, args.root, k, v, args.offline_export)
|
| 101 |
+
for k, v in sources.items()]
|
| 102 |
+
for future in as_completed(futures):
|
| 103 |
+
key, result = future.result()
|
| 104 |
+
if result is not None:
|
| 105 |
+
completed[key] = result
|
| 106 |
+
print("PREPARED", len(completed), "OF", len(sources), flush=True)
|
| 107 |
+
if len(completed) == len(sources):
|
| 108 |
+
(args.root / "manifest.json").write_text(json.dumps(completed, indent=2) + "\n")
|
runs/vast-paper_revision-come-attn-fit-20261126-62646539/20261126-qwen3-base-mka-come-mlp-fit/catalog/code/prepare_offline_ppl_cache.py
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""Export the warmed WikiText dataset once; never contact the Hub here."""
|
| 2 |
+
import os
|
| 3 |
+
for key in ('HF_HUB_OFFLINE', 'HF_DATASETS_OFFLINE', 'TRANSFORMERS_OFFLINE'):
|
| 4 |
+
os.environ[key] = '1'
|
| 5 |
+
|
| 6 |
+
import json
|
| 7 |
+
from pathlib import Path
|
| 8 |
+
import sys
|
| 9 |
+
from datasets import load_dataset, load_from_disk
|
| 10 |
+
|
| 11 |
+
root = Path(sys.argv[1])
|
| 12 |
+
source = load_dataset('Salesforce/wikitext', 'wikitext-2-raw-v1')
|
| 13 |
+
cache = root / 'wikitext2_cache'
|
| 14 |
+
if not cache.exists():
|
| 15 |
+
temporary = root / f'wikitext2_cache_partial_{os.getpid()}'
|
| 16 |
+
source.save_to_disk(str(temporary))
|
| 17 |
+
temporary.rename(cache)
|
| 18 |
+
restored = load_from_disk(str(cache))
|
| 19 |
+
assert set(source) == set(restored)
|
| 20 |
+
assert all(source[k].data.table.equals(restored[k].data.table) for k in source)
|
| 21 |
+
policy = {'wikitext_cache': str(cache), 'dataset': 'Salesforce/wikitext',
|
| 22 |
+
'config': 'wikitext-2-raw-v1', 'splits': {k: len(v) for k,v in restored.items()},
|
| 23 |
+
'fingerprints': {k: v._fingerprint for k,v in source.items()}}
|
| 24 |
+
for family in ('base', 'instruct'):
|
| 25 |
+
target = root / 'full' / family / 'offline_eval.json'
|
| 26 |
+
target.parent.mkdir(parents=True, exist_ok=True)
|
| 27 |
+
temporary = target.with_suffix('.json.partial')
|
| 28 |
+
temporary.write_text(json.dumps(policy, indent=2) + '\n')
|
| 29 |
+
temporary.replace(target)
|
| 30 |
+
print('OFFLINE_PPL_CACHE_EXACT_ROWS_VERIFIED', policy['splits'], flush=True)
|
runs/vast-paper_revision-come-attn-fit-20261126-62646539/20261126-qwen3-base-mka-come-mlp-fit/catalog/code/prepare_qwen_mlp_fit_calibrations.py
ADDED
|
@@ -0,0 +1,98 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""Restore native Qwen MKA tokens and freeze the legacy native CoMe loader."""
|
| 2 |
+
import argparse
|
| 3 |
+
import hashlib
|
| 4 |
+
import json
|
| 5 |
+
from pathlib import Path
|
| 6 |
+
|
| 7 |
+
import torch
|
| 8 |
+
from datasets import load_dataset
|
| 9 |
+
from transformers import AutoTokenizer
|
| 10 |
+
|
| 11 |
+
REVISION = "49e3418fbbbca6ecbdf9608b4d22e5a407081db4"
|
| 12 |
+
MKA_FILE_HASH = "aa8b546874da296d54ef69d73faffc83802deb089c0209cc55593e32ab50489b"
|
| 13 |
+
MKA_IDS_HASH = "4f47034e02892bf464998e540be8bd7bc0718f83f6bc9d354c887cc2874cada9"
|
| 14 |
+
VOCAB_HASH = "c605f1c0a80a9501fca9782b942a7f01474e3f37b1c59e3efea82da0e2f20376"
|
| 15 |
+
|
| 16 |
+
|
| 17 |
+
def save_batches(batches, metadata, output):
|
| 18 |
+
output.mkdir(parents=True, exist_ok=True)
|
| 19 |
+
path = output / "selection.pt"
|
| 20 |
+
ids, masks = hashlib.sha256(), hashlib.sha256()
|
| 21 |
+
for b in batches:
|
| 22 |
+
ids.update(b["input_ids"].numpy().astype("<i8").tobytes())
|
| 23 |
+
masks.update(b["attention_mask"].numpy().astype("<i8").tobytes())
|
| 24 |
+
metadata.update(input_ids_sha256=ids.hexdigest(), attention_mask_sha256=masks.hexdigest())
|
| 25 |
+
if path.exists() or path.with_suffix(".json").exists():
|
| 26 |
+
if not (path.is_file() and path.with_suffix(".json").is_file()):
|
| 27 |
+
raise FileExistsError("Incomplete existing calibration must be inspected")
|
| 28 |
+
existing = torch.load(path, weights_only=True, map_location="cpu")
|
| 29 |
+
stored = json.loads(path.with_suffix(".json").read_text())
|
| 30 |
+
assert len(existing) == len(batches)
|
| 31 |
+
assert all(torch.equal(x[k], y[k]) for x, y in zip(existing, batches)
|
| 32 |
+
for k in ("input_ids", "attention_mask"))
|
| 33 |
+
assert stored["input_ids_sha256"] == ids.hexdigest()
|
| 34 |
+
assert stored["attention_mask_sha256"] == masks.hexdigest()
|
| 35 |
+
print(json.dumps({"method": metadata["method"], "existing_frozen_inputs_verified": True,
|
| 36 |
+
"input_ids_sha256": ids.hexdigest()}))
|
| 37 |
+
return
|
| 38 |
+
torch.save(batches, path)
|
| 39 |
+
metadata["selection_file_sha256"] = hashlib.sha256(path.read_bytes()).hexdigest()
|
| 40 |
+
path.with_suffix(".json").write_text(json.dumps(metadata, indent=2) + "\n")
|
| 41 |
+
print(json.dumps({"method": metadata["method"], "sequences": len(batches),
|
| 42 |
+
"input_ids_sha256": ids.hexdigest(), "attention_mask_sha256": masks.hexdigest()}))
|
| 43 |
+
|
| 44 |
+
|
| 45 |
+
def main():
|
| 46 |
+
p = argparse.ArgumentParser(description=__doc__)
|
| 47 |
+
p.add_argument("--model", required=True)
|
| 48 |
+
p.add_argument("--mka-source", type=Path, required=True)
|
| 49 |
+
p.add_argument("--output", type=Path, required=True)
|
| 50 |
+
a = p.parse_args()
|
| 51 |
+
if hashlib.sha256(a.mka_source.read_bytes()).hexdigest() != MKA_FILE_HASH:
|
| 52 |
+
raise ValueError("Immutable native MKA source file differs")
|
| 53 |
+
saved = torch.load(a.mka_source, weights_only=True, map_location="cpu")
|
| 54 |
+
meta, chunks = saved["metadata"], saved["input_ids"]
|
| 55 |
+
assert meta["tokenizer"] == "Qwen/Qwen3-8B-Base" and meta["tokenizer_revision"] == REVISION
|
| 56 |
+
assert meta["tokenizer_vocab_sha256"] == VOCAB_HASH
|
| 57 |
+
assert len(chunks) == 100 and all(x.dtype == torch.long and tuple(x.shape) == (512,) for x in chunks)
|
| 58 |
+
digest = hashlib.sha256(b"".join(x.numpy().astype("<i8").tobytes() for x in chunks)).hexdigest()
|
| 59 |
+
assert digest == meta["input_ids_sha256"] == MKA_IDS_HASH
|
| 60 |
+
tokenizer = AutoTokenizer.from_pretrained(a.model, local_files_only=True)
|
| 61 |
+
from run_mka_pruning import vocabulary_checksum
|
| 62 |
+
assert vocabulary_checksum(tokenizer) == VOCAB_HASH
|
| 63 |
+
batches = [{"input_ids": x[None, :], "attention_mask": torch.ones_like(x[None, :])} for x in chunks]
|
| 64 |
+
native = dict(meta)
|
| 65 |
+
native.update(method="MKA", resampled=False, source_file_sha256=MKA_FILE_HASH,
|
| 66 |
+
source_revision="15b4ad6fcdf6a42344a86296b4dafa662d08f282",
|
| 67 |
+
source_path="runs/vast-paper_revision-mka-all-small-5090x8-ca-54482709/20261006-mka-small-13checkpoints/qwen3_base_remove9/model/calibration_ids.pt")
|
| 68 |
+
save_batches(batches, native, a.output / "mka")
|
| 69 |
+
|
| 70 |
+
dataset = load_dataset("DKYoon/SlimPajama-6B", split="train", streaming=True,
|
| 71 |
+
revision="b5f90f419b7489cdba26fdbc8c022fcb5562f968").shuffle(seed=10, buffer_size=10000)
|
| 72 |
+
tokens, documents = [], []
|
| 73 |
+
for i, row in enumerate(dataset):
|
| 74 |
+
text = row.get("text")
|
| 75 |
+
documents.append(hashlib.sha256((text or "").encode()).hexdigest())
|
| 76 |
+
if isinstance(text, str):
|
| 77 |
+
tokens.extend(tokenizer.encode(text, add_special_tokens=False))
|
| 78 |
+
if i == 255:
|
| 79 |
+
break
|
| 80 |
+
assert len(documents) == 256
|
| 81 |
+
batches = []
|
| 82 |
+
for i in range(0, len(tokens) - 2047, 2048):
|
| 83 |
+
ids = torch.tensor(tokens[i:i + 2048], dtype=torch.long)[None, :]
|
| 84 |
+
batches.append({"input_ids": ids, "attention_mask": torch.ones_like(ids)})
|
| 85 |
+
assert len(batches) == 94, f"Historical native CoMe expected94windows, got{len(batches)}"
|
| 86 |
+
import datasets, transformers
|
| 87 |
+
save_batches(batches, {"method": "CoMe", "dataset": "DKYoon/SlimPajama-6B",
|
| 88 |
+
"revision": "b5f90f419b7489cdba26fdbc8c022fcb5562f968", "source_rows": 256,
|
| 89 |
+
"packed_windows": 94, "sequence_length": 2048, "seed": 10, "shuffle_buffer": 10000,
|
| 90 |
+
"minimum_retention": 0, "power": 1, "allow_repeat": True,
|
| 91 |
+
"tokenizer_revision": REVISION, "tokenizer_vocab_sha256": VOCAB_HASH,
|
| 92 |
+
"document_sha256": documents, "datasets_version": datasets.__version__,
|
| 93 |
+
"transformers_version": transformers.__version__, "historical_token_hash_available": False,
|
| 94 |
+
"validation": "Pinned legacy loader and historical source arguments/window count; not an immutable historical token-cache claim"}, a.output / "come")
|
| 95 |
+
|
| 96 |
+
|
| 97 |
+
if __name__ == "__main__":
|
| 98 |
+
main()
|
runs/vast-paper_revision-come-attn-fit-20261126-62646539/20261126-qwen3-base-mka-come-mlp-fit/catalog/code/project_commit.txt
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
13b0cc3f0312bca22ef0cec7dcefec632db82f09
|
runs/vast-paper_revision-come-attn-fit-20261126-62646539/20261126-qwen3-base-mka-come-mlp-fit/catalog/code/run_external_abprune_instruct_order.py
ADDED
|
@@ -0,0 +1,140 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env python3
|
| 2 |
+
"""Run the transport-enabled ABPrune entrypoint with SlimOrca record data.
|
| 3 |
+
|
| 4 |
+
The transport implementation currently lives in the external repository's
|
| 5 |
+
``src`` tree, while its instruction-only tree does not contain the transport
|
| 6 |
+
patch. This adapter keeps the transport implementation unchanged and swaps
|
| 7 |
+
only the calibration/distillation record loader to the established SlimOrca
|
| 8 |
+
first-turn protocol.
|
| 9 |
+
"""
|
| 10 |
+
|
| 11 |
+
from __future__ import annotations
|
| 12 |
+
|
| 13 |
+
import argparse
|
| 14 |
+
import os
|
| 15 |
+
import sys
|
| 16 |
+
from typing import Dict, List, Optional
|
| 17 |
+
|
| 18 |
+
import torch
|
| 19 |
+
|
| 20 |
+
|
| 21 |
+
external_src = os.environ.get("ABPRUNE_EXTERNAL_SRC", "").strip()
|
| 22 |
+
if not external_src:
|
| 23 |
+
raise SystemExit("Set ABPRUNE_EXTERNAL_SRC to the external ABPrune src directory")
|
| 24 |
+
sys.path.insert(0, external_src)
|
| 25 |
+
|
| 26 |
+
import fuse_layers as base # noqa: E402
|
| 27 |
+
import fuse_layers_data as data # noqa: E402
|
| 28 |
+
|
| 29 |
+
|
| 30 |
+
def _messages_text(messages: List[Dict[str, str]]) -> str:
|
| 31 |
+
return "\n\n".join(
|
| 32 |
+
f"{str(message.get('role', '')).strip().title() or 'User'}: "
|
| 33 |
+
f"{str(message.get('content', '')).strip()}"
|
| 34 |
+
for message in messages
|
| 35 |
+
if str(message.get("content", "")).strip()
|
| 36 |
+
)
|
| 37 |
+
|
| 38 |
+
|
| 39 |
+
def _slimorca_record(row: Dict[str, object]) -> Optional[Dict[str, object]]:
|
| 40 |
+
conversations = row.get("conversations")
|
| 41 |
+
if not isinstance(conversations, list) or len(conversations) < 2:
|
| 42 |
+
return None
|
| 43 |
+
start = 0 if str(conversations[0].get("from", "")).lower() == "human" else 1
|
| 44 |
+
if start + 1 >= len(conversations):
|
| 45 |
+
return None
|
| 46 |
+
user = conversations[start]
|
| 47 |
+
assistant = conversations[start + 1]
|
| 48 |
+
if str(user.get("from", "")).lower() != "human":
|
| 49 |
+
return None
|
| 50 |
+
if str(assistant.get("from", "")).lower() != "gpt":
|
| 51 |
+
return None
|
| 52 |
+
user_text = str(user.get("value", "")).strip()
|
| 53 |
+
assistant_text = str(assistant.get("value", "")).strip()
|
| 54 |
+
if not user_text or not assistant_text:
|
| 55 |
+
return None
|
| 56 |
+
messages = [
|
| 57 |
+
{"role": "user", "content": user_text},
|
| 58 |
+
{"role": "assistant", "content": assistant_text},
|
| 59 |
+
]
|
| 60 |
+
return {"messages": messages, "text": _messages_text(messages)}
|
| 61 |
+
|
| 62 |
+
|
| 63 |
+
def load_slimorca_records(
|
| 64 |
+
args: argparse.Namespace,
|
| 65 |
+
num_samples: int,
|
| 66 |
+
manifest_env_var: str = "ABPRUNE_DATA_INDICES_FILE",
|
| 67 |
+
) -> List[Dict[str, object]]:
|
| 68 |
+
if args.instruction_dataset != "Open-Orca/SlimOrca":
|
| 69 |
+
raise SystemExit(
|
| 70 |
+
"The instruction transport adapter requires Open-Orca/SlimOrca"
|
| 71 |
+
)
|
| 72 |
+
dataset = data.load_dataset(**data._instruction_dataset_kwargs(args))
|
| 73 |
+
rows = (
|
| 74 |
+
data._sample_dataset_rows(dataset, num_samples, args.seed, manifest_env_var)
|
| 75 |
+
if num_samples > 0
|
| 76 |
+
else dataset
|
| 77 |
+
)
|
| 78 |
+
records: List[Dict[str, object]] = []
|
| 79 |
+
for row in rows:
|
| 80 |
+
if not isinstance(row, dict):
|
| 81 |
+
continue
|
| 82 |
+
record = _slimorca_record(row)
|
| 83 |
+
if record is not None:
|
| 84 |
+
records.append(record)
|
| 85 |
+
return records
|
| 86 |
+
|
| 87 |
+
|
| 88 |
+
def build_instruction_calibration(args: argparse.Namespace, tokenizer):
|
| 89 |
+
records = load_slimorca_records(
|
| 90 |
+
args, args.num_samples, "ABPRUNE_CALIB_DATA_INDICES_FILE"
|
| 91 |
+
)
|
| 92 |
+
if not records:
|
| 93 |
+
raise SystemExit("No SlimOrca instruction calibration records were built")
|
| 94 |
+
dataset = base.FixedSeqDataset(records, tokenizer, args.seq_len)
|
| 95 |
+
chunks = [dataset[index][0] for index in range(len(dataset))]
|
| 96 |
+
masks = [dataset[index][1] for index in range(len(dataset))]
|
| 97 |
+
loader = torch.utils.data.DataLoader(
|
| 98 |
+
torch.utils.data.TensorDataset(torch.stack(chunks), torch.stack(masks)),
|
| 99 |
+
batch_size=args.batch_size,
|
| 100 |
+
shuffle=False,
|
| 101 |
+
)
|
| 102 |
+
return [], chunks, loader
|
| 103 |
+
|
| 104 |
+
|
| 105 |
+
original_parse_args = base.parse_args
|
| 106 |
+
|
| 107 |
+
|
| 108 |
+
def parse_args() -> argparse.Namespace:
|
| 109 |
+
args = original_parse_args()
|
| 110 |
+
args.instruction_format = "slimorca"
|
| 111 |
+
args.calibration_source = "instruction"
|
| 112 |
+
return args
|
| 113 |
+
|
| 114 |
+
|
| 115 |
+
base.parse_args = parse_args
|
| 116 |
+
base.load_instruction_records = load_slimorca_records
|
| 117 |
+
base.build_calibration_dataloader = build_instruction_calibration
|
| 118 |
+
data.load_instruction_records = load_slimorca_records
|
| 119 |
+
|
| 120 |
+
original_prepare_distillation_data = base.prepare_distillation_data
|
| 121 |
+
|
| 122 |
+
|
| 123 |
+
def prepare_instruction_distillation(args, tokenizer, include_instruction=True):
|
| 124 |
+
# The generic LM entrypoint deliberately suppresses instruction records for
|
| 125 |
+
# reparameterization and enables them only for LoRA. This adapter is the
|
| 126 |
+
# instruction-model entrypoint, so both calibration and reparameterization
|
| 127 |
+
# must consume the requested SlimOrca records.
|
| 128 |
+
del include_instruction
|
| 129 |
+
return original_prepare_distillation_data(
|
| 130 |
+
args, tokenizer, include_instruction=True
|
| 131 |
+
)
|
| 132 |
+
|
| 133 |
+
|
| 134 |
+
base.prepare_distillation_data = prepare_instruction_distillation
|
| 135 |
+
|
| 136 |
+
import fuse_layers_order as ordered # noqa: E402
|
| 137 |
+
|
| 138 |
+
|
| 139 |
+
if __name__ == "__main__":
|
| 140 |
+
ordered.main()
|
runs/vast-paper_revision-come-attn-fit-20261126-62646539/20261126-qwen3-base-mka-come-mlp-fit/catalog/code/run_llama31_base_fit_ablation.py
ADDED
|
@@ -0,0 +1,926 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env python3
|
| 2 |
+
"""Non-Fisher initialization controls on the historical additive-U FiT engine.
|
| 3 |
+
|
| 4 |
+
Wa/Wb/average use the fixed anchor. MKA uses the corrected, committed MKA
|
| 5 |
+
selector; --fit-mka-mlp freezes its merged attention and anchor norms while
|
| 6 |
+
fitting only the three MLP weights. The existing default MKA scope is unchanged.
|
| 7 |
+
The opt-in fixed-span-merge-only mode instead retains our selection/transport,
|
| 8 |
+
replaces just the three MLP initializers, and freezes anchor attention/norms.
|
| 9 |
+
No fake Fisher tensor is used to derive initialization; empty placeholders
|
| 10 |
+
only satisfy the unmodified engine's call signature. Audits mark this clearly.
|
| 11 |
+
"""
|
| 12 |
+
from __future__ import annotations
|
| 13 |
+
|
| 14 |
+
import argparse
|
| 15 |
+
import hashlib
|
| 16 |
+
import json
|
| 17 |
+
import math
|
| 18 |
+
import os
|
| 19 |
+
import sys
|
| 20 |
+
import time
|
| 21 |
+
from pathlib import Path
|
| 22 |
+
|
| 23 |
+
|
| 24 |
+
def install_exact_layer(distill, torch, state):
|
| 25 |
+
original = distill.ReparamMergedLayer
|
| 26 |
+
|
| 27 |
+
class ExactInitializationLayer(original):
|
| 28 |
+
def __init__(self, layer_a, layer_b, targets, **kwargs):
|
| 29 |
+
assert kwargs.get("additive_u"), "Controls require additive-U"
|
| 30 |
+
assert not kwargs.get("tensor_rho")
|
| 31 |
+
super().__init__(layer_a, layer_b, targets, **kwargs)
|
| 32 |
+
self.exact_lambda = float(state["lambda"])
|
| 33 |
+
self.initialization_errors = {}
|
| 34 |
+
self.fit_attention = bool(state.get("fit_attention", False))
|
| 35 |
+
self.fit_full_block = bool(state.get("fit_full_block", False))
|
| 36 |
+
self.fit_come_mlp = bool(state.get("fit_come_mlp", False))
|
| 37 |
+
self.fit_come_attention = bool(state.get("fit_come_attention", False))
|
| 38 |
+
self.fit_mka_mlp = bool(state.get("fit_mka_mlp", False))
|
| 39 |
+
fixed_merge_only = bool(state.get("fixed_span_merge_only", False))
|
| 40 |
+
fixed_initial = None
|
| 41 |
+
if fixed_merge_only:
|
| 42 |
+
from fusegpt.fixed_span_merge_init import MLP_NAMES, build_initialization
|
| 43 |
+
assert set(self._name_map) == set(MLP_NAMES), self._name_map
|
| 44 |
+
assert state.get("transport_completed"), "Initialize only after transport"
|
| 45 |
+
fixed_initial, fixed_audit = build_initialization(
|
| 46 |
+
layer_a, layer_b, state["initializer"], state["merge_payload"])
|
| 47 |
+
if ((state["initializer"] == "mka" and not fixed_merge_only) or
|
| 48 |
+
self.fit_attention or self.fit_come_attention):
|
| 49 |
+
from fusegpt.fit_ablation_mka import PROJECTION_WEIGHTS
|
| 50 |
+
for name, safe in list(self._name_map.items()):
|
| 51 |
+
if name not in PROJECTION_WEIGHTS:
|
| 52 |
+
del self._name_map[name]
|
| 53 |
+
del self.u[safe]
|
| 54 |
+
del self.gates[safe]
|
| 55 |
+
mka_frozen_initial = {}
|
| 56 |
+
if self.fit_mka_mlp:
|
| 57 |
+
assert state["initializer"] == "mka" and not fixed_merge_only
|
| 58 |
+
assert len(self._name_map) == 3 and all(n.startswith("mlp.") for n in self._name_map)
|
| 59 |
+
# Native MKA merges all seven projections in FP32, rounds into
|
| 60 |
+
# the model dtype, and leaves residual/QK norms at the left anchor.
|
| 61 |
+
# A narrower FiT scope must still materialize that attention merge.
|
| 62 |
+
for name, param in layer_a.named_parameters():
|
| 63 |
+
if name in self._name_map:
|
| 64 |
+
continue
|
| 65 |
+
projection_weight = name in PROJECTION_WEIGHTS
|
| 66 |
+
projection_bias = name.endswith(".bias") and name[:-4] + "weight" in PROJECTION_WEIGHTS
|
| 67 |
+
initial = (torch.lerp(layer_b.get_parameter(name).detach().float(),
|
| 68 |
+
param.detach().float(), self.exact_lambda)
|
| 69 |
+
if projection_weight or projection_bias else param.detach().clone())
|
| 70 |
+
initial = initial.to(param.dtype)
|
| 71 |
+
mka_frozen_initial[name] = initial.detach().clone()
|
| 72 |
+
self.register_buffer("frozen_initial__" + name.replace(".", "__"),
|
| 73 |
+
initial.detach().clone(), persistent=False)
|
| 74 |
+
if (self.fit_come_mlp or self.fit_come_attention) and not fixed_merge_only:
|
| 75 |
+
assert len(self._name_map) == (7 if self.fit_come_attention else 3)
|
| 76 |
+
if self.fit_come_mlp:
|
| 77 |
+
assert all(n.startswith("mlp.") for n in self._name_map)
|
| 78 |
+
for name, initial in state["come_initial"].items():
|
| 79 |
+
if name not in self._name_map:
|
| 80 |
+
self.register_buffer("frozen_initial__" + name.replace(".", "__"),
|
| 81 |
+
initial.to(layer_a.get_parameter(name).device).clone(), persistent=False)
|
| 82 |
+
with torch.no_grad():
|
| 83 |
+
for name, safe in self._name_map.items():
|
| 84 |
+
a = layer_a.get_parameter(name).detach().float()
|
| 85 |
+
b = layer_b.get_parameter(name).detach().float()
|
| 86 |
+
# This is a fitting-scope ablation, not an attention merge.
|
| 87 |
+
# Keep anchor attention exactly; only MLP uses Wa/Wb lambda.
|
| 88 |
+
ratio = 1. if self.fit_attention and name.startswith("self_attn.") else self.exact_lambda
|
| 89 |
+
if fixed_merge_only:
|
| 90 |
+
initial = fixed_initial[name].to(a.device).clone()
|
| 91 |
+
elif state["initializer"] == "come":
|
| 92 |
+
initial = state["come_initial"][name].to(a.device).clone()
|
| 93 |
+
elif ratio == 1:
|
| 94 |
+
initial = a.clone()
|
| 95 |
+
elif ratio == 0:
|
| 96 |
+
initial = b.clone()
|
| 97 |
+
else:
|
| 98 |
+
initial = torch.lerp(b, a, ratio)
|
| 99 |
+
self.register_buffer("initial__" + safe, initial, persistent=False)
|
| 100 |
+
self.u[safe].zero_()
|
| 101 |
+
assert torch.isfinite(initial).all(), name
|
| 102 |
+
self.initialization_errors[name] = 0.0
|
| 103 |
+
state["initialization_audit"] = {
|
| 104 |
+
"lambda": self.exact_lambda, "endpoint_clamping": False,
|
| 105 |
+
"initial_u_nonzero": 0, "merged_parameters": list(self._name_map),
|
| 106 |
+
"parameterization": "W_initial + U_add", "fisher_computed": False,
|
| 107 |
+
"fit_scope": "full_block_including_norms" if self.fit_full_block else (
|
| 108 |
+
"attention_and_mlp" if self.fit_attention or self.fit_come_attention else "mlp"),
|
| 109 |
+
"attention_initialization": "CoMe_channel_merge" if state["initializer"] == "come" else (
|
| 110 |
+
"anchor_Wa" if self.fit_attention else (
|
| 111 |
+
"MKA_merge" if state["initializer"] == "mka" else "anchor_Wa")
|
| 112 |
+
),
|
| 113 |
+
}
|
| 114 |
+
if fixed_merge_only:
|
| 115 |
+
state["initialization_audit"].update({"fixed_span_merge_only": True,
|
| 116 |
+
"attention_initialization": "anchor_Wa", "norm_initialization": "anchor_Wa",
|
| 117 |
+
"norms_trainable": False, "initialized_parameters": list(self._name_map),
|
| 118 |
+
"selection_policy": state.get("selection_policy", "fixed_anchor21_remove_original_22_30"),
|
| 119 |
+
"merge_rule_audit": fixed_audit})
|
| 120 |
+
state.pop("merge_payload")
|
| 121 |
+
elif state["initializer"] == "come":
|
| 122 |
+
actual_names = {n for n, _ in layer_a.named_parameters()}
|
| 123 |
+
assert set(state["come_initial"]) == actual_names, "Native CoMe initialization must cover every block parameter"
|
| 124 |
+
if self.fit_full_block:
|
| 125 |
+
assert set(self._name_map) == set(state["come_initial"]), "All block parameters must have U"
|
| 126 |
+
state["initialization_audit"].update({"lambda": None, "norm_initialization": "CoMe_pair_mean",
|
| 127 |
+
"CoMe": state["come_audit"], "norms_trainable": self.fit_full_block,
|
| 128 |
+
"attention_norm_initialization": "CoMe_retention_weighted_QK" if any(
|
| 129 |
+
n.startswith("self_attn.") and "norm" in n for n in actual_names) else None,
|
| 130 |
+
"initialized_parameters": list(state["come_initial"]),
|
| 131 |
+
"frozen_CoMe_parameters": [n for n in state["come_initial"] if n not in self._name_map]})
|
| 132 |
+
if self.fit_come_mlp:
|
| 133 |
+
hashes = {n: hashlib.sha256(initial.to(dtype=layer_a.get_parameter(n).dtype).cpu().contiguous()
|
| 134 |
+
.view(torch.uint8).numpy().tobytes()).hexdigest()
|
| 135 |
+
for n, initial in state["come_initial"].items() if n not in self._name_map}
|
| 136 |
+
actual = self._merged_params()
|
| 137 |
+
measured = {n: hashlib.sha256(actual[n].detach().cpu().contiguous()
|
| 138 |
+
.view(torch.uint8).numpy().tobytes()).hexdigest() for n in hashes}
|
| 139 |
+
assert measured == hashes, "CoMe frozen initialization does not match native merge"
|
| 140 |
+
state["initialization_audit"].update({
|
| 141 |
+
"frozen_attention_norm_expected_sha256": hashes,
|
| 142 |
+
"frozen_attention_norm_before_sha256": measured,
|
| 143 |
+
})
|
| 144 |
+
if self.fit_come_attention:
|
| 145 |
+
state["initialization_audit"]["frozen_norm_expected_sha256"] = {
|
| 146 |
+
n: hashlib.sha256(initial.to(dtype=layer_a.get_parameter(n).dtype).cpu().contiguous()
|
| 147 |
+
.view(torch.uint8).numpy().tobytes()).hexdigest()
|
| 148 |
+
for n, initial in state["come_initial"].items() if n not in self._name_map
|
| 149 |
+
}
|
| 150 |
+
frozen_norms = state["initialization_audit"]["frozen_norm_expected_sha256"]
|
| 151 |
+
assert len(frozen_norms) >= 2 and all("norm" in n for n in frozen_norms)
|
| 152 |
+
state.pop("come_initial")
|
| 153 |
+
elif self.fit_mka_mlp:
|
| 154 |
+
hashes = {n: hashlib.sha256(p.cpu().contiguous().view(torch.uint8).numpy().tobytes()).hexdigest()
|
| 155 |
+
for n, p in mka_frozen_initial.items()}
|
| 156 |
+
actual = self._merged_params()
|
| 157 |
+
measured = {n: hashlib.sha256(actual[n].detach().cpu().contiguous()
|
| 158 |
+
.view(torch.uint8).numpy().tobytes()).hexdigest() for n in hashes}
|
| 159 |
+
assert measured == hashes, "MKA frozen initialization does not match native merge"
|
| 160 |
+
state["initialization_audit"].update({
|
| 161 |
+
"fit_scope": "mlp", "attention_initialization": "MKA_merge",
|
| 162 |
+
"norm_initialization": "anchor_Wa", "norms_trainable": False,
|
| 163 |
+
"frozen_MKA_parameters": list(mka_frozen_initial),
|
| 164 |
+
"frozen_attention_norm_expected_sha256": hashes,
|
| 165 |
+
"frozen_attention_norm_before_sha256": measured,
|
| 166 |
+
})
|
| 167 |
+
|
| 168 |
+
def gate_lambdas(self):
|
| 169 |
+
return {name: torch.tensor(
|
| 170 |
+
1. if self.fit_attention and name.startswith("self_attn.") else self.exact_lambda,
|
| 171 |
+
device=self.u[safe].device)
|
| 172 |
+
for name, safe in self._name_map.items()}
|
| 173 |
+
|
| 174 |
+
def _merged_params(self):
|
| 175 |
+
result = {}
|
| 176 |
+
for name, param in self.layer_a.named_parameters():
|
| 177 |
+
safe = self._name_map.get(name)
|
| 178 |
+
frozen = getattr(self, "frozen_initial__" + name.replace(".", "__"), param.detach())
|
| 179 |
+
result[name] = (frozen.to(param.dtype) if safe is None else
|
| 180 |
+
(getattr(self, "initial__" + safe) + self.u[safe]).to(param.dtype))
|
| 181 |
+
return result
|
| 182 |
+
|
| 183 |
+
def materialize_into_layer_a(self):
|
| 184 |
+
with torch.no_grad():
|
| 185 |
+
for name, param in self.layer_a.named_parameters():
|
| 186 |
+
frozen = getattr(self, "frozen_initial__" + name.replace(".", "__"), None)
|
| 187 |
+
if frozen is not None:
|
| 188 |
+
param.copy_(frozen.to(param.dtype))
|
| 189 |
+
for name, safe in self._name_map.items():
|
| 190 |
+
param = self.layer_a.get_parameter(name)
|
| 191 |
+
param.copy_((getattr(self, "initial__" + safe) + self.u[safe]).to(param.dtype))
|
| 192 |
+
return len(self._name_map)
|
| 193 |
+
|
| 194 |
+
distill.ReparamMergedLayer = ExactInitializationLayer
|
| 195 |
+
# The old diagnostic names its reference "Fisher displacement". That is
|
| 196 |
+
# not the reference direction in these controls, so do not emit it.
|
| 197 |
+
distill._sequential_u_fisher_orthogonality = lambda layer: {}
|
| 198 |
+
return ExactInitializationLayer
|
| 199 |
+
|
| 200 |
+
|
| 201 |
+
def algebra_test(torch, distill):
|
| 202 |
+
class Layer(torch.nn.Module):
|
| 203 |
+
def __init__(self):
|
| 204 |
+
super().__init__()
|
| 205 |
+
self.mlp = torch.nn.Module()
|
| 206 |
+
self.mlp.up_proj = torch.nn.Linear(4, 5, bias=False)
|
| 207 |
+
|
| 208 |
+
torch.manual_seed(42)
|
| 209 |
+
state = {"initializer": "average", "lambda": .5}
|
| 210 |
+
cls = install_exact_layer(distill, torch, state)
|
| 211 |
+
a, b = Layer(), Layer()
|
| 212 |
+
for ratio in (0., .5, 1.):
|
| 213 |
+
state["lambda"] = ratio
|
| 214 |
+
layer = cls(a, b, {"mlp.up_proj.weight": ratio},
|
| 215 |
+
param_subset="mlp", additive_u=True)
|
| 216 |
+
actual = layer._merged_params()["mlp.up_proj.weight"]
|
| 217 |
+
expected = a.mlp.up_proj.weight if ratio == 1 else (
|
| 218 |
+
b.mlp.up_proj.weight if ratio == 0 else
|
| 219 |
+
torch.lerp(b.mlp.up_proj.weight, a.mlp.up_proj.weight, ratio))
|
| 220 |
+
expected = expected.detach().clone()
|
| 221 |
+
assert torch.equal(actual, expected)
|
| 222 |
+
actual.sum().backward()
|
| 223 |
+
u = layer.u["mlp__up_proj__weight"]
|
| 224 |
+
assert torch.equal(u.grad, torch.ones_like(u)), "Average must not mask FiT gradients"
|
| 225 |
+
with torch.no_grad():
|
| 226 |
+
u.add_(.01)
|
| 227 |
+
layer.materialize_into_layer_a()
|
| 228 |
+
assert torch.equal(a.mlp.up_proj.weight, expected + .01)
|
| 229 |
+
print("EXACT_INITIALIZATION_AND_AVERAGE_U_GRADIENT_OK", flush=True)
|
| 230 |
+
|
| 231 |
+
|
| 232 |
+
def attention_algebra_test(torch, distill):
|
| 233 |
+
class Layer(torch.nn.Module):
|
| 234 |
+
def __init__(self):
|
| 235 |
+
super().__init__()
|
| 236 |
+
self.self_attn = torch.nn.Module()
|
| 237 |
+
self.mlp = torch.nn.Module()
|
| 238 |
+
for name in ("q_proj", "k_proj", "v_proj", "o_proj"):
|
| 239 |
+
setattr(self.self_attn, name, torch.nn.Linear(4, 4, bias=False))
|
| 240 |
+
for name in ("gate_proj", "up_proj", "down_proj"):
|
| 241 |
+
setattr(self.mlp, name, torch.nn.Linear(4, 4, bias=False))
|
| 242 |
+
self.input_layernorm = torch.nn.LayerNorm(4)
|
| 243 |
+
|
| 244 |
+
state = {"initializer": "wa", "lambda": 1., "fit_attention": True}
|
| 245 |
+
cls = install_exact_layer(distill, torch, state)
|
| 246 |
+
for ratio in (0., 1.):
|
| 247 |
+
state["lambda"] = ratio
|
| 248 |
+
a, b = Layer(), Layer()
|
| 249 |
+
targets = {name: ratio for name, _ in a.named_parameters()}
|
| 250 |
+
layer = cls(a, b, targets, param_subset="all", additive_u=True)
|
| 251 |
+
assert len(layer._name_map) == 7
|
| 252 |
+
merged = layer._merged_params()
|
| 253 |
+
for name, safe in layer._name_map.items():
|
| 254 |
+
expected = (a if name.startswith("self_attn.") or ratio == 1 else b).get_parameter(name)
|
| 255 |
+
assert torch.equal(merged[name], expected.detach()), name
|
| 256 |
+
assert torch.equal(merged["input_layernorm.weight"], a.input_layernorm.weight)
|
| 257 |
+
sum(merged[name].sum() for name in layer._name_map).backward()
|
| 258 |
+
assert all(torch.equal(u.grad, torch.ones_like(u)) for u in layer.u.values())
|
| 259 |
+
print("ATTENTION_FIT_EXACT_ANCHOR_ATTENTION_MLP_ENDPOINTS_7_U_GRADIENTS_OK", flush=True)
|
| 260 |
+
|
| 261 |
+
|
| 262 |
+
def come_algebra_test(torch, distill, mlp_only=False, attention_and_mlp=False, qk_norms=False):
|
| 263 |
+
from types import SimpleNamespace
|
| 264 |
+
from fusegpt import come
|
| 265 |
+
|
| 266 |
+
class Layer(torch.nn.Module):
|
| 267 |
+
def __init__(self):
|
| 268 |
+
super().__init__()
|
| 269 |
+
self.self_attn = torch.nn.Module()
|
| 270 |
+
self.self_attn.config = SimpleNamespace(num_attention_heads=2, num_key_value_heads=2)
|
| 271 |
+
self.self_attn.head_dim = 2
|
| 272 |
+
for n in ("q_proj", "k_proj", "v_proj", "o_proj"):
|
| 273 |
+
setattr(self.self_attn, n, torch.nn.Linear(4, 4, bias=False))
|
| 274 |
+
if qk_norms:
|
| 275 |
+
self.self_attn.q_norm = torch.nn.RMSNorm(2)
|
| 276 |
+
self.self_attn.k_norm = torch.nn.RMSNorm(2)
|
| 277 |
+
self.mlp = torch.nn.Module()
|
| 278 |
+
self.mlp.gate_proj = torch.nn.Linear(4, 6, bias=False)
|
| 279 |
+
self.mlp.up_proj = torch.nn.Linear(4, 6, bias=False)
|
| 280 |
+
self.mlp.down_proj = torch.nn.Linear(6, 4, bias=False)
|
| 281 |
+
self.input_layernorm = torch.nn.RMSNorm(4)
|
| 282 |
+
self.post_attention_layernorm = torch.nn.RMSNorm(4)
|
| 283 |
+
|
| 284 |
+
import copy
|
| 285 |
+
a, b = Layer(), Layer()
|
| 286 |
+
with torch.no_grad():
|
| 287 |
+
a.input_layernorm.weight.fill_(2)
|
| 288 |
+
b.input_layernorm.weight.fill_(4)
|
| 289 |
+
if qk_norms:
|
| 290 |
+
a.self_attn.q_norm.weight.fill_(2)
|
| 291 |
+
b.self_attn.q_norm.weight.fill_(6)
|
| 292 |
+
a.self_attn.k_norm.weight.fill_(4)
|
| 293 |
+
b.self_attn.k_norm.weight.fill_(8)
|
| 294 |
+
untouched = {n: p.detach().clone() for n, p in a.named_parameters()}
|
| 295 |
+
untouched_b = {n: p.detach().clone() for n, p in b.named_parameters()}
|
| 296 |
+
pair = [copy.deepcopy(a), copy.deepcopy(b)]
|
| 297 |
+
ratios = [.25, .75] if qk_norms else [.5, .5]
|
| 298 |
+
come.merge_attention(pair, ratios, [torch.tensor([0., 1.]), torch.tensor([1., 0.])])
|
| 299 |
+
come.merge_mlp(pair, ratios, [torch.arange(6.), torch.arange(6.).flip(0)])
|
| 300 |
+
come.merge_norms(pair)
|
| 301 |
+
expected = {n: p.detach().clone() for n, p in pair[0].named_parameters()}
|
| 302 |
+
state = {"initializer": "come", "lambda": 1., "fit_full_block": not (mlp_only or attention_and_mlp),
|
| 303 |
+
"fit_come_mlp": mlp_only,
|
| 304 |
+
"fit_come_attention": attention_and_mlp,
|
| 305 |
+
"come_initial": expected, "come_audit": {"self_test": True}}
|
| 306 |
+
cls = install_exact_layer(distill, torch, state)
|
| 307 |
+
layer = cls(a, b, {n: 1. for n in expected}, param_subset="mlp" if mlp_only else "all", additive_u=True)
|
| 308 |
+
merged = layer._merged_params()
|
| 309 |
+
assert len(layer._name_map) == (3 if mlp_only else (7 if attention_and_mlp else len(expected)))
|
| 310 |
+
assert all(torch.equal(merged[n], expected[n]) for n in expected)
|
| 311 |
+
assert all(torch.equal(p, untouched[n]) for n, p in a.named_parameters())
|
| 312 |
+
assert all(torch.equal(p, untouched_b[n]) for n, p in b.named_parameters())
|
| 313 |
+
assert bool((merged["input_layernorm.weight"] == 3).all())
|
| 314 |
+
if qk_norms:
|
| 315 |
+
assert len(expected) == 11
|
| 316 |
+
assert bool((merged["self_attn.q_norm.weight"] == 5).all())
|
| 317 |
+
assert bool((merged["self_attn.k_norm.weight"] == 7).all())
|
| 318 |
+
sum(v.sum() for v in merged.values()).backward()
|
| 319 |
+
assert all(torch.equal(u.grad, torch.ones_like(u)) for u in layer.u.values())
|
| 320 |
+
assert state["initialization_audit"]["attention_initialization"] == "CoMe_channel_merge"
|
| 321 |
+
if mlp_only or attention_and_mlp:
|
| 322 |
+
assert not state["initialization_audit"]["norms_trainable"]
|
| 323 |
+
assert len(state["initialization_audit"]["frozen_CoMe_parameters"]) == len(expected) - len(layer._name_map)
|
| 324 |
+
if mlp_only:
|
| 325 |
+
audit = state["initialization_audit"]
|
| 326 |
+
assert len(audit["frozen_attention_norm_expected_sha256"]) == len(expected) - 3
|
| 327 |
+
assert audit["frozen_attention_norm_before_sha256"] == audit["frozen_attention_norm_expected_sha256"]
|
| 328 |
+
with torch.no_grad():
|
| 329 |
+
for u in layer.u.values():
|
| 330 |
+
u.add_(.01)
|
| 331 |
+
layer.materialize_into_layer_a()
|
| 332 |
+
for n, p in a.named_parameters():
|
| 333 |
+
trainable = n in layer._name_map
|
| 334 |
+
assert torch.equal(p, expected[n] + .01 if trainable else expected[n]), n
|
| 335 |
+
print(("QWEN_QK_NORMS_NATIVE_INIT_FROZEN_OK " if qk_norms else "") + (
|
| 336 |
+
"COME_NATIVE_MERGE_MLP3_U_FROZEN_ATTN_NORMS_OK" if mlp_only else (
|
| 337 |
+
"COME_NATIVE_MERGE_ATTN4_MLP3_U_FROZEN_NORMS_TEACHER_UNCHANGED_OK" if attention_and_mlp else
|
| 338 |
+
f"COME_NATIVE_MERGE_{len(expected)}_U_GRADIENTS_NORMS_TEACHER_UNCHANGED_OK")), flush=True)
|
| 339 |
+
|
| 340 |
+
|
| 341 |
+
def mka_algebra_test(torch, distill, mlp_only=False, qk_norms=False):
|
| 342 |
+
"""Compare with the real native merger, including BF16 rounding and frozen attention."""
|
| 343 |
+
import copy
|
| 344 |
+
from types import SimpleNamespace
|
| 345 |
+
from fusegpt import fit_ablation_mka as mka
|
| 346 |
+
original = distill.ReparamMergedLayer
|
| 347 |
+
|
| 348 |
+
class Layer(torch.nn.Module):
|
| 349 |
+
def __init__(self):
|
| 350 |
+
super().__init__()
|
| 351 |
+
self.self_attn = torch.nn.Module()
|
| 352 |
+
self.mlp = torch.nn.Module()
|
| 353 |
+
for name in ("q_proj", "k_proj", "v_proj", "o_proj"):
|
| 354 |
+
setattr(self.self_attn, name, torch.nn.Linear(4, 4, bias=False))
|
| 355 |
+
if qk_norms:
|
| 356 |
+
self.self_attn.q_norm = torch.nn.RMSNorm(2)
|
| 357 |
+
self.self_attn.k_norm = torch.nn.RMSNorm(2)
|
| 358 |
+
for name in ("gate_proj", "up_proj", "down_proj"):
|
| 359 |
+
setattr(self.mlp, name, torch.nn.Linear(4, 4, bias=False))
|
| 360 |
+
self.input_layernorm = torch.nn.RMSNorm(4)
|
| 361 |
+
self.post_attention_layernorm = torch.nn.RMSNorm(4)
|
| 362 |
+
|
| 363 |
+
for dtype in (torch.float32, torch.bfloat16):
|
| 364 |
+
for ratio in (0., .623, 1.):
|
| 365 |
+
a, b = Layer().to(dtype), Layer().to(dtype)
|
| 366 |
+
with torch.no_grad():
|
| 367 |
+
a.input_layernorm.weight.fill_(2)
|
| 368 |
+
b.input_layernorm.weight.fill_(4)
|
| 369 |
+
a.post_attention_layernorm.weight.fill_(3)
|
| 370 |
+
b.post_attention_layernorm.weight.fill_(5)
|
| 371 |
+
if qk_norms:
|
| 372 |
+
a.self_attn.q_norm.weight.fill_(2)
|
| 373 |
+
b.self_attn.q_norm.weight.fill_(6)
|
| 374 |
+
a.self_attn.k_norm.weight.fill_(4)
|
| 375 |
+
b.self_attn.k_norm.weight.fill_(8)
|
| 376 |
+
teacher = [{n: p.detach().clone() for n, p in layer.named_parameters()} for layer in (a, b)]
|
| 377 |
+
model = torch.nn.Module()
|
| 378 |
+
model.config = SimpleNamespace(num_hidden_layers=2)
|
| 379 |
+
model.model = torch.nn.Module()
|
| 380 |
+
model.model.config = model.config
|
| 381 |
+
model.model.layers = torch.nn.ModuleList([copy.deepcopy(a), copy.deepcopy(b)])
|
| 382 |
+
mka.merge_pair(model, 0, ratio)
|
| 383 |
+
expected = {n: p.detach().clone() for n, p in model.model.layers[0].named_parameters()}
|
| 384 |
+
state = {"initializer": "mka", "lambda": ratio, "fit_mka_mlp": mlp_only}
|
| 385 |
+
distill.ReparamMergedLayer = original
|
| 386 |
+
cls = install_exact_layer(distill, torch, state)
|
| 387 |
+
layer = cls(a, b, {n: ratio for n, _ in a.named_parameters()},
|
| 388 |
+
param_subset="mlp" if mlp_only else "all", additive_u=True)
|
| 389 |
+
merged = layer._merged_params()
|
| 390 |
+
assert len(layer._name_map) == (3 if mlp_only else 7)
|
| 391 |
+
assert all(torch.equal(merged[n], expected[n]) for n in expected)
|
| 392 |
+
assert all(torch.equal(p, saved[n]) for source, saved in zip((a, b), teacher)
|
| 393 |
+
for n, p in source.named_parameters()), "Initialization mutated the teacher"
|
| 394 |
+
sum(merged[n].float().sum() for n in layer._name_map).backward()
|
| 395 |
+
assert all(u.grad is not None and torch.equal(u.grad, torch.ones_like(u)) for u in layer.u.values())
|
| 396 |
+
with torch.no_grad():
|
| 397 |
+
for u in layer.u.values():
|
| 398 |
+
u.add_(.01)
|
| 399 |
+
layer.materialize_into_layer_a()
|
| 400 |
+
for n, p in a.named_parameters():
|
| 401 |
+
after = (expected[n].float() + .01).to(dtype) if n in layer._name_map else expected[n]
|
| 402 |
+
# Trainable BF16 native initialization keeps its unrounded FP32
|
| 403 |
+
# weighted sum until materialization, as in the existing engine.
|
| 404 |
+
if n in layer._name_map:
|
| 405 |
+
initial = torch.lerp(teacher[1][n].float(), teacher[0][n].float(), ratio)
|
| 406 |
+
after = (initial + .01).to(dtype)
|
| 407 |
+
assert torch.equal(p, after), n
|
| 408 |
+
if mlp_only:
|
| 409 |
+
audit = state["initialization_audit"]
|
| 410 |
+
assert len(audit["frozen_attention_norm_expected_sha256"]) == len(expected) - 3
|
| 411 |
+
assert audit["frozen_attention_norm_before_sha256"] == audit["frozen_attention_norm_expected_sha256"]
|
| 412 |
+
assert not audit["norms_trainable"] and audit["attention_initialization"] == "MKA_merge"
|
| 413 |
+
# Historical MKA uses a seven-projection map but the external
|
| 414 |
+
# fitter trains only MLP U (reparam_train_subset=mlp). Confirm
|
| 415 |
+
# narrowing the map preserves that initialization and update.
|
| 416 |
+
old_a, old_b = Layer().to(dtype), Layer().to(dtype)
|
| 417 |
+
old_a.load_state_dict(teacher[0])
|
| 418 |
+
old_b.load_state_dict(teacher[1])
|
| 419 |
+
distill.ReparamMergedLayer = original
|
| 420 |
+
old_cls = install_exact_layer(distill, torch, {"initializer": "mka", "lambda": ratio})
|
| 421 |
+
old = old_cls(old_a, old_b, {n: ratio for n, _ in old_a.named_parameters()},
|
| 422 |
+
param_subset="all", additive_u=True)
|
| 423 |
+
assert len(old._name_map) == 7
|
| 424 |
+
for name, safe in old._name_map.items():
|
| 425 |
+
u = old.u[safe]
|
| 426 |
+
u.requires_grad_(name.startswith("mlp."))
|
| 427 |
+
if name.startswith("mlp."):
|
| 428 |
+
with torch.no_grad():
|
| 429 |
+
u.add_(.01)
|
| 430 |
+
old.materialize_into_layer_a()
|
| 431 |
+
assert all(torch.equal(p, old_a.get_parameter(n)) for n, p in a.named_parameters()), (
|
| 432 |
+
"New three-MLP map differs from historical seven-map/MLP-only-update MKA")
|
| 433 |
+
distill.ReparamMergedLayer = original
|
| 434 |
+
print(("QWEN_QK_NORMS_ANCHOR_FROZEN_OK " if qk_norms else "") + (
|
| 435 |
+
"MKA_NATIVE_MERGE_MLP3_U_FROZEN_ATTN_NORMS_TEACHER_UNCHANGED_OK" if mlp_only else
|
| 436 |
+
"MKA_NATIVE_MERGE_DEFAULT7_U_REGRESSION_OK"), flush=True)
|
| 437 |
+
|
| 438 |
+
|
| 439 |
+
def main():
|
| 440 |
+
parser = argparse.ArgumentParser(allow_abbrev=False)
|
| 441 |
+
parser.add_argument("--external-root", type=Path, required=True)
|
| 442 |
+
parser.add_argument("--initializer", choices=("wa", "wb", "average", "mka", "come"), required=True)
|
| 443 |
+
parser.add_argument("--fixed-anchor", type=int, default=21)
|
| 444 |
+
parser.add_argument("--original-layers", type=int, default=32,
|
| 445 |
+
help="Original decoder depth; defaults preserve the Llama controls")
|
| 446 |
+
parser.add_argument("--audit-root", type=Path, required=True)
|
| 447 |
+
parser.add_argument("--mka-data", type=Path)
|
| 448 |
+
parser.add_argument("--selection-data", type=Path,
|
| 449 |
+
help="Frozen native calibration batches; separate from FiT inputs")
|
| 450 |
+
parser.add_argument("--selection-hash",
|
| 451 |
+
help="Required input_ids SHA256 for frozen selection batches")
|
| 452 |
+
parser.add_argument("--record-fit-runtime", action="store_true")
|
| 453 |
+
parser.add_argument("--expected-fit-input-hash",
|
| 454 |
+
help="Require this distillation input SHA256 before any training")
|
| 455 |
+
parser.add_argument("--expected-fit-mask-hash",
|
| 456 |
+
help="Require this distillation attention-mask SHA256 before any training")
|
| 457 |
+
parser.add_argument("--mka-samples", type=int, default=100)
|
| 458 |
+
parser.add_argument("--self-test", action="store_true")
|
| 459 |
+
parser.add_argument("--model-id", default="meta-llama/Llama-3.1-8B")
|
| 460 |
+
parser.add_argument("--base-revision", default="d04e592bb4f6aa9cfee91e2e20afa771667e1d4b")
|
| 461 |
+
parser.add_argument("--instruction-data", action="store_true")
|
| 462 |
+
parser.add_argument("--fit-attention", action="store_true",
|
| 463 |
+
help="Train seven projection U tensors; initialize attention from anchor Wa")
|
| 464 |
+
parser.add_argument("--fit-full-block", action="store_true",
|
| 465 |
+
help="CoMe initialization; train all native block weights including residual/QK norms")
|
| 466 |
+
parser.add_argument("--fit-come-mlp", action="store_true",
|
| 467 |
+
help="CoMe initializes every block weight; fit3 MLP weights, freeze merged attention/norms")
|
| 468 |
+
parser.add_argument("--fit-come-attention", action="store_true",
|
| 469 |
+
help="CoMe initializes every block weight; fit7 projections, freeze merged residual/QK norms")
|
| 470 |
+
parser.add_argument("--fit-mka-mlp", action="store_true",
|
| 471 |
+
help="Native dynamic MKA initializes7 projections; fit3 MLP weights, freeze merged attention/anchor norms")
|
| 472 |
+
parser.add_argument("--fixed-span-merge-only", action="store_true",
|
| 473 |
+
help="Fixed our span, transport ON, replace ONLY3 MLP initial weights with CoMe/MKA")
|
| 474 |
+
parser.add_argument("--come-minimum-retention", type=float, default=.97)
|
| 475 |
+
parser.add_argument("--come-power", type=float, default=1.)
|
| 476 |
+
parser.add_argument("--one-shot", type=int, default=1,
|
| 477 |
+
help="Absorb this many blocks in a single cycle (Wa only).")
|
| 478 |
+
opt, forwarded = parser.parse_known_args()
|
| 479 |
+
assert bool(opt.expected_fit_input_hash) == bool(opt.expected_fit_mask_hash), "Specify both expected FiT hashes together"
|
| 480 |
+
if opt.fit_attention:
|
| 481 |
+
assert opt.initializer in ("wa", "wb") and opt.one_shot == 1
|
| 482 |
+
if opt.fit_mka_mlp:
|
| 483 |
+
assert opt.initializer == "mka" and not opt.fixed_span_merge_only and opt.one_shot == 1
|
| 484 |
+
assert not (opt.fit_attention or opt.fit_full_block or opt.fit_come_mlp or opt.fit_come_attention)
|
| 485 |
+
assert "--source_feature_transport" not in forwarded
|
| 486 |
+
if not opt.self_test:
|
| 487 |
+
assert opt.selection_data or opt.mka_data, "MLP-only MKA requires explicitly saved native geometry inputs"
|
| 488 |
+
assert opt.selection_hash, "MLP-only MKA requires a native geometry input hash"
|
| 489 |
+
for key in ("--reparam_param_subset", "--reparam_train_subset"):
|
| 490 |
+
assert forwarded[forwarded.index(key) + 1] == "mlp"
|
| 491 |
+
assert sum((opt.fit_full_block, opt.fit_come_mlp, opt.fit_come_attention)) == int(
|
| 492 |
+
opt.initializer == "come" and not opt.fixed_span_merge_only)
|
| 493 |
+
if opt.fixed_span_merge_only:
|
| 494 |
+
assert opt.initializer in ("come", "mka") and opt.one_shot == 1
|
| 495 |
+
count = int(forwarded[forwarded.index("--num_progressive") + 1])
|
| 496 |
+
assert opt.original_layers > 1 and 0 <= opt.fixed_anchor < opt.original_layers - 1
|
| 497 |
+
assert 1 <= count <= opt.original_layers - opt.fixed_anchor - 1
|
| 498 |
+
assert int(forwarded[forwarded.index("--layer") + 1]) == opt.fixed_anchor
|
| 499 |
+
assert not (opt.fit_attention or opt.fit_full_block or opt.fit_come_mlp or opt.fit_come_attention or opt.self_test)
|
| 500 |
+
assert "--source_feature_transport" in forwarded
|
| 501 |
+
for key in ("--reparam_param_subset", "--reparam_train_subset"):
|
| 502 |
+
assert forwarded[forwarded.index(key) + 1] == "mlp"
|
| 503 |
+
elif opt.initializer == "come":
|
| 504 |
+
assert not opt.fit_attention and opt.one_shot == 1
|
| 505 |
+
assert "--source_feature_transport" not in forwarded
|
| 506 |
+
if not opt.self_test:
|
| 507 |
+
subset = "mlp" if opt.fit_come_mlp else "all"
|
| 508 |
+
assert forwarded[forwarded.index("--reparam_param_subset") + 1] == subset
|
| 509 |
+
assert forwarded[forwarded.index("--reparam_train_subset") + 1] == subset
|
| 510 |
+
if opt.one_shot != 1:
|
| 511 |
+
assert opt.initializer == "wa" and opt.one_shot == 8
|
| 512 |
+
assert forwarded[forwarded.index("--num_progressive") + 1] == "1"
|
| 513 |
+
assert forwarded[forwarded.index("--redistrib_teacher_source") + 1] == "base_model"
|
| 514 |
+
assert forwarded[forwarded.index("--reparam_absorb_count") + 1] == "8"
|
| 515 |
+
assert "--source_feature_transport" not in forwarded
|
| 516 |
+
sys.path.insert(0, str(opt.external_root / "src"))
|
| 517 |
+
sys.path.insert(0, str(Path(__file__).resolve().parents[1] / "src"))
|
| 518 |
+
import torch
|
| 519 |
+
import fuse_layers as base
|
| 520 |
+
import fuse_layers_distill as distill
|
| 521 |
+
if opt.self_test:
|
| 522 |
+
qk_norms = opt.model_id in ("Qwen/Qwen3-8B-Base", "Qwen/Qwen3-8B")
|
| 523 |
+
if opt.initializer == "come":
|
| 524 |
+
come_algebra_test(torch, distill, mlp_only=opt.fit_come_mlp,
|
| 525 |
+
attention_and_mlp=opt.fit_come_attention, qk_norms=qk_norms)
|
| 526 |
+
elif opt.initializer == "mka":
|
| 527 |
+
mka_algebra_test(torch, distill, mlp_only=opt.fit_mka_mlp, qk_norms=qk_norms)
|
| 528 |
+
else:
|
| 529 |
+
(attention_algebra_test if opt.fit_attention else algebra_test)(torch, distill)
|
| 530 |
+
return
|
| 531 |
+
if opt.instruction_data:
|
| 532 |
+
assert opt.model_id in ("meta-llama/Llama-3.1-8B-Instruct", "Qwen/Qwen3-8B")
|
| 533 |
+
os.environ["ABPRUNE_EXTERNAL_SRC"] = str(opt.external_root / "src")
|
| 534 |
+
import run_external_abprune_instruct_order as instruction
|
| 535 |
+
|
| 536 |
+
opt.audit_root.mkdir(parents=True, exist_ok=True)
|
| 537 |
+
selection_batches = None
|
| 538 |
+
if opt.selection_data:
|
| 539 |
+
if opt.initializer not in ("come", "mka") or opt.fixed_span_merge_only:
|
| 540 |
+
raise ValueError("Frozen selection inputs require native CoMe or MKA")
|
| 541 |
+
selection_batches = torch.load(opt.selection_data, weights_only=True, map_location="cpu")
|
| 542 |
+
checksum = hashlib.sha256()
|
| 543 |
+
count = 0
|
| 544 |
+
for batch in selection_batches:
|
| 545 |
+
ids, mask = batch["input_ids"], batch["attention_mask"]
|
| 546 |
+
if ids.ndim != 2 or ids.shape != mask.shape or not bool(mask.bool().any(dim=1).all()):
|
| 547 |
+
raise ValueError("Frozen native inputs require matching nonempty valid-token masks")
|
| 548 |
+
if opt.initializer == "come" and not bool(mask.all()):
|
| 549 |
+
raise ValueError("Frozen native CoMe inputs must be unpadded matrices")
|
| 550 |
+
checksum.update(ids.numpy().astype("<i8").tobytes())
|
| 551 |
+
count += ids.shape[0]
|
| 552 |
+
measured = checksum.hexdigest()
|
| 553 |
+
if not opt.selection_hash or measured != opt.selection_hash:
|
| 554 |
+
raise ValueError("Frozen native calibration hash mismatch")
|
| 555 |
+
(opt.audit_root / "selection_inputs.json").write_text(json.dumps({
|
| 556 |
+
"input_ids_sha256": measured, "sequences": count,
|
| 557 |
+
"source": str(opt.selection_data), "independent_of_fit_loader": True,
|
| 558 |
+
}, indent=2) + "\n")
|
| 559 |
+
if opt.fit_mka_mlp:
|
| 560 |
+
source = opt.selection_data or opt.mka_data
|
| 561 |
+
if selection_batches is None:
|
| 562 |
+
if not source.is_file():
|
| 563 |
+
raise FileNotFoundError("Saved native MKA geometry is required; do not resample: " + str(source))
|
| 564 |
+
selection_batches = torch.load(source, weights_only=True, map_location="cpu")
|
| 565 |
+
ids_hash, mask_hash = hashlib.sha256(), hashlib.sha256()
|
| 566 |
+
count = valid_tokens = 0
|
| 567 |
+
for batch in selection_batches:
|
| 568 |
+
ids, mask = batch["input_ids"], batch["attention_mask"]
|
| 569 |
+
if ids.ndim != 2 or ids.shape != mask.shape or ids.shape[1] != 512:
|
| 570 |
+
raise ValueError("Native saved MKA geometry requires 512-token matrices, not CoMe packed windows")
|
| 571 |
+
if not bool(((mask == 0) | (mask == 1)).all()) or not bool(mask.bool().any(dim=1).all()):
|
| 572 |
+
raise ValueError("Native MKA geometry has invalid/empty attention masks")
|
| 573 |
+
ids_hash.update(ids.cpu().numpy().astype("<i8").tobytes())
|
| 574 |
+
mask_hash.update(mask.cpu().numpy().astype("<i8").tobytes())
|
| 575 |
+
count += ids.shape[0]
|
| 576 |
+
valid_tokens += int(mask.sum())
|
| 577 |
+
if count != opt.mka_samples or ids_hash.hexdigest() != opt.selection_hash:
|
| 578 |
+
raise ValueError("Saved native MKA geometry sample count or input SHA256 mismatch")
|
| 579 |
+
(opt.audit_root / "selection_inputs.json").write_text(json.dumps({
|
| 580 |
+
"input_ids_sha256": ids_hash.hexdigest(), "attention_mask_sha256": mask_hash.hexdigest(),
|
| 581 |
+
"sequences": count, "sequence_length": 512, "valid_tokens": valid_tokens,
|
| 582 |
+
"source": str(source), "independent_of_fit_loader": True,
|
| 583 |
+
"selection_protocol": "native_MKA_saved_geometry_dynamic_NPIB",
|
| 584 |
+
}, indent=2) + "\n")
|
| 585 |
+
state = {"initializer": opt.initializer, "fit_attention": opt.fit_attention,
|
| 586 |
+
"fixed_span_merge_only": opt.fixed_span_merge_only,
|
| 587 |
+
"fit_full_block": opt.fit_full_block,
|
| 588 |
+
"fit_come_mlp": opt.fit_come_mlp,
|
| 589 |
+
"fit_come_attention": opt.fit_come_attention,
|
| 590 |
+
"fit_mka_mlp": opt.fit_mka_mlp,
|
| 591 |
+
"lambda": {"wa": 1., "wb": 0., "average": .5, "mka": .5, "come": 1.}[opt.initializer],
|
| 592 |
+
"records": [], "active": list(range(opt.original_layers)),
|
| 593 |
+
"lineage": [[i] for i in range(opt.original_layers)],
|
| 594 |
+
"selection_policy": f"fixed_anchor{opt.fixed_anchor}_remove_original_{opt.fixed_anchor + 1}_{opt.fixed_anchor + 1 + int(forwarded[forwarded.index('--num_progressive') + 1])}"}
|
| 595 |
+
install_exact_layer(distill, torch, state)
|
| 596 |
+
|
| 597 |
+
def no_fisher(*args, **kwargs):
|
| 598 |
+
print("[fit-ablation] Fisher bypassed: non-Fisher initializer", flush=True)
|
| 599 |
+
return ({}, {}), 0, ({}, {})
|
| 600 |
+
|
| 601 |
+
def no_contextual_fisher(**kwargs):
|
| 602 |
+
values = no_fisher()
|
| 603 |
+
return (*values, {"computed": False, "reason": "non-Fisher initializer",
|
| 604 |
+
"anchor_candidate_mean_nll": 0., "transported_source_candidate_mean_nll": 0.})
|
| 605 |
+
|
| 606 |
+
def priors(**kwargs):
|
| 607 |
+
a, b = kwargs["layer_a"], dict(kwargs["layer_b"].named_parameters())
|
| 608 |
+
return {name: state["lambda"] for name, param in a.named_parameters()
|
| 609 |
+
if name in b and param.shape == b[name].shape}
|
| 610 |
+
|
| 611 |
+
base.compute_fisher = no_fisher
|
| 612 |
+
base.compute_same_anchor_contextual_fisher = no_contextual_fisher
|
| 613 |
+
base.compute_fisher_gate_priors = priors
|
| 614 |
+
base.summarize_fisher_gate_prior_inputs = lambda **kw: {
|
| 615 |
+
"computed": False, "initializer": opt.initializer, "prior_mean": state["lambda"]}
|
| 616 |
+
if opt.fixed_span_merge_only:
|
| 617 |
+
original_transport = base.fit_and_apply_source_feature_transport
|
| 618 |
+
|
| 619 |
+
def tracked_transport(**kwargs):
|
| 620 |
+
from fusegpt.fixed_span_merge_init import MLP_NAMES, tensor_hash
|
| 621 |
+
before = {n: tensor_hash(kwargs["layer_b"].get_parameter(n)) for n in MLP_NAMES}
|
| 622 |
+
result = original_transport(**kwargs)
|
| 623 |
+
after = {n: tensor_hash(kwargs["layer_b"].get_parameter(n)) for n in MLP_NAMES}
|
| 624 |
+
state["transport_completed"] = True
|
| 625 |
+
state["transport_operands"] = {"before": before, "after": after,
|
| 626 |
+
"changed": [n for n in MLP_NAMES if before[n] != after[n]]}
|
| 627 |
+
return result
|
| 628 |
+
|
| 629 |
+
base.fit_and_apply_source_feature_transport = tracked_transport
|
| 630 |
+
|
| 631 |
+
original_prepare = base.prepare_all_data
|
| 632 |
+
|
| 633 |
+
def prepare(*args, **kwargs):
|
| 634 |
+
if opt.instruction_data:
|
| 635 |
+
config = args[0]
|
| 636 |
+
assert not config.dataset and config.target_tokens == 0
|
| 637 |
+
assert config.instruction_dataset == "Open-Orca/SlimOrca"
|
| 638 |
+
data = original_prepare(*args, **kwargs)
|
| 639 |
+
fingerprints = {}
|
| 640 |
+
for name in ("calib_loader", "distill_loader"):
|
| 641 |
+
loader = getattr(data, name)
|
| 642 |
+
checksum = hashlib.sha256()
|
| 643 |
+
mask_checksum = hashlib.sha256()
|
| 644 |
+
valid_tokens = 0
|
| 645 |
+
for item in loader.dataset:
|
| 646 |
+
ids = item[0] if isinstance(item, (tuple, list)) else item["input_ids"]
|
| 647 |
+
mask = item[1] if isinstance(item, (tuple, list)) else item["attention_mask"]
|
| 648 |
+
checksum.update(ids.cpu().numpy().astype("<i8").tobytes())
|
| 649 |
+
mask_checksum.update(mask.cpu().numpy().astype("<i8").tobytes())
|
| 650 |
+
valid_tokens += int(mask.sum())
|
| 651 |
+
fingerprints[name] = {"sequences": len(loader.dataset), "sha256": checksum.hexdigest(),
|
| 652 |
+
"attention_mask_sha256": mask_checksum.hexdigest(), "valid_tokens": valid_tokens}
|
| 653 |
+
(opt.audit_root / "data_fingerprints.json").write_text(json.dumps(fingerprints, indent=2) + "\n")
|
| 654 |
+
if opt.expected_fit_input_hash:
|
| 655 |
+
if fingerprints["distill_loader"]["sha256"] != opt.expected_fit_input_hash:
|
| 656 |
+
raise ValueError("FiT input SHA256 mismatch; stop before training")
|
| 657 |
+
if fingerprints["distill_loader"]["attention_mask_sha256"] != opt.expected_fit_mask_hash:
|
| 658 |
+
raise ValueError("FiT attention-mask SHA256 mismatch; stop before training")
|
| 659 |
+
print("EXPECTED_FIT_INPUT_AND_MASK_HASHES_VERIFIED_BEFORE_TRAINING", flush=True)
|
| 660 |
+
if opt.fit_attention or opt.initializer == "come" or opt.fixed_span_merge_only or opt.fit_mka_mlp:
|
| 661 |
+
size = fingerprints["distill_loader"]["sequences"]
|
| 662 |
+
if opt.model_id == "meta-llama/Llama-3.1-8B" and size == 512:
|
| 663 |
+
assert fingerprints["calib_loader"]["sha256"] == "fa4a6219f7a7b17364eef6b5b7771533b57a407f1d26db1d483bbd955814ce38"
|
| 664 |
+
assert fingerprints["distill_loader"]["sha256"] == "2b2d044c8c040f67891817ecc110f0fa0de2f469db4c6731114ff7816bbf1cd0"
|
| 665 |
+
elif opt.model_id == "meta-llama/Llama-3.1-8B-Instruct" and opt.instruction_data and size == 500:
|
| 666 |
+
assert fingerprints["calib_loader"]["sha256"] == "98ff6481a347ebc9444154a51f379c5c71746abe3b417b47186d9f61cbedeeb2"
|
| 667 |
+
assert fingerprints["distill_loader"]["sha256"] == "c75cb58ff76dce06a57127e87633f2fbad04d7d7c9c824e5150c14fd8556cda3"
|
| 668 |
+
assert fingerprints["distill_loader"]["attention_mask_sha256"] == "1e9ccfe6387a9565982ab4ee99f2a3b8c54afebe957ab11ef16e2097c4b8f825"
|
| 669 |
+
elif opt.model_id == "Qwen/Qwen3-8B" and opt.instruction_data:
|
| 670 |
+
assert fingerprints["calib_loader"]["sha256"] == "0d438c8d712c08b428287c97ff2422cc63c99cc0564a27ec53afcae788f042bb"
|
| 671 |
+
assert fingerprints["calib_loader"]["attention_mask_sha256"] == "fdcd61583ffdd02ccfd992f92343facc38a41d794a316746d9b9b7836ebb65b5"
|
| 672 |
+
if size == 500:
|
| 673 |
+
assert fingerprints["distill_loader"]["sha256"] == "b9885f1464a0b145f1c59bc60190bfa73ad388902cbd245e532aa082044a61e7"
|
| 674 |
+
assert fingerprints["distill_loader"]["attention_mask_sha256"] == "f5380885dd835321800a18abd00245d32d60aef9c78ea43a1f16effc26457718"
|
| 675 |
+
print("ATTENTION_FIT_DATA_FINGERPRINTS_CHECKED_BEFORE_TRAINING", flush=True)
|
| 676 |
+
if opt.one_shot > 1 and fingerprints["distill_loader"]["sequences"] == 512:
|
| 677 |
+
assert fingerprints["calib_loader"]["sha256"] == "fa4a6219f7a7b17364eef6b5b7771533b57a407f1d26db1d483bbd955814ce38"
|
| 678 |
+
assert fingerprints["distill_loader"]["sha256"] == "2b2d044c8c040f67891817ecc110f0fa0de2f469db4c6731114ff7816bbf1cd0"
|
| 679 |
+
print("ONE_SHOT_DATA_MATCHES_PREVIOUS_PROGRESSIVE", flush=True)
|
| 680 |
+
return data
|
| 681 |
+
|
| 682 |
+
base.prepare_all_data = prepare
|
| 683 |
+
geometry_batches = None
|
| 684 |
+
|
| 685 |
+
def select(args, model, layers, dataloader, cosine_loader, scores, start, excluded):
|
| 686 |
+
nonlocal geometry_batches
|
| 687 |
+
if opt.fixed_span_merge_only:
|
| 688 |
+
from fusegpt.fit_ablation_come import valid_calibration_batches
|
| 689 |
+
index = opt.fixed_anchor
|
| 690 |
+
assert state["active"][index] == opt.fixed_anchor
|
| 691 |
+
assert state["active"][index + 1] == opt.fixed_anchor + 1 + len(state["records"])
|
| 692 |
+
state["transport_completed"] = False
|
| 693 |
+
batches = valid_calibration_batches(dataloader)
|
| 694 |
+
if opt.initializer == "come":
|
| 695 |
+
from fusegpt import come
|
| 696 |
+
measured = come.collect_calibration_scores(model, batches, sbi_metric="angular_last")
|
| 697 |
+
leaves = len(state["lineage"][index]) + len(state["lineage"][index + 1])
|
| 698 |
+
minimum = opt.come_minimum_retention ** (1 / (leaves - 1))
|
| 699 |
+
ratios = come.compute_retention_ratios(
|
| 700 |
+
measured.block_importance[index:index+2], power=opt.come_power, minimum=minimum)
|
| 701 |
+
state["merge_payload"] = {"ratios": ratios,
|
| 702 |
+
"neuron_scores": measured.mlp_neurons[index:index+2]}
|
| 703 |
+
extra = {"minimum_retention": opt.come_minimum_retention,
|
| 704 |
+
"adjusted_minimum": minimum, "power": opt.come_power,
|
| 705 |
+
"retention_ratios": ratios, "block_importance": measured.block_importance[index:index+2]}
|
| 706 |
+
del measured
|
| 707 |
+
else:
|
| 708 |
+
from fusegpt import fit_ablation_mka as mka
|
| 709 |
+
config = mka.GeometryConfig()
|
| 710 |
+
assert len(batches) >= 64, "MKA geometry requires the matched64-record calibration view"
|
| 711 |
+
features = mka.collect_features(model, batches, pooling=config.pooling)
|
| 712 |
+
manifolds = [mka.diffusion_embedding(x, config) for x in features]
|
| 713 |
+
del features
|
| 714 |
+
matrix, entropies = mka.npib_matrix([x[0] for x in manifolds], config)
|
| 715 |
+
state["lambda"] = mka.upstream_lambda(matrix, index, index+1, config.beta)
|
| 716 |
+
state["merge_payload"] = {"lambda_left": state["lambda"]}
|
| 717 |
+
extra = {"npib_matrix": matrix.tolist(), "entropies": entropies,
|
| 718 |
+
"row_means": matrix.mean(1).tolist(), "geometry_samples": len(batches),
|
| 719 |
+
"geometry_sequence_length": int(batches[0]["input_ids"].shape[1])}
|
| 720 |
+
del manifolds, matrix
|
| 721 |
+
extra.update({"selection_policy": f"fixed_anchor{opt.fixed_anchor}", "source_lineage":
|
| 722 |
+
[state["lineage"][index][:], state["lineage"][index+1][:]],
|
| 723 |
+
"score_data": "same_calib_loader_as_transport", "data_seed": 42,
|
| 724 |
+
"mka_mi_seed": 0 if opt.initializer == "mka" else None,
|
| 725 |
+
"initializer_weights_after_transport": True})
|
| 726 |
+
del batches
|
| 727 |
+
elif opt.initializer == "come":
|
| 728 |
+
from fusegpt.fit_ablation_come import select_and_initialize
|
| 729 |
+
index, initial, extra = select_and_initialize(
|
| 730 |
+
model, selection_batches if selection_batches is not None else dataloader, state["lineage"],
|
| 731 |
+
minimum=opt.come_minimum_retention, power=opt.come_power)
|
| 732 |
+
state["come_initial"] = initial
|
| 733 |
+
state["come_audit"] = extra
|
| 734 |
+
elif opt.initializer == "mka":
|
| 735 |
+
from fusegpt import fit_ablation_mka as mka
|
| 736 |
+
if geometry_batches is None:
|
| 737 |
+
if selection_batches is not None:
|
| 738 |
+
geometry_batches = selection_batches
|
| 739 |
+
elif opt.mka_data and opt.mka_data.is_file():
|
| 740 |
+
geometry_batches = torch.load(opt.mka_data, weights_only=True)
|
| 741 |
+
else:
|
| 742 |
+
from transformers import AutoTokenizer
|
| 743 |
+
tokenizer = AutoTokenizer.from_pretrained(args.model)
|
| 744 |
+
if opt.instruction_data:
|
| 745 |
+
import copy
|
| 746 |
+
geometry_args = copy.copy(args)
|
| 747 |
+
geometry_args.seed = 0
|
| 748 |
+
records = instruction.load_slimorca_records(geometry_args, opt.mka_samples,
|
| 749 |
+
"ABPRUNE_MKA_DATA_INDICES_FILE")
|
| 750 |
+
dataset = base.FixedSeqDataset(records, tokenizer, 512)
|
| 751 |
+
geometry_batches = [{"input_ids": ids[None, :], "attention_mask": mask[None, :]}
|
| 752 |
+
for ids, mask in dataset]
|
| 753 |
+
assert len(geometry_batches) == opt.mka_samples
|
| 754 |
+
checksum = hashlib.sha256()
|
| 755 |
+
for batch in geometry_batches:
|
| 756 |
+
checksum.update(batch["input_ids"].numpy().astype("<i8").tobytes())
|
| 757 |
+
metadata = {"dataset": "Open-Orca/SlimOrca", "revision": os.environ["ABPRUNE_DATASET_REVISION"],
|
| 758 |
+
"samples": len(records), "sequence_length": 512, "seed": 0,
|
| 759 |
+
"format": "first user-assistant turn; model chat template; right padding masked",
|
| 760 |
+
"input_ids_sha256": checksum.hexdigest()}
|
| 761 |
+
else:
|
| 762 |
+
geometry_batches, metadata = mka.sample_slimpajama(
|
| 763 |
+
tokenizer, samples=opt.mka_samples, sequence_length=512, seed=0)
|
| 764 |
+
if opt.mka_data:
|
| 765 |
+
opt.mka_data.parent.mkdir(parents=True, exist_ok=True)
|
| 766 |
+
torch.save(geometry_batches, opt.mka_data)
|
| 767 |
+
opt.mka_data.with_suffix(".json").write_text(json.dumps(metadata, indent=2) + "\n")
|
| 768 |
+
config = mka.GeometryConfig()
|
| 769 |
+
print(f"[fit-ablation] MKA geometry: {len(layers)} layers", flush=True)
|
| 770 |
+
features = mka.collect_features(model, geometry_batches)
|
| 771 |
+
manifold = [mka.diffusion_embedding(x, config) for x in features]
|
| 772 |
+
del features
|
| 773 |
+
matrix, entropies = mka.npib_matrix([x[0] for x in manifold], config)
|
| 774 |
+
index = mka.select_pair(matrix)
|
| 775 |
+
state["lambda"] = mka.upstream_lambda(matrix, index, index + 1, config.beta)
|
| 776 |
+
extra = {"npib_matrix": matrix.tolist(), "entropies": entropies,
|
| 777 |
+
"pair_npib": float(matrix[index, index+1]),
|
| 778 |
+
"source_lineage": [state["lineage"][index][:], state["lineage"][index+1][:]]}
|
| 779 |
+
if opt.fit_mka_mlp:
|
| 780 |
+
extra.update({"geometry_samples": sum(b["input_ids"].shape[0] for b in geometry_batches),
|
| 781 |
+
"geometry_sequence_length": 512,
|
| 782 |
+
"geometry_input_ids_sha256": opt.selection_hash,
|
| 783 |
+
"selection_policy": "native_dynamic_adjacent_NPIB",
|
| 784 |
+
"score_data": "saved_native_MKA_geometry_not_CoMe_calibration"})
|
| 785 |
+
else:
|
| 786 |
+
index, extra = opt.fixed_anchor, {}
|
| 787 |
+
assert len(layers) == len(state["active"])
|
| 788 |
+
record = {"cycle": len(state["records"]) + 1, "pair_index": index,
|
| 789 |
+
"initializer": opt.initializer,
|
| 790 |
+
"lambda_left": None if opt.initializer == "come" else state["lambda"],
|
| 791 |
+
"recipient_original_layer": state["active"][index], "recipient_side": "left",
|
| 792 |
+
"removed_original_layer": state["active"][index+1], **extra}
|
| 793 |
+
state["records"].append(record)
|
| 794 |
+
record["removed_original_layers"] = state["active"][index+1:index+1+opt.one_shot]
|
| 795 |
+
for _ in range(opt.one_shot):
|
| 796 |
+
state["active"].pop(index+1)
|
| 797 |
+
state["lineage"][index] += state["lineage"].pop(index+1)
|
| 798 |
+
record["active_original_layers"] = state["active"][:]
|
| 799 |
+
(opt.audit_root / "selection.json").write_text(json.dumps(state["records"], indent=2) + "\n")
|
| 800 |
+
print("[fit-ablation] selection " + json.dumps({k:v for k,v in record.items() if k != "npib_matrix"}), flush=True)
|
| 801 |
+
return index, None, {"method": opt.initializer, "fisher_computed": False}
|
| 802 |
+
|
| 803 |
+
base.resolve_layer_idx = select
|
| 804 |
+
original_fit = base.distill_reparam_merge
|
| 805 |
+
|
| 806 |
+
def fit(**kwargs):
|
| 807 |
+
if opt.fixed_span_merge_only:
|
| 808 |
+
from fusegpt.fixed_span_merge_init import frozen_hashes
|
| 809 |
+
anchor_layer = kwargs["student_layers"][kwargs["layer_idx"]]
|
| 810 |
+
frozen_before = frozen_hashes(anchor_layer)
|
| 811 |
+
if opt.one_shot > 1:
|
| 812 |
+
assert len(kwargs["teacher_layers"]) == 32
|
| 813 |
+
assert len(kwargs["student_layers"]) == 32
|
| 814 |
+
assert kwargs["layer_idx"] == 21 and kwargs["absorb_count"] == 8
|
| 815 |
+
print("ONE_SHOT_FIXED_DENSE_TEACHER_BOUNDARY=29 STUDENT_BOUNDARY=21 DROP=22:30", flush=True)
|
| 816 |
+
if opt.record_fit_runtime:
|
| 817 |
+
forward_shapes = {}
|
| 818 |
+
hooks = []
|
| 819 |
+
def trace_forward(label):
|
| 820 |
+
def capture(module, positional, named):
|
| 821 |
+
ids = named.get("input_ids")
|
| 822 |
+
if ids is None and positional:
|
| 823 |
+
ids = positional[0]
|
| 824 |
+
if torch.is_tensor(ids):
|
| 825 |
+
key = label + ":" + "x".join(str(v) for v in ids.shape)
|
| 826 |
+
forward_shapes[key] = forward_shapes.get(key, 0) + 1
|
| 827 |
+
return capture
|
| 828 |
+
for label in ("student", "teacher"):
|
| 829 |
+
hooks.append(kwargs[label + "_model"].register_forward_pre_hook(
|
| 830 |
+
trace_forward(label), with_kwargs=True))
|
| 831 |
+
torch.cuda.synchronize()
|
| 832 |
+
torch.cuda.reset_peak_memory_stats()
|
| 833 |
+
fit_started = time.perf_counter()
|
| 834 |
+
try:
|
| 835 |
+
merged, gates, stats = original_fit(**kwargs)
|
| 836 |
+
finally:
|
| 837 |
+
if opt.record_fit_runtime:
|
| 838 |
+
for hook in hooks:
|
| 839 |
+
hook.remove()
|
| 840 |
+
if opt.record_fit_runtime:
|
| 841 |
+
torch.cuda.synchronize()
|
| 842 |
+
elapsed = time.perf_counter() - fit_started
|
| 843 |
+
loader = kwargs["dataloader"]
|
| 844 |
+
tokens = sum(int(item[1].sum()) for item in loader.dataset)
|
| 845 |
+
stats["runtime"] = {
|
| 846 |
+
"seconds": elapsed, "dataset_tokens": tokens,
|
| 847 |
+
"tokens_per_second": tokens * float(kwargs["args"].distill_epochs) / elapsed,
|
| 848 |
+
"batch_size": int(kwargs["args"].distill_batch_size),
|
| 849 |
+
"batches_per_epoch": len(loader),
|
| 850 |
+
"grad_accumulation": int(kwargs["args"].distill_grad_accum_steps),
|
| 851 |
+
"peak_allocated_bytes": torch.cuda.max_memory_allocated(),
|
| 852 |
+
"peak_reserved_bytes": torch.cuda.max_memory_reserved(),
|
| 853 |
+
"gpu_total_bytes": torch.cuda.get_device_properties(0).total_memory,
|
| 854 |
+
"actual_forward_shapes": forward_shapes,
|
| 855 |
+
}
|
| 856 |
+
if opt.fit_come_attention:
|
| 857 |
+
layer = kwargs["student_layers"][kwargs["layer_idx"]]
|
| 858 |
+
expected = state["initialization_audit"]["frozen_norm_expected_sha256"]
|
| 859 |
+
measured = {n: hashlib.sha256(layer.get_parameter(n).detach().cpu().contiguous()
|
| 860 |
+
.view(torch.uint8).numpy().tobytes()).hexdigest() for n in expected}
|
| 861 |
+
assert measured == expected, "CoMe-initialized norms changed during attention+MLP FiT"
|
| 862 |
+
state["initialization_audit"]["frozen_norm_after_sha256"] = measured
|
| 863 |
+
state["initialization_audit"]["frozen_norms_unchanged"] = True
|
| 864 |
+
if opt.fit_mka_mlp or opt.fit_come_mlp:
|
| 865 |
+
layer = kwargs["student_layers"][kwargs["layer_idx"]]
|
| 866 |
+
expected = state["initialization_audit"]["frozen_attention_norm_expected_sha256"]
|
| 867 |
+
measured = {n: hashlib.sha256(layer.get_parameter(n).detach().cpu().contiguous()
|
| 868 |
+
.view(torch.uint8).numpy().tobytes()).hexdigest() for n in expected}
|
| 869 |
+
assert measured == expected, "Native merged attention/norms changed during MLP-only FiT"
|
| 870 |
+
state["initialization_audit"]["frozen_attention_norm_after_sha256"] = measured
|
| 871 |
+
state["initialization_audit"]["frozen_attention_norm_unchanged"] = True
|
| 872 |
+
if opt.fixed_span_merge_only:
|
| 873 |
+
frozen_after = frozen_hashes(anchor_layer)
|
| 874 |
+
assert frozen_after == frozen_before, "Attention/norm changed during MLP-only FiT"
|
| 875 |
+
audit = state["initialization_audit"]["merge_rule_audit"]
|
| 876 |
+
assert audit["transported_source_mlp_sha256"] == state["transport_operands"]["after"]
|
| 877 |
+
state["initialization_audit"].update({"frozen_attention_norm_unchanged": True,
|
| 878 |
+
"transport_operands": state["transport_operands"]})
|
| 879 |
+
stats["ablation"] = {**state["initialization_audit"],
|
| 880 |
+
"source_feature_transport": bool(kwargs["args"].source_feature_transport),
|
| 881 |
+
"initializer": opt.initializer,
|
| 882 |
+
"removed_count_per_cycle": opt.one_shot,
|
| 883 |
+
"teacher_boundary_current_layer": kwargs["layer_idx"] + opt.one_shot,
|
| 884 |
+
"teacher_boundary_original_layer": state["records"][-1]["removed_original_layers"][-1]}
|
| 885 |
+
(opt.audit_root / f"cycle_{kwargs['progressive_cycle']:02d}_fit.json").write_text(
|
| 886 |
+
json.dumps(stats, indent=2) + "\n")
|
| 887 |
+
return merged, gates, stats
|
| 888 |
+
|
| 889 |
+
base.distill_reparam_merge = fit
|
| 890 |
+
sys.argv = [sys.argv[0], *forwarded]
|
| 891 |
+
base.main()
|
| 892 |
+
# Correct legacy Fisher-specific labels and add reconstructible topology.
|
| 893 |
+
output = Path(forwarded[forwarded.index("--output_dir") + 1])
|
| 894 |
+
for record in state["records"]:
|
| 895 |
+
path = output / f"cycle_{record['cycle']}" / "cycle_metadata.json"
|
| 896 |
+
data = json.loads(path.read_text())
|
| 897 |
+
data.update({k: record[k] for k in ("recipient_original_layer", "removed_original_layer", "recipient_side", "active_original_layers")})
|
| 898 |
+
data["fisher_computed"] = False
|
| 899 |
+
data["merge_initializer"] = opt.initializer
|
| 900 |
+
data["fixed_span_merge_only"] = opt.fixed_span_merge_only
|
| 901 |
+
data["removed_original_layers"] = record["removed_original_layers"]
|
| 902 |
+
data["same_anchor_contextual_fisher"] = {"computed": False}
|
| 903 |
+
if data.get("source_feature_transport"):
|
| 904 |
+
data["source_feature_transport"]["fisher_order"] = "source transport; non-Fisher initialization; additive-U FiT"
|
| 905 |
+
reparam = data.get("distill", {}).get("reparam_stats")
|
| 906 |
+
if reparam:
|
| 907 |
+
reparam["lambda_init"] = opt.initializer
|
| 908 |
+
path.write_text(json.dumps(data, indent=2) + "\n")
|
| 909 |
+
if opt.one_shot > 1:
|
| 910 |
+
import subprocess
|
| 911 |
+
subprocess.run([sys.executable, str(Path(__file__).with_name("package_qwen3_1_7b_one_shot_compact.py")),
|
| 912 |
+
"--run-root", str(output), "--output-root", str(opt.audit_root.parent / "compact"),
|
| 913 |
+
"--model", opt.model_id, "--base-revision", opt.base_revision,
|
| 914 |
+
"--run-id", "llama31_base_wa_oneshot_8block", "--anchor", str(opt.fixed_anchor),
|
| 915 |
+
"--removed-count", str(opt.one_shot)], check=True)
|
| 916 |
+
else:
|
| 917 |
+
from fusegpt.abprune_compact import package
|
| 918 |
+
package(argparse.Namespace(run_root=output, output_root=opt.audit_root.parent / "compact",
|
| 919 |
+
model=opt.model_id, base_revision=opt.base_revision,
|
| 920 |
+
run_id=f"{opt.model_id.split('/')[-1].lower().replace('-', '_')}_fit_{opt.initializer}_{'fixed_span_transport_mlp_' if opt.fixed_span_merge_only else ('full_block_' if opt.fit_full_block else ('attn_mlp_' if opt.fit_attention or opt.fit_come_attention else ('mlp_' if opt.fit_mka_mlp else '')))}{len(state['records'])}block", cycles=len(state["records"]),
|
| 921 |
+
start_cycle=1, layer_order=" ".join(str(r["pair_index"]) for r in state["records"])))
|
| 922 |
+
(opt.audit_root.parent / "TRAIN_COMPLETE").touch()
|
| 923 |
+
|
| 924 |
+
|
| 925 |
+
if __name__ == "__main__":
|
| 926 |
+
main()
|
runs/vast-paper_revision-come-attn-fit-20261126-62646539/20261126-qwen3-base-mka-come-mlp-fit/catalog/code/run_llama31_come_fit_arm.sh
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env bash
|
| 2 |
+
set -euo pipefail
|
| 3 |
+
project="$1"; external="$2"; root="$3"; model="$4"; family="$5"; gpu="$6"; mode="${7:-full}"
|
| 4 |
+
scope="${8:-full}"; subset=all; fit=(--fit-full-block)
|
| 5 |
+
if [[ "$scope" == mlp ]]; then subset=mlp; fit=(--fit-come-mlp); elif [[ "$scope" != full ]]; then exit 2; fi
|
| 6 |
+
export CUDA_VISIBLE_DEVICES="$gpu" HF_HOME=/workspace/.hf_home HF_TOKEN_PATH=/root/.cache/huggingface/token
|
| 7 |
+
export HF_DATASETS_CACHE=/workspace/.hf_datasets36 HF_DATASETS_TRUST_REMOTE_CODE=1
|
| 8 |
+
export HF_HUB_OFFLINE=1 HF_DATASETS_OFFLINE=1
|
| 9 |
+
export PYTHONUNBUFFERED=1 TOKENIZERS_PARALLELISM=false OMP_NUM_THREADS=4
|
| 10 |
+
export PYTHONPATH="$external/src:$project/src${PYTHONPATH:+:$PYTHONPATH}"
|
| 11 |
+
mkdir -p "$root/logs" "$root/audit" "$root/run"
|
| 12 |
+
cycles=8; records=500; calib=64; tokens=524288
|
| 13 |
+
if [[ "$mode" == smoke ]]; then cycles=2; records=20; calib=4; tokens=20480; fi
|
| 14 |
+
if [[ "$family" == instruct ]]; then
|
| 15 |
+
export ABPRUNE_DATASET_REVISION=ce9ed009ef3292bac33d3520afaf5ec804066120
|
| 16 |
+
wrapper=(--model-id meta-llama/Llama-3.1-8B-Instruct --base-revision 0e9e39f249a16976918f6564b8830bc894c89659 --instruction-data)
|
| 17 |
+
data=(--target_tokens 0 --distill_calib_samples 0 --instruction_dataset Open-Orca/SlimOrca
|
| 18 |
+
--instruction_config none --instruction_split train --distill_inst_samples "$records")
|
| 19 |
+
elif [[ "$family" == base ]]; then
|
| 20 |
+
export ABPRUNE_DATASET_REVISION=b5f90f419b7489cdba26fdbc8c022fcb5562f968
|
| 21 |
+
wrapper=(--model-id meta-llama/Llama-3.1-8B --base-revision d04e592bb4f6aa9cfee91e2e20afa771667e1d4b)
|
| 22 |
+
data=(--dataset slimpajama --dataset_config none --target_tokens "$tokens")
|
| 23 |
+
else exit 2; fi
|
| 24 |
+
python "$project/scripts/run_llama31_base_fit_ablation.py" \
|
| 25 |
+
--external-root "$external" --initializer come "${fit[@]}" --audit-root "$root/audit" \
|
| 26 |
+
--come-minimum-retention .97 --come-power 1 "${wrapper[@]}" --model "$model" --output_dir "$root/run" \
|
| 27 |
+
--layer 21 --num_progressive "$cycles" "${data[@]}" --num_samples "$calib" \
|
| 28 |
+
--seq_len 1024 --batch_size 2 --distill_seq_len 1024 --distill_batch_size 1 \
|
| 29 |
+
--distill_epochs 1 --distill_lr 1e-4 --distill_weight_decay 0 --distill_max_grad_norm 1 \
|
| 30 |
+
--distill_grad_accum_steps 1 --distill_kl_weight .02 --distill_kl_temp 4 \
|
| 31 |
+
--distill_hidden_mse_weight 1 --distill_mlp_mse_weight 1 --distill_attn_mse_weight 0 \
|
| 32 |
+
--reparam_eta 0 --reparam_gamma 0 --reparam_param_subset "$subset" \
|
| 33 |
+
--reparam_fisher_init_subset same --reparam_train_subset "$subset" --reparam_rho_objective none \
|
| 34 |
+
--reparam_additive_u --redistrib_teacher_source previous_cycle --fisher_mode param --eps 0 \
|
| 35 |
+
--no_head_permute_merge --no_head_permute_select --dtype bfloat16 --eval_dtype bfloat16 \
|
| 36 |
+
--lora_epochs 0 --skip_eval --skip_final_model_save --distill_log_steps 20 --seed 42 \
|
| 37 |
+
>> "$root/logs/train.log" 2>&1
|
runs/vast-paper_revision-come-attn-fit-20261126-62646539/20261126-qwen3-base-mka-come-mlp-fit/catalog/code/run_qwen_mlp_fit_arm.sh
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env bash
|
| 2 |
+
set -euo pipefail
|
| 3 |
+
project="$1"; external="$2"; root="$3"; model="$4"; method="$5"; selection="$6"; selection_hash="$7"; gpu="$8"
|
| 4 |
+
cycles="${9:-9}"; tokens="${10:-524288}"; fit_hash="${11:-}"; fit_mask_hash="${12:-}"; come_minimum="${13:-0}"
|
| 5 |
+
case "$method" in
|
| 6 |
+
mka) scope_args=(--fit-mka-mlp --mka-data "$selection" --mka-samples 100) ;;
|
| 7 |
+
come) scope_args=(--fit-come-mlp --selection-data "$selection" --come-minimum-retention "$come_minimum" --come-power 1) ;;
|
| 8 |
+
*) echo 'Method must be mka or come'; exit 2 ;;
|
| 9 |
+
esac
|
| 10 |
+
[[ -s "$selection" ]] || { echo 'Frozen native selection input is required; no resampling'; exit 1; }
|
| 11 |
+
if [[ "$tokens" == 524288 ]]; then
|
| 12 |
+
[[ -n "$fit_hash" && -n "$fit_mask_hash" ]] || { echo 'Full FiT requires pinned token/mask hashes'; exit 1; }
|
| 13 |
+
scope_args+=(--expected-fit-input-hash "$fit_hash" --expected-fit-mask-hash "$fit_mask_hash")
|
| 14 |
+
fi
|
| 15 |
+
export CUDA_VISIBLE_DEVICES="$gpu" HF_HOME=/workspace/.hf_home HF_TOKEN_PATH=/root/.cache/huggingface/token
|
| 16 |
+
export HF_DATASETS_CACHE=/workspace/.hf_datasets36 HF_DATASETS_TRUST_REMOTE_CODE=1
|
| 17 |
+
export HF_HUB_OFFLINE=1 HF_DATASETS_OFFLINE=1 TRANSFORMERS_OFFLINE=1
|
| 18 |
+
export PYTHONUNBUFFERED=1 TOKENIZERS_PARALLELISM=false OMP_NUM_THREADS=4
|
| 19 |
+
export PYTHONPATH="$external/src:$project/src${PYTHONPATH:+:$PYTHONPATH}"
|
| 20 |
+
export ABPRUNE_DATASET_REVISION=b5f90f419b7489cdba26fdbc8c022fcb5562f968
|
| 21 |
+
mkdir -p "$root/logs" "$root/audit" "$root/run"
|
| 22 |
+
python "$project/scripts/run_llama31_base_fit_ablation.py" \
|
| 23 |
+
--external-root "$external" --initializer "$method" "${scope_args[@]}" --audit-root "$root/audit" \
|
| 24 |
+
--selection-hash "$selection_hash" --record-fit-runtime --original-layers 36 --fixed-anchor 12 \
|
| 25 |
+
--model-id Qwen/Qwen3-8B-Base --base-revision 49e3418fbbbca6ecbdf9608b4d22e5a407081db4 \
|
| 26 |
+
--model "$model" --output_dir "$root/run" --layer 12 --num_progressive "$cycles" \
|
| 27 |
+
--dataset slimpajama --dataset_config none --target_tokens "$tokens" \
|
| 28 |
+
--num_samples 64 --seq_len 1024 --batch_size 2 \
|
| 29 |
+
--distill_seq_len 1024 --distill_batch_size 1 --distill_epochs 1 --distill_lr 1e-4 \
|
| 30 |
+
--distill_weight_decay 0 --distill_max_grad_norm 1 --distill_grad_accum_steps 1 \
|
| 31 |
+
--distill_kl_weight .02 --distill_kl_temp 4 --distill_hidden_mse_weight 1 \
|
| 32 |
+
--distill_mlp_mse_weight 1 --distill_attn_mse_weight 0 --reparam_eta 0 --reparam_gamma 0 \
|
| 33 |
+
--reparam_param_subset mlp --reparam_fisher_init_subset same --reparam_train_subset mlp \
|
| 34 |
+
--reparam_rho_objective none --reparam_additive_u --redistrib_teacher_source previous_cycle \
|
| 35 |
+
--fisher_mode param --eps 0 --no_head_permute_merge --no_head_permute_select \
|
| 36 |
+
--dtype bfloat16 --eval_dtype bfloat16 --lora_epochs 0 --skip_eval --skip_final_model_save \
|
| 37 |
+
--distill_log_steps 10 --seed 42 >> "$root/logs/train.log" 2>&1
|
runs/vast-paper_revision-come-attn-fit-20261126-62646539/20261126-qwen3-base-mka-come-mlp-fit/catalog/code/source_feature_transport.py
ADDED
|
@@ -0,0 +1,342 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""Stage-local source MLP transport into the anchor MLP input coordinate.
|
| 2 |
+
|
| 3 |
+
The fitted map ``T`` satisfies ``X_anchor @ T ~= X_source``. For linear
|
| 4 |
+
input projections stored as ``W`` (PyTorch convention ``y = x @ W.T``), the
|
| 5 |
+
equivalent source projection in the anchor coordinate is ``W @ T.T``.
|
| 6 |
+
|
| 7 |
+
This module intentionally transports only ``gate_proj`` and ``up_proj``.
|
| 8 |
+
``down_proj`` consumes the SwiGLU intermediate representation rather than the
|
| 9 |
+
decoder hidden coordinate and is therefore left unchanged.
|
| 10 |
+
"""
|
| 11 |
+
|
| 12 |
+
from __future__ import annotations
|
| 13 |
+
|
| 14 |
+
import math
|
| 15 |
+
from typing import Dict, List, Tuple
|
| 16 |
+
|
| 17 |
+
import torch
|
| 18 |
+
|
| 19 |
+
|
| 20 |
+
class _StopAfterSource(RuntimeError):
|
| 21 |
+
"""Abort a model forward once both MLP inputs have been captured."""
|
| 22 |
+
|
| 23 |
+
|
| 24 |
+
def _capture_mlp_inputs(model, layer_a, layer_b, input_ids, attention_mask=None):
|
| 25 |
+
captured: Dict[str, torch.Tensor] = {}
|
| 26 |
+
|
| 27 |
+
def capture_anchor(_module, inputs):
|
| 28 |
+
captured["anchor"] = inputs[0].detach()
|
| 29 |
+
|
| 30 |
+
def capture_source(_module, inputs):
|
| 31 |
+
captured["source"] = inputs[0].detach()
|
| 32 |
+
raise _StopAfterSource()
|
| 33 |
+
|
| 34 |
+
handles = (
|
| 35 |
+
layer_a.mlp.register_forward_pre_hook(capture_anchor),
|
| 36 |
+
layer_b.mlp.register_forward_pre_hook(capture_source),
|
| 37 |
+
)
|
| 38 |
+
try:
|
| 39 |
+
kwargs = {"input_ids": input_ids, "use_cache": False}
|
| 40 |
+
if attention_mask is not None:
|
| 41 |
+
kwargs["attention_mask"] = attention_mask
|
| 42 |
+
try:
|
| 43 |
+
model(**kwargs)
|
| 44 |
+
except _StopAfterSource:
|
| 45 |
+
pass
|
| 46 |
+
finally:
|
| 47 |
+
for handle in handles:
|
| 48 |
+
handle.remove()
|
| 49 |
+
|
| 50 |
+
if set(captured) != {"anchor", "source"}:
|
| 51 |
+
raise RuntimeError(
|
| 52 |
+
"Failed to capture anchor/source MLP inputs; "
|
| 53 |
+
f"captured={sorted(captured)}"
|
| 54 |
+
)
|
| 55 |
+
return captured["anchor"], captured["source"]
|
| 56 |
+
|
| 57 |
+
|
| 58 |
+
def solve_transport_from_statistics(
|
| 59 |
+
gram_sum: torch.Tensor,
|
| 60 |
+
cross_sum: torch.Tensor,
|
| 61 |
+
source_sq_sum: float,
|
| 62 |
+
token_count: int,
|
| 63 |
+
ridge_relative: float,
|
| 64 |
+
) -> Tuple[torch.Tensor, Dict[str, float]]:
|
| 65 |
+
"""Solve ridge OLS and return its calibration-set reconstruction metrics."""
|
| 66 |
+
if token_count <= 0:
|
| 67 |
+
raise ValueError("token_count must be positive")
|
| 68 |
+
if ridge_relative < 0.0:
|
| 69 |
+
raise ValueError("ridge_relative must be non-negative")
|
| 70 |
+
|
| 71 |
+
gram = gram_sum / float(token_count)
|
| 72 |
+
cross = cross_sum / float(token_count)
|
| 73 |
+
target_sq = float(source_sq_sum) / float(token_count)
|
| 74 |
+
mean_diagonal = float(torch.diagonal(gram).mean().item())
|
| 75 |
+
ridge = float(ridge_relative) * mean_diagonal
|
| 76 |
+
regularized = gram.clone()
|
| 77 |
+
regularized.diagonal().add_(ridge)
|
| 78 |
+
chol, info = torch.linalg.cholesky_ex(regularized)
|
| 79 |
+
if int(info.max().item()) != 0:
|
| 80 |
+
raise RuntimeError(
|
| 81 |
+
"Source-feature transport Cholesky failed: "
|
| 82 |
+
f"info={int(info.max().item())}"
|
| 83 |
+
)
|
| 84 |
+
solution = torch.cholesky_solve(cross, chol)
|
| 85 |
+
|
| 86 |
+
# Since (G + ridge I) T = C, tr(T' G T) can be computed without another
|
| 87 |
+
# O(d^3) multiply as <T,C> - ridge ||T||^2.
|
| 88 |
+
dot = float((solution.double() * cross.double()).sum().item())
|
| 89 |
+
solution_sq = float(solution.double().square().sum().item())
|
| 90 |
+
predicted_sq = max(0.0, dot - ridge * solution_sq)
|
| 91 |
+
error_sq = max(0.0, target_sq + predicted_sq - 2.0 * dot)
|
| 92 |
+
denominator = math.sqrt(max(predicted_sq, 0.0) * max(target_sq, 0.0))
|
| 93 |
+
identity = torch.eye(
|
| 94 |
+
solution.shape[0], dtype=solution.dtype, device=solution.device
|
| 95 |
+
)
|
| 96 |
+
relative_identity_distance = float(
|
| 97 |
+
torch.linalg.vector_norm((solution - identity).float()).item()
|
| 98 |
+
/ math.sqrt(float(solution.shape[0]))
|
| 99 |
+
)
|
| 100 |
+
del identity
|
| 101 |
+
|
| 102 |
+
stats = {
|
| 103 |
+
"tokens": int(token_count),
|
| 104 |
+
"ridge_relative": float(ridge_relative),
|
| 105 |
+
"ridge_absolute": ridge,
|
| 106 |
+
"gram_mean_diagonal": mean_diagonal,
|
| 107 |
+
"calibration_nmse": error_sq / target_sq if target_sq > 0.0 else float("nan"),
|
| 108 |
+
"calibration_cosine": dot / denominator if denominator > 0.0 else float("nan"),
|
| 109 |
+
"calibration_norm_ratio": (
|
| 110 |
+
math.sqrt(predicted_sq / target_sq) if target_sq > 0.0 else float("nan")
|
| 111 |
+
),
|
| 112 |
+
"transport_relative_identity_distance": relative_identity_distance,
|
| 113 |
+
}
|
| 114 |
+
return solution, stats
|
| 115 |
+
|
| 116 |
+
|
| 117 |
+
def _apply_transport_to_source_mlp(source_mlp, solution, row_chunk: int) -> None:
|
| 118 |
+
if row_chunk <= 0:
|
| 119 |
+
raise ValueError("row_chunk must be positive")
|
| 120 |
+
with torch.no_grad():
|
| 121 |
+
for projection_name in ("gate_proj", "up_proj"):
|
| 122 |
+
projection = getattr(source_mlp, projection_name)
|
| 123 |
+
original = projection.weight.detach().clone()
|
| 124 |
+
if original.ndim != 2 or original.shape[1] != solution.shape[0]:
|
| 125 |
+
raise ValueError(
|
| 126 |
+
f"Unexpected {projection_name} shape {tuple(original.shape)} "
|
| 127 |
+
f"for transport {tuple(solution.shape)}"
|
| 128 |
+
)
|
| 129 |
+
for start in range(0, original.shape[0], row_chunk):
|
| 130 |
+
end = min(start + row_chunk, original.shape[0])
|
| 131 |
+
transported = original[start:end].float() @ solution.transpose(0, 1)
|
| 132 |
+
projection.weight[start:end].copy_(transported.to(projection.weight.dtype))
|
| 133 |
+
del original
|
| 134 |
+
|
| 135 |
+
|
| 136 |
+
def fit_and_apply_source_feature_transport(
|
| 137 |
+
model,
|
| 138 |
+
layer_a,
|
| 139 |
+
layer_b,
|
| 140 |
+
dataloader,
|
| 141 |
+
device: str,
|
| 142 |
+
ridge_relative: float = 1e-3,
|
| 143 |
+
max_batches: int = 0,
|
| 144 |
+
row_chunk: int = 128,
|
| 145 |
+
) -> Dict[str, object]:
|
| 146 |
+
"""Fit ``X_a T ~= X_b`` and rewrite source MLP input projections."""
|
| 147 |
+
if dataloader is None:
|
| 148 |
+
raise ValueError("Source-feature transport requires a dataloader")
|
| 149 |
+
|
| 150 |
+
previous_training = model.training
|
| 151 |
+
model.eval()
|
| 152 |
+
gram_sum = None
|
| 153 |
+
cross_sum = None
|
| 154 |
+
source_sq_sum = 0.0
|
| 155 |
+
token_count = 0
|
| 156 |
+
batches = 0
|
| 157 |
+
try:
|
| 158 |
+
with torch.no_grad():
|
| 159 |
+
for batch in dataloader:
|
| 160 |
+
if max_batches > 0 and batches >= max_batches:
|
| 161 |
+
break
|
| 162 |
+
input_ids = batch[0].to(device, non_blocking=True)
|
| 163 |
+
attention_mask = (
|
| 164 |
+
batch[1].to(device, non_blocking=True) if len(batch) > 1 else None
|
| 165 |
+
)
|
| 166 |
+
x_a, x_b = _capture_mlp_inputs(
|
| 167 |
+
model, layer_a, layer_b, input_ids, attention_mask
|
| 168 |
+
)
|
| 169 |
+
x_a = x_a.reshape(-1, x_a.shape[-1]).float()
|
| 170 |
+
x_b = x_b.reshape(-1, x_b.shape[-1]).float()
|
| 171 |
+
if attention_mask is not None:
|
| 172 |
+
valid = attention_mask.reshape(-1).to(dtype=torch.bool)
|
| 173 |
+
if valid.numel() != x_a.shape[0]:
|
| 174 |
+
raise RuntimeError(
|
| 175 |
+
"Attention mask does not align with captured MLP inputs"
|
| 176 |
+
)
|
| 177 |
+
x_a = x_a[valid]
|
| 178 |
+
x_b = x_b[valid]
|
| 179 |
+
if gram_sum is None:
|
| 180 |
+
width = x_a.shape[-1]
|
| 181 |
+
gram_sum = torch.zeros(
|
| 182 |
+
(width, width), dtype=torch.float32, device=x_a.device
|
| 183 |
+
)
|
| 184 |
+
cross_sum = torch.zeros_like(gram_sum)
|
| 185 |
+
gram_sum.addmm_(x_a.transpose(0, 1), x_a)
|
| 186 |
+
cross_sum.addmm_(x_a.transpose(0, 1), x_b)
|
| 187 |
+
source_sq_sum += float(x_b.double().square().sum().item())
|
| 188 |
+
token_count += int(x_a.shape[0])
|
| 189 |
+
batches += 1
|
| 190 |
+
finally:
|
| 191 |
+
model.train(previous_training)
|
| 192 |
+
|
| 193 |
+
if gram_sum is None or cross_sum is None or batches == 0:
|
| 194 |
+
raise RuntimeError("No batches were processed for source-feature transport")
|
| 195 |
+
solution, stats = solve_transport_from_statistics(
|
| 196 |
+
gram_sum,
|
| 197 |
+
cross_sum,
|
| 198 |
+
source_sq_sum,
|
| 199 |
+
token_count,
|
| 200 |
+
ridge_relative,
|
| 201 |
+
)
|
| 202 |
+
_apply_transport_to_source_mlp(layer_b.mlp, solution, row_chunk=row_chunk)
|
| 203 |
+
stats.update(
|
| 204 |
+
{
|
| 205 |
+
"enabled": True,
|
| 206 |
+
"batches": int(batches),
|
| 207 |
+
"coordinate_fit": "X_anchor @ T ~= X_source",
|
| 208 |
+
"weight_rewrite": [
|
| 209 |
+
"mlp.gate_proj.weight <- W_source @ T.T",
|
| 210 |
+
"mlp.up_proj.weight <- W_source @ T.T",
|
| 211 |
+
],
|
| 212 |
+
"down_proj_transported": False,
|
| 213 |
+
}
|
| 214 |
+
)
|
| 215 |
+
del solution, gram_sum, cross_sum
|
| 216 |
+
if torch.cuda.is_available():
|
| 217 |
+
torch.cuda.empty_cache()
|
| 218 |
+
return stats
|
| 219 |
+
|
| 220 |
+
|
| 221 |
+
def _drop_container_layer(container, index: int):
|
| 222 |
+
if isinstance(container, torch.nn.ModuleList):
|
| 223 |
+
return torch.nn.ModuleList(
|
| 224 |
+
[layer for layer_index, layer in enumerate(container) if layer_index != index]
|
| 225 |
+
)
|
| 226 |
+
if isinstance(container, list):
|
| 227 |
+
return [layer for layer_index, layer in enumerate(container) if layer_index != index]
|
| 228 |
+
raise TypeError(f"Unsupported layer container: {type(container)}")
|
| 229 |
+
|
| 230 |
+
|
| 231 |
+
def compute_same_anchor_contextual_fisher(
|
| 232 |
+
model,
|
| 233 |
+
parent,
|
| 234 |
+
layer_attr: str,
|
| 235 |
+
container,
|
| 236 |
+
layer_idx: int,
|
| 237 |
+
layer_a,
|
| 238 |
+
layer_b,
|
| 239 |
+
dataloader,
|
| 240 |
+
device: str,
|
| 241 |
+
fisher_mode: str,
|
| 242 |
+
) -> Tuple[List[Dict[str, object]], int, List[Dict[str, int]], Dict[str, float]]:
|
| 243 |
+
"""Measure both candidate MLPs in the same post-pruning anchor topology.
|
| 244 |
+
|
| 245 |
+
The source MLP must already be feature-transported. Two virtual pruned
|
| 246 |
+
models are evaluated on every calibration batch: one uses the native
|
| 247 |
+
anchor MLP and one replaces it with the transported source MLP. The source
|
| 248 |
+
decoder block is absent in both arms, so the gradients describe the actual
|
| 249 |
+
deployment coordinate/topology rather than the source's old depth.
|
| 250 |
+
"""
|
| 251 |
+
if fisher_mode != "param":
|
| 252 |
+
raise ValueError("Same-anchor contextual Fisher currently requires fisher_mode=param")
|
| 253 |
+
|
| 254 |
+
anchor_mlp = layer_a.mlp
|
| 255 |
+
source_mlp = layer_b.mlp
|
| 256 |
+
previous_container = container
|
| 257 |
+
pruned_container = _drop_container_layer(container, layer_idx + 1)
|
| 258 |
+
previous_training = model.training
|
| 259 |
+
|
| 260 |
+
names_a = dict(layer_a.named_parameters())
|
| 261 |
+
names_b = dict(layer_b.named_parameters())
|
| 262 |
+
fisher_a: Dict[str, object] = {}
|
| 263 |
+
fisher_b: Dict[str, object] = {}
|
| 264 |
+
numels_a: Dict[str, int] = {}
|
| 265 |
+
numels_b: Dict[str, int] = {}
|
| 266 |
+
for name, parameter in names_a.items():
|
| 267 |
+
if name.startswith("mlp."):
|
| 268 |
+
fisher_a[name] = torch.zeros_like(parameter, dtype=torch.float32, device="cpu")
|
| 269 |
+
else:
|
| 270 |
+
fisher_a[name] = 0.0
|
| 271 |
+
numels_a[name] = int(parameter.numel())
|
| 272 |
+
for name, parameter in names_b.items():
|
| 273 |
+
if name.startswith("mlp."):
|
| 274 |
+
fisher_b[name] = torch.zeros_like(parameter, dtype=torch.float32, device="cpu")
|
| 275 |
+
else:
|
| 276 |
+
fisher_b[name] = 0.0
|
| 277 |
+
numels_b[name] = int(parameter.numel())
|
| 278 |
+
|
| 279 |
+
for parameter in model.parameters():
|
| 280 |
+
parameter.requires_grad_(False)
|
| 281 |
+
|
| 282 |
+
anchor_loss_sum = 0.0
|
| 283 |
+
source_loss_sum = 0.0
|
| 284 |
+
num_batches = 0
|
| 285 |
+
|
| 286 |
+
def run_arm(candidate_mlp, fisher_target, input_ids, attention_mask):
|
| 287 |
+
layer_a.mlp = candidate_mlp
|
| 288 |
+
for parameter in candidate_mlp.parameters():
|
| 289 |
+
parameter.requires_grad_(True)
|
| 290 |
+
model.zero_grad(set_to_none=True)
|
| 291 |
+
labels = input_ids
|
| 292 |
+
if attention_mask is not None:
|
| 293 |
+
labels = input_ids.masked_fill(attention_mask == 0, -100)
|
| 294 |
+
kwargs = {"input_ids": input_ids, "labels": labels, "use_cache": False}
|
| 295 |
+
if attention_mask is not None:
|
| 296 |
+
kwargs["attention_mask"] = attention_mask
|
| 297 |
+
output = model(**kwargs)
|
| 298 |
+
output.loss.backward()
|
| 299 |
+
for local_name, parameter in candidate_mlp.named_parameters():
|
| 300 |
+
full_name = f"mlp.{local_name}"
|
| 301 |
+
if parameter.grad is not None:
|
| 302 |
+
fisher_target[full_name] += parameter.grad.detach().float().square().cpu()
|
| 303 |
+
loss = float(output.loss.detach().item())
|
| 304 |
+
model.zero_grad(set_to_none=True)
|
| 305 |
+
for parameter in candidate_mlp.parameters():
|
| 306 |
+
parameter.requires_grad_(False)
|
| 307 |
+
return loss
|
| 308 |
+
|
| 309 |
+
try:
|
| 310 |
+
setattr(parent, layer_attr, pruned_container)
|
| 311 |
+
model.eval()
|
| 312 |
+
for batch in dataloader:
|
| 313 |
+
input_ids = batch[0].to(device, non_blocking=True)
|
| 314 |
+
attention_mask = (
|
| 315 |
+
batch[1].to(device, non_blocking=True) if len(batch) > 1 else None
|
| 316 |
+
)
|
| 317 |
+
anchor_loss_sum += run_arm(
|
| 318 |
+
anchor_mlp, fisher_a, input_ids, attention_mask
|
| 319 |
+
)
|
| 320 |
+
source_loss_sum += run_arm(
|
| 321 |
+
source_mlp, fisher_b, input_ids, attention_mask
|
| 322 |
+
)
|
| 323 |
+
num_batches += 1
|
| 324 |
+
finally:
|
| 325 |
+
layer_a.mlp = anchor_mlp
|
| 326 |
+
setattr(parent, layer_attr, previous_container)
|
| 327 |
+
model.train(previous_training)
|
| 328 |
+
|
| 329 |
+
if num_batches == 0:
|
| 330 |
+
raise RuntimeError("No batches were processed for same-anchor contextual Fisher")
|
| 331 |
+
stats = {
|
| 332 |
+
"num_batches": int(num_batches),
|
| 333 |
+
"anchor_candidate_mean_nll": anchor_loss_sum / float(num_batches),
|
| 334 |
+
"transported_source_candidate_mean_nll": source_loss_sum / float(num_batches),
|
| 335 |
+
"source_minus_anchor_mean_nll": (
|
| 336 |
+
source_loss_sum - anchor_loss_sum
|
| 337 |
+
) / float(num_batches),
|
| 338 |
+
"topology": "source block dropped; candidate MLP evaluated at anchor slot",
|
| 339 |
+
"shared_input_coordinate": True,
|
| 340 |
+
"scope": "mlp gate/up/down diagonal empirical Fisher",
|
| 341 |
+
}
|
| 342 |
+
return [fisher_a, fisher_b], num_batches, [numels_a, numels_b], stats
|
runs/vast-paper_revision-come-attn-fit-20261126-62646539/20261126-qwen3-base-mka-come-mlp-fit/catalog/code/verify_public_experiment_backups.py
ADDED
|
@@ -0,0 +1,105 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""Independently verify immutable public HF inventories and every payload digest."""
|
| 2 |
+
import argparse
|
| 3 |
+
import hashlib
|
| 4 |
+
import json
|
| 5 |
+
from pathlib import Path
|
| 6 |
+
import re
|
| 7 |
+
import time
|
| 8 |
+
from urllib.error import HTTPError, URLError
|
| 9 |
+
from urllib.parse import quote
|
| 10 |
+
from urllib.request import Request, urlopen
|
| 11 |
+
|
| 12 |
+
|
| 13 |
+
def fetch(url):
|
| 14 |
+
for attempt in range(4):
|
| 15 |
+
try:
|
| 16 |
+
request = Request(url, headers={"Accept-Encoding": "identity", "User-Agent": "paper-revision-backup-verification"})
|
| 17 |
+
with urlopen(request, timeout=45) as response:
|
| 18 |
+
return response.read(), response.headers.get("Link", "")
|
| 19 |
+
except (HTTPError, URLError, TimeoutError) as error:
|
| 20 |
+
status = getattr(error, "code", None)
|
| 21 |
+
if attempt == 3 or (status is not None and status not in (408, 429, 500, 502, 503, 504)):
|
| 22 |
+
raise
|
| 23 |
+
time.sleep(min(2 ** attempt, 8))
|
| 24 |
+
|
| 25 |
+
|
| 26 |
+
def verify(repo, receipt):
|
| 27 |
+
prefix, revision = receipt["path_in_repo"], receipt["revision"]
|
| 28 |
+
if not re.fullmatch(r"[0-9a-f]{40}", revision):
|
| 29 |
+
raise ValueError("Expected immutable HF commit revision")
|
| 30 |
+
base = "https://huggingface.co/" + repo + "/resolve/" + revision + "/" + quote(prefix, safe="/") + "/"
|
| 31 |
+
raw, _ = fetch(base + "manifest.json")
|
| 32 |
+
digest = hashlib.sha256(raw).hexdigest()
|
| 33 |
+
if receipt.get("manifest_sha256") and digest != receipt["manifest_sha256"]:
|
| 34 |
+
raise ValueError("Manifest does not match the saved receipt")
|
| 35 |
+
manifest = json.loads(raw)
|
| 36 |
+
expected = {entry["path"]: entry for entry in manifest["files"]}
|
| 37 |
+
expected["manifest.json"] = {"path": "manifest.json", "size": len(raw), "sha256": digest}
|
| 38 |
+
inventory = {}
|
| 39 |
+
next_url = ("https://huggingface.co/api/models/" + repo + "/tree/" + revision + "/" +
|
| 40 |
+
quote(prefix, safe="/") + "?recursive=true&expand=false")
|
| 41 |
+
while next_url:
|
| 42 |
+
data, links = fetch(next_url)
|
| 43 |
+
for entry in json.loads(data):
|
| 44 |
+
if entry["type"] == "file":
|
| 45 |
+
inventory[entry["path"][len(prefix) + 1:]] = entry
|
| 46 |
+
match = re.search(r'<([^>]+)>;\s*rel="next"', links)
|
| 47 |
+
next_url = match.group(1) if match else None
|
| 48 |
+
if set(inventory) != set(expected):
|
| 49 |
+
raise ValueError("Remote inventory differs from the immutable payload manifest")
|
| 50 |
+
if receipt.get("files") is not None and len(inventory) != receipt["files"]:
|
| 51 |
+
raise ValueError("File count differs from the saved backup receipt")
|
| 52 |
+
lfs_files = 0
|
| 53 |
+
for name, record in expected.items():
|
| 54 |
+
item = inventory[name]
|
| 55 |
+
if item["size"] != record["size"]:
|
| 56 |
+
raise ValueError("Remote size mismatch: " + name)
|
| 57 |
+
if item.get("lfs"):
|
| 58 |
+
lfs_files += 1
|
| 59 |
+
lfs = item["lfs"]
|
| 60 |
+
actual = lfs.get("oid", lfs.get("sha256", "")).removeprefix("sha256:")
|
| 61 |
+
else:
|
| 62 |
+
if item["size"] > 64 << 20:
|
| 63 |
+
raise ValueError("Large payload has no LFS digest; refuse an accidental model re-download")
|
| 64 |
+
payload, _ = fetch(base + quote(name, safe="/"))
|
| 65 |
+
actual = hashlib.sha256(payload).hexdigest()
|
| 66 |
+
if actual != record["sha256"]:
|
| 67 |
+
raise ValueError("Payload SHA256 mismatch: " + name)
|
| 68 |
+
return {"verified": True, "repo_id": repo, "path_in_repo": prefix, "revision": revision,
|
| 69 |
+
"files": len(expected), "bytes": sum(v["size"] for v in expected.values()),
|
| 70 |
+
"manifest_sha256": digest, "all_payload_hashes_verified": True,
|
| 71 |
+
"lfs_files": lfs_files, "git_blob_files_read_back": len(expected) - lfs_files,
|
| 72 |
+
"verification": "Immutable inventory/sizes, server LFS SHA256, independently downloaded Git blobs"}
|
| 73 |
+
|
| 74 |
+
|
| 75 |
+
def main():
|
| 76 |
+
parser = argparse.ArgumentParser(description=__doc__)
|
| 77 |
+
parser.add_argument("--comparison", type=Path)
|
| 78 |
+
parser.add_argument("--receipts", type=Path, nargs="*")
|
| 79 |
+
parser.add_argument("--output", type=Path, required=True)
|
| 80 |
+
args = parser.parse_args()
|
| 81 |
+
receipts = []
|
| 82 |
+
if args.comparison:
|
| 83 |
+
for row in json.loads(args.comparison.read_text(encoding="utf-8"))["rows"]:
|
| 84 |
+
if row.get("hf_path"):
|
| 85 |
+
receipts.append({"repo_id": "LJYAI/paper_revision", "path_in_repo": row["hf_path"],
|
| 86 |
+
"revision": row["hf_revision"], "manifest_sha256": row.get("hf_manifest_sha256"),
|
| 87 |
+
"files": row.get("hf_files")})
|
| 88 |
+
for path in args.receipts or []:
|
| 89 |
+
receipt = json.loads(path.read_text(encoding="utf-8-sig"))
|
| 90 |
+
if not receipt["verified"]:
|
| 91 |
+
raise ValueError("Input backup receipt was not verified")
|
| 92 |
+
receipts.append(receipt)
|
| 93 |
+
if not receipts:
|
| 94 |
+
parser.error("Supply a comparison or backup receipts")
|
| 95 |
+
results = []
|
| 96 |
+
for receipt in receipts:
|
| 97 |
+
result = verify(receipt.get("repo_id", "LJYAI/paper_revision"), receipt)
|
| 98 |
+
results.append(result)
|
| 99 |
+
print(json.dumps({"verified": True, "path": result["path_in_repo"], "files": result["files"]}), flush=True)
|
| 100 |
+
args.output.parent.mkdir(parents=True, exist_ok=True)
|
| 101 |
+
args.output.write_text(json.dumps({"verified": True, "records": results}, indent=2) + "\n", encoding="utf-8")
|
| 102 |
+
|
| 103 |
+
|
| 104 |
+
if __name__ == "__main__":
|
| 105 |
+
main()
|
runs/vast-paper_revision-come-attn-fit-20261126-62646539/20261126-qwen3-base-mka-come-mlp-fit/catalog/comparison.csv
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
method,label,fit_scope,fit_batch,bench12_pct,mmlu_pct,cmmlu_pct,ppl,training_wall_seconds,new_run,source,selection_input_sha256,fit_input_sha256,fit_mask_sha256,hf_revision
|
| 2 |
+
MKA without FiT,,none,,38.79284767125949,23.394103404073494,25.22016922811259,52.51067353528358,,False,hf://LJYAI/paper_revision/runs/vast-paper_revision-mka-all-small-5090x8-ca-54482709/20261006-mka-small-13checkpoints/qwen3_base_remove9/evaluation/final_14bench.json@5abbdf9f3ace5c51114a7bf50f480b3315084a0f,4f47034e02892bf464998e540be8bd7bc0718f83f6bc9d354c887cc2874cada9,,,15b4ad6fcdf6a42344a86296b4dafa662d08f282
|
| 3 |
+
CoMe without FiT,,none,,52.31430536954963,46.339552770260646,44.102918321533416,23.593915095549406,,False,hf://LJYAI/paper_revision/runs/vast-paper_revision-come-qwen8b-53994057/20261003-come-qwen3-8b-9block-allowrepeat/eval/final_14bench.json@54db29312f8fb27f57d01d48d92489d18e7f7c18,,,,54db29312f8fb27f57d01d48d92489d18e7f7c18
|
| 4 |
+
ABPrune without FiT,,none,,51.25956256004165,25.630252100840334,26.463477810395442,15.585997450543665,,False,results/qwen3_8b_base_nofit_bench14_20261009/summary.json/on,,,,b2a437466b134a6311d3ab625b0b37f9aa1a96d6
|
| 5 |
+
ABPrune + MLP FiT,,mlp,1,53.07235164292536,29.2693348525851,27.594543256777758,11.450465,,False,results/instruct_pruning_experiment_catalog.csv#qwen3_base_transport_9block,,,,
|
| 6 |
+
MKA + MLP FiT,MKA + MLP FiT,mlp,1,46.53387224538528,26.791055405212933,26.70523225695044,15.782106613626244,2588.620101213455,True,results/qwen3_base_mka_come_mlp_fit_20261126/mka/final_14bench.json,4f47034e02892bf464998e540be8bd7bc0718f83f6bc9d354c887cc2874cada9,5d9d4cc2f81d8712b932806c0c2b2992dce9bd3e6c7a143f1f670649b8bfe693,c8e7f8e30cd532b82e6af4b98d596bc7106f29f9fb2b398b44355e624898a30d,7a479c20426d817bb0cb7157c7b5a790b76267f3
|
| 7 |
+
CoMe + MLP FiT,CoMe + MLP FiT,mlp,1,48.743232754988,36.98191140863125,36.14228975997237,19.337434332734354,2727.9755203723907,True,results/qwen3_base_mka_come_mlp_fit_20261126/come/final_14bench.json,0e958e9f08255ee1a4bb4f029d8e7af94c8a26c6b31366a9223fb7629ebf53e3,5d9d4cc2f81d8712b932806c0c2b2992dce9bd3e6c7a143f1f670649b8bfe693,c8e7f8e30cd532b82e6af4b98d596bc7106f29f9fb2b398b44355e624898a30d,43e28d03f09794f7caac7eb99db3a6ac3ff020f4
|
runs/vast-paper_revision-come-attn-fit-20261126-62646539/20261126-qwen3-base-mka-come-mlp-fit/catalog/comparison.json
ADDED
|
@@ -0,0 +1,498 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"model": "Qwen/Qwen3-8B-Base",
|
| 3 |
+
"model_revision": "49e3418fbbbca6ecbdf9608b4d22e5a407081db4",
|
| 4 |
+
"removed_blocks": 9,
|
| 5 |
+
"original_layers": 36,
|
| 6 |
+
"accuracy_scale": "fraction",
|
| 7 |
+
"rows": [
|
| 8 |
+
{
|
| 9 |
+
"method": "MKA without FiT",
|
| 10 |
+
"fit_scope": "none",
|
| 11 |
+
"fit_batch": null,
|
| 12 |
+
"model": "Qwen/Qwen3-8B-Base",
|
| 13 |
+
"model_variant": "Base",
|
| 14 |
+
"removed_blocks": 9,
|
| 15 |
+
"pruning_fraction": 0.25,
|
| 16 |
+
"bench12": 0.38792847671259484,
|
| 17 |
+
"mmlu": 0.23394103404073494,
|
| 18 |
+
"cmmlu": 0.2522016922811259,
|
| 19 |
+
"ppl": 52.51067353528358,
|
| 20 |
+
"task_scores": {
|
| 21 |
+
"race_high": 0.24128073184676957,
|
| 22 |
+
"race_middle": 0.2298050139275766,
|
| 23 |
+
"c3": 0.4158904109589041,
|
| 24 |
+
"cmnli": 0.3235846744547014,
|
| 25 |
+
"chid": 0.3910891089108911,
|
| 26 |
+
"piqa": 0.6017410228509249,
|
| 27 |
+
"winogrande": 0.4846093133385951,
|
| 28 |
+
"hellaswag": 0.34534953196574386,
|
| 29 |
+
"arc_challenge": 0.2235494880546075,
|
| 30 |
+
"arc_easy": 0.42424242424242425,
|
| 31 |
+
"openbookqa": 0.28,
|
| 32 |
+
"sciq": 0.694,
|
| 33 |
+
"mmlu": 0.23394103404073494,
|
| 34 |
+
"cmmlu": 0.2522016922811259
|
| 35 |
+
},
|
| 36 |
+
"accuracy_scale": "fraction",
|
| 37 |
+
"source": "hf://LJYAI/paper_revision/runs/vast-paper_revision-mka-all-small-5090x8-ca-54482709/20261006-mka-small-13checkpoints/qwen3_base_remove9/evaluation/final_14bench.json@5abbdf9f3ace5c51114a7bf50f480b3315084a0f",
|
| 38 |
+
"hf_path": "runs/vast-paper_revision-mka-all-small-5090x8-ca-54482709/20261006-mka-small-13checkpoints/qwen3_base_remove9/model",
|
| 39 |
+
"hf_revision": "15b4ad6fcdf6a42344a86296b4dafa662d08f282",
|
| 40 |
+
"evaluation_hf_path": "runs/vast-paper_revision-mka-all-small-5090x8-ca-54482709/20261006-mka-small-13checkpoints/qwen3_base_remove9/evaluation/final_14bench.json",
|
| 41 |
+
"evaluation_hf_revision": "5abbdf9f3ace5c51114a7bf50f480b3315084a0f",
|
| 42 |
+
"source_code_commit": "2f876a7bd8898e43323394ec089ebbc620622d14",
|
| 43 |
+
"source_git_remote": "https://github.com/leejunyoung8631/paper_revision",
|
| 44 |
+
"source_file_sha256": {
|
| 45 |
+
"final_14bench.json": "1150c4a90a60d767691b6c157c9b322e47c0086fac9950729ccfcc411c623100",
|
| 46 |
+
"ppl.json": "5e181656c5752270a3ebb0b84cb33208757893bd02f6df86ded927c311870259",
|
| 47 |
+
"pruning.json": "98c61eec8a908fd9c10e7e8d05d1d1b5c7ead7f391e1fb8a0e197e4f914685eb"
|
| 48 |
+
},
|
| 49 |
+
"verification": {
|
| 50 |
+
"immutable_raw_metrics_read": true,
|
| 51 |
+
"bench12_recomputed": true,
|
| 52 |
+
"nine_merges_27_retained_layers": true,
|
| 53 |
+
"mmlu_cmmlu_raw_task_scores": true,
|
| 54 |
+
"ppl_from_raw_result": true
|
| 55 |
+
},
|
| 56 |
+
"selection_input_sha256": "4f47034e02892bf464998e540be8bd7bc0718f83f6bc9d354c887cc2874cada9",
|
| 57 |
+
"selection_calibration": {
|
| 58 |
+
"dataset": "DKYoon/SlimPajama-6B",
|
| 59 |
+
"revision": "b5f90f419b7489cdba26fdbc8c022fcb5562f968",
|
| 60 |
+
"split": "train",
|
| 61 |
+
"samples": 100,
|
| 62 |
+
"sequence_length": 512,
|
| 63 |
+
"seed": 0,
|
| 64 |
+
"shuffle_buffer": 10000,
|
| 65 |
+
"add_special_tokens": false,
|
| 66 |
+
"sampling": "one random window per distinct document",
|
| 67 |
+
"input_ids_sha256": "4f47034e02892bf464998e540be8bd7bc0718f83f6bc9d354c887cc2874cada9",
|
| 68 |
+
"tokenizer": "Qwen/Qwen3-8B-Base",
|
| 69 |
+
"tokenizer_revision": "49e3418fbbbca6ecbdf9608b4d22e5a407081db4",
|
| 70 |
+
"tokenizer_vocab_sha256": "c605f1c0a80a9501fca9782b942a7f01474e3f37b1c59e3efea82da0e2f20376"
|
| 71 |
+
},
|
| 72 |
+
"geometry": {
|
| 73 |
+
"sigma": 8.0,
|
| 74 |
+
"alpha": 0.5,
|
| 75 |
+
"dimensions": 2,
|
| 76 |
+
"mi_neighbors": 5,
|
| 77 |
+
"entropy_neighbors": 50,
|
| 78 |
+
"beta": 1.0,
|
| 79 |
+
"seed": 0,
|
| 80 |
+
"pooling": "mean"
|
| 81 |
+
},
|
| 82 |
+
"norm_policy": "retain left residual norms and Q/K norms; seven projection weights and their existing biases",
|
| 83 |
+
"source_cache": {
|
| 84 |
+
"filename": "runs/vast-paper_revision-mka-all-small-5090x8-ca-54482709/20261006-mka-small-13checkpoints/qwen3_base_remove9/model/calibration_ids.pt",
|
| 85 |
+
"revision": "15b4ad6fcdf6a42344a86296b4dafa662d08f282",
|
| 86 |
+
"bytes": 448967,
|
| 87 |
+
"file_sha256": "aa8b546874da296d54ef69d73faffc83802deb089c0209cc55593e32ab50489b"
|
| 88 |
+
},
|
| 89 |
+
"new_run": false
|
| 90 |
+
},
|
| 91 |
+
{
|
| 92 |
+
"method": "CoMe without FiT",
|
| 93 |
+
"fit_scope": "none",
|
| 94 |
+
"fit_batch": null,
|
| 95 |
+
"model": "Qwen/Qwen3-8B-Base",
|
| 96 |
+
"model_variant": "Base",
|
| 97 |
+
"removed_blocks": 9,
|
| 98 |
+
"pruning_fraction": 0.25,
|
| 99 |
+
"bench12": 0.5231430536954963,
|
| 100 |
+
"mmlu": 0.46339552770260645,
|
| 101 |
+
"cmmlu": 0.44102918321533413,
|
| 102 |
+
"ppl": 23.593915095549406,
|
| 103 |
+
"task_scores": {
|
| 104 |
+
"race_high": 0.532590051457976,
|
| 105 |
+
"race_middle": 0.5522284122562674,
|
| 106 |
+
"c3": 0.5084931506849315,
|
| 107 |
+
"cmnli": 0.3446613838738665,
|
| 108 |
+
"chid": 0.698019801980198,
|
| 109 |
+
"piqa": 0.676278563656148,
|
| 110 |
+
"winogrande": 0.5666929755327546,
|
| 111 |
+
"hellaswag": 0.5301732722565226,
|
| 112 |
+
"arc_challenge": 0.31399317406143346,
|
| 113 |
+
"arc_easy": 0.48358585858585856,
|
| 114 |
+
"openbookqa": 0.332,
|
| 115 |
+
"sciq": 0.739,
|
| 116 |
+
"mmlu": 0.46339552770260645,
|
| 117 |
+
"cmmlu": 0.44102918321533413
|
| 118 |
+
},
|
| 119 |
+
"accuracy_scale": "fraction",
|
| 120 |
+
"source": "hf://LJYAI/paper_revision/runs/vast-paper_revision-come-qwen8b-53994057/20261003-come-qwen3-8b-9block-allowrepeat/eval/final_14bench.json@54db29312f8fb27f57d01d48d92489d18e7f7c18",
|
| 121 |
+
"hf_path": "runs/vast-paper_revision-come-qwen8b-53994057/20261003-come-qwen3-8b-9block-allowrepeat",
|
| 122 |
+
"hf_revision": "54db29312f8fb27f57d01d48d92489d18e7f7c18",
|
| 123 |
+
"evaluation_hf_path": "runs/vast-paper_revision-come-qwen8b-53994057/20261003-come-qwen3-8b-9block-allowrepeat/eval/final_14bench.json",
|
| 124 |
+
"evaluation_hf_revision": "54db29312f8fb27f57d01d48d92489d18e7f7c18",
|
| 125 |
+
"source_code_commit": "e2b37a3b00b8a20b594385e35ae09413541d53df",
|
| 126 |
+
"source_git_remote": "https://github.com/leejunyoung8631/paper_revision",
|
| 127 |
+
"source_file_sha256": {
|
| 128 |
+
"final_14bench.json": "3dd4903ff0c34f5a38ca65a1bcf5f3a1895372c3b4fd65bc05294976b6007359",
|
| 129 |
+
"ppl.json": "27979128956b1bb00d54bf03326635fc0ac85fe259df343e5d017a080d0628b7",
|
| 130 |
+
"pruning.json": "0862c1d9c0e16c65c6a28f9730a317de3f93bde4421991b0dea956c1b8a53392"
|
| 131 |
+
},
|
| 132 |
+
"verification": {
|
| 133 |
+
"immutable_raw_metrics_read": true,
|
| 134 |
+
"bench12_recomputed": true,
|
| 135 |
+
"nine_merges_27_retained_layers": true,
|
| 136 |
+
"mmlu_cmmlu_raw_task_scores": true,
|
| 137 |
+
"ppl_from_raw_result": true
|
| 138 |
+
},
|
| 139 |
+
"selection_input_sha256": null,
|
| 140 |
+
"selection_calibration": {
|
| 141 |
+
"dataset": "DKYoon/SlimPajama-6B",
|
| 142 |
+
"rows": 256,
|
| 143 |
+
"packed_windows": 94,
|
| 144 |
+
"sequence_length": 2048,
|
| 145 |
+
"seed": 10,
|
| 146 |
+
"batch_size": 1,
|
| 147 |
+
"saved_token_cache_available": false,
|
| 148 |
+
"legacy_datasets_version": "3.1.0",
|
| 149 |
+
"legacy_transformers_version": "4.52.1"
|
| 150 |
+
},
|
| 151 |
+
"selection_settings": {
|
| 152 |
+
"model": "Qwen/Qwen3-8B-Base",
|
| 153 |
+
"output_dir": "/workspace/runs/20261003-come-qwen3-8b-9block-allowrepeat",
|
| 154 |
+
"target_layers": 27,
|
| 155 |
+
"calibration_dataset": "slimpajama",
|
| 156 |
+
"calibration_rows": 256,
|
| 157 |
+
"sequence_length": 2048,
|
| 158 |
+
"batch_size": 1,
|
| 159 |
+
"seed": 10,
|
| 160 |
+
"power": 1.0,
|
| 161 |
+
"minimum_retention": 0.0,
|
| 162 |
+
"allow_repeat": true,
|
| 163 |
+
"sbi_metric": "angular_last",
|
| 164 |
+
"dtype": "bfloat16",
|
| 165 |
+
"device_map": "auto",
|
| 166 |
+
"attn_implementation": "sdpa",
|
| 167 |
+
"trust_remote_code": false
|
| 168 |
+
},
|
| 169 |
+
"historical_selection": [
|
| 170 |
+
{
|
| 171 |
+
"step": 1,
|
| 172 |
+
"left_index": 31,
|
| 173 |
+
"source_layers": [
|
| 174 |
+
[
|
| 175 |
+
31
|
| 176 |
+
],
|
| 177 |
+
[
|
| 178 |
+
32
|
| 179 |
+
]
|
| 180 |
+
],
|
| 181 |
+
"retention_ratios": [
|
| 182 |
+
0.49274789168296595,
|
| 183 |
+
0.5072521083170339
|
| 184 |
+
],
|
| 185 |
+
"retained_attention_groups": [
|
| 186 |
+
3,
|
| 187 |
+
5
|
| 188 |
+
],
|
| 189 |
+
"retained_mlp_neurons": [
|
| 190 |
+
6054,
|
| 191 |
+
6234
|
| 192 |
+
],
|
| 193 |
+
"pair_score": 0.11533127194072337
|
| 194 |
+
},
|
| 195 |
+
{
|
| 196 |
+
"step": 2,
|
| 197 |
+
"left_index": 16,
|
| 198 |
+
"source_layers": [
|
| 199 |
+
[
|
| 200 |
+
16
|
| 201 |
+
],
|
| 202 |
+
[
|
| 203 |
+
17
|
| 204 |
+
]
|
| 205 |
+
],
|
| 206 |
+
"retention_ratios": [
|
| 207 |
+
0.49296001567209896,
|
| 208 |
+
0.507039984327901
|
| 209 |
+
],
|
| 210 |
+
"retained_attention_groups": [
|
| 211 |
+
3,
|
| 212 |
+
5
|
| 213 |
+
],
|
| 214 |
+
"retained_mlp_neurons": [
|
| 215 |
+
6057,
|
| 216 |
+
6231
|
| 217 |
+
],
|
| 218 |
+
"pair_score": 0.11846736168607752
|
| 219 |
+
},
|
| 220 |
+
{
|
| 221 |
+
"step": 3,
|
| 222 |
+
"left_index": 25,
|
| 223 |
+
"source_layers": [
|
| 224 |
+
[
|
| 225 |
+
26
|
| 226 |
+
],
|
| 227 |
+
[
|
| 228 |
+
27
|
| 229 |
+
]
|
| 230 |
+
],
|
| 231 |
+
"retention_ratios": [
|
| 232 |
+
0.5020186686131197,
|
| 233 |
+
0.4979813313868802
|
| 234 |
+
],
|
| 235 |
+
"retained_attention_groups": [
|
| 236 |
+
5,
|
| 237 |
+
3
|
| 238 |
+
],
|
| 239 |
+
"retained_mlp_neurons": [
|
| 240 |
+
6169,
|
| 241 |
+
6119
|
| 242 |
+
],
|
| 243 |
+
"pair_score": 0.11860260573473383
|
| 244 |
+
},
|
| 245 |
+
{
|
| 246 |
+
"step": 4,
|
| 247 |
+
"left_index": 19,
|
| 248 |
+
"source_layers": [
|
| 249 |
+
[
|
| 250 |
+
20
|
| 251 |
+
],
|
| 252 |
+
[
|
| 253 |
+
21
|
| 254 |
+
]
|
| 255 |
+
],
|
| 256 |
+
"retention_ratios": [
|
| 257 |
+
0.47716604595649,
|
| 258 |
+
0.52283395404351
|
| 259 |
+
],
|
| 260 |
+
"retained_attention_groups": [
|
| 261 |
+
3,
|
| 262 |
+
5
|
| 263 |
+
],
|
| 264 |
+
"retained_mlp_neurons": [
|
| 265 |
+
5863,
|
| 266 |
+
6425
|
| 267 |
+
],
|
| 268 |
+
"pair_score": 0.1312229299640402
|
| 269 |
+
},
|
| 270 |
+
{
|
| 271 |
+
"step": 5,
|
| 272 |
+
"left_index": 26,
|
| 273 |
+
"source_layers": [
|
| 274 |
+
[
|
| 275 |
+
29
|
| 276 |
+
],
|
| 277 |
+
[
|
| 278 |
+
30
|
| 279 |
+
]
|
| 280 |
+
],
|
| 281 |
+
"retention_ratios": [
|
| 282 |
+
0.5138352488350308,
|
| 283 |
+
0.4861647511649692
|
| 284 |
+
],
|
| 285 |
+
"retained_attention_groups": [
|
| 286 |
+
5,
|
| 287 |
+
3
|
| 288 |
+
],
|
| 289 |
+
"retained_mlp_neurons": [
|
| 290 |
+
6315,
|
| 291 |
+
5973
|
| 292 |
+
],
|
| 293 |
+
"pair_score": 0.13291560057946977
|
| 294 |
+
},
|
| 295 |
+
{
|
| 296 |
+
"step": 6,
|
| 297 |
+
"left_index": 14,
|
| 298 |
+
"source_layers": [
|
| 299 |
+
[
|
| 300 |
+
14
|
| 301 |
+
],
|
| 302 |
+
[
|
| 303 |
+
15
|
| 304 |
+
]
|
| 305 |
+
],
|
| 306 |
+
"retention_ratios": [
|
| 307 |
+
0.5310382300298483,
|
| 308 |
+
0.46896176997015177
|
| 309 |
+
],
|
| 310 |
+
"retained_attention_groups": [
|
| 311 |
+
5,
|
| 312 |
+
3
|
| 313 |
+
],
|
| 314 |
+
"retained_mlp_neurons": [
|
| 315 |
+
6526,
|
| 316 |
+
5762
|
| 317 |
+
],
|
| 318 |
+
"pair_score": 0.13335662826578668
|
| 319 |
+
},
|
| 320 |
+
{
|
| 321 |
+
"step": 7,
|
| 322 |
+
"left_index": 22,
|
| 323 |
+
"source_layers": [
|
| 324 |
+
[
|
| 325 |
+
25
|
| 326 |
+
],
|
| 327 |
+
[
|
| 328 |
+
26,
|
| 329 |
+
27
|
| 330 |
+
]
|
| 331 |
+
],
|
| 332 |
+
"retention_ratios": [
|
| 333 |
+
0.437070753724112,
|
| 334 |
+
0.562929246275888
|
| 335 |
+
],
|
| 336 |
+
"retained_attention_groups": [
|
| 337 |
+
3,
|
| 338 |
+
5
|
| 339 |
+
],
|
| 340 |
+
"retained_mlp_neurons": [
|
| 341 |
+
5370,
|
| 342 |
+
6918
|
| 343 |
+
],
|
| 344 |
+
"pair_score": 0.14011256991231696
|
| 345 |
+
},
|
| 346 |
+
{
|
| 347 |
+
"step": 8,
|
| 348 |
+
"left_index": 25,
|
| 349 |
+
"source_layers": [
|
| 350 |
+
[
|
| 351 |
+
31,
|
| 352 |
+
32
|
| 353 |
+
],
|
| 354 |
+
[
|
| 355 |
+
33
|
| 356 |
+
]
|
| 357 |
+
],
|
| 358 |
+
"retention_ratios": [
|
| 359 |
+
0.6128931969396756,
|
| 360 |
+
0.3871068030603244
|
| 361 |
+
],
|
| 362 |
+
"retained_attention_groups": [
|
| 363 |
+
5,
|
| 364 |
+
3
|
| 365 |
+
],
|
| 366 |
+
"retained_mlp_neurons": [
|
| 367 |
+
7532,
|
| 368 |
+
4756
|
| 369 |
+
],
|
| 370 |
+
"pair_score": 0.1459530328816556
|
| 371 |
+
},
|
| 372 |
+
{
|
| 373 |
+
"step": 9,
|
| 374 |
+
"left_index": 2,
|
| 375 |
+
"source_layers": [
|
| 376 |
+
[
|
| 377 |
+
2
|
| 378 |
+
],
|
| 379 |
+
[
|
| 380 |
+
3
|
| 381 |
+
]
|
| 382 |
+
],
|
| 383 |
+
"retention_ratios": [
|
| 384 |
+
0.4223177432383485,
|
| 385 |
+
0.5776822567616515
|
| 386 |
+
],
|
| 387 |
+
"retained_attention_groups": [
|
| 388 |
+
3,
|
| 389 |
+
5
|
| 390 |
+
],
|
| 391 |
+
"retained_mlp_neurons": [
|
| 392 |
+
5189,
|
| 393 |
+
7099
|
| 394 |
+
],
|
| 395 |
+
"pair_score": 0.14644237171779287
|
| 396 |
+
}
|
| 397 |
+
],
|
| 398 |
+
"norm_policy": "Q/K norms convex retention-ratio weighted merge; two residual RMSNorm weights pair mean; freeze all four after initialization",
|
| 399 |
+
"source_catalog_commit": "714db8e7e366f6728c90a8833d3307faa167471c",
|
| 400 |
+
"qualification": "Original token cache and token hash absent from immutable model package; reconstruct legacy inputs and validate native pair-score replay before claiming exact calibration equality.",
|
| 401 |
+
"new_run": false
|
| 402 |
+
},
|
| 403 |
+
{
|
| 404 |
+
"method": "ABPrune without FiT",
|
| 405 |
+
"fit_scope": "none",
|
| 406 |
+
"fit_batch": null,
|
| 407 |
+
"bench12": 0.5125956256004165,
|
| 408 |
+
"mmlu": 0.25630252100840334,
|
| 409 |
+
"cmmlu": 0.2646347781039544,
|
| 410 |
+
"ppl": 15.585997450543665,
|
| 411 |
+
"task_scores": {
|
| 412 |
+
"race_high": 0.2773013150371641,
|
| 413 |
+
"race_middle": 0.27506963788300837,
|
| 414 |
+
"c3": 0.5189041095890411,
|
| 415 |
+
"cmnli": 0.33003839555591863,
|
| 416 |
+
"chid": 0.7475247524752475,
|
| 417 |
+
"hellaswag": 0.525094602668791,
|
| 418 |
+
"piqa": 0.7252448313384113,
|
| 419 |
+
"winogrande": 0.5611681136543015,
|
| 420 |
+
"arc_challenge": 0.37627986348122866,
|
| 421 |
+
"arc_easy": 0.6355218855218855,
|
| 422 |
+
"openbookqa": 0.384,
|
| 423 |
+
"sciq": 0.795,
|
| 424 |
+
"mmlu": 0.25630252100840334,
|
| 425 |
+
"cmmlu": 0.2646347781039544
|
| 426 |
+
},
|
| 427 |
+
"source": "results/qwen3_8b_base_nofit_bench14_20261009/summary.json/on",
|
| 428 |
+
"new_run": false,
|
| 429 |
+
"hf_path": "runs/vast-paper_revision-qwen3-base-nofit-transport-zs6-54974094-20261009/20261009-qwen3-base-nofit-transport-zs6/on",
|
| 430 |
+
"hf_revision": "b2a437466b134a6311d3ab625b0b37f9aa1a96d6"
|
| 431 |
+
},
|
| 432 |
+
{
|
| 433 |
+
"method": "ABPrune + MLP FiT",
|
| 434 |
+
"fit_scope": "mlp",
|
| 435 |
+
"fit_batch": 1,
|
| 436 |
+
"bench12": 0.5307235164292536,
|
| 437 |
+
"mmlu": 0.292693348525851,
|
| 438 |
+
"cmmlu": 0.2759454325677776,
|
| 439 |
+
"ppl": 11.450465,
|
| 440 |
+
"task_scores": {
|
| 441 |
+
"race_high": 0.29559748427672955,
|
| 442 |
+
"race_middle": 0.28551532033426186,
|
| 443 |
+
"c3": 0.5249315068493151,
|
| 444 |
+
"cmnli": 0.32930316150641287,
|
| 445 |
+
"chid": 0.7821782178217822,
|
| 446 |
+
"piqa": 0.7415669205658324,
|
| 447 |
+
"winogrande": 0.5430149960536701,
|
| 448 |
+
"hellaswag": 0.5880302728540131,
|
| 449 |
+
"arc_challenge": 0.3856655290102389,
|
| 450 |
+
"arc_easy": 0.6628787878787878,
|
| 451 |
+
"openbookqa": 0.396,
|
| 452 |
+
"sciq": 0.834,
|
| 453 |
+
"mmlu": 0.292693348525851,
|
| 454 |
+
"cmmlu": 0.2759454325677776
|
| 455 |
+
},
|
| 456 |
+
"source": "results/instruct_pruning_experiment_catalog.csv#qwen3_base_transport_9block",
|
| 457 |
+
"new_run": false,
|
| 458 |
+
"qualification": "Historical canonical catalog; PPL retained at its recorded six-decimal precision"
|
| 459 |
+
},
|
| 460 |
+
{
|
| 461 |
+
"method": "MKA + MLP FiT",
|
| 462 |
+
"label": "MKA + MLP FiT",
|
| 463 |
+
"fit_scope": "mlp",
|
| 464 |
+
"fit_batch": 1,
|
| 465 |
+
"bench12": 0.4653387224538528,
|
| 466 |
+
"mmlu": 0.2679105540521293,
|
| 467 |
+
"cmmlu": 0.2670523225695044,
|
| 468 |
+
"ppl": 15.782106613626244,
|
| 469 |
+
"training_wall_seconds": 2588.620101213455,
|
| 470 |
+
"selection_input_sha256": "4f47034e02892bf464998e540be8bd7bc0718f83f6bc9d354c887cc2874cada9",
|
| 471 |
+
"fit_input_sha256": "5d9d4cc2f81d8712b932806c0c2b2992dce9bd3e6c7a143f1f670649b8bfe693",
|
| 472 |
+
"fit_mask_sha256": "c8e7f8e30cd532b82e6af4b98d596bc7106f29f9fb2b398b44355e624898a30d",
|
| 473 |
+
"source": "results/qwen3_base_mka_come_mlp_fit_20261126/mka/final_14bench.json",
|
| 474 |
+
"new_run": true,
|
| 475 |
+
"hf_path": "runs/vast-paper_revision-come-attn-fit-20261126-62646539/20261126-qwen3-base-mka-come-mlp-fit/mka",
|
| 476 |
+
"hf_revision": "7a479c20426d817bb0cb7157c7b5a790b76267f3"
|
| 477 |
+
},
|
| 478 |
+
{
|
| 479 |
+
"method": "CoMe + MLP FiT",
|
| 480 |
+
"label": "CoMe + MLP FiT",
|
| 481 |
+
"fit_scope": "mlp",
|
| 482 |
+
"fit_batch": 1,
|
| 483 |
+
"bench12": 0.48743232754988003,
|
| 484 |
+
"mmlu": 0.3698191140863125,
|
| 485 |
+
"cmmlu": 0.36142289759972374,
|
| 486 |
+
"ppl": 19.337434332734354,
|
| 487 |
+
"training_wall_seconds": 2727.9755203723907,
|
| 488 |
+
"selection_input_sha256": "0e958e9f08255ee1a4bb4f029d8e7af94c8a26c6b31366a9223fb7629ebf53e3",
|
| 489 |
+
"fit_input_sha256": "5d9d4cc2f81d8712b932806c0c2b2992dce9bd3e6c7a143f1f670649b8bfe693",
|
| 490 |
+
"fit_mask_sha256": "c8e7f8e30cd532b82e6af4b98d596bc7106f29f9fb2b398b44355e624898a30d",
|
| 491 |
+
"source": "results/qwen3_base_mka_come_mlp_fit_20261126/come/final_14bench.json",
|
| 492 |
+
"new_run": true,
|
| 493 |
+
"hf_path": "runs/vast-paper_revision-come-attn-fit-20261126-62646539/20261126-qwen3-base-mka-come-mlp-fit/come",
|
| 494 |
+
"hf_revision": "43e28d03f09794f7caac7eb99db3a6ac3ff020f4"
|
| 495 |
+
}
|
| 496 |
+
],
|
| 497 |
+
"qualification": "Historical controls are not fresh reruns. Native MKA and CoMe keep different geometry/selection calibration. New arms match Qwen Base FiT512x1024 examples/masks/LR/loss/epochs, batch1 and512updates/stage. CoMe reconstructed legacy inputs match first native selection exactly; original saved token cache absent. MKA uses original saved tokens but numerical NPIB/lambda differs slightly with same first selected pair. Do not claim full native replay equivalence or substitute a Bench14 mean for Bench12/MMLU/CMMLU."
|
| 498 |
+
}
|
runs/vast-paper_revision-come-attn-fit-20261126-62646539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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"schema": "sha256-tree-v1",
|
| 3 |
+
"files": [
|
| 4 |
+
{
|
| 5 |
+
"path": "README.md",
|
| 6 |
+
"size": 873,
|
| 7 |
+
"sha256": "7ce1ba67f7f2617f52d485aaf51390ea7d808233eb1bd639ffa892904ec796cd"
|
| 8 |
+
},
|
| 9 |
+
{
|
| 10 |
+
"path": "backup_audit.json",
|
| 11 |
+
"size": 1263,
|
| 12 |
+
"sha256": "0786459343647bcc67c9f8607791baff5c1162d8e7329f9d6eefc54455903eb6"
|
| 13 |
+
},
|
| 14 |
+
{
|
| 15 |
+
"path": "code/abprune_compact.py",
|
| 16 |
+
"size": 12360,
|
| 17 |
+
"sha256": "34f00dc3b96ea3c3dd6dafada682352e2b332e6b1c79fb2033e13f9585254ff3"
|
| 18 |
+
},
|
| 19 |
+
{
|
| 20 |
+
"path": "code/bootstrap_llama31_come_fit2.sh",
|
| 21 |
+
"size": 3092,
|
| 22 |
+
"sha256": "53d76652e71b4ac0b4d8cf8e3444443acf59781e03311a102f8583e2a4597818"
|
| 23 |
+
},
|
| 24 |
+
{
|
| 25 |
+
"path": "code/collect_qwen_mlp_fit_comparison.py",
|
| 26 |
+
"size": 4234,
|
| 27 |
+
"sha256": "d732fd90fc2892ece0ea15ad224b3b677b1891f6366aa3a107dc1a6710b4d1bd"
|
| 28 |
+
},
|
| 29 |
+
{
|
| 30 |
+
"path": "code/come.py",
|
| 31 |
+
"size": 24499,
|
| 32 |
+
"sha256": "782e306e43f59e6fc1df28ba346ee57b03004c283376c661233b144f7491d9f8"
|
| 33 |
+
},
|
| 34 |
+
{
|
| 35 |
+
"path": "code/eval_llama31_8b_12bench.py",
|
| 36 |
+
"size": 6694,
|
| 37 |
+
"sha256": "94f6ca3e633f10b5cdef756c1e88e32cdf1615a8f17d078918c0b412a445fb37"
|
| 38 |
+
},
|
| 39 |
+
{
|
| 40 |
+
"path": "code/eval_llama31_fit_ablation_one.sh",
|
| 41 |
+
"size": 3118,
|
| 42 |
+
"sha256": "ae03668f8f4aae078813858b17aada4d0cc828a848d4321036736bf12ca665dd"
|
| 43 |
+
},
|
| 44 |
+
{
|
| 45 |
+
"path": "code/evaluate_abprune_compact_ppl.py",
|
| 46 |
+
"size": 7038,
|
| 47 |
+
"sha256": "916db0545ee18ba39dbbb0af9ce4f379a1ddef0b54d0477caf402ee24421a050"
|
| 48 |
+
},
|
| 49 |
+
{
|
| 50 |
+
"path": "code/evaluate_hchc_wikitext2_ppl.py",
|
| 51 |
+
"size": 5422,
|
| 52 |
+
"sha256": "a1c1c0bf8422ddc70cc5e9c0049830b9aa594742fdeffa110de7b3dcf30c1dd3"
|
| 53 |
+
},
|
| 54 |
+
{
|
| 55 |
+
"path": "code/finalize_qwen_mlp_fit_comparison.py",
|
| 56 |
+
"size": 16055,
|
| 57 |
+
"sha256": "c3239475214be454957fdc5cfa37bca9e355de20b19c9033003c4c582928156e"
|
| 58 |
+
},
|
| 59 |
+
{
|
| 60 |
+
"path": "code/fit_ablation_come.py",
|
| 61 |
+
"size": 2615,
|
| 62 |
+
"sha256": "21345e899859f09745b008e6a77582a574a2ba66fa9b071634b16fd7969e3dbb"
|
| 63 |
+
},
|
| 64 |
+
{
|
| 65 |
+
"path": "code/fit_ablation_mka.py",
|
| 66 |
+
"size": 19854,
|
| 67 |
+
"sha256": "05679b074c4e8dda5f902598c0115e538128da42dfe75c5402f4adf84262da03"
|
| 68 |
+
},
|
| 69 |
+
{
|
| 70 |
+
"path": "code/fuse_layers.py",
|
| 71 |
+
"size": 131351,
|
| 72 |
+
"sha256": "d2bca0ca9b5bc42da7a29cd5a14f860821486625cebd9da60d01521f07a3f6dc"
|
| 73 |
+
},
|
| 74 |
+
{
|
| 75 |
+
"path": "code/fuse_layers_distill.py",
|
| 76 |
+
"size": 148110,
|
| 77 |
+
"sha256": "d0f2ffcb021e486b9462b45fd7507d492a47ffa5f803768a9bc856721e4be16c"
|
| 78 |
+
},
|
| 79 |
+
{
|
| 80 |
+
"path": "code/inspect_qwen_mlp_fit_run.py",
|
| 81 |
+
"size": 2094,
|
| 82 |
+
"sha256": "7a9e922f195dede19f7b5cb0f9ddf490647648d954cc699601b778f63623de0b"
|
| 83 |
+
},
|
| 84 |
+
{
|
| 85 |
+
"path": "code/launch_llama31_come_fit2.sh",
|
| 86 |
+
"size": 6784,
|
| 87 |
+
"sha256": "0b8fa86012cc34ca690495d2fe99129237ce45b204e42cc343897a6d2411ebd8"
|
| 88 |
+
},
|
| 89 |
+
{
|
| 90 |
+
"path": "code/launch_qwen_mlp_fit_comparison.py",
|
| 91 |
+
"size": 16470,
|
| 92 |
+
"sha256": "6cdc9a3a8b412499912e6b48878fef2bbfe5b4bbaaed497f0fe0c42c99c3a737"
|
| 93 |
+
},
|
| 94 |
+
{
|
| 95 |
+
"path": "code/monitor_qwen_mlp_fit_local.ps1",
|
| 96 |
+
"size": 1464,
|
| 97 |
+
"sha256": "1d9215e98493adcfcf29a2f1bc96d33f41977434b11a590bcaa7a9e2ea8bd03d"
|
| 98 |
+
},
|
| 99 |
+
{
|
| 100 |
+
"path": "code/offline_eval_policy.py",
|
| 101 |
+
"size": 1001,
|
| 102 |
+
"sha256": "6d4b2b315573cc308ada19e24b81166d10a1dd4e2bcf0a1f3799229a6d58135a"
|
| 103 |
+
},
|
| 104 |
+
{
|
| 105 |
+
"path": "code/package_final_fit_backup.py",
|
| 106 |
+
"size": 3144,
|
| 107 |
+
"sha256": "d70551361aa5e114912fe1b3a4ed7bae57da7f6addcc0c6ebec2b322172f3866"
|
| 108 |
+
},
|
| 109 |
+
{
|
| 110 |
+
"path": "code/prepare_lmeval9_local_cache.py",
|
| 111 |
+
"size": 4706,
|
| 112 |
+
"sha256": "b9d7cfa46fa42cc017f53c5fffa34832756246377c3586484c0c54a53a00de8b"
|
| 113 |
+
},
|
| 114 |
+
{
|
| 115 |
+
"path": "code/prepare_offline_ppl_cache.py",
|
| 116 |
+
"size": 1329,
|
| 117 |
+
"sha256": "b623ed2d4a71beda5427f86875bf5ee6364891f2e4854ff03539d3a94db22f2b"
|
| 118 |
+
},
|
| 119 |
+
{
|
| 120 |
+
"path": "code/prepare_qwen_mlp_fit_calibrations.py",
|
| 121 |
+
"size": 5541,
|
| 122 |
+
"sha256": "07a20c6c961fe2166ef970c7af6f370a2a6d96b07e13e29fe5c1c38f5a90a7ee"
|
| 123 |
+
},
|
| 124 |
+
{
|
| 125 |
+
"path": "code/project_commit.txt",
|
| 126 |
+
"size": 41,
|
| 127 |
+
"sha256": "b38c6c5948630f3aba8dbadb0c4c9464cc3894d34544465addc406b502033e33"
|
| 128 |
+
},
|
| 129 |
+
{
|
| 130 |
+
"path": "code/run_external_abprune_instruct_order.py",
|
| 131 |
+
"size": 4771,
|
| 132 |
+
"sha256": "c39736b64fd793a568ed2c4b3dcdfcb27f21123c28e7592392aef145336b0ecd"
|
| 133 |
+
},
|
| 134 |
+
{
|
| 135 |
+
"path": "code/run_llama31_base_fit_ablation.py",
|
| 136 |
+
"size": 57846,
|
| 137 |
+
"sha256": "0f24e655803a8e70cd9e7e3a2ce7d4eecf032cede9656d5c6e4d5a4f054bc4f5"
|
| 138 |
+
},
|
| 139 |
+
{
|
| 140 |
+
"path": "code/run_llama31_come_fit_arm.sh",
|
| 141 |
+
"size": 2729,
|
| 142 |
+
"sha256": "40c4febea4e215eae2598ca8fe09b5dbcf47b1b8d6fd9ab34d40a9c821c7544a"
|
| 143 |
+
},
|
| 144 |
+
{
|
| 145 |
+
"path": "code/run_qwen_mlp_fit_arm.sh",
|
| 146 |
+
"size": 2732,
|
| 147 |
+
"sha256": "a6149e6c386ae46f26066dfde656ce317f2d030cb831bd0b4c112acf32a35e8c"
|
| 148 |
+
},
|
| 149 |
+
{
|
| 150 |
+
"path": "code/source_feature_transport.py",
|
| 151 |
+
"size": 13200,
|
| 152 |
+
"sha256": "75809bdbbc9bf73f07adaf1f0c816fc9abd1d9b7c0b8a0d561c96cb0313e243f"
|
| 153 |
+
},
|
| 154 |
+
{
|
| 155 |
+
"path": "code/verify_public_experiment_backups.py",
|
| 156 |
+
"size": 5147,
|
| 157 |
+
"sha256": "258ae35b639ee4f331f241e78d9be59eb60a4284afbf673a7f71f591c6d56d7a"
|
| 158 |
+
},
|
| 159 |
+
{
|
| 160 |
+
"path": "comparison.csv",
|
| 161 |
+
"size": 2184,
|
| 162 |
+
"sha256": "8e17dfc0a8c59a0c00bee1a505e48ab537c9181ebcbaa1ddcdb5c1bc1b4bb4c8"
|
| 163 |
+
},
|
| 164 |
+
{
|
| 165 |
+
"path": "comparison.json",
|
| 166 |
+
"size": 16974,
|
| 167 |
+
"sha256": "368b7ec7f832e74ede3aecb01a94fe3c7cdb240e9c6e14739a17b6c044516c66"
|
| 168 |
+
},
|
| 169 |
+
{
|
| 170 |
+
"path": "project_commit.txt",
|
| 171 |
+
"size": 41,
|
| 172 |
+
"sha256": "961a2007f926ba36808ff5c38a5d41fef3342aaa68f556f304b07eed60c702f0"
|
| 173 |
+
},
|
| 174 |
+
{
|
| 175 |
+
"path": "report_ko.md",
|
| 176 |
+
"size": 12521,
|
| 177 |
+
"sha256": "0edf169ca901e47682d1ab4af4381ba5ce8d325b4171644c5e6b163746d28db2"
|
| 178 |
+
},
|
| 179 |
+
{
|
| 180 |
+
"path": "results/backup_audit.json",
|
| 181 |
+
"size": 1263,
|
| 182 |
+
"sha256": "0786459343647bcc67c9f8607791baff5c1162d8e7329f9d6eefc54455903eb6"
|
| 183 |
+
},
|
| 184 |
+
{
|
| 185 |
+
"path": "results/come/audit/cycle_01_fit.json",
|
| 186 |
+
"size": 9745,
|
| 187 |
+
"sha256": "97ef46f8a435e2e91c6579dd85a7928a81cdffbf2b07cb022d3c16fe4c5bc55d"
|
| 188 |
+
},
|
| 189 |
+
{
|
| 190 |
+
"path": "results/come/audit/cycle_02_fit.json",
|
| 191 |
+
"size": 9747,
|
| 192 |
+
"sha256": "cdbef5bc60e38659029eeaff91e67f36ec7a30312fa9285d9f0f9d1ca66d7a8d"
|
| 193 |
+
},
|
| 194 |
+
{
|
| 195 |
+
"path": "results/come/audit/cycle_03_fit.json",
|
| 196 |
+
"size": 9747,
|
| 197 |
+
"sha256": "ede6f5001b5f5a6944ee6ebfcd5f2645d2eb29a3c3274707f33f8d1302a413aa"
|
| 198 |
+
},
|
| 199 |
+
{
|
| 200 |
+
"path": "results/come/audit/cycle_04_fit.json",
|
| 201 |
+
"size": 9755,
|
| 202 |
+
"sha256": "9af724a3acae8cc142d559e75b095c5a48a06640f95e53a49ea0886fc3adfce7"
|
| 203 |
+
},
|
| 204 |
+
{
|
| 205 |
+
"path": "results/come/audit/cycle_05_fit.json",
|
| 206 |
+
"size": 9747,
|
| 207 |
+
"sha256": "85347f87939a870178252b430d5993b7dfa091f70a278ca9f654254f85292922"
|
| 208 |
+
},
|
| 209 |
+
{
|
| 210 |
+
"path": "results/come/audit/cycle_06_fit.json",
|
| 211 |
+
"size": 9759,
|
| 212 |
+
"sha256": "e1111bc6c3aff1d7e4bb250cbaa37e2207c14f265bf9c1d085ac404050247c07"
|
| 213 |
+
},
|
| 214 |
+
{
|
| 215 |
+
"path": "results/come/audit/cycle_07_fit.json",
|
| 216 |
+
"size": 9746,
|
| 217 |
+
"sha256": "c4d8c2fced18fa56384e914c2370264c0926ddaa1a80db897881382efcd4e119"
|
| 218 |
+
},
|
| 219 |
+
{
|
| 220 |
+
"path": "results/come/audit/cycle_08_fit.json",
|
| 221 |
+
"size": 9756,
|
| 222 |
+
"sha256": "c291941a3e09172e078aab605ecc5b2fbf0999b2eae487e2cd2fdf14fc5f63d4"
|
| 223 |
+
},
|
| 224 |
+
{
|
| 225 |
+
"path": "results/come/audit/cycle_09_fit.json",
|
| 226 |
+
"size": 9750,
|
| 227 |
+
"sha256": "9af1bc616356be38545ed47c79b9421630baefdc96f327eff5e9a82c0b947807"
|
| 228 |
+
},
|
| 229 |
+
{
|
| 230 |
+
"path": "results/come/audit/data_fingerprints.json",
|
| 231 |
+
"size": 509,
|
| 232 |
+
"sha256": "9fbff8a189977aec07cc97d4945d40794d730426a9498c9a3a56ba066e7afbd4"
|
| 233 |
+
},
|
| 234 |
+
{
|
| 235 |
+
"path": "results/come/audit/selection.json",
|
| 236 |
+
"size": 10645,
|
| 237 |
+
"sha256": "e9cf6261a8d953850f84e6f6c58c1d26110e76fbe8871561c8c2da122a47ee18"
|
| 238 |
+
},
|
| 239 |
+
{
|
| 240 |
+
"path": "results/come/audit/selection_inputs.json",
|
| 241 |
+
"size": 218,
|
| 242 |
+
"sha256": "781f8ee07f94a0d1f34b0145b69a0ae135c0d49ee15a0d2fe3f04e90f9deafc4"
|
| 243 |
+
},
|
| 244 |
+
{
|
| 245 |
+
"path": "results/come/compact_metadata.json",
|
| 246 |
+
"size": 2291,
|
| 247 |
+
"sha256": "c4fbac6a80d1cd6b869fdac2ff125dfed2ce735fae90c41a8527e79c11356ffd"
|
| 248 |
+
},
|
| 249 |
+
{
|
| 250 |
+
"path": "results/come/execution_commit.txt",
|
| 251 |
+
"size": 41,
|
| 252 |
+
"sha256": "b38c6c5948630f3aba8dbadb0c4c9464cc3894d34544465addc406b502033e33"
|
| 253 |
+
},
|
| 254 |
+
{
|
| 255 |
+
"path": "results/come/final_14bench.json",
|
| 256 |
+
"size": 886,
|
| 257 |
+
"sha256": "e5d94d1e744d7d673e5cfb92d1a3609e10a3b9da6821a310555942eb22d4ce22"
|
| 258 |
+
},
|
| 259 |
+
{
|
| 260 |
+
"path": "results/come/final_lmeval9.json",
|
| 261 |
+
"size": 42754,
|
| 262 |
+
"sha256": "1644fa836af75f0a1cbf479899aaab9cbdd35111a299ccd73616dc2e45f23fd4"
|
| 263 |
+
},
|
| 264 |
+
{
|
| 265 |
+
"path": "results/come/final_opencompass5.json",
|
| 266 |
+
"size": 1098,
|
| 267 |
+
"sha256": "85016077d7e03c98b189a22b2460e07aa5e42e2e0a0bf80d5a3a41491dde27b6"
|
| 268 |
+
},
|
| 269 |
+
{
|
| 270 |
+
"path": "results/come/final_ppl.json",
|
| 271 |
+
"size": 1233,
|
| 272 |
+
"sha256": "ca4bbbb5080a3b45e5955ac4630d83a8428460b5f41bc110bff8f51555099a57"
|
| 273 |
+
},
|
| 274 |
+
{
|
| 275 |
+
"path": "results/come/training_elapsed.json",
|
| 276 |
+
"size": 84,
|
| 277 |
+
"sha256": "f4ea045bd97d06680c8cd12c5e0abde5876ea4f41a96b0cdb19a3ad52036e03b"
|
| 278 |
+
},
|
| 279 |
+
{
|
| 280 |
+
"path": "results/come_backup.json",
|
| 281 |
+
"size": 405,
|
| 282 |
+
"sha256": "0644efbd46b85398b7da7afcacc42d8e2893f452aa8ae3a65ebfd1ea19874ed3"
|
| 283 |
+
},
|
| 284 |
+
{
|
| 285 |
+
"path": "results/comparison.csv",
|
| 286 |
+
"size": 2184,
|
| 287 |
+
"sha256": "8e17dfc0a8c59a0c00bee1a505e48ab537c9181ebcbaa1ddcdb5c1bc1b4bb4c8"
|
| 288 |
+
},
|
| 289 |
+
{
|
| 290 |
+
"path": "results/comparison.json",
|
| 291 |
+
"size": 16974,
|
| 292 |
+
"sha256": "368b7ec7f832e74ede3aecb01a94fe3c7cdb240e9c6e14739a17b6c044516c66"
|
| 293 |
+
},
|
| 294 |
+
{
|
| 295 |
+
"path": "results/final_status.json",
|
| 296 |
+
"size": 784,
|
| 297 |
+
"sha256": "022fcf0021a64427a8bf156598386ae0c171ea0e83d4615e876a94181529323e"
|
| 298 |
+
},
|
| 299 |
+
{
|
| 300 |
+
"path": "results/first_native_validation.json",
|
| 301 |
+
"size": 799,
|
| 302 |
+
"sha256": "faa911476698a873842d51999018b761bd55986b724a781fe49c773835590e46"
|
| 303 |
+
},
|
| 304 |
+
{
|
| 305 |
+
"path": "results/instance_retention.json",
|
| 306 |
+
"size": 878,
|
| 307 |
+
"sha256": "8092e3958a3c3318e4674f6742fc4146be93f32be44fd984b92cde3623542a7d"
|
| 308 |
+
},
|
| 309 |
+
{
|
| 310 |
+
"path": "results/launch_status.json",
|
| 311 |
+
"size": 786,
|
| 312 |
+
"sha256": "8fbdeba941fcf9d8ffd43865bbcec8dbbfe59d6251504bc9d858bad5392b51a8"
|
| 313 |
+
},
|
| 314 |
+
{
|
| 315 |
+
"path": "results/mka/audit/cycle_01_fit.json",
|
| 316 |
+
"size": 8858,
|
| 317 |
+
"sha256": "faa4c9316a63d7d38e8b385a964b5933dcfe55966c17c1fb75889496bd8c4d16"
|
| 318 |
+
},
|
| 319 |
+
{
|
| 320 |
+
"path": "results/mka/audit/cycle_02_fit.json",
|
| 321 |
+
"size": 8854,
|
| 322 |
+
"sha256": "f0f2c16999195b2631f340cbd7238a1a211cde20c2e40d0b52809369edb5dc9e"
|
| 323 |
+
},
|
| 324 |
+
{
|
| 325 |
+
"path": "results/mka/audit/cycle_03_fit.json",
|
| 326 |
+
"size": 8981,
|
| 327 |
+
"sha256": "425e9c3873187be95e46e5ec846337dc9416d1ef11cf2b23e6229b3a41d8b739"
|
| 328 |
+
},
|
| 329 |
+
{
|
| 330 |
+
"path": "results/mka/audit/cycle_04_fit.json",
|
| 331 |
+
"size": 8857,
|
| 332 |
+
"sha256": "90a9e77cf510a5fb0f049eb7231dd4b5d33e071dc48b96d4e7bd2363c87ec74d"
|
| 333 |
+
},
|
| 334 |
+
{
|
| 335 |
+
"path": "results/mka/audit/cycle_05_fit.json",
|
| 336 |
+
"size": 8846,
|
| 337 |
+
"sha256": "89343e53a14a458bf734e0cdd21669a015f9d08cfe28bd2f912dc5690a191eb8"
|
| 338 |
+
},
|
| 339 |
+
{
|
| 340 |
+
"path": "results/mka/audit/cycle_06_fit.json",
|
| 341 |
+
"size": 8914,
|
| 342 |
+
"sha256": "bd9f528ec3ff232c05fa79f0e4a8cbe8ea018ceb3fc42c9697d7c82828e5f957"
|
| 343 |
+
},
|
| 344 |
+
{
|
| 345 |
+
"path": "results/mka/audit/cycle_07_fit.json",
|
| 346 |
+
"size": 9003,
|
| 347 |
+
"sha256": "b9f32c35c97c3a51ed50501979bc82ac826b1b8ee6b90fafea64e88fcc6268ee"
|
| 348 |
+
},
|
| 349 |
+
{
|
| 350 |
+
"path": "results/mka/audit/cycle_08_fit.json",
|
| 351 |
+
"size": 8854,
|
| 352 |
+
"sha256": "7ff84e448c7fc291a3a1380f046da79929d4bdbed681559bef2e55cff7980188"
|
| 353 |
+
},
|
| 354 |
+
{
|
| 355 |
+
"path": "results/mka/audit/cycle_09_fit.json",
|
| 356 |
+
"size": 8994,
|
| 357 |
+
"sha256": "07100740d5d8fd356b2efa4b8ce870a1f811a390a7a5f8cc413309f369f0b445"
|
| 358 |
+
},
|
| 359 |
+
{
|
| 360 |
+
"path": "results/mka/audit/data_fingerprints.json",
|
| 361 |
+
"size": 509,
|
| 362 |
+
"sha256": "9fbff8a189977aec07cc97d4945d40794d730426a9498c9a3a56ba066e7afbd4"
|
| 363 |
+
},
|
| 364 |
+
{
|
| 365 |
+
"path": "results/mka/audit/selection.json",
|
| 366 |
+
"size": 282629,
|
| 367 |
+
"sha256": "8ce6d98e64d220a8cffe9b62910f84ca96a5fdfb92ab8f0d57a17932401a9f88"
|
| 368 |
+
},
|
| 369 |
+
{
|
| 370 |
+
"path": "results/mka/audit/selection_inputs.json",
|
| 371 |
+
"size": 430,
|
| 372 |
+
"sha256": "09591936d55cd5a6eaa976509711a353311e4f31e11da07d4d7ef50443a43385"
|
| 373 |
+
},
|
| 374 |
+
{
|
| 375 |
+
"path": "results/mka/compact_metadata.json",
|
| 376 |
+
"size": 2060,
|
| 377 |
+
"sha256": "09ec2316f1486976600cc834c106c1dfe33caf427a49702b12e1e131af7e96a8"
|
| 378 |
+
},
|
| 379 |
+
{
|
| 380 |
+
"path": "results/mka/execution_commit.txt",
|
| 381 |
+
"size": 41,
|
| 382 |
+
"sha256": "b38c6c5948630f3aba8dbadb0c4c9464cc3894d34544465addc406b502033e33"
|
| 383 |
+
},
|
| 384 |
+
{
|
| 385 |
+
"path": "results/mka/final_14bench.json",
|
| 386 |
+
"size": 890,
|
| 387 |
+
"sha256": "cb52435b5109c571a5553ddafc406d183ef20be83973e2a951a04a2854d90490"
|
| 388 |
+
},
|
| 389 |
+
{
|
| 390 |
+
"path": "results/mka/final_lmeval9.json",
|
| 391 |
+
"size": 42803,
|
| 392 |
+
"sha256": "acc4987926f942bf2c5b55cb5c5b2eee6554e52ddf17f05d3af8005dc44a9c83"
|
| 393 |
+
},
|
| 394 |
+
{
|
| 395 |
+
"path": "results/mka/final_opencompass5.json",
|
| 396 |
+
"size": 1098,
|
| 397 |
+
"sha256": "4e40196084e37588db8659621d2cdefc6c364647c7a9fb487ea9e13d57b00e21"
|
| 398 |
+
},
|
| 399 |
+
{
|
| 400 |
+
"path": "results/mka/final_ppl.json",
|
| 401 |
+
"size": 1232,
|
| 402 |
+
"sha256": "3b627da2e2462b18a82dbfd7073f36b7fd8acd53d4d35985e0ceba0185988527"
|
| 403 |
+
},
|
| 404 |
+
{
|
| 405 |
+
"path": "results/mka/training_elapsed.json",
|
| 406 |
+
"size": 83,
|
| 407 |
+
"sha256": "a576c7470b94c178428f45da98bbc0e20b5bb0558224390aaa75fc1f9ecfecb7"
|
| 408 |
+
},
|
| 409 |
+
{
|
| 410 |
+
"path": "results/mka_backup.json",
|
| 411 |
+
"size": 404,
|
| 412 |
+
"sha256": "d9c6035f4899e7e10c43627ed56cd1236e24ad48e689c8ee3a48f59195257497"
|
| 413 |
+
},
|
| 414 |
+
{
|
| 415 |
+
"path": "results/native_references.json",
|
| 416 |
+
"size": 13765,
|
| 417 |
+
"sha256": "80ced6ba0f31e9ff6d0f66d89aa64668901f9f3cb28babb6563512001c50fe20"
|
| 418 |
+
},
|
| 419 |
+
{
|
| 420 |
+
"path": "results/runtime_monitor.jsonl",
|
| 421 |
+
"size": 36323,
|
| 422 |
+
"sha256": "e1ff29bb0c0dbd6a9beb4ddf7927d276de06867bc3d68b683b5da6742eae7ca6"
|
| 423 |
+
},
|
| 424 |
+
{
|
| 425 |
+
"path": "results/selection_provenance.json",
|
| 426 |
+
"size": 43675,
|
| 427 |
+
"sha256": "7d336eb44e8a57aa58ac889c786590498204f939f99ee8158debc164e78953fe"
|
| 428 |
+
},
|
| 429 |
+
{
|
| 430 |
+
"path": "results/smoke_summary.json",
|
| 431 |
+
"size": 51735,
|
| 432 |
+
"sha256": "6d1ee95088030c7541f535c3f65768d9dd315e4724128eb342a7b01753ebdb31"
|
| 433 |
+
},
|
| 434 |
+
{
|
| 435 |
+
"path": "results/summary.json",
|
| 436 |
+
"size": 676160,
|
| 437 |
+
"sha256": "7354c58cde9289839b372a6b09f0e35c73ee34aec9c719c636d385b08ce1967c"
|
| 438 |
+
},
|
| 439 |
+
{
|
| 440 |
+
"path": "summary.json",
|
| 441 |
+
"size": 676160,
|
| 442 |
+
"sha256": "7354c58cde9289839b372a6b09f0e35c73ee34aec9c719c636d385b08ce1967c"
|
| 443 |
+
}
|
| 444 |
+
],
|
| 445 |
+
"total_files": 88,
|
| 446 |
+
"total_bytes": 2629039
|
| 447 |
+
}
|
runs/vast-paper_revision-come-attn-fit-20261126-62646539/20261126-qwen3-base-mka-come-mlp-fit/catalog/project_commit.txt
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
021c81b5b08875362e8b29b55e923fe8c306e5d1
|
runs/vast-paper_revision-come-attn-fit-20261126-62646539/20261126-qwen3-base-mka-come-mlp-fit/catalog/report_ko.md
ADDED
|
@@ -0,0 +1,174 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Qwen3-8B Base native MKA / CoMe + MLP-only FiT, 25%, batch1
|
| 2 |
+
|
| 3 |
+
## 최종 결과 / Final results
|
| 4 |
+
|
| 5 |
+
Qwen3-8B **Base**,25%(9/36블록 제거), 두 방법 모두 MLP-only FiT,
|
| 6 |
+
physicalbatch1. Bench12는 MMLU·CMMLU를 제외한12개 task의 단순평균이며,
|
| 7 |
+
정확도는%입니다. 초기화된 attention4개와 norm4개(Q/K포함)는 고정했습니다.
|
| 8 |
+
|
| 9 |
+
| 방법 | FiT | Bench12 | MMLU | CMMLU | PPL |
|
| 10 |
+
|---|---|---:|---:|---:|---:|
|
| 11 |
+
| MKA | 없음, 기존 참고 | 38.7928 | 23.3941 | 25.2202 | 52.5107 |
|
| 12 |
+
| MKA | MLP-only, batch 1 | 46.5339 | 26.7911 | 26.7052 | 15.7821 |
|
| 13 |
+
| CoMe | 없음, 기존 참고 | 52.3143 | 46.3396 | 44.1029 | 23.5939 |
|
| 14 |
+
| CoMe | MLP-only, batch 1 | 48.7432 | 36.9819 | 36.1423 | 19.3374 |
|
| 15 |
+
|
| 16 |
+
MKA: no-FiT 대비 Bench12 +7.7410%p, MMLU +3.3970%p, CMMLU +1.4851%p.
|
| 17 |
+
|
| 18 |
+
CoMe: no-FiT 대비 Bench12 -3.5711%p, MMLU -9.3576%p, CMMLU -7.9606%p.
|
| 19 |
+
|
| 20 |
+
MKA는 세 정확도 지표가 모두 상승했고, CoMe는 모두 하락했습니다.
|
| 21 |
+
CoMe PPL은 개선됐지만 분류 정확도는 하락했으므로 PPL만으로
|
| 22 |
+
벤치마크 품질 개선을 주장하지 않습니다. 동일512x1024 FiT입력/마스크,
|
| 23 |
+
seed42,epoch/LR/loss/MLP3범위/batch1을 맞춘 단일seed 관측입니다.
|
| 24 |
+
각 방법은 자체 native 선택/병합을 사용했고, FiT 후 동적으로 재선택하므로
|
| 25 |
+
no-FiT와 전체 병합 경로가 같다는 의미는 아닙니다. 원인에 대한 인과
|
| 26 |
+
분해나 방법별 최적 hyperparameter 탐색은 수행하지 않았습니다.
|
| 27 |
+
|
| 28 |
+
같은 모델의 기존 ABPrune MLP FiT 참고는 Bench12 53.0724%,
|
| 29 |
+
MMLU29.2693%,CMMLU27.5945%입니다. ABPrune은 이번 두 FiT모델보다
|
| 30 |
+
Bench12가 높지만, CoMe FiT의 MMLU·CMMLU는 ABPrune보다 높습니다.
|
| 31 |
+
따라서 모든 평가 지표에서 우월하다고 해석하지 않습니다.
|
| 32 |
+
|
| 33 |
+
두 모델 모두27layers/9removals,9단계×512updates,4608optimizerupdates입니다.
|
| 34 |
+
모든18단계에서3MLP U의 gradient/update 및8개 frozen가중치 해시를
|
| 35 |
+
검증했습니다. Full14task 평가 및 호스트 측 모델 백업이 모두 완료됐으며,
|
| 36 |
+
컨트롤러 독립 payload SHA256 검증까지 완료했습니다. 서버는 반납하지 않습니다.
|
| 37 |
+
|
| 38 |
+
User requested Qwen MKA and CoMe at25%, each physicalbatch1 and MLP-only
|
| 39 |
+
FiT, following the completed Llama comparison. Scope is Qwen3-8B **Base**,
|
| 40 |
+
36->27layers, nine removals. GPU0 MKA / GPU1 CoMe on the existing retained
|
| 41 |
+
two-A100-SXM4-80GB instance62646539. No new rental or host restart.
|
| 42 |
+
**Do not return, destroy or stop the instance without a new explicit user
|
| 43 |
+
instruction**, even when experiments and backups finish.
|
| 44 |
+
|
| 45 |
+
Session/SSH: vast-paper_revision-come-attn-fit-20261126-62646539.
|
| 46 |
+
Remote branch: codex/vast-paper_revision-come-attn-fit-20261126-62646539.
|
| 47 |
+
Remote project: /workspace/paper_revision/sessions/vast-paper_revision-come-attn-fit-20261126-62646539.
|
| 48 |
+
New artifact root: /workspace/qwen3-mlp-fit-20261126.
|
| 49 |
+
Controlling local branch: codex/qwen3-mka-come-mlp-fit-20261126.
|
| 50 |
+
Existing external FiT engine: /workspace/external/come-attn-fit.
|
| 51 |
+
Model: Qwen/Qwen3-8B-Base@49e3418fbbbca6ecbdf9608b4d22e5a407081db4,
|
| 52 |
+
local /workspace/models/qwen3-base-49e3418. Exact snapshot prefetched;
|
| 53 |
+
both GPUs idle before this new preparation. Existing Llama MKA evaluation
|
| 54 |
+
is complete; its batch1 weight upload continues independently on CPU/network.
|
| 55 |
+
|
| 56 |
+
Both methods use native dynamic pair selection and initialization, reselect
|
| 57 |
+
after each stage's FiT, with no imposed ABPrune span, Fisher, Transport,
|
| 58 |
+
rho, LoRA, head permutation, or extra donor model. Fit only selected merged
|
| 59 |
+
block's three MLP projections: gate/up/down. Qwen's block has11weights,
|
| 60 |
+
including Q/K norms. Freeze the four initialized attention projections and
|
| 61 |
+
all four initialized norms (eight frozen parameter tensors).
|
| 62 |
+
|
| 63 |
+
- Corrected local MKA variant: native frozen100x512 SlimPajama windows,
|
| 64 |
+
seed0, mean-pooled block outputs before final norm; sigma8/alpha.5/dim2/
|
| 65 |
+
MIneighbors5/entropyneighbors50/beta1. Maximum adjacent NPIB, deeper
|
| 66 |
+
exact ties, recompute after each merge/FiT. Initialize seven projections
|
| 67 |
+
by FP32 lerp then model-dtype conversion; retain all four left-anchor norms.
|
| 68 |
+
This is the project's corrected local variant, not an exact paper reproduction.
|
| 69 |
+
- Native CoMe: SlimPajama256 source rows ->94packed2048windows,
|
| 70 |
+
seed10/buffer10000, scoringbatch1, angular_last, power1, minimumretention0,
|
| 71 |
+
repeat allowed. **Do not substitute Llama's minimumretention.97.**
|
| 72 |
+
Q/K norms follow native retention-weighted merge, two residual RMSNorms
|
| 73 |
+
follow native unweighted pair mean; freeze all four after initialization.
|
| 74 |
+
|
| 75 |
+
MKA original token cache: HF LJYAI/paper_revision at
|
| 76 |
+
15b4ad6fcdf6a42344a86296b4dafa662d08f282,
|
| 77 |
+
runs/vast-paper_revision-mka-all-small-5090x8-ca-54482709/
|
| 78 |
+
20261006-mka-small-13checkpoints/qwen3_base_remove9/model/calibration_ids.pt.
|
| 79 |
+
File448967bytes/SHA256aa8b546874da296d54ef69d73faffc83802deb089c0209cc55593e32ab50489b;
|
| 80 |
+
input SHA2564f47034e02892bf464998e540be8bd7bc0718f83f6bc9d354c887cc2874cada9;
|
| 81 |
+
vocabulary SHA256c605f1c0a80a9501fca9782b942a7f01474e3f37b1c59e3efea82da0e2f20376.
|
| 82 |
+
CoMe historical token cache was not saved. Reconstruct with pinned legacy
|
| 83 |
+
datasets3.1.0 / Transformers4.52.1, preserve exact new tokens/doc hashes,
|
| 84 |
+
compare native behavior where practical, and qualify any historical numerical
|
| 85 |
+
differences instead of claiming an immutable original token-cache match.
|
| 86 |
+
|
| 87 |
+
FiT recipe matches existing Qwen Base ABPrune controls: pinned SlimPajama
|
| 88 |
+
b5f90f419b7489cdba26fdbc8c022fcb5562f968; seed42;512x1024,524288tokens/stage;
|
| 89 |
+
batch1,accumulation1,one epoch/stage,512updates/stage,LR1e-4,WD0,clip1;
|
| 90 |
+
hiddenMSE1/MLPMSE1/attentionMSE0/KL.02/temp4,previous-cycle teacher,
|
| 91 |
+
BF16 model plus zero-initialized additive FP32 U. Expected FiT input SHA256
|
| 92 |
+
5d9d4cc2f81d8712b932806c0c2b2992dce9bd3e6c7a143f1f670649b8bfe693;
|
| 93 |
+
mask SHA256c8e7f8e30cd532b82e6af4b98d596bc7106f29f9fb2b398b44355e624898a30d.
|
| 94 |
+
Check both hashes before full training. Native selection data remains separate.
|
| 95 |
+
|
| 96 |
+
Before full9cycles, validate Qwen native11weight initialization, frozen8,
|
| 97 |
+
three nonzero MLP U gradients/updates, unchanged teacher, and a real
|
| 98 |
+
64sequence/batch1 one-cycle smoke per method. Preserve Llama regression tests.
|
| 99 |
+
Reuse strict offline131benchmark assets under /workspace/come-attn-fit-20261126.
|
| 100 |
+
Final metrics: WikiText2 packed2048 PPL, full Bench12, MMLU and CMMLU separately.
|
| 101 |
+
Back up only final reconstructible stage09 compact states, code, audits and
|
| 102 |
+
raw results. No raw token caches or private pooled features are published.
|
| 103 |
+
|
| 104 |
+
HF output: LJYAI/paper_revision/runs/
|
| 105 |
+
vast-paper_revision-come-attn-fit-20261126-62646539/
|
| 106 |
+
20261126-qwen3-base-mka-come-mlp-fit/<mka|come>.
|
| 107 |
+
Only the local controller pushes GitHub; code/notes move by SSH Git bundles.
|
| 108 |
+
Read-only five-minute monitoring must never change the instance state.
|
| 109 |
+
|
| 110 |
+
Status: model downloaded and native input/calibration preparation in progress;
|
| 111 |
+
no new Qwen accuracy result exists yet. Verified historical no-FiT references
|
| 112 |
+
and fitting hashes are recorded in
|
| 113 |
+
results/qwen3_base_mka_come_mlp_fit_20261126/native_references.json.
|
| 114 |
+
|
| 115 |
+
|
| 116 |
+
## Validated launch, 2026-11-26 18:55:45 KST
|
| 117 |
+
|
| 118 |
+
Source74185322c, production controllerPID13362, GPU0MKA/GPU1CoMe,
|
| 119 |
+
eachbatch1/9cycles. Actual full512x1024 FiT input/mask hashes in BOTHarms
|
| 120 |
+
match existing Qwen Base controls exactly before fitting began. All131offline
|
| 121 |
+
benchmark caches validated. Two real64sequence probes passed MLP3/attention0/
|
| 122 |
+
other0, three nonzero U gradients and updates, and all8frozen attention/norm
|
| 123 |
+
expected-before-after hashes. Actualteacher/student forward shape1x1024.
|
| 124 |
+
Smoke FiT secondsMKA36.1529198/CoMe36.1404278; peak reserved43.16GB/40.71GB.
|
| 125 |
+
QwenQKnorm/teacher/native initializer algebra and LlamaMLP3/attention7/full9
|
| 126 |
+
regressions passed; no host restart or rental.
|
| 127 |
+
|
| 128 |
+
MKA immutable input100x512 hash4f470... restored exactly. CoMe legacy
|
| 129 |
+
preparation initially ran offline and fell back to a different cached dataset
|
| 130 |
+
reader, yielding106windows; the94window guard rejected it before saving or
|
| 131 |
+
training. Repeated only preparation with the same pinned legacy loader online;
|
| 132 |
+
existingMKA tensors were revalidated without overwrite. Correct94window CoMe
|
| 133 |
+
input SHA2560e958e9f08255ee1a4bb4f029d8e7af94c8a26c6b31366a9223fb7629ebf53e3,
|
| 134 |
+
maskSHA25639024bd69b2936f651f76827b6e0b1118b908ff87f1aa3df24f097246fd42dfa.
|
| 135 |
+
No wrong106window checkpoint exists or was used.
|
| 136 |
+
|
| 137 |
+
Native first-stage checks: CoMe pair31/32, score0.11533127194072337,
|
| 138 |
+
ratios[0.49274789168296595,0.5072521083170339], retained attention3/5 and
|
| 139 |
+
MLP6054/6234, all exactly equal the historical first stage. Historical CoMe
|
| 140 |
+
token cache was not saved: this verifies reconstructed recipe/first behavior,
|
| 141 |
+
not an immutable historical token hash or full9stage replay. MKA pair13/14
|
| 142 |
+
matches historical; observedlambda0.6225208206034097 versus0.6225201943477188,
|
| 143 |
+
NPIB2.0866975139397255 versus2.104302442487761. Preserve numerical differences;
|
| 144 |
+
do not force historical coefficients or claim byte-identical full replay.
|
| 145 |
+
|
| 146 |
+
Exact command:
|
| 147 |
+
```bash
|
| 148 |
+
python scripts/launch_qwen_mlp_fit_comparison.py --project /workspace/paper_revision/sessions/vast-paper_revision-come-attn-fit-20261126-62646539 --external /workspace/external/come-attn-fit --root /workspace/qwen3-mlp-fit-20261126 --model /workspace/models/qwen3-base-49e3418 --session vast-paper_revision-come-attn-fit-20261126-62646539 --mka-selection /workspace/qwen3-mlp-fit-20261126/calibration/mka/selection.pt --mka-selection-metadata /workspace/qwen3-mlp-fit-20261126/calibration/mka/selection.json --mka-selection-hash 4f47034e02892bf464998e540be8bd7bc0718f83f6bc9d354c887cc2874cada9 --come-selection /workspace/qwen3-mlp-fit-20261126/calibration/come/selection.pt --come-selection-metadata /workspace/qwen3-mlp-fit-20261126/calibration/come/selection.json --come-selection-hash 0e958e9f08255ee1a4bb4f029d8e7af94c8a26c6b31366a9223fb7629ebf53e3 --eval-root /workspace/come-attn-fit-20261126
|
| 149 |
+
```
|
| 150 |
+
Five-minute read-only monitor is active. Both arms automatically advance to
|
| 151 |
+
PPL/full14task evaluation/final verified model backup. Bench12 excludesMMLU/
|
| 152 |
+
CMMLU, which remain separate. **Retain instance62646539 after completion.**
|
| 153 |
+
|
| 154 |
+
## Training checkpoint 2026-11-26T10:20:10Z
|
| 155 |
+
|
| 156 |
+
Completed stages MKA4/9, CoMe4/9. Every completed audit confirms MLP3/attention0/other0, nonzero MLP updates and exact expected/before/after hashes for eight frozen attention/norm tensors. Both fullFiT512token/mask hashes remain matched. No failure, resampling or training/host restart. No final accuracy available. Instance retained running.
|
| 157 |
+
|
| 158 |
+
## Both9stage pruning/FiT runs completed
|
| 159 |
+
|
| 160 |
+
- mka: completed2026-11-26T10:38:54Z, pruning+FiT wall2588.620101213455s, WikiText2 PPL15.782106613626244/NLL2.7588768054699075, 145sequences/296815predictedtokens; final compact retains5fitted block states.
|
| 161 |
+
- come: completed2026-11-26T10:41:13Z, pruning+FiT wall2727.9755203723907s, WikiText2 PPL19.337434332734354/NLL2.9620428200425772, 145sequences/296815predictedtokens; final compact retains6fitted block states.
|
| 162 |
+
|
| 163 |
+
Both final models contain27layers after9removals from36. All18audits passed MLP3/attention0/other0, nonzeroUupdates and8exact frozen attention/norm hashes. Both actual512FiTinput/mask hashes match historicalQwenABcontrols. No training or host restart. Full14task evaluations are active ontheirassignedGPUs; no final accuracy claim yet. Instance explicitly retained.
|
| 164 |
+
|
| 165 |
+
## Immutable model backups
|
| 166 |
+
|
| 167 |
+
- mka: `runs/vast-paper_revision-come-attn-fit-20261126-62646539/20261126-qwen3-base-mka-come-mlp-fit/mka` at `7a479c20426d817bb0cb7157c7b5a790b76267f3`; 67payload files/1931463108bytes plusmanifest.
|
| 168 |
+
- come: `runs/vast-paper_revision-come-attn-fit-20261126-62646539/20261126-qwen3-base-mka-come-mlp-fit/come` at `43e28d03f09794f7caac7eb99db3a6ac3ff020f4`; 68payload files/2317150009bytes plusmanifest.
|
| 169 |
+
|
| 170 |
+
## Final independent verification and retained idle instance
|
| 171 |
+
|
| 172 |
+
All137model-backupfiles (MKA68,CoMe69) passed independent immutable inventories/sizes, server LFS SHA256 and directly downloaded Git-blob digests. Raw14scores were independently averaged toBench12. Exactly2Qwen canonical records appended, allpreviouscatalogbytes/rows preserved;6comparisonrows retain historical reference qualifications. Runtime five-minute snapshots are archived in runtime_monitor.jsonl.
|
| 173 |
+
|
| 174 |
+
Final provider status actual/intended=running on instance62646539; SSH observation2026-11-26T11:13:35Z confirms bothGPU0%/0MiB, no compute processes. No return/destroy/stop was issued. Keep the server running until a new explicit user instruction; hourly quote remainsUSD2.4137037037includingdisk. Both Qwen jobs and prior LlamaMKA jobs are complete and backed up.
|
runs/vast-paper_revision-come-attn-fit-20261126-62646539/20261126-qwen3-base-mka-come-mlp-fit/catalog/results/backup_audit.json
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"verified": true,
|
| 3 |
+
"records": [
|
| 4 |
+
{
|
| 5 |
+
"verified": true,
|
| 6 |
+
"repo_id": "LJYAI/paper_revision",
|
| 7 |
+
"path_in_repo": "runs/vast-paper_revision-come-attn-fit-20261126-62646539/20261126-qwen3-base-mka-come-mlp-fit/mka",
|
| 8 |
+
"revision": "7a479c20426d817bb0cb7157c7b5a790b76267f3",
|
| 9 |
+
"files": 68,
|
| 10 |
+
"bytes": 1931474221,
|
| 11 |
+
"manifest_sha256": "0c3ce4c30e1cdbb272d6d98e225fe61cfc547371c1e0a649f3ab042683f468e8",
|
| 12 |
+
"all_payload_hashes_verified": true,
|
| 13 |
+
"lfs_files": 5,
|
| 14 |
+
"git_blob_files_read_back": 63,
|
| 15 |
+
"verification": "Immutable inventory/sizes, server LFS SHA256, independently downloaded Git blobs"
|
| 16 |
+
},
|
| 17 |
+
{
|
| 18 |
+
"verified": true,
|
| 19 |
+
"repo_id": "LJYAI/paper_revision",
|
| 20 |
+
"path_in_repo": "runs/vast-paper_revision-come-attn-fit-20261126-62646539/20261126-qwen3-base-mka-come-mlp-fit/come",
|
| 21 |
+
"revision": "43e28d03f09794f7caac7eb99db3a6ac3ff020f4",
|
| 22 |
+
"files": 69,
|
| 23 |
+
"bytes": 2317161299,
|
| 24 |
+
"manifest_sha256": "d04c75128b2fb4e58fad0cda085b408facc54183bfc538a76e3c3a399b8d5de5",
|
| 25 |
+
"all_payload_hashes_verified": true,
|
| 26 |
+
"lfs_files": 6,
|
| 27 |
+
"git_blob_files_read_back": 63,
|
| 28 |
+
"verification": "Immutable inventory/sizes, server LFS SHA256, independently downloaded Git blobs"
|
| 29 |
+
}
|
| 30 |
+
]
|
| 31 |
+
}
|
runs/vast-paper_revision-come-attn-fit-20261126-62646539/20261126-qwen3-base-mka-come-mlp-fit/catalog/results/come/audit/cycle_01_fit.json
ADDED
|
@@ -0,0 +1,308 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"enabled": true,
|
| 3 |
+
"epochs": 1.0,
|
| 4 |
+
"requested_epochs": 1.0,
|
| 5 |
+
"skip_train": false,
|
| 6 |
+
"trained": true,
|
| 7 |
+
"lr": 0.0001,
|
| 8 |
+
"hidden_mse_weight": 1.0,
|
| 9 |
+
"attn_mse_weight": 0.0,
|
| 10 |
+
"mlp_mse_weight": 1.0,
|
| 11 |
+
"eta": 0.0,
|
| 12 |
+
"gamma": 0.0,
|
| 13 |
+
"attn_reg_scale": 1.0,
|
| 14 |
+
"mlp_reg_scale": 1.0,
|
| 15 |
+
"param_subset": "mlp",
|
| 16 |
+
"train_subset": "mlp",
|
| 17 |
+
"num_gates": 3,
|
| 18 |
+
"num_attn_gates": 0,
|
| 19 |
+
"num_mlp_gates": 3,
|
| 20 |
+
"num_other_gates": 0,
|
| 21 |
+
"num_trainable_attn_gates": 0,
|
| 22 |
+
"num_trainable_mlp_gates": 3,
|
| 23 |
+
"num_trainable_other_gates": 0,
|
| 24 |
+
"lambda_init_summary": {
|
| 25 |
+
"num_tensors": 3,
|
| 26 |
+
"num_elements": 3,
|
| 27 |
+
"mean": 0.9998999834060669,
|
| 28 |
+
"std": 0.0,
|
| 29 |
+
"min": 0.9998999834060669,
|
| 30 |
+
"max": 0.9998999834060669,
|
| 31 |
+
"mean_abs_from_0_5": 0.4998999834060669,
|
| 32 |
+
"per_tensor": {
|
| 33 |
+
"mlp.gate_proj.weight": {
|
| 34 |
+
"mean": 0.9998999834060669,
|
| 35 |
+
"std": 0.0,
|
| 36 |
+
"min": 0.9998999834060669,
|
| 37 |
+
"max": 0.9998999834060669,
|
| 38 |
+
"mean_abs_from_0_5": 0.4998999834060669
|
| 39 |
+
},
|
| 40 |
+
"mlp.up_proj.weight": {
|
| 41 |
+
"mean": 0.9998999834060669,
|
| 42 |
+
"std": 0.0,
|
| 43 |
+
"min": 0.9998999834060669,
|
| 44 |
+
"max": 0.9998999834060669,
|
| 45 |
+
"mean_abs_from_0_5": 0.4998999834060669
|
| 46 |
+
},
|
| 47 |
+
"mlp.down_proj.weight": {
|
| 48 |
+
"mean": 0.9998999834060669,
|
| 49 |
+
"std": 0.0,
|
| 50 |
+
"min": 0.9998999834060669,
|
| 51 |
+
"max": 0.9998999834060669,
|
| 52 |
+
"mean_abs_from_0_5": 0.4998999834060669
|
| 53 |
+
}
|
| 54 |
+
}
|
| 55 |
+
},
|
| 56 |
+
"lambda_final_summary": {
|
| 57 |
+
"num_tensors": 3,
|
| 58 |
+
"num_elements": 3,
|
| 59 |
+
"mean": 1.0,
|
| 60 |
+
"std": 0.0,
|
| 61 |
+
"min": 1.0,
|
| 62 |
+
"max": 1.0,
|
| 63 |
+
"mean_abs_from_0_5": 0.5,
|
| 64 |
+
"per_tensor": {
|
| 65 |
+
"mlp.gate_proj.weight": {
|
| 66 |
+
"mean": 1.0,
|
| 67 |
+
"std": 0.0,
|
| 68 |
+
"min": 1.0,
|
| 69 |
+
"max": 1.0,
|
| 70 |
+
"mean_abs_from_0_5": 0.5
|
| 71 |
+
},
|
| 72 |
+
"mlp.up_proj.weight": {
|
| 73 |
+
"mean": 1.0,
|
| 74 |
+
"std": 0.0,
|
| 75 |
+
"min": 1.0,
|
| 76 |
+
"max": 1.0,
|
| 77 |
+
"mean_abs_from_0_5": 0.5
|
| 78 |
+
},
|
| 79 |
+
"mlp.down_proj.weight": {
|
| 80 |
+
"mean": 1.0,
|
| 81 |
+
"std": 0.0,
|
| 82 |
+
"min": 1.0,
|
| 83 |
+
"max": 1.0,
|
| 84 |
+
"mean_abs_from_0_5": 0.5
|
| 85 |
+
}
|
| 86 |
+
}
|
| 87 |
+
},
|
| 88 |
+
"lambda_delta_from_init": {
|
| 89 |
+
"num_tensors": 3,
|
| 90 |
+
"num_elements": 3,
|
| 91 |
+
"mean_abs": 0.0,
|
| 92 |
+
"rms": 0.0,
|
| 93 |
+
"max_abs": 0.0,
|
| 94 |
+
"per_tensor": {
|
| 95 |
+
"mlp.gate_proj.weight": {
|
| 96 |
+
"mean_abs": 0.0,
|
| 97 |
+
"rms": 0.0,
|
| 98 |
+
"max_abs": 0.0
|
| 99 |
+
},
|
| 100 |
+
"mlp.up_proj.weight": {
|
| 101 |
+
"mean_abs": 0.0,
|
| 102 |
+
"rms": 0.0,
|
| 103 |
+
"max_abs": 0.0
|
| 104 |
+
},
|
| 105 |
+
"mlp.down_proj.weight": {
|
| 106 |
+
"mean_abs": 0.0,
|
| 107 |
+
"rms": 0.0,
|
| 108 |
+
"max_abs": 0.0
|
| 109 |
+
}
|
| 110 |
+
}
|
| 111 |
+
},
|
| 112 |
+
"first_grad_summary": {
|
| 113 |
+
"joint": {
|
| 114 |
+
"step": 1,
|
| 115 |
+
"phase": "joint",
|
| 116 |
+
"gate": {
|
| 117 |
+
"num_tensors": 3,
|
| 118 |
+
"num_tensors_without_grad": 3,
|
| 119 |
+
"num_elements": 0,
|
| 120 |
+
"l2": 0.0,
|
| 121 |
+
"mean_abs": null,
|
| 122 |
+
"max_abs": 0.0
|
| 123 |
+
},
|
| 124 |
+
"u": {
|
| 125 |
+
"num_tensors": 3,
|
| 126 |
+
"num_tensors_without_grad": 0,
|
| 127 |
+
"num_elements": 150994944,
|
| 128 |
+
"l2": 9.49544724743403,
|
| 129 |
+
"mean_abs": 0.00018087541037756536,
|
| 130 |
+
"max_abs": 1.5859873294830322
|
| 131 |
+
},
|
| 132 |
+
"rho": {
|
| 133 |
+
"num_tensors": 0,
|
| 134 |
+
"num_tensors_without_grad": 0,
|
| 135 |
+
"num_elements": 0,
|
| 136 |
+
"l2": 0.0,
|
| 137 |
+
"mean_abs": null,
|
| 138 |
+
"max_abs": 0.0
|
| 139 |
+
}
|
| 140 |
+
}
|
| 141 |
+
},
|
| 142 |
+
"u_delta_summary": {
|
| 143 |
+
"num_tensors": 3,
|
| 144 |
+
"num_elements": 150994944,
|
| 145 |
+
"mean": 1.6938262964079815e-06,
|
| 146 |
+
"std": 0.0028841262342925596,
|
| 147 |
+
"rms": 0.00288412673167843,
|
| 148 |
+
"mean_abs": 0.0022766475255290666,
|
| 149 |
+
"min": -0.028415188193321228,
|
| 150 |
+
"max": 0.030315399169921875,
|
| 151 |
+
"per_tensor": {
|
| 152 |
+
"mlp.gate_proj.weight": {
|
| 153 |
+
"mean": 5.346755642676726e-06,
|
| 154 |
+
"std": 0.002756188385278948,
|
| 155 |
+
"rms": 0.0027561935713847235,
|
| 156 |
+
"mean_abs": 0.0021897933135430017,
|
| 157 |
+
"min": -0.024268098175525665,
|
| 158 |
+
"max": 0.023231012746691704
|
| 159 |
+
},
|
| 160 |
+
"mlp.up_proj.weight": {
|
| 161 |
+
"mean": -2.945407118204457e-07,
|
| 162 |
+
"std": 0.0026402173161349488,
|
| 163 |
+
"rms": 0.002640217332564322,
|
| 164 |
+
"mean_abs": 0.0020853507642944655,
|
| 165 |
+
"min": -0.02331394888460636,
|
| 166 |
+
"max": 0.022465486079454422
|
| 167 |
+
},
|
| 168 |
+
"mlp.down_proj.weight": {
|
| 169 |
+
"mean": 2.92639583676646e-08,
|
| 170 |
+
"std": 0.0032229195531651707,
|
| 171 |
+
"rms": 0.0032229195532980284,
|
| 172 |
+
"mean_abs": 0.002554798498749733,
|
| 173 |
+
"min": -0.028415188193321228,
|
| 174 |
+
"max": 0.030315399169921875
|
| 175 |
+
}
|
| 176 |
+
}
|
| 177 |
+
},
|
| 178 |
+
"rho_objective": "none",
|
| 179 |
+
"rho_schedule": "joint",
|
| 180 |
+
"additive_u": true,
|
| 181 |
+
"rho_epochs": 0.0,
|
| 182 |
+
"rho_lr": null,
|
| 183 |
+
"rho_bounds": null,
|
| 184 |
+
"rho_after_phase": null,
|
| 185 |
+
"rho_final": {},
|
| 186 |
+
"u_fisher_orthogonality": {},
|
| 187 |
+
"runtime": {
|
| 188 |
+
"seconds": 284.4065435389057,
|
| 189 |
+
"dataset_tokens": 524288,
|
| 190 |
+
"tokens_per_second": 1843.4456305970311,
|
| 191 |
+
"batch_size": 1,
|
| 192 |
+
"batches_per_epoch": 512,
|
| 193 |
+
"grad_accumulation": 1,
|
| 194 |
+
"peak_allocated_bytes": 38770888192,
|
| 195 |
+
"peak_reserved_bytes": 40705720320,
|
| 196 |
+
"gpu_total_bytes": 85094825984,
|
| 197 |
+
"actual_forward_shapes": {
|
| 198 |
+
"teacher:1x1024": 512,
|
| 199 |
+
"student:1x1024": 512
|
| 200 |
+
}
|
| 201 |
+
},
|
| 202 |
+
"ablation": {
|
| 203 |
+
"lambda": null,
|
| 204 |
+
"endpoint_clamping": false,
|
| 205 |
+
"initial_u_nonzero": 0,
|
| 206 |
+
"merged_parameters": [
|
| 207 |
+
"mlp.gate_proj.weight",
|
| 208 |
+
"mlp.up_proj.weight",
|
| 209 |
+
"mlp.down_proj.weight"
|
| 210 |
+
],
|
| 211 |
+
"parameterization": "W_initial + U_add",
|
| 212 |
+
"fisher_computed": false,
|
| 213 |
+
"fit_scope": "mlp",
|
| 214 |
+
"attention_initialization": "CoMe_channel_merge",
|
| 215 |
+
"norm_initialization": "CoMe_pair_mean",
|
| 216 |
+
"CoMe": {
|
| 217 |
+
"source_lineage": [
|
| 218 |
+
[
|
| 219 |
+
31
|
| 220 |
+
],
|
| 221 |
+
[
|
| 222 |
+
32
|
| 223 |
+
]
|
| 224 |
+
],
|
| 225 |
+
"retention_ratios": [
|
| 226 |
+
0.49274789168296595,
|
| 227 |
+
0.5072521083170339
|
| 228 |
+
],
|
| 229 |
+
"retained_attention_groups": [
|
| 230 |
+
3,
|
| 231 |
+
5
|
| 232 |
+
],
|
| 233 |
+
"retained_mlp_neurons": [
|
| 234 |
+
6054,
|
| 235 |
+
6234
|
| 236 |
+
],
|
| 237 |
+
"pair_score": 0.11533127194072337,
|
| 238 |
+
"minimum_retention": 0.0,
|
| 239 |
+
"adjusted_minimum": 0.0,
|
| 240 |
+
"power": 1.0,
|
| 241 |
+
"allow_repeat": true,
|
| 242 |
+
"sbi_metric": "angular_last",
|
| 243 |
+
"calibration_padding": "trim_right_padding_before_native_CoMe_scoring",
|
| 244 |
+
"teacher_mutated_during_initialization": false
|
| 245 |
+
},
|
| 246 |
+
"norms_trainable": false,
|
| 247 |
+
"attention_norm_initialization": "CoMe_retention_weighted_QK",
|
| 248 |
+
"initialized_parameters": [
|
| 249 |
+
"self_attn.q_proj.weight",
|
| 250 |
+
"self_attn.k_proj.weight",
|
| 251 |
+
"self_attn.v_proj.weight",
|
| 252 |
+
"self_attn.o_proj.weight",
|
| 253 |
+
"self_attn.q_norm.weight",
|
| 254 |
+
"self_attn.k_norm.weight",
|
| 255 |
+
"mlp.gate_proj.weight",
|
| 256 |
+
"mlp.up_proj.weight",
|
| 257 |
+
"mlp.down_proj.weight",
|
| 258 |
+
"input_layernorm.weight",
|
| 259 |
+
"post_attention_layernorm.weight"
|
| 260 |
+
],
|
| 261 |
+
"frozen_CoMe_parameters": [
|
| 262 |
+
"self_attn.q_proj.weight",
|
| 263 |
+
"self_attn.k_proj.weight",
|
| 264 |
+
"self_attn.v_proj.weight",
|
| 265 |
+
"self_attn.o_proj.weight",
|
| 266 |
+
"self_attn.q_norm.weight",
|
| 267 |
+
"self_attn.k_norm.weight",
|
| 268 |
+
"input_layernorm.weight",
|
| 269 |
+
"post_attention_layernorm.weight"
|
| 270 |
+
],
|
| 271 |
+
"frozen_attention_norm_expected_sha256": {
|
| 272 |
+
"self_attn.q_proj.weight": "d32ab579b634854ee33973f309191b5099d830b8f9189443b26791e043f35b74",
|
| 273 |
+
"self_attn.k_proj.weight": "1a63ee1e67c33062741b1acbdcb80b0ec9e16b0f30e984b21a1a41e899504765",
|
| 274 |
+
"self_attn.v_proj.weight": "9ec2df6bba949c6870ca18d7dfde4a4055b72c809b44958868777e77f5abf1c8",
|
| 275 |
+
"self_attn.o_proj.weight": "8e9f8603686d189fecd3a4ba41ac32046c14ce9bf75662a70042a453b8984f72",
|
| 276 |
+
"self_attn.q_norm.weight": "1ae662bfcbfd5edee375b6a3bafa86cd26fe6dd611568b98b45950949b91a97b",
|
| 277 |
+
"self_attn.k_norm.weight": "3588b84b908a2d2d498d1f96db9990fa492b15088fe42fe7d8ace619738a1119",
|
| 278 |
+
"input_layernorm.weight": "7ab4e8ed36ba6396ebde3cf6685dc9ac0df299665cdd8bb682af51cc443b989e",
|
| 279 |
+
"post_attention_layernorm.weight": "0940f7475c1f814c377a0e5c3e55bc6b058aba1290a64ee2ca3c1c8f270751d8"
|
| 280 |
+
},
|
| 281 |
+
"frozen_attention_norm_before_sha256": {
|
| 282 |
+
"self_attn.q_proj.weight": "d32ab579b634854ee33973f309191b5099d830b8f9189443b26791e043f35b74",
|
| 283 |
+
"self_attn.k_proj.weight": "1a63ee1e67c33062741b1acbdcb80b0ec9e16b0f30e984b21a1a41e899504765",
|
| 284 |
+
"self_attn.v_proj.weight": "9ec2df6bba949c6870ca18d7dfde4a4055b72c809b44958868777e77f5abf1c8",
|
| 285 |
+
"self_attn.o_proj.weight": "8e9f8603686d189fecd3a4ba41ac32046c14ce9bf75662a70042a453b8984f72",
|
| 286 |
+
"self_attn.q_norm.weight": "1ae662bfcbfd5edee375b6a3bafa86cd26fe6dd611568b98b45950949b91a97b",
|
| 287 |
+
"self_attn.k_norm.weight": "3588b84b908a2d2d498d1f96db9990fa492b15088fe42fe7d8ace619738a1119",
|
| 288 |
+
"input_layernorm.weight": "7ab4e8ed36ba6396ebde3cf6685dc9ac0df299665cdd8bb682af51cc443b989e",
|
| 289 |
+
"post_attention_layernorm.weight": "0940f7475c1f814c377a0e5c3e55bc6b058aba1290a64ee2ca3c1c8f270751d8"
|
| 290 |
+
},
|
| 291 |
+
"frozen_attention_norm_after_sha256": {
|
| 292 |
+
"self_attn.q_proj.weight": "d32ab579b634854ee33973f309191b5099d830b8f9189443b26791e043f35b74",
|
| 293 |
+
"self_attn.k_proj.weight": "1a63ee1e67c33062741b1acbdcb80b0ec9e16b0f30e984b21a1a41e899504765",
|
| 294 |
+
"self_attn.v_proj.weight": "9ec2df6bba949c6870ca18d7dfde4a4055b72c809b44958868777e77f5abf1c8",
|
| 295 |
+
"self_attn.o_proj.weight": "8e9f8603686d189fecd3a4ba41ac32046c14ce9bf75662a70042a453b8984f72",
|
| 296 |
+
"self_attn.q_norm.weight": "1ae662bfcbfd5edee375b6a3bafa86cd26fe6dd611568b98b45950949b91a97b",
|
| 297 |
+
"self_attn.k_norm.weight": "3588b84b908a2d2d498d1f96db9990fa492b15088fe42fe7d8ace619738a1119",
|
| 298 |
+
"input_layernorm.weight": "7ab4e8ed36ba6396ebde3cf6685dc9ac0df299665cdd8bb682af51cc443b989e",
|
| 299 |
+
"post_attention_layernorm.weight": "0940f7475c1f814c377a0e5c3e55bc6b058aba1290a64ee2ca3c1c8f270751d8"
|
| 300 |
+
},
|
| 301 |
+
"frozen_attention_norm_unchanged": true,
|
| 302 |
+
"source_feature_transport": false,
|
| 303 |
+
"initializer": "come",
|
| 304 |
+
"removed_count_per_cycle": 1,
|
| 305 |
+
"teacher_boundary_current_layer": 32,
|
| 306 |
+
"teacher_boundary_original_layer": 32
|
| 307 |
+
}
|
| 308 |
+
}
|
runs/vast-paper_revision-come-attn-fit-20261126-62646539/20261126-qwen3-base-mka-come-mlp-fit/catalog/results/come/audit/cycle_02_fit.json
ADDED
|
@@ -0,0 +1,308 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"enabled": true,
|
| 3 |
+
"epochs": 1.0,
|
| 4 |
+
"requested_epochs": 1.0,
|
| 5 |
+
"skip_train": false,
|
| 6 |
+
"trained": true,
|
| 7 |
+
"lr": 0.0001,
|
| 8 |
+
"hidden_mse_weight": 1.0,
|
| 9 |
+
"attn_mse_weight": 0.0,
|
| 10 |
+
"mlp_mse_weight": 1.0,
|
| 11 |
+
"eta": 0.0,
|
| 12 |
+
"gamma": 0.0,
|
| 13 |
+
"attn_reg_scale": 1.0,
|
| 14 |
+
"mlp_reg_scale": 1.0,
|
| 15 |
+
"param_subset": "mlp",
|
| 16 |
+
"train_subset": "mlp",
|
| 17 |
+
"num_gates": 3,
|
| 18 |
+
"num_attn_gates": 0,
|
| 19 |
+
"num_mlp_gates": 3,
|
| 20 |
+
"num_other_gates": 0,
|
| 21 |
+
"num_trainable_attn_gates": 0,
|
| 22 |
+
"num_trainable_mlp_gates": 3,
|
| 23 |
+
"num_trainable_other_gates": 0,
|
| 24 |
+
"lambda_init_summary": {
|
| 25 |
+
"num_tensors": 3,
|
| 26 |
+
"num_elements": 3,
|
| 27 |
+
"mean": 0.9998999834060669,
|
| 28 |
+
"std": 0.0,
|
| 29 |
+
"min": 0.9998999834060669,
|
| 30 |
+
"max": 0.9998999834060669,
|
| 31 |
+
"mean_abs_from_0_5": 0.4998999834060669,
|
| 32 |
+
"per_tensor": {
|
| 33 |
+
"mlp.gate_proj.weight": {
|
| 34 |
+
"mean": 0.9998999834060669,
|
| 35 |
+
"std": 0.0,
|
| 36 |
+
"min": 0.9998999834060669,
|
| 37 |
+
"max": 0.9998999834060669,
|
| 38 |
+
"mean_abs_from_0_5": 0.4998999834060669
|
| 39 |
+
},
|
| 40 |
+
"mlp.up_proj.weight": {
|
| 41 |
+
"mean": 0.9998999834060669,
|
| 42 |
+
"std": 0.0,
|
| 43 |
+
"min": 0.9998999834060669,
|
| 44 |
+
"max": 0.9998999834060669,
|
| 45 |
+
"mean_abs_from_0_5": 0.4998999834060669
|
| 46 |
+
},
|
| 47 |
+
"mlp.down_proj.weight": {
|
| 48 |
+
"mean": 0.9998999834060669,
|
| 49 |
+
"std": 0.0,
|
| 50 |
+
"min": 0.9998999834060669,
|
| 51 |
+
"max": 0.9998999834060669,
|
| 52 |
+
"mean_abs_from_0_5": 0.4998999834060669
|
| 53 |
+
}
|
| 54 |
+
}
|
| 55 |
+
},
|
| 56 |
+
"lambda_final_summary": {
|
| 57 |
+
"num_tensors": 3,
|
| 58 |
+
"num_elements": 3,
|
| 59 |
+
"mean": 1.0,
|
| 60 |
+
"std": 0.0,
|
| 61 |
+
"min": 1.0,
|
| 62 |
+
"max": 1.0,
|
| 63 |
+
"mean_abs_from_0_5": 0.5,
|
| 64 |
+
"per_tensor": {
|
| 65 |
+
"mlp.gate_proj.weight": {
|
| 66 |
+
"mean": 1.0,
|
| 67 |
+
"std": 0.0,
|
| 68 |
+
"min": 1.0,
|
| 69 |
+
"max": 1.0,
|
| 70 |
+
"mean_abs_from_0_5": 0.5
|
| 71 |
+
},
|
| 72 |
+
"mlp.up_proj.weight": {
|
| 73 |
+
"mean": 1.0,
|
| 74 |
+
"std": 0.0,
|
| 75 |
+
"min": 1.0,
|
| 76 |
+
"max": 1.0,
|
| 77 |
+
"mean_abs_from_0_5": 0.5
|
| 78 |
+
},
|
| 79 |
+
"mlp.down_proj.weight": {
|
| 80 |
+
"mean": 1.0,
|
| 81 |
+
"std": 0.0,
|
| 82 |
+
"min": 1.0,
|
| 83 |
+
"max": 1.0,
|
| 84 |
+
"mean_abs_from_0_5": 0.5
|
| 85 |
+
}
|
| 86 |
+
}
|
| 87 |
+
},
|
| 88 |
+
"lambda_delta_from_init": {
|
| 89 |
+
"num_tensors": 3,
|
| 90 |
+
"num_elements": 3,
|
| 91 |
+
"mean_abs": 0.0,
|
| 92 |
+
"rms": 0.0,
|
| 93 |
+
"max_abs": 0.0,
|
| 94 |
+
"per_tensor": {
|
| 95 |
+
"mlp.gate_proj.weight": {
|
| 96 |
+
"mean_abs": 0.0,
|
| 97 |
+
"rms": 0.0,
|
| 98 |
+
"max_abs": 0.0
|
| 99 |
+
},
|
| 100 |
+
"mlp.up_proj.weight": {
|
| 101 |
+
"mean_abs": 0.0,
|
| 102 |
+
"rms": 0.0,
|
| 103 |
+
"max_abs": 0.0
|
| 104 |
+
},
|
| 105 |
+
"mlp.down_proj.weight": {
|
| 106 |
+
"mean_abs": 0.0,
|
| 107 |
+
"rms": 0.0,
|
| 108 |
+
"max_abs": 0.0
|
| 109 |
+
}
|
| 110 |
+
}
|
| 111 |
+
},
|
| 112 |
+
"first_grad_summary": {
|
| 113 |
+
"joint": {
|
| 114 |
+
"step": 1,
|
| 115 |
+
"phase": "joint",
|
| 116 |
+
"gate": {
|
| 117 |
+
"num_tensors": 3,
|
| 118 |
+
"num_tensors_without_grad": 3,
|
| 119 |
+
"num_elements": 0,
|
| 120 |
+
"l2": 0.0,
|
| 121 |
+
"mean_abs": null,
|
| 122 |
+
"max_abs": 0.0
|
| 123 |
+
},
|
| 124 |
+
"u": {
|
| 125 |
+
"num_tensors": 3,
|
| 126 |
+
"num_tensors_without_grad": 0,
|
| 127 |
+
"num_elements": 150994944,
|
| 128 |
+
"l2": 0.28547625475643207,
|
| 129 |
+
"mean_abs": 4.936821420010852e-06,
|
| 130 |
+
"max_abs": 0.03876304626464844
|
| 131 |
+
},
|
| 132 |
+
"rho": {
|
| 133 |
+
"num_tensors": 0,
|
| 134 |
+
"num_tensors_without_grad": 0,
|
| 135 |
+
"num_elements": 0,
|
| 136 |
+
"l2": 0.0,
|
| 137 |
+
"mean_abs": null,
|
| 138 |
+
"max_abs": 0.0
|
| 139 |
+
}
|
| 140 |
+
}
|
| 141 |
+
},
|
| 142 |
+
"u_delta_summary": {
|
| 143 |
+
"num_tensors": 3,
|
| 144 |
+
"num_elements": 150994944,
|
| 145 |
+
"mean": -2.2277035264374313e-06,
|
| 146 |
+
"std": 0.003590529790157256,
|
| 147 |
+
"rms": 0.003590530481233896,
|
| 148 |
+
"mean_abs": 0.0027030425456662974,
|
| 149 |
+
"min": -0.04027918726205826,
|
| 150 |
+
"max": 0.037824470549821854,
|
| 151 |
+
"per_tensor": {
|
| 152 |
+
"mlp.gate_proj.weight": {
|
| 153 |
+
"mean": -6.615836658359815e-06,
|
| 154 |
+
"std": 0.0036853567166835904,
|
| 155 |
+
"rms": 0.0036853626549499226,
|
| 156 |
+
"mean_abs": 0.002706917623678843,
|
| 157 |
+
"min": -0.03582677245140076,
|
| 158 |
+
"max": 0.03232936933636665
|
| 159 |
+
},
|
| 160 |
+
"mlp.up_proj.weight": {
|
| 161 |
+
"mean": 9.250769987071787e-08,
|
| 162 |
+
"std": 0.003794212333341261,
|
| 163 |
+
"rms": 0.0037942123344689885,
|
| 164 |
+
"mean_abs": 0.0028184043864409127,
|
| 165 |
+
"min": -0.033416759222745895,
|
| 166 |
+
"max": 0.03145444020628929
|
| 167 |
+
},
|
| 168 |
+
"mlp.down_proj.weight": {
|
| 169 |
+
"mean": -1.5978162082319614e-07,
|
| 170 |
+
"std": 0.0032707464357456407,
|
| 171 |
+
"rms": 0.003270746439648445,
|
| 172 |
+
"mean_abs": 0.0025838056268791356,
|
| 173 |
+
"min": -0.04027918726205826,
|
| 174 |
+
"max": 0.037824470549821854
|
| 175 |
+
}
|
| 176 |
+
}
|
| 177 |
+
},
|
| 178 |
+
"rho_objective": "none",
|
| 179 |
+
"rho_schedule": "joint",
|
| 180 |
+
"additive_u": true,
|
| 181 |
+
"rho_epochs": 0.0,
|
| 182 |
+
"rho_lr": null,
|
| 183 |
+
"rho_bounds": null,
|
| 184 |
+
"rho_after_phase": null,
|
| 185 |
+
"rho_final": {},
|
| 186 |
+
"u_fisher_orthogonality": {},
|
| 187 |
+
"runtime": {
|
| 188 |
+
"seconds": 287.0148811088875,
|
| 189 |
+
"dataset_tokens": 524288,
|
| 190 |
+
"tokens_per_second": 1826.6927414160662,
|
| 191 |
+
"batch_size": 1,
|
| 192 |
+
"batches_per_epoch": 512,
|
| 193 |
+
"grad_accumulation": 1,
|
| 194 |
+
"peak_allocated_bytes": 40117289984,
|
| 195 |
+
"peak_reserved_bytes": 51361349632,
|
| 196 |
+
"gpu_total_bytes": 85094825984,
|
| 197 |
+
"actual_forward_shapes": {
|
| 198 |
+
"teacher:1x1024": 512,
|
| 199 |
+
"student:1x1024": 512
|
| 200 |
+
}
|
| 201 |
+
},
|
| 202 |
+
"ablation": {
|
| 203 |
+
"lambda": null,
|
| 204 |
+
"endpoint_clamping": false,
|
| 205 |
+
"initial_u_nonzero": 0,
|
| 206 |
+
"merged_parameters": [
|
| 207 |
+
"mlp.gate_proj.weight",
|
| 208 |
+
"mlp.up_proj.weight",
|
| 209 |
+
"mlp.down_proj.weight"
|
| 210 |
+
],
|
| 211 |
+
"parameterization": "W_initial + U_add",
|
| 212 |
+
"fisher_computed": false,
|
| 213 |
+
"fit_scope": "mlp",
|
| 214 |
+
"attention_initialization": "CoMe_channel_merge",
|
| 215 |
+
"norm_initialization": "CoMe_pair_mean",
|
| 216 |
+
"CoMe": {
|
| 217 |
+
"source_lineage": [
|
| 218 |
+
[
|
| 219 |
+
16
|
| 220 |
+
],
|
| 221 |
+
[
|
| 222 |
+
17
|
| 223 |
+
]
|
| 224 |
+
],
|
| 225 |
+
"retention_ratios": [
|
| 226 |
+
0.49296001567209896,
|
| 227 |
+
0.507039984327901
|
| 228 |
+
],
|
| 229 |
+
"retained_attention_groups": [
|
| 230 |
+
3,
|
| 231 |
+
5
|
| 232 |
+
],
|
| 233 |
+
"retained_mlp_neurons": [
|
| 234 |
+
6057,
|
| 235 |
+
6231
|
| 236 |
+
],
|
| 237 |
+
"pair_score": 0.11846736168607752,
|
| 238 |
+
"minimum_retention": 0.0,
|
| 239 |
+
"adjusted_minimum": 0.0,
|
| 240 |
+
"power": 1.0,
|
| 241 |
+
"allow_repeat": true,
|
| 242 |
+
"sbi_metric": "angular_last",
|
| 243 |
+
"calibration_padding": "trim_right_padding_before_native_CoMe_scoring",
|
| 244 |
+
"teacher_mutated_during_initialization": false
|
| 245 |
+
},
|
| 246 |
+
"norms_trainable": false,
|
| 247 |
+
"attention_norm_initialization": "CoMe_retention_weighted_QK",
|
| 248 |
+
"initialized_parameters": [
|
| 249 |
+
"self_attn.q_proj.weight",
|
| 250 |
+
"self_attn.k_proj.weight",
|
| 251 |
+
"self_attn.v_proj.weight",
|
| 252 |
+
"self_attn.o_proj.weight",
|
| 253 |
+
"self_attn.q_norm.weight",
|
| 254 |
+
"self_attn.k_norm.weight",
|
| 255 |
+
"mlp.gate_proj.weight",
|
| 256 |
+
"mlp.up_proj.weight",
|
| 257 |
+
"mlp.down_proj.weight",
|
| 258 |
+
"input_layernorm.weight",
|
| 259 |
+
"post_attention_layernorm.weight"
|
| 260 |
+
],
|
| 261 |
+
"frozen_CoMe_parameters": [
|
| 262 |
+
"self_attn.q_proj.weight",
|
| 263 |
+
"self_attn.k_proj.weight",
|
| 264 |
+
"self_attn.v_proj.weight",
|
| 265 |
+
"self_attn.o_proj.weight",
|
| 266 |
+
"self_attn.q_norm.weight",
|
| 267 |
+
"self_attn.k_norm.weight",
|
| 268 |
+
"input_layernorm.weight",
|
| 269 |
+
"post_attention_layernorm.weight"
|
| 270 |
+
],
|
| 271 |
+
"frozen_attention_norm_expected_sha256": {
|
| 272 |
+
"self_attn.q_proj.weight": "d2ed544f73cf62e3ab17f0be58f92f865cd3605e6d229fe8b2bd23de52252508",
|
| 273 |
+
"self_attn.k_proj.weight": "787f7f67063f02e7d3fd3f715d589274faeccf7d41d87f074f9e5010c8fcab43",
|
| 274 |
+
"self_attn.v_proj.weight": "cbeea55153838935a713e0e697686d9e0494ecaa9faed73c9c9f3d742db218d2",
|
| 275 |
+
"self_attn.o_proj.weight": "6fbabb27e0f0a37a8c41a199de67ed0cdfbfc7f7d1187a7d4dd9519c6194c5f2",
|
| 276 |
+
"self_attn.q_norm.weight": "349a1ca5fc11e844626318e972364bf926df4415d34cde698fcdc1fed7bb86c3",
|
| 277 |
+
"self_attn.k_norm.weight": "68f81d391604fc4461e9297f19ca7a56b30cf90c5f8e0520137b7eb84d37ab91",
|
| 278 |
+
"input_layernorm.weight": "086e8d855b92cf3fb06fd4a34cdcedd527143c24144a737b1a49446c980dbd41",
|
| 279 |
+
"post_attention_layernorm.weight": "0b0aa8913baf6ec21771d1d6834adf8ce81c80a3a7719fa50a6a56f71d52e2a3"
|
| 280 |
+
},
|
| 281 |
+
"frozen_attention_norm_before_sha256": {
|
| 282 |
+
"self_attn.q_proj.weight": "d2ed544f73cf62e3ab17f0be58f92f865cd3605e6d229fe8b2bd23de52252508",
|
| 283 |
+
"self_attn.k_proj.weight": "787f7f67063f02e7d3fd3f715d589274faeccf7d41d87f074f9e5010c8fcab43",
|
| 284 |
+
"self_attn.v_proj.weight": "cbeea55153838935a713e0e697686d9e0494ecaa9faed73c9c9f3d742db218d2",
|
| 285 |
+
"self_attn.o_proj.weight": "6fbabb27e0f0a37a8c41a199de67ed0cdfbfc7f7d1187a7d4dd9519c6194c5f2",
|
| 286 |
+
"self_attn.q_norm.weight": "349a1ca5fc11e844626318e972364bf926df4415d34cde698fcdc1fed7bb86c3",
|
| 287 |
+
"self_attn.k_norm.weight": "68f81d391604fc4461e9297f19ca7a56b30cf90c5f8e0520137b7eb84d37ab91",
|
| 288 |
+
"input_layernorm.weight": "086e8d855b92cf3fb06fd4a34cdcedd527143c24144a737b1a49446c980dbd41",
|
| 289 |
+
"post_attention_layernorm.weight": "0b0aa8913baf6ec21771d1d6834adf8ce81c80a3a7719fa50a6a56f71d52e2a3"
|
| 290 |
+
},
|
| 291 |
+
"frozen_attention_norm_after_sha256": {
|
| 292 |
+
"self_attn.q_proj.weight": "d2ed544f73cf62e3ab17f0be58f92f865cd3605e6d229fe8b2bd23de52252508",
|
| 293 |
+
"self_attn.k_proj.weight": "787f7f67063f02e7d3fd3f715d589274faeccf7d41d87f074f9e5010c8fcab43",
|
| 294 |
+
"self_attn.v_proj.weight": "cbeea55153838935a713e0e697686d9e0494ecaa9faed73c9c9f3d742db218d2",
|
| 295 |
+
"self_attn.o_proj.weight": "6fbabb27e0f0a37a8c41a199de67ed0cdfbfc7f7d1187a7d4dd9519c6194c5f2",
|
| 296 |
+
"self_attn.q_norm.weight": "349a1ca5fc11e844626318e972364bf926df4415d34cde698fcdc1fed7bb86c3",
|
| 297 |
+
"self_attn.k_norm.weight": "68f81d391604fc4461e9297f19ca7a56b30cf90c5f8e0520137b7eb84d37ab91",
|
| 298 |
+
"input_layernorm.weight": "086e8d855b92cf3fb06fd4a34cdcedd527143c24144a737b1a49446c980dbd41",
|
| 299 |
+
"post_attention_layernorm.weight": "0b0aa8913baf6ec21771d1d6834adf8ce81c80a3a7719fa50a6a56f71d52e2a3"
|
| 300 |
+
},
|
| 301 |
+
"frozen_attention_norm_unchanged": true,
|
| 302 |
+
"source_feature_transport": false,
|
| 303 |
+
"initializer": "come",
|
| 304 |
+
"removed_count_per_cycle": 1,
|
| 305 |
+
"teacher_boundary_current_layer": 17,
|
| 306 |
+
"teacher_boundary_original_layer": 17
|
| 307 |
+
}
|
| 308 |
+
}
|
runs/vast-paper_revision-come-attn-fit-20261126-62646539/20261126-qwen3-base-mka-come-mlp-fit/catalog/results/come/audit/cycle_03_fit.json
ADDED
|
@@ -0,0 +1,308 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"enabled": true,
|
| 3 |
+
"epochs": 1.0,
|
| 4 |
+
"requested_epochs": 1.0,
|
| 5 |
+
"skip_train": false,
|
| 6 |
+
"trained": true,
|
| 7 |
+
"lr": 0.0001,
|
| 8 |
+
"hidden_mse_weight": 1.0,
|
| 9 |
+
"attn_mse_weight": 0.0,
|
| 10 |
+
"mlp_mse_weight": 1.0,
|
| 11 |
+
"eta": 0.0,
|
| 12 |
+
"gamma": 0.0,
|
| 13 |
+
"attn_reg_scale": 1.0,
|
| 14 |
+
"mlp_reg_scale": 1.0,
|
| 15 |
+
"param_subset": "mlp",
|
| 16 |
+
"train_subset": "mlp",
|
| 17 |
+
"num_gates": 3,
|
| 18 |
+
"num_attn_gates": 0,
|
| 19 |
+
"num_mlp_gates": 3,
|
| 20 |
+
"num_other_gates": 0,
|
| 21 |
+
"num_trainable_attn_gates": 0,
|
| 22 |
+
"num_trainable_mlp_gates": 3,
|
| 23 |
+
"num_trainable_other_gates": 0,
|
| 24 |
+
"lambda_init_summary": {
|
| 25 |
+
"num_tensors": 3,
|
| 26 |
+
"num_elements": 3,
|
| 27 |
+
"mean": 0.9998999834060669,
|
| 28 |
+
"std": 0.0,
|
| 29 |
+
"min": 0.9998999834060669,
|
| 30 |
+
"max": 0.9998999834060669,
|
| 31 |
+
"mean_abs_from_0_5": 0.4998999834060669,
|
| 32 |
+
"per_tensor": {
|
| 33 |
+
"mlp.gate_proj.weight": {
|
| 34 |
+
"mean": 0.9998999834060669,
|
| 35 |
+
"std": 0.0,
|
| 36 |
+
"min": 0.9998999834060669,
|
| 37 |
+
"max": 0.9998999834060669,
|
| 38 |
+
"mean_abs_from_0_5": 0.4998999834060669
|
| 39 |
+
},
|
| 40 |
+
"mlp.up_proj.weight": {
|
| 41 |
+
"mean": 0.9998999834060669,
|
| 42 |
+
"std": 0.0,
|
| 43 |
+
"min": 0.9998999834060669,
|
| 44 |
+
"max": 0.9998999834060669,
|
| 45 |
+
"mean_abs_from_0_5": 0.4998999834060669
|
| 46 |
+
},
|
| 47 |
+
"mlp.down_proj.weight": {
|
| 48 |
+
"mean": 0.9998999834060669,
|
| 49 |
+
"std": 0.0,
|
| 50 |
+
"min": 0.9998999834060669,
|
| 51 |
+
"max": 0.9998999834060669,
|
| 52 |
+
"mean_abs_from_0_5": 0.4998999834060669
|
| 53 |
+
}
|
| 54 |
+
}
|
| 55 |
+
},
|
| 56 |
+
"lambda_final_summary": {
|
| 57 |
+
"num_tensors": 3,
|
| 58 |
+
"num_elements": 3,
|
| 59 |
+
"mean": 1.0,
|
| 60 |
+
"std": 0.0,
|
| 61 |
+
"min": 1.0,
|
| 62 |
+
"max": 1.0,
|
| 63 |
+
"mean_abs_from_0_5": 0.5,
|
| 64 |
+
"per_tensor": {
|
| 65 |
+
"mlp.gate_proj.weight": {
|
| 66 |
+
"mean": 1.0,
|
| 67 |
+
"std": 0.0,
|
| 68 |
+
"min": 1.0,
|
| 69 |
+
"max": 1.0,
|
| 70 |
+
"mean_abs_from_0_5": 0.5
|
| 71 |
+
},
|
| 72 |
+
"mlp.up_proj.weight": {
|
| 73 |
+
"mean": 1.0,
|
| 74 |
+
"std": 0.0,
|
| 75 |
+
"min": 1.0,
|
| 76 |
+
"max": 1.0,
|
| 77 |
+
"mean_abs_from_0_5": 0.5
|
| 78 |
+
},
|
| 79 |
+
"mlp.down_proj.weight": {
|
| 80 |
+
"mean": 1.0,
|
| 81 |
+
"std": 0.0,
|
| 82 |
+
"min": 1.0,
|
| 83 |
+
"max": 1.0,
|
| 84 |
+
"mean_abs_from_0_5": 0.5
|
| 85 |
+
}
|
| 86 |
+
}
|
| 87 |
+
},
|
| 88 |
+
"lambda_delta_from_init": {
|
| 89 |
+
"num_tensors": 3,
|
| 90 |
+
"num_elements": 3,
|
| 91 |
+
"mean_abs": 0.0,
|
| 92 |
+
"rms": 0.0,
|
| 93 |
+
"max_abs": 0.0,
|
| 94 |
+
"per_tensor": {
|
| 95 |
+
"mlp.gate_proj.weight": {
|
| 96 |
+
"mean_abs": 0.0,
|
| 97 |
+
"rms": 0.0,
|
| 98 |
+
"max_abs": 0.0
|
| 99 |
+
},
|
| 100 |
+
"mlp.up_proj.weight": {
|
| 101 |
+
"mean_abs": 0.0,
|
| 102 |
+
"rms": 0.0,
|
| 103 |
+
"max_abs": 0.0
|
| 104 |
+
},
|
| 105 |
+
"mlp.down_proj.weight": {
|
| 106 |
+
"mean_abs": 0.0,
|
| 107 |
+
"rms": 0.0,
|
| 108 |
+
"max_abs": 0.0
|
| 109 |
+
}
|
| 110 |
+
}
|
| 111 |
+
},
|
| 112 |
+
"first_grad_summary": {
|
| 113 |
+
"joint": {
|
| 114 |
+
"step": 1,
|
| 115 |
+
"phase": "joint",
|
| 116 |
+
"gate": {
|
| 117 |
+
"num_tensors": 3,
|
| 118 |
+
"num_tensors_without_grad": 3,
|
| 119 |
+
"num_elements": 0,
|
| 120 |
+
"l2": 0.0,
|
| 121 |
+
"mean_abs": null,
|
| 122 |
+
"max_abs": 0.0
|
| 123 |
+
},
|
| 124 |
+
"u": {
|
| 125 |
+
"num_tensors": 3,
|
| 126 |
+
"num_tensors_without_grad": 0,
|
| 127 |
+
"num_elements": 150994944,
|
| 128 |
+
"l2": 1.9195377668022477,
|
| 129 |
+
"mean_abs": 4.386278063369294e-05,
|
| 130 |
+
"max_abs": 0.15239524841308594
|
| 131 |
+
},
|
| 132 |
+
"rho": {
|
| 133 |
+
"num_tensors": 0,
|
| 134 |
+
"num_tensors_without_grad": 0,
|
| 135 |
+
"num_elements": 0,
|
| 136 |
+
"l2": 0.0,
|
| 137 |
+
"mean_abs": null,
|
| 138 |
+
"max_abs": 0.0
|
| 139 |
+
}
|
| 140 |
+
}
|
| 141 |
+
},
|
| 142 |
+
"u_delta_summary": {
|
| 143 |
+
"num_tensors": 3,
|
| 144 |
+
"num_elements": 150994944,
|
| 145 |
+
"mean": 4.834807075187402e-06,
|
| 146 |
+
"std": 0.002954291666716121,
|
| 147 |
+
"rms": 0.0029542956228833586,
|
| 148 |
+
"mean_abs": 0.0023312543829282126,
|
| 149 |
+
"min": -0.025260327383875847,
|
| 150 |
+
"max": 0.025104448199272156,
|
| 151 |
+
"per_tensor": {
|
| 152 |
+
"mlp.gate_proj.weight": {
|
| 153 |
+
"mean": 1.5033686698491996e-05,
|
| 154 |
+
"std": 0.0027293740459918606,
|
| 155 |
+
"rms": 0.0027294154492619347,
|
| 156 |
+
"mean_abs": 0.0021729754904905954,
|
| 157 |
+
"min": -0.02162746898829937,
|
| 158 |
+
"max": 0.0205176193267107
|
| 159 |
+
},
|
| 160 |
+
"mlp.up_proj.weight": {
|
| 161 |
+
"mean": 1.5114774972365316e-07,
|
| 162 |
+
"std": 0.0027591918042724883,
|
| 163 |
+
"rms": 0.002759191808412404,
|
| 164 |
+
"mean_abs": 0.0021809920047720275,
|
| 165 |
+
"min": -0.024778185412287712,
|
| 166 |
+
"max": 0.025104448199272156
|
| 167 |
+
},
|
| 168 |
+
"mlp.down_proj.weight": {
|
| 169 |
+
"mean": -6.804132226534421e-07,
|
| 170 |
+
"std": 0.003334777247271745,
|
| 171 |
+
"rms": 0.003334777316685999,
|
| 172 |
+
"mean_abs": 0.0026397956535220146,
|
| 173 |
+
"min": -0.025260327383875847,
|
| 174 |
+
"max": 0.022698627784848213
|
| 175 |
+
}
|
| 176 |
+
}
|
| 177 |
+
},
|
| 178 |
+
"rho_objective": "none",
|
| 179 |
+
"rho_schedule": "joint",
|
| 180 |
+
"additive_u": true,
|
| 181 |
+
"rho_epochs": 0.0,
|
| 182 |
+
"rho_lr": null,
|
| 183 |
+
"rho_bounds": null,
|
| 184 |
+
"rho_after_phase": null,
|
| 185 |
+
"rho_final": {},
|
| 186 |
+
"u_fisher_orthogonality": {},
|
| 187 |
+
"runtime": {
|
| 188 |
+
"seconds": 275.03382919635624,
|
| 189 |
+
"dataset_tokens": 524288,
|
| 190 |
+
"tokens_per_second": 1906.2673182130352,
|
| 191 |
+
"batch_size": 1,
|
| 192 |
+
"batches_per_epoch": 512,
|
| 193 |
+
"grad_accumulation": 1,
|
| 194 |
+
"peak_allocated_bytes": 37833298944,
|
| 195 |
+
"peak_reserved_bytes": 51449430016,
|
| 196 |
+
"gpu_total_bytes": 85094825984,
|
| 197 |
+
"actual_forward_shapes": {
|
| 198 |
+
"teacher:1x1024": 512,
|
| 199 |
+
"student:1x1024": 512
|
| 200 |
+
}
|
| 201 |
+
},
|
| 202 |
+
"ablation": {
|
| 203 |
+
"lambda": null,
|
| 204 |
+
"endpoint_clamping": false,
|
| 205 |
+
"initial_u_nonzero": 0,
|
| 206 |
+
"merged_parameters": [
|
| 207 |
+
"mlp.gate_proj.weight",
|
| 208 |
+
"mlp.up_proj.weight",
|
| 209 |
+
"mlp.down_proj.weight"
|
| 210 |
+
],
|
| 211 |
+
"parameterization": "W_initial + U_add",
|
| 212 |
+
"fisher_computed": false,
|
| 213 |
+
"fit_scope": "mlp",
|
| 214 |
+
"attention_initialization": "CoMe_channel_merge",
|
| 215 |
+
"norm_initialization": "CoMe_pair_mean",
|
| 216 |
+
"CoMe": {
|
| 217 |
+
"source_lineage": [
|
| 218 |
+
[
|
| 219 |
+
26
|
| 220 |
+
],
|
| 221 |
+
[
|
| 222 |
+
27
|
| 223 |
+
]
|
| 224 |
+
],
|
| 225 |
+
"retention_ratios": [
|
| 226 |
+
0.500755807036962,
|
| 227 |
+
0.4992441929630379
|
| 228 |
+
],
|
| 229 |
+
"retained_attention_groups": [
|
| 230 |
+
5,
|
| 231 |
+
3
|
| 232 |
+
],
|
| 233 |
+
"retained_mlp_neurons": [
|
| 234 |
+
6154,
|
| 235 |
+
6134
|
| 236 |
+
],
|
| 237 |
+
"pair_score": 0.11813264054820892,
|
| 238 |
+
"minimum_retention": 0.0,
|
| 239 |
+
"adjusted_minimum": 0.0,
|
| 240 |
+
"power": 1.0,
|
| 241 |
+
"allow_repeat": true,
|
| 242 |
+
"sbi_metric": "angular_last",
|
| 243 |
+
"calibration_padding": "trim_right_padding_before_native_CoMe_scoring",
|
| 244 |
+
"teacher_mutated_during_initialization": false
|
| 245 |
+
},
|
| 246 |
+
"norms_trainable": false,
|
| 247 |
+
"attention_norm_initialization": "CoMe_retention_weighted_QK",
|
| 248 |
+
"initialized_parameters": [
|
| 249 |
+
"self_attn.q_proj.weight",
|
| 250 |
+
"self_attn.k_proj.weight",
|
| 251 |
+
"self_attn.v_proj.weight",
|
| 252 |
+
"self_attn.o_proj.weight",
|
| 253 |
+
"self_attn.q_norm.weight",
|
| 254 |
+
"self_attn.k_norm.weight",
|
| 255 |
+
"mlp.gate_proj.weight",
|
| 256 |
+
"mlp.up_proj.weight",
|
| 257 |
+
"mlp.down_proj.weight",
|
| 258 |
+
"input_layernorm.weight",
|
| 259 |
+
"post_attention_layernorm.weight"
|
| 260 |
+
],
|
| 261 |
+
"frozen_CoMe_parameters": [
|
| 262 |
+
"self_attn.q_proj.weight",
|
| 263 |
+
"self_attn.k_proj.weight",
|
| 264 |
+
"self_attn.v_proj.weight",
|
| 265 |
+
"self_attn.o_proj.weight",
|
| 266 |
+
"self_attn.q_norm.weight",
|
| 267 |
+
"self_attn.k_norm.weight",
|
| 268 |
+
"input_layernorm.weight",
|
| 269 |
+
"post_attention_layernorm.weight"
|
| 270 |
+
],
|
| 271 |
+
"frozen_attention_norm_expected_sha256": {
|
| 272 |
+
"self_attn.q_proj.weight": "e374ecba7e5771f2299e56089ddd77b8b27f79f973e8be4e6cee80b9eac2612d",
|
| 273 |
+
"self_attn.k_proj.weight": "cf81f8d90cec377c6663e4b11e3dc0b61a0381e37444c00eef678183b4297b44",
|
| 274 |
+
"self_attn.v_proj.weight": "08d06843a169474bcd7a1f077dab1521fd59dd7dc4f0cbb81b4c399d0a153f98",
|
| 275 |
+
"self_attn.o_proj.weight": "efccaf7cf05bb7a6242e5ceb3afe68109d2e1c0e094f812a140e810d1b447b9c",
|
| 276 |
+
"self_attn.q_norm.weight": "4f1a08be52e5dedcad350ef489a3f349c839f22f0c2ee184e5edc2a1d4a0ddd9",
|
| 277 |
+
"self_attn.k_norm.weight": "f9ee6e6f0ac01557912733c0a1e3e3fbc977bd73cc9b89f203f13d1798e07ba6",
|
| 278 |
+
"input_layernorm.weight": "18d7e105f8c8b1594f50e198525ed0ec0b52e763ad77399b17b78ead143a289e",
|
| 279 |
+
"post_attention_layernorm.weight": "aeb4c2bf8614b342c7e265383dc930e75db4283123cb51d99196d1bbf113fd8b"
|
| 280 |
+
},
|
| 281 |
+
"frozen_attention_norm_before_sha256": {
|
| 282 |
+
"self_attn.q_proj.weight": "e374ecba7e5771f2299e56089ddd77b8b27f79f973e8be4e6cee80b9eac2612d",
|
| 283 |
+
"self_attn.k_proj.weight": "cf81f8d90cec377c6663e4b11e3dc0b61a0381e37444c00eef678183b4297b44",
|
| 284 |
+
"self_attn.v_proj.weight": "08d06843a169474bcd7a1f077dab1521fd59dd7dc4f0cbb81b4c399d0a153f98",
|
| 285 |
+
"self_attn.o_proj.weight": "efccaf7cf05bb7a6242e5ceb3afe68109d2e1c0e094f812a140e810d1b447b9c",
|
| 286 |
+
"self_attn.q_norm.weight": "4f1a08be52e5dedcad350ef489a3f349c839f22f0c2ee184e5edc2a1d4a0ddd9",
|
| 287 |
+
"self_attn.k_norm.weight": "f9ee6e6f0ac01557912733c0a1e3e3fbc977bd73cc9b89f203f13d1798e07ba6",
|
| 288 |
+
"input_layernorm.weight": "18d7e105f8c8b1594f50e198525ed0ec0b52e763ad77399b17b78ead143a289e",
|
| 289 |
+
"post_attention_layernorm.weight": "aeb4c2bf8614b342c7e265383dc930e75db4283123cb51d99196d1bbf113fd8b"
|
| 290 |
+
},
|
| 291 |
+
"frozen_attention_norm_after_sha256": {
|
| 292 |
+
"self_attn.q_proj.weight": "e374ecba7e5771f2299e56089ddd77b8b27f79f973e8be4e6cee80b9eac2612d",
|
| 293 |
+
"self_attn.k_proj.weight": "cf81f8d90cec377c6663e4b11e3dc0b61a0381e37444c00eef678183b4297b44",
|
| 294 |
+
"self_attn.v_proj.weight": "08d06843a169474bcd7a1f077dab1521fd59dd7dc4f0cbb81b4c399d0a153f98",
|
| 295 |
+
"self_attn.o_proj.weight": "efccaf7cf05bb7a6242e5ceb3afe68109d2e1c0e094f812a140e810d1b447b9c",
|
| 296 |
+
"self_attn.q_norm.weight": "4f1a08be52e5dedcad350ef489a3f349c839f22f0c2ee184e5edc2a1d4a0ddd9",
|
| 297 |
+
"self_attn.k_norm.weight": "f9ee6e6f0ac01557912733c0a1e3e3fbc977bd73cc9b89f203f13d1798e07ba6",
|
| 298 |
+
"input_layernorm.weight": "18d7e105f8c8b1594f50e198525ed0ec0b52e763ad77399b17b78ead143a289e",
|
| 299 |
+
"post_attention_layernorm.weight": "aeb4c2bf8614b342c7e265383dc930e75db4283123cb51d99196d1bbf113fd8b"
|
| 300 |
+
},
|
| 301 |
+
"frozen_attention_norm_unchanged": true,
|
| 302 |
+
"source_feature_transport": false,
|
| 303 |
+
"initializer": "come",
|
| 304 |
+
"removed_count_per_cycle": 1,
|
| 305 |
+
"teacher_boundary_current_layer": 26,
|
| 306 |
+
"teacher_boundary_original_layer": 27
|
| 307 |
+
}
|
| 308 |
+
}
|
runs/vast-paper_revision-come-attn-fit-20261126-62646539/20261126-qwen3-base-mka-come-mlp-fit/catalog/results/come/audit/cycle_04_fit.json
ADDED
|
@@ -0,0 +1,309 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
| 1 |
+
{
|
| 2 |
+
"enabled": true,
|
| 3 |
+
"epochs": 1.0,
|
| 4 |
+
"requested_epochs": 1.0,
|
| 5 |
+
"skip_train": false,
|
| 6 |
+
"trained": true,
|
| 7 |
+
"lr": 0.0001,
|
| 8 |
+
"hidden_mse_weight": 1.0,
|
| 9 |
+
"attn_mse_weight": 0.0,
|
| 10 |
+
"mlp_mse_weight": 1.0,
|
| 11 |
+
"eta": 0.0,
|
| 12 |
+
"gamma": 0.0,
|
| 13 |
+
"attn_reg_scale": 1.0,
|
| 14 |
+
"mlp_reg_scale": 1.0,
|
| 15 |
+
"param_subset": "mlp",
|
| 16 |
+
"train_subset": "mlp",
|
| 17 |
+
"num_gates": 3,
|
| 18 |
+
"num_attn_gates": 0,
|
| 19 |
+
"num_mlp_gates": 3,
|
| 20 |
+
"num_other_gates": 0,
|
| 21 |
+
"num_trainable_attn_gates": 0,
|
| 22 |
+
"num_trainable_mlp_gates": 3,
|
| 23 |
+
"num_trainable_other_gates": 0,
|
| 24 |
+
"lambda_init_summary": {
|
| 25 |
+
"num_tensors": 3,
|
| 26 |
+
"num_elements": 3,
|
| 27 |
+
"mean": 0.9998999834060669,
|
| 28 |
+
"std": 0.0,
|
| 29 |
+
"min": 0.9998999834060669,
|
| 30 |
+
"max": 0.9998999834060669,
|
| 31 |
+
"mean_abs_from_0_5": 0.4998999834060669,
|
| 32 |
+
"per_tensor": {
|
| 33 |
+
"mlp.gate_proj.weight": {
|
| 34 |
+
"mean": 0.9998999834060669,
|
| 35 |
+
"std": 0.0,
|
| 36 |
+
"min": 0.9998999834060669,
|
| 37 |
+
"max": 0.9998999834060669,
|
| 38 |
+
"mean_abs_from_0_5": 0.4998999834060669
|
| 39 |
+
},
|
| 40 |
+
"mlp.up_proj.weight": {
|
| 41 |
+
"mean": 0.9998999834060669,
|
| 42 |
+
"std": 0.0,
|
| 43 |
+
"min": 0.9998999834060669,
|
| 44 |
+
"max": 0.9998999834060669,
|
| 45 |
+
"mean_abs_from_0_5": 0.4998999834060669
|
| 46 |
+
},
|
| 47 |
+
"mlp.down_proj.weight": {
|
| 48 |
+
"mean": 0.9998999834060669,
|
| 49 |
+
"std": 0.0,
|
| 50 |
+
"min": 0.9998999834060669,
|
| 51 |
+
"max": 0.9998999834060669,
|
| 52 |
+
"mean_abs_from_0_5": 0.4998999834060669
|
| 53 |
+
}
|
| 54 |
+
}
|
| 55 |
+
},
|
| 56 |
+
"lambda_final_summary": {
|
| 57 |
+
"num_tensors": 3,
|
| 58 |
+
"num_elements": 3,
|
| 59 |
+
"mean": 1.0,
|
| 60 |
+
"std": 0.0,
|
| 61 |
+
"min": 1.0,
|
| 62 |
+
"max": 1.0,
|
| 63 |
+
"mean_abs_from_0_5": 0.5,
|
| 64 |
+
"per_tensor": {
|
| 65 |
+
"mlp.gate_proj.weight": {
|
| 66 |
+
"mean": 1.0,
|
| 67 |
+
"std": 0.0,
|
| 68 |
+
"min": 1.0,
|
| 69 |
+
"max": 1.0,
|
| 70 |
+
"mean_abs_from_0_5": 0.5
|
| 71 |
+
},
|
| 72 |
+
"mlp.up_proj.weight": {
|
| 73 |
+
"mean": 1.0,
|
| 74 |
+
"std": 0.0,
|
| 75 |
+
"min": 1.0,
|
| 76 |
+
"max": 1.0,
|
| 77 |
+
"mean_abs_from_0_5": 0.5
|
| 78 |
+
},
|
| 79 |
+
"mlp.down_proj.weight": {
|
| 80 |
+
"mean": 1.0,
|
| 81 |
+
"std": 0.0,
|
| 82 |
+
"min": 1.0,
|
| 83 |
+
"max": 1.0,
|
| 84 |
+
"mean_abs_from_0_5": 0.5
|
| 85 |
+
}
|
| 86 |
+
}
|
| 87 |
+
},
|
| 88 |
+
"lambda_delta_from_init": {
|
| 89 |
+
"num_tensors": 3,
|
| 90 |
+
"num_elements": 3,
|
| 91 |
+
"mean_abs": 0.0,
|
| 92 |
+
"rms": 0.0,
|
| 93 |
+
"max_abs": 0.0,
|
| 94 |
+
"per_tensor": {
|
| 95 |
+
"mlp.gate_proj.weight": {
|
| 96 |
+
"mean_abs": 0.0,
|
| 97 |
+
"rms": 0.0,
|
| 98 |
+
"max_abs": 0.0
|
| 99 |
+
},
|
| 100 |
+
"mlp.up_proj.weight": {
|
| 101 |
+
"mean_abs": 0.0,
|
| 102 |
+
"rms": 0.0,
|
| 103 |
+
"max_abs": 0.0
|
| 104 |
+
},
|
| 105 |
+
"mlp.down_proj.weight": {
|
| 106 |
+
"mean_abs": 0.0,
|
| 107 |
+
"rms": 0.0,
|
| 108 |
+
"max_abs": 0.0
|
| 109 |
+
}
|
| 110 |
+
}
|
| 111 |
+
},
|
| 112 |
+
"first_grad_summary": {
|
| 113 |
+
"joint": {
|
| 114 |
+
"step": 1,
|
| 115 |
+
"phase": "joint",
|
| 116 |
+
"gate": {
|
| 117 |
+
"num_tensors": 3,
|
| 118 |
+
"num_tensors_without_grad": 3,
|
| 119 |
+
"num_elements": 0,
|
| 120 |
+
"l2": 0.0,
|
| 121 |
+
"mean_abs": null,
|
| 122 |
+
"max_abs": 0.0
|
| 123 |
+
},
|
| 124 |
+
"u": {
|
| 125 |
+
"num_tensors": 3,
|
| 126 |
+
"num_tensors_without_grad": 0,
|
| 127 |
+
"num_elements": 150994944,
|
| 128 |
+
"l2": 0.5103952856501015,
|
| 129 |
+
"mean_abs": 4.802161230246485e-06,
|
| 130 |
+
"max_abs": 0.18325042724609375
|
| 131 |
+
},
|
| 132 |
+
"rho": {
|
| 133 |
+
"num_tensors": 0,
|
| 134 |
+
"num_tensors_without_grad": 0,
|
| 135 |
+
"num_elements": 0,
|
| 136 |
+
"l2": 0.0,
|
| 137 |
+
"mean_abs": null,
|
| 138 |
+
"max_abs": 0.0
|
| 139 |
+
}
|
| 140 |
+
}
|
| 141 |
+
},
|
| 142 |
+
"u_delta_summary": {
|
| 143 |
+
"num_tensors": 3,
|
| 144 |
+
"num_elements": 150994944,
|
| 145 |
+
"mean": 2.1773275370328014e-07,
|
| 146 |
+
"std": 0.004527799256407125,
|
| 147 |
+
"rms": 0.00452779926164229,
|
| 148 |
+
"mean_abs": 0.003343291063275602,
|
| 149 |
+
"min": -0.04195663332939148,
|
| 150 |
+
"max": 0.042360153049230576,
|
| 151 |
+
"per_tensor": {
|
| 152 |
+
"mlp.gate_proj.weight": {
|
| 153 |
+
"mean": 1.2623284722697765e-06,
|
| 154 |
+
"std": 0.004667664245278318,
|
| 155 |
+
"rms": 0.0046676644159710946,
|
| 156 |
+
"mean_abs": 0.0033581051975488663,
|
| 157 |
+
"min": -0.04188692569732666,
|
| 158 |
+
"max": 0.04206804931163788
|
| 159 |
+
},
|
| 160 |
+
"mlp.up_proj.weight": {
|
| 161 |
+
"mean": -2.837029266326378e-07,
|
| 162 |
+
"std": 0.005126653429482778,
|
| 163 |
+
"rms": 0.005126653437332669,
|
| 164 |
+
"mean_abs": 0.003825555555522442,
|
| 165 |
+
"min": -0.0383785143494606,
|
| 166 |
+
"max": 0.037312258034944534
|
| 167 |
+
},
|
| 168 |
+
"mlp.down_proj.weight": {
|
| 169 |
+
"mean": -3.2542728452729836e-07,
|
| 170 |
+
"std": 0.0036651373492196473,
|
| 171 |
+
"rms": 0.00366513736366698,
|
| 172 |
+
"mean_abs": 0.0028462124367554984,
|
| 173 |
+
"min": -0.04195663332939148,
|
| 174 |
+
"max": 0.042360153049230576
|
| 175 |
+
}
|
| 176 |
+
}
|
| 177 |
+
},
|
| 178 |
+
"rho_objective": "none",
|
| 179 |
+
"rho_schedule": "joint",
|
| 180 |
+
"additive_u": true,
|
| 181 |
+
"rho_epochs": 0.0,
|
| 182 |
+
"rho_lr": null,
|
| 183 |
+
"rho_bounds": null,
|
| 184 |
+
"rho_after_phase": null,
|
| 185 |
+
"rho_final": {},
|
| 186 |
+
"u_fisher_orthogonality": {},
|
| 187 |
+
"runtime": {
|
| 188 |
+
"seconds": 272.50738346390426,
|
| 189 |
+
"dataset_tokens": 524288,
|
| 190 |
+
"tokens_per_second": 1923.940530842336,
|
| 191 |
+
"batch_size": 1,
|
| 192 |
+
"batches_per_epoch": 512,
|
| 193 |
+
"grad_accumulation": 1,
|
| 194 |
+
"peak_allocated_bytes": 38422417408,
|
| 195 |
+
"peak_reserved_bytes": 50077892608,
|
| 196 |
+
"gpu_total_bytes": 85094825984,
|
| 197 |
+
"actual_forward_shapes": {
|
| 198 |
+
"teacher:1x1024": 512,
|
| 199 |
+
"student:1x1024": 512
|
| 200 |
+
}
|
| 201 |
+
},
|
| 202 |
+
"ablation": {
|
| 203 |
+
"lambda": null,
|
| 204 |
+
"endpoint_clamping": false,
|
| 205 |
+
"initial_u_nonzero": 0,
|
| 206 |
+
"merged_parameters": [
|
| 207 |
+
"mlp.gate_proj.weight",
|
| 208 |
+
"mlp.up_proj.weight",
|
| 209 |
+
"mlp.down_proj.weight"
|
| 210 |
+
],
|
| 211 |
+
"parameterization": "W_initial + U_add",
|
| 212 |
+
"fisher_computed": false,
|
| 213 |
+
"fit_scope": "mlp",
|
| 214 |
+
"attention_initialization": "CoMe_channel_merge",
|
| 215 |
+
"norm_initialization": "CoMe_pair_mean",
|
| 216 |
+
"CoMe": {
|
| 217 |
+
"source_lineage": [
|
| 218 |
+
[
|
| 219 |
+
15
|
| 220 |
+
],
|
| 221 |
+
[
|
| 222 |
+
16,
|
| 223 |
+
17
|
| 224 |
+
]
|
| 225 |
+
],
|
| 226 |
+
"retention_ratios": [
|
| 227 |
+
0.48481783779572774,
|
| 228 |
+
0.5151821622042723
|
| 229 |
+
],
|
| 230 |
+
"retained_attention_groups": [
|
| 231 |
+
3,
|
| 232 |
+
5
|
| 233 |
+
],
|
| 234 |
+
"retained_mlp_neurons": [
|
| 235 |
+
5957,
|
| 236 |
+
6331
|
| 237 |
+
],
|
| 238 |
+
"pair_score": 0.12428857100770828,
|
| 239 |
+
"minimum_retention": 0.0,
|
| 240 |
+
"adjusted_minimum": 0.0,
|
| 241 |
+
"power": 1.0,
|
| 242 |
+
"allow_repeat": true,
|
| 243 |
+
"sbi_metric": "angular_last",
|
| 244 |
+
"calibration_padding": "trim_right_padding_before_native_CoMe_scoring",
|
| 245 |
+
"teacher_mutated_during_initialization": false
|
| 246 |
+
},
|
| 247 |
+
"norms_trainable": false,
|
| 248 |
+
"attention_norm_initialization": "CoMe_retention_weighted_QK",
|
| 249 |
+
"initialized_parameters": [
|
| 250 |
+
"self_attn.q_proj.weight",
|
| 251 |
+
"self_attn.k_proj.weight",
|
| 252 |
+
"self_attn.v_proj.weight",
|
| 253 |
+
"self_attn.o_proj.weight",
|
| 254 |
+
"self_attn.q_norm.weight",
|
| 255 |
+
"self_attn.k_norm.weight",
|
| 256 |
+
"mlp.gate_proj.weight",
|
| 257 |
+
"mlp.up_proj.weight",
|
| 258 |
+
"mlp.down_proj.weight",
|
| 259 |
+
"input_layernorm.weight",
|
| 260 |
+
"post_attention_layernorm.weight"
|
| 261 |
+
],
|
| 262 |
+
"frozen_CoMe_parameters": [
|
| 263 |
+
"self_attn.q_proj.weight",
|
| 264 |
+
"self_attn.k_proj.weight",
|
| 265 |
+
"self_attn.v_proj.weight",
|
| 266 |
+
"self_attn.o_proj.weight",
|
| 267 |
+
"self_attn.q_norm.weight",
|
| 268 |
+
"self_attn.k_norm.weight",
|
| 269 |
+
"input_layernorm.weight",
|
| 270 |
+
"post_attention_layernorm.weight"
|
| 271 |
+
],
|
| 272 |
+
"frozen_attention_norm_expected_sha256": {
|
| 273 |
+
"self_attn.q_proj.weight": "e144fc375feeba841fb893f66d6c6fa9ef04120dbfa4ddfc1a159bf86586ba61",
|
| 274 |
+
"self_attn.k_proj.weight": "355b2a930766fc9c33f032fc19c3d1c618a5cc70d08acf1492aea8d9dc474150",
|
| 275 |
+
"self_attn.v_proj.weight": "34f582d607f0468a641dc8622fa95cc0bdbfdc2f38b98a32e11e6ad55d7b2e37",
|
| 276 |
+
"self_attn.o_proj.weight": "2f832c98994cce37666e06e9fec044ca2ecf17cb00b5adb1f10358c4367d3070",
|
| 277 |
+
"self_attn.q_norm.weight": "92b6ba51de0e72d7322500ceb344593844994aa05de41a1566908d0036b72158",
|
| 278 |
+
"self_attn.k_norm.weight": "fe2847d3261818e9ce010ef6c3e5aaded6c3045337c7b2989470d6d405bde5d9",
|
| 279 |
+
"input_layernorm.weight": "a36bf9c9668635c84481fa731271a83870120a57b6610c2ff64274e6a96d9f3c",
|
| 280 |
+
"post_attention_layernorm.weight": "02c0294d3d2fc22669c98157d5514cddf1a41a4ff47925bc0c560e86a60aa425"
|
| 281 |
+
},
|
| 282 |
+
"frozen_attention_norm_before_sha256": {
|
| 283 |
+
"self_attn.q_proj.weight": "e144fc375feeba841fb893f66d6c6fa9ef04120dbfa4ddfc1a159bf86586ba61",
|
| 284 |
+
"self_attn.k_proj.weight": "355b2a930766fc9c33f032fc19c3d1c618a5cc70d08acf1492aea8d9dc474150",
|
| 285 |
+
"self_attn.v_proj.weight": "34f582d607f0468a641dc8622fa95cc0bdbfdc2f38b98a32e11e6ad55d7b2e37",
|
| 286 |
+
"self_attn.o_proj.weight": "2f832c98994cce37666e06e9fec044ca2ecf17cb00b5adb1f10358c4367d3070",
|
| 287 |
+
"self_attn.q_norm.weight": "92b6ba51de0e72d7322500ceb344593844994aa05de41a1566908d0036b72158",
|
| 288 |
+
"self_attn.k_norm.weight": "fe2847d3261818e9ce010ef6c3e5aaded6c3045337c7b2989470d6d405bde5d9",
|
| 289 |
+
"input_layernorm.weight": "a36bf9c9668635c84481fa731271a83870120a57b6610c2ff64274e6a96d9f3c",
|
| 290 |
+
"post_attention_layernorm.weight": "02c0294d3d2fc22669c98157d5514cddf1a41a4ff47925bc0c560e86a60aa425"
|
| 291 |
+
},
|
| 292 |
+
"frozen_attention_norm_after_sha256": {
|
| 293 |
+
"self_attn.q_proj.weight": "e144fc375feeba841fb893f66d6c6fa9ef04120dbfa4ddfc1a159bf86586ba61",
|
| 294 |
+
"self_attn.k_proj.weight": "355b2a930766fc9c33f032fc19c3d1c618a5cc70d08acf1492aea8d9dc474150",
|
| 295 |
+
"self_attn.v_proj.weight": "34f582d607f0468a641dc8622fa95cc0bdbfdc2f38b98a32e11e6ad55d7b2e37",
|
| 296 |
+
"self_attn.o_proj.weight": "2f832c98994cce37666e06e9fec044ca2ecf17cb00b5adb1f10358c4367d3070",
|
| 297 |
+
"self_attn.q_norm.weight": "92b6ba51de0e72d7322500ceb344593844994aa05de41a1566908d0036b72158",
|
| 298 |
+
"self_attn.k_norm.weight": "fe2847d3261818e9ce010ef6c3e5aaded6c3045337c7b2989470d6d405bde5d9",
|
| 299 |
+
"input_layernorm.weight": "a36bf9c9668635c84481fa731271a83870120a57b6610c2ff64274e6a96d9f3c",
|
| 300 |
+
"post_attention_layernorm.weight": "02c0294d3d2fc22669c98157d5514cddf1a41a4ff47925bc0c560e86a60aa425"
|
| 301 |
+
},
|
| 302 |
+
"frozen_attention_norm_unchanged": true,
|
| 303 |
+
"source_feature_transport": false,
|
| 304 |
+
"initializer": "come",
|
| 305 |
+
"removed_count_per_cycle": 1,
|
| 306 |
+
"teacher_boundary_current_layer": 16,
|
| 307 |
+
"teacher_boundary_original_layer": 16
|
| 308 |
+
}
|
| 309 |
+
}
|
runs/vast-paper_revision-come-attn-fit-20261126-62646539/20261126-qwen3-base-mka-come-mlp-fit/catalog/results/come/audit/cycle_05_fit.json
ADDED
|
@@ -0,0 +1,308 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"enabled": true,
|
| 3 |
+
"epochs": 1.0,
|
| 4 |
+
"requested_epochs": 1.0,
|
| 5 |
+
"skip_train": false,
|
| 6 |
+
"trained": true,
|
| 7 |
+
"lr": 0.0001,
|
| 8 |
+
"hidden_mse_weight": 1.0,
|
| 9 |
+
"attn_mse_weight": 0.0,
|
| 10 |
+
"mlp_mse_weight": 1.0,
|
| 11 |
+
"eta": 0.0,
|
| 12 |
+
"gamma": 0.0,
|
| 13 |
+
"attn_reg_scale": 1.0,
|
| 14 |
+
"mlp_reg_scale": 1.0,
|
| 15 |
+
"param_subset": "mlp",
|
| 16 |
+
"train_subset": "mlp",
|
| 17 |
+
"num_gates": 3,
|
| 18 |
+
"num_attn_gates": 0,
|
| 19 |
+
"num_mlp_gates": 3,
|
| 20 |
+
"num_other_gates": 0,
|
| 21 |
+
"num_trainable_attn_gates": 0,
|
| 22 |
+
"num_trainable_mlp_gates": 3,
|
| 23 |
+
"num_trainable_other_gates": 0,
|
| 24 |
+
"lambda_init_summary": {
|
| 25 |
+
"num_tensors": 3,
|
| 26 |
+
"num_elements": 3,
|
| 27 |
+
"mean": 0.9998999834060669,
|
| 28 |
+
"std": 0.0,
|
| 29 |
+
"min": 0.9998999834060669,
|
| 30 |
+
"max": 0.9998999834060669,
|
| 31 |
+
"mean_abs_from_0_5": 0.4998999834060669,
|
| 32 |
+
"per_tensor": {
|
| 33 |
+
"mlp.gate_proj.weight": {
|
| 34 |
+
"mean": 0.9998999834060669,
|
| 35 |
+
"std": 0.0,
|
| 36 |
+
"min": 0.9998999834060669,
|
| 37 |
+
"max": 0.9998999834060669,
|
| 38 |
+
"mean_abs_from_0_5": 0.4998999834060669
|
| 39 |
+
},
|
| 40 |
+
"mlp.up_proj.weight": {
|
| 41 |
+
"mean": 0.9998999834060669,
|
| 42 |
+
"std": 0.0,
|
| 43 |
+
"min": 0.9998999834060669,
|
| 44 |
+
"max": 0.9998999834060669,
|
| 45 |
+
"mean_abs_from_0_5": 0.4998999834060669
|
| 46 |
+
},
|
| 47 |
+
"mlp.down_proj.weight": {
|
| 48 |
+
"mean": 0.9998999834060669,
|
| 49 |
+
"std": 0.0,
|
| 50 |
+
"min": 0.9998999834060669,
|
| 51 |
+
"max": 0.9998999834060669,
|
| 52 |
+
"mean_abs_from_0_5": 0.4998999834060669
|
| 53 |
+
}
|
| 54 |
+
}
|
| 55 |
+
},
|
| 56 |
+
"lambda_final_summary": {
|
| 57 |
+
"num_tensors": 3,
|
| 58 |
+
"num_elements": 3,
|
| 59 |
+
"mean": 1.0,
|
| 60 |
+
"std": 0.0,
|
| 61 |
+
"min": 1.0,
|
| 62 |
+
"max": 1.0,
|
| 63 |
+
"mean_abs_from_0_5": 0.5,
|
| 64 |
+
"per_tensor": {
|
| 65 |
+
"mlp.gate_proj.weight": {
|
| 66 |
+
"mean": 1.0,
|
| 67 |
+
"std": 0.0,
|
| 68 |
+
"min": 1.0,
|
| 69 |
+
"max": 1.0,
|
| 70 |
+
"mean_abs_from_0_5": 0.5
|
| 71 |
+
},
|
| 72 |
+
"mlp.up_proj.weight": {
|
| 73 |
+
"mean": 1.0,
|
| 74 |
+
"std": 0.0,
|
| 75 |
+
"min": 1.0,
|
| 76 |
+
"max": 1.0,
|
| 77 |
+
"mean_abs_from_0_5": 0.5
|
| 78 |
+
},
|
| 79 |
+
"mlp.down_proj.weight": {
|
| 80 |
+
"mean": 1.0,
|
| 81 |
+
"std": 0.0,
|
| 82 |
+
"min": 1.0,
|
| 83 |
+
"max": 1.0,
|
| 84 |
+
"mean_abs_from_0_5": 0.5
|
| 85 |
+
}
|
| 86 |
+
}
|
| 87 |
+
},
|
| 88 |
+
"lambda_delta_from_init": {
|
| 89 |
+
"num_tensors": 3,
|
| 90 |
+
"num_elements": 3,
|
| 91 |
+
"mean_abs": 0.0,
|
| 92 |
+
"rms": 0.0,
|
| 93 |
+
"max_abs": 0.0,
|
| 94 |
+
"per_tensor": {
|
| 95 |
+
"mlp.gate_proj.weight": {
|
| 96 |
+
"mean_abs": 0.0,
|
| 97 |
+
"rms": 0.0,
|
| 98 |
+
"max_abs": 0.0
|
| 99 |
+
},
|
| 100 |
+
"mlp.up_proj.weight": {
|
| 101 |
+
"mean_abs": 0.0,
|
| 102 |
+
"rms": 0.0,
|
| 103 |
+
"max_abs": 0.0
|
| 104 |
+
},
|
| 105 |
+
"mlp.down_proj.weight": {
|
| 106 |
+
"mean_abs": 0.0,
|
| 107 |
+
"rms": 0.0,
|
| 108 |
+
"max_abs": 0.0
|
| 109 |
+
}
|
| 110 |
+
}
|
| 111 |
+
},
|
| 112 |
+
"first_grad_summary": {
|
| 113 |
+
"joint": {
|
| 114 |
+
"step": 1,
|
| 115 |
+
"phase": "joint",
|
| 116 |
+
"gate": {
|
| 117 |
+
"num_tensors": 3,
|
| 118 |
+
"num_tensors_without_grad": 3,
|
| 119 |
+
"num_elements": 0,
|
| 120 |
+
"l2": 0.0,
|
| 121 |
+
"mean_abs": null,
|
| 122 |
+
"max_abs": 0.0
|
| 123 |
+
},
|
| 124 |
+
"u": {
|
| 125 |
+
"num_tensors": 3,
|
| 126 |
+
"num_tensors_without_grad": 0,
|
| 127 |
+
"num_elements": 150994944,
|
| 128 |
+
"l2": 10.416070559929201,
|
| 129 |
+
"mean_abs": 0.00014571001843756271,
|
| 130 |
+
"max_abs": 1.5470943450927734
|
| 131 |
+
},
|
| 132 |
+
"rho": {
|
| 133 |
+
"num_tensors": 0,
|
| 134 |
+
"num_tensors_without_grad": 0,
|
| 135 |
+
"num_elements": 0,
|
| 136 |
+
"l2": 0.0,
|
| 137 |
+
"mean_abs": null,
|
| 138 |
+
"max_abs": 0.0
|
| 139 |
+
}
|
| 140 |
+
}
|
| 141 |
+
},
|
| 142 |
+
"u_delta_summary": {
|
| 143 |
+
"num_tensors": 3,
|
| 144 |
+
"num_elements": 150994944,
|
| 145 |
+
"mean": 3.504058844959622e-06,
|
| 146 |
+
"std": 0.0028318628407741995,
|
| 147 |
+
"rms": 0.002831865008679988,
|
| 148 |
+
"mean_abs": 0.0022335324643386733,
|
| 149 |
+
"min": -0.026923593133687973,
|
| 150 |
+
"max": 0.029769256711006165,
|
| 151 |
+
"per_tensor": {
|
| 152 |
+
"mlp.gate_proj.weight": {
|
| 153 |
+
"mean": 1.0593326199644556e-05,
|
| 154 |
+
"std": 0.0026527072310847228,
|
| 155 |
+
"rms": 0.0026527283827050877,
|
| 156 |
+
"mean_abs": 0.00211204681545496,
|
| 157 |
+
"min": -0.023384634405374527,
|
| 158 |
+
"max": 0.021433265879750252
|
| 159 |
+
},
|
| 160 |
+
"mlp.up_proj.weight": {
|
| 161 |
+
"mean": -1.3555364830608596e-07,
|
| 162 |
+
"std": 0.002661194413471638,
|
| 163 |
+
"rms": 0.002661194416923996,
|
| 164 |
+
"mean_abs": 0.0020990585908293724,
|
| 165 |
+
"min": -0.01704355515539646,
|
| 166 |
+
"max": 0.017607910558581352
|
| 167 |
+
},
|
| 168 |
+
"mlp.down_proj.weight": {
|
| 169 |
+
"mean": 5.440398354039644e-08,
|
| 170 |
+
"std": 0.0031526900707367247,
|
| 171 |
+
"rms": 0.0031526900712061322,
|
| 172 |
+
"mean_abs": 0.002489491986731688,
|
| 173 |
+
"min": -0.026923593133687973,
|
| 174 |
+
"max": 0.029769256711006165
|
| 175 |
+
}
|
| 176 |
+
}
|
| 177 |
+
},
|
| 178 |
+
"rho_objective": "none",
|
| 179 |
+
"rho_schedule": "joint",
|
| 180 |
+
"additive_u": true,
|
| 181 |
+
"rho_epochs": 0.0,
|
| 182 |
+
"rho_lr": null,
|
| 183 |
+
"rho_bounds": null,
|
| 184 |
+
"rho_after_phase": null,
|
| 185 |
+
"rho_final": {},
|
| 186 |
+
"u_fisher_orthogonality": {},
|
| 187 |
+
"runtime": {
|
| 188 |
+
"seconds": 263.1926762089133,
|
| 189 |
+
"dataset_tokens": 524288,
|
| 190 |
+
"tokens_per_second": 1992.0311140566776,
|
| 191 |
+
"batch_size": 1,
|
| 192 |
+
"batches_per_epoch": 512,
|
| 193 |
+
"grad_accumulation": 1,
|
| 194 |
+
"peak_allocated_bytes": 35835041792,
|
| 195 |
+
"peak_reserved_bytes": 48907681792,
|
| 196 |
+
"gpu_total_bytes": 85094825984,
|
| 197 |
+
"actual_forward_shapes": {
|
| 198 |
+
"teacher:1x1024": 512,
|
| 199 |
+
"student:1x1024": 512
|
| 200 |
+
}
|
| 201 |
+
},
|
| 202 |
+
"ablation": {
|
| 203 |
+
"lambda": null,
|
| 204 |
+
"endpoint_clamping": false,
|
| 205 |
+
"initial_u_nonzero": 0,
|
| 206 |
+
"merged_parameters": [
|
| 207 |
+
"mlp.gate_proj.weight",
|
| 208 |
+
"mlp.up_proj.weight",
|
| 209 |
+
"mlp.down_proj.weight"
|
| 210 |
+
],
|
| 211 |
+
"parameterization": "W_initial + U_add",
|
| 212 |
+
"fisher_computed": false,
|
| 213 |
+
"fit_scope": "mlp",
|
| 214 |
+
"attention_initialization": "CoMe_channel_merge",
|
| 215 |
+
"norm_initialization": "CoMe_pair_mean",
|
| 216 |
+
"CoMe": {
|
| 217 |
+
"source_lineage": [
|
| 218 |
+
[
|
| 219 |
+
29
|
| 220 |
+
],
|
| 221 |
+
[
|
| 222 |
+
30
|
| 223 |
+
]
|
| 224 |
+
],
|
| 225 |
+
"retention_ratios": [
|
| 226 |
+
0.5168892574349215,
|
| 227 |
+
0.4831107425650785
|
| 228 |
+
],
|
| 229 |
+
"retained_attention_groups": [
|
| 230 |
+
5,
|
| 231 |
+
3
|
| 232 |
+
],
|
| 233 |
+
"retained_mlp_neurons": [
|
| 234 |
+
6352,
|
| 235 |
+
5936
|
| 236 |
+
],
|
| 237 |
+
"pair_score": 0.12363086149413535,
|
| 238 |
+
"minimum_retention": 0.0,
|
| 239 |
+
"adjusted_minimum": 0.0,
|
| 240 |
+
"power": 1.0,
|
| 241 |
+
"allow_repeat": true,
|
| 242 |
+
"sbi_metric": "angular_last",
|
| 243 |
+
"calibration_padding": "trim_right_padding_before_native_CoMe_scoring",
|
| 244 |
+
"teacher_mutated_during_initialization": false
|
| 245 |
+
},
|
| 246 |
+
"norms_trainable": false,
|
| 247 |
+
"attention_norm_initialization": "CoMe_retention_weighted_QK",
|
| 248 |
+
"initialized_parameters": [
|
| 249 |
+
"self_attn.q_proj.weight",
|
| 250 |
+
"self_attn.k_proj.weight",
|
| 251 |
+
"self_attn.v_proj.weight",
|
| 252 |
+
"self_attn.o_proj.weight",
|
| 253 |
+
"self_attn.q_norm.weight",
|
| 254 |
+
"self_attn.k_norm.weight",
|
| 255 |
+
"mlp.gate_proj.weight",
|
| 256 |
+
"mlp.up_proj.weight",
|
| 257 |
+
"mlp.down_proj.weight",
|
| 258 |
+
"input_layernorm.weight",
|
| 259 |
+
"post_attention_layernorm.weight"
|
| 260 |
+
],
|
| 261 |
+
"frozen_CoMe_parameters": [
|
| 262 |
+
"self_attn.q_proj.weight",
|
| 263 |
+
"self_attn.k_proj.weight",
|
| 264 |
+
"self_attn.v_proj.weight",
|
| 265 |
+
"self_attn.o_proj.weight",
|
| 266 |
+
"self_attn.q_norm.weight",
|
| 267 |
+
"self_attn.k_norm.weight",
|
| 268 |
+
"input_layernorm.weight",
|
| 269 |
+
"post_attention_layernorm.weight"
|
| 270 |
+
],
|
| 271 |
+
"frozen_attention_norm_expected_sha256": {
|
| 272 |
+
"self_attn.q_proj.weight": "52fbd62bd62d7e2eaac0d2200d13f871e3deb60c0fd528297ee4536e9d8dc086",
|
| 273 |
+
"self_attn.k_proj.weight": "8111ddc37251c97bb655b31cd12861532c4bfbebd575bf99d2b1fbe10c48e056",
|
| 274 |
+
"self_attn.v_proj.weight": "90ab892c075978b6c4da576a84726e0dd1b2c03a2693ae085e9fb4854f8f5cda",
|
| 275 |
+
"self_attn.o_proj.weight": "0bd5ffb8b1db91700ecef537352b4938c61ab309f0c133e406f70406ea3d5479",
|
| 276 |
+
"self_attn.q_norm.weight": "da82f14c18c6dd24be49f9ea70b0dba47f259589a8c36f25319404914cc93e30",
|
| 277 |
+
"self_attn.k_norm.weight": "e997dc8cf097fb2e1771403fe8dfd46c8e38290d07e3fc105cf003611032c7f4",
|
| 278 |
+
"input_layernorm.weight": "64e67fc0c3a1540d2fc0134655058358a78cc81e047873cf05afac1c6a2fc0d0",
|
| 279 |
+
"post_attention_layernorm.weight": "0a89cbbfd56094d174142e7b4ad773e644f7bb78c6b3539ebb3eab6c048680cd"
|
| 280 |
+
},
|
| 281 |
+
"frozen_attention_norm_before_sha256": {
|
| 282 |
+
"self_attn.q_proj.weight": "52fbd62bd62d7e2eaac0d2200d13f871e3deb60c0fd528297ee4536e9d8dc086",
|
| 283 |
+
"self_attn.k_proj.weight": "8111ddc37251c97bb655b31cd12861532c4bfbebd575bf99d2b1fbe10c48e056",
|
| 284 |
+
"self_attn.v_proj.weight": "90ab892c075978b6c4da576a84726e0dd1b2c03a2693ae085e9fb4854f8f5cda",
|
| 285 |
+
"self_attn.o_proj.weight": "0bd5ffb8b1db91700ecef537352b4938c61ab309f0c133e406f70406ea3d5479",
|
| 286 |
+
"self_attn.q_norm.weight": "da82f14c18c6dd24be49f9ea70b0dba47f259589a8c36f25319404914cc93e30",
|
| 287 |
+
"self_attn.k_norm.weight": "e997dc8cf097fb2e1771403fe8dfd46c8e38290d07e3fc105cf003611032c7f4",
|
| 288 |
+
"input_layernorm.weight": "64e67fc0c3a1540d2fc0134655058358a78cc81e047873cf05afac1c6a2fc0d0",
|
| 289 |
+
"post_attention_layernorm.weight": "0a89cbbfd56094d174142e7b4ad773e644f7bb78c6b3539ebb3eab6c048680cd"
|
| 290 |
+
},
|
| 291 |
+
"frozen_attention_norm_after_sha256": {
|
| 292 |
+
"self_attn.q_proj.weight": "52fbd62bd62d7e2eaac0d2200d13f871e3deb60c0fd528297ee4536e9d8dc086",
|
| 293 |
+
"self_attn.k_proj.weight": "8111ddc37251c97bb655b31cd12861532c4bfbebd575bf99d2b1fbe10c48e056",
|
| 294 |
+
"self_attn.v_proj.weight": "90ab892c075978b6c4da576a84726e0dd1b2c03a2693ae085e9fb4854f8f5cda",
|
| 295 |
+
"self_attn.o_proj.weight": "0bd5ffb8b1db91700ecef537352b4938c61ab309f0c133e406f70406ea3d5479",
|
| 296 |
+
"self_attn.q_norm.weight": "da82f14c18c6dd24be49f9ea70b0dba47f259589a8c36f25319404914cc93e30",
|
| 297 |
+
"self_attn.k_norm.weight": "e997dc8cf097fb2e1771403fe8dfd46c8e38290d07e3fc105cf003611032c7f4",
|
| 298 |
+
"input_layernorm.weight": "64e67fc0c3a1540d2fc0134655058358a78cc81e047873cf05afac1c6a2fc0d0",
|
| 299 |
+
"post_attention_layernorm.weight": "0a89cbbfd56094d174142e7b4ad773e644f7bb78c6b3539ebb3eab6c048680cd"
|
| 300 |
+
},
|
| 301 |
+
"frozen_attention_norm_unchanged": true,
|
| 302 |
+
"source_feature_transport": false,
|
| 303 |
+
"initializer": "come",
|
| 304 |
+
"removed_count_per_cycle": 1,
|
| 305 |
+
"teacher_boundary_current_layer": 27,
|
| 306 |
+
"teacher_boundary_original_layer": 30
|
| 307 |
+
}
|
| 308 |
+
}
|
runs/vast-paper_revision-come-attn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true,
|
| 7 |
+
"lr": 0.0001,
|
| 8 |
+
"hidden_mse_weight": 1.0,
|
| 9 |
+
"attn_mse_weight": 0.0,
|
| 10 |
+
"mlp_mse_weight": 1.0,
|
| 11 |
+
"eta": 0.0,
|
| 12 |
+
"gamma": 0.0,
|
| 13 |
+
"attn_reg_scale": 1.0,
|
| 14 |
+
"mlp_reg_scale": 1.0,
|
| 15 |
+
"param_subset": "mlp",
|
| 16 |
+
"train_subset": "mlp",
|
| 17 |
+
"num_gates": 3,
|
| 18 |
+
"num_attn_gates": 0,
|
| 19 |
+
"num_mlp_gates": 3,
|
| 20 |
+
"num_other_gates": 0,
|
| 21 |
+
"num_trainable_attn_gates": 0,
|
| 22 |
+
"num_trainable_mlp_gates": 3,
|
| 23 |
+
"num_trainable_other_gates": 0,
|
| 24 |
+
"lambda_init_summary": {
|
| 25 |
+
"num_tensors": 3,
|
| 26 |
+
"num_elements": 3,
|
| 27 |
+
"mean": 0.9998999834060669,
|
| 28 |
+
"std": 0.0,
|
| 29 |
+
"min": 0.9998999834060669,
|
| 30 |
+
"max": 0.9998999834060669,
|
| 31 |
+
"mean_abs_from_0_5": 0.4998999834060669,
|
| 32 |
+
"per_tensor": {
|
| 33 |
+
"mlp.gate_proj.weight": {
|
| 34 |
+
"mean": 0.9998999834060669,
|
| 35 |
+
"std": 0.0,
|
| 36 |
+
"min": 0.9998999834060669,
|
| 37 |
+
"max": 0.9998999834060669,
|
| 38 |
+
"mean_abs_from_0_5": 0.4998999834060669
|
| 39 |
+
},
|
| 40 |
+
"mlp.up_proj.weight": {
|
| 41 |
+
"mean": 0.9998999834060669,
|
| 42 |
+
"std": 0.0,
|
| 43 |
+
"min": 0.9998999834060669,
|
| 44 |
+
"max": 0.9998999834060669,
|
| 45 |
+
"mean_abs_from_0_5": 0.4998999834060669
|
| 46 |
+
},
|
| 47 |
+
"mlp.down_proj.weight": {
|
| 48 |
+
"mean": 0.9998999834060669,
|
| 49 |
+
"std": 0.0,
|
| 50 |
+
"min": 0.9998999834060669,
|
| 51 |
+
"max": 0.9998999834060669,
|
| 52 |
+
"mean_abs_from_0_5": 0.4998999834060669
|
| 53 |
+
}
|
| 54 |
+
}
|
| 55 |
+
},
|
| 56 |
+
"lambda_final_summary": {
|
| 57 |
+
"num_tensors": 3,
|
| 58 |
+
"num_elements": 3,
|
| 59 |
+
"mean": 1.0,
|
| 60 |
+
"std": 0.0,
|
| 61 |
+
"min": 1.0,
|
| 62 |
+
"max": 1.0,
|
| 63 |
+
"mean_abs_from_0_5": 0.5,
|
| 64 |
+
"per_tensor": {
|
| 65 |
+
"mlp.gate_proj.weight": {
|
| 66 |
+
"mean": 1.0,
|
| 67 |
+
"std": 0.0,
|
| 68 |
+
"min": 1.0,
|
| 69 |
+
"max": 1.0,
|
| 70 |
+
"mean_abs_from_0_5": 0.5
|
| 71 |
+
},
|
| 72 |
+
"mlp.up_proj.weight": {
|
| 73 |
+
"mean": 1.0,
|
| 74 |
+
"std": 0.0,
|
| 75 |
+
"min": 1.0,
|
| 76 |
+
"max": 1.0,
|
| 77 |
+
"mean_abs_from_0_5": 0.5
|
| 78 |
+
},
|
| 79 |
+
"mlp.down_proj.weight": {
|
| 80 |
+
"mean": 1.0,
|
| 81 |
+
"std": 0.0,
|
| 82 |
+
"min": 1.0,
|
| 83 |
+
"max": 1.0,
|
| 84 |
+
"mean_abs_from_0_5": 0.5
|
| 85 |
+
}
|
| 86 |
+
}
|
| 87 |
+
},
|
| 88 |
+
"lambda_delta_from_init": {
|
| 89 |
+
"num_tensors": 3,
|
| 90 |
+
"num_elements": 3,
|
| 91 |
+
"mean_abs": 0.0,
|
| 92 |
+
"rms": 0.0,
|
| 93 |
+
"max_abs": 0.0,
|
| 94 |
+
"per_tensor": {
|
| 95 |
+
"mlp.gate_proj.weight": {
|
| 96 |
+
"mean_abs": 0.0,
|
| 97 |
+
"rms": 0.0,
|
| 98 |
+
"max_abs": 0.0
|
| 99 |
+
},
|
| 100 |
+
"mlp.up_proj.weight": {
|
| 101 |
+
"mean_abs": 0.0,
|
| 102 |
+
"rms": 0.0,
|
| 103 |
+
"max_abs": 0.0
|
| 104 |
+
},
|
| 105 |
+
"mlp.down_proj.weight": {
|
| 106 |
+
"mean_abs": 0.0,
|
| 107 |
+
"rms": 0.0,
|
| 108 |
+
"max_abs": 0.0
|
| 109 |
+
}
|
| 110 |
+
}
|
| 111 |
+
},
|
| 112 |
+
"first_grad_summary": {
|
| 113 |
+
"joint": {
|
| 114 |
+
"step": 1,
|
| 115 |
+
"phase": "joint",
|
| 116 |
+
"gate": {
|
| 117 |
+
"num_tensors": 3,
|
| 118 |
+
"num_tensors_without_grad": 3,
|
| 119 |
+
"num_elements": 0,
|
| 120 |
+
"l2": 0.0,
|
| 121 |
+
"mean_abs": null,
|
| 122 |
+
"max_abs": 0.0
|
| 123 |
+
},
|
| 124 |
+
"u": {
|
| 125 |
+
"num_tensors": 3,
|
| 126 |
+
"num_tensors_without_grad": 0,
|
| 127 |
+
"num_elements": 150994944,
|
| 128 |
+
"l2": 1.6286034611369704,
|
| 129 |
+
"mean_abs": 4.974205835929347e-05,
|
| 130 |
+
"max_abs": 0.09180885553359985
|
| 131 |
+
},
|
| 132 |
+
"rho": {
|
| 133 |
+
"num_tensors": 0,
|
| 134 |
+
"num_tensors_without_grad": 0,
|
| 135 |
+
"num_elements": 0,
|
| 136 |
+
"l2": 0.0,
|
| 137 |
+
"mean_abs": null,
|
| 138 |
+
"max_abs": 0.0
|
| 139 |
+
}
|
| 140 |
+
}
|
| 141 |
+
},
|
| 142 |
+
"u_delta_summary": {
|
| 143 |
+
"num_tensors": 3,
|
| 144 |
+
"num_elements": 150994944,
|
| 145 |
+
"mean": 3.004043845875357e-06,
|
| 146 |
+
"std": 0.002940920321421633,
|
| 147 |
+
"rms": 0.0029409218556823553,
|
| 148 |
+
"mean_abs": 0.002319265363944901,
|
| 149 |
+
"min": -0.02507743053138256,
|
| 150 |
+
"max": 0.02854803204536438,
|
| 151 |
+
"per_tensor": {
|
| 152 |
+
"mlp.gate_proj.weight": {
|
| 153 |
+
"mean": 8.660291011134783e-06,
|
| 154 |
+
"std": 0.002758917691235299,
|
| 155 |
+
"rms": 0.0027589312836044885,
|
| 156 |
+
"mean_abs": 0.0022007301449775696,
|
| 157 |
+
"min": -0.021901600062847137,
|
| 158 |
+
"max": 0.024919675663113594
|
| 159 |
+
},
|
| 160 |
+
"mlp.up_proj.weight": {
|
| 161 |
+
"mean": 3.8269778694181394e-07,
|
| 162 |
+
"std": 0.0027593195629921686,
|
| 163 |
+
"rms": 0.0027593195895308843,
|
| 164 |
+
"mean_abs": 0.0021812085372706256,
|
| 165 |
+
"min": -0.019312186166644096,
|
| 166 |
+
"max": 0.017826871946454048
|
| 167 |
+
},
|
| 168 |
+
"mlp.down_proj.weight": {
|
| 169 |
+
"mean": -3.085726045052676e-08,
|
| 170 |
+
"std": 0.003274372864827382,
|
| 171 |
+
"rms": 0.0032743728649727794,
|
| 172 |
+
"mean_abs": 0.002575857409586509,
|
| 173 |
+
"min": -0.02507743053138256,
|
| 174 |
+
"max": 0.02854803204536438
|
| 175 |
+
}
|
| 176 |
+
}
|
| 177 |
+
},
|
| 178 |
+
"rho_objective": "none",
|
| 179 |
+
"rho_schedule": "joint",
|
| 180 |
+
"additive_u": true,
|
| 181 |
+
"rho_epochs": 0.0,
|
| 182 |
+
"rho_lr": null,
|
| 183 |
+
"rho_bounds": null,
|
| 184 |
+
"rho_after_phase": null,
|
| 185 |
+
"rho_final": {},
|
| 186 |
+
"u_fisher_orthogonality": {},
|
| 187 |
+
"runtime": {
|
| 188 |
+
"seconds": 295.43956048227847,
|
| 189 |
+
"dataset_tokens": 524288,
|
| 190 |
+
"tokens_per_second": 1774.603235748615,
|
| 191 |
+
"batch_size": 1,
|
| 192 |
+
"batches_per_epoch": 512,
|
| 193 |
+
"grad_accumulation": 1,
|
| 194 |
+
"peak_allocated_bytes": 35365853184,
|
| 195 |
+
"peak_reserved_bytes": 47737470976,
|
| 196 |
+
"gpu_total_bytes": 85094825984,
|
| 197 |
+
"actual_forward_shapes": {
|
| 198 |
+
"teacher:1x1024": 512,
|
| 199 |
+
"student:1x1024": 512
|
| 200 |
+
}
|
| 201 |
+
},
|
| 202 |
+
"ablation": {
|
| 203 |
+
"lambda": null,
|
| 204 |
+
"endpoint_clamping": false,
|
| 205 |
+
"initial_u_nonzero": 0,
|
| 206 |
+
"merged_parameters": [
|
| 207 |
+
"mlp.gate_proj.weight",
|
| 208 |
+
"mlp.up_proj.weight",
|
| 209 |
+
"mlp.down_proj.weight"
|
| 210 |
+
],
|
| 211 |
+
"parameterization": "W_initial + U_add",
|
| 212 |
+
"fisher_computed": false,
|
| 213 |
+
"fit_scope": "mlp",
|
| 214 |
+
"attention_initialization": "CoMe_channel_merge",
|
| 215 |
+
"norm_initialization": "CoMe_pair_mean",
|
| 216 |
+
"CoMe": {
|
| 217 |
+
"source_lineage": [
|
| 218 |
+
[
|
| 219 |
+
25
|
| 220 |
+
],
|
| 221 |
+
[
|
| 222 |
+
26,
|
| 223 |
+
27
|
| 224 |
+
]
|
| 225 |
+
],
|
| 226 |
+
"retention_ratios": [
|
| 227 |
+
0.5023699918186109,
|
| 228 |
+
0.49763000818138914
|
| 229 |
+
],
|
| 230 |
+
"retained_attention_groups": [
|
| 231 |
+
5,
|
| 232 |
+
3
|
| 233 |
+
],
|
| 234 |
+
"retained_mlp_neurons": [
|
| 235 |
+
6174,
|
| 236 |
+
6114
|
| 237 |
+
],
|
| 238 |
+
"pair_score": 0.12410008491195262,
|
| 239 |
+
"minimum_retention": 0.0,
|
| 240 |
+
"adjusted_minimum": 0.0,
|
| 241 |
+
"power": 1.0,
|
| 242 |
+
"allow_repeat": true,
|
| 243 |
+
"sbi_metric": "angular_last",
|
| 244 |
+
"calibration_padding": "trim_right_padding_before_native_CoMe_scoring",
|
| 245 |
+
"teacher_mutated_during_initialization": false
|
| 246 |
+
},
|
| 247 |
+
"norms_trainable": false,
|
| 248 |
+
"attention_norm_initialization": "CoMe_retention_weighted_QK",
|
| 249 |
+
"initialized_parameters": [
|
| 250 |
+
"self_attn.q_proj.weight",
|
| 251 |
+
"self_attn.k_proj.weight",
|
| 252 |
+
"self_attn.v_proj.weight",
|
| 253 |
+
"self_attn.o_proj.weight",
|
| 254 |
+
"self_attn.q_norm.weight",
|
| 255 |
+
"self_attn.k_norm.weight",
|
| 256 |
+
"mlp.gate_proj.weight",
|
| 257 |
+
"mlp.up_proj.weight",
|
| 258 |
+
"mlp.down_proj.weight",
|
| 259 |
+
"input_layernorm.weight",
|
| 260 |
+
"post_attention_layernorm.weight"
|
| 261 |
+
],
|
| 262 |
+
"frozen_CoMe_parameters": [
|
| 263 |
+
"self_attn.q_proj.weight",
|
| 264 |
+
"self_attn.k_proj.weight",
|
| 265 |
+
"self_attn.v_proj.weight",
|
| 266 |
+
"self_attn.o_proj.weight",
|
| 267 |
+
"self_attn.q_norm.weight",
|
| 268 |
+
"self_attn.k_norm.weight",
|
| 269 |
+
"input_layernorm.weight",
|
| 270 |
+
"post_attention_layernorm.weight"
|
| 271 |
+
],
|
| 272 |
+
"frozen_attention_norm_expected_sha256": {
|
| 273 |
+
"self_attn.q_proj.weight": "39f86798d44a14cf29c0724dc84fe0261eb909a05cd405ac91ac7d141f235a4e",
|
| 274 |
+
"self_attn.k_proj.weight": "e23576863e9742419b554ec91e06851542fa31624588dd0b0865c98ca756ef07",
|
| 275 |
+
"self_attn.v_proj.weight": "32df6f78cdcbd2eb1155384475ea6ded1079aee19486bca7713627278410d373",
|
| 276 |
+
"self_attn.o_proj.weight": "607f1bd80abb8a599c6b66c669658355b73eb737edc5366d0e1afc494609943f",
|
| 277 |
+
"self_attn.q_norm.weight": "a24069bc529bcd467f912646b8707018d31f4a0446da073b1b205c4db50ee145",
|
| 278 |
+
"self_attn.k_norm.weight": "9dab9cd5fae1f8d67c448cfcf98e579cbcfc38d8c416771282eb1fe691b20022",
|
| 279 |
+
"input_layernorm.weight": "1ac54bb5ca0b83123b8cffdb4badce519a1ce5ddd669f6243d10f00b493d445d",
|
| 280 |
+
"post_attention_layernorm.weight": "394b5889e1bf81ccb8c96b48f7f760df70a5d0b24835ffa47bdf1e053daeecea"
|
| 281 |
+
},
|
| 282 |
+
"frozen_attention_norm_before_sha256": {
|
| 283 |
+
"self_attn.q_proj.weight": "39f86798d44a14cf29c0724dc84fe0261eb909a05cd405ac91ac7d141f235a4e",
|
| 284 |
+
"self_attn.k_proj.weight": "e23576863e9742419b554ec91e06851542fa31624588dd0b0865c98ca756ef07",
|
| 285 |
+
"self_attn.v_proj.weight": "32df6f78cdcbd2eb1155384475ea6ded1079aee19486bca7713627278410d373",
|
| 286 |
+
"self_attn.o_proj.weight": "607f1bd80abb8a599c6b66c669658355b73eb737edc5366d0e1afc494609943f",
|
| 287 |
+
"self_attn.q_norm.weight": "a24069bc529bcd467f912646b8707018d31f4a0446da073b1b205c4db50ee145",
|
| 288 |
+
"self_attn.k_norm.weight": "9dab9cd5fae1f8d67c448cfcf98e579cbcfc38d8c416771282eb1fe691b20022",
|
| 289 |
+
"input_layernorm.weight": "1ac54bb5ca0b83123b8cffdb4badce519a1ce5ddd669f6243d10f00b493d445d",
|
| 290 |
+
"post_attention_layernorm.weight": "394b5889e1bf81ccb8c96b48f7f760df70a5d0b24835ffa47bdf1e053daeecea"
|
| 291 |
+
},
|
| 292 |
+
"frozen_attention_norm_after_sha256": {
|
| 293 |
+
"self_attn.q_proj.weight": "39f86798d44a14cf29c0724dc84fe0261eb909a05cd405ac91ac7d141f235a4e",
|
| 294 |
+
"self_attn.k_proj.weight": "e23576863e9742419b554ec91e06851542fa31624588dd0b0865c98ca756ef07",
|
| 295 |
+
"self_attn.v_proj.weight": "32df6f78cdcbd2eb1155384475ea6ded1079aee19486bca7713627278410d373",
|
| 296 |
+
"self_attn.o_proj.weight": "607f1bd80abb8a599c6b66c669658355b73eb737edc5366d0e1afc494609943f",
|
| 297 |
+
"self_attn.q_norm.weight": "a24069bc529bcd467f912646b8707018d31f4a0446da073b1b205c4db50ee145",
|
| 298 |
+
"self_attn.k_norm.weight": "9dab9cd5fae1f8d67c448cfcf98e579cbcfc38d8c416771282eb1fe691b20022",
|
| 299 |
+
"input_layernorm.weight": "1ac54bb5ca0b83123b8cffdb4badce519a1ce5ddd669f6243d10f00b493d445d",
|
| 300 |
+
"post_attention_layernorm.weight": "394b5889e1bf81ccb8c96b48f7f760df70a5d0b24835ffa47bdf1e053daeecea"
|
| 301 |
+
},
|
| 302 |
+
"frozen_attention_norm_unchanged": true,
|
| 303 |
+
"source_feature_transport": false,
|
| 304 |
+
"initializer": "come",
|
| 305 |
+
"removed_count_per_cycle": 1,
|
| 306 |
+
"teacher_boundary_current_layer": 24,
|
| 307 |
+
"teacher_boundary_original_layer": 26
|
| 308 |
+
}
|
| 309 |
+
}
|
runs/vast-paper_revision-come-attn-fit-20261126-62646539/20261126-qwen3-base-mka-come-mlp-fit/catalog/results/come/audit/cycle_07_fit.json
ADDED
|
@@ -0,0 +1,308 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"enabled": true,
|
| 3 |
+
"epochs": 1.0,
|
| 4 |
+
"requested_epochs": 1.0,
|
| 5 |
+
"skip_train": false,
|
| 6 |
+
"trained": true,
|
| 7 |
+
"lr": 0.0001,
|
| 8 |
+
"hidden_mse_weight": 1.0,
|
| 9 |
+
"attn_mse_weight": 0.0,
|
| 10 |
+
"mlp_mse_weight": 1.0,
|
| 11 |
+
"eta": 0.0,
|
| 12 |
+
"gamma": 0.0,
|
| 13 |
+
"attn_reg_scale": 1.0,
|
| 14 |
+
"mlp_reg_scale": 1.0,
|
| 15 |
+
"param_subset": "mlp",
|
| 16 |
+
"train_subset": "mlp",
|
| 17 |
+
"num_gates": 3,
|
| 18 |
+
"num_attn_gates": 0,
|
| 19 |
+
"num_mlp_gates": 3,
|
| 20 |
+
"num_other_gates": 0,
|
| 21 |
+
"num_trainable_attn_gates": 0,
|
| 22 |
+
"num_trainable_mlp_gates": 3,
|
| 23 |
+
"num_trainable_other_gates": 0,
|
| 24 |
+
"lambda_init_summary": {
|
| 25 |
+
"num_tensors": 3,
|
| 26 |
+
"num_elements": 3,
|
| 27 |
+
"mean": 0.9998999834060669,
|
| 28 |
+
"std": 0.0,
|
| 29 |
+
"min": 0.9998999834060669,
|
| 30 |
+
"max": 0.9998999834060669,
|
| 31 |
+
"mean_abs_from_0_5": 0.4998999834060669,
|
| 32 |
+
"per_tensor": {
|
| 33 |
+
"mlp.gate_proj.weight": {
|
| 34 |
+
"mean": 0.9998999834060669,
|
| 35 |
+
"std": 0.0,
|
| 36 |
+
"min": 0.9998999834060669,
|
| 37 |
+
"max": 0.9998999834060669,
|
| 38 |
+
"mean_abs_from_0_5": 0.4998999834060669
|
| 39 |
+
},
|
| 40 |
+
"mlp.up_proj.weight": {
|
| 41 |
+
"mean": 0.9998999834060669,
|
| 42 |
+
"std": 0.0,
|
| 43 |
+
"min": 0.9998999834060669,
|
| 44 |
+
"max": 0.9998999834060669,
|
| 45 |
+
"mean_abs_from_0_5": 0.4998999834060669
|
| 46 |
+
},
|
| 47 |
+
"mlp.down_proj.weight": {
|
| 48 |
+
"mean": 0.9998999834060669,
|
| 49 |
+
"std": 0.0,
|
| 50 |
+
"min": 0.9998999834060669,
|
| 51 |
+
"max": 0.9998999834060669,
|
| 52 |
+
"mean_abs_from_0_5": 0.4998999834060669
|
| 53 |
+
}
|
| 54 |
+
}
|
| 55 |
+
},
|
| 56 |
+
"lambda_final_summary": {
|
| 57 |
+
"num_tensors": 3,
|
| 58 |
+
"num_elements": 3,
|
| 59 |
+
"mean": 1.0,
|
| 60 |
+
"std": 0.0,
|
| 61 |
+
"min": 1.0,
|
| 62 |
+
"max": 1.0,
|
| 63 |
+
"mean_abs_from_0_5": 0.5,
|
| 64 |
+
"per_tensor": {
|
| 65 |
+
"mlp.gate_proj.weight": {
|
| 66 |
+
"mean": 1.0,
|
| 67 |
+
"std": 0.0,
|
| 68 |
+
"min": 1.0,
|
| 69 |
+
"max": 1.0,
|
| 70 |
+
"mean_abs_from_0_5": 0.5
|
| 71 |
+
},
|
| 72 |
+
"mlp.up_proj.weight": {
|
| 73 |
+
"mean": 1.0,
|
| 74 |
+
"std": 0.0,
|
| 75 |
+
"min": 1.0,
|
| 76 |
+
"max": 1.0,
|
| 77 |
+
"mean_abs_from_0_5": 0.5
|
| 78 |
+
},
|
| 79 |
+
"mlp.down_proj.weight": {
|
| 80 |
+
"mean": 1.0,
|
| 81 |
+
"std": 0.0,
|
| 82 |
+
"min": 1.0,
|
| 83 |
+
"max": 1.0,
|
| 84 |
+
"mean_abs_from_0_5": 0.5
|
| 85 |
+
}
|
| 86 |
+
}
|
| 87 |
+
},
|
| 88 |
+
"lambda_delta_from_init": {
|
| 89 |
+
"num_tensors": 3,
|
| 90 |
+
"num_elements": 3,
|
| 91 |
+
"mean_abs": 0.0,
|
| 92 |
+
"rms": 0.0,
|
| 93 |
+
"max_abs": 0.0,
|
| 94 |
+
"per_tensor": {
|
| 95 |
+
"mlp.gate_proj.weight": {
|
| 96 |
+
"mean_abs": 0.0,
|
| 97 |
+
"rms": 0.0,
|
| 98 |
+
"max_abs": 0.0
|
| 99 |
+
},
|
| 100 |
+
"mlp.up_proj.weight": {
|
| 101 |
+
"mean_abs": 0.0,
|
| 102 |
+
"rms": 0.0,
|
| 103 |
+
"max_abs": 0.0
|
| 104 |
+
},
|
| 105 |
+
"mlp.down_proj.weight": {
|
| 106 |
+
"mean_abs": 0.0,
|
| 107 |
+
"rms": 0.0,
|
| 108 |
+
"max_abs": 0.0
|
| 109 |
+
}
|
| 110 |
+
}
|
| 111 |
+
},
|
| 112 |
+
"first_grad_summary": {
|
| 113 |
+
"joint": {
|
| 114 |
+
"step": 1,
|
| 115 |
+
"phase": "joint",
|
| 116 |
+
"gate": {
|
| 117 |
+
"num_tensors": 3,
|
| 118 |
+
"num_tensors_without_grad": 3,
|
| 119 |
+
"num_elements": 0,
|
| 120 |
+
"l2": 0.0,
|
| 121 |
+
"mean_abs": null,
|
| 122 |
+
"max_abs": 0.0
|
| 123 |
+
},
|
| 124 |
+
"u": {
|
| 125 |
+
"num_tensors": 3,
|
| 126 |
+
"num_tensors_without_grad": 0,
|
| 127 |
+
"num_elements": 150994944,
|
| 128 |
+
"l2": 0.23740315356757863,
|
| 129 |
+
"mean_abs": 5.882513101419641e-06,
|
| 130 |
+
"max_abs": 0.027914047241210938
|
| 131 |
+
},
|
| 132 |
+
"rho": {
|
| 133 |
+
"num_tensors": 0,
|
| 134 |
+
"num_tensors_without_grad": 0,
|
| 135 |
+
"num_elements": 0,
|
| 136 |
+
"l2": 0.0,
|
| 137 |
+
"mean_abs": null,
|
| 138 |
+
"max_abs": 0.0
|
| 139 |
+
}
|
| 140 |
+
}
|
| 141 |
+
},
|
| 142 |
+
"u_delta_summary": {
|
| 143 |
+
"num_tensors": 3,
|
| 144 |
+
"num_elements": 150994944,
|
| 145 |
+
"mean": 1.3507076851561174e-06,
|
| 146 |
+
"std": 0.003134056113070226,
|
| 147 |
+
"rms": 0.0031340564041325266,
|
| 148 |
+
"mean_abs": 0.002464224429180225,
|
| 149 |
+
"min": -0.029158497229218483,
|
| 150 |
+
"max": 0.030568668618798256,
|
| 151 |
+
"per_tensor": {
|
| 152 |
+
"mlp.gate_proj.weight": {
|
| 153 |
+
"mean": 4.040793404177141e-06,
|
| 154 |
+
"std": 0.0028221248657079863,
|
| 155 |
+
"rms": 0.0028221277585642104,
|
| 156 |
+
"mean_abs": 0.002228420072545608,
|
| 157 |
+
"min": -0.029158497229218483,
|
| 158 |
+
"max": 0.030568668618798256
|
| 159 |
+
},
|
| 160 |
+
"mlp.up_proj.weight": {
|
| 161 |
+
"mean": -6.914443323087956e-07,
|
| 162 |
+
"std": 0.003002453443705404,
|
| 163 |
+
"rms": 0.003002453523322835,
|
| 164 |
+
"mean_abs": 0.002365610251824061,
|
| 165 |
+
"min": -0.025998085737228394,
|
| 166 |
+
"max": 0.022817036136984825
|
| 167 |
+
},
|
| 168 |
+
"mlp.down_proj.weight": {
|
| 169 |
+
"mean": 7.027739836000061e-07,
|
| 170 |
+
"std": 0.003533807563180072,
|
| 171 |
+
"rms": 0.003533807633060967,
|
| 172 |
+
"mean_abs": 0.0027986429631710052,
|
| 173 |
+
"min": -0.02480441704392433,
|
| 174 |
+
"max": 0.022958504036068916
|
| 175 |
+
}
|
| 176 |
+
}
|
| 177 |
+
},
|
| 178 |
+
"rho_objective": "none",
|
| 179 |
+
"rho_schedule": "joint",
|
| 180 |
+
"additive_u": true,
|
| 181 |
+
"rho_epochs": 0.0,
|
| 182 |
+
"rho_lr": null,
|
| 183 |
+
"rho_bounds": null,
|
| 184 |
+
"rho_after_phase": null,
|
| 185 |
+
"rho_final": {},
|
| 186 |
+
"u_fisher_orthogonality": {},
|
| 187 |
+
"runtime": {
|
| 188 |
+
"seconds": 277.19303956301883,
|
| 189 |
+
"dataset_tokens": 524288,
|
| 190 |
+
"tokens_per_second": 1891.418344510072,
|
| 191 |
+
"batch_size": 1,
|
| 192 |
+
"batches_per_epoch": 512,
|
| 193 |
+
"grad_accumulation": 1,
|
| 194 |
+
"peak_allocated_bytes": 35199262720,
|
| 195 |
+
"peak_reserved_bytes": 46567260160,
|
| 196 |
+
"gpu_total_bytes": 85094825984,
|
| 197 |
+
"actual_forward_shapes": {
|
| 198 |
+
"teacher:1x1024": 512,
|
| 199 |
+
"student:1x1024": 512
|
| 200 |
+
}
|
| 201 |
+
},
|
| 202 |
+
"ablation": {
|
| 203 |
+
"lambda": null,
|
| 204 |
+
"endpoint_clamping": false,
|
| 205 |
+
"initial_u_nonzero": 0,
|
| 206 |
+
"merged_parameters": [
|
| 207 |
+
"mlp.gate_proj.weight",
|
| 208 |
+
"mlp.up_proj.weight",
|
| 209 |
+
"mlp.down_proj.weight"
|
| 210 |
+
],
|
| 211 |
+
"parameterization": "W_initial + U_add",
|
| 212 |
+
"fisher_computed": false,
|
| 213 |
+
"fit_scope": "mlp",
|
| 214 |
+
"attention_initialization": "CoMe_channel_merge",
|
| 215 |
+
"norm_initialization": "CoMe_pair_mean",
|
| 216 |
+
"CoMe": {
|
| 217 |
+
"source_lineage": [
|
| 218 |
+
[
|
| 219 |
+
20
|
| 220 |
+
],
|
| 221 |
+
[
|
| 222 |
+
21
|
| 223 |
+
]
|
| 224 |
+
],
|
| 225 |
+
"retention_ratios": [
|
| 226 |
+
0.47186972247563475,
|
| 227 |
+
0.5281302775243653
|
| 228 |
+
],
|
| 229 |
+
"retained_attention_groups": [
|
| 230 |
+
3,
|
| 231 |
+
5
|
| 232 |
+
],
|
| 233 |
+
"retained_mlp_neurons": [
|
| 234 |
+
5798,
|
| 235 |
+
6490
|
| 236 |
+
],
|
| 237 |
+
"pair_score": 0.1278106997859605,
|
| 238 |
+
"minimum_retention": 0.0,
|
| 239 |
+
"adjusted_minimum": 0.0,
|
| 240 |
+
"power": 1.0,
|
| 241 |
+
"allow_repeat": true,
|
| 242 |
+
"sbi_metric": "angular_last",
|
| 243 |
+
"calibration_padding": "trim_right_padding_before_native_CoMe_scoring",
|
| 244 |
+
"teacher_mutated_during_initialization": false
|
| 245 |
+
},
|
| 246 |
+
"norms_trainable": false,
|
| 247 |
+
"attention_norm_initialization": "CoMe_retention_weighted_QK",
|
| 248 |
+
"initialized_parameters": [
|
| 249 |
+
"self_attn.q_proj.weight",
|
| 250 |
+
"self_attn.k_proj.weight",
|
| 251 |
+
"self_attn.v_proj.weight",
|
| 252 |
+
"self_attn.o_proj.weight",
|
| 253 |
+
"self_attn.q_norm.weight",
|
| 254 |
+
"self_attn.k_norm.weight",
|
| 255 |
+
"mlp.gate_proj.weight",
|
| 256 |
+
"mlp.up_proj.weight",
|
| 257 |
+
"mlp.down_proj.weight",
|
| 258 |
+
"input_layernorm.weight",
|
| 259 |
+
"post_attention_layernorm.weight"
|
| 260 |
+
],
|
| 261 |
+
"frozen_CoMe_parameters": [
|
| 262 |
+
"self_attn.q_proj.weight",
|
| 263 |
+
"self_attn.k_proj.weight",
|
| 264 |
+
"self_attn.v_proj.weight",
|
| 265 |
+
"self_attn.o_proj.weight",
|
| 266 |
+
"self_attn.q_norm.weight",
|
| 267 |
+
"self_attn.k_norm.weight",
|
| 268 |
+
"input_layernorm.weight",
|
| 269 |
+
"post_attention_layernorm.weight"
|
| 270 |
+
],
|
| 271 |
+
"frozen_attention_norm_expected_sha256": {
|
| 272 |
+
"self_attn.q_proj.weight": "100c474fa668596c16128a59e841aa485f057f3767c68833a4766a06e067a114",
|
| 273 |
+
"self_attn.k_proj.weight": "df3000d47df027011761b871c1d47491a2f13c4dd3363175be9e93970d1f9be5",
|
| 274 |
+
"self_attn.v_proj.weight": "bb7a683a3151ecc3ca6739b59f54dfcbdc6d328334af50213c274a5c4226ba18",
|
| 275 |
+
"self_attn.o_proj.weight": "663b0ca3ae6bbbb3c613ee1f9af319eec3b35f0dbc01efc7b6d774625a8db0e8",
|
| 276 |
+
"self_attn.q_norm.weight": "5aee4fb2de6a7f64cd3162db26cc0a06e004f6e91f8d1bfb0bb33a18e3c72eec",
|
| 277 |
+
"self_attn.k_norm.weight": "c27266ee8a88066155b72fae60bf106ecbce5880cc8a3d37dfce5e7a6b671567",
|
| 278 |
+
"input_layernorm.weight": "34a032c26054d427bf876a4574e76d16fe6275d6f951c1ff686f89def2c68581",
|
| 279 |
+
"post_attention_layernorm.weight": "2331ab53730e845fdf782fc2d6aab39a66b8e7bb31afed5212594790002946a0"
|
| 280 |
+
},
|
| 281 |
+
"frozen_attention_norm_before_sha256": {
|
| 282 |
+
"self_attn.q_proj.weight": "100c474fa668596c16128a59e841aa485f057f3767c68833a4766a06e067a114",
|
| 283 |
+
"self_attn.k_proj.weight": "df3000d47df027011761b871c1d47491a2f13c4dd3363175be9e93970d1f9be5",
|
| 284 |
+
"self_attn.v_proj.weight": "bb7a683a3151ecc3ca6739b59f54dfcbdc6d328334af50213c274a5c4226ba18",
|
| 285 |
+
"self_attn.o_proj.weight": "663b0ca3ae6bbbb3c613ee1f9af319eec3b35f0dbc01efc7b6d774625a8db0e8",
|
| 286 |
+
"self_attn.q_norm.weight": "5aee4fb2de6a7f64cd3162db26cc0a06e004f6e91f8d1bfb0bb33a18e3c72eec",
|
| 287 |
+
"self_attn.k_norm.weight": "c27266ee8a88066155b72fae60bf106ecbce5880cc8a3d37dfce5e7a6b671567",
|
| 288 |
+
"input_layernorm.weight": "34a032c26054d427bf876a4574e76d16fe6275d6f951c1ff686f89def2c68581",
|
| 289 |
+
"post_attention_layernorm.weight": "2331ab53730e845fdf782fc2d6aab39a66b8e7bb31afed5212594790002946a0"
|
| 290 |
+
},
|
| 291 |
+
"frozen_attention_norm_after_sha256": {
|
| 292 |
+
"self_attn.q_proj.weight": "100c474fa668596c16128a59e841aa485f057f3767c68833a4766a06e067a114",
|
| 293 |
+
"self_attn.k_proj.weight": "df3000d47df027011761b871c1d47491a2f13c4dd3363175be9e93970d1f9be5",
|
| 294 |
+
"self_attn.v_proj.weight": "bb7a683a3151ecc3ca6739b59f54dfcbdc6d328334af50213c274a5c4226ba18",
|
| 295 |
+
"self_attn.o_proj.weight": "663b0ca3ae6bbbb3c613ee1f9af319eec3b35f0dbc01efc7b6d774625a8db0e8",
|
| 296 |
+
"self_attn.q_norm.weight": "5aee4fb2de6a7f64cd3162db26cc0a06e004f6e91f8d1bfb0bb33a18e3c72eec",
|
| 297 |
+
"self_attn.k_norm.weight": "c27266ee8a88066155b72fae60bf106ecbce5880cc8a3d37dfce5e7a6b671567",
|
| 298 |
+
"input_layernorm.weight": "34a032c26054d427bf876a4574e76d16fe6275d6f951c1ff686f89def2c68581",
|
| 299 |
+
"post_attention_layernorm.weight": "2331ab53730e845fdf782fc2d6aab39a66b8e7bb31afed5212594790002946a0"
|
| 300 |
+
},
|
| 301 |
+
"frozen_attention_norm_unchanged": true,
|
| 302 |
+
"source_feature_transport": false,
|
| 303 |
+
"initializer": "come",
|
| 304 |
+
"removed_count_per_cycle": 1,
|
| 305 |
+
"teacher_boundary_current_layer": 19,
|
| 306 |
+
"teacher_boundary_original_layer": 21
|
| 307 |
+
}
|
| 308 |
+
}
|
runs/vast-paper_revision-come-attn-fit-20261126-62646539/20261126-qwen3-base-mka-come-mlp-fit/catalog/results/come/audit/cycle_08_fit.json
ADDED
|
@@ -0,0 +1,309 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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|
+
"mlp_reg_scale": 1.0,
|
| 15 |
+
"param_subset": "mlp",
|
| 16 |
+
"train_subset": "mlp",
|
| 17 |
+
"num_gates": 3,
|
| 18 |
+
"num_attn_gates": 0,
|
| 19 |
+
"num_mlp_gates": 3,
|
| 20 |
+
"num_other_gates": 0,
|
| 21 |
+
"num_trainable_attn_gates": 0,
|
| 22 |
+
"num_trainable_mlp_gates": 3,
|
| 23 |
+
"num_trainable_other_gates": 0,
|
| 24 |
+
"lambda_init_summary": {
|
| 25 |
+
"num_tensors": 3,
|
| 26 |
+
"num_elements": 3,
|
| 27 |
+
"mean": 0.9998999834060669,
|
| 28 |
+
"std": 0.0,
|
| 29 |
+
"min": 0.9998999834060669,
|
| 30 |
+
"max": 0.9998999834060669,
|
| 31 |
+
"mean_abs_from_0_5": 0.4998999834060669,
|
| 32 |
+
"per_tensor": {
|
| 33 |
+
"mlp.gate_proj.weight": {
|
| 34 |
+
"mean": 0.9998999834060669,
|
| 35 |
+
"std": 0.0,
|
| 36 |
+
"min": 0.9998999834060669,
|
| 37 |
+
"max": 0.9998999834060669,
|
| 38 |
+
"mean_abs_from_0_5": 0.4998999834060669
|
| 39 |
+
},
|
| 40 |
+
"mlp.up_proj.weight": {
|
| 41 |
+
"mean": 0.9998999834060669,
|
| 42 |
+
"std": 0.0,
|
| 43 |
+
"min": 0.9998999834060669,
|
| 44 |
+
"max": 0.9998999834060669,
|
| 45 |
+
"mean_abs_from_0_5": 0.4998999834060669
|
| 46 |
+
},
|
| 47 |
+
"mlp.down_proj.weight": {
|
| 48 |
+
"mean": 0.9998999834060669,
|
| 49 |
+
"std": 0.0,
|
| 50 |
+
"min": 0.9998999834060669,
|
| 51 |
+
"max": 0.9998999834060669,
|
| 52 |
+
"mean_abs_from_0_5": 0.4998999834060669
|
| 53 |
+
}
|
| 54 |
+
}
|
| 55 |
+
},
|
| 56 |
+
"lambda_final_summary": {
|
| 57 |
+
"num_tensors": 3,
|
| 58 |
+
"num_elements": 3,
|
| 59 |
+
"mean": 1.0,
|
| 60 |
+
"std": 0.0,
|
| 61 |
+
"min": 1.0,
|
| 62 |
+
"max": 1.0,
|
| 63 |
+
"mean_abs_from_0_5": 0.5,
|
| 64 |
+
"per_tensor": {
|
| 65 |
+
"mlp.gate_proj.weight": {
|
| 66 |
+
"mean": 1.0,
|
| 67 |
+
"std": 0.0,
|
| 68 |
+
"min": 1.0,
|
| 69 |
+
"max": 1.0,
|
| 70 |
+
"mean_abs_from_0_5": 0.5
|
| 71 |
+
},
|
| 72 |
+
"mlp.up_proj.weight": {
|
| 73 |
+
"mean": 1.0,
|
| 74 |
+
"std": 0.0,
|
| 75 |
+
"min": 1.0,
|
| 76 |
+
"max": 1.0,
|
| 77 |
+
"mean_abs_from_0_5": 0.5
|
| 78 |
+
},
|
| 79 |
+
"mlp.down_proj.weight": {
|
| 80 |
+
"mean": 1.0,
|
| 81 |
+
"std": 0.0,
|
| 82 |
+
"min": 1.0,
|
| 83 |
+
"max": 1.0,
|
| 84 |
+
"mean_abs_from_0_5": 0.5
|
| 85 |
+
}
|
| 86 |
+
}
|
| 87 |
+
},
|
| 88 |
+
"lambda_delta_from_init": {
|
| 89 |
+
"num_tensors": 3,
|
| 90 |
+
"num_elements": 3,
|
| 91 |
+
"mean_abs": 0.0,
|
| 92 |
+
"rms": 0.0,
|
| 93 |
+
"max_abs": 0.0,
|
| 94 |
+
"per_tensor": {
|
| 95 |
+
"mlp.gate_proj.weight": {
|
| 96 |
+
"mean_abs": 0.0,
|
| 97 |
+
"rms": 0.0,
|
| 98 |
+
"max_abs": 0.0
|
| 99 |
+
},
|
| 100 |
+
"mlp.up_proj.weight": {
|
| 101 |
+
"mean_abs": 0.0,
|
| 102 |
+
"rms": 0.0,
|
| 103 |
+
"max_abs": 0.0
|
| 104 |
+
},
|
| 105 |
+
"mlp.down_proj.weight": {
|
| 106 |
+
"mean_abs": 0.0,
|
| 107 |
+
"rms": 0.0,
|
| 108 |
+
"max_abs": 0.0
|
| 109 |
+
}
|
| 110 |
+
}
|
| 111 |
+
},
|
| 112 |
+
"first_grad_summary": {
|
| 113 |
+
"joint": {
|
| 114 |
+
"step": 1,
|
| 115 |
+
"phase": "joint",
|
| 116 |
+
"gate": {
|
| 117 |
+
"num_tensors": 3,
|
| 118 |
+
"num_tensors_without_grad": 3,
|
| 119 |
+
"num_elements": 0,
|
| 120 |
+
"l2": 0.0,
|
| 121 |
+
"mean_abs": null,
|
| 122 |
+
"max_abs": 0.0
|
| 123 |
+
},
|
| 124 |
+
"u": {
|
| 125 |
+
"num_tensors": 3,
|
| 126 |
+
"num_tensors_without_grad": 0,
|
| 127 |
+
"num_elements": 150994944,
|
| 128 |
+
"l2": 6.49169853930633,
|
| 129 |
+
"mean_abs": 9.474362013861537e-05,
|
| 130 |
+
"max_abs": 1.5315284729003906
|
| 131 |
+
},
|
| 132 |
+
"rho": {
|
| 133 |
+
"num_tensors": 0,
|
| 134 |
+
"num_tensors_without_grad": 0,
|
| 135 |
+
"num_elements": 0,
|
| 136 |
+
"l2": 0.0,
|
| 137 |
+
"mean_abs": null,
|
| 138 |
+
"max_abs": 0.0
|
| 139 |
+
}
|
| 140 |
+
}
|
| 141 |
+
},
|
| 142 |
+
"u_delta_summary": {
|
| 143 |
+
"num_tensors": 3,
|
| 144 |
+
"num_elements": 150994944,
|
| 145 |
+
"mean": 4.591499305206526e-06,
|
| 146 |
+
"std": 0.0027378081098337064,
|
| 147 |
+
"rms": 0.002737811959966769,
|
| 148 |
+
"mean_abs": 0.0021497576704455745,
|
| 149 |
+
"min": -0.032534871250391006,
|
| 150 |
+
"max": 0.03337450698018074,
|
| 151 |
+
"per_tensor": {
|
| 152 |
+
"mlp.gate_proj.weight": {
|
| 153 |
+
"mean": 1.311179221374914e-05,
|
| 154 |
+
"std": 0.0026171782407182786,
|
| 155 |
+
"rms": 0.0026172110848734155,
|
| 156 |
+
"mean_abs": 0.002076787098000447,
|
| 157 |
+
"min": -0.022585367783904076,
|
| 158 |
+
"max": 0.024974439293146133
|
| 159 |
+
},
|
| 160 |
+
"mlp.up_proj.weight": {
|
| 161 |
+
"mean": 6.339674503882028e-07,
|
| 162 |
+
"std": 0.002621912470452202,
|
| 163 |
+
"rms": 0.0026219125470975375,
|
| 164 |
+
"mean_abs": 0.0020654979161918163,
|
| 165 |
+
"min": -0.01963549107313156,
|
| 166 |
+
"max": 0.021688615903258324
|
| 167 |
+
},
|
| 168 |
+
"mlp.down_proj.weight": {
|
| 169 |
+
"mean": 2.873825148223356e-08,
|
| 170 |
+
"std": 0.002960172919978422,
|
| 171 |
+
"rms": 0.002960172920117922,
|
| 172 |
+
"mean_abs": 0.0023069879971444607,
|
| 173 |
+
"min": -0.032534871250391006,
|
| 174 |
+
"max": 0.03337450698018074
|
| 175 |
+
}
|
| 176 |
+
}
|
| 177 |
+
},
|
| 178 |
+
"rho_objective": "none",
|
| 179 |
+
"rho_schedule": "joint",
|
| 180 |
+
"additive_u": true,
|
| 181 |
+
"rho_epochs": 0.0,
|
| 182 |
+
"rho_lr": null,
|
| 183 |
+
"rho_bounds": null,
|
| 184 |
+
"rho_after_phase": null,
|
| 185 |
+
"rho_final": {},
|
| 186 |
+
"u_fisher_orthogonality": {},
|
| 187 |
+
"runtime": {
|
| 188 |
+
"seconds": 267.72440619114786,
|
| 189 |
+
"dataset_tokens": 524288,
|
| 190 |
+
"tokens_per_second": 1958.3123087615434,
|
| 191 |
+
"batch_size": 1,
|
| 192 |
+
"batches_per_epoch": 512,
|
| 193 |
+
"grad_accumulation": 1,
|
| 194 |
+
"peak_allocated_bytes": 33519681536,
|
| 195 |
+
"peak_reserved_bytes": 45397049344,
|
| 196 |
+
"gpu_total_bytes": 85094825984,
|
| 197 |
+
"actual_forward_shapes": {
|
| 198 |
+
"teacher:1x1024": 512,
|
| 199 |
+
"student:1x1024": 512
|
| 200 |
+
}
|
| 201 |
+
},
|
| 202 |
+
"ablation": {
|
| 203 |
+
"lambda": null,
|
| 204 |
+
"endpoint_clamping": false,
|
| 205 |
+
"initial_u_nonzero": 0,
|
| 206 |
+
"merged_parameters": [
|
| 207 |
+
"mlp.gate_proj.weight",
|
| 208 |
+
"mlp.up_proj.weight",
|
| 209 |
+
"mlp.down_proj.weight"
|
| 210 |
+
],
|
| 211 |
+
"parameterization": "W_initial + U_add",
|
| 212 |
+
"fisher_computed": false,
|
| 213 |
+
"fit_scope": "mlp",
|
| 214 |
+
"attention_initialization": "CoMe_channel_merge",
|
| 215 |
+
"norm_initialization": "CoMe_pair_mean",
|
| 216 |
+
"CoMe": {
|
| 217 |
+
"source_lineage": [
|
| 218 |
+
[
|
| 219 |
+
28
|
| 220 |
+
],
|
| 221 |
+
[
|
| 222 |
+
29,
|
| 223 |
+
30
|
| 224 |
+
]
|
| 225 |
+
],
|
| 226 |
+
"retention_ratios": [
|
| 227 |
+
0.46346630280250284,
|
| 228 |
+
0.5365336971974971
|
| 229 |
+
],
|
| 230 |
+
"retained_attention_groups": [
|
| 231 |
+
3,
|
| 232 |
+
5
|
| 233 |
+
],
|
| 234 |
+
"retained_mlp_neurons": [
|
| 235 |
+
5695,
|
| 236 |
+
6593
|
| 237 |
+
],
|
| 238 |
+
"pair_score": 0.13028502202731498,
|
| 239 |
+
"minimum_retention": 0.0,
|
| 240 |
+
"adjusted_minimum": 0.0,
|
| 241 |
+
"power": 1.0,
|
| 242 |
+
"allow_repeat": true,
|
| 243 |
+
"sbi_metric": "angular_last",
|
| 244 |
+
"calibration_padding": "trim_right_padding_before_native_CoMe_scoring",
|
| 245 |
+
"teacher_mutated_during_initialization": false
|
| 246 |
+
},
|
| 247 |
+
"norms_trainable": false,
|
| 248 |
+
"attention_norm_initialization": "CoMe_retention_weighted_QK",
|
| 249 |
+
"initialized_parameters": [
|
| 250 |
+
"self_attn.q_proj.weight",
|
| 251 |
+
"self_attn.k_proj.weight",
|
| 252 |
+
"self_attn.v_proj.weight",
|
| 253 |
+
"self_attn.o_proj.weight",
|
| 254 |
+
"self_attn.q_norm.weight",
|
| 255 |
+
"self_attn.k_norm.weight",
|
| 256 |
+
"mlp.gate_proj.weight",
|
| 257 |
+
"mlp.up_proj.weight",
|
| 258 |
+
"mlp.down_proj.weight",
|
| 259 |
+
"input_layernorm.weight",
|
| 260 |
+
"post_attention_layernorm.weight"
|
| 261 |
+
],
|
| 262 |
+
"frozen_CoMe_parameters": [
|
| 263 |
+
"self_attn.q_proj.weight",
|
| 264 |
+
"self_attn.k_proj.weight",
|
| 265 |
+
"self_attn.v_proj.weight",
|
| 266 |
+
"self_attn.o_proj.weight",
|
| 267 |
+
"self_attn.q_norm.weight",
|
| 268 |
+
"self_attn.k_norm.weight",
|
| 269 |
+
"input_layernorm.weight",
|
| 270 |
+
"post_attention_layernorm.weight"
|
| 271 |
+
],
|
| 272 |
+
"frozen_attention_norm_expected_sha256": {
|
| 273 |
+
"self_attn.q_proj.weight": "36252b41be52e81d520f07dfc5c92c7933266cc8b572ca413af64b3d6d715629",
|
| 274 |
+
"self_attn.k_proj.weight": "da2a0f50a824c4ed95a852d28a0729890e6df83eeea7dcaed1383ee0a17c41c7",
|
| 275 |
+
"self_attn.v_proj.weight": "a097c0995b19020bc7d3bf86b42791bb50e8b0a0965f1c9d575fca0804816eec",
|
| 276 |
+
"self_attn.o_proj.weight": "2fd02a6653ed46d24683bacdf5074072c9e4564bc9e10224082af2787419a7e5",
|
| 277 |
+
"self_attn.q_norm.weight": "984494fcfbe0781014b23dc6f76c39fcc7a024d5474c3e993da11f808c4c6e5b",
|
| 278 |
+
"self_attn.k_norm.weight": "6a7a2aa47fc5932c85a04ec3f8126eec8459cbe3dda0f027ea100b437d4e5af7",
|
| 279 |
+
"input_layernorm.weight": "bef856a0d4f111bad8496c0bed2bfb65efbef1580f074bc4d9929d8185e8e9b7",
|
| 280 |
+
"post_attention_layernorm.weight": "4e0f51ab4f79e73bd1ca169a404e5308778535c28228aedb026fef9993e650c3"
|
| 281 |
+
},
|
| 282 |
+
"frozen_attention_norm_before_sha256": {
|
| 283 |
+
"self_attn.q_proj.weight": "36252b41be52e81d520f07dfc5c92c7933266cc8b572ca413af64b3d6d715629",
|
| 284 |
+
"self_attn.k_proj.weight": "da2a0f50a824c4ed95a852d28a0729890e6df83eeea7dcaed1383ee0a17c41c7",
|
| 285 |
+
"self_attn.v_proj.weight": "a097c0995b19020bc7d3bf86b42791bb50e8b0a0965f1c9d575fca0804816eec",
|
| 286 |
+
"self_attn.o_proj.weight": "2fd02a6653ed46d24683bacdf5074072c9e4564bc9e10224082af2787419a7e5",
|
| 287 |
+
"self_attn.q_norm.weight": "984494fcfbe0781014b23dc6f76c39fcc7a024d5474c3e993da11f808c4c6e5b",
|
| 288 |
+
"self_attn.k_norm.weight": "6a7a2aa47fc5932c85a04ec3f8126eec8459cbe3dda0f027ea100b437d4e5af7",
|
| 289 |
+
"input_layernorm.weight": "bef856a0d4f111bad8496c0bed2bfb65efbef1580f074bc4d9929d8185e8e9b7",
|
| 290 |
+
"post_attention_layernorm.weight": "4e0f51ab4f79e73bd1ca169a404e5308778535c28228aedb026fef9993e650c3"
|
| 291 |
+
},
|
| 292 |
+
"frozen_attention_norm_after_sha256": {
|
| 293 |
+
"self_attn.q_proj.weight": "36252b41be52e81d520f07dfc5c92c7933266cc8b572ca413af64b3d6d715629",
|
| 294 |
+
"self_attn.k_proj.weight": "da2a0f50a824c4ed95a852d28a0729890e6df83eeea7dcaed1383ee0a17c41c7",
|
| 295 |
+
"self_attn.v_proj.weight": "a097c0995b19020bc7d3bf86b42791bb50e8b0a0965f1c9d575fca0804816eec",
|
| 296 |
+
"self_attn.o_proj.weight": "2fd02a6653ed46d24683bacdf5074072c9e4564bc9e10224082af2787419a7e5",
|
| 297 |
+
"self_attn.q_norm.weight": "984494fcfbe0781014b23dc6f76c39fcc7a024d5474c3e993da11f808c4c6e5b",
|
| 298 |
+
"self_attn.k_norm.weight": "6a7a2aa47fc5932c85a04ec3f8126eec8459cbe3dda0f027ea100b437d4e5af7",
|
| 299 |
+
"input_layernorm.weight": "bef856a0d4f111bad8496c0bed2bfb65efbef1580f074bc4d9929d8185e8e9b7",
|
| 300 |
+
"post_attention_layernorm.weight": "4e0f51ab4f79e73bd1ca169a404e5308778535c28228aedb026fef9993e650c3"
|
| 301 |
+
},
|
| 302 |
+
"frozen_attention_norm_unchanged": true,
|
| 303 |
+
"source_feature_transport": false,
|
| 304 |
+
"initializer": "come",
|
| 305 |
+
"removed_count_per_cycle": 1,
|
| 306 |
+
"teacher_boundary_current_layer": 24,
|
| 307 |
+
"teacher_boundary_original_layer": 29
|
| 308 |
+
}
|
| 309 |
+
}
|
runs/vast-paper_revision-come-attn-fit-20261126-62646539/20261126-qwen3-base-mka-come-mlp-fit/catalog/results/come/audit/cycle_09_fit.json
ADDED
|
@@ -0,0 +1,308 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"enabled": true,
|
| 3 |
+
"epochs": 1.0,
|
| 4 |
+
"requested_epochs": 1.0,
|
| 5 |
+
"skip_train": false,
|
| 6 |
+
"trained": true,
|
| 7 |
+
"lr": 0.0001,
|
| 8 |
+
"hidden_mse_weight": 1.0,
|
| 9 |
+
"attn_mse_weight": 0.0,
|
| 10 |
+
"mlp_mse_weight": 1.0,
|
| 11 |
+
"eta": 0.0,
|
| 12 |
+
"gamma": 0.0,
|
| 13 |
+
"attn_reg_scale": 1.0,
|
| 14 |
+
"mlp_reg_scale": 1.0,
|
| 15 |
+
"param_subset": "mlp",
|
| 16 |
+
"train_subset": "mlp",
|
| 17 |
+
"num_gates": 3,
|
| 18 |
+
"num_attn_gates": 0,
|
| 19 |
+
"num_mlp_gates": 3,
|
| 20 |
+
"num_other_gates": 0,
|
| 21 |
+
"num_trainable_attn_gates": 0,
|
| 22 |
+
"num_trainable_mlp_gates": 3,
|
| 23 |
+
"num_trainable_other_gates": 0,
|
| 24 |
+
"lambda_init_summary": {
|
| 25 |
+
"num_tensors": 3,
|
| 26 |
+
"num_elements": 3,
|
| 27 |
+
"mean": 0.9998999834060669,
|
| 28 |
+
"std": 0.0,
|
| 29 |
+
"min": 0.9998999834060669,
|
| 30 |
+
"max": 0.9998999834060669,
|
| 31 |
+
"mean_abs_from_0_5": 0.4998999834060669,
|
| 32 |
+
"per_tensor": {
|
| 33 |
+
"mlp.gate_proj.weight": {
|
| 34 |
+
"mean": 0.9998999834060669,
|
| 35 |
+
"std": 0.0,
|
| 36 |
+
"min": 0.9998999834060669,
|
| 37 |
+
"max": 0.9998999834060669,
|
| 38 |
+
"mean_abs_from_0_5": 0.4998999834060669
|
| 39 |
+
},
|
| 40 |
+
"mlp.up_proj.weight": {
|
| 41 |
+
"mean": 0.9998999834060669,
|
| 42 |
+
"std": 0.0,
|
| 43 |
+
"min": 0.9998999834060669,
|
| 44 |
+
"max": 0.9998999834060669,
|
| 45 |
+
"mean_abs_from_0_5": 0.4998999834060669
|
| 46 |
+
},
|
| 47 |
+
"mlp.down_proj.weight": {
|
| 48 |
+
"mean": 0.9998999834060669,
|
| 49 |
+
"std": 0.0,
|
| 50 |
+
"min": 0.9998999834060669,
|
| 51 |
+
"max": 0.9998999834060669,
|
| 52 |
+
"mean_abs_from_0_5": 0.4998999834060669
|
| 53 |
+
}
|
| 54 |
+
}
|
| 55 |
+
},
|
| 56 |
+
"lambda_final_summary": {
|
| 57 |
+
"num_tensors": 3,
|
| 58 |
+
"num_elements": 3,
|
| 59 |
+
"mean": 1.0,
|
| 60 |
+
"std": 0.0,
|
| 61 |
+
"min": 1.0,
|
| 62 |
+
"max": 1.0,
|
| 63 |
+
"mean_abs_from_0_5": 0.5,
|
| 64 |
+
"per_tensor": {
|
| 65 |
+
"mlp.gate_proj.weight": {
|
| 66 |
+
"mean": 1.0,
|
| 67 |
+
"std": 0.0,
|
| 68 |
+
"min": 1.0,
|
| 69 |
+
"max": 1.0,
|
| 70 |
+
"mean_abs_from_0_5": 0.5
|
| 71 |
+
},
|
| 72 |
+
"mlp.up_proj.weight": {
|
| 73 |
+
"mean": 1.0,
|
| 74 |
+
"std": 0.0,
|
| 75 |
+
"min": 1.0,
|
| 76 |
+
"max": 1.0,
|
| 77 |
+
"mean_abs_from_0_5": 0.5
|
| 78 |
+
},
|
| 79 |
+
"mlp.down_proj.weight": {
|
| 80 |
+
"mean": 1.0,
|
| 81 |
+
"std": 0.0,
|
| 82 |
+
"min": 1.0,
|
| 83 |
+
"max": 1.0,
|
| 84 |
+
"mean_abs_from_0_5": 0.5
|
| 85 |
+
}
|
| 86 |
+
}
|
| 87 |
+
},
|
| 88 |
+
"lambda_delta_from_init": {
|
| 89 |
+
"num_tensors": 3,
|
| 90 |
+
"num_elements": 3,
|
| 91 |
+
"mean_abs": 0.0,
|
| 92 |
+
"rms": 0.0,
|
| 93 |
+
"max_abs": 0.0,
|
| 94 |
+
"per_tensor": {
|
| 95 |
+
"mlp.gate_proj.weight": {
|
| 96 |
+
"mean_abs": 0.0,
|
| 97 |
+
"rms": 0.0,
|
| 98 |
+
"max_abs": 0.0
|
| 99 |
+
},
|
| 100 |
+
"mlp.up_proj.weight": {
|
| 101 |
+
"mean_abs": 0.0,
|
| 102 |
+
"rms": 0.0,
|
| 103 |
+
"max_abs": 0.0
|
| 104 |
+
},
|
| 105 |
+
"mlp.down_proj.weight": {
|
| 106 |
+
"mean_abs": 0.0,
|
| 107 |
+
"rms": 0.0,
|
| 108 |
+
"max_abs": 0.0
|
| 109 |
+
}
|
| 110 |
+
}
|
| 111 |
+
},
|
| 112 |
+
"first_grad_summary": {
|
| 113 |
+
"joint": {
|
| 114 |
+
"step": 1,
|
| 115 |
+
"phase": "joint",
|
| 116 |
+
"gate": {
|
| 117 |
+
"num_tensors": 3,
|
| 118 |
+
"num_tensors_without_grad": 3,
|
| 119 |
+
"num_elements": 0,
|
| 120 |
+
"l2": 0.0,
|
| 121 |
+
"mean_abs": null,
|
| 122 |
+
"max_abs": 0.0
|
| 123 |
+
},
|
| 124 |
+
"u": {
|
| 125 |
+
"num_tensors": 3,
|
| 126 |
+
"num_tensors_without_grad": 0,
|
| 127 |
+
"num_elements": 150994944,
|
| 128 |
+
"l2": 0.5486992756018507,
|
| 129 |
+
"mean_abs": 7.279721204314329e-06,
|
| 130 |
+
"max_abs": 0.08547437191009521
|
| 131 |
+
},
|
| 132 |
+
"rho": {
|
| 133 |
+
"num_tensors": 0,
|
| 134 |
+
"num_tensors_without_grad": 0,
|
| 135 |
+
"num_elements": 0,
|
| 136 |
+
"l2": 0.0,
|
| 137 |
+
"mean_abs": null,
|
| 138 |
+
"max_abs": 0.0
|
| 139 |
+
}
|
| 140 |
+
}
|
| 141 |
+
},
|
| 142 |
+
"u_delta_summary": {
|
| 143 |
+
"num_tensors": 3,
|
| 144 |
+
"num_elements": 150994944,
|
| 145 |
+
"mean": -2.401146111373641e-06,
|
| 146 |
+
"std": 0.0028625390829901984,
|
| 147 |
+
"rms": 0.00286254009005097,
|
| 148 |
+
"mean_abs": 0.002229874281005727,
|
| 149 |
+
"min": -0.031118491664528847,
|
| 150 |
+
"max": 0.03590920567512512,
|
| 151 |
+
"per_tensor": {
|
| 152 |
+
"mlp.gate_proj.weight": {
|
| 153 |
+
"mean": -7.017540459249479e-06,
|
| 154 |
+
"std": 0.0026435958450601446,
|
| 155 |
+
"rms": 0.0026436051592273304,
|
| 156 |
+
"mean_abs": 0.0020676087588071823,
|
| 157 |
+
"min": -0.026987718418240547,
|
| 158 |
+
"max": 0.029445279389619827
|
| 159 |
+
},
|
| 160 |
+
"mlp.up_proj.weight": {
|
| 161 |
+
"mean": -3.4636233673760824e-07,
|
| 162 |
+
"std": 0.0026137689593844203,
|
| 163 |
+
"rms": 0.0026137689823334392,
|
| 164 |
+
"mean_abs": 0.0020307997862497964,
|
| 165 |
+
"min": -0.03019127808511257,
|
| 166 |
+
"max": 0.026006054133176804
|
| 167 |
+
},
|
| 168 |
+
"mlp.down_proj.weight": {
|
| 169 |
+
"mean": 1.6046446186616473e-07,
|
| 170 |
+
"std": 0.0032805442756951874,
|
| 171 |
+
"rms": 0.0032805442796196645,
|
| 172 |
+
"mean_abs": 0.0025912142979602018,
|
| 173 |
+
"min": -0.031118491664528847,
|
| 174 |
+
"max": 0.03590920567512512
|
| 175 |
+
}
|
| 176 |
+
}
|
| 177 |
+
},
|
| 178 |
+
"rho_objective": "none",
|
| 179 |
+
"rho_schedule": "joint",
|
| 180 |
+
"additive_u": true,
|
| 181 |
+
"rho_epochs": 0.0,
|
| 182 |
+
"rho_lr": null,
|
| 183 |
+
"rho_bounds": null,
|
| 184 |
+
"rho_after_phase": null,
|
| 185 |
+
"rho_final": {},
|
| 186 |
+
"u_fisher_orthogonality": {},
|
| 187 |
+
"runtime": {
|
| 188 |
+
"seconds": 251.94926179386675,
|
| 189 |
+
"dataset_tokens": 524288,
|
| 190 |
+
"tokens_per_second": 2080.92691467756,
|
| 191 |
+
"batch_size": 1,
|
| 192 |
+
"batches_per_epoch": 512,
|
| 193 |
+
"grad_accumulation": 1,
|
| 194 |
+
"peak_allocated_bytes": 33655689216,
|
| 195 |
+
"peak_reserved_bytes": 44226838528,
|
| 196 |
+
"gpu_total_bytes": 85094825984,
|
| 197 |
+
"actual_forward_shapes": {
|
| 198 |
+
"teacher:1x1024": 512,
|
| 199 |
+
"student:1x1024": 512
|
| 200 |
+
}
|
| 201 |
+
},
|
| 202 |
+
"ablation": {
|
| 203 |
+
"lambda": null,
|
| 204 |
+
"endpoint_clamping": false,
|
| 205 |
+
"initial_u_nonzero": 0,
|
| 206 |
+
"merged_parameters": [
|
| 207 |
+
"mlp.gate_proj.weight",
|
| 208 |
+
"mlp.up_proj.weight",
|
| 209 |
+
"mlp.down_proj.weight"
|
| 210 |
+
],
|
| 211 |
+
"parameterization": "W_initial + U_add",
|
| 212 |
+
"fisher_computed": false,
|
| 213 |
+
"fit_scope": "mlp",
|
| 214 |
+
"attention_initialization": "CoMe_channel_merge",
|
| 215 |
+
"norm_initialization": "CoMe_pair_mean",
|
| 216 |
+
"CoMe": {
|
| 217 |
+
"source_lineage": [
|
| 218 |
+
[
|
| 219 |
+
18
|
| 220 |
+
],
|
| 221 |
+
[
|
| 222 |
+
19
|
| 223 |
+
]
|
| 224 |
+
],
|
| 225 |
+
"retention_ratios": [
|
| 226 |
+
0.43171495242956137,
|
| 227 |
+
0.5682850475704386
|
| 228 |
+
],
|
| 229 |
+
"retained_attention_groups": [
|
| 230 |
+
3,
|
| 231 |
+
5
|
| 232 |
+
],
|
| 233 |
+
"retained_mlp_neurons": [
|
| 234 |
+
5304,
|
| 235 |
+
6984
|
| 236 |
+
],
|
| 237 |
+
"pair_score": 0.13059031313404124,
|
| 238 |
+
"minimum_retention": 0.0,
|
| 239 |
+
"adjusted_minimum": 0.0,
|
| 240 |
+
"power": 1.0,
|
| 241 |
+
"allow_repeat": true,
|
| 242 |
+
"sbi_metric": "angular_last",
|
| 243 |
+
"calibration_padding": "trim_right_padding_before_native_CoMe_scoring",
|
| 244 |
+
"teacher_mutated_during_initialization": false
|
| 245 |
+
},
|
| 246 |
+
"norms_trainable": false,
|
| 247 |
+
"attention_norm_initialization": "CoMe_retention_weighted_QK",
|
| 248 |
+
"initialized_parameters": [
|
| 249 |
+
"self_attn.q_proj.weight",
|
| 250 |
+
"self_attn.k_proj.weight",
|
| 251 |
+
"self_attn.v_proj.weight",
|
| 252 |
+
"self_attn.o_proj.weight",
|
| 253 |
+
"self_attn.q_norm.weight",
|
| 254 |
+
"self_attn.k_norm.weight",
|
| 255 |
+
"mlp.gate_proj.weight",
|
| 256 |
+
"mlp.up_proj.weight",
|
| 257 |
+
"mlp.down_proj.weight",
|
| 258 |
+
"input_layernorm.weight",
|
| 259 |
+
"post_attention_layernorm.weight"
|
| 260 |
+
],
|
| 261 |
+
"frozen_CoMe_parameters": [
|
| 262 |
+
"self_attn.q_proj.weight",
|
| 263 |
+
"self_attn.k_proj.weight",
|
| 264 |
+
"self_attn.v_proj.weight",
|
| 265 |
+
"self_attn.o_proj.weight",
|
| 266 |
+
"self_attn.q_norm.weight",
|
| 267 |
+
"self_attn.k_norm.weight",
|
| 268 |
+
"input_layernorm.weight",
|
| 269 |
+
"post_attention_layernorm.weight"
|
| 270 |
+
],
|
| 271 |
+
"frozen_attention_norm_expected_sha256": {
|
| 272 |
+
"self_attn.q_proj.weight": "f2a853932fea15a5a825782f208d6ca3f77ccf896addd4d9e56f0e8e9082fe6b",
|
| 273 |
+
"self_attn.k_proj.weight": "5575d2b5c9f9213078cee249df0db1a0d912c10900df8a7636095e4835a61217",
|
| 274 |
+
"self_attn.v_proj.weight": "9f294925ca5d2ae3ada26843af7fde6baa73c1a158e80d0baf14a4871dffb000",
|
| 275 |
+
"self_attn.o_proj.weight": "cb2a380e6bebe924e97bca438e8be51a7557b79f87c3a9eff7f3d94816a19401",
|
| 276 |
+
"self_attn.q_norm.weight": "92f79f4e9257476501577f2a7519154db20b0859e33b071a9498bb47136dce8f",
|
| 277 |
+
"self_attn.k_norm.weight": "6714e2b2f504289ad5c98deb930db2b2ba947ad86b1bc6fe814f461ae93ef273",
|
| 278 |
+
"input_layernorm.weight": "0b6edcbe6fc1e1bf40352a8291be48de9315be9a8b60b0e5f6f79e926527c90c",
|
| 279 |
+
"post_attention_layernorm.weight": "dba76b7f863c3425bdc928b6d785d9d8b414258c7d2cac5c591cadce3d89bba5"
|
| 280 |
+
},
|
| 281 |
+
"frozen_attention_norm_before_sha256": {
|
| 282 |
+
"self_attn.q_proj.weight": "f2a853932fea15a5a825782f208d6ca3f77ccf896addd4d9e56f0e8e9082fe6b",
|
| 283 |
+
"self_attn.k_proj.weight": "5575d2b5c9f9213078cee249df0db1a0d912c10900df8a7636095e4835a61217",
|
| 284 |
+
"self_attn.v_proj.weight": "9f294925ca5d2ae3ada26843af7fde6baa73c1a158e80d0baf14a4871dffb000",
|
| 285 |
+
"self_attn.o_proj.weight": "cb2a380e6bebe924e97bca438e8be51a7557b79f87c3a9eff7f3d94816a19401",
|
| 286 |
+
"self_attn.q_norm.weight": "92f79f4e9257476501577f2a7519154db20b0859e33b071a9498bb47136dce8f",
|
| 287 |
+
"self_attn.k_norm.weight": "6714e2b2f504289ad5c98deb930db2b2ba947ad86b1bc6fe814f461ae93ef273",
|
| 288 |
+
"input_layernorm.weight": "0b6edcbe6fc1e1bf40352a8291be48de9315be9a8b60b0e5f6f79e926527c90c",
|
| 289 |
+
"post_attention_layernorm.weight": "dba76b7f863c3425bdc928b6d785d9d8b414258c7d2cac5c591cadce3d89bba5"
|
| 290 |
+
},
|
| 291 |
+
"frozen_attention_norm_after_sha256": {
|
| 292 |
+
"self_attn.q_proj.weight": "f2a853932fea15a5a825782f208d6ca3f77ccf896addd4d9e56f0e8e9082fe6b",
|
| 293 |
+
"self_attn.k_proj.weight": "5575d2b5c9f9213078cee249df0db1a0d912c10900df8a7636095e4835a61217",
|
| 294 |
+
"self_attn.v_proj.weight": "9f294925ca5d2ae3ada26843af7fde6baa73c1a158e80d0baf14a4871dffb000",
|
| 295 |
+
"self_attn.o_proj.weight": "cb2a380e6bebe924e97bca438e8be51a7557b79f87c3a9eff7f3d94816a19401",
|
| 296 |
+
"self_attn.q_norm.weight": "92f79f4e9257476501577f2a7519154db20b0859e33b071a9498bb47136dce8f",
|
| 297 |
+
"self_attn.k_norm.weight": "6714e2b2f504289ad5c98deb930db2b2ba947ad86b1bc6fe814f461ae93ef273",
|
| 298 |
+
"input_layernorm.weight": "0b6edcbe6fc1e1bf40352a8291be48de9315be9a8b60b0e5f6f79e926527c90c",
|
| 299 |
+
"post_attention_layernorm.weight": "dba76b7f863c3425bdc928b6d785d9d8b414258c7d2cac5c591cadce3d89bba5"
|
| 300 |
+
},
|
| 301 |
+
"frozen_attention_norm_unchanged": true,
|
| 302 |
+
"source_feature_transport": false,
|
| 303 |
+
"initializer": "come",
|
| 304 |
+
"removed_count_per_cycle": 1,
|
| 305 |
+
"teacher_boundary_current_layer": 17,
|
| 306 |
+
"teacher_boundary_original_layer": 19
|
| 307 |
+
}
|
| 308 |
+
}
|
runs/vast-paper_revision-come-attn-fit-20261126-62646539/20261126-qwen3-base-mka-come-mlp-fit/catalog/results/come/audit/data_fingerprints.json
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"calib_loader": {
|
| 3 |
+
"sequences": 64,
|
| 4 |
+
"sha256": "85a84b9a68cf0856fd363186d3a273860886b1c17f876cae145fd092454aff55",
|
| 5 |
+
"attention_mask_sha256": "b1476de1907209012e63fa502715fd97db26e595352faa808d8c10433a1472a4",
|
| 6 |
+
"valid_tokens": 65536
|
| 7 |
+
},
|
| 8 |
+
"distill_loader": {
|
| 9 |
+
"sequences": 512,
|
| 10 |
+
"sha256": "5d9d4cc2f81d8712b932806c0c2b2992dce9bd3e6c7a143f1f670649b8bfe693",
|
| 11 |
+
"attention_mask_sha256": "c8e7f8e30cd532b82e6af4b98d596bc7106f29f9fb2b398b44355e624898a30d",
|
| 12 |
+
"valid_tokens": 524288
|
| 13 |
+
}
|
| 14 |
+
}
|
runs/vast-paper_revision-come-attn-fit-20261126-62646539/20261126-qwen3-base-mka-come-mlp-fit/catalog/results/come/audit/selection.json
ADDED
|
@@ -0,0 +1,662 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
[
|
| 2 |
+
{
|
| 3 |
+
"cycle": 1,
|
| 4 |
+
"pair_index": 31,
|
| 5 |
+
"initializer": "come",
|
| 6 |
+
"lambda_left": null,
|
| 7 |
+
"recipient_original_layer": 31,
|
| 8 |
+
"recipient_side": "left",
|
| 9 |
+
"removed_original_layer": 32,
|
| 10 |
+
"source_lineage": [
|
| 11 |
+
[
|
| 12 |
+
31
|
| 13 |
+
],
|
| 14 |
+
[
|
| 15 |
+
32
|
| 16 |
+
]
|
| 17 |
+
],
|
| 18 |
+
"retention_ratios": [
|
| 19 |
+
0.49274789168296595,
|
| 20 |
+
0.5072521083170339
|
| 21 |
+
],
|
| 22 |
+
"retained_attention_groups": [
|
| 23 |
+
3,
|
| 24 |
+
5
|
| 25 |
+
],
|
| 26 |
+
"retained_mlp_neurons": [
|
| 27 |
+
6054,
|
| 28 |
+
6234
|
| 29 |
+
],
|
| 30 |
+
"pair_score": 0.11533127194072337,
|
| 31 |
+
"minimum_retention": 0.0,
|
| 32 |
+
"adjusted_minimum": 0.0,
|
| 33 |
+
"power": 1.0,
|
| 34 |
+
"allow_repeat": true,
|
| 35 |
+
"sbi_metric": "angular_last",
|
| 36 |
+
"calibration_padding": "trim_right_padding_before_native_CoMe_scoring",
|
| 37 |
+
"teacher_mutated_during_initialization": false,
|
| 38 |
+
"removed_original_layers": [
|
| 39 |
+
32
|
| 40 |
+
],
|
| 41 |
+
"active_original_layers": [
|
| 42 |
+
0,
|
| 43 |
+
1,
|
| 44 |
+
2,
|
| 45 |
+
3,
|
| 46 |
+
4,
|
| 47 |
+
5,
|
| 48 |
+
6,
|
| 49 |
+
7,
|
| 50 |
+
8,
|
| 51 |
+
9,
|
| 52 |
+
10,
|
| 53 |
+
11,
|
| 54 |
+
12,
|
| 55 |
+
13,
|
| 56 |
+
14,
|
| 57 |
+
15,
|
| 58 |
+
16,
|
| 59 |
+
17,
|
| 60 |
+
18,
|
| 61 |
+
19,
|
| 62 |
+
20,
|
| 63 |
+
21,
|
| 64 |
+
22,
|
| 65 |
+
23,
|
| 66 |
+
24,
|
| 67 |
+
25,
|
| 68 |
+
26,
|
| 69 |
+
27,
|
| 70 |
+
28,
|
| 71 |
+
29,
|
| 72 |
+
30,
|
| 73 |
+
31,
|
| 74 |
+
33,
|
| 75 |
+
34,
|
| 76 |
+
35
|
| 77 |
+
]
|
| 78 |
+
},
|
| 79 |
+
{
|
| 80 |
+
"cycle": 2,
|
| 81 |
+
"pair_index": 16,
|
| 82 |
+
"initializer": "come",
|
| 83 |
+
"lambda_left": null,
|
| 84 |
+
"recipient_original_layer": 16,
|
| 85 |
+
"recipient_side": "left",
|
| 86 |
+
"removed_original_layer": 17,
|
| 87 |
+
"source_lineage": [
|
| 88 |
+
[
|
| 89 |
+
16
|
| 90 |
+
],
|
| 91 |
+
[
|
| 92 |
+
17
|
| 93 |
+
]
|
| 94 |
+
],
|
| 95 |
+
"retention_ratios": [
|
| 96 |
+
0.49296001567209896,
|
| 97 |
+
0.507039984327901
|
| 98 |
+
],
|
| 99 |
+
"retained_attention_groups": [
|
| 100 |
+
3,
|
| 101 |
+
5
|
| 102 |
+
],
|
| 103 |
+
"retained_mlp_neurons": [
|
| 104 |
+
6057,
|
| 105 |
+
6231
|
| 106 |
+
],
|
| 107 |
+
"pair_score": 0.11846736168607752,
|
| 108 |
+
"minimum_retention": 0.0,
|
| 109 |
+
"adjusted_minimum": 0.0,
|
| 110 |
+
"power": 1.0,
|
| 111 |
+
"allow_repeat": true,
|
| 112 |
+
"sbi_metric": "angular_last",
|
| 113 |
+
"calibration_padding": "trim_right_padding_before_native_CoMe_scoring",
|
| 114 |
+
"teacher_mutated_during_initialization": false,
|
| 115 |
+
"removed_original_layers": [
|
| 116 |
+
17
|
| 117 |
+
],
|
| 118 |
+
"active_original_layers": [
|
| 119 |
+
0,
|
| 120 |
+
1,
|
| 121 |
+
2,
|
| 122 |
+
3,
|
| 123 |
+
4,
|
| 124 |
+
5,
|
| 125 |
+
6,
|
| 126 |
+
7,
|
| 127 |
+
8,
|
| 128 |
+
9,
|
| 129 |
+
10,
|
| 130 |
+
11,
|
| 131 |
+
12,
|
| 132 |
+
13,
|
| 133 |
+
14,
|
| 134 |
+
15,
|
| 135 |
+
16,
|
| 136 |
+
18,
|
| 137 |
+
19,
|
| 138 |
+
20,
|
| 139 |
+
21,
|
| 140 |
+
22,
|
| 141 |
+
23,
|
| 142 |
+
24,
|
| 143 |
+
25,
|
| 144 |
+
26,
|
| 145 |
+
27,
|
| 146 |
+
28,
|
| 147 |
+
29,
|
| 148 |
+
30,
|
| 149 |
+
31,
|
| 150 |
+
33,
|
| 151 |
+
34,
|
| 152 |
+
35
|
| 153 |
+
]
|
| 154 |
+
},
|
| 155 |
+
{
|
| 156 |
+
"cycle": 3,
|
| 157 |
+
"pair_index": 25,
|
| 158 |
+
"initializer": "come",
|
| 159 |
+
"lambda_left": null,
|
| 160 |
+
"recipient_original_layer": 26,
|
| 161 |
+
"recipient_side": "left",
|
| 162 |
+
"removed_original_layer": 27,
|
| 163 |
+
"source_lineage": [
|
| 164 |
+
[
|
| 165 |
+
26
|
| 166 |
+
],
|
| 167 |
+
[
|
| 168 |
+
27
|
| 169 |
+
]
|
| 170 |
+
],
|
| 171 |
+
"retention_ratios": [
|
| 172 |
+
0.500755807036962,
|
| 173 |
+
0.4992441929630379
|
| 174 |
+
],
|
| 175 |
+
"retained_attention_groups": [
|
| 176 |
+
5,
|
| 177 |
+
3
|
| 178 |
+
],
|
| 179 |
+
"retained_mlp_neurons": [
|
| 180 |
+
6154,
|
| 181 |
+
6134
|
| 182 |
+
],
|
| 183 |
+
"pair_score": 0.11813264054820892,
|
| 184 |
+
"minimum_retention": 0.0,
|
| 185 |
+
"adjusted_minimum": 0.0,
|
| 186 |
+
"power": 1.0,
|
| 187 |
+
"allow_repeat": true,
|
| 188 |
+
"sbi_metric": "angular_last",
|
| 189 |
+
"calibration_padding": "trim_right_padding_before_native_CoMe_scoring",
|
| 190 |
+
"teacher_mutated_during_initialization": false,
|
| 191 |
+
"removed_original_layers": [
|
| 192 |
+
27
|
| 193 |
+
],
|
| 194 |
+
"active_original_layers": [
|
| 195 |
+
0,
|
| 196 |
+
1,
|
| 197 |
+
2,
|
| 198 |
+
3,
|
| 199 |
+
4,
|
| 200 |
+
5,
|
| 201 |
+
6,
|
| 202 |
+
7,
|
| 203 |
+
8,
|
| 204 |
+
9,
|
| 205 |
+
10,
|
| 206 |
+
11,
|
| 207 |
+
12,
|
| 208 |
+
13,
|
| 209 |
+
14,
|
| 210 |
+
15,
|
| 211 |
+
16,
|
| 212 |
+
18,
|
| 213 |
+
19,
|
| 214 |
+
20,
|
| 215 |
+
21,
|
| 216 |
+
22,
|
| 217 |
+
23,
|
| 218 |
+
24,
|
| 219 |
+
25,
|
| 220 |
+
26,
|
| 221 |
+
28,
|
| 222 |
+
29,
|
| 223 |
+
30,
|
| 224 |
+
31,
|
| 225 |
+
33,
|
| 226 |
+
34,
|
| 227 |
+
35
|
| 228 |
+
]
|
| 229 |
+
},
|
| 230 |
+
{
|
| 231 |
+
"cycle": 4,
|
| 232 |
+
"pair_index": 15,
|
| 233 |
+
"initializer": "come",
|
| 234 |
+
"lambda_left": null,
|
| 235 |
+
"recipient_original_layer": 15,
|
| 236 |
+
"recipient_side": "left",
|
| 237 |
+
"removed_original_layer": 16,
|
| 238 |
+
"source_lineage": [
|
| 239 |
+
[
|
| 240 |
+
15
|
| 241 |
+
],
|
| 242 |
+
[
|
| 243 |
+
16,
|
| 244 |
+
17
|
| 245 |
+
]
|
| 246 |
+
],
|
| 247 |
+
"retention_ratios": [
|
| 248 |
+
0.48481783779572774,
|
| 249 |
+
0.5151821622042723
|
| 250 |
+
],
|
| 251 |
+
"retained_attention_groups": [
|
| 252 |
+
3,
|
| 253 |
+
5
|
| 254 |
+
],
|
| 255 |
+
"retained_mlp_neurons": [
|
| 256 |
+
5957,
|
| 257 |
+
6331
|
| 258 |
+
],
|
| 259 |
+
"pair_score": 0.12428857100770828,
|
| 260 |
+
"minimum_retention": 0.0,
|
| 261 |
+
"adjusted_minimum": 0.0,
|
| 262 |
+
"power": 1.0,
|
| 263 |
+
"allow_repeat": true,
|
| 264 |
+
"sbi_metric": "angular_last",
|
| 265 |
+
"calibration_padding": "trim_right_padding_before_native_CoMe_scoring",
|
| 266 |
+
"teacher_mutated_during_initialization": false,
|
| 267 |
+
"removed_original_layers": [
|
| 268 |
+
16
|
| 269 |
+
],
|
| 270 |
+
"active_original_layers": [
|
| 271 |
+
0,
|
| 272 |
+
1,
|
| 273 |
+
2,
|
| 274 |
+
3,
|
| 275 |
+
4,
|
| 276 |
+
5,
|
| 277 |
+
6,
|
| 278 |
+
7,
|
| 279 |
+
8,
|
| 280 |
+
9,
|
| 281 |
+
10,
|
| 282 |
+
11,
|
| 283 |
+
12,
|
| 284 |
+
13,
|
| 285 |
+
14,
|
| 286 |
+
15,
|
| 287 |
+
18,
|
| 288 |
+
19,
|
| 289 |
+
20,
|
| 290 |
+
21,
|
| 291 |
+
22,
|
| 292 |
+
23,
|
| 293 |
+
24,
|
| 294 |
+
25,
|
| 295 |
+
26,
|
| 296 |
+
28,
|
| 297 |
+
29,
|
| 298 |
+
30,
|
| 299 |
+
31,
|
| 300 |
+
33,
|
| 301 |
+
34,
|
| 302 |
+
35
|
| 303 |
+
]
|
| 304 |
+
},
|
| 305 |
+
{
|
| 306 |
+
"cycle": 5,
|
| 307 |
+
"pair_index": 26,
|
| 308 |
+
"initializer": "come",
|
| 309 |
+
"lambda_left": null,
|
| 310 |
+
"recipient_original_layer": 29,
|
| 311 |
+
"recipient_side": "left",
|
| 312 |
+
"removed_original_layer": 30,
|
| 313 |
+
"source_lineage": [
|
| 314 |
+
[
|
| 315 |
+
29
|
| 316 |
+
],
|
| 317 |
+
[
|
| 318 |
+
30
|
| 319 |
+
]
|
| 320 |
+
],
|
| 321 |
+
"retention_ratios": [
|
| 322 |
+
0.5168892574349215,
|
| 323 |
+
0.4831107425650785
|
| 324 |
+
],
|
| 325 |
+
"retained_attention_groups": [
|
| 326 |
+
5,
|
| 327 |
+
3
|
| 328 |
+
],
|
| 329 |
+
"retained_mlp_neurons": [
|
| 330 |
+
6352,
|
| 331 |
+
5936
|
| 332 |
+
],
|
| 333 |
+
"pair_score": 0.12363086149413535,
|
| 334 |
+
"minimum_retention": 0.0,
|
| 335 |
+
"adjusted_minimum": 0.0,
|
| 336 |
+
"power": 1.0,
|
| 337 |
+
"allow_repeat": true,
|
| 338 |
+
"sbi_metric": "angular_last",
|
| 339 |
+
"calibration_padding": "trim_right_padding_before_native_CoMe_scoring",
|
| 340 |
+
"teacher_mutated_during_initialization": false,
|
| 341 |
+
"removed_original_layers": [
|
| 342 |
+
30
|
| 343 |
+
],
|
| 344 |
+
"active_original_layers": [
|
| 345 |
+
0,
|
| 346 |
+
1,
|
| 347 |
+
2,
|
| 348 |
+
3,
|
| 349 |
+
4,
|
| 350 |
+
5,
|
| 351 |
+
6,
|
| 352 |
+
7,
|
| 353 |
+
8,
|
| 354 |
+
9,
|
| 355 |
+
10,
|
| 356 |
+
11,
|
| 357 |
+
12,
|
| 358 |
+
13,
|
| 359 |
+
14,
|
| 360 |
+
15,
|
| 361 |
+
18,
|
| 362 |
+
19,
|
| 363 |
+
20,
|
| 364 |
+
21,
|
| 365 |
+
22,
|
| 366 |
+
23,
|
| 367 |
+
24,
|
| 368 |
+
25,
|
| 369 |
+
26,
|
| 370 |
+
28,
|
| 371 |
+
29,
|
| 372 |
+
31,
|
| 373 |
+
33,
|
| 374 |
+
34,
|
| 375 |
+
35
|
| 376 |
+
]
|
| 377 |
+
},
|
| 378 |
+
{
|
| 379 |
+
"cycle": 6,
|
| 380 |
+
"pair_index": 23,
|
| 381 |
+
"initializer": "come",
|
| 382 |
+
"lambda_left": null,
|
| 383 |
+
"recipient_original_layer": 25,
|
| 384 |
+
"recipient_side": "left",
|
| 385 |
+
"removed_original_layer": 26,
|
| 386 |
+
"source_lineage": [
|
| 387 |
+
[
|
| 388 |
+
25
|
| 389 |
+
],
|
| 390 |
+
[
|
| 391 |
+
26,
|
| 392 |
+
27
|
| 393 |
+
]
|
| 394 |
+
],
|
| 395 |
+
"retention_ratios": [
|
| 396 |
+
0.5023699918186109,
|
| 397 |
+
0.49763000818138914
|
| 398 |
+
],
|
| 399 |
+
"retained_attention_groups": [
|
| 400 |
+
5,
|
| 401 |
+
3
|
| 402 |
+
],
|
| 403 |
+
"retained_mlp_neurons": [
|
| 404 |
+
6174,
|
| 405 |
+
6114
|
| 406 |
+
],
|
| 407 |
+
"pair_score": 0.12410008491195262,
|
| 408 |
+
"minimum_retention": 0.0,
|
| 409 |
+
"adjusted_minimum": 0.0,
|
| 410 |
+
"power": 1.0,
|
| 411 |
+
"allow_repeat": true,
|
| 412 |
+
"sbi_metric": "angular_last",
|
| 413 |
+
"calibration_padding": "trim_right_padding_before_native_CoMe_scoring",
|
| 414 |
+
"teacher_mutated_during_initialization": false,
|
| 415 |
+
"removed_original_layers": [
|
| 416 |
+
26
|
| 417 |
+
],
|
| 418 |
+
"active_original_layers": [
|
| 419 |
+
0,
|
| 420 |
+
1,
|
| 421 |
+
2,
|
| 422 |
+
3,
|
| 423 |
+
4,
|
| 424 |
+
5,
|
| 425 |
+
6,
|
| 426 |
+
7,
|
| 427 |
+
8,
|
| 428 |
+
9,
|
| 429 |
+
10,
|
| 430 |
+
11,
|
| 431 |
+
12,
|
| 432 |
+
13,
|
| 433 |
+
14,
|
| 434 |
+
15,
|
| 435 |
+
18,
|
| 436 |
+
19,
|
| 437 |
+
20,
|
| 438 |
+
21,
|
| 439 |
+
22,
|
| 440 |
+
23,
|
| 441 |
+
24,
|
| 442 |
+
25,
|
| 443 |
+
28,
|
| 444 |
+
29,
|
| 445 |
+
31,
|
| 446 |
+
33,
|
| 447 |
+
34,
|
| 448 |
+
35
|
| 449 |
+
]
|
| 450 |
+
},
|
| 451 |
+
{
|
| 452 |
+
"cycle": 7,
|
| 453 |
+
"pair_index": 18,
|
| 454 |
+
"initializer": "come",
|
| 455 |
+
"lambda_left": null,
|
| 456 |
+
"recipient_original_layer": 20,
|
| 457 |
+
"recipient_side": "left",
|
| 458 |
+
"removed_original_layer": 21,
|
| 459 |
+
"source_lineage": [
|
| 460 |
+
[
|
| 461 |
+
20
|
| 462 |
+
],
|
| 463 |
+
[
|
| 464 |
+
21
|
| 465 |
+
]
|
| 466 |
+
],
|
| 467 |
+
"retention_ratios": [
|
| 468 |
+
0.47186972247563475,
|
| 469 |
+
0.5281302775243653
|
| 470 |
+
],
|
| 471 |
+
"retained_attention_groups": [
|
| 472 |
+
3,
|
| 473 |
+
5
|
| 474 |
+
],
|
| 475 |
+
"retained_mlp_neurons": [
|
| 476 |
+
5798,
|
| 477 |
+
6490
|
| 478 |
+
],
|
| 479 |
+
"pair_score": 0.1278106997859605,
|
| 480 |
+
"minimum_retention": 0.0,
|
| 481 |
+
"adjusted_minimum": 0.0,
|
| 482 |
+
"power": 1.0,
|
| 483 |
+
"allow_repeat": true,
|
| 484 |
+
"sbi_metric": "angular_last",
|
| 485 |
+
"calibration_padding": "trim_right_padding_before_native_CoMe_scoring",
|
| 486 |
+
"teacher_mutated_during_initialization": false,
|
| 487 |
+
"removed_original_layers": [
|
| 488 |
+
21
|
| 489 |
+
],
|
| 490 |
+
"active_original_layers": [
|
| 491 |
+
0,
|
| 492 |
+
1,
|
| 493 |
+
2,
|
| 494 |
+
3,
|
| 495 |
+
4,
|
| 496 |
+
5,
|
| 497 |
+
6,
|
| 498 |
+
7,
|
| 499 |
+
8,
|
| 500 |
+
9,
|
| 501 |
+
10,
|
| 502 |
+
11,
|
| 503 |
+
12,
|
| 504 |
+
13,
|
| 505 |
+
14,
|
| 506 |
+
15,
|
| 507 |
+
18,
|
| 508 |
+
19,
|
| 509 |
+
20,
|
| 510 |
+
22,
|
| 511 |
+
23,
|
| 512 |
+
24,
|
| 513 |
+
25,
|
| 514 |
+
28,
|
| 515 |
+
29,
|
| 516 |
+
31,
|
| 517 |
+
33,
|
| 518 |
+
34,
|
| 519 |
+
35
|
| 520 |
+
]
|
| 521 |
+
},
|
| 522 |
+
{
|
| 523 |
+
"cycle": 8,
|
| 524 |
+
"pair_index": 23,
|
| 525 |
+
"initializer": "come",
|
| 526 |
+
"lambda_left": null,
|
| 527 |
+
"recipient_original_layer": 28,
|
| 528 |
+
"recipient_side": "left",
|
| 529 |
+
"removed_original_layer": 29,
|
| 530 |
+
"source_lineage": [
|
| 531 |
+
[
|
| 532 |
+
28
|
| 533 |
+
],
|
| 534 |
+
[
|
| 535 |
+
29,
|
| 536 |
+
30
|
| 537 |
+
]
|
| 538 |
+
],
|
| 539 |
+
"retention_ratios": [
|
| 540 |
+
0.46346630280250284,
|
| 541 |
+
0.5365336971974971
|
| 542 |
+
],
|
| 543 |
+
"retained_attention_groups": [
|
| 544 |
+
3,
|
| 545 |
+
5
|
| 546 |
+
],
|
| 547 |
+
"retained_mlp_neurons": [
|
| 548 |
+
5695,
|
| 549 |
+
6593
|
| 550 |
+
],
|
| 551 |
+
"pair_score": 0.13028502202731498,
|
| 552 |
+
"minimum_retention": 0.0,
|
| 553 |
+
"adjusted_minimum": 0.0,
|
| 554 |
+
"power": 1.0,
|
| 555 |
+
"allow_repeat": true,
|
| 556 |
+
"sbi_metric": "angular_last",
|
| 557 |
+
"calibration_padding": "trim_right_padding_before_native_CoMe_scoring",
|
| 558 |
+
"teacher_mutated_during_initialization": false,
|
| 559 |
+
"removed_original_layers": [
|
| 560 |
+
29
|
| 561 |
+
],
|
| 562 |
+
"active_original_layers": [
|
| 563 |
+
0,
|
| 564 |
+
1,
|
| 565 |
+
2,
|
| 566 |
+
3,
|
| 567 |
+
4,
|
| 568 |
+
5,
|
| 569 |
+
6,
|
| 570 |
+
7,
|
| 571 |
+
8,
|
| 572 |
+
9,
|
| 573 |
+
10,
|
| 574 |
+
11,
|
| 575 |
+
12,
|
| 576 |
+
13,
|
| 577 |
+
14,
|
| 578 |
+
15,
|
| 579 |
+
18,
|
| 580 |
+
19,
|
| 581 |
+
20,
|
| 582 |
+
22,
|
| 583 |
+
23,
|
| 584 |
+
24,
|
| 585 |
+
25,
|
| 586 |
+
28,
|
| 587 |
+
31,
|
| 588 |
+
33,
|
| 589 |
+
34,
|
| 590 |
+
35
|
| 591 |
+
]
|
| 592 |
+
},
|
| 593 |
+
{
|
| 594 |
+
"cycle": 9,
|
| 595 |
+
"pair_index": 16,
|
| 596 |
+
"initializer": "come",
|
| 597 |
+
"lambda_left": null,
|
| 598 |
+
"recipient_original_layer": 18,
|
| 599 |
+
"recipient_side": "left",
|
| 600 |
+
"removed_original_layer": 19,
|
| 601 |
+
"source_lineage": [
|
| 602 |
+
[
|
| 603 |
+
18
|
| 604 |
+
],
|
| 605 |
+
[
|
| 606 |
+
19
|
| 607 |
+
]
|
| 608 |
+
],
|
| 609 |
+
"retention_ratios": [
|
| 610 |
+
0.43171495242956137,
|
| 611 |
+
0.5682850475704386
|
| 612 |
+
],
|
| 613 |
+
"retained_attention_groups": [
|
| 614 |
+
3,
|
| 615 |
+
5
|
| 616 |
+
],
|
| 617 |
+
"retained_mlp_neurons": [
|
| 618 |
+
5304,
|
| 619 |
+
6984
|
| 620 |
+
],
|
| 621 |
+
"pair_score": 0.13059031313404124,
|
| 622 |
+
"minimum_retention": 0.0,
|
| 623 |
+
"adjusted_minimum": 0.0,
|
| 624 |
+
"power": 1.0,
|
| 625 |
+
"allow_repeat": true,
|
| 626 |
+
"sbi_metric": "angular_last",
|
| 627 |
+
"calibration_padding": "trim_right_padding_before_native_CoMe_scoring",
|
| 628 |
+
"teacher_mutated_during_initialization": false,
|
| 629 |
+
"removed_original_layers": [
|
| 630 |
+
19
|
| 631 |
+
],
|
| 632 |
+
"active_original_layers": [
|
| 633 |
+
0,
|
| 634 |
+
1,
|
| 635 |
+
2,
|
| 636 |
+
3,
|
| 637 |
+
4,
|
| 638 |
+
5,
|
| 639 |
+
6,
|
| 640 |
+
7,
|
| 641 |
+
8,
|
| 642 |
+
9,
|
| 643 |
+
10,
|
| 644 |
+
11,
|
| 645 |
+
12,
|
| 646 |
+
13,
|
| 647 |
+
14,
|
| 648 |
+
15,
|
| 649 |
+
18,
|
| 650 |
+
20,
|
| 651 |
+
22,
|
| 652 |
+
23,
|
| 653 |
+
24,
|
| 654 |
+
25,
|
| 655 |
+
28,
|
| 656 |
+
31,
|
| 657 |
+
33,
|
| 658 |
+
34,
|
| 659 |
+
35
|
| 660 |
+
]
|
| 661 |
+
}
|
| 662 |
+
]
|
runs/vast-paper_revision-come-attn-fit-20261126-62646539/20261126-qwen3-base-mka-come-mlp-fit/catalog/results/come/audit/selection_inputs.json
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"input_ids_sha256": "0e958e9f08255ee1a4bb4f029d8e7af94c8a26c6b31366a9223fb7629ebf53e3",
|
| 3 |
+
"sequences": 94,
|
| 4 |
+
"source": "/workspace/qwen3-mlp-fit-20261126/calibration/come.pt",
|
| 5 |
+
"independent_of_fit_loader": true
|
| 6 |
+
}
|
runs/vast-paper_revision-come-attn-fit-20261126-62646539/20261126-qwen3-base-mka-come-mlp-fit/catalog/results/come/compact_metadata.json
ADDED
|
@@ -0,0 +1,110 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"format": "abprune_compact_stage_v2",
|
| 3 |
+
"model": "Qwen/Qwen3-8B-Base",
|
| 4 |
+
"base_model_revision": "49e3418fbbbca6ecbdf9608b4d22e5a407081db4",
|
| 5 |
+
"run_id": "qwen3_8b_base_fit_come_9block",
|
| 6 |
+
"target_prune_count": 9,
|
| 7 |
+
"stage": 9,
|
| 8 |
+
"removed_count": 9,
|
| 9 |
+
"original_layer_count": 36,
|
| 10 |
+
"layer_order": [
|
| 11 |
+
31,
|
| 12 |
+
16,
|
| 13 |
+
25,
|
| 14 |
+
15,
|
| 15 |
+
26,
|
| 16 |
+
23,
|
| 17 |
+
18,
|
| 18 |
+
23,
|
| 19 |
+
16
|
| 20 |
+
],
|
| 21 |
+
"latest_pair_index": 16,
|
| 22 |
+
"latest_recipient_side": "left",
|
| 23 |
+
"latest_recipient_original_layer": 18,
|
| 24 |
+
"latest_removed_original_layer": 19,
|
| 25 |
+
"removed_original_layers": [
|
| 26 |
+
16,
|
| 27 |
+
17,
|
| 28 |
+
19,
|
| 29 |
+
21,
|
| 30 |
+
26,
|
| 31 |
+
27,
|
| 32 |
+
29,
|
| 33 |
+
30,
|
| 34 |
+
32
|
| 35 |
+
],
|
| 36 |
+
"active_original_layers": [
|
| 37 |
+
0,
|
| 38 |
+
1,
|
| 39 |
+
2,
|
| 40 |
+
3,
|
| 41 |
+
4,
|
| 42 |
+
5,
|
| 43 |
+
6,
|
| 44 |
+
7,
|
| 45 |
+
8,
|
| 46 |
+
9,
|
| 47 |
+
10,
|
| 48 |
+
11,
|
| 49 |
+
12,
|
| 50 |
+
13,
|
| 51 |
+
14,
|
| 52 |
+
15,
|
| 53 |
+
18,
|
| 54 |
+
20,
|
| 55 |
+
22,
|
| 56 |
+
23,
|
| 57 |
+
24,
|
| 58 |
+
25,
|
| 59 |
+
28,
|
| 60 |
+
31,
|
| 61 |
+
33,
|
| 62 |
+
34,
|
| 63 |
+
35
|
| 64 |
+
],
|
| 65 |
+
"retained_layer_states": [
|
| 66 |
+
{
|
| 67 |
+
"original_layer": 15,
|
| 68 |
+
"state_file": "layer_original_0015.pt",
|
| 69 |
+
"sha256": "80dc7228f4a34261a00664948eaf3619cdee5fef0dc9dae6e72d330d624c72d1",
|
| 70 |
+
"source_cycle": 4,
|
| 71 |
+
"recipient_side": "left"
|
| 72 |
+
},
|
| 73 |
+
{
|
| 74 |
+
"original_layer": 18,
|
| 75 |
+
"state_file": "layer_original_0018.pt",
|
| 76 |
+
"sha256": "85faba5efb76fdae0c2b8a6357db84d42f0e19b8a7592d9f9d2d5862b3f6b9b4",
|
| 77 |
+
"source_cycle": 9,
|
| 78 |
+
"recipient_side": "left"
|
| 79 |
+
},
|
| 80 |
+
{
|
| 81 |
+
"original_layer": 20,
|
| 82 |
+
"state_file": "layer_original_0020.pt",
|
| 83 |
+
"sha256": "06b6663e17e2d5749b618bb43a1df5541bc76139b82e57c5cfa05a4e0e61ac93",
|
| 84 |
+
"source_cycle": 7,
|
| 85 |
+
"recipient_side": "left"
|
| 86 |
+
},
|
| 87 |
+
{
|
| 88 |
+
"original_layer": 25,
|
| 89 |
+
"state_file": "layer_original_0025.pt",
|
| 90 |
+
"sha256": "4d0ded25ce72f3b53059a9f5f885fb0178b0509db3a4a6e593dc862c897aee78",
|
| 91 |
+
"source_cycle": 6,
|
| 92 |
+
"recipient_side": "left"
|
| 93 |
+
},
|
| 94 |
+
{
|
| 95 |
+
"original_layer": 28,
|
| 96 |
+
"state_file": "layer_original_0028.pt",
|
| 97 |
+
"sha256": "50abe4d738ed5839b7060ce33964007e4679091dfcded790b56075937fb8bd60",
|
| 98 |
+
"source_cycle": 8,
|
| 99 |
+
"recipient_side": "left"
|
| 100 |
+
},
|
| 101 |
+
{
|
| 102 |
+
"original_layer": 31,
|
| 103 |
+
"state_file": "layer_original_0031.pt",
|
| 104 |
+
"sha256": "5c5ec97998485de8ddd46981befd5a33566982ddfaa57ce2b97f9884e341eb49",
|
| 105 |
+
"source_cycle": 1,
|
| 106 |
+
"recipient_side": "left"
|
| 107 |
+
}
|
| 108 |
+
],
|
| 109 |
+
"source_cycle": "cycle_9"
|
| 110 |
+
}
|