Complete attention MLP FiT comparison and model verification catalog; 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-llama31-come-attn-mlp-batch/catalog/README.md +3 -0
- runs/vast-paper_revision-come-attn-fit-20261126-62646539/20261126-llama31-come-attn-mlp-batch/catalog/backup_audit.json +31 -0
- runs/vast-paper_revision-come-attn-fit-20261126-62646539/20261126-llama31-come-attn-mlp-batch/catalog/code/abprune_compact.py +284 -0
- runs/vast-paper_revision-come-attn-fit-20261126-62646539/20261126-llama31-come-attn-mlp-batch/catalog/code/bootstrap_come_batch_comparison.sh +48 -0
- runs/vast-paper_revision-come-attn-fit-20261126-62646539/20261126-llama31-come-attn-mlp-batch/catalog/code/bootstrap_llama31_come_fit2.sh +52 -0
- runs/vast-paper_revision-come-attn-fit-20261126-62646539/20261126-llama31-come-attn-mlp-batch/catalog/code/collect_come_batch_comparison.py +57 -0
- runs/vast-paper_revision-come-attn-fit-20261126-62646539/20261126-llama31-come-attn-mlp-batch/catalog/code/come.py +612 -0
- runs/vast-paper_revision-come-attn-fit-20261126-62646539/20261126-llama31-come-attn-mlp-batch/catalog/code/eval_llama31_8b_12bench.py +194 -0
- runs/vast-paper_revision-come-attn-fit-20261126-62646539/20261126-llama31-come-attn-mlp-batch/catalog/code/eval_llama31_fit_ablation_one.sh +63 -0
- runs/vast-paper_revision-come-attn-fit-20261126-62646539/20261126-llama31-come-attn-mlp-batch/catalog/code/evaluate_abprune_compact_ppl.py +187 -0
- runs/vast-paper_revision-come-attn-fit-20261126-62646539/20261126-llama31-come-attn-mlp-batch/catalog/code/evaluate_hchc_wikitext2_ppl.py +152 -0
- runs/vast-paper_revision-come-attn-fit-20261126-62646539/20261126-llama31-come-attn-mlp-batch/catalog/code/finalize_come_batch_report.py +128 -0
- runs/vast-paper_revision-come-attn-fit-20261126-62646539/20261126-llama31-come-attn-mlp-batch/catalog/code/fit_ablation_come.py +54 -0
- runs/vast-paper_revision-come-attn-fit-20261126-62646539/20261126-llama31-come-attn-mlp-batch/catalog/code/fuse_layers.py +0 -0
- runs/vast-paper_revision-come-attn-fit-20261126-62646539/20261126-llama31-come-attn-mlp-batch/catalog/code/fuse_layers_distill.py +0 -0
- runs/vast-paper_revision-come-attn-fit-20261126-62646539/20261126-llama31-come-attn-mlp-batch/catalog/code/inspect_come_batch_run.py +32 -0
- runs/vast-paper_revision-come-attn-fit-20261126-62646539/20261126-llama31-come-attn-mlp-batch/catalog/code/launch_come_batch_comparison.py +244 -0
- runs/vast-paper_revision-come-attn-fit-20261126-62646539/20261126-llama31-come-attn-mlp-batch/catalog/code/launch_llama31_come_fit2.sh +123 -0
- runs/vast-paper_revision-come-attn-fit-20261126-62646539/20261126-llama31-come-attn-mlp-batch/catalog/code/monitor_come_batch_local.ps1 +24 -0
- runs/vast-paper_revision-come-attn-fit-20261126-62646539/20261126-llama31-come-attn-mlp-batch/catalog/code/offline_eval_policy.py +26 -0
- runs/vast-paper_revision-come-attn-fit-20261126-62646539/20261126-llama31-come-attn-mlp-batch/catalog/code/package_final_fit_backup.py +60 -0
- runs/vast-paper_revision-come-attn-fit-20261126-62646539/20261126-llama31-come-attn-mlp-batch/catalog/code/prepare_come_batch_calibration.py +48 -0
- runs/vast-paper_revision-come-attn-fit-20261126-62646539/20261126-llama31-come-attn-mlp-batch/catalog/code/prepare_lmeval9_local_cache.py +108 -0
- runs/vast-paper_revision-come-attn-fit-20261126-62646539/20261126-llama31-come-attn-mlp-batch/catalog/code/prepare_offline_ppl_cache.py +30 -0
- runs/vast-paper_revision-come-attn-fit-20261126-62646539/20261126-llama31-come-attn-mlp-batch/catalog/code/project_commit.txt +1 -0
- runs/vast-paper_revision-come-attn-fit-20261126-62646539/20261126-llama31-come-attn-mlp-batch/catalog/code/run_come_batch_arm.sh +36 -0
- runs/vast-paper_revision-come-attn-fit-20261126-62646539/20261126-llama31-come-attn-mlp-batch/catalog/code/run_external_abprune_instruct_order.py +140 -0
- runs/vast-paper_revision-come-attn-fit-20261126-62646539/20261126-llama31-come-attn-mlp-batch/catalog/code/run_llama31_base_fit_ablation.py +689 -0
- runs/vast-paper_revision-come-attn-fit-20261126-62646539/20261126-llama31-come-attn-mlp-batch/catalog/code/run_llama31_come_fit_arm.sh +37 -0
- runs/vast-paper_revision-come-attn-fit-20261126-62646539/20261126-llama31-come-attn-mlp-batch/catalog/code/source_feature_transport.py +342 -0
- runs/vast-paper_revision-come-attn-fit-20261126-62646539/20261126-llama31-come-attn-mlp-batch/catalog/code/validate_native_come_replay.py +45 -0
- runs/vast-paper_revision-come-attn-fit-20261126-62646539/20261126-llama31-come-attn-mlp-batch/catalog/code/verify_public_experiment_backups.py +105 -0
- runs/vast-paper_revision-come-attn-fit-20261126-62646539/20261126-llama31-come-attn-mlp-batch/catalog/comparison.csv +8 -0
- runs/vast-paper_revision-come-attn-fit-20261126-62646539/20261126-llama31-come-attn-mlp-batch/catalog/comparison.json +94 -0
- runs/vast-paper_revision-come-attn-fit-20261126-62646539/20261126-llama31-come-attn-mlp-batch/catalog/manifest.json +432 -0
- runs/vast-paper_revision-come-attn-fit-20261126-62646539/20261126-llama31-come-attn-mlp-batch/catalog/project_commit.txt +1 -0
- runs/vast-paper_revision-come-attn-fit-20261126-62646539/20261126-llama31-come-attn-mlp-batch/catalog/report_ko.md +172 -0
- runs/vast-paper_revision-come-attn-fit-20261126-62646539/20261126-llama31-come-attn-mlp-batch/catalog/results/backup_audit.json +31 -0
- runs/vast-paper_revision-come-attn-fit-20261126-62646539/20261126-llama31-come-attn-mlp-batch/catalog/results/batch1/audit/cycle_01_fit.json +389 -0
- runs/vast-paper_revision-come-attn-fit-20261126-62646539/20261126-llama31-come-attn-mlp-batch/catalog/results/batch1/audit/cycle_02_fit.json +389 -0
- runs/vast-paper_revision-come-attn-fit-20261126-62646539/20261126-llama31-come-attn-mlp-batch/catalog/results/batch1/audit/cycle_03_fit.json +390 -0
- runs/vast-paper_revision-come-attn-fit-20261126-62646539/20261126-llama31-come-attn-mlp-batch/catalog/results/batch1/audit/cycle_04_fit.json +389 -0
- runs/vast-paper_revision-come-attn-fit-20261126-62646539/20261126-llama31-come-attn-mlp-batch/catalog/results/batch1/audit/cycle_05_fit.json +389 -0
- runs/vast-paper_revision-come-attn-fit-20261126-62646539/20261126-llama31-come-attn-mlp-batch/catalog/results/batch1/audit/cycle_06_fit.json +390 -0
- runs/vast-paper_revision-come-attn-fit-20261126-62646539/20261126-llama31-come-attn-mlp-batch/catalog/results/batch1/audit/cycle_07_fit.json +390 -0
- runs/vast-paper_revision-come-attn-fit-20261126-62646539/20261126-llama31-come-attn-mlp-batch/catalog/results/batch1/audit/cycle_08_fit.json +391 -0
- runs/vast-paper_revision-come-attn-fit-20261126-62646539/20261126-llama31-come-attn-mlp-batch/catalog/results/batch1/audit/data_fingerprints.json +14 -0
- runs/vast-paper_revision-come-attn-fit-20261126-62646539/20261126-llama31-come-attn-mlp-batch/catalog/results/batch1/audit/selection.json +563 -0
- runs/vast-paper_revision-come-attn-fit-20261126-62646539/20261126-llama31-come-attn-mlp-batch/catalog/results/batch1/audit/selection_inputs.json +6 -0
- runs/vast-paper_revision-come-attn-fit-20261126-62646539/20261126-llama31-come-attn-mlp-batch/catalog/results/batch1/compact_metadata.json +91 -0
runs/vast-paper_revision-come-attn-fit-20261126-62646539/20261126-llama31-come-attn-mlp-batch/catalog/README.md
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Llama-3.1-8B Base native CoMe25%: matched attention+MLP FiT batch1 vs8.
|
| 2 |
+
|
| 3 |
+
Bench12 excludes MMLU/CMMLU; scores and historical MLP-only controls are recorded separately in comparison.csv. Raw evaluations, all16stage audits, exact data hashes, code, model backup receipts and independent immutable hash audits are included. Reconstructible compact weights are in the separate immutable model paths in summary.json, not duplicated here. Frozen norms; attention4+MLP3 trainable; no raw data/token caches, credentials or Git history. Instance62646539 explicitly retained running; completion does not authorize return.
|
runs/vast-paper_revision-come-attn-fit-20261126-62646539/20261126-llama31-come-attn-mlp-batch/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-llama31-come-attn-mlp-batch/batch1",
|
| 8 |
+
"revision": "3754f1bdd3c1072c7b09cb594924d2a2a2ef0968",
|
| 9 |
+
"files": 63,
|
| 10 |
+
"bytes": 1746484403,
|
| 11 |
+
"manifest_sha256": "85f2ad7169ec1ea3ec2a9aa5955206ea0cba223ed74e724b126885d45a688144",
|
| 12 |
+
"all_payload_hashes_verified": true,
|
| 13 |
+
"lfs_files": 4,
|
| 14 |
+
"git_blob_files_read_back": 59,
|
| 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-llama31-come-attn-mlp-batch/batch_large",
|
| 21 |
+
"revision": "6bddb1e37c9958bcd5b726d45aa3191b5128a912",
|
| 22 |
+
"files": 62,
|
| 23 |
+
"bytes": 1309850926,
|
| 24 |
+
"manifest_sha256": "9c26c94c632135bedb62b38c3b5bd6e2a637160a7f54f77e9c0f0af791d615fd",
|
| 25 |
+
"all_payload_hashes_verified": true,
|
| 26 |
+
"lfs_files": 3,
|
| 27 |
+
"git_blob_files_read_back": 59,
|
| 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-llama31-come-attn-mlp-batch/catalog/code/abprune_compact.py
ADDED
|
@@ -0,0 +1,284 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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-llama31-come-attn-mlp-batch/catalog/code/bootstrap_come_batch_comparison.sh
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env bash
|
| 2 |
+
set -euo pipefail
|
| 3 |
+
project="$1"; external="$2"; root="$3"; model="$4"
|
| 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
|
| 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' 'brotli>=1.2.0' 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 |
+
if git -C "$external" apply --check "$project/patches/abprune_transport_instruction_masks.patch"; then
|
| 25 |
+
git -C "$external" apply "$project/patches/abprune_transport_instruction_masks.patch"
|
| 26 |
+
fi
|
| 27 |
+
touch "$root/DEPS_READY"
|
| 28 |
+
python -m venv --system-site-packages "$root/legacy"
|
| 29 |
+
"$root/legacy/bin/python" -m pip install 'datasets==3.1.0' 'transformers==4.52.1' 'huggingface_hub==0.36.2'
|
| 30 |
+
while [[ ! -f "$root/PREFETCH_COMPLETE" ]]; do
|
| 31 |
+
kill -0 "$(cat "$root/prefetch.pid")" 2>/dev/null || { tail -n 15 "$root/prefetch.log"; exit 1; }
|
| 32 |
+
sleep 5
|
| 33 |
+
done
|
| 34 |
+
"$root/legacy/bin/python" "$project/scripts/prepare_come_batch_calibration.py" --model "$model" --output "$root/calibration"
|
| 35 |
+
python - <<'PY'
|
| 36 |
+
from datasets import load_dataset
|
| 37 |
+
load_dataset('DKYoon/SlimPajama-6B',split='train',revision='b5f90f419b7489cdba26fdbc8c022fcb5562f968',trust_remote_code=True)
|
| 38 |
+
load_dataset('Salesforce/wikitext','wikitext-2-raw-v1')
|
| 39 |
+
PY
|
| 40 |
+
python "$project/scripts/prepare_offline_ppl_cache.py" "$root"
|
| 41 |
+
python - "$root" <<'PY'
|
| 42 |
+
from pathlib import Path
|
| 43 |
+
import json,sys
|
| 44 |
+
r=Path(sys.argv[1]);policy=json.loads((r/'full/base/offline_eval.json').read_text())
|
| 45 |
+
for arm in ('batch1','batch_large'):
|
| 46 |
+
p=r/'full'/arm/'offline_eval.json';p.parent.mkdir(parents=True,exist_ok=True);p.write_text(json.dumps(policy,indent=2)+'\n')
|
| 47 |
+
PY
|
| 48 |
+
touch "$root/BOOTSTRAP_COMPLETE"
|
runs/vast-paper_revision-come-attn-fit-20261126-62646539/20261126-llama31-come-attn-mlp-batch/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-llama31-come-attn-mlp-batch/catalog/code/collect_come_batch_comparison.py
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""Summarize both FiT batches without mixing Bench12 with MMLU/CMMLU."""
|
| 2 |
+
import argparse
|
| 3 |
+
import json
|
| 4 |
+
import math
|
| 5 |
+
from pathlib import Path
|
| 6 |
+
|
| 7 |
+
p = argparse.ArgumentParser()
|
| 8 |
+
p.add_argument("root", type=Path)
|
| 9 |
+
p.add_argument("--output", type=Path)
|
| 10 |
+
p.add_argument("--fit-scope", choices=("mlp", "attention_mlp"), default="mlp")
|
| 11 |
+
a = p.parse_args()
|
| 12 |
+
rows = []
|
| 13 |
+
for arm in ("batch1", "batch_large"):
|
| 14 |
+
run = a.root / "full" / arm
|
| 15 |
+
bench = json.loads((run / "eval/final_14bench.json").read_text())
|
| 16 |
+
scores = bench["task_scores"]
|
| 17 |
+
tasks = [k for k in scores if k not in ("mmlu", "cmmlu")]
|
| 18 |
+
assert len(tasks) == 12
|
| 19 |
+
assert all(math.isfinite(v) and 0 <= v <= 1 for v in scores.values())
|
| 20 |
+
fits = [json.loads((run / "audit" / f"cycle_{i:02d}_fit.json").read_text())
|
| 21 |
+
for i in range(1, 9)]
|
| 22 |
+
provenance = json.loads((run / "audit/data_fingerprints.json").read_text())
|
| 23 |
+
ppl = json.loads((run / "eval/final_ppl.json").read_text())
|
| 24 |
+
metrics = ppl.get("metrics", ppl)
|
| 25 |
+
value = next((metrics[k] for k in ("ppl", "perplexity") if k in metrics), None)
|
| 26 |
+
if value is None:
|
| 27 |
+
raise ValueError("Missing PPL in final_ppl.json")
|
| 28 |
+
assert math.isfinite(value) and value > 0
|
| 29 |
+
batch = fits[0]["runtime"]["batch_size"]
|
| 30 |
+
rows.append({"arm": arm, "batch_size": batch,
|
| 31 |
+
"bench12": sum(scores[k] for k in tasks) / 12,
|
| 32 |
+
"mmlu": scores["mmlu"], "cmmlu": scores["cmmlu"], "ppl": value,
|
| 33 |
+
"task_scores": scores,
|
| 34 |
+
"training_wall_seconds": json.loads((run / "training_elapsed.json").read_text())["wall_seconds"],
|
| 35 |
+
"fit_seconds": sum(f["runtime"]["seconds"] for f in fits),
|
| 36 |
+
"peak_allocated_bytes": max(f["runtime"]["peak_allocated_bytes"] for f in fits),
|
| 37 |
+
"peak_reserved_bytes": max(f["runtime"]["peak_reserved_bytes"] for f in fits),
|
| 38 |
+
"optimizer_updates_per_stage": 512 // batch,
|
| 39 |
+
"fit_input_sha256": provenance["distill_loader"]["sha256"],
|
| 40 |
+
"fit_mask_sha256": provenance["distill_loader"]["attention_mask_sha256"],
|
| 41 |
+
"selection_input_sha256": json.loads((run / "audit/selection_inputs.json").read_text())["input_ids_sha256"],
|
| 42 |
+
"cycles": fits,
|
| 43 |
+
"selection_trace": json.loads((run / "audit/selection.json").read_text()),
|
| 44 |
+
"backup": json.loads((a.root / f"{arm}_backup.json").read_text())})
|
| 45 |
+
assert rows[0]["fit_input_sha256"] == rows[1]["fit_input_sha256"]
|
| 46 |
+
assert rows[0]["fit_mask_sha256"] == rows[1]["fit_mask_sha256"]
|
| 47 |
+
assert rows[0]["selection_input_sha256"] == rows[1]["selection_input_sha256"]
|
| 48 |
+
result = {"model": "meta-llama/Llama-3.1-8B", "removed_blocks": 8,
|
| 49 |
+
"method": "native CoMe plus stagewise " + ("attention+MLP FiT with frozen norms" if a.fit_scope == "attention_mlp" else "MLP-only FiT"),
|
| 50 |
+
"fit_scope": a.fit_scope, "accuracy_scale": "fraction",
|
| 51 |
+
"profile": json.loads((a.root / "batch_profile.json").read_text()), "rows": rows,
|
| 52 |
+
"qualification": "Same calibration and FiT examples/epochs/LR/loss; larger batch has fewer updates and may alter later pair selections"}
|
| 53 |
+
output = a.output or a.root / "summary.json"
|
| 54 |
+
output.parent.mkdir(parents=True, exist_ok=True)
|
| 55 |
+
output.write_text(json.dumps(result, indent=2) + "\n")
|
| 56 |
+
for row in rows:
|
| 57 |
+
print({k: row[k] for k in ("arm", "batch_size", "bench12", "mmlu", "cmmlu", "ppl", "training_wall_seconds")})
|
runs/vast-paper_revision-come-attn-fit-20261126-62646539/20261126-llama31-come-attn-mlp-batch/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 |
+
modeling_utils.DTensor = DTensor
|
runs/vast-paper_revision-come-attn-fit-20261126-62646539/20261126-llama31-come-attn-mlp-batch/catalog/code/eval_llama31_8b_12bench.py
ADDED
|
@@ -0,0 +1,194 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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-llama31-come-attn-mlp-batch/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-llama31-come-attn-mlp-batch/catalog/code/evaluate_abprune_compact_ppl.py
ADDED
|
@@ -0,0 +1,187 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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-llama31-come-attn-mlp-batch/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-llama31-come-attn-mlp-batch/catalog/code/finalize_come_batch_report.py
ADDED
|
@@ -0,0 +1,128 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""Register the completed two-arm experiment and write a precise comparison CSV."""
|
| 2 |
+
import csv
|
| 3 |
+
import argparse
|
| 4 |
+
import json
|
| 5 |
+
from pathlib import Path
|
| 6 |
+
import shutil
|
| 7 |
+
import subprocess
|
| 8 |
+
|
| 9 |
+
repo = Path(__file__).resolve().parents[1]
|
| 10 |
+
p = argparse.ArgumentParser(description=__doc__)
|
| 11 |
+
p.add_argument("--fit-scope", choices=("mlp", "attention_mlp"), default="mlp")
|
| 12 |
+
args = p.parse_args()
|
| 13 |
+
attention = args.fit_scope == "attention_mlp"
|
| 14 |
+
result_name = "llama31_come_attn_mlp_batch_20261126" if attention else "llama31_come_batch_20261126"
|
| 15 |
+
state_name = "come-attn-fit-20261126" if attention else "come-fit-batch-20261126"
|
| 16 |
+
note_name = "2026-11-26_llama31-come-attn-mlp-batch-comparison.md" if attention else "2026-11-26_llama31-come-mlp-batch-comparison.md"
|
| 17 |
+
session = "vast-paper_revision-come-attn-fit-20261126-62646539" if attention else "vast-paper_revision-come-fit-batch-20261126-62635207"
|
| 18 |
+
instance_id = 62646539 if attention else 62635207
|
| 19 |
+
root = repo / "results" / result_name
|
| 20 |
+
summary = json.loads((root / "summary.json").read_text(encoding="utf-8"))
|
| 21 |
+
assert summary.get("fit_scope", "mlp") == args.fit_scope
|
| 22 |
+
journal_commit = subprocess.check_output(["git", "rev-parse", "HEAD"], cwd=repo, text=True).strip()
|
| 23 |
+
|
| 24 |
+
def catalog_row(path, record):
|
| 25 |
+
with path.open(encoding="utf-8-sig", newline="") as stream:
|
| 26 |
+
return next(r for r in csv.DictReader(stream) if r["record_id"] == record)
|
| 27 |
+
|
| 28 |
+
come = catalog_row(repo / "results/laco_come_experiment_catalog.csv", "llama31_base_come_allowrepeat_8block")
|
| 29 |
+
ab = catalog_row(repo / "results/instruct_pruning_experiment_catalog.csv", "llama31_base_transport_8block")
|
| 30 |
+
nofit = next(r for r in json.loads((repo / "results/llama31_base_nofit_transport_bench14_20261009/summary.json").read_text())["rows"] if r["transport"] == "on")
|
| 31 |
+
references = [
|
| 32 |
+
{"method": "CoMe", "fit_batch": None, "bench12": float(come["zs12_mean"]),
|
| 33 |
+
"mmlu": float(come["mmlu"]), "cmmlu": float(come["cmmlu"]), "ppl": float(come["ppl"]),
|
| 34 |
+
"source": "llama31_base_come_allowrepeat_8block", "new_run": False},
|
| 35 |
+
{"method": "ABPrune without FiT", "fit_batch": None, "bench12": nofit["zs12"],
|
| 36 |
+
"mmlu": nofit["mmlu"], "cmmlu": nofit["cmmlu"], "ppl": nofit["ppl"],
|
| 37 |
+
"source": "llama31_base_nofit_transport_bench14_20261009/on", "new_run": False},
|
| 38 |
+
{"method": "ABPrune + FiT", "fit_batch": 1, "bench12": float(ab["zs12_mean"]),
|
| 39 |
+
"mmlu": float(ab["mmlu"]), "cmmlu": float(ab["cmmlu"]), "ppl": float(ab["ppl"]),
|
| 40 |
+
"source": "llama31_base_transport_8block", "new_run": False},
|
| 41 |
+
]
|
| 42 |
+
if attention:
|
| 43 |
+
prior = json.loads((repo / "results/llama31_come_batch_20261126/summary.json").read_text(encoding="utf-8"))
|
| 44 |
+
references += [{"method": "CoMe + MLP FiT", "fit_scope": "mlp", "fit_batch": row["batch_size"],
|
| 45 |
+
**{k: row[k] for k in ("bench12", "mmlu", "cmmlu", "ppl", "training_wall_seconds")},
|
| 46 |
+
"source": "llama31_come_batch_20261126/" + row["arm"], "new_run": False,
|
| 47 |
+
"hf_path": row["backup"]["path_in_repo"], "hf_revision": row["backup"]["revision"]} for row in prior["rows"]]
|
| 48 |
+
comparison = references + [{
|
| 49 |
+
"method": "CoMe + attention/MLP FiT" if attention else "CoMe + MLP FiT",
|
| 50 |
+
"fit_scope": args.fit_scope, "fit_batch": row["batch_size"],
|
| 51 |
+
**{k: row[k] for k in ("bench12", "mmlu", "cmmlu", "ppl", "training_wall_seconds")},
|
| 52 |
+
"source": result_name + "/" + row["arm"], "new_run": True,
|
| 53 |
+
"hf_path": row["backup"]["path_in_repo"], "hf_revision": row["backup"]["revision"],
|
| 54 |
+
} for row in summary["rows"]]
|
| 55 |
+
(root / "comparison.json").write_text(json.dumps({"rows": comparison,
|
| 56 |
+
"accuracy_scale": "fraction", "model": "Llama-3.1-8B Base", "removed_blocks": 8,
|
| 57 |
+
"reference_rows": "Historical results, not fresh benchmark reruns"}, indent=2) + "\n", encoding="utf-8")
|
| 58 |
+
with (root / "comparison.csv").open("w", encoding="utf-8-sig", newline="") as stream:
|
| 59 |
+
fields = ["method", "fit_scope", "fit_batch", "bench12_pct", "mmlu_pct", "cmmlu_pct", "ppl",
|
| 60 |
+
"training_wall_seconds", "new_run", "source", "hf_revision"]
|
| 61 |
+
writer = csv.DictWriter(stream, fields)
|
| 62 |
+
writer.writeheader()
|
| 63 |
+
for row in comparison:
|
| 64 |
+
record = {k: row.get(k, "") for k in fields}
|
| 65 |
+
record.update({k + "_pct": row[k] * 100 for k in ("bench12", "mmlu", "cmmlu")})
|
| 66 |
+
writer.writerow(record)
|
| 67 |
+
|
| 68 |
+
audit_source = repo / "outputs" / state_name / "model_backup_audit.json"
|
| 69 |
+
audit = json.loads(audit_source.read_text(encoding="utf-8"))
|
| 70 |
+
assert audit["verified"] and len(audit["records"]) == 2
|
| 71 |
+
assert all(r["all_payload_hashes_verified"] for r in audit["records"])
|
| 72 |
+
shutil.copy2(audit_source, root / "backup_audit.json")
|
| 73 |
+
|
| 74 |
+
catalog = repo / "results/instruct_pruning_experiment_catalog.csv"
|
| 75 |
+
encoding = "utf-8-sig" if catalog.read_bytes().startswith(b"\xef\xbb\xbf") else "utf-8"
|
| 76 |
+
with catalog.open(encoding=encoding, newline="") as stream:
|
| 77 |
+
reader = csv.DictReader(stream)
|
| 78 |
+
fields, rows = reader.fieldnames, list(reader)
|
| 79 |
+
for row in summary["rows"]:
|
| 80 |
+
name, batch, receipt = row["arm"], row["batch_size"], row["backup"]
|
| 81 |
+
stem = "come_attn_mlp" if attention else "come_mlp"
|
| 82 |
+
record_id = f"llama31_base_{stem}_fit_batch{batch}_8block_20261126"
|
| 83 |
+
settings = {"method": "native stagewise CoMe + " + args.fit_scope + " FiT", "selection": {
|
| 84 |
+
"dataset": "DKYoon/SlimPajama-6B", "revision": "b5f90f419b7489cdba26fdbc8c022fcb5562f968",
|
| 85 |
+
"rows": 256, "packed_windows": 91, "sequence_length": 2048, "seed": 10,
|
| 86 |
+
"batch_size": 1, "minimum_retention": .97, "allow_repeat": True,
|
| 87 |
+
"metric": "angular_last", "input_ids_sha256": row["selection_input_sha256"]},
|
| 88 |
+
"training": {"samples": 512, "sequence_length": 1024, "tokens_per_stage": 524288,
|
| 89 |
+
"epochs_per_stage": 1, "batch_size": batch, "grad_accumulation": 1, "lr": 1e-4,
|
| 90 |
+
"weight_decay": 0, "clip": 1, "hidden_mse": 1, "mlp_mse": 1, "attention_mse": 0,
|
| 91 |
+
"kl_weight": .02, "temperature": 4, "seed": 42, "teacher": "previous_cycle",
|
| 92 |
+
"scope": args.fit_scope, "trainable_projection_tensors": 7 if attention else 3,
|
| 93 |
+
"norms_trainable": False, "input_ids_sha256": row["fit_input_sha256"], "mask_sha256": row["fit_mask_sha256"]}}
|
| 94 |
+
scores = row["task_scores"]
|
| 95 |
+
record = {key: "" for key in fields}
|
| 96 |
+
record.update({"record_id": record_id, "model_name": "meta-llama/Llama-3.1-8B",
|
| 97 |
+
"model_revision": "d04e592bb4f6aa9cfee91e2e20afa771667e1d4b", "model_variant": "Base",
|
| 98 |
+
"method": "CoMe+Attention+MLP-FiT" if attention else "CoMe+MLP-FiT", "blocks_removed": 8,
|
| 99 |
+
"selector": "Frozen historical SlimPajama256 native CoMe angular_last; dynamic reselection after FiT",
|
| 100 |
+
"removed_interval": "non-contiguous; see selection trace", "ppl": row["ppl"],
|
| 101 |
+
"zs12_count": 12, "zs12_mean": row["bench12"], "mmlu": row["mmlu"], "cmmlu": row["cmmlu"],
|
| 102 |
+
"macro14_mean": sum(scores.values()) / 14, "metric_scale": "accuracy_fraction_0_to_1",
|
| 103 |
+
"experiment_settings": f"Native CoMe256rows/91x2048/seed10; FiT512x1024/1epoch/LR1e-4/{args.fit_scope}/frozen-norms/batch{batch}/seed42",
|
| 104 |
+
"experiment_settings_json": json.dumps(settings, separators=(",", ":")),
|
| 105 |
+
"experiment_date": "2026-11-26", "status": "complete",
|
| 106 |
+
"storage_host": session, "vast_instance": instance_id,
|
| 107 |
+
"weight_path": f"/workspace/{state_name}/full/{name}/compact/stage_08",
|
| 108 |
+
"hf_backup_path": f"hf://LJYAI/paper_revision/{receipt['path_in_repo']}@{receipt['revision']}",
|
| 109 |
+
"backup_status": "verified_huggingface_backup", "journal_commit": journal_commit,
|
| 110 |
+
"code_commit": (root / name / "execution_commit.txt").read_text().strip(),
|
| 111 |
+
"protocol_path": f"hf://LJYAI/paper_revision/{receipt['path_in_repo']}/protocol.md@{receipt['revision']}",
|
| 112 |
+
"ppl_result_path": f"results/{result_name}/{name}/final_ppl.json",
|
| 113 |
+
"bench14_result_path": f"results/{result_name}/{name}/final_14bench.json",
|
| 114 |
+
"evaluation_protocol": "Packed WikiText2 seq2048 BF16; canonical OpenCompass5 full-prompt PPL; lm-eval0.4.12 zero-shot auto:4, full offline131 cache",
|
| 115 |
+
"experiment_log": "exp_md/" + note_name,
|
| 116 |
+
"notes": f"Paired batch comparison; exact shared native selection/FiT inputs; {512//batch}updates/stage; pruning wall{row['training_wall_seconds']}s. Native replay matches all8 historical scores and merge groups."})
|
| 117 |
+
record.update(scores)
|
| 118 |
+
record = {k: v for k, v in record.items() if k in fields}
|
| 119 |
+
rows = [r for r in rows if r["record_id"] != record_id] + [record]
|
| 120 |
+
with catalog.open("w", encoding=encoding, newline="") as stream:
|
| 121 |
+
writer = csv.DictWriter(stream, fields, quoting=csv.QUOTE_ALL, lineterminator="\n")
|
| 122 |
+
writer.writeheader()
|
| 123 |
+
writer.writerows(rows)
|
| 124 |
+
with catalog.open(encoding="utf-8-sig", newline="") as stream:
|
| 125 |
+
parsed = list(csv.reader(stream))
|
| 126 |
+
assert all(len(row) == len(fields) for row in parsed)
|
| 127 |
+
assert len({r["record_id"] for r in rows}) == len(rows)
|
| 128 |
+
print("FINAL_COMPARISON_AND_TWO_CANONICAL_RECORDS_WRITTEN")
|
runs/vast-paper_revision-come-attn-fit-20261126-62646539/20261126-llama31-come-attn-mlp-batch/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 |
+
return left, initial, audit
|
runs/vast-paper_revision-come-attn-fit-20261126-62646539/20261126-llama31-come-attn-mlp-batch/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-llama31-come-attn-mlp-batch/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-llama31-come-attn-mlp-batch/catalog/code/inspect_come_batch_run.py
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""Read-only compact progress snapshot for five-minute experiment checks."""
|
| 2 |
+
import argparse
|
| 3 |
+
import json
|
| 4 |
+
from pathlib import Path
|
| 5 |
+
import subprocess
|
| 6 |
+
import time
|
| 7 |
+
|
| 8 |
+
p = argparse.ArgumentParser()
|
| 9 |
+
p.add_argument("root", type=Path)
|
| 10 |
+
a = p.parse_args()
|
| 11 |
+
root = a.root
|
| 12 |
+
snapshot = {"utc": time.strftime("%Y-%m-%dT%H:%M:%SZ", time.gmtime()),
|
| 13 |
+
"status": json.loads((root / "status.json").read_text()), "arms": {}}
|
| 14 |
+
for name in ("batch1", "batch_large"):
|
| 15 |
+
r = root / "full" / name
|
| 16 |
+
audits = sorted((r / "audit").glob("cycle_*_fit.json"))
|
| 17 |
+
row = {"trained_cycles": len(audits), "training_complete": (r / "TRAIN_COMPLETE").exists(),
|
| 18 |
+
"evaluation_complete": (r / "EVAL_COMPLETE").exists(),
|
| 19 |
+
"backup_complete": (r / "BACKUP_COMPLETE").exists()}
|
| 20 |
+
for key, relative in (("training", "logs/train.log"), ("evaluation", "logs/eval14.log")):
|
| 21 |
+
log = r / relative
|
| 22 |
+
if log.exists():
|
| 23 |
+
lines = log.read_text(errors="replace").replace("\r", "\n").splitlines()
|
| 24 |
+
row[key + "_last_line"] = next((line for line in reversed(lines) if line.strip()), "")[-500:]
|
| 25 |
+
row[key + "_log_age_seconds"] = time.time() - log.stat().st_mtime
|
| 26 |
+
if audits:
|
| 27 |
+
fit = json.loads(audits[-1].read_text())
|
| 28 |
+
row["last_fit_runtime"] = fit.get("runtime")
|
| 29 |
+
snapshot["arms"][name] = row
|
| 30 |
+
snapshot["gpu"] = subprocess.check_output(
|
| 31 |
+
["nvidia-smi", "--query-gpu=index,utilization.gpu,memory.used", "--format=csv,noheader"], text=True).splitlines()
|
| 32 |
+
print(json.dumps(snapshot, ensure_ascii=True))
|
runs/vast-pa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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""Run only the two user-requested Llama CoMe arms, then evaluate and back up."""
|
| 2 |
+
import argparse
|
| 3 |
+
from concurrent.futures import ThreadPoolExecutor
|
| 4 |
+
import json
|
| 5 |
+
import os
|
| 6 |
+
from pathlib import Path
|
| 7 |
+
import shutil
|
| 8 |
+
import subprocess
|
| 9 |
+
import sys
|
| 10 |
+
import threading
|
| 11 |
+
import time
|
| 12 |
+
|
| 13 |
+
p = argparse.ArgumentParser()
|
| 14 |
+
p.add_argument("--project", type=Path, required=True)
|
| 15 |
+
p.add_argument("--external", type=Path, required=True)
|
| 16 |
+
p.add_argument("--root", type=Path, required=True)
|
| 17 |
+
p.add_argument("--model", required=True)
|
| 18 |
+
p.add_argument("--session", required=True)
|
| 19 |
+
p.add_argument("--fit-scope", choices=("mlp", "attention_mlp"), default="mlp")
|
| 20 |
+
p.add_argument("--experiment-id", default="20261126-llama31-come-mlp-batch")
|
| 21 |
+
p.add_argument("--protocol", default="exp_md/2026-11-26_llama31-come-mlp-batch-comparison.md")
|
| 22 |
+
p.add_argument("--larger-batch", type=int, default=0,
|
| 23 |
+
help="Require this larger physical batch after profiling; zero selects measured fastest")
|
| 24 |
+
p.add_argument("--expected-selection-hash")
|
| 25 |
+
a = p.parse_args()
|
| 26 |
+
root = a.root
|
| 27 |
+
attention_count = 4 if a.fit_scope == "attention_mlp" else 0
|
| 28 |
+
scope_flag = "--fit-come-attention" if attention_count else "--fit-come-mlp"
|
| 29 |
+
env = dict(os.environ, HF_HOME="/workspace/.hf_home", HF_TOKEN_PATH="/root/.cache/huggingface/token",
|
| 30 |
+
HF_DATASETS_CACHE="/workspace/.hf_datasets36", HF_DATASETS_TRUST_REMOTE_CODE="1",
|
| 31 |
+
PYTHONUNBUFFERED="1", TOKENIZERS_PARALLELISM="false", OMP_NUM_THREADS="4",
|
| 32 |
+
PYTHONPATH=f"{a.project}/src:{a.external}/src")
|
| 33 |
+
state = {"experiment": a.experiment_id, "session": a.session, "fit_scope": a.fit_scope,
|
| 34 |
+
"instance_return_policy": "explicit_user_instruction_only", "auto_return": False,
|
| 35 |
+
"scope": ["batch1", "batch_large"], "phase": "waiting_bootstrap", "arms": {}}
|
| 36 |
+
state_lock = threading.RLock()
|
| 37 |
+
stopping = threading.Event()
|
| 38 |
+
|
| 39 |
+
def save():
|
| 40 |
+
with state_lock:
|
| 41 |
+
state["updated_utc"] = time.strftime("%Y-%m-%dT%H:%M:%SZ", time.gmtime())
|
| 42 |
+
temp = root / "status.partial"
|
| 43 |
+
temp.write_text(json.dumps(state, indent=2) + "\n")
|
| 44 |
+
temp.replace(root / "status.json")
|
| 45 |
+
|
| 46 |
+
def run(command, log, gpu=None, check=True):
|
| 47 |
+
run_env = dict(env)
|
| 48 |
+
if gpu is not None:
|
| 49 |
+
run_env["CUDA_VISIBLE_DEVICES"] = str(gpu)
|
| 50 |
+
log.parent.mkdir(parents=True, exist_ok=True)
|
| 51 |
+
with log.open("a") as stream:
|
| 52 |
+
result = subprocess.run([str(x) for x in command], env=run_env, stdout=stream,
|
| 53 |
+
stderr=subprocess.STDOUT, cwd=a.project)
|
| 54 |
+
if check and result.returncode:
|
| 55 |
+
raise RuntimeError(f"Command failed ({result.returncode}); see {log}")
|
| 56 |
+
return result.returncode
|
| 57 |
+
|
| 58 |
+
def wait_marker(name):
|
| 59 |
+
while not (root / name).exists():
|
| 60 |
+
if stopping.is_set():
|
| 61 |
+
raise RuntimeError("Supervisor stopped after another preparation failure")
|
| 62 |
+
if (root / "BOOTSTRAP_FAILED").exists() or (root / "EVAL_PREP_FAILED").exists():
|
| 63 |
+
raise RuntimeError("Preparation failed; inspect retained logs")
|
| 64 |
+
time.sleep(5)
|
| 65 |
+
|
| 66 |
+
def training_command(out, batch, gpu, cycles=8, tokens=524288):
|
| 67 |
+
return ["bash", a.project / "scripts/run_come_batch_arm.sh", a.project, a.external,
|
| 68 |
+
out, a.model, root / "calibration/selection.pt", batch, gpu, cycles, tokens, a.fit_scope]
|
| 69 |
+
|
| 70 |
+
def prepare_eval():
|
| 71 |
+
try:
|
| 72 |
+
wait_marker("BOOTSTRAP_COMPLETE")
|
| 73 |
+
for name in ("opencompass5-data.tar.gz", "llama31-eval-cache-131-20261008.tar.gz"):
|
| 74 |
+
while not (root / "EVAL_ARCHIVES_READY").exists():
|
| 75 |
+
if stopping.is_set():
|
| 76 |
+
raise RuntimeError("Supervisor stopped")
|
| 77 |
+
time.sleep(5)
|
| 78 |
+
destination = root / ("eval_data" if name.startswith("opencompass") else "lmeval_cache")
|
| 79 |
+
destination.mkdir(exist_ok=True)
|
| 80 |
+
command = ["tar", "-xzf", root / name, "-C", destination]
|
| 81 |
+
if name.startswith("llama31-eval"):
|
| 82 |
+
command += ["--strip-components=1"]
|
| 83 |
+
run(command, root / "eval_prepare.log")
|
| 84 |
+
run([sys.executable, a.project / "scripts/prepare_lmeval9_local_cache.py",
|
| 85 |
+
root / "lmeval_cache", "--validate-local"], root / "eval_prepare.log")
|
| 86 |
+
(root / "EVAL_READY").touch()
|
| 87 |
+
except Exception:
|
| 88 |
+
(root / "EVAL_PREP_FAILED").touch()
|
| 89 |
+
raise
|
| 90 |
+
|
| 91 |
+
def complete_arm(name, batch, gpu):
|
| 92 |
+
out = root / "full" / name
|
| 93 |
+
out.mkdir(parents=True, exist_ok=True)
|
| 94 |
+
state["arms"][name] = {"phase": "training", "batch_size": batch, "gpu": gpu,
|
| 95 |
+
"started_utc": time.strftime("%Y-%m-%dT%H:%M:%SZ", time.gmtime())}
|
| 96 |
+
save()
|
| 97 |
+
if not (out / "TRAIN_COMPLETE").exists():
|
| 98 |
+
started = time.time()
|
| 99 |
+
run(training_command(out, batch, gpu), root / f"{name}_pipeline.log")
|
| 100 |
+
(out / "training_elapsed.json").write_text(json.dumps({
|
| 101 |
+
"wall_seconds": time.time() - started,
|
| 102 |
+
"completed_utc": time.strftime("%Y-%m-%dT%H:%M:%SZ", time.gmtime()),
|
| 103 |
+
}, indent=2) + "\n")
|
| 104 |
+
for cycle in range(1, 9):
|
| 105 |
+
fit = json.loads((out / "audit" / f"cycle_{cycle:02d}_fit.json").read_text())
|
| 106 |
+
assert fit["trained"] and fit["num_trainable_mlp_gates"] == 3
|
| 107 |
+
assert fit["num_trainable_attn_gates"] == attention_count and fit["num_trainable_other_gates"] == 0
|
| 108 |
+
if attention_count:
|
| 109 |
+
assert fit["ablation"]["frozen_norms_unchanged"] and not fit["ablation"]["norms_trainable"]
|
| 110 |
+
assert fit["ablation"]["attention_initialization"] == "CoMe_channel_merge"
|
| 111 |
+
assert fit["runtime"]["batch_size"] == batch and fit["runtime"]["dataset_tokens"] == 524288
|
| 112 |
+
assert fit["ablation"]["source_feature_transport"] is False
|
| 113 |
+
fingerprints = json.loads((out / "audit/data_fingerprints.json").read_text())
|
| 114 |
+
assert fingerprints["distill_loader"]["sha256"] == "2b2d044c8c040f67891817ecc110f0fa0de2f469db4c6731114ff7816bbf1cd0"
|
| 115 |
+
state["arms"][name]["phase"] = "evaluation"
|
| 116 |
+
save()
|
| 117 |
+
(out / "eval").mkdir(exist_ok=True)
|
| 118 |
+
if not (out / "eval/final_ppl.json").exists():
|
| 119 |
+
run([sys.executable, a.project / "scripts/evaluate_abprune_compact_ppl.py",
|
| 120 |
+
"--model", a.model, "--revision", "d04e592bb4f6aa9cfee91e2e20afa771667e1d4b",
|
| 121 |
+
"--compact-stage", out / "compact/stage_08", "--anchor", 21, "--cycles", 8,
|
| 122 |
+
"--original-layers", 32, "--seq-len", 2048, "--batch-size", 8,
|
| 123 |
+
"--output", out / "eval/final_ppl.json"], root / f"{name}_ppl.log", gpu)
|
| 124 |
+
wait_marker("EVAL_READY")
|
| 125 |
+
eval_env = dict(env, LMEVAL_LOCAL_CACHE=str(root / "lmeval_cache"),
|
| 126 |
+
MODEL_REVISION="d04e592bb4f6aa9cfee91e2e20afa771667e1d4b")
|
| 127 |
+
log = root / f"{name}_eval.log"
|
| 128 |
+
with log.open("a") as stream:
|
| 129 |
+
subprocess.run(["bash", str(a.project / "scripts/eval_llama31_fit_ablation_one.sh"),
|
| 130 |
+
str(a.project), str(out), a.model, str(root / "eval_data/data"),
|
| 131 |
+
sys.executable, "21", "8", str(gpu)], env=eval_env,
|
| 132 |
+
stdout=stream, stderr=subprocess.STDOUT, check=True)
|
| 133 |
+
(out / "EVAL_COMPLETE").touch()
|
| 134 |
+
state["arms"][name]["phase"] = "backup"
|
| 135 |
+
save()
|
| 136 |
+
backup = root / "backup" / name
|
| 137 |
+
if not backup.exists():
|
| 138 |
+
run([sys.executable, a.project / "scripts/package_final_fit_backup.py", out, backup,
|
| 139 |
+
a.project, a.external, "--protocol", a.protocol],
|
| 140 |
+
root / f"{name}_backup.log")
|
| 141 |
+
# Package the real new launcher and calibration provenance, never raw token caches.
|
| 142 |
+
for filename in ("launch_come_batch_comparison.py", "run_come_batch_arm.sh",
|
| 143 |
+
"prepare_come_batch_calibration.py", "validate_native_come_replay.py",
|
| 144 |
+
"bootstrap_come_batch_comparison.sh", "collect_come_batch_comparison.py"):
|
| 145 |
+
shutil.copy2(a.project / "scripts" / filename, backup / "code" / filename)
|
| 146 |
+
shutil.copy2(root / "calibration/selection.json", backup / "selection_provenance.json")
|
| 147 |
+
shutil.copy2(root / "native_replay.json", backup / "native_replay.json")
|
| 148 |
+
shutil.copy2(root / "batch_profile.json", backup / "batch_profile.json")
|
| 149 |
+
shutil.copy2(out / "training_elapsed.json", backup / "training_elapsed.json")
|
| 150 |
+
(backup / "code/project_commit.txt").write_text(subprocess.check_output(
|
| 151 |
+
["git", "rev-parse", "HEAD"], cwd=a.project, text=True))
|
| 152 |
+
run([sys.executable, a.project / "scripts/write_tree_manifest.py", backup], root / f"{name}_backup.log")
|
| 153 |
+
upload_env = dict(env, HF_HUB_OFFLINE="0", HF_DATASETS_OFFLINE="0", TRANSFORMERS_OFFLINE="0")
|
| 154 |
+
receipt = root / f"{name}_backup.json"
|
| 155 |
+
with receipt.open("w") as stream:
|
| 156 |
+
subprocess.run([sys.executable, str(a.project / "scripts/upload_verified_hf_tree.py"), str(backup),
|
| 157 |
+
"--repo-id", "LJYAI/paper_revision", "--path-in-repo",
|
| 158 |
+
f"runs/{a.session}/{a.experiment_id}/{name}",
|
| 159 |
+
"--commit-message", f"Matched native CoMe Llama Base {a.fit_scope} FiT {name}"],
|
| 160 |
+
env=upload_env, stdout=stream, check=True)
|
| 161 |
+
(out / "BACKUP_COMPLETE").touch()
|
| 162 |
+
state["arms"][name]["phase"] = "complete"
|
| 163 |
+
save()
|
| 164 |
+
|
| 165 |
+
save()
|
| 166 |
+
pool = ThreadPoolExecutor(max_workers=3)
|
| 167 |
+
eval_future = pool.submit(prepare_eval)
|
| 168 |
+
try:
|
| 169 |
+
wait_marker("BOOTSTRAP_COMPLETE")
|
| 170 |
+
selection = json.loads((root / "calibration/selection.json").read_text())
|
| 171 |
+
if a.expected_selection_hash:
|
| 172 |
+
assert selection["input_ids_sha256"] == a.expected_selection_hash, "Selection inputs differ from paired reference"
|
| 173 |
+
state["phase"] = "validation"
|
| 174 |
+
save()
|
| 175 |
+
run([sys.executable, "-m", "pytest", "-q", str(a.project / "tests/test_come.py")], root / "tests.log")
|
| 176 |
+
run([sys.executable, a.project / "scripts/run_llama31_base_fit_ablation.py",
|
| 177 |
+
"--external-root", a.external, "--initializer", "come", scope_flag,
|
| 178 |
+
"--audit-root", root / "algebra", "--self-test"], root / "tests.log", 0)
|
| 179 |
+
if not (root / "native_replay.json").exists():
|
| 180 |
+
run([root / "legacy/bin/python", a.project / "scripts/validate_native_come_replay.py",
|
| 181 |
+
"--model", a.model, "--selection", root / "calibration/selection.pt",
|
| 182 |
+
"--output", root / "native_replay.json"], root / "native_replay.log", 0)
|
| 183 |
+
assert json.loads((root / "native_replay.json").read_text())["passed"]
|
| 184 |
+
state["phase"] = "batch_profiling"
|
| 185 |
+
save()
|
| 186 |
+
profiles = []
|
| 187 |
+
for batch in (1, 2, 4, 8):
|
| 188 |
+
probe = root / "probes" / f"batch{batch}"
|
| 189 |
+
audit = probe / "audit/cycle_01_fit.json"
|
| 190 |
+
if (probe / "TRAIN_COMPLETE").exists() and audit.exists():
|
| 191 |
+
rc = 0
|
| 192 |
+
else:
|
| 193 |
+
rc = run(training_command(probe, batch, 1, cycles=1, tokens=65536),
|
| 194 |
+
root / "batch_profile.log", check=False)
|
| 195 |
+
row = {"batch_size": batch, "return_code": rc, "completed": rc == 0 and audit.exists()}
|
| 196 |
+
if row["completed"]:
|
| 197 |
+
fit = json.loads(audit.read_text())
|
| 198 |
+
assert fit["trained"] and fit["num_trainable_mlp_gates"] == 3
|
| 199 |
+
assert fit["num_trainable_attn_gates"] == attention_count
|
| 200 |
+
assert fit["num_trainable_other_gates"] == 0
|
| 201 |
+
assert fit["first_grad_summary"]["joint"]["u"]["num_tensors_without_grad"] == 0
|
| 202 |
+
assert len(fit["u_delta_summary"]["per_tensor"]) == 3 + attention_count
|
| 203 |
+
assert all(v["rms"] > 0 for v in fit["u_delta_summary"]["per_tensor"].values())
|
| 204 |
+
if attention_count:
|
| 205 |
+
assert fit["ablation"]["frozen_norms_unchanged"]
|
| 206 |
+
row.update(fit["runtime"])
|
| 207 |
+
row["memory_margin_bytes"] = row["gpu_total_bytes"] - row["peak_reserved_bytes"]
|
| 208 |
+
profiles.append(row)
|
| 209 |
+
(root / "batch_profile.json").write_text(json.dumps({"profiles": profiles}, indent=2) + "\n")
|
| 210 |
+
eligible = [r for r in profiles if r["completed"] and r["batch_size"] > 1 and
|
| 211 |
+
r["memory_margin_bytes"] >= 4 * 1024**3]
|
| 212 |
+
if not eligible:
|
| 213 |
+
raise RuntimeError("No larger batch met the measured memory margin")
|
| 214 |
+
if a.larger_batch:
|
| 215 |
+
if a.larger_batch not in {r["batch_size"] for r in eligible}:
|
| 216 |
+
raise RuntimeError("Requested larger batch did not meet profile/memory gates; do not change silently")
|
| 217 |
+
chosen = a.larger_batch
|
| 218 |
+
else:
|
| 219 |
+
chosen = max(eligible, key=lambda r: r["tokens_per_second"])["batch_size"]
|
| 220 |
+
profile = {"profiles": profiles, "selected_larger_batch": chosen,
|
| 221 |
+
"selection_rule": ("User comparison batch, successfully profiled with >=4GiB margin" if a.larger_batch else
|
| 222 |
+
"Fastest measured successful larger batch with >=4GiB margin"),
|
| 223 |
+
"training_updates_per_stage": {"batch1": 512, "batch_large": 512 // chosen}}
|
| 224 |
+
(root / "batch_profile.json").write_text(json.dumps(profile, indent=2) + "\n")
|
| 225 |
+
state["phase"] = "production"
|
| 226 |
+
state["larger_batch"] = chosen
|
| 227 |
+
save()
|
| 228 |
+
jobs = [pool.submit(complete_arm, "batch1", 1, 0),
|
| 229 |
+
pool.submit(complete_arm, "batch_large", chosen, 1)]
|
| 230 |
+
for job in jobs:
|
| 231 |
+
job.result()
|
| 232 |
+
eval_future.result()
|
| 233 |
+
state["phase"] = "complete"
|
| 234 |
+
save()
|
| 235 |
+
(root / "COMPLETE").touch()
|
| 236 |
+
except Exception as exc:
|
| 237 |
+
stopping.set()
|
| 238 |
+
state["phase"] = "failed"
|
| 239 |
+
state["error"] = str(exc)
|
| 240 |
+
save()
|
| 241 |
+
(root / "FAILED").touch()
|
| 242 |
+
raise
|
| 243 |
+
finally:
|
| 244 |
+
pool.shutdown(wait=False, cancel_futures=True)
|
runs/vast-paper_revision-come-attn-fit-20261126-62646539/20261126-llama31-come-attn-mlp-batch/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_revision-come-attn-fit-20261126-62646539/20261126-llama31-come-attn-mlp-batch/catalog/code/monitor_come_batch_local.ps1
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
[CmdletBinding()]
|
| 2 |
+
param(
|
| 3 |
+
[ValidatePattern('^[A-Za-z0-9._-]+$')][string]$HostAlias = 'vast-paper_revision-come-fit-batch-20261126-62635207',
|
| 4 |
+
[int]$IntervalSeconds = 300,
|
| 5 |
+
[ValidatePattern('^/[A-Za-z0-9._/-]+$')][string]$RemoteProject = '/workspace/paper_revision/sessions/vast-paper_revision-come-fit-batch-20261126-62635207',
|
| 6 |
+
[ValidatePattern('^/[A-Za-z0-9._/-]+$')][string]$RemoteRoot = '/workspace/come-fit-batch-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/come-fit-batch-20261126' }
|
| 13 |
+
[IO.Directory]::CreateDirectory($StateDirectory) | Out-Null
|
| 14 |
+
$log = Join-Path $StateDirectory 'progress.jsonl'
|
| 15 |
+
$remote = "python $RemoteProject/scripts/inspect_come_batch_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} phase={1} trained_cycles: batch1={2}/8 batch8={3}/8' -f $state.utc,$state.status.phase,$state.arms.batch1.trained_cycles,$state.arms.batch_large.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-llama31-come-attn-mlp-batch/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-llama31-come-attn-mlp-batch/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-llama31-come-attn-mlp-batch/catalog/code/prepare_come_batch_calibration.py
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""Freeze historical native CoMe inputs using its pinned legacy loader environment."""
|
| 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 |
+
p = argparse.ArgumentParser()
|
| 12 |
+
p.add_argument("--model", required=True)
|
| 13 |
+
p.add_argument("--output", type=Path, required=True)
|
| 14 |
+
a = p.parse_args()
|
| 15 |
+
a.output.mkdir(parents=True, exist_ok=True)
|
| 16 |
+
tokenizer = AutoTokenizer.from_pretrained(a.model, local_files_only=True)
|
| 17 |
+
revision = "b5f90f419b7489cdba26fdbc8c022fcb5562f968"
|
| 18 |
+
dataset = load_dataset("DKYoon/SlimPajama-6B", split="train", streaming=True,
|
| 19 |
+
revision=revision).shuffle(seed=10, buffer_size=10000)
|
| 20 |
+
tokens, documents = [], []
|
| 21 |
+
for index, row in enumerate(dataset):
|
| 22 |
+
text = row.get("text")
|
| 23 |
+
documents.append(hashlib.sha256((text or "").encode()).hexdigest())
|
| 24 |
+
if isinstance(text, str):
|
| 25 |
+
tokens.extend(tokenizer.encode(text, add_special_tokens=False))
|
| 26 |
+
if index == 255:
|
| 27 |
+
break
|
| 28 |
+
if len(documents) != 256:
|
| 29 |
+
raise ValueError("Incomplete historical source-row selection")
|
| 30 |
+
batches = []
|
| 31 |
+
checksum = hashlib.sha256()
|
| 32 |
+
for start in range(0, len(tokens) - 2047, 2048):
|
| 33 |
+
ids = torch.tensor(tokens[start:start + 2048], dtype=torch.long).unsqueeze(0)
|
| 34 |
+
checksum.update(ids.numpy().astype("<i8").tobytes())
|
| 35 |
+
batches.append({"input_ids": ids, "attention_mask": torch.ones_like(ids)})
|
| 36 |
+
if len(batches) != 91:
|
| 37 |
+
raise ValueError(f"Historical CoMe calibration expected 91 windows, got {len(batches)}")
|
| 38 |
+
torch.save(batches, a.output / "selection.pt")
|
| 39 |
+
import datasets, transformers
|
| 40 |
+
metadata = {"dataset": "DKYoon/SlimPajama-6B", "revision": revision,
|
| 41 |
+
"source_rows": 256, "packed_windows": len(batches), "sequence_length": 2048,
|
| 42 |
+
"seed": 10, "shuffle_buffer": 10000, "batch_size": 1,
|
| 43 |
+
"input_ids_sha256": checksum.hexdigest(), "document_sha256": documents,
|
| 44 |
+
"datasets_version": datasets.__version__, "transformers_version": transformers.__version__,
|
| 45 |
+
"historical_input_hash_available": False,
|
| 46 |
+
"validation": "Historical arguments and window count; native replay checked separately"}
|
| 47 |
+
(a.output / "selection.json").write_text(json.dumps(metadata, indent=2) + "\n")
|
| 48 |
+
print("FROZEN_NATIVE_COME_INPUTS", len(batches), checksum.hexdigest(), flush=True)
|
runs/vast-paper_revision-come-attn-fit-20261126-62646539/20261126-llama31-come-attn-mlp-batch/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-llama31-come-attn-mlp-batch/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-llama31-come-attn-mlp-batch/catalog/code/project_commit.txt
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
5a32aedf500e6155e6230845214ba8c65dde5957
|
runs/vast-paper_revision-come-attn-fit-20261126-62646539/20261126-llama31-come-attn-mlp-batch/catalog/code/run_come_batch_arm.sh
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env bash
|
| 2 |
+
set -euo pipefail
|
| 3 |
+
project="$1"; external="$2"; root="$3"; model="$4"; selection="$5"; batch="$6"; gpu="$7"
|
| 4 |
+
cycles="${8:-8}"; tokens="${9:-524288}"
|
| 5 |
+
scope="${10:-mlp}"; subset=mlp; scope_args=(--fit-come-mlp)
|
| 6 |
+
if [[ "$scope" == attention_mlp ]]; then subset=all; scope_args=(--fit-come-attention);
|
| 7 |
+
elif [[ "$scope" != mlp ]]; then exit 2; fi
|
| 8 |
+
export CUDA_VISIBLE_DEVICES="$gpu" HF_HOME=/workspace/.hf_home HF_TOKEN_PATH=/root/.cache/huggingface/token
|
| 9 |
+
export HF_DATASETS_CACHE=/workspace/.hf_datasets36 HF_DATASETS_TRUST_REMOTE_CODE=1
|
| 10 |
+
export HF_HUB_OFFLINE=1 HF_DATASETS_OFFLINE=1 TRANSFORMERS_OFFLINE=1
|
| 11 |
+
export PYTHONUNBUFFERED=1 TOKENIZERS_PARALLELISM=false OMP_NUM_THREADS=4
|
| 12 |
+
export PYTHONPATH="$external/src:$project/src${PYTHONPATH:+:$PYTHONPATH}"
|
| 13 |
+
export ABPRUNE_DATASET_REVISION=b5f90f419b7489cdba26fdbc8c022fcb5562f968
|
| 14 |
+
mkdir -p "$root/logs" "$root/audit" "$root/run"
|
| 15 |
+
selection_hash=$(python - "$selection" <<'PY'
|
| 16 |
+
import json,sys
|
| 17 |
+
from pathlib import Path
|
| 18 |
+
print(json.loads(Path(sys.argv[1]).with_suffix('.json').read_text())['input_ids_sha256'])
|
| 19 |
+
PY
|
| 20 |
+
)
|
| 21 |
+
python "$project/scripts/run_llama31_base_fit_ablation.py" \
|
| 22 |
+
--external-root "$external" --initializer come "${scope_args[@]}" --audit-root "$root/audit" \
|
| 23 |
+
--selection-data "$selection" --selection-hash "$selection_hash" --record-fit-runtime \
|
| 24 |
+
--model-id meta-llama/Llama-3.1-8B --base-revision d04e592bb4f6aa9cfee91e2e20afa771667e1d4b \
|
| 25 |
+
--come-minimum-retention .97 --come-power 1 --model "$model" --output_dir "$root/run" \
|
| 26 |
+
--layer 21 --num_progressive "$cycles" --dataset slimpajama --dataset_config none \
|
| 27 |
+
--target_tokens "$tokens" --num_samples 64 --seq_len 1024 --batch_size 2 \
|
| 28 |
+
--distill_seq_len 1024 --distill_batch_size "$batch" --distill_epochs 1 --distill_lr 1e-4 \
|
| 29 |
+
--distill_weight_decay 0 --distill_max_grad_norm 1 --distill_grad_accum_steps 1 \
|
| 30 |
+
--distill_kl_weight .02 --distill_kl_temp 4 --distill_hidden_mse_weight 1 \
|
| 31 |
+
--distill_mlp_mse_weight 1 --distill_attn_mse_weight 0 --reparam_eta 0 --reparam_gamma 0 \
|
| 32 |
+
--reparam_param_subset "$subset" --reparam_fisher_init_subset same --reparam_train_subset "$subset" \
|
| 33 |
+
--reparam_rho_objective none --reparam_additive_u --redistrib_teacher_source previous_cycle \
|
| 34 |
+
--fisher_mode param --eps 0 --no_head_permute_merge --no_head_permute_select \
|
| 35 |
+
--dtype bfloat16 --eval_dtype bfloat16 --lora_epochs 0 --skip_eval --skip_final_model_save \
|
| 36 |
+
--distill_log_steps 10 --seed 42 >> "$root/logs/train.log" 2>&1
|
runs/vast-paper_revision-come-attn-fit-20261126-62646539/20261126-llama31-come-attn-mlp-batch/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-llama31-come-attn-mlp-batch/catalog/code/run_llama31_base_fit_ablation.py
ADDED
|
@@ -0,0 +1,689 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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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, merges its seven projections, then fits only the three MLP weights.
|
| 6 |
+
The opt-in fixed-span-merge-only mode instead retains our selection/transport,
|
| 7 |
+
replaces just the three MLP initializers, and freezes anchor attention/norms.
|
| 8 |
+
No fake Fisher tensor is used to derive initialization; empty placeholders
|
| 9 |
+
only satisfy the unmodified engine's call signature. Audits mark this clearly.
|
| 10 |
+
"""
|
| 11 |
+
from __future__ import annotations
|
| 12 |
+
|
| 13 |
+
import argparse
|
| 14 |
+
import hashlib
|
| 15 |
+
import json
|
| 16 |
+
import math
|
| 17 |
+
import os
|
| 18 |
+
import sys
|
| 19 |
+
import time
|
| 20 |
+
from pathlib import Path
|
| 21 |
+
|
| 22 |
+
|
| 23 |
+
def install_exact_layer(distill, torch, state):
|
| 24 |
+
original = distill.ReparamMergedLayer
|
| 25 |
+
|
| 26 |
+
class ExactInitializationLayer(original):
|
| 27 |
+
def __init__(self, layer_a, layer_b, targets, **kwargs):
|
| 28 |
+
assert kwargs.get("additive_u"), "Controls require additive-U"
|
| 29 |
+
assert not kwargs.get("tensor_rho")
|
| 30 |
+
super().__init__(layer_a, layer_b, targets, **kwargs)
|
| 31 |
+
self.exact_lambda = float(state["lambda"])
|
| 32 |
+
self.initialization_errors = {}
|
| 33 |
+
self.fit_attention = bool(state.get("fit_attention", False))
|
| 34 |
+
self.fit_full_block = bool(state.get("fit_full_block", False))
|
| 35 |
+
self.fit_come_mlp = bool(state.get("fit_come_mlp", False))
|
| 36 |
+
self.fit_come_attention = bool(state.get("fit_come_attention", False))
|
| 37 |
+
fixed_merge_only = bool(state.get("fixed_span_merge_only", False))
|
| 38 |
+
fixed_initial = None
|
| 39 |
+
if fixed_merge_only:
|
| 40 |
+
from fusegpt.fixed_span_merge_init import MLP_NAMES, build_initialization
|
| 41 |
+
assert set(self._name_map) == set(MLP_NAMES), self._name_map
|
| 42 |
+
assert state.get("transport_completed"), "Initialize only after transport"
|
| 43 |
+
fixed_initial, fixed_audit = build_initialization(
|
| 44 |
+
layer_a, layer_b, state["initializer"], state["merge_payload"])
|
| 45 |
+
if ((state["initializer"] == "mka" and not fixed_merge_only) or
|
| 46 |
+
self.fit_attention or self.fit_come_attention):
|
| 47 |
+
from fusegpt.fit_ablation_mka import PROJECTION_WEIGHTS
|
| 48 |
+
for name, safe in list(self._name_map.items()):
|
| 49 |
+
if name not in PROJECTION_WEIGHTS:
|
| 50 |
+
del self._name_map[name]
|
| 51 |
+
del self.u[safe]
|
| 52 |
+
del self.gates[safe]
|
| 53 |
+
if (self.fit_come_mlp or self.fit_come_attention) and not fixed_merge_only:
|
| 54 |
+
assert len(self._name_map) == (7 if self.fit_come_attention else 3)
|
| 55 |
+
if self.fit_come_mlp:
|
| 56 |
+
assert all(n.startswith("mlp.") for n in self._name_map)
|
| 57 |
+
for name, initial in state["come_initial"].items():
|
| 58 |
+
if name not in self._name_map:
|
| 59 |
+
self.register_buffer("frozen_initial__" + name.replace(".", "__"),
|
| 60 |
+
initial.to(layer_a.get_parameter(name).device).clone(), persistent=False)
|
| 61 |
+
with torch.no_grad():
|
| 62 |
+
for name, safe in self._name_map.items():
|
| 63 |
+
a = layer_a.get_parameter(name).detach().float()
|
| 64 |
+
b = layer_b.get_parameter(name).detach().float()
|
| 65 |
+
# This is a fitting-scope ablation, not an attention merge.
|
| 66 |
+
# Keep anchor attention exactly; only MLP uses Wa/Wb lambda.
|
| 67 |
+
ratio = 1. if self.fit_attention and name.startswith("self_attn.") else self.exact_lambda
|
| 68 |
+
if fixed_merge_only:
|
| 69 |
+
initial = fixed_initial[name].to(a.device).clone()
|
| 70 |
+
elif state["initializer"] == "come":
|
| 71 |
+
initial = state["come_initial"][name].to(a.device).clone()
|
| 72 |
+
elif ratio == 1:
|
| 73 |
+
initial = a.clone()
|
| 74 |
+
elif ratio == 0:
|
| 75 |
+
initial = b.clone()
|
| 76 |
+
else:
|
| 77 |
+
initial = torch.lerp(b, a, ratio)
|
| 78 |
+
self.register_buffer("initial__" + safe, initial, persistent=False)
|
| 79 |
+
self.u[safe].zero_()
|
| 80 |
+
assert torch.isfinite(initial).all(), name
|
| 81 |
+
self.initialization_errors[name] = 0.0
|
| 82 |
+
state["initialization_audit"] = {
|
| 83 |
+
"lambda": self.exact_lambda, "endpoint_clamping": False,
|
| 84 |
+
"initial_u_nonzero": 0, "merged_parameters": list(self._name_map),
|
| 85 |
+
"parameterization": "W_initial + U_add", "fisher_computed": False,
|
| 86 |
+
"fit_scope": "full_block_including_norms" if self.fit_full_block else (
|
| 87 |
+
"attention_and_mlp" if self.fit_attention or self.fit_come_attention else "mlp"),
|
| 88 |
+
"attention_initialization": "CoMe_channel_merge" if state["initializer"] == "come" else (
|
| 89 |
+
"anchor_Wa" if self.fit_attention else (
|
| 90 |
+
"MKA_merge" if state["initializer"] == "mka" else "anchor_Wa")
|
| 91 |
+
),
|
| 92 |
+
}
|
| 93 |
+
if fixed_merge_only:
|
| 94 |
+
state["initialization_audit"].update({"fixed_span_merge_only": True,
|
| 95 |
+
"attention_initialization": "anchor_Wa", "norm_initialization": "anchor_Wa",
|
| 96 |
+
"norms_trainable": False, "initialized_parameters": list(self._name_map),
|
| 97 |
+
"selection_policy": state.get("selection_policy", "fixed_anchor21_remove_original_22_30"),
|
| 98 |
+
"merge_rule_audit": fixed_audit})
|
| 99 |
+
state.pop("merge_payload")
|
| 100 |
+
elif state["initializer"] == "come":
|
| 101 |
+
assert len(state["come_initial"]) == 9, "Pinned Llama block has7 projections and2 norms"
|
| 102 |
+
if self.fit_full_block:
|
| 103 |
+
assert set(self._name_map) == set(state["come_initial"]), "All block parameters must have U"
|
| 104 |
+
state["initialization_audit"].update({"lambda": None, "norm_initialization": "CoMe_pair_mean",
|
| 105 |
+
"CoMe": state["come_audit"], "norms_trainable": self.fit_full_block,
|
| 106 |
+
"initialized_parameters": list(state["come_initial"]),
|
| 107 |
+
"frozen_CoMe_parameters": [n for n in state["come_initial"] if n not in self._name_map]})
|
| 108 |
+
if self.fit_come_attention:
|
| 109 |
+
state["initialization_audit"]["frozen_norm_expected_sha256"] = {
|
| 110 |
+
n: hashlib.sha256(initial.to(dtype=layer_a.get_parameter(n).dtype).cpu().contiguous()
|
| 111 |
+
.view(torch.uint8).numpy().tobytes()).hexdigest()
|
| 112 |
+
for n, initial in state["come_initial"].items() if n not in self._name_map
|
| 113 |
+
}
|
| 114 |
+
assert len(state["initialization_audit"]["frozen_norm_expected_sha256"]) == 2
|
| 115 |
+
state.pop("come_initial")
|
| 116 |
+
|
| 117 |
+
def gate_lambdas(self):
|
| 118 |
+
return {name: torch.tensor(
|
| 119 |
+
1. if self.fit_attention and name.startswith("self_attn.") else self.exact_lambda,
|
| 120 |
+
device=self.u[safe].device)
|
| 121 |
+
for name, safe in self._name_map.items()}
|
| 122 |
+
|
| 123 |
+
def _merged_params(self):
|
| 124 |
+
result = {}
|
| 125 |
+
for name, param in self.layer_a.named_parameters():
|
| 126 |
+
safe = self._name_map.get(name)
|
| 127 |
+
frozen = getattr(self, "frozen_initial__" + name.replace(".", "__"), param.detach())
|
| 128 |
+
result[name] = (frozen.to(param.dtype) if safe is None else
|
| 129 |
+
(getattr(self, "initial__" + safe) + self.u[safe]).to(param.dtype))
|
| 130 |
+
return result
|
| 131 |
+
|
| 132 |
+
def materialize_into_layer_a(self):
|
| 133 |
+
with torch.no_grad():
|
| 134 |
+
for name, param in self.layer_a.named_parameters():
|
| 135 |
+
frozen = getattr(self, "frozen_initial__" + name.replace(".", "__"), None)
|
| 136 |
+
if frozen is not None:
|
| 137 |
+
param.copy_(frozen.to(param.dtype))
|
| 138 |
+
for name, safe in self._name_map.items():
|
| 139 |
+
param = self.layer_a.get_parameter(name)
|
| 140 |
+
param.copy_((getattr(self, "initial__" + safe) + self.u[safe]).to(param.dtype))
|
| 141 |
+
return len(self._name_map)
|
| 142 |
+
|
| 143 |
+
distill.ReparamMergedLayer = ExactInitializationLayer
|
| 144 |
+
# The old diagnostic names its reference "Fisher displacement". That is
|
| 145 |
+
# not the reference direction in these controls, so do not emit it.
|
| 146 |
+
distill._sequential_u_fisher_orthogonality = lambda layer: {}
|
| 147 |
+
return ExactInitializationLayer
|
| 148 |
+
|
| 149 |
+
|
| 150 |
+
def algebra_test(torch, distill):
|
| 151 |
+
class Layer(torch.nn.Module):
|
| 152 |
+
def __init__(self):
|
| 153 |
+
super().__init__()
|
| 154 |
+
self.mlp = torch.nn.Module()
|
| 155 |
+
self.mlp.up_proj = torch.nn.Linear(4, 5, bias=False)
|
| 156 |
+
|
| 157 |
+
torch.manual_seed(42)
|
| 158 |
+
state = {"initializer": "average", "lambda": .5}
|
| 159 |
+
cls = install_exact_layer(distill, torch, state)
|
| 160 |
+
a, b = Layer(), Layer()
|
| 161 |
+
for ratio in (0., .5, 1.):
|
| 162 |
+
state["lambda"] = ratio
|
| 163 |
+
layer = cls(a, b, {"mlp.up_proj.weight": ratio},
|
| 164 |
+
param_subset="mlp", additive_u=True)
|
| 165 |
+
actual = layer._merged_params()["mlp.up_proj.weight"]
|
| 166 |
+
expected = a.mlp.up_proj.weight if ratio == 1 else (
|
| 167 |
+
b.mlp.up_proj.weight if ratio == 0 else
|
| 168 |
+
torch.lerp(b.mlp.up_proj.weight, a.mlp.up_proj.weight, ratio))
|
| 169 |
+
expected = expected.detach().clone()
|
| 170 |
+
assert torch.equal(actual, expected)
|
| 171 |
+
actual.sum().backward()
|
| 172 |
+
u = layer.u["mlp__up_proj__weight"]
|
| 173 |
+
assert torch.equal(u.grad, torch.ones_like(u)), "Average must not mask FiT gradients"
|
| 174 |
+
with torch.no_grad():
|
| 175 |
+
u.add_(.01)
|
| 176 |
+
layer.materialize_into_layer_a()
|
| 177 |
+
assert torch.equal(a.mlp.up_proj.weight, expected + .01)
|
| 178 |
+
print("EXACT_INITIALIZATION_AND_AVERAGE_U_GRADIENT_OK", flush=True)
|
| 179 |
+
|
| 180 |
+
|
| 181 |
+
def attention_algebra_test(torch, distill):
|
| 182 |
+
class Layer(torch.nn.Module):
|
| 183 |
+
def __init__(self):
|
| 184 |
+
super().__init__()
|
| 185 |
+
self.self_attn = torch.nn.Module()
|
| 186 |
+
self.mlp = torch.nn.Module()
|
| 187 |
+
for name in ("q_proj", "k_proj", "v_proj", "o_proj"):
|
| 188 |
+
setattr(self.self_attn, name, torch.nn.Linear(4, 4, bias=False))
|
| 189 |
+
for name in ("gate_proj", "up_proj", "down_proj"):
|
| 190 |
+
setattr(self.mlp, name, torch.nn.Linear(4, 4, bias=False))
|
| 191 |
+
self.input_layernorm = torch.nn.LayerNorm(4)
|
| 192 |
+
|
| 193 |
+
state = {"initializer": "wa", "lambda": 1., "fit_attention": True}
|
| 194 |
+
cls = install_exact_layer(distill, torch, state)
|
| 195 |
+
for ratio in (0., 1.):
|
| 196 |
+
state["lambda"] = ratio
|
| 197 |
+
a, b = Layer(), Layer()
|
| 198 |
+
targets = {name: ratio for name, _ in a.named_parameters()}
|
| 199 |
+
layer = cls(a, b, targets, param_subset="all", additive_u=True)
|
| 200 |
+
assert len(layer._name_map) == 7
|
| 201 |
+
merged = layer._merged_params()
|
| 202 |
+
for name, safe in layer._name_map.items():
|
| 203 |
+
expected = (a if name.startswith("self_attn.") or ratio == 1 else b).get_parameter(name)
|
| 204 |
+
assert torch.equal(merged[name], expected.detach()), name
|
| 205 |
+
assert torch.equal(merged["input_layernorm.weight"], a.input_layernorm.weight)
|
| 206 |
+
sum(merged[name].sum() for name in layer._name_map).backward()
|
| 207 |
+
assert all(torch.equal(u.grad, torch.ones_like(u)) for u in layer.u.values())
|
| 208 |
+
print("ATTENTION_FIT_EXACT_ANCHOR_ATTENTION_MLP_ENDPOINTS_7_U_GRADIENTS_OK", flush=True)
|
| 209 |
+
|
| 210 |
+
|
| 211 |
+
def come_algebra_test(torch, distill, mlp_only=False, attention_and_mlp=False):
|
| 212 |
+
from types import SimpleNamespace
|
| 213 |
+
from fusegpt import come
|
| 214 |
+
|
| 215 |
+
class Layer(torch.nn.Module):
|
| 216 |
+
def __init__(self):
|
| 217 |
+
super().__init__()
|
| 218 |
+
self.self_attn = torch.nn.Module()
|
| 219 |
+
self.self_attn.config = SimpleNamespace(num_attention_heads=2, num_key_value_heads=2)
|
| 220 |
+
self.self_attn.head_dim = 2
|
| 221 |
+
for n in ("q_proj", "k_proj", "v_proj", "o_proj"):
|
| 222 |
+
setattr(self.self_attn, n, torch.nn.Linear(4, 4, bias=False))
|
| 223 |
+
self.mlp = torch.nn.Module()
|
| 224 |
+
self.mlp.gate_proj = torch.nn.Linear(4, 6, bias=False)
|
| 225 |
+
self.mlp.up_proj = torch.nn.Linear(4, 6, bias=False)
|
| 226 |
+
self.mlp.down_proj = torch.nn.Linear(6, 4, bias=False)
|
| 227 |
+
self.input_layernorm = torch.nn.RMSNorm(4)
|
| 228 |
+
self.post_attention_layernorm = torch.nn.RMSNorm(4)
|
| 229 |
+
|
| 230 |
+
import copy
|
| 231 |
+
a, b = Layer(), Layer()
|
| 232 |
+
with torch.no_grad():
|
| 233 |
+
a.input_layernorm.weight.fill_(2)
|
| 234 |
+
b.input_layernorm.weight.fill_(4)
|
| 235 |
+
untouched = {n: p.detach().clone() for n, p in a.named_parameters()}
|
| 236 |
+
pair = [copy.deepcopy(a), copy.deepcopy(b)]
|
| 237 |
+
come.merge_attention(pair, [.5, .5], [torch.tensor([0., 1.]), torch.tensor([1., 0.])])
|
| 238 |
+
come.merge_mlp(pair, [.5, .5], [torch.arange(6.), torch.arange(6.).flip(0)])
|
| 239 |
+
come.merge_norms(pair)
|
| 240 |
+
expected = {n: p.detach().clone() for n, p in pair[0].named_parameters()}
|
| 241 |
+
state = {"initializer": "come", "lambda": 1., "fit_full_block": not (mlp_only or attention_and_mlp),
|
| 242 |
+
"fit_come_mlp": mlp_only,
|
| 243 |
+
"fit_come_attention": attention_and_mlp,
|
| 244 |
+
"come_initial": expected, "come_audit": {"self_test": True}}
|
| 245 |
+
cls = install_exact_layer(distill, torch, state)
|
| 246 |
+
layer = cls(a, b, {n: 1. for n in expected}, param_subset="mlp" if mlp_only else "all", additive_u=True)
|
| 247 |
+
merged = layer._merged_params()
|
| 248 |
+
assert len(layer._name_map) == (3 if mlp_only else (7 if attention_and_mlp else 9))
|
| 249 |
+
assert all(torch.equal(merged[n], expected[n]) for n in expected)
|
| 250 |
+
assert all(torch.equal(p, untouched[n]) for n, p in a.named_parameters())
|
| 251 |
+
assert bool((merged["input_layernorm.weight"] == 3).all())
|
| 252 |
+
sum(v.sum() for v in merged.values()).backward()
|
| 253 |
+
assert all(torch.equal(u.grad, torch.ones_like(u)) for u in layer.u.values())
|
| 254 |
+
assert state["initialization_audit"]["attention_initialization"] == "CoMe_channel_merge"
|
| 255 |
+
if mlp_only or attention_and_mlp:
|
| 256 |
+
assert not state["initialization_audit"]["norms_trainable"]
|
| 257 |
+
assert len(state["initialization_audit"]["frozen_CoMe_parameters"]) == (2 if attention_and_mlp else 6)
|
| 258 |
+
with torch.no_grad():
|
| 259 |
+
for u in layer.u.values():
|
| 260 |
+
u.add_(.01)
|
| 261 |
+
layer.materialize_into_layer_a()
|
| 262 |
+
for n, p in a.named_parameters():
|
| 263 |
+
trainable = n in layer._name_map
|
| 264 |
+
assert torch.equal(p, expected[n] + .01 if trainable else expected[n]), n
|
| 265 |
+
print("COME_NATIVE_MERGE_MLP3_U_FROZEN_ATTN_NORMS_OK" if mlp_only else (
|
| 266 |
+
"COME_NATIVE_MERGE_ATTN4_MLP3_U_FROZEN_NORMS_TEACHER_UNCHANGED_OK" if attention_and_mlp else
|
| 267 |
+
"COME_NATIVE_MERGE_9_U_GRADIENTS_NORMS_TEACHER_UNCHANGED_OK"), flush=True)
|
| 268 |
+
|
| 269 |
+
|
| 270 |
+
def main():
|
| 271 |
+
parser = argparse.ArgumentParser(allow_abbrev=False)
|
| 272 |
+
parser.add_argument("--external-root", type=Path, required=True)
|
| 273 |
+
parser.add_argument("--initializer", choices=("wa", "wb", "average", "mka", "come"), required=True)
|
| 274 |
+
parser.add_argument("--fixed-anchor", type=int, default=21)
|
| 275 |
+
parser.add_argument("--original-layers", type=int, default=32,
|
| 276 |
+
help="Original decoder depth; defaults preserve the Llama controls")
|
| 277 |
+
parser.add_argument("--audit-root", type=Path, required=True)
|
| 278 |
+
parser.add_argument("--mka-data", type=Path)
|
| 279 |
+
parser.add_argument("--selection-data", type=Path,
|
| 280 |
+
help="Frozen native calibration batches; separate from FiT inputs")
|
| 281 |
+
parser.add_argument("--selection-hash",
|
| 282 |
+
help="Required input_ids SHA256 for frozen selection batches")
|
| 283 |
+
parser.add_argument("--record-fit-runtime", action="store_true")
|
| 284 |
+
parser.add_argument("--mka-samples", type=int, default=100)
|
| 285 |
+
parser.add_argument("--self-test", action="store_true")
|
| 286 |
+
parser.add_argument("--model-id", default="meta-llama/Llama-3.1-8B")
|
| 287 |
+
parser.add_argument("--base-revision", default="d04e592bb4f6aa9cfee91e2e20afa771667e1d4b")
|
| 288 |
+
parser.add_argument("--instruction-data", action="store_true")
|
| 289 |
+
parser.add_argument("--fit-attention", action="store_true",
|
| 290 |
+
help="Train seven projection U tensors; initialize attention from anchor Wa")
|
| 291 |
+
parser.add_argument("--fit-full-block", action="store_true",
|
| 292 |
+
help="CoMe initialization; train all9 block weights including both norms")
|
| 293 |
+
parser.add_argument("--fit-come-mlp", action="store_true",
|
| 294 |
+
help="CoMe initializes all9 weights; fit only3 MLP weights, freeze merged attention/norms")
|
| 295 |
+
parser.add_argument("--fit-come-attention", action="store_true",
|
| 296 |
+
help="CoMe initializes all9 weights; fit7 attention/MLP projections, freeze merged norms")
|
| 297 |
+
parser.add_argument("--fixed-span-merge-only", action="store_true",
|
| 298 |
+
help="Fixed our span, transport ON, replace ONLY3 MLP initial weights with CoMe/MKA")
|
| 299 |
+
parser.add_argument("--come-minimum-retention", type=float, default=.97)
|
| 300 |
+
parser.add_argument("--come-power", type=float, default=1.)
|
| 301 |
+
parser.add_argument("--one-shot", type=int, default=1,
|
| 302 |
+
help="Absorb this many blocks in a single cycle (Wa only).")
|
| 303 |
+
opt, forwarded = parser.parse_known_args()
|
| 304 |
+
if opt.fit_attention:
|
| 305 |
+
assert opt.initializer in ("wa", "wb") and opt.one_shot == 1
|
| 306 |
+
assert sum((opt.fit_full_block, opt.fit_come_mlp, opt.fit_come_attention)) == int(
|
| 307 |
+
opt.initializer == "come" and not opt.fixed_span_merge_only)
|
| 308 |
+
if opt.fixed_span_merge_only:
|
| 309 |
+
assert opt.initializer in ("come", "mka") and opt.one_shot == 1
|
| 310 |
+
count = int(forwarded[forwarded.index("--num_progressive") + 1])
|
| 311 |
+
assert opt.original_layers > 1 and 0 <= opt.fixed_anchor < opt.original_layers - 1
|
| 312 |
+
assert 1 <= count <= opt.original_layers - opt.fixed_anchor - 1
|
| 313 |
+
assert int(forwarded[forwarded.index("--layer") + 1]) == opt.fixed_anchor
|
| 314 |
+
assert not (opt.fit_attention or opt.fit_full_block or opt.fit_come_mlp or opt.fit_come_attention or opt.self_test)
|
| 315 |
+
assert "--source_feature_transport" in forwarded
|
| 316 |
+
for key in ("--reparam_param_subset", "--reparam_train_subset"):
|
| 317 |
+
assert forwarded[forwarded.index(key) + 1] == "mlp"
|
| 318 |
+
elif opt.initializer == "come":
|
| 319 |
+
assert not opt.fit_attention and opt.one_shot == 1
|
| 320 |
+
assert "--source_feature_transport" not in forwarded
|
| 321 |
+
if not opt.self_test:
|
| 322 |
+
subset = "mlp" if opt.fit_come_mlp else "all"
|
| 323 |
+
assert forwarded[forwarded.index("--reparam_param_subset") + 1] == subset
|
| 324 |
+
assert forwarded[forwarded.index("--reparam_train_subset") + 1] == subset
|
| 325 |
+
if opt.one_shot != 1:
|
| 326 |
+
assert opt.initializer == "wa" and opt.one_shot == 8
|
| 327 |
+
assert forwarded[forwarded.index("--num_progressive") + 1] == "1"
|
| 328 |
+
assert forwarded[forwarded.index("--redistrib_teacher_source") + 1] == "base_model"
|
| 329 |
+
assert forwarded[forwarded.index("--reparam_absorb_count") + 1] == "8"
|
| 330 |
+
assert "--source_feature_transport" not in forwarded
|
| 331 |
+
sys.path.insert(0, str(opt.external_root / "src"))
|
| 332 |
+
sys.path.insert(0, str(Path(__file__).resolve().parents[1] / "src"))
|
| 333 |
+
import torch
|
| 334 |
+
import fuse_layers as base
|
| 335 |
+
import fuse_layers_distill as distill
|
| 336 |
+
if opt.self_test:
|
| 337 |
+
if opt.initializer == "come":
|
| 338 |
+
come_algebra_test(torch, distill, mlp_only=opt.fit_come_mlp,
|
| 339 |
+
attention_and_mlp=opt.fit_come_attention)
|
| 340 |
+
else:
|
| 341 |
+
(attention_algebra_test if opt.fit_attention else algebra_test)(torch, distill)
|
| 342 |
+
return
|
| 343 |
+
if opt.instruction_data:
|
| 344 |
+
assert opt.model_id in ("meta-llama/Llama-3.1-8B-Instruct", "Qwen/Qwen3-8B")
|
| 345 |
+
os.environ["ABPRUNE_EXTERNAL_SRC"] = str(opt.external_root / "src")
|
| 346 |
+
import run_external_abprune_instruct_order as instruction
|
| 347 |
+
|
| 348 |
+
opt.audit_root.mkdir(parents=True, exist_ok=True)
|
| 349 |
+
selection_batches = None
|
| 350 |
+
if opt.selection_data:
|
| 351 |
+
if opt.initializer not in ("come", "mka") or opt.fixed_span_merge_only:
|
| 352 |
+
raise ValueError("Frozen selection inputs require native CoMe or MKA")
|
| 353 |
+
selection_batches = torch.load(opt.selection_data, weights_only=True, map_location="cpu")
|
| 354 |
+
checksum = hashlib.sha256()
|
| 355 |
+
count = 0
|
| 356 |
+
for batch in selection_batches:
|
| 357 |
+
ids, mask = batch["input_ids"], batch["attention_mask"]
|
| 358 |
+
if ids.ndim != 2 or ids.shape != mask.shape or not bool(mask.all()):
|
| 359 |
+
raise ValueError("Frozen native inputs must be unpadded matrices")
|
| 360 |
+
checksum.update(ids.numpy().astype("<i8").tobytes())
|
| 361 |
+
count += ids.shape[0]
|
| 362 |
+
measured = checksum.hexdigest()
|
| 363 |
+
if not opt.selection_hash or measured != opt.selection_hash:
|
| 364 |
+
raise ValueError("Frozen native calibration hash mismatch")
|
| 365 |
+
(opt.audit_root / "selection_inputs.json").write_text(json.dumps({
|
| 366 |
+
"input_ids_sha256": measured, "sequences": count,
|
| 367 |
+
"source": str(opt.selection_data), "independent_of_fit_loader": True,
|
| 368 |
+
}, indent=2) + "\n")
|
| 369 |
+
state = {"initializer": opt.initializer, "fit_attention": opt.fit_attention,
|
| 370 |
+
"fixed_span_merge_only": opt.fixed_span_merge_only,
|
| 371 |
+
"fit_full_block": opt.fit_full_block,
|
| 372 |
+
"fit_come_mlp": opt.fit_come_mlp,
|
| 373 |
+
"fit_come_attention": opt.fit_come_attention,
|
| 374 |
+
"lambda": {"wa": 1., "wb": 0., "average": .5, "mka": .5, "come": 1.}[opt.initializer],
|
| 375 |
+
"records": [], "active": list(range(opt.original_layers)),
|
| 376 |
+
"lineage": [[i] for i in range(opt.original_layers)],
|
| 377 |
+
"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])}"}
|
| 378 |
+
install_exact_layer(distill, torch, state)
|
| 379 |
+
|
| 380 |
+
def no_fisher(*args, **kwargs):
|
| 381 |
+
print("[fit-ablation] Fisher bypassed: non-Fisher initializer", flush=True)
|
| 382 |
+
return ({}, {}), 0, ({}, {})
|
| 383 |
+
|
| 384 |
+
def no_contextual_fisher(**kwargs):
|
| 385 |
+
values = no_fisher()
|
| 386 |
+
return (*values, {"computed": False, "reason": "non-Fisher initializer",
|
| 387 |
+
"anchor_candidate_mean_nll": 0., "transported_source_candidate_mean_nll": 0.})
|
| 388 |
+
|
| 389 |
+
def priors(**kwargs):
|
| 390 |
+
a, b = kwargs["layer_a"], dict(kwargs["layer_b"].named_parameters())
|
| 391 |
+
return {name: state["lambda"] for name, param in a.named_parameters()
|
| 392 |
+
if name in b and param.shape == b[name].shape}
|
| 393 |
+
|
| 394 |
+
base.compute_fisher = no_fisher
|
| 395 |
+
base.compute_same_anchor_contextual_fisher = no_contextual_fisher
|
| 396 |
+
base.compute_fisher_gate_priors = priors
|
| 397 |
+
base.summarize_fisher_gate_prior_inputs = lambda **kw: {
|
| 398 |
+
"computed": False, "initializer": opt.initializer, "prior_mean": state["lambda"]}
|
| 399 |
+
if opt.fixed_span_merge_only:
|
| 400 |
+
original_transport = base.fit_and_apply_source_feature_transport
|
| 401 |
+
|
| 402 |
+
def tracked_transport(**kwargs):
|
| 403 |
+
from fusegpt.fixed_span_merge_init import MLP_NAMES, tensor_hash
|
| 404 |
+
before = {n: tensor_hash(kwargs["layer_b"].get_parameter(n)) for n in MLP_NAMES}
|
| 405 |
+
result = original_transport(**kwargs)
|
| 406 |
+
after = {n: tensor_hash(kwargs["layer_b"].get_parameter(n)) for n in MLP_NAMES}
|
| 407 |
+
state["transport_completed"] = True
|
| 408 |
+
state["transport_operands"] = {"before": before, "after": after,
|
| 409 |
+
"changed": [n for n in MLP_NAMES if before[n] != after[n]]}
|
| 410 |
+
return result
|
| 411 |
+
|
| 412 |
+
base.fit_and_apply_source_feature_transport = tracked_transport
|
| 413 |
+
|
| 414 |
+
original_prepare = base.prepare_all_data
|
| 415 |
+
|
| 416 |
+
def prepare(*args, **kwargs):
|
| 417 |
+
if opt.instruction_data:
|
| 418 |
+
config = args[0]
|
| 419 |
+
assert not config.dataset and config.target_tokens == 0
|
| 420 |
+
assert config.instruction_dataset == "Open-Orca/SlimOrca"
|
| 421 |
+
data = original_prepare(*args, **kwargs)
|
| 422 |
+
fingerprints = {}
|
| 423 |
+
for name in ("calib_loader", "distill_loader"):
|
| 424 |
+
loader = getattr(data, name)
|
| 425 |
+
checksum = hashlib.sha256()
|
| 426 |
+
mask_checksum = hashlib.sha256()
|
| 427 |
+
valid_tokens = 0
|
| 428 |
+
for item in loader.dataset:
|
| 429 |
+
ids = item[0] if isinstance(item, (tuple, list)) else item["input_ids"]
|
| 430 |
+
mask = item[1] if isinstance(item, (tuple, list)) else item["attention_mask"]
|
| 431 |
+
checksum.update(ids.cpu().numpy().astype("<i8").tobytes())
|
| 432 |
+
mask_checksum.update(mask.cpu().numpy().astype("<i8").tobytes())
|
| 433 |
+
valid_tokens += int(mask.sum())
|
| 434 |
+
fingerprints[name] = {"sequences": len(loader.dataset), "sha256": checksum.hexdigest(),
|
| 435 |
+
"attention_mask_sha256": mask_checksum.hexdigest(), "valid_tokens": valid_tokens}
|
| 436 |
+
(opt.audit_root / "data_fingerprints.json").write_text(json.dumps(fingerprints, indent=2) + "\n")
|
| 437 |
+
if opt.fit_attention or opt.initializer == "come" or opt.fixed_span_merge_only:
|
| 438 |
+
size = fingerprints["distill_loader"]["sequences"]
|
| 439 |
+
if opt.model_id == "meta-llama/Llama-3.1-8B" and size == 512:
|
| 440 |
+
assert fingerprints["calib_loader"]["sha256"] == "fa4a6219f7a7b17364eef6b5b7771533b57a407f1d26db1d483bbd955814ce38"
|
| 441 |
+
assert fingerprints["distill_loader"]["sha256"] == "2b2d044c8c040f67891817ecc110f0fa0de2f469db4c6731114ff7816bbf1cd0"
|
| 442 |
+
elif opt.model_id == "meta-llama/Llama-3.1-8B-Instruct" and opt.instruction_data and size == 500:
|
| 443 |
+
assert fingerprints["calib_loader"]["sha256"] == "98ff6481a347ebc9444154a51f379c5c71746abe3b417b47186d9f61cbedeeb2"
|
| 444 |
+
assert fingerprints["distill_loader"]["sha256"] == "c75cb58ff76dce06a57127e87633f2fbad04d7d7c9c824e5150c14fd8556cda3"
|
| 445 |
+
assert fingerprints["distill_loader"]["attention_mask_sha256"] == "1e9ccfe6387a9565982ab4ee99f2a3b8c54afebe957ab11ef16e2097c4b8f825"
|
| 446 |
+
elif opt.model_id == "Qwen/Qwen3-8B" and opt.instruction_data:
|
| 447 |
+
assert fingerprints["calib_loader"]["sha256"] == "0d438c8d712c08b428287c97ff2422cc63c99cc0564a27ec53afcae788f042bb"
|
| 448 |
+
assert fingerprints["calib_loader"]["attention_mask_sha256"] == "fdcd61583ffdd02ccfd992f92343facc38a41d794a316746d9b9b7836ebb65b5"
|
| 449 |
+
if size == 500:
|
| 450 |
+
assert fingerprints["distill_loader"]["sha256"] == "b9885f1464a0b145f1c59bc60190bfa73ad388902cbd245e532aa082044a61e7"
|
| 451 |
+
assert fingerprints["distill_loader"]["attention_mask_sha256"] == "f5380885dd835321800a18abd00245d32d60aef9c78ea43a1f16effc26457718"
|
| 452 |
+
print("ATTENTION_FIT_DATA_FINGERPRINTS_CHECKED_BEFORE_TRAINING", flush=True)
|
| 453 |
+
if opt.one_shot > 1 and fingerprints["distill_loader"]["sequences"] == 512:
|
| 454 |
+
assert fingerprints["calib_loader"]["sha256"] == "fa4a6219f7a7b17364eef6b5b7771533b57a407f1d26db1d483bbd955814ce38"
|
| 455 |
+
assert fingerprints["distill_loader"]["sha256"] == "2b2d044c8c040f67891817ecc110f0fa0de2f469db4c6731114ff7816bbf1cd0"
|
| 456 |
+
print("ONE_SHOT_DATA_MATCHES_PREVIOUS_PROGRESSIVE", flush=True)
|
| 457 |
+
return data
|
| 458 |
+
|
| 459 |
+
base.prepare_all_data = prepare
|
| 460 |
+
geometry_batches = None
|
| 461 |
+
|
| 462 |
+
def select(args, model, layers, dataloader, cosine_loader, scores, start, excluded):
|
| 463 |
+
nonlocal geometry_batches
|
| 464 |
+
if opt.fixed_span_merge_only:
|
| 465 |
+
from fusegpt.fit_ablation_come import valid_calibration_batches
|
| 466 |
+
index = opt.fixed_anchor
|
| 467 |
+
assert state["active"][index] == opt.fixed_anchor
|
| 468 |
+
assert state["active"][index + 1] == opt.fixed_anchor + 1 + len(state["records"])
|
| 469 |
+
state["transport_completed"] = False
|
| 470 |
+
batches = valid_calibration_batches(dataloader)
|
| 471 |
+
if opt.initializer == "come":
|
| 472 |
+
from fusegpt import come
|
| 473 |
+
measured = come.collect_calibration_scores(model, batches, sbi_metric="angular_last")
|
| 474 |
+
leaves = len(state["lineage"][index]) + len(state["lineage"][index + 1])
|
| 475 |
+
minimum = opt.come_minimum_retention ** (1 / (leaves - 1))
|
| 476 |
+
ratios = come.compute_retention_ratios(
|
| 477 |
+
measured.block_importance[index:index+2], power=opt.come_power, minimum=minimum)
|
| 478 |
+
state["merge_payload"] = {"ratios": ratios,
|
| 479 |
+
"neuron_scores": measured.mlp_neurons[index:index+2]}
|
| 480 |
+
extra = {"minimum_retention": opt.come_minimum_retention,
|
| 481 |
+
"adjusted_minimum": minimum, "power": opt.come_power,
|
| 482 |
+
"retention_ratios": ratios, "block_importance": measured.block_importance[index:index+2]}
|
| 483 |
+
del measured
|
| 484 |
+
else:
|
| 485 |
+
from fusegpt import fit_ablation_mka as mka
|
| 486 |
+
config = mka.GeometryConfig()
|
| 487 |
+
assert len(batches) >= 64, "MKA geometry requires the matched64-record calibration view"
|
| 488 |
+
features = mka.collect_features(model, batches, pooling=config.pooling)
|
| 489 |
+
manifolds = [mka.diffusion_embedding(x, config) for x in features]
|
| 490 |
+
del features
|
| 491 |
+
matrix, entropies = mka.npib_matrix([x[0] for x in manifolds], config)
|
| 492 |
+
state["lambda"] = mka.upstream_lambda(matrix, index, index+1, config.beta)
|
| 493 |
+
state["merge_payload"] = {"lambda_left": state["lambda"]}
|
| 494 |
+
extra = {"npib_matrix": matrix.tolist(), "entropies": entropies,
|
| 495 |
+
"row_means": matrix.mean(1).tolist(), "geometry_samples": len(batches),
|
| 496 |
+
"geometry_sequence_length": int(batches[0]["input_ids"].shape[1])}
|
| 497 |
+
del manifolds, matrix
|
| 498 |
+
extra.update({"selection_policy": f"fixed_anchor{opt.fixed_anchor}", "source_lineage":
|
| 499 |
+
[state["lineage"][index][:], state["lineage"][index+1][:]],
|
| 500 |
+
"score_data": "same_calib_loader_as_transport", "data_seed": 42,
|
| 501 |
+
"mka_mi_seed": 0 if opt.initializer == "mka" else None,
|
| 502 |
+
"initializer_weights_after_transport": True})
|
| 503 |
+
del batches
|
| 504 |
+
elif opt.initializer == "come":
|
| 505 |
+
from fusegpt.fit_ablation_come import select_and_initialize
|
| 506 |
+
index, initial, extra = select_and_initialize(
|
| 507 |
+
model, selection_batches if selection_batches is not None else dataloader, state["lineage"],
|
| 508 |
+
minimum=opt.come_minimum_retention, power=opt.come_power)
|
| 509 |
+
state["come_initial"] = initial
|
| 510 |
+
state["come_audit"] = extra
|
| 511 |
+
elif opt.initializer == "mka":
|
| 512 |
+
from fusegpt import fit_ablation_mka as mka
|
| 513 |
+
if geometry_batches is None:
|
| 514 |
+
if selection_batches is not None:
|
| 515 |
+
geometry_batches = selection_batches
|
| 516 |
+
elif opt.mka_data and opt.mka_data.is_file():
|
| 517 |
+
geometry_batches = torch.load(opt.mka_data, weights_only=True)
|
| 518 |
+
else:
|
| 519 |
+
from transformers import AutoTokenizer
|
| 520 |
+
tokenizer = AutoTokenizer.from_pretrained(args.model)
|
| 521 |
+
if opt.instruction_data:
|
| 522 |
+
import copy
|
| 523 |
+
geometry_args = copy.copy(args)
|
| 524 |
+
geometry_args.seed = 0
|
| 525 |
+
records = instruction.load_slimorca_records(geometry_args, opt.mka_samples,
|
| 526 |
+
"ABPRUNE_MKA_DATA_INDICES_FILE")
|
| 527 |
+
dataset = base.FixedSeqDataset(records, tokenizer, 512)
|
| 528 |
+
geometry_batches = [{"input_ids": ids[None, :], "attention_mask": mask[None, :]}
|
| 529 |
+
for ids, mask in dataset]
|
| 530 |
+
assert len(geometry_batches) == opt.mka_samples
|
| 531 |
+
checksum = hashlib.sha256()
|
| 532 |
+
for batch in geometry_batches:
|
| 533 |
+
checksum.update(batch["input_ids"].numpy().astype("<i8").tobytes())
|
| 534 |
+
metadata = {"dataset": "Open-Orca/SlimOrca", "revision": os.environ["ABPRUNE_DATASET_REVISION"],
|
| 535 |
+
"samples": len(records), "sequence_length": 512, "seed": 0,
|
| 536 |
+
"format": "first user-assistant turn; model chat template; right padding masked",
|
| 537 |
+
"input_ids_sha256": checksum.hexdigest()}
|
| 538 |
+
else:
|
| 539 |
+
geometry_batches, metadata = mka.sample_slimpajama(
|
| 540 |
+
tokenizer, samples=opt.mka_samples, sequence_length=512, seed=0)
|
| 541 |
+
if opt.mka_data:
|
| 542 |
+
opt.mka_data.parent.mkdir(parents=True, exist_ok=True)
|
| 543 |
+
torch.save(geometry_batches, opt.mka_data)
|
| 544 |
+
opt.mka_data.with_suffix(".json").write_text(json.dumps(metadata, indent=2) + "\n")
|
| 545 |
+
config = mka.GeometryConfig()
|
| 546 |
+
print(f"[fit-ablation] MKA geometry: {len(layers)} layers", flush=True)
|
| 547 |
+
features = mka.collect_features(model, geometry_batches)
|
| 548 |
+
manifold = [mka.diffusion_embedding(x, config) for x in features]
|
| 549 |
+
del features
|
| 550 |
+
matrix, entropies = mka.npib_matrix([x[0] for x in manifold], config)
|
| 551 |
+
index = mka.select_pair(matrix)
|
| 552 |
+
state["lambda"] = mka.upstream_lambda(matrix, index, index + 1, config.beta)
|
| 553 |
+
extra = {"npib_matrix": matrix.tolist(), "entropies": entropies,
|
| 554 |
+
"pair_npib": float(matrix[index, index+1]),
|
| 555 |
+
"source_lineage": [state["lineage"][index][:], state["lineage"][index+1][:]]}
|
| 556 |
+
else:
|
| 557 |
+
index, extra = opt.fixed_anchor, {}
|
| 558 |
+
assert len(layers) == len(state["active"])
|
| 559 |
+
record = {"cycle": len(state["records"]) + 1, "pair_index": index,
|
| 560 |
+
"initializer": opt.initializer,
|
| 561 |
+
"lambda_left": None if opt.initializer == "come" else state["lambda"],
|
| 562 |
+
"recipient_original_layer": state["active"][index], "recipient_side": "left",
|
| 563 |
+
"removed_original_layer": state["active"][index+1], **extra}
|
| 564 |
+
state["records"].append(record)
|
| 565 |
+
record["removed_original_layers"] = state["active"][index+1:index+1+opt.one_shot]
|
| 566 |
+
for _ in range(opt.one_shot):
|
| 567 |
+
state["active"].pop(index+1)
|
| 568 |
+
state["lineage"][index] += state["lineage"].pop(index+1)
|
| 569 |
+
record["active_original_layers"] = state["active"][:]
|
| 570 |
+
(opt.audit_root / "selection.json").write_text(json.dumps(state["records"], indent=2) + "\n")
|
| 571 |
+
print("[fit-ablation] selection " + json.dumps({k:v for k,v in record.items() if k != "npib_matrix"}), flush=True)
|
| 572 |
+
return index, None, {"method": opt.initializer, "fisher_computed": False}
|
| 573 |
+
|
| 574 |
+
base.resolve_layer_idx = select
|
| 575 |
+
original_fit = base.distill_reparam_merge
|
| 576 |
+
|
| 577 |
+
def fit(**kwargs):
|
| 578 |
+
if opt.fixed_span_merge_only:
|
| 579 |
+
from fusegpt.fixed_span_merge_init import frozen_hashes
|
| 580 |
+
anchor_layer = kwargs["student_layers"][kwargs["layer_idx"]]
|
| 581 |
+
frozen_before = frozen_hashes(anchor_layer)
|
| 582 |
+
if opt.one_shot > 1:
|
| 583 |
+
assert len(kwargs["teacher_layers"]) == 32
|
| 584 |
+
assert len(kwargs["student_layers"]) == 32
|
| 585 |
+
assert kwargs["layer_idx"] == 21 and kwargs["absorb_count"] == 8
|
| 586 |
+
print("ONE_SHOT_FIXED_DENSE_TEACHER_BOUNDARY=29 STUDENT_BOUNDARY=21 DROP=22:30", flush=True)
|
| 587 |
+
if opt.record_fit_runtime:
|
| 588 |
+
forward_shapes = {}
|
| 589 |
+
hooks = []
|
| 590 |
+
def trace_forward(label):
|
| 591 |
+
def capture(module, positional, named):
|
| 592 |
+
ids = named.get("input_ids")
|
| 593 |
+
if ids is None and positional:
|
| 594 |
+
ids = positional[0]
|
| 595 |
+
if torch.is_tensor(ids):
|
| 596 |
+
key = label + ":" + "x".join(str(v) for v in ids.shape)
|
| 597 |
+
forward_shapes[key] = forward_shapes.get(key, 0) + 1
|
| 598 |
+
return capture
|
| 599 |
+
for label in ("student", "teacher"):
|
| 600 |
+
hooks.append(kwargs[label + "_model"].register_forward_pre_hook(
|
| 601 |
+
trace_forward(label), with_kwargs=True))
|
| 602 |
+
torch.cuda.synchronize()
|
| 603 |
+
torch.cuda.reset_peak_memory_stats()
|
| 604 |
+
fit_started = time.perf_counter()
|
| 605 |
+
try:
|
| 606 |
+
merged, gates, stats = original_fit(**kwargs)
|
| 607 |
+
finally:
|
| 608 |
+
if opt.record_fit_runtime:
|
| 609 |
+
for hook in hooks:
|
| 610 |
+
hook.remove()
|
| 611 |
+
if opt.record_fit_runtime:
|
| 612 |
+
torch.cuda.synchronize()
|
| 613 |
+
elapsed = time.perf_counter() - fit_started
|
| 614 |
+
loader = kwargs["dataloader"]
|
| 615 |
+
tokens = sum(int(item[1].sum()) for item in loader.dataset)
|
| 616 |
+
stats["runtime"] = {
|
| 617 |
+
"seconds": elapsed, "dataset_tokens": tokens,
|
| 618 |
+
"tokens_per_second": tokens * float(kwargs["args"].distill_epochs) / elapsed,
|
| 619 |
+
"batch_size": int(kwargs["args"].distill_batch_size),
|
| 620 |
+
"batches_per_epoch": len(loader),
|
| 621 |
+
"grad_accumulation": int(kwargs["args"].distill_grad_accum_steps),
|
| 622 |
+
"peak_allocated_bytes": torch.cuda.max_memory_allocated(),
|
| 623 |
+
"peak_reserved_bytes": torch.cuda.max_memory_reserved(),
|
| 624 |
+
"gpu_total_bytes": torch.cuda.get_device_properties(0).total_memory,
|
| 625 |
+
"actual_forward_shapes": forward_shapes,
|
| 626 |
+
}
|
| 627 |
+
if opt.fit_come_attention:
|
| 628 |
+
layer = kwargs["student_layers"][kwargs["layer_idx"]]
|
| 629 |
+
expected = state["initialization_audit"]["frozen_norm_expected_sha256"]
|
| 630 |
+
measured = {n: hashlib.sha256(layer.get_parameter(n).detach().cpu().contiguous()
|
| 631 |
+
.view(torch.uint8).numpy().tobytes()).hexdigest() for n in expected}
|
| 632 |
+
assert measured == expected, "CoMe-initialized norms changed during attention+MLP FiT"
|
| 633 |
+
state["initialization_audit"]["frozen_norm_after_sha256"] = measured
|
| 634 |
+
state["initialization_audit"]["frozen_norms_unchanged"] = True
|
| 635 |
+
if opt.fixed_span_merge_only:
|
| 636 |
+
frozen_after = frozen_hashes(anchor_layer)
|
| 637 |
+
assert frozen_after == frozen_before, "Attention/norm changed during MLP-only FiT"
|
| 638 |
+
audit = state["initialization_audit"]["merge_rule_audit"]
|
| 639 |
+
assert audit["transported_source_mlp_sha256"] == state["transport_operands"]["after"]
|
| 640 |
+
state["initialization_audit"].update({"frozen_attention_norm_unchanged": True,
|
| 641 |
+
"transport_operands": state["transport_operands"]})
|
| 642 |
+
stats["ablation"] = {**state["initialization_audit"],
|
| 643 |
+
"source_feature_transport": bool(kwargs["args"].source_feature_transport),
|
| 644 |
+
"initializer": opt.initializer,
|
| 645 |
+
"removed_count_per_cycle": opt.one_shot,
|
| 646 |
+
"teacher_boundary_current_layer": kwargs["layer_idx"] + opt.one_shot,
|
| 647 |
+
"teacher_boundary_original_layer": state["records"][-1]["removed_original_layers"][-1]}
|
| 648 |
+
(opt.audit_root / f"cycle_{kwargs['progressive_cycle']:02d}_fit.json").write_text(
|
| 649 |
+
json.dumps(stats, indent=2) + "\n")
|
| 650 |
+
return merged, gates, stats
|
| 651 |
+
|
| 652 |
+
base.distill_reparam_merge = fit
|
| 653 |
+
sys.argv = [sys.argv[0], *forwarded]
|
| 654 |
+
base.main()
|
| 655 |
+
# Correct legacy Fisher-specific labels and add reconstructible topology.
|
| 656 |
+
output = Path(forwarded[forwarded.index("--output_dir") + 1])
|
| 657 |
+
for record in state["records"]:
|
| 658 |
+
path = output / f"cycle_{record['cycle']}" / "cycle_metadata.json"
|
| 659 |
+
data = json.loads(path.read_text())
|
| 660 |
+
data.update({k: record[k] for k in ("recipient_original_layer", "removed_original_layer", "recipient_side", "active_original_layers")})
|
| 661 |
+
data["fisher_computed"] = False
|
| 662 |
+
data["merge_initializer"] = opt.initializer
|
| 663 |
+
data["fixed_span_merge_only"] = opt.fixed_span_merge_only
|
| 664 |
+
data["removed_original_layers"] = record["removed_original_layers"]
|
| 665 |
+
data["same_anchor_contextual_fisher"] = {"computed": False}
|
| 666 |
+
if data.get("source_feature_transport"):
|
| 667 |
+
data["source_feature_transport"]["fisher_order"] = "source transport; non-Fisher initialization; additive-U FiT"
|
| 668 |
+
reparam = data.get("distill", {}).get("reparam_stats")
|
| 669 |
+
if reparam:
|
| 670 |
+
reparam["lambda_init"] = opt.initializer
|
| 671 |
+
path.write_text(json.dumps(data, indent=2) + "\n")
|
| 672 |
+
if opt.one_shot > 1:
|
| 673 |
+
import subprocess
|
| 674 |
+
subprocess.run([sys.executable, str(Path(__file__).with_name("package_qwen3_1_7b_one_shot_compact.py")),
|
| 675 |
+
"--run-root", str(output), "--output-root", str(opt.audit_root.parent / "compact"),
|
| 676 |
+
"--model", opt.model_id, "--base-revision", opt.base_revision,
|
| 677 |
+
"--run-id", "llama31_base_wa_oneshot_8block", "--anchor", str(opt.fixed_anchor),
|
| 678 |
+
"--removed-count", str(opt.one_shot)], check=True)
|
| 679 |
+
else:
|
| 680 |
+
from fusegpt.abprune_compact import package
|
| 681 |
+
package(argparse.Namespace(run_root=output, output_root=opt.audit_root.parent / "compact",
|
| 682 |
+
model=opt.model_id, base_revision=opt.base_revision,
|
| 683 |
+
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 ''))}{len(state['records'])}block", cycles=len(state["records"]),
|
| 684 |
+
start_cycle=1, layer_order=" ".join(str(r["pair_index"]) for r in state["records"])))
|
| 685 |
+
(opt.audit_root.parent / "TRAIN_COMPLETE").touch()
|
| 686 |
+
|
| 687 |
+
|
| 688 |
+
if __name__ == "__main__":
|
| 689 |
+
main()
|
runs/vast-paper_revision-come-attn-fit-20261126-62646539/20261126-llama31-come-attn-mlp-batch/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-llama31-come-attn-mlp-batch/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-llama31-come-attn-mlp-batch/catalog/code/validate_native_come_replay.py
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""Check restored native CoMe calibration against its historical merge trace."""
|
| 2 |
+
import argparse
|
| 3 |
+
from dataclasses import asdict
|
| 4 |
+
import json
|
| 5 |
+
from pathlib import Path
|
| 6 |
+
import urllib.request
|
| 7 |
+
|
| 8 |
+
import torch
|
| 9 |
+
from transformers import AutoModelForCausalLM
|
| 10 |
+
from fusegpt import come
|
| 11 |
+
|
| 12 |
+
p = argparse.ArgumentParser()
|
| 13 |
+
p.add_argument("--model", required=True)
|
| 14 |
+
p.add_argument("--selection", type=Path, required=True)
|
| 15 |
+
p.add_argument("--output", type=Path, required=True)
|
| 16 |
+
a = p.parse_args()
|
| 17 |
+
reference_url = ("https://huggingface.co/LJYAI/paper_revision/resolve/"
|
| 18 |
+
"d74c1f84be13a3ab3233a5a08d7970f02d211f5a/"
|
| 19 |
+
"runs/vast-paper_revision-come-llama31-8b-54114105/"
|
| 20 |
+
"20261004-come-llama31-8b-8block-allowrepeat/come_pruning.json")
|
| 21 |
+
reference = json.load(urllib.request.urlopen(reference_url, timeout=60))
|
| 22 |
+
model = AutoModelForCausalLM.from_pretrained(a.model, torch_dtype=torch.bfloat16,
|
| 23 |
+
device_map="cuda:0", attn_implementation="sdpa",
|
| 24 |
+
local_files_only=True)
|
| 25 |
+
model.eval()
|
| 26 |
+
batches = torch.load(a.selection, weights_only=True, map_location="cpu")
|
| 27 |
+
records = [asdict(r) for r in come.progressive_prune(
|
| 28 |
+
model, batches, target_layers=24, power=1., minimum_retention=.97,
|
| 29 |
+
allow_repeat=True, sbi_metric="angular_last")]
|
| 30 |
+
checks = []
|
| 31 |
+
for actual, old in zip(records, reference["merges"]):
|
| 32 |
+
discrete = all(actual[k] == old[k] for k in
|
| 33 |
+
("source_layers", "retained_attention_groups", "retained_mlp_neurons"))
|
| 34 |
+
error = abs(actual["pair_score"] - old["pair_score"])
|
| 35 |
+
checks.append({"step": actual["step"], "discrete_merge_match": discrete,
|
| 36 |
+
"pair_score_absolute_error": error})
|
| 37 |
+
result = {"reference": reference_url, "records": records, "checks": checks,
|
| 38 |
+
"passed": len(checks) == 8 and all(c["discrete_merge_match"] and
|
| 39 |
+
c["pair_score_absolute_error"] < .002 for c in checks),
|
| 40 |
+
"scope": "Merge trace and scoring agreement; historical input hash was not saved"}
|
| 41 |
+
a.output.parent.mkdir(parents=True, exist_ok=True)
|
| 42 |
+
a.output.write_text(json.dumps(result, indent=2) + "\n")
|
| 43 |
+
if not result["passed"]:
|
| 44 |
+
raise ValueError("Historical native CoMe replay differs; production must not start")
|
| 45 |
+
print("EIGHT_STAGE_NATIVE_COME_REPLAY_VERIFIED", checks, flush=True)
|
runs/vast-paper_revision-come-attn-fit-20261126-62646539/20261126-llama31-come-attn-mlp-batch/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-llama31-come-attn-mlp-batch/catalog/comparison.csv
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
method,fit_scope,fit_batch,bench12_pct,mmlu_pct,cmmlu_pct,ppl,training_wall_seconds,new_run,source,hf_revision
|
| 2 |
+
CoMe,,,55.1597298504693,55.8182595071927,40.86513555517182,22.769869082395516,,False,llama31_base_come_allowrepeat_8block,
|
| 3 |
+
ABPrune without FiT,,,51.455659033826976,34.261501210653755,28.829217751683643,31.988051928028295,,False,llama31_base_nofit_transport_bench14_20261009/on,
|
| 4 |
+
ABPrune + FiT,,1,56.93100685265902,37.4661729098419,36.57399412882059,17.896455416608784,,False,llama31_base_transport_8block,
|
| 5 |
+
CoMe + MLP FiT,mlp,1,56.03341033262276,59.74220196553197,44.43964772923502,19.21783208596286,1981.2216973304749,False,llama31_come_batch_20261126/batch1,e762aaea126165ec54d02c4045ad803fee0115ee
|
| 6 |
+
CoMe + MLP FiT,mlp,8,56.14634439798502,57.17134311351659,45.74339492315662,18.171799138402875,1406.9505376815796,False,llama31_come_batch_20261126/batch_large,f407a63af421945571461a5fef809ee1b40c974b
|
| 7 |
+
CoMe + attention/MLP FiT,attention_mlp,1,55.365612568260914,61.40150975644495,49.058884475910894,25.964731889312485,2256.4183456897736,True,llama31_come_attn_mlp_batch_20261126/batch1,3754f1bdd3c1072c7b09cb594924d2a2a2ef0968
|
| 8 |
+
CoMe + attention/MLP FiT,attention_mlp,8,59.21032158270908,60.64663153396952,44.98359523398377,19.492961327144673,1516.4341526031494,True,llama31_come_attn_mlp_batch_20261126/batch_large,6bddb1e37c9958bcd5b726d45aa3191b5128a912
|
runs/vast-paper_revision-come-attn-fit-20261126-62646539/20261126-llama31-come-attn-mlp-batch/catalog/comparison.json
ADDED
|
@@ -0,0 +1,94 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"rows": [
|
| 3 |
+
{
|
| 4 |
+
"method": "CoMe",
|
| 5 |
+
"fit_batch": null,
|
| 6 |
+
"bench12": 0.551597298504693,
|
| 7 |
+
"mmlu": 0.558182595071927,
|
| 8 |
+
"cmmlu": 0.40865135555171817,
|
| 9 |
+
"ppl": 22.769869082395516,
|
| 10 |
+
"source": "llama31_base_come_allowrepeat_8block",
|
| 11 |
+
"new_run": false
|
| 12 |
+
},
|
| 13 |
+
{
|
| 14 |
+
"method": "ABPrune without FiT",
|
| 15 |
+
"fit_batch": null,
|
| 16 |
+
"bench12": 0.5145565903382697,
|
| 17 |
+
"mmlu": 0.34261501210653755,
|
| 18 |
+
"cmmlu": 0.28829217751683645,
|
| 19 |
+
"ppl": 31.988051928028295,
|
| 20 |
+
"source": "llama31_base_nofit_transport_bench14_20261009/on",
|
| 21 |
+
"new_run": false
|
| 22 |
+
},
|
| 23 |
+
{
|
| 24 |
+
"method": "ABPrune + FiT",
|
| 25 |
+
"fit_batch": 1,
|
| 26 |
+
"bench12": 0.5693100685265902,
|
| 27 |
+
"mmlu": 0.37466172909841905,
|
| 28 |
+
"cmmlu": 0.36573994128820586,
|
| 29 |
+
"ppl": 17.896455416608784,
|
| 30 |
+
"source": "llama31_base_transport_8block",
|
| 31 |
+
"new_run": false
|
| 32 |
+
},
|
| 33 |
+
{
|
| 34 |
+
"method": "CoMe + MLP FiT",
|
| 35 |
+
"fit_scope": "mlp",
|
| 36 |
+
"fit_batch": 1,
|
| 37 |
+
"bench12": 0.5603341033262276,
|
| 38 |
+
"mmlu": 0.5974220196553197,
|
| 39 |
+
"cmmlu": 0.4443964772923502,
|
| 40 |
+
"ppl": 19.21783208596286,
|
| 41 |
+
"training_wall_seconds": 1981.2216973304749,
|
| 42 |
+
"source": "llama31_come_batch_20261126/batch1",
|
| 43 |
+
"new_run": false,
|
| 44 |
+
"hf_path": "runs/vast-paper_revision-come-fit-batch-20261126-62635207/20261126-llama31-come-mlp-batch/batch1",
|
| 45 |
+
"hf_revision": "e762aaea126165ec54d02c4045ad803fee0115ee"
|
| 46 |
+
},
|
| 47 |
+
{
|
| 48 |
+
"method": "CoMe + MLP FiT",
|
| 49 |
+
"fit_scope": "mlp",
|
| 50 |
+
"fit_batch": 8,
|
| 51 |
+
"bench12": 0.5614634439798502,
|
| 52 |
+
"mmlu": 0.5717134311351659,
|
| 53 |
+
"cmmlu": 0.4574339492315662,
|
| 54 |
+
"ppl": 18.171799138402875,
|
| 55 |
+
"training_wall_seconds": 1406.9505376815796,
|
| 56 |
+
"source": "llama31_come_batch_20261126/batch_large",
|
| 57 |
+
"new_run": false,
|
| 58 |
+
"hf_path": "runs/vast-paper_revision-come-fit-batch-20261126-62635207/20261126-llama31-come-mlp-batch/batch_large",
|
| 59 |
+
"hf_revision": "f407a63af421945571461a5fef809ee1b40c974b"
|
| 60 |
+
},
|
| 61 |
+
{
|
| 62 |
+
"method": "CoMe + attention/MLP FiT",
|
| 63 |
+
"fit_scope": "attention_mlp",
|
| 64 |
+
"fit_batch": 1,
|
| 65 |
+
"bench12": 0.5536561256826091,
|
| 66 |
+
"mmlu": 0.6140150975644495,
|
| 67 |
+
"cmmlu": 0.49058884475910897,
|
| 68 |
+
"ppl": 25.964731889312485,
|
| 69 |
+
"training_wall_seconds": 2256.4183456897736,
|
| 70 |
+
"source": "llama31_come_attn_mlp_batch_20261126/batch1",
|
| 71 |
+
"new_run": true,
|
| 72 |
+
"hf_path": "runs/vast-paper_revision-come-attn-fit-20261126-62646539/20261126-llama31-come-attn-mlp-batch/batch1",
|
| 73 |
+
"hf_revision": "3754f1bdd3c1072c7b09cb594924d2a2a2ef0968"
|
| 74 |
+
},
|
| 75 |
+
{
|
| 76 |
+
"method": "CoMe + attention/MLP FiT",
|
| 77 |
+
"fit_scope": "attention_mlp",
|
| 78 |
+
"fit_batch": 8,
|
| 79 |
+
"bench12": 0.5921032158270908,
|
| 80 |
+
"mmlu": 0.6064663153396952,
|
| 81 |
+
"cmmlu": 0.4498359523398377,
|
| 82 |
+
"ppl": 19.492961327144673,
|
| 83 |
+
"training_wall_seconds": 1516.4341526031494,
|
| 84 |
+
"source": "llama31_come_attn_mlp_batch_20261126/batch_large",
|
| 85 |
+
"new_run": true,
|
| 86 |
+
"hf_path": "runs/vast-paper_revision-come-attn-fit-20261126-62646539/20261126-llama31-come-attn-mlp-batch/batch_large",
|
| 87 |
+
"hf_revision": "6bddb1e37c9958bcd5b726d45aa3191b5128a912"
|
| 88 |
+
}
|
| 89 |
+
],
|
| 90 |
+
"accuracy_scale": "fraction",
|
| 91 |
+
"model": "Llama-3.1-8B Base",
|
| 92 |
+
"removed_blocks": 8,
|
| 93 |
+
"reference_rows": "Historical results, not fresh benchmark reruns"
|
| 94 |
+
}
|
runs/vast-paper_revision-come-attn-fit-20261126-62646539/20261126-llama31-come-attn-mlp-batch/catalog/manifest.json
ADDED
|
@@ -0,0 +1,432 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"schema": "sha256-tree-v1",
|
| 3 |
+
"files": [
|
| 4 |
+
{
|
| 5 |
+
"path": "README.md",
|
| 6 |
+
"size": 611,
|
| 7 |
+
"sha256": "b06d46e1323ec124f70577d11ce7d9ad3bc499f6fbf47d7f5c3a47afaca97760"
|
| 8 |
+
},
|
| 9 |
+
{
|
| 10 |
+
"path": "backup_audit.json",
|
| 11 |
+
"size": 1273,
|
| 12 |
+
"sha256": "ba36e3235d5dd808b0e74749c4f3fbaa9cd4ec211f8ade67dd83ad0bb6769d34"
|
| 13 |
+
},
|
| 14 |
+
{
|
| 15 |
+
"path": "code/abprune_compact.py",
|
| 16 |
+
"size": 12360,
|
| 17 |
+
"sha256": "34f00dc3b96ea3c3dd6dafada682352e2b332e6b1c79fb2033e13f9585254ff3"
|
| 18 |
+
},
|
| 19 |
+
{
|
| 20 |
+
"path": "code/bootstrap_come_batch_comparison.sh",
|
| 21 |
+
"size": 2779,
|
| 22 |
+
"sha256": "d7f4fa21a815ac57fe9cfdd4b3ae8bc857ed732edd201bc235b5e9b640b78f30"
|
| 23 |
+
},
|
| 24 |
+
{
|
| 25 |
+
"path": "code/bootstrap_llama31_come_fit2.sh",
|
| 26 |
+
"size": 3092,
|
| 27 |
+
"sha256": "53d76652e71b4ac0b4d8cf8e3444443acf59781e03311a102f8583e2a4597818"
|
| 28 |
+
},
|
| 29 |
+
{
|
| 30 |
+
"path": "code/collect_come_batch_comparison.py",
|
| 31 |
+
"size": 3431,
|
| 32 |
+
"sha256": "94667887a1a8a88a775a79e9d6efe551edf03c728b14eb00df3d0d336ff76cad"
|
| 33 |
+
},
|
| 34 |
+
{
|
| 35 |
+
"path": "code/come.py",
|
| 36 |
+
"size": 24499,
|
| 37 |
+
"sha256": "782e306e43f59e6fc1df28ba346ee57b03004c283376c661233b144f7491d9f8"
|
| 38 |
+
},
|
| 39 |
+
{
|
| 40 |
+
"path": "code/eval_llama31_8b_12bench.py",
|
| 41 |
+
"size": 6694,
|
| 42 |
+
"sha256": "94f6ca3e633f10b5cdef756c1e88e32cdf1615a8f17d078918c0b412a445fb37"
|
| 43 |
+
},
|
| 44 |
+
{
|
| 45 |
+
"path": "code/eval_llama31_fit_ablation_one.sh",
|
| 46 |
+
"size": 3118,
|
| 47 |
+
"sha256": "ae03668f8f4aae078813858b17aada4d0cc828a848d4321036736bf12ca665dd"
|
| 48 |
+
},
|
| 49 |
+
{
|
| 50 |
+
"path": "code/evaluate_abprune_compact_ppl.py",
|
| 51 |
+
"size": 7038,
|
| 52 |
+
"sha256": "916db0545ee18ba39dbbb0af9ce4f379a1ddef0b54d0477caf402ee24421a050"
|
| 53 |
+
},
|
| 54 |
+
{
|
| 55 |
+
"path": "code/evaluate_hchc_wikitext2_ppl.py",
|
| 56 |
+
"size": 5422,
|
| 57 |
+
"sha256": "a1c1c0bf8422ddc70cc5e9c0049830b9aa594742fdeffa110de7b3dcf30c1dd3"
|
| 58 |
+
},
|
| 59 |
+
{
|
| 60 |
+
"path": "code/finalize_come_batch_report.py",
|
| 61 |
+
"size": 8875,
|
| 62 |
+
"sha256": "98ba8baf96d728dd71537026652bd08662bc39514d682f5bfd7044afb27ec568"
|
| 63 |
+
},
|
| 64 |
+
{
|
| 65 |
+
"path": "code/fit_ablation_come.py",
|
| 66 |
+
"size": 2615,
|
| 67 |
+
"sha256": "21345e899859f09745b008e6a77582a574a2ba66fa9b071634b16fd7969e3dbb"
|
| 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_come_batch_run.py",
|
| 81 |
+
"size": 1538,
|
| 82 |
+
"sha256": "5397f6f4e3cc5763348f56ba4fff7b96b57a3939967e5bb29a8134306bf6fe2b"
|
| 83 |
+
},
|
| 84 |
+
{
|
| 85 |
+
"path": "code/launch_come_batch_comparison.py",
|
| 86 |
+
"size": 13283,
|
| 87 |
+
"sha256": "1b18b3dcb9d82705e4cfc8eab065ec5a52a34405480c0aa48a7ba4f535f3ecc6"
|
| 88 |
+
},
|
| 89 |
+
{
|
| 90 |
+
"path": "code/launch_llama31_come_fit2.sh",
|
| 91 |
+
"size": 6784,
|
| 92 |
+
"sha256": "0b8fa86012cc34ca690495d2fe99129237ce45b204e42cc343897a6d2411ebd8"
|
| 93 |
+
},
|
| 94 |
+
{
|
| 95 |
+
"path": "code/monitor_come_batch_local.ps1",
|
| 96 |
+
"size": 1458,
|
| 97 |
+
"sha256": "ad455b4e103f8e909c784b27f9732b25411fb901184a19a90b5aa1f2586fec58"
|
| 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_come_batch_calibration.py",
|
| 111 |
+
"size": 2339,
|
| 112 |
+
"sha256": "f6f07a369fb83f86add9b2594beed6823428d68db0d56e2373c75911093f41ad"
|
| 113 |
+
},
|
| 114 |
+
{
|
| 115 |
+
"path": "code/prepare_lmeval9_local_cache.py",
|
| 116 |
+
"size": 4706,
|
| 117 |
+
"sha256": "b9d7cfa46fa42cc017f53c5fffa34832756246377c3586484c0c54a53a00de8b"
|
| 118 |
+
},
|
| 119 |
+
{
|
| 120 |
+
"path": "code/prepare_offline_ppl_cache.py",
|
| 121 |
+
"size": 1329,
|
| 122 |
+
"sha256": "b623ed2d4a71beda5427f86875bf5ee6364891f2e4854ff03539d3a94db22f2b"
|
| 123 |
+
},
|
| 124 |
+
{
|
| 125 |
+
"path": "code/project_commit.txt",
|
| 126 |
+
"size": 41,
|
| 127 |
+
"sha256": "12daa9cc7122d7f29b2e1c4889b321c2f72d884fac1950133258605c68f889bd"
|
| 128 |
+
},
|
| 129 |
+
{
|
| 130 |
+
"path": "code/run_come_batch_arm.sh",
|
| 131 |
+
"size": 2442,
|
| 132 |
+
"sha256": "66186d8671723fcb265aba41fd7a5b73601608b7c1e406f8f9a2cad39166577f"
|
| 133 |
+
},
|
| 134 |
+
{
|
| 135 |
+
"path": "code/run_external_abprune_instruct_order.py",
|
| 136 |
+
"size": 4771,
|
| 137 |
+
"sha256": "c39736b64fd793a568ed2c4b3dcdfcb27f21123c28e7592392aef145336b0ecd"
|
| 138 |
+
},
|
| 139 |
+
{
|
| 140 |
+
"path": "code/run_llama31_base_fit_ablation.py",
|
| 141 |
+
"size": 41780,
|
| 142 |
+
"sha256": "eced665afd90758d15268554b262a3ba8c64f0a4080105f65695312e570dbe04"
|
| 143 |
+
},
|
| 144 |
+
{
|
| 145 |
+
"path": "code/run_llama31_come_fit_arm.sh",
|
| 146 |
+
"size": 2729,
|
| 147 |
+
"sha256": "40c4febea4e215eae2598ca8fe09b5dbcf47b1b8d6fd9ab34d40a9c821c7544a"
|
| 148 |
+
},
|
| 149 |
+
{
|
| 150 |
+
"path": "code/source_feature_transport.py",
|
| 151 |
+
"size": 13200,
|
| 152 |
+
"sha256": "75809bdbbc9bf73f07adaf1f0c816fc9abd1d9b7c0b8a0d561c96cb0313e243f"
|
| 153 |
+
},
|
| 154 |
+
{
|
| 155 |
+
"path": "code/validate_native_come_replay.py",
|
| 156 |
+
"size": 2342,
|
| 157 |
+
"sha256": "639296537e990f5ad097773a7ed259ae188fbb63a74c606d29bb96dd6c3def56"
|
| 158 |
+
},
|
| 159 |
+
{
|
| 160 |
+
"path": "code/verify_public_experiment_backups.py",
|
| 161 |
+
"size": 5147,
|
| 162 |
+
"sha256": "258ae35b639ee4f331f241e78d9be59eb60a4284afbf673a7f71f591c6d56d7a"
|
| 163 |
+
},
|
| 164 |
+
{
|
| 165 |
+
"path": "comparison.csv",
|
| 166 |
+
"size": 1366,
|
| 167 |
+
"sha256": "8a83f9fc7d27f058dcf9c7255c52beb710f3bc936356ec1f1f3c6f6e7e68f8ec"
|
| 168 |
+
},
|
| 169 |
+
{
|
| 170 |
+
"path": "comparison.json",
|
| 171 |
+
"size": 3305,
|
| 172 |
+
"sha256": "65402aac729e7cf73b382b452e00b26bb89cb39b3e77f233cea5460d27a60e65"
|
| 173 |
+
},
|
| 174 |
+
{
|
| 175 |
+
"path": "project_commit.txt",
|
| 176 |
+
"size": 41,
|
| 177 |
+
"sha256": "2541fd149c13e0dd0840db64ba17033e9b73f02c53d166f12391c07c04de89fd"
|
| 178 |
+
},
|
| 179 |
+
{
|
| 180 |
+
"path": "report_ko.md",
|
| 181 |
+
"size": 11805,
|
| 182 |
+
"sha256": "4994b176f1ba2fbbb4329c2745c52ff68b284c2a5772a45c6a78fe1de1f3675d"
|
| 183 |
+
},
|
| 184 |
+
{
|
| 185 |
+
"path": "results/backup_audit.json",
|
| 186 |
+
"size": 1273,
|
| 187 |
+
"sha256": "ba36e3235d5dd808b0e74749c4f3fbaa9cd4ec211f8ade67dd83ad0bb6769d34"
|
| 188 |
+
},
|
| 189 |
+
{
|
| 190 |
+
"path": "results/batch1/audit/cycle_01_fit.json",
|
| 191 |
+
"size": 10503,
|
| 192 |
+
"sha256": "e610603390e2bfbf91bca27cd559e0bd2f2ea1eb2868fe7d1dfac14a371f0c4e"
|
| 193 |
+
},
|
| 194 |
+
{
|
| 195 |
+
"path": "results/batch1/audit/cycle_02_fit.json",
|
| 196 |
+
"size": 10509,
|
| 197 |
+
"sha256": "372dd31720f078d4f073360486357ab5a64ccca10fa45231597a9133c69d9487"
|
| 198 |
+
},
|
| 199 |
+
{
|
| 200 |
+
"path": "results/batch1/audit/cycle_03_fit.json",
|
| 201 |
+
"size": 10536,
|
| 202 |
+
"sha256": "d10a2bd8101efc6301f8e9c46e649306286030192601d9b36ae31af2b28f8075"
|
| 203 |
+
},
|
| 204 |
+
{
|
| 205 |
+
"path": "results/batch1/audit/cycle_04_fit.json",
|
| 206 |
+
"size": 10498,
|
| 207 |
+
"sha256": "ff2a7962f471c0d0cd7a637f9c45db756e6cee1290ae0d7a5d2f3c45ba4c88e9"
|
| 208 |
+
},
|
| 209 |
+
{
|
| 210 |
+
"path": "results/batch1/audit/cycle_05_fit.json",
|
| 211 |
+
"size": 10502,
|
| 212 |
+
"sha256": "4a7b31a5870c3a808af9238e2822649f9d098e403701971fa9a234dc45d48c84"
|
| 213 |
+
},
|
| 214 |
+
{
|
| 215 |
+
"path": "results/batch1/audit/cycle_06_fit.json",
|
| 216 |
+
"size": 10535,
|
| 217 |
+
"sha256": "7c302708a2f5d41feaf16c796125f77b45837bc7183023ed58d10631d5cb06bf"
|
| 218 |
+
},
|
| 219 |
+
{
|
| 220 |
+
"path": "results/batch1/audit/cycle_07_fit.json",
|
| 221 |
+
"size": 10542,
|
| 222 |
+
"sha256": "580ee9d4722da43da7d22bd9b7342f951dd1b0be5d74da601698a0b51fcbf889"
|
| 223 |
+
},
|
| 224 |
+
{
|
| 225 |
+
"path": "results/batch1/audit/cycle_08_fit.json",
|
| 226 |
+
"size": 10556,
|
| 227 |
+
"sha256": "f1c1ff376af922f48a7bb5433288c63c72c56c69ba78ed093bced356cfbfccbc"
|
| 228 |
+
},
|
| 229 |
+
{
|
| 230 |
+
"path": "results/batch1/audit/data_fingerprints.json",
|
| 231 |
+
"size": 509,
|
| 232 |
+
"sha256": "0a3902dc3badda0d88f08e0b1bbaa24c9257efabf1170fa2704d006da446d9ce"
|
| 233 |
+
},
|
| 234 |
+
{
|
| 235 |
+
"path": "results/batch1/audit/selection.json",
|
| 236 |
+
"size": 9236,
|
| 237 |
+
"sha256": "2fee7e27d75171caf69dca9720a0b26c387f03b978f8a9d6a87aac93bea3ee3d"
|
| 238 |
+
},
|
| 239 |
+
{
|
| 240 |
+
"path": "results/batch1/audit/selection_inputs.json",
|
| 241 |
+
"size": 223,
|
| 242 |
+
"sha256": "9905a29e49c83b3b77bd8170602905e20324959208ea4575cbfde33c33f1a187"
|
| 243 |
+
},
|
| 244 |
+
{
|
| 245 |
+
"path": "results/batch1/compact_metadata.json",
|
| 246 |
+
"size": 1810,
|
| 247 |
+
"sha256": "a3d5f4d3aeb7b60ad8a8e8bc352db69dba31d68b0f14c86161d85ed4a516d3d4"
|
| 248 |
+
},
|
| 249 |
+
{
|
| 250 |
+
"path": "results/batch1/execution_commit.txt",
|
| 251 |
+
"size": 41,
|
| 252 |
+
"sha256": "12daa9cc7122d7f29b2e1c4889b321c2f72d884fac1950133258605c68f889bd"
|
| 253 |
+
},
|
| 254 |
+
{
|
| 255 |
+
"path": "results/batch1/final_14bench.json",
|
| 256 |
+
"size": 886,
|
| 257 |
+
"sha256": "bca178e3b71eee988a89006e403d6743115154116f9afaa982653a458eea9a4b"
|
| 258 |
+
},
|
| 259 |
+
{
|
| 260 |
+
"path": "results/batch1/final_lmeval9.json",
|
| 261 |
+
"size": 42788,
|
| 262 |
+
"sha256": "bc93508ae288f7f413258f1ed259914ad09359ef47140b5d573ffcc38808dd93"
|
| 263 |
+
},
|
| 264 |
+
{
|
| 265 |
+
"path": "results/batch1/final_opencompass5.json",
|
| 266 |
+
"size": 1105,
|
| 267 |
+
"sha256": "39a243e8e439c22f3746dda2c65b8af1f77c0d92e7dc25b73b7636f42c736624"
|
| 268 |
+
},
|
| 269 |
+
{
|
| 270 |
+
"path": "results/batch1/final_ppl.json",
|
| 271 |
+
"size": 1236,
|
| 272 |
+
"sha256": "048f91d7cb0c23b7b71df8e5600082fc3dc30e358a47c17141caaedcfda74892"
|
| 273 |
+
},
|
| 274 |
+
{
|
| 275 |
+
"path": "results/batch1/training_elapsed.json",
|
| 276 |
+
"size": 84,
|
| 277 |
+
"sha256": "a522e54d269f893f7556dc6d95a957771dfdbea98344c41dee251b3958f470ad"
|
| 278 |
+
},
|
| 279 |
+
{
|
| 280 |
+
"path": "results/batch1_backup.json",
|
| 281 |
+
"size": 407,
|
| 282 |
+
"sha256": "7765bd6026fc57de74d7700f0f798f71967d2cb5320934c7ef32228cdca436a3"
|
| 283 |
+
},
|
| 284 |
+
{
|
| 285 |
+
"path": "results/batch_large/audit/cycle_01_fit.json",
|
| 286 |
+
"size": 10511,
|
| 287 |
+
"sha256": "6a1a8ca0eb836052a2c8f0da256fe88ed9c0a2d6067c53a9d75516712b5ada23"
|
| 288 |
+
},
|
| 289 |
+
{
|
| 290 |
+
"path": "results/batch_large/audit/cycle_02_fit.json",
|
| 291 |
+
"size": 10512,
|
| 292 |
+
"sha256": "269ea2bd15dadb82d95f69f04cf474213b3b7954757c0190d21146ac5ce4ef83"
|
| 293 |
+
},
|
| 294 |
+
{
|
| 295 |
+
"path": "results/batch_large/audit/cycle_03_fit.json",
|
| 296 |
+
"size": 10556,
|
| 297 |
+
"sha256": "d418e56d68e15f136e5e8267fe76011df19260d42f9c69a0f8f9739ca09d5a28"
|
| 298 |
+
},
|
| 299 |
+
{
|
| 300 |
+
"path": "results/batch_large/audit/cycle_04_fit.json",
|
| 301 |
+
"size": 10505,
|
| 302 |
+
"sha256": "1120a3cd725a41b6bdeddf56724d351b814a14a30d00cc7f8ce1351e1084960c"
|
| 303 |
+
},
|
| 304 |
+
{
|
| 305 |
+
"path": "results/batch_large/audit/cycle_05_fit.json",
|
| 306 |
+
"size": 10512,
|
| 307 |
+
"sha256": "7d0658921287b8bb73a380dacb936e1fc78a0d2e7af2db69da080452eabedac8"
|
| 308 |
+
},
|
| 309 |
+
{
|
| 310 |
+
"path": "results/batch_large/audit/cycle_06_fit.json",
|
| 311 |
+
"size": 10550,
|
| 312 |
+
"sha256": "1472c1f985b6bf7cd84ab76ed7316cf61f07572dfcc96b5d58e7cc9a4b6fdce6"
|
| 313 |
+
},
|
| 314 |
+
{
|
| 315 |
+
"path": "results/batch_large/audit/cycle_07_fit.json",
|
| 316 |
+
"size": 10550,
|
| 317 |
+
"sha256": "51f2bc576c9fac7a37e47b523932bb3f22e6868f07c5820206765184358d0cd2"
|
| 318 |
+
},
|
| 319 |
+
{
|
| 320 |
+
"path": "results/batch_large/audit/cycle_08_fit.json",
|
| 321 |
+
"size": 10574,
|
| 322 |
+
"sha256": "622a4796ecfff6d24f8a807ed9b62bf3aa30d4f9f1e54853d64235f28190c455"
|
| 323 |
+
},
|
| 324 |
+
{
|
| 325 |
+
"path": "results/batch_large/audit/data_fingerprints.json",
|
| 326 |
+
"size": 509,
|
| 327 |
+
"sha256": "0a3902dc3badda0d88f08e0b1bbaa24c9257efabf1170fa2704d006da446d9ce"
|
| 328 |
+
},
|
| 329 |
+
{
|
| 330 |
+
"path": "results/batch_large/audit/selection.json",
|
| 331 |
+
"size": 9248,
|
| 332 |
+
"sha256": "4565abbe9332034c4d30816d76c2bb5ee8de187d393231ab24698c0df8f04271"
|
| 333 |
+
},
|
| 334 |
+
{
|
| 335 |
+
"path": "results/batch_large/audit/selection_inputs.json",
|
| 336 |
+
"size": 223,
|
| 337 |
+
"sha256": "9905a29e49c83b3b77bd8170602905e20324959208ea4575cbfde33c33f1a187"
|
| 338 |
+
},
|
| 339 |
+
{
|
| 340 |
+
"path": "results/batch_large/compact_metadata.json",
|
| 341 |
+
"size": 1583,
|
| 342 |
+
"sha256": "0bf1ea55ac7ed24f631a0ed067bb39f914cdebd9a7643516e62ce367f00147ac"
|
| 343 |
+
},
|
| 344 |
+
{
|
| 345 |
+
"path": "results/batch_large/execution_commit.txt",
|
| 346 |
+
"size": 41,
|
| 347 |
+
"sha256": "12daa9cc7122d7f29b2e1c4889b321c2f72d884fac1950133258605c68f889bd"
|
| 348 |
+
},
|
| 349 |
+
{
|
| 350 |
+
"path": "results/batch_large/final_14bench.json",
|
| 351 |
+
"size": 882,
|
| 352 |
+
"sha256": "b377f24081572a73f623fbce4d836d2ded0e76d816414122ad8737eac6d12de4"
|
| 353 |
+
},
|
| 354 |
+
{
|
| 355 |
+
"path": "results/batch_large/final_lmeval9.json",
|
| 356 |
+
"size": 42740,
|
| 357 |
+
"sha256": "15b5a58ed8d64a5fff5c0215aa522bbfd72213e82fef0118c45db5254c714f2a"
|
| 358 |
+
},
|
| 359 |
+
{
|
| 360 |
+
"path": "results/batch_large/final_opencompass5.json",
|
| 361 |
+
"size": 1109,
|
| 362 |
+
"sha256": "7916a5a5857402d05f5d3dbff955300a77b679558a6ea047c6cd1034b8a25903"
|
| 363 |
+
},
|
| 364 |
+
{
|
| 365 |
+
"path": "results/batch_large/final_ppl.json",
|
| 366 |
+
"size": 1241,
|
| 367 |
+
"sha256": "8feb865f0f464ce8cf69c4f2b974625df670caa345dbb0b7b5ed62db681cffd3"
|
| 368 |
+
},
|
| 369 |
+
{
|
| 370 |
+
"path": "results/batch_large/training_elapsed.json",
|
| 371 |
+
"size": 84,
|
| 372 |
+
"sha256": "a06c6b8abedb43e977f6a4e8bfa70987dcfbae0ee74499c4ec20f20173dac382"
|
| 373 |
+
},
|
| 374 |
+
{
|
| 375 |
+
"path": "results/batch_large_backup.json",
|
| 376 |
+
"size": 412,
|
| 377 |
+
"sha256": "2b5d053f3c1afa90dda7c62a107edec1e0947234b70584269bbd5f1f5ae7d2a8"
|
| 378 |
+
},
|
| 379 |
+
{
|
| 380 |
+
"path": "results/batch_profile.json",
|
| 381 |
+
"size": 2318,
|
| 382 |
+
"sha256": "49888e80a05862a9698eee1fd75c96ba7f05b91c1334c5c14ee4083c9322a74e"
|
| 383 |
+
},
|
| 384 |
+
{
|
| 385 |
+
"path": "results/comparison.csv",
|
| 386 |
+
"size": 1366,
|
| 387 |
+
"sha256": "8a83f9fc7d27f058dcf9c7255c52beb710f3bc936356ec1f1f3c6f6e7e68f8ec"
|
| 388 |
+
},
|
| 389 |
+
{
|
| 390 |
+
"path": "results/comparison.json",
|
| 391 |
+
"size": 3305,
|
| 392 |
+
"sha256": "65402aac729e7cf73b382b452e00b26bb89cb39b3e77f233cea5460d27a60e65"
|
| 393 |
+
},
|
| 394 |
+
{
|
| 395 |
+
"path": "results/final_status.json",
|
| 396 |
+
"size": 667,
|
| 397 |
+
"sha256": "cf200bbb7ff83dd21bf98b1101fb02157a48ebb0b83c2f7791b351451051e3a8"
|
| 398 |
+
},
|
| 399 |
+
{
|
| 400 |
+
"path": "results/instance_retention.json",
|
| 401 |
+
"size": 859,
|
| 402 |
+
"sha256": "ee40f724d4994730b90855793c80202e771848255445223a6e90517f9c576270"
|
| 403 |
+
},
|
| 404 |
+
{
|
| 405 |
+
"path": "results/launch_status.json",
|
| 406 |
+
"size": 669,
|
| 407 |
+
"sha256": "acd44c7b8976b5e00129cbbe66029fef828461d56ee45fb862f9f62d1658447b"
|
| 408 |
+
},
|
| 409 |
+
{
|
| 410 |
+
"path": "results/native_replay.json",
|
| 411 |
+
"size": 4936,
|
| 412 |
+
"sha256": "d7eb663ef4ffc6d89ed0250898e74babc60d6814d8995febf8354db315e0c41a"
|
| 413 |
+
},
|
| 414 |
+
{
|
| 415 |
+
"path": "results/selection_provenance.json",
|
| 416 |
+
"size": 18982,
|
| 417 |
+
"sha256": "3a883c340d595e34a8339f368da9160a636aaaf2d9e3c87aa74c3bac3da11720"
|
| 418 |
+
},
|
| 419 |
+
{
|
| 420 |
+
"path": "results/summary.json",
|
| 421 |
+
"size": 250022,
|
| 422 |
+
"sha256": "1af4a550d95e58feff01189a03e2080937d046fc9e698079fe81afb5a90fd630"
|
| 423 |
+
},
|
| 424 |
+
{
|
| 425 |
+
"path": "summary.json",
|
| 426 |
+
"size": 250022,
|
| 427 |
+
"sha256": "1af4a550d95e58feff01189a03e2080937d046fc9e698079fe81afb5a90fd630"
|
| 428 |
+
}
|
| 429 |
+
],
|
| 430 |
+
"total_files": 85,
|
| 431 |
+
"total_bytes": 1305086
|
| 432 |
+
}
|
runs/vast-paper_revision-come-attn-fit-20261126-62646539/20261126-llama31-come-attn-mlp-batch/catalog/project_commit.txt
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
6a3e85f7c425e32f88639f389fc177ae633c986e
|
runs/vast-paper_revision-come-attn-fit-20261126-62646539/20261126-llama31-come-attn-mlp-batch/catalog/report_ko.md
ADDED
|
@@ -0,0 +1,172 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Llama-3.1-8B Base CoMe attention + MLP FiT, 25% pruning
|
| 2 |
+
|
| 3 |
+
## Final accuracy results / 최종 정확도
|
| 4 |
+
|
| 5 |
+
Attention+MLP 조건의 batch 1·8 평가와 가중치 백업을 모두 완료했습니다.
|
| 6 |
+
Bench12는 batch 8이 높고, MMLU·CMMLU는 batch 1이 높습니다. 같은 batch의
|
| 7 |
+
MLP-only 대비로는 batch 1의 Bench12가 하락하고 batch 8은 상승했습니다.
|
| 8 |
+
Attention 추가가 모든 조건에서 일관되게 정확도를 높였다고 해석할 수 없습니다.
|
| 9 |
+
두 조건 모두 RMSNorm은 고정했고, FiT 데이터·학습률·epoch·loss는 이전과 같습니다.
|
| 10 |
+
Batch를 키우면 업데이트 수가 줄고, 이후의 CoMe 병합 경로도 달라집니다.
|
| 11 |
+
서버는 사용자 지시에 따라 반납하지 않고 실행 상태로 유지합니다.
|
| 12 |
+
|
| 13 |
+
Llama-3.1-8B **Base**, CoMe 25% (8/32 blocks removed). Bench12 is the
|
| 14 |
+
unweighted mean of the twelve tasks excluding MMLU and CMMLU. Accuracies
|
| 15 |
+
below are percentages. Both RMSNorm weights were frozen in every run.
|
| 16 |
+
|
| 17 |
+
| FiT scope | Batch | Bench12 | MMLU | CMMLU | WikiText2 PPL | Pruning + FiT wall |
|
| 18 |
+
|---|---:|---:|---:|---:|---:|---:|
|
| 19 |
+
| MLP-only | 1 | 56.0334 | 59.7422 | 44.4396 | 19.2178 | 33m1.22s |
|
| 20 |
+
| MLP-only | 8 | 56.1463 | 57.1713 | 45.7434 | 18.1718 | 23m26.95s |
|
| 21 |
+
| Attention+MLP | 1 | 55.3656 | 61.4015 | 49.0589 | 25.9647 | 37m36.42s |
|
| 22 |
+
| Attention+MLP | 8 | 59.2103 | 60.6466 | 44.9836 | 19.4930 | 25m16.43s |
|
| 23 |
+
|
| 24 |
+
Batch1: attention addition changed Bench12 by -0.6678pp, MMLU +1.6593pp,
|
| 25 |
+
and CMMLU +4.6192pp relative to MLP-only batch1. Batch8: Bench12 +3.0640pp,
|
| 26 |
+
MMLU +3.4753pp, CMMLU -0.7598pp relative to MLP-only batch8. Batch8 beats
|
| 27 |
+
batch1 on all twelve Bench12 component tasks within the attention+MLP pair;
|
| 28 |
+
batch1 is higher on MMLU and CMMLU. These are single-seed observations,
|
| 29 |
+
not proof that a batch choice universally improves quality. PPL and benchmark
|
| 30 |
+
accuracy do not move monotonically here.
|
| 31 |
+
|
| 32 |
+
Within the attention+MLP pair, batch8 shortened pruning+FiT wall by
|
| 33 |
+
739.9842s (12m19.98s, 32.79%). This excludes setup, profiling, evaluation
|
| 34 |
+
and upload. Cross-scope timing uses different A10080GB hosts and is not a
|
| 35 |
+
controlled hardware comparison. All inputs and attention masks match the
|
| 36 |
+
preceding MLP-only experiment exactly. Batch1/8 have 512/64 updates/stage;
|
| 37 |
+
native CoMe dynamically reselects pairs after each FiT stage. Selection paths
|
| 38 |
+
first differ at stage4 across scopes, and at stage6 within the attention pair.
|
| 39 |
+
|
| 40 |
+
Historical ABPrune+FiT is MLP-only: Bench12 56.9310%, MMLU 37.4662%,
|
| 41 |
+
CMMLU 36.5740%. The attention+MLP batch8 Bench12 exceeds that reference by
|
| 42 |
+
2.2793pp, while batch1 is lower by 1.5654pp. The seven-projection CoMe runs
|
| 43 |
+
have a larger training scope than the three-projection ABPrune reference;
|
| 44 |
+
do not present these as identical-scope merging-only comparisons.
|
| 45 |
+
|
| 46 |
+
All16 production audits passed exact native-CoMe merged-norm hash equality,
|
| 47 |
+
four attention/three MLP/zero other trainable projections, physical forward
|
| 48 |
+
batch shapes, and data fingerprint checks. No production restart occurred.
|
| 49 |
+
|
| 50 |
+
**Instance62646539 must remain running after backup. Return only on a new
|
| 51 |
+
explicit user instruction. Auto-return remains false.**
|
| 52 |
+
|
| 53 |
+
User requested the matching attention-inclusive experiment after the completed
|
| 54 |
+
MLP-only runs and explicitly instructed: do not return any instance unless
|
| 55 |
+
the user asks. Retain this server after evaluation and backup, even if idle.
|
| 56 |
+
No automatic destroy or return command is authorized for this new instance.
|
| 57 |
+
|
| 58 |
+
Scope: Llama-3.1-8B Base, eight removed blocks (32->24), native stagewise
|
| 59 |
+
CoMe selection and initialization. Compare physical FiT batch1 and batch8
|
| 60 |
+
on two A10080GB GPUs. Train seven projections: q/k/v/o attention and
|
| 61 |
+
gate/up/down MLP; freeze both CoMe-initialized RMSNorm weights. This differs
|
| 62 |
+
from historical full-block FiT, which also trained norms. No Transport,
|
| 63 |
+
Fisher initialization, rho, LoRA, or imposed fixed interval.
|
| 64 |
+
|
| 65 |
+
Model meta-llama/Llama-3.1-8B at
|
| 66 |
+
d04e592bb4f6aa9cfee91e2e20afa771667e1d4b. Frozen native CoMe selection
|
| 67 |
+
SlimPajama256 rows ->91x2048 windows, seed10/buffer10000, scoringbatch1,
|
| 68 |
+
angular_last/power1/minimum retention.97/repeat allowed. Expected input
|
| 69 |
+
SHA2560d5ee3894a716120c8f738c25d05838ca6871137f7b471d4616da55cab4a7361.
|
| 70 |
+
The previous no-FiT replay matched all8 historical pair scores, source groups
|
| 71 |
+
and retained counts exactly; preserve and independently check this input hash.
|
| 72 |
+
|
| 73 |
+
FiT data is unchanged: pinned SlimPajama512x1024,524288tokens/stage,
|
| 74 |
+
seed42,one epoch/stage,LR1e-4,WD0,clip1,accumulation1. HiddenMSE1,
|
| 75 |
+
MLPMSE1,attentionMSE0,KL.02/temp4,previous-cycle teacher; BF16 model,
|
| 76 |
+
zero-initialized additive FP32 U. Training input SHA256
|
| 77 |
+
2b2d044c8c040f67891817ecc110f0fa0de2f469db4c6731114ff7816bbf1cd0;
|
| 78 |
+
mask SHA256c8e7f8e30cd532b82e6af4b98d596bc7106f29f9fb2b398b44355e624898a30d.
|
| 79 |
+
Only the trainable scope changes relative to the preceding MLP-only batch
|
| 80 |
+
comparison. Batch1 has512 updates/stage; batch8 has64, with fixed LR/epochs.
|
| 81 |
+
Profile actual forward shapes/memory before production; do not silently
|
| 82 |
+
reduce the requested batch8 or train norms if a memory problem occurs.
|
| 83 |
+
|
| 84 |
+
Validate seven native-initialized U tensors with nonzero gradients/updates,
|
| 85 |
+
four attention/three MLP/zero norm trainable parameters, unchanged teacher,
|
| 86 |
+
and exactly frozen merged norms. Preserve calibration and FiT hashes across
|
| 87 |
+
both arms and against the previous MLP-only experiment. Evaluate full
|
| 88 |
+
Bench12 plus MMLU and CMMLU separately, and canonical packed WikiText2 PPL.
|
| 89 |
+
Back up final reconstructible weights, raw results, code and audits to the
|
| 90 |
+
existing public LJYAI/paper_revision under a unique session path. No raw
|
| 91 |
+
calibration token caches or benchmark archives are published. Only local
|
| 92 |
+
controller pushes GitHub; code moves by SSH Git bundles.
|
| 93 |
+
|
| 94 |
+
Initial protocol above; completed results and later checkpoints are recorded below.
|
| 95 |
+
|
| 96 |
+
## Rental, validation and production launch
|
| 97 |
+
|
| 98 |
+
Instance62646539, offer61164756, machine70593, twoA100-SXM4-80GB,260GBdisk,
|
| 99 |
+
advertised host RAM512996MiB, quote2.4137037037USD/hour includingdisk,
|
| 100 |
+
network additional. Session vast-paper_revision-come-attn-fit-20261126-62646539;
|
| 101 |
+
remote branch codex/vast-paper_revision-come-attn-fit-20261126-62646539;
|
| 102 |
+
project /workspace/paper_revision/sessions/vast-paper_revision-come-attn-fit-20261126-62646539;
|
| 103 |
+
artifacts /workspace/come-attn-fit-20261126; external /workspace/external/come-attn-fit.
|
| 104 |
+
Image pytorch/pytorch:2.8.0-cuda12.8-cudnn9-devel. Same pinned
|
| 105 |
+
transformers5.15.1/datasets3.6.0/hub1.33.0/lm-eval0.4.12 engine as previous
|
| 106 |
+
MLP-only experiment; legacy calibration datasets3.1.0/transformers4.52.1.
|
| 107 |
+
|
| 108 |
+
Prior calibration token hash exactly matched on this host. Reused the
|
| 109 |
+
previously verified8-stage no-FiT replay evidence after this hash check; no
|
| 110 |
+
new8-stage no-FiT replay is claimed. Native CoMe implementation unchanged.
|
| 111 |
+
Nine CoMe unit tests passed. Old MLP3 and full-block9 algebra regression
|
| 112 |
+
checks passed; new attention4+MLP3/frozen-norm2 exact initialization, seven
|
| 113 |
+
nonzero U gradients, unchanged teacher and materialization checks passed.
|
| 114 |
+
All four real64-sequence probes passed7U/no-missing-gradient/nonzero-update
|
| 115 |
+
and before/after norm SHA256 equality checks. Actual forward shapes match
|
| 116 |
+
physicalbatch1/2/4/8. Probe FiT seconds:34.24657/26.21264/23.43615/22.60571;
|
| 117 |
+
tokens/sec1913.65/2500.17/2796.36/2899.09. Batch8 peak allocated61696254976,
|
| 118 |
+
reserved74048339968,total85094825984bytes;11.05GB reserve margin.
|
| 119 |
+
|
| 120 |
+
Both full production arms started2026-11-26 15:26:40KST, GPU0batch1 and
|
| 121 |
+
GPU1batch8. Fixed user-comparison batch8, not an accuracy-selected hyperparameter.
|
| 122 |
+
Same512x1024 FiT inputs/loss/LR/epochs as MLP-only; optimizer steps512vs64
|
| 123 |
+
perstage. All131offline benchmark configurations and evaluation archives
|
| 124 |
+
validated before launch. No production or host restart.
|
| 125 |
+
|
| 126 |
+
Exact supervisor command:
|
| 127 |
+
```bash
|
| 128 |
+
python scripts/launch_come_batch_comparison.py --project /workspace/paper_revision/sessions/vast-paper_revision-come-attn-fit-20261126-62646539 --external /workspace/external/come-attn-fit --root /workspace/come-attn-fit-20261126 --model /workspace/models/llama31-base-d04e592 --session vast-paper_revision-come-attn-fit-20261126-62646539 --fit-scope attention_mlp --larger-batch 8 --expected-selection-hash 0d5ee3894a716120c8f738c25d05838ca6871137f7b471d4616da55cab4a7361 --experiment-id 20261126-llama31-come-attn-mlp-batch --protocol exp_md/2026-11-26_llama31-come-attn-mlp-batch-comparison.md
|
| 129 |
+
```
|
| 130 |
+
|
| 131 |
+
Public output prefix runs/vast-paper_revision-come-attn-fit-20261126-62646539/20261126-llama31-come-attn-mlp-batch/<batch1|batch_large>.
|
| 132 |
+
Only local computer pushes GitHub. A local read-only monitor checks every300s
|
| 133 |
+
and stops on experiment completion, without returning the server.
|
| 134 |
+
|
| 135 |
+
**User retention instruction remains absolute: retain instance62646539
|
| 136 |
+
after completion, including idle time. Do not destroy/return it without a
|
| 137 |
+
new explicit instruction.** Status: production active, no final result yet.
|
| 138 |
+
|
| 139 |
+
## Batch8 pruning and PPL checkpoint
|
| 140 |
+
|
| 141 |
+
Attention+MLP batch8 completed all8stages at2026-11-26 15:51:56KST.
|
| 142 |
+
Wall1516.4341526031494seconds (25m16.43s), WikiText2 NLL2.970053442826508,
|
| 143 |
+
PPL19.492961327144673,141sequences/288627predicted tokens. All8audits confirm
|
| 144 |
+
attention4/MLP3/norm0 trainable and exact before/after merged norm hashes.
|
| 145 |
+
Full benchmark evaluation active; batch1 remains in training. No final
|
| 146 |
+
accuracy claim. Instance explicitly retained; no return authorization.
|
| 147 |
+
|
| 148 |
+
## Both attention+MLP pruning arms completed
|
| 149 |
+
|
| 150 |
+
Batch1 completed2026-11-26 16:04:16KST, wall2256.4183456897736seconds
|
| 151 |
+
(37m36.42s). WikiText2 NLL3.256739151393268/PPL25.964731889312485.
|
| 152 |
+
Batch8 wall1516.4341526031494s (25m16.43s), PPL19.492961327144673.
|
| 153 |
+
All16stage audits passed attention4/MLP3/norm0 training and exact frozen
|
| 154 |
+
merged-norm hashes. Actual calibration and FiT token/mask hashes equal
|
| 155 |
+
the completed MLP-only controls. No production restart or data resampling.
|
| 156 |
+
Full accuracy evaluation remains active; no final accuracy claim.
|
| 157 |
+
Cross-scope wall times were measured on different A10080GB hosts and
|
| 158 |
+
should not be read as a controlled hardware comparison.
|
| 159 |
+
Instance62646539 remains running; explicit user return instruction required.
|
| 160 |
+
|
| 161 |
+
## Completed weight backups
|
| 162 |
+
|
| 163 |
+
- batch1: `LJYAI/paper_revision/runs/vast-paper_revision-come-attn-fit-20261126-62646539/20261126-llama31-come-attn-mlp-batch/batch1` at immutable `3754f1bdd3c1072c7b09cb594924d2a2a2ef0968`; 62 payload files, 1746474122 bytes plus manifest.
|
| 164 |
+
- batch_large: `LJYAI/paper_revision/runs/vast-paper_revision-come-attn-fit-20261126-62646539/20261126-llama31-come-attn-mlp-batch/batch_large` at immutable `6bddb1e37c9958bcd5b726d45aa3191b5128a912`; 61 payload files, 1309840823 bytes plus manifest.
|
| 165 |
+
|
| 166 |
+
Both evaluations and host-side verified uploads completed; independent controller-side SHA256 audit follows. Server is retained running, not returned. Execution code was launched from af3b6199d9a1447b3e9ada36c3ca0b53e9c29a00; per-arm execution_commit.txt identifies the packaged code snapshot. Training and evaluation sources are unchanged between those commits (only reports/finalizer changed).
|
| 167 |
+
|
| 168 |
+
## Final independent verification and retention
|
| 169 |
+
|
| 170 |
+
Controller-side immutable inventory + SHA256 verification passed for all125files (batch1:63, batch8:62), including server LFS content digests and directly downloaded Git blobs. Two new canonical records were appended; every existing canonical record was preserved exactly. Source/results were recovered through SSH Git bundles and pushed only from the local controller.
|
| 171 |
+
|
| 172 |
+
Instance62646539 provider actual_status/intended_status are both running. Two GPUs are idle with zero model memory and no compute processes at the final SSH observation. No destroy, return or stop was issued. Approximate continuing charge is USD2.4137/hour including allocated disk; keep running until an explicit new user instruction. Monitoring of the completed job stops without changing the instance state.
|
runs/vast-paper_revision-come-attn-fit-20261126-62646539/20261126-llama31-come-attn-mlp-batch/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-llama31-come-attn-mlp-batch/batch1",
|
| 8 |
+
"revision": "3754f1bdd3c1072c7b09cb594924d2a2a2ef0968",
|
| 9 |
+
"files": 63,
|
| 10 |
+
"bytes": 1746484403,
|
| 11 |
+
"manifest_sha256": "85f2ad7169ec1ea3ec2a9aa5955206ea0cba223ed74e724b126885d45a688144",
|
| 12 |
+
"all_payload_hashes_verified": true,
|
| 13 |
+
"lfs_files": 4,
|
| 14 |
+
"git_blob_files_read_back": 59,
|
| 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-llama31-come-attn-mlp-batch/batch_large",
|
| 21 |
+
"revision": "6bddb1e37c9958bcd5b726d45aa3191b5128a912",
|
| 22 |
+
"files": 62,
|
| 23 |
+
"bytes": 1309850926,
|
| 24 |
+
"manifest_sha256": "9c26c94c632135bedb62b38c3b5bd6e2a637160a7f54f77e9c0f0af791d615fd",
|
| 25 |
+
"all_payload_hashes_verified": true,
|
| 26 |
+
"lfs_files": 3,
|
| 27 |
+
"git_blob_files_read_back": 59,
|
| 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-llama31-come-attn-mlp-batch/catalog/results/batch1/audit/cycle_01_fit.json
ADDED
|
@@ -0,0 +1,389 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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 0.0,
|
| 13 |
+
"attn_reg_scale": 1.0,
|
| 14 |
+
"mlp_reg_scale": 1.0,
|
| 15 |
+
"param_subset": "all",
|
| 16 |
+
"train_subset": "all",
|
| 17 |
+
"num_gates": 7,
|
| 18 |
+
"num_attn_gates": 4,
|
| 19 |
+
"num_mlp_gates": 3,
|
| 20 |
+
"num_other_gates": 0,
|
| 21 |
+
"num_trainable_attn_gates": 4,
|
| 22 |
+
"num_trainable_mlp_gates": 3,
|
| 23 |
+
"num_trainable_other_gates": 0,
|
| 24 |
+
"lambda_init_summary": {
|
| 25 |
+
"num_tensors": 7,
|
| 26 |
+
"num_elements": 7,
|
| 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 |
+
"self_attn.q_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 |
+
"self_attn.k_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 |
+
"self_attn.v_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 |
+
"self_attn.o_proj.weight": {
|
| 55 |
+
"mean": 0.9998999834060669,
|
| 56 |
+
"std": 0.0,
|
| 57 |
+
"min": 0.9998999834060669,
|
| 58 |
+
"max": 0.9998999834060669,
|
| 59 |
+
"mean_abs_from_0_5": 0.4998999834060669
|
| 60 |
+
},
|
| 61 |
+
"mlp.gate_proj.weight": {
|
| 62 |
+
"mean": 0.9998999834060669,
|
| 63 |
+
"std": 0.0,
|
| 64 |
+
"min": 0.9998999834060669,
|
| 65 |
+
"max": 0.9998999834060669,
|
| 66 |
+
"mean_abs_from_0_5": 0.4998999834060669
|
| 67 |
+
},
|
| 68 |
+
"mlp.up_proj.weight": {
|
| 69 |
+
"mean": 0.9998999834060669,
|
| 70 |
+
"std": 0.0,
|
| 71 |
+
"min": 0.9998999834060669,
|
| 72 |
+
"max": 0.9998999834060669,
|
| 73 |
+
"mean_abs_from_0_5": 0.4998999834060669
|
| 74 |
+
},
|
| 75 |
+
"mlp.down_proj.weight": {
|
| 76 |
+
"mean": 0.9998999834060669,
|
| 77 |
+
"std": 0.0,
|
| 78 |
+
"min": 0.9998999834060669,
|
| 79 |
+
"max": 0.9998999834060669,
|
| 80 |
+
"mean_abs_from_0_5": 0.4998999834060669
|
| 81 |
+
}
|
| 82 |
+
}
|
| 83 |
+
},
|
| 84 |
+
"lambda_final_summary": {
|
| 85 |
+
"num_tensors": 7,
|
| 86 |
+
"num_elements": 7,
|
| 87 |
+
"mean": 1.0,
|
| 88 |
+
"std": 0.0,
|
| 89 |
+
"min": 1.0,
|
| 90 |
+
"max": 1.0,
|
| 91 |
+
"mean_abs_from_0_5": 0.5,
|
| 92 |
+
"per_tensor": {
|
| 93 |
+
"self_attn.q_proj.weight": {
|
| 94 |
+
"mean": 1.0,
|
| 95 |
+
"std": 0.0,
|
| 96 |
+
"min": 1.0,
|
| 97 |
+
"max": 1.0,
|
| 98 |
+
"mean_abs_from_0_5": 0.5
|
| 99 |
+
},
|
| 100 |
+
"self_attn.k_proj.weight": {
|
| 101 |
+
"mean": 1.0,
|
| 102 |
+
"std": 0.0,
|
| 103 |
+
"min": 1.0,
|
| 104 |
+
"max": 1.0,
|
| 105 |
+
"mean_abs_from_0_5": 0.5
|
| 106 |
+
},
|
| 107 |
+
"self_attn.v_proj.weight": {
|
| 108 |
+
"mean": 1.0,
|
| 109 |
+
"std": 0.0,
|
| 110 |
+
"min": 1.0,
|
| 111 |
+
"max": 1.0,
|
| 112 |
+
"mean_abs_from_0_5": 0.5
|
| 113 |
+
},
|
| 114 |
+
"self_attn.o_proj.weight": {
|
| 115 |
+
"mean": 1.0,
|
| 116 |
+
"std": 0.0,
|
| 117 |
+
"min": 1.0,
|
| 118 |
+
"max": 1.0,
|
| 119 |
+
"mean_abs_from_0_5": 0.5
|
| 120 |
+
},
|
| 121 |
+
"mlp.gate_proj.weight": {
|
| 122 |
+
"mean": 1.0,
|
| 123 |
+
"std": 0.0,
|
| 124 |
+
"min": 1.0,
|
| 125 |
+
"max": 1.0,
|
| 126 |
+
"mean_abs_from_0_5": 0.5
|
| 127 |
+
},
|
| 128 |
+
"mlp.up_proj.weight": {
|
| 129 |
+
"mean": 1.0,
|
| 130 |
+
"std": 0.0,
|
| 131 |
+
"min": 1.0,
|
| 132 |
+
"max": 1.0,
|
| 133 |
+
"mean_abs_from_0_5": 0.5
|
| 134 |
+
},
|
| 135 |
+
"mlp.down_proj.weight": {
|
| 136 |
+
"mean": 1.0,
|
| 137 |
+
"std": 0.0,
|
| 138 |
+
"min": 1.0,
|
| 139 |
+
"max": 1.0,
|
| 140 |
+
"mean_abs_from_0_5": 0.5
|
| 141 |
+
}
|
| 142 |
+
}
|
| 143 |
+
},
|
| 144 |
+
"lambda_delta_from_init": {
|
| 145 |
+
"num_tensors": 7,
|
| 146 |
+
"num_elements": 7,
|
| 147 |
+
"mean_abs": 0.0,
|
| 148 |
+
"rms": 0.0,
|
| 149 |
+
"max_abs": 0.0,
|
| 150 |
+
"per_tensor": {
|
| 151 |
+
"self_attn.q_proj.weight": {
|
| 152 |
+
"mean_abs": 0.0,
|
| 153 |
+
"rms": 0.0,
|
| 154 |
+
"max_abs": 0.0
|
| 155 |
+
},
|
| 156 |
+
"self_attn.k_proj.weight": {
|
| 157 |
+
"mean_abs": 0.0,
|
| 158 |
+
"rms": 0.0,
|
| 159 |
+
"max_abs": 0.0
|
| 160 |
+
},
|
| 161 |
+
"self_attn.v_proj.weight": {
|
| 162 |
+
"mean_abs": 0.0,
|
| 163 |
+
"rms": 0.0,
|
| 164 |
+
"max_abs": 0.0
|
| 165 |
+
},
|
| 166 |
+
"self_attn.o_proj.weight": {
|
| 167 |
+
"mean_abs": 0.0,
|
| 168 |
+
"rms": 0.0,
|
| 169 |
+
"max_abs": 0.0
|
| 170 |
+
},
|
| 171 |
+
"mlp.gate_proj.weight": {
|
| 172 |
+
"mean_abs": 0.0,
|
| 173 |
+
"rms": 0.0,
|
| 174 |
+
"max_abs": 0.0
|
| 175 |
+
},
|
| 176 |
+
"mlp.up_proj.weight": {
|
| 177 |
+
"mean_abs": 0.0,
|
| 178 |
+
"rms": 0.0,
|
| 179 |
+
"max_abs": 0.0
|
| 180 |
+
},
|
| 181 |
+
"mlp.down_proj.weight": {
|
| 182 |
+
"mean_abs": 0.0,
|
| 183 |
+
"rms": 0.0,
|
| 184 |
+
"max_abs": 0.0
|
| 185 |
+
}
|
| 186 |
+
}
|
| 187 |
+
},
|
| 188 |
+
"first_grad_summary": {
|
| 189 |
+
"joint": {
|
| 190 |
+
"step": 1,
|
| 191 |
+
"phase": "joint",
|
| 192 |
+
"gate": {
|
| 193 |
+
"num_tensors": 7,
|
| 194 |
+
"num_tensors_without_grad": 7,
|
| 195 |
+
"num_elements": 0,
|
| 196 |
+
"l2": 0.0,
|
| 197 |
+
"mean_abs": null,
|
| 198 |
+
"max_abs": 0.0
|
| 199 |
+
},
|
| 200 |
+
"u": {
|
| 201 |
+
"num_tensors": 7,
|
| 202 |
+
"num_tensors_without_grad": 0,
|
| 203 |
+
"num_elements": 218103808,
|
| 204 |
+
"l2": 0.04621322996625489,
|
| 205 |
+
"mean_abs": 1.3280027771473285e-06,
|
| 206 |
+
"max_abs": 0.00289154052734375
|
| 207 |
+
},
|
| 208 |
+
"rho": {
|
| 209 |
+
"num_tensors": 0,
|
| 210 |
+
"num_tensors_without_grad": 0,
|
| 211 |
+
"num_elements": 0,
|
| 212 |
+
"l2": 0.0,
|
| 213 |
+
"mean_abs": null,
|
| 214 |
+
"max_abs": 0.0
|
| 215 |
+
}
|
| 216 |
+
}
|
| 217 |
+
},
|
| 218 |
+
"u_delta_summary": {
|
| 219 |
+
"num_tensors": 7,
|
| 220 |
+
"num_elements": 218103808,
|
| 221 |
+
"mean": 8.301657973019107e-08,
|
| 222 |
+
"std": 0.002095396265434298,
|
| 223 |
+
"rms": 0.0020953962670787964,
|
| 224 |
+
"mean_abs": 0.001686239677767914,
|
| 225 |
+
"min": -0.017962045967578888,
|
| 226 |
+
"max": 0.019278671592473984,
|
| 227 |
+
"per_tensor": {
|
| 228 |
+
"self_attn.q_proj.weight": {
|
| 229 |
+
"mean": -2.913146772698383e-07,
|
| 230 |
+
"std": 0.0019486817063737124,
|
| 231 |
+
"rms": 0.001948681728148495,
|
| 232 |
+
"mean_abs": 0.001559942844323814,
|
| 233 |
+
"min": -0.010392497293651104,
|
| 234 |
+
"max": 0.01077086478471756
|
| 235 |
+
},
|
| 236 |
+
"self_attn.k_proj.weight": {
|
| 237 |
+
"mean": 2.3786427050254133e-07,
|
| 238 |
+
"std": 0.0019851046313401964,
|
| 239 |
+
"rms": 0.001985104645591186,
|
| 240 |
+
"mean_abs": 0.0015915698604658246,
|
| 241 |
+
"min": -0.013858834281563759,
|
| 242 |
+
"max": 0.016664935275912285
|
| 243 |
+
},
|
| 244 |
+
"self_attn.v_proj.weight": {
|
| 245 |
+
"mean": -3.7627378901561315e-07,
|
| 246 |
+
"std": 0.002029615753069246,
|
| 247 |
+
"rms": 0.002029615787948253,
|
| 248 |
+
"mean_abs": 0.0016194655327126384,
|
| 249 |
+
"min": -0.012240258976817131,
|
| 250 |
+
"max": 0.012380006723105907
|
| 251 |
+
},
|
| 252 |
+
"self_attn.o_proj.weight": {
|
| 253 |
+
"mean": -3.238943691030727e-07,
|
| 254 |
+
"std": 0.002129538815036201,
|
| 255 |
+
"rms": 0.0021295388396677228,
|
| 256 |
+
"mean_abs": 0.0017022138927131891,
|
| 257 |
+
"min": -0.016467344015836716,
|
| 258 |
+
"max": 0.019278671592473984
|
| 259 |
+
},
|
| 260 |
+
"mlp.gate_proj.weight": {
|
| 261 |
+
"mean": -2.2408200298481722e-07,
|
| 262 |
+
"std": 0.0021466559011978537,
|
| 263 |
+
"rms": 0.0021466559128934274,
|
| 264 |
+
"mean_abs": 0.0017323014991624014,
|
| 265 |
+
"min": -0.017962045967578888,
|
| 266 |
+
"max": 0.01821981370449066
|
| 267 |
+
},
|
| 268 |
+
"mlp.up_proj.weight": {
|
| 269 |
+
"mean": 4.851283717601161e-07,
|
| 270 |
+
"std": 0.0020947177378918447,
|
| 271 |
+
"rms": 0.0020947177940687533,
|
| 272 |
+
"mean_abs": 0.0016900979514632905,
|
| 273 |
+
"min": -0.01745721511542797,
|
| 274 |
+
"max": 0.01412601675838232
|
| 275 |
+
},
|
| 276 |
+
"mlp.down_proj.weight": {
|
| 277 |
+
"mean": 2.3296133479431903e-07,
|
| 278 |
+
"std": 0.0020870834290080543,
|
| 279 |
+
"rms": 0.0020870834420096867,
|
| 280 |
+
"mean_abs": 0.0016793720424175262,
|
| 281 |
+
"min": -0.013508688658475876,
|
| 282 |
+
"max": 0.015811778604984283
|
| 283 |
+
}
|
| 284 |
+
}
|
| 285 |
+
},
|
| 286 |
+
"rho_objective": "none",
|
| 287 |
+
"rho_schedule": "joint",
|
| 288 |
+
"additive_u": true,
|
| 289 |
+
"rho_epochs": 0.0,
|
| 290 |
+
"rho_lr": null,
|
| 291 |
+
"rho_bounds": null,
|
| 292 |
+
"rho_after_phase": null,
|
| 293 |
+
"rho_final": {},
|
| 294 |
+
"u_fisher_orthogonality": {},
|
| 295 |
+
"runtime": {
|
| 296 |
+
"seconds": 309.57352054910734,
|
| 297 |
+
"dataset_tokens": 524288,
|
| 298 |
+
"tokens_per_second": 1693.5815410505456,
|
| 299 |
+
"batch_size": 1,
|
| 300 |
+
"batches_per_epoch": 512,
|
| 301 |
+
"grad_accumulation": 1,
|
| 302 |
+
"peak_allocated_bytes": 39562527744,
|
| 303 |
+
"peak_reserved_bytes": 41303408640,
|
| 304 |
+
"gpu_total_bytes": 85094825984,
|
| 305 |
+
"actual_forward_shapes": {
|
| 306 |
+
"teacher:1x1024": 512,
|
| 307 |
+
"student:1x1024": 512
|
| 308 |
+
}
|
| 309 |
+
},
|
| 310 |
+
"ablation": {
|
| 311 |
+
"lambda": null,
|
| 312 |
+
"endpoint_clamping": false,
|
| 313 |
+
"initial_u_nonzero": 0,
|
| 314 |
+
"merged_parameters": [
|
| 315 |
+
"self_attn.q_proj.weight",
|
| 316 |
+
"self_attn.k_proj.weight",
|
| 317 |
+
"self_attn.v_proj.weight",
|
| 318 |
+
"self_attn.o_proj.weight",
|
| 319 |
+
"mlp.gate_proj.weight",
|
| 320 |
+
"mlp.up_proj.weight",
|
| 321 |
+
"mlp.down_proj.weight"
|
| 322 |
+
],
|
| 323 |
+
"parameterization": "W_initial + U_add",
|
| 324 |
+
"fisher_computed": false,
|
| 325 |
+
"fit_scope": "attention_and_mlp",
|
| 326 |
+
"attention_initialization": "CoMe_channel_merge",
|
| 327 |
+
"norm_initialization": "CoMe_pair_mean",
|
| 328 |
+
"CoMe": {
|
| 329 |
+
"source_lineage": [
|
| 330 |
+
[
|
| 331 |
+
25
|
| 332 |
+
],
|
| 333 |
+
[
|
| 334 |
+
26
|
| 335 |
+
]
|
| 336 |
+
],
|
| 337 |
+
"retention_ratios": [
|
| 338 |
+
0.030000000000000027,
|
| 339 |
+
0.97
|
| 340 |
+
],
|
| 341 |
+
"retained_attention_groups": [
|
| 342 |
+
0,
|
| 343 |
+
8
|
| 344 |
+
],
|
| 345 |
+
"retained_mlp_neurons": [
|
| 346 |
+
430,
|
| 347 |
+
13906
|
| 348 |
+
],
|
| 349 |
+
"pair_score": 0.1301000171474048,
|
| 350 |
+
"minimum_retention": 0.97,
|
| 351 |
+
"adjusted_minimum": 0.97,
|
| 352 |
+
"power": 1.0,
|
| 353 |
+
"allow_repeat": true,
|
| 354 |
+
"sbi_metric": "angular_last",
|
| 355 |
+
"calibration_padding": "trim_right_padding_before_native_CoMe_scoring",
|
| 356 |
+
"teacher_mutated_during_initialization": false
|
| 357 |
+
},
|
| 358 |
+
"norms_trainable": false,
|
| 359 |
+
"initialized_parameters": [
|
| 360 |
+
"self_attn.q_proj.weight",
|
| 361 |
+
"self_attn.k_proj.weight",
|
| 362 |
+
"self_attn.v_proj.weight",
|
| 363 |
+
"self_attn.o_proj.weight",
|
| 364 |
+
"mlp.gate_proj.weight",
|
| 365 |
+
"mlp.up_proj.weight",
|
| 366 |
+
"mlp.down_proj.weight",
|
| 367 |
+
"input_layernorm.weight",
|
| 368 |
+
"post_attention_layernorm.weight"
|
| 369 |
+
],
|
| 370 |
+
"frozen_CoMe_parameters": [
|
| 371 |
+
"input_layernorm.weight",
|
| 372 |
+
"post_attention_layernorm.weight"
|
| 373 |
+
],
|
| 374 |
+
"frozen_norm_expected_sha256": {
|
| 375 |
+
"input_layernorm.weight": "58667b2d4e3550d00b7bef01e30a7dc82fde48c46559a2025509cb0cc260d4db",
|
| 376 |
+
"post_attention_layernorm.weight": "87fed7ad0086f3e95ba57094ff5f41641dd4c9c9c7722f012ce3e515f5905cf9"
|
| 377 |
+
},
|
| 378 |
+
"frozen_norm_after_sha256": {
|
| 379 |
+
"input_layernorm.weight": "58667b2d4e3550d00b7bef01e30a7dc82fde48c46559a2025509cb0cc260d4db",
|
| 380 |
+
"post_attention_layernorm.weight": "87fed7ad0086f3e95ba57094ff5f41641dd4c9c9c7722f012ce3e515f5905cf9"
|
| 381 |
+
},
|
| 382 |
+
"frozen_norms_unchanged": true,
|
| 383 |
+
"source_feature_transport": false,
|
| 384 |
+
"initializer": "come",
|
| 385 |
+
"removed_count_per_cycle": 1,
|
| 386 |
+
"teacher_boundary_current_layer": 26,
|
| 387 |
+
"teacher_boundary_original_layer": 26
|
| 388 |
+
}
|
| 389 |
+
}
|
runs/vast-paper_revision-come-attn-fit-20261126-62646539/20261126-llama31-come-attn-mlp-batch/catalog/results/batch1/audit/cycle_02_fit.json
ADDED
|
@@ -0,0 +1,389 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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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": "all",
|
| 16 |
+
"train_subset": "all",
|
| 17 |
+
"num_gates": 7,
|
| 18 |
+
"num_attn_gates": 4,
|
| 19 |
+
"num_mlp_gates": 3,
|
| 20 |
+
"num_other_gates": 0,
|
| 21 |
+
"num_trainable_attn_gates": 4,
|
| 22 |
+
"num_trainable_mlp_gates": 3,
|
| 23 |
+
"num_trainable_other_gates": 0,
|
| 24 |
+
"lambda_init_summary": {
|
| 25 |
+
"num_tensors": 7,
|
| 26 |
+
"num_elements": 7,
|
| 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 |
+
"self_attn.q_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 |
+
"self_attn.k_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 |
+
"self_attn.v_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 |
+
"self_attn.o_proj.weight": {
|
| 55 |
+
"mean": 0.9998999834060669,
|
| 56 |
+
"std": 0.0,
|
| 57 |
+
"min": 0.9998999834060669,
|
| 58 |
+
"max": 0.9998999834060669,
|
| 59 |
+
"mean_abs_from_0_5": 0.4998999834060669
|
| 60 |
+
},
|
| 61 |
+
"mlp.gate_proj.weight": {
|
| 62 |
+
"mean": 0.9998999834060669,
|
| 63 |
+
"std": 0.0,
|
| 64 |
+
"min": 0.9998999834060669,
|
| 65 |
+
"max": 0.9998999834060669,
|
| 66 |
+
"mean_abs_from_0_5": 0.4998999834060669
|
| 67 |
+
},
|
| 68 |
+
"mlp.up_proj.weight": {
|
| 69 |
+
"mean": 0.9998999834060669,
|
| 70 |
+
"std": 0.0,
|
| 71 |
+
"min": 0.9998999834060669,
|
| 72 |
+
"max": 0.9998999834060669,
|
| 73 |
+
"mean_abs_from_0_5": 0.4998999834060669
|
| 74 |
+
},
|
| 75 |
+
"mlp.down_proj.weight": {
|
| 76 |
+
"mean": 0.9998999834060669,
|
| 77 |
+
"std": 0.0,
|
| 78 |
+
"min": 0.9998999834060669,
|
| 79 |
+
"max": 0.9998999834060669,
|
| 80 |
+
"mean_abs_from_0_5": 0.4998999834060669
|
| 81 |
+
}
|
| 82 |
+
}
|
| 83 |
+
},
|
| 84 |
+
"lambda_final_summary": {
|
| 85 |
+
"num_tensors": 7,
|
| 86 |
+
"num_elements": 7,
|
| 87 |
+
"mean": 1.0,
|
| 88 |
+
"std": 0.0,
|
| 89 |
+
"min": 1.0,
|
| 90 |
+
"max": 1.0,
|
| 91 |
+
"mean_abs_from_0_5": 0.5,
|
| 92 |
+
"per_tensor": {
|
| 93 |
+
"self_attn.q_proj.weight": {
|
| 94 |
+
"mean": 1.0,
|
| 95 |
+
"std": 0.0,
|
| 96 |
+
"min": 1.0,
|
| 97 |
+
"max": 1.0,
|
| 98 |
+
"mean_abs_from_0_5": 0.5
|
| 99 |
+
},
|
| 100 |
+
"self_attn.k_proj.weight": {
|
| 101 |
+
"mean": 1.0,
|
| 102 |
+
"std": 0.0,
|
| 103 |
+
"min": 1.0,
|
| 104 |
+
"max": 1.0,
|
| 105 |
+
"mean_abs_from_0_5": 0.5
|
| 106 |
+
},
|
| 107 |
+
"self_attn.v_proj.weight": {
|
| 108 |
+
"mean": 1.0,
|
| 109 |
+
"std": 0.0,
|
| 110 |
+
"min": 1.0,
|
| 111 |
+
"max": 1.0,
|
| 112 |
+
"mean_abs_from_0_5": 0.5
|
| 113 |
+
},
|
| 114 |
+
"self_attn.o_proj.weight": {
|
| 115 |
+
"mean": 1.0,
|
| 116 |
+
"std": 0.0,
|
| 117 |
+
"min": 1.0,
|
| 118 |
+
"max": 1.0,
|
| 119 |
+
"mean_abs_from_0_5": 0.5
|
| 120 |
+
},
|
| 121 |
+
"mlp.gate_proj.weight": {
|
| 122 |
+
"mean": 1.0,
|
| 123 |
+
"std": 0.0,
|
| 124 |
+
"min": 1.0,
|
| 125 |
+
"max": 1.0,
|
| 126 |
+
"mean_abs_from_0_5": 0.5
|
| 127 |
+
},
|
| 128 |
+
"mlp.up_proj.weight": {
|
| 129 |
+
"mean": 1.0,
|
| 130 |
+
"std": 0.0,
|
| 131 |
+
"min": 1.0,
|
| 132 |
+
"max": 1.0,
|
| 133 |
+
"mean_abs_from_0_5": 0.5
|
| 134 |
+
},
|
| 135 |
+
"mlp.down_proj.weight": {
|
| 136 |
+
"mean": 1.0,
|
| 137 |
+
"std": 0.0,
|
| 138 |
+
"min": 1.0,
|
| 139 |
+
"max": 1.0,
|
| 140 |
+
"mean_abs_from_0_5": 0.5
|
| 141 |
+
}
|
| 142 |
+
}
|
| 143 |
+
},
|
| 144 |
+
"lambda_delta_from_init": {
|
| 145 |
+
"num_tensors": 7,
|
| 146 |
+
"num_elements": 7,
|
| 147 |
+
"mean_abs": 0.0,
|
| 148 |
+
"rms": 0.0,
|
| 149 |
+
"max_abs": 0.0,
|
| 150 |
+
"per_tensor": {
|
| 151 |
+
"self_attn.q_proj.weight": {
|
| 152 |
+
"mean_abs": 0.0,
|
| 153 |
+
"rms": 0.0,
|
| 154 |
+
"max_abs": 0.0
|
| 155 |
+
},
|
| 156 |
+
"self_attn.k_proj.weight": {
|
| 157 |
+
"mean_abs": 0.0,
|
| 158 |
+
"rms": 0.0,
|
| 159 |
+
"max_abs": 0.0
|
| 160 |
+
},
|
| 161 |
+
"self_attn.v_proj.weight": {
|
| 162 |
+
"mean_abs": 0.0,
|
| 163 |
+
"rms": 0.0,
|
| 164 |
+
"max_abs": 0.0
|
| 165 |
+
},
|
| 166 |
+
"self_attn.o_proj.weight": {
|
| 167 |
+
"mean_abs": 0.0,
|
| 168 |
+
"rms": 0.0,
|
| 169 |
+
"max_abs": 0.0
|
| 170 |
+
},
|
| 171 |
+
"mlp.gate_proj.weight": {
|
| 172 |
+
"mean_abs": 0.0,
|
| 173 |
+
"rms": 0.0,
|
| 174 |
+
"max_abs": 0.0
|
| 175 |
+
},
|
| 176 |
+
"mlp.up_proj.weight": {
|
| 177 |
+
"mean_abs": 0.0,
|
| 178 |
+
"rms": 0.0,
|
| 179 |
+
"max_abs": 0.0
|
| 180 |
+
},
|
| 181 |
+
"mlp.down_proj.weight": {
|
| 182 |
+
"mean_abs": 0.0,
|
| 183 |
+
"rms": 0.0,
|
| 184 |
+
"max_abs": 0.0
|
| 185 |
+
}
|
| 186 |
+
}
|
| 187 |
+
},
|
| 188 |
+
"first_grad_summary": {
|
| 189 |
+
"joint": {
|
| 190 |
+
"step": 1,
|
| 191 |
+
"phase": "joint",
|
| 192 |
+
"gate": {
|
| 193 |
+
"num_tensors": 7,
|
| 194 |
+
"num_tensors_without_grad": 7,
|
| 195 |
+
"num_elements": 0,
|
| 196 |
+
"l2": 0.0,
|
| 197 |
+
"mean_abs": null,
|
| 198 |
+
"max_abs": 0.0
|
| 199 |
+
},
|
| 200 |
+
"u": {
|
| 201 |
+
"num_tensors": 7,
|
| 202 |
+
"num_tensors_without_grad": 0,
|
| 203 |
+
"num_elements": 218103808,
|
| 204 |
+
"l2": 0.03150363715295638,
|
| 205 |
+
"mean_abs": 6.304102768694975e-07,
|
| 206 |
+
"max_abs": 0.0030031204223632812
|
| 207 |
+
},
|
| 208 |
+
"rho": {
|
| 209 |
+
"num_tensors": 0,
|
| 210 |
+
"num_tensors_without_grad": 0,
|
| 211 |
+
"num_elements": 0,
|
| 212 |
+
"l2": 0.0,
|
| 213 |
+
"mean_abs": null,
|
| 214 |
+
"max_abs": 0.0
|
| 215 |
+
}
|
| 216 |
+
}
|
| 217 |
+
},
|
| 218 |
+
"u_delta_summary": {
|
| 219 |
+
"num_tensors": 7,
|
| 220 |
+
"num_elements": 218103808,
|
| 221 |
+
"mean": -3.046761858189921e-08,
|
| 222 |
+
"std": 0.0020018436541109543,
|
| 223 |
+
"rms": 0.0020018436543428096,
|
| 224 |
+
"mean_abs": 0.0015793918394662726,
|
| 225 |
+
"min": -0.023186692968010902,
|
| 226 |
+
"max": 0.02465524896979332,
|
| 227 |
+
"per_tensor": {
|
| 228 |
+
"self_attn.q_proj.weight": {
|
| 229 |
+
"mean": -7.174695326739311e-08,
|
| 230 |
+
"std": 0.0015853346114623756,
|
| 231 |
+
"rms": 0.0015853346130858894,
|
| 232 |
+
"mean_abs": 0.0012431073701009154,
|
| 233 |
+
"min": -0.010545467026531696,
|
| 234 |
+
"max": 0.011044338345527649
|
| 235 |
+
},
|
| 236 |
+
"self_attn.k_proj.weight": {
|
| 237 |
+
"mean": 8.058067635374755e-08,
|
| 238 |
+
"std": 0.0015472798543858936,
|
| 239 |
+
"rms": 0.0015472798564841713,
|
| 240 |
+
"mean_abs": 0.0011991694336757064,
|
| 241 |
+
"min": -0.008818818256258965,
|
| 242 |
+
"max": 0.009798734448850155
|
| 243 |
+
},
|
| 244 |
+
"self_attn.v_proj.weight": {
|
| 245 |
+
"mean": -1.1152110346301924e-08,
|
| 246 |
+
"std": 0.0016126078579391477,
|
| 247 |
+
"rms": 0.0016126078579777093,
|
| 248 |
+
"mean_abs": 0.0012735086493194103,
|
| 249 |
+
"min": -0.009370114654302597,
|
| 250 |
+
"max": 0.009373115375638008
|
| 251 |
+
},
|
| 252 |
+
"self_attn.o_proj.weight": {
|
| 253 |
+
"mean": 4.120860808143334e-08,
|
| 254 |
+
"std": 0.0018136308083127007,
|
| 255 |
+
"rms": 0.0018136308087808638,
|
| 256 |
+
"mean_abs": 0.0014261073665693402,
|
| 257 |
+
"min": -0.023186692968010902,
|
| 258 |
+
"max": 0.02465524896979332
|
| 259 |
+
},
|
| 260 |
+
"mlp.gate_proj.weight": {
|
| 261 |
+
"mean": -3.8037231726255935e-07,
|
| 262 |
+
"std": 0.0020301906782935423,
|
| 263 |
+
"rms": 0.0020301907139264265,
|
| 264 |
+
"mean_abs": 0.0016132770106196404,
|
| 265 |
+
"min": -0.014395240694284439,
|
| 266 |
+
"max": 0.014452898874878883
|
| 267 |
+
},
|
| 268 |
+
"mlp.up_proj.weight": {
|
| 269 |
+
"mean": 1.4756993290835192e-07,
|
| 270 |
+
"std": 0.002025136844713265,
|
| 271 |
+
"rms": 0.0020251368500899102,
|
| 272 |
+
"mean_abs": 0.001606754825583526,
|
| 273 |
+
"min": -0.01790381595492363,
|
| 274 |
+
"max": 0.014900405891239643
|
| 275 |
+
},
|
| 276 |
+
"mlp.down_proj.weight": {
|
| 277 |
+
"mean": 1.2340300210260985e-07,
|
| 278 |
+
"std": 0.0021557060005003136,
|
| 279 |
+
"rms": 0.002155706004032405,
|
| 280 |
+
"mean_abs": 0.0017070280654089792,
|
| 281 |
+
"min": -0.02179914154112339,
|
| 282 |
+
"max": 0.021062197163701057
|
| 283 |
+
}
|
| 284 |
+
}
|
| 285 |
+
},
|
| 286 |
+
"rho_objective": "none",
|
| 287 |
+
"rho_schedule": "joint",
|
| 288 |
+
"additive_u": true,
|
| 289 |
+
"rho_epochs": 0.0,
|
| 290 |
+
"rho_lr": null,
|
| 291 |
+
"rho_bounds": null,
|
| 292 |
+
"rho_after_phase": null,
|
| 293 |
+
"rho_final": {},
|
| 294 |
+
"u_fisher_orthogonality": {},
|
| 295 |
+
"runtime": {
|
| 296 |
+
"seconds": 269.86574819730595,
|
| 297 |
+
"dataset_tokens": 524288,
|
| 298 |
+
"tokens_per_second": 1942.7734104910537,
|
| 299 |
+
"batch_size": 1,
|
| 300 |
+
"batches_per_epoch": 512,
|
| 301 |
+
"grad_accumulation": 1,
|
| 302 |
+
"peak_allocated_bytes": 38832829952,
|
| 303 |
+
"peak_reserved_bytes": 50186944512,
|
| 304 |
+
"gpu_total_bytes": 85094825984,
|
| 305 |
+
"actual_forward_shapes": {
|
| 306 |
+
"teacher:1x1024": 512,
|
| 307 |
+
"student:1x1024": 512
|
| 308 |
+
}
|
| 309 |
+
},
|
| 310 |
+
"ablation": {
|
| 311 |
+
"lambda": null,
|
| 312 |
+
"endpoint_clamping": false,
|
| 313 |
+
"initial_u_nonzero": 0,
|
| 314 |
+
"merged_parameters": [
|
| 315 |
+
"self_attn.q_proj.weight",
|
| 316 |
+
"self_attn.k_proj.weight",
|
| 317 |
+
"self_attn.v_proj.weight",
|
| 318 |
+
"self_attn.o_proj.weight",
|
| 319 |
+
"mlp.gate_proj.weight",
|
| 320 |
+
"mlp.up_proj.weight",
|
| 321 |
+
"mlp.down_proj.weight"
|
| 322 |
+
],
|
| 323 |
+
"parameterization": "W_initial + U_add",
|
| 324 |
+
"fisher_computed": false,
|
| 325 |
+
"fit_scope": "attention_and_mlp",
|
| 326 |
+
"attention_initialization": "CoMe_channel_merge",
|
| 327 |
+
"norm_initialization": "CoMe_pair_mean",
|
| 328 |
+
"CoMe": {
|
| 329 |
+
"source_lineage": [
|
| 330 |
+
[
|
| 331 |
+
23
|
| 332 |
+
],
|
| 333 |
+
[
|
| 334 |
+
24
|
| 335 |
+
]
|
| 336 |
+
],
|
| 337 |
+
"retention_ratios": [
|
| 338 |
+
0.97,
|
| 339 |
+
0.03000000000000003
|
| 340 |
+
],
|
| 341 |
+
"retained_attention_groups": [
|
| 342 |
+
8,
|
| 343 |
+
0
|
| 344 |
+
],
|
| 345 |
+
"retained_mlp_neurons": [
|
| 346 |
+
13906,
|
| 347 |
+
430
|
| 348 |
+
],
|
| 349 |
+
"pair_score": 0.13651073019910645,
|
| 350 |
+
"minimum_retention": 0.97,
|
| 351 |
+
"adjusted_minimum": 0.97,
|
| 352 |
+
"power": 1.0,
|
| 353 |
+
"allow_repeat": true,
|
| 354 |
+
"sbi_metric": "angular_last",
|
| 355 |
+
"calibration_padding": "trim_right_padding_before_native_CoMe_scoring",
|
| 356 |
+
"teacher_mutated_during_initialization": false
|
| 357 |
+
},
|
| 358 |
+
"norms_trainable": false,
|
| 359 |
+
"initialized_parameters": [
|
| 360 |
+
"self_attn.q_proj.weight",
|
| 361 |
+
"self_attn.k_proj.weight",
|
| 362 |
+
"self_attn.v_proj.weight",
|
| 363 |
+
"self_attn.o_proj.weight",
|
| 364 |
+
"mlp.gate_proj.weight",
|
| 365 |
+
"mlp.up_proj.weight",
|
| 366 |
+
"mlp.down_proj.weight",
|
| 367 |
+
"input_layernorm.weight",
|
| 368 |
+
"post_attention_layernorm.weight"
|
| 369 |
+
],
|
| 370 |
+
"frozen_CoMe_parameters": [
|
| 371 |
+
"input_layernorm.weight",
|
| 372 |
+
"post_attention_layernorm.weight"
|
| 373 |
+
],
|
| 374 |
+
"frozen_norm_expected_sha256": {
|
| 375 |
+
"input_layernorm.weight": "f392bbad44c4f745f01943cc706a88f4532bf48c5fad8e4495b531fb57569116",
|
| 376 |
+
"post_attention_layernorm.weight": "9e133e18f02e9e7bebafdfd509eb5d59c4e3b63e67c5155611064cc3aae11b60"
|
| 377 |
+
},
|
| 378 |
+
"frozen_norm_after_sha256": {
|
| 379 |
+
"input_layernorm.weight": "f392bbad44c4f745f01943cc706a88f4532bf48c5fad8e4495b531fb57569116",
|
| 380 |
+
"post_attention_layernorm.weight": "9e133e18f02e9e7bebafdfd509eb5d59c4e3b63e67c5155611064cc3aae11b60"
|
| 381 |
+
},
|
| 382 |
+
"frozen_norms_unchanged": true,
|
| 383 |
+
"source_feature_transport": false,
|
| 384 |
+
"initializer": "come",
|
| 385 |
+
"removed_count_per_cycle": 1,
|
| 386 |
+
"teacher_boundary_current_layer": 24,
|
| 387 |
+
"teacher_boundary_original_layer": 24
|
| 388 |
+
}
|
| 389 |
+
}
|
runs/vast-paper_revision-come-attn-fit-20261126-62646539/20261126-llama31-come-attn-mlp-batch/catalog/results/batch1/audit/cycle_03_fit.json
ADDED
|
@@ -0,0 +1,390 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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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": "all",
|
| 16 |
+
"train_subset": "all",
|
| 17 |
+
"num_gates": 7,
|
| 18 |
+
"num_attn_gates": 4,
|
| 19 |
+
"num_mlp_gates": 3,
|
| 20 |
+
"num_other_gates": 0,
|
| 21 |
+
"num_trainable_attn_gates": 4,
|
| 22 |
+
"num_trainable_mlp_gates": 3,
|
| 23 |
+
"num_trainable_other_gates": 0,
|
| 24 |
+
"lambda_init_summary": {
|
| 25 |
+
"num_tensors": 7,
|
| 26 |
+
"num_elements": 7,
|
| 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 |
+
"self_attn.q_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 |
+
"self_attn.k_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 |
+
"self_attn.v_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 |
+
"self_attn.o_proj.weight": {
|
| 55 |
+
"mean": 0.9998999834060669,
|
| 56 |
+
"std": 0.0,
|
| 57 |
+
"min": 0.9998999834060669,
|
| 58 |
+
"max": 0.9998999834060669,
|
| 59 |
+
"mean_abs_from_0_5": 0.4998999834060669
|
| 60 |
+
},
|
| 61 |
+
"mlp.gate_proj.weight": {
|
| 62 |
+
"mean": 0.9998999834060669,
|
| 63 |
+
"std": 0.0,
|
| 64 |
+
"min": 0.9998999834060669,
|
| 65 |
+
"max": 0.9998999834060669,
|
| 66 |
+
"mean_abs_from_0_5": 0.4998999834060669
|
| 67 |
+
},
|
| 68 |
+
"mlp.up_proj.weight": {
|
| 69 |
+
"mean": 0.9998999834060669,
|
| 70 |
+
"std": 0.0,
|
| 71 |
+
"min": 0.9998999834060669,
|
| 72 |
+
"max": 0.9998999834060669,
|
| 73 |
+
"mean_abs_from_0_5": 0.4998999834060669
|
| 74 |
+
},
|
| 75 |
+
"mlp.down_proj.weight": {
|
| 76 |
+
"mean": 0.9998999834060669,
|
| 77 |
+
"std": 0.0,
|
| 78 |
+
"min": 0.9998999834060669,
|
| 79 |
+
"max": 0.9998999834060669,
|
| 80 |
+
"mean_abs_from_0_5": 0.4998999834060669
|
| 81 |
+
}
|
| 82 |
+
}
|
| 83 |
+
},
|
| 84 |
+
"lambda_final_summary": {
|
| 85 |
+
"num_tensors": 7,
|
| 86 |
+
"num_elements": 7,
|
| 87 |
+
"mean": 1.0,
|
| 88 |
+
"std": 0.0,
|
| 89 |
+
"min": 1.0,
|
| 90 |
+
"max": 1.0,
|
| 91 |
+
"mean_abs_from_0_5": 0.5,
|
| 92 |
+
"per_tensor": {
|
| 93 |
+
"self_attn.q_proj.weight": {
|
| 94 |
+
"mean": 1.0,
|
| 95 |
+
"std": 0.0,
|
| 96 |
+
"min": 1.0,
|
| 97 |
+
"max": 1.0,
|
| 98 |
+
"mean_abs_from_0_5": 0.5
|
| 99 |
+
},
|
| 100 |
+
"self_attn.k_proj.weight": {
|
| 101 |
+
"mean": 1.0,
|
| 102 |
+
"std": 0.0,
|
| 103 |
+
"min": 1.0,
|
| 104 |
+
"max": 1.0,
|
| 105 |
+
"mean_abs_from_0_5": 0.5
|
| 106 |
+
},
|
| 107 |
+
"self_attn.v_proj.weight": {
|
| 108 |
+
"mean": 1.0,
|
| 109 |
+
"std": 0.0,
|
| 110 |
+
"min": 1.0,
|
| 111 |
+
"max": 1.0,
|
| 112 |
+
"mean_abs_from_0_5": 0.5
|
| 113 |
+
},
|
| 114 |
+
"self_attn.o_proj.weight": {
|
| 115 |
+
"mean": 1.0,
|
| 116 |
+
"std": 0.0,
|
| 117 |
+
"min": 1.0,
|
| 118 |
+
"max": 1.0,
|
| 119 |
+
"mean_abs_from_0_5": 0.5
|
| 120 |
+
},
|
| 121 |
+
"mlp.gate_proj.weight": {
|
| 122 |
+
"mean": 1.0,
|
| 123 |
+
"std": 0.0,
|
| 124 |
+
"min": 1.0,
|
| 125 |
+
"max": 1.0,
|
| 126 |
+
"mean_abs_from_0_5": 0.5
|
| 127 |
+
},
|
| 128 |
+
"mlp.up_proj.weight": {
|
| 129 |
+
"mean": 1.0,
|
| 130 |
+
"std": 0.0,
|
| 131 |
+
"min": 1.0,
|
| 132 |
+
"max": 1.0,
|
| 133 |
+
"mean_abs_from_0_5": 0.5
|
| 134 |
+
},
|
| 135 |
+
"mlp.down_proj.weight": {
|
| 136 |
+
"mean": 1.0,
|
| 137 |
+
"std": 0.0,
|
| 138 |
+
"min": 1.0,
|
| 139 |
+
"max": 1.0,
|
| 140 |
+
"mean_abs_from_0_5": 0.5
|
| 141 |
+
}
|
| 142 |
+
}
|
| 143 |
+
},
|
| 144 |
+
"lambda_delta_from_init": {
|
| 145 |
+
"num_tensors": 7,
|
| 146 |
+
"num_elements": 7,
|
| 147 |
+
"mean_abs": 0.0,
|
| 148 |
+
"rms": 0.0,
|
| 149 |
+
"max_abs": 0.0,
|
| 150 |
+
"per_tensor": {
|
| 151 |
+
"self_attn.q_proj.weight": {
|
| 152 |
+
"mean_abs": 0.0,
|
| 153 |
+
"rms": 0.0,
|
| 154 |
+
"max_abs": 0.0
|
| 155 |
+
},
|
| 156 |
+
"self_attn.k_proj.weight": {
|
| 157 |
+
"mean_abs": 0.0,
|
| 158 |
+
"rms": 0.0,
|
| 159 |
+
"max_abs": 0.0
|
| 160 |
+
},
|
| 161 |
+
"self_attn.v_proj.weight": {
|
| 162 |
+
"mean_abs": 0.0,
|
| 163 |
+
"rms": 0.0,
|
| 164 |
+
"max_abs": 0.0
|
| 165 |
+
},
|
| 166 |
+
"self_attn.o_proj.weight": {
|
| 167 |
+
"mean_abs": 0.0,
|
| 168 |
+
"rms": 0.0,
|
| 169 |
+
"max_abs": 0.0
|
| 170 |
+
},
|
| 171 |
+
"mlp.gate_proj.weight": {
|
| 172 |
+
"mean_abs": 0.0,
|
| 173 |
+
"rms": 0.0,
|
| 174 |
+
"max_abs": 0.0
|
| 175 |
+
},
|
| 176 |
+
"mlp.up_proj.weight": {
|
| 177 |
+
"mean_abs": 0.0,
|
| 178 |
+
"rms": 0.0,
|
| 179 |
+
"max_abs": 0.0
|
| 180 |
+
},
|
| 181 |
+
"mlp.down_proj.weight": {
|
| 182 |
+
"mean_abs": 0.0,
|
| 183 |
+
"rms": 0.0,
|
| 184 |
+
"max_abs": 0.0
|
| 185 |
+
}
|
| 186 |
+
}
|
| 187 |
+
},
|
| 188 |
+
"first_grad_summary": {
|
| 189 |
+
"joint": {
|
| 190 |
+
"step": 1,
|
| 191 |
+
"phase": "joint",
|
| 192 |
+
"gate": {
|
| 193 |
+
"num_tensors": 7,
|
| 194 |
+
"num_tensors_without_grad": 7,
|
| 195 |
+
"num_elements": 0,
|
| 196 |
+
"l2": 0.0,
|
| 197 |
+
"mean_abs": null,
|
| 198 |
+
"max_abs": 0.0
|
| 199 |
+
},
|
| 200 |
+
"u": {
|
| 201 |
+
"num_tensors": 7,
|
| 202 |
+
"num_tensors_without_grad": 0,
|
| 203 |
+
"num_elements": 218103808,
|
| 204 |
+
"l2": 0.08550608977587418,
|
| 205 |
+
"mean_abs": 1.219674249324061e-06,
|
| 206 |
+
"max_abs": 0.0055141448974609375
|
| 207 |
+
},
|
| 208 |
+
"rho": {
|
| 209 |
+
"num_tensors": 0,
|
| 210 |
+
"num_tensors_without_grad": 0,
|
| 211 |
+
"num_elements": 0,
|
| 212 |
+
"l2": 0.0,
|
| 213 |
+
"mean_abs": null,
|
| 214 |
+
"max_abs": 0.0
|
| 215 |
+
}
|
| 216 |
+
}
|
| 217 |
+
},
|
| 218 |
+
"u_delta_summary": {
|
| 219 |
+
"num_tensors": 7,
|
| 220 |
+
"num_elements": 218103808,
|
| 221 |
+
"mean": 2.741781180212946e-07,
|
| 222 |
+
"std": 0.002338803962604666,
|
| 223 |
+
"rms": 0.002338803978675624,
|
| 224 |
+
"mean_abs": 0.0018595884567520653,
|
| 225 |
+
"min": -0.030197463929653168,
|
| 226 |
+
"max": 0.02784019522368908,
|
| 227 |
+
"per_tensor": {
|
| 228 |
+
"self_attn.q_proj.weight": {
|
| 229 |
+
"mean": 3.349895507653855e-07,
|
| 230 |
+
"std": 0.0022042413085290352,
|
| 231 |
+
"rms": 0.002204241333984052,
|
| 232 |
+
"mean_abs": 0.0017482270486652851,
|
| 233 |
+
"min": -0.013558188453316689,
|
| 234 |
+
"max": 0.013033853843808174
|
| 235 |
+
},
|
| 236 |
+
"self_attn.k_proj.weight": {
|
| 237 |
+
"mean": -4.271734042049502e-07,
|
| 238 |
+
"std": 0.002262832389564919,
|
| 239 |
+
"rms": 0.00226283242988543,
|
| 240 |
+
"mean_abs": 0.00179249735083431,
|
| 241 |
+
"min": -0.011787437833845615,
|
| 242 |
+
"max": 0.012109086848795414
|
| 243 |
+
},
|
| 244 |
+
"self_attn.v_proj.weight": {
|
| 245 |
+
"mean": 1.5791754321980989e-06,
|
| 246 |
+
"std": 0.0021743802141797955,
|
| 247 |
+
"rms": 0.002174380787629347,
|
| 248 |
+
"mean_abs": 0.001727923285216093,
|
| 249 |
+
"min": -0.01213236153125763,
|
| 250 |
+
"max": 0.011572041548788548
|
| 251 |
+
},
|
| 252 |
+
"self_attn.o_proj.weight": {
|
| 253 |
+
"mean": -1.020055037770362e-06,
|
| 254 |
+
"std": 0.0020551276271446066,
|
| 255 |
+
"rms": 0.002055127880294874,
|
| 256 |
+
"mean_abs": 0.0016199075616896152,
|
| 257 |
+
"min": -0.030197463929653168,
|
| 258 |
+
"max": 0.02784019522368908
|
| 259 |
+
},
|
| 260 |
+
"mlp.gate_proj.weight": {
|
| 261 |
+
"mean": 8.903005306949905e-07,
|
| 262 |
+
"std": 0.002412364914186786,
|
| 263 |
+
"rms": 0.0024123650784726707,
|
| 264 |
+
"mean_abs": 0.0019249229558876582,
|
| 265 |
+
"min": -0.01832672767341137,
|
| 266 |
+
"max": 0.016350485384464264
|
| 267 |
+
},
|
| 268 |
+
"mlp.up_proj.weight": {
|
| 269 |
+
"mean": 2.8677225470476385e-07,
|
| 270 |
+
"std": 0.0023721883373157685,
|
| 271 |
+
"rms": 0.002372188354649621,
|
| 272 |
+
"mean_abs": 0.0018913325454507554,
|
| 273 |
+
"min": -0.014771738089621067,
|
| 274 |
+
"max": 0.016269953921437263
|
| 275 |
+
},
|
| 276 |
+
"mlp.down_proj.weight": {
|
| 277 |
+
"mean": -4.524978131874897e-08,
|
| 278 |
+
"std": 0.002360508212149501,
|
| 279 |
+
"rms": 0.002360508212583209,
|
| 280 |
+
"mean_abs": 0.0018770045467785426,
|
| 281 |
+
"min": -0.018130647018551826,
|
| 282 |
+
"max": 0.01858564093708992
|
| 283 |
+
}
|
| 284 |
+
}
|
| 285 |
+
},
|
| 286 |
+
"rho_objective": "none",
|
| 287 |
+
"rho_schedule": "joint",
|
| 288 |
+
"additive_u": true,
|
| 289 |
+
"rho_epochs": 0.0,
|
| 290 |
+
"rho_lr": null,
|
| 291 |
+
"rho_bounds": null,
|
| 292 |
+
"rho_after_phase": null,
|
| 293 |
+
"rho_final": {},
|
| 294 |
+
"u_fisher_orthogonality": {},
|
| 295 |
+
"runtime": {
|
| 296 |
+
"seconds": 260.49719872837886,
|
| 297 |
+
"dataset_tokens": 524288,
|
| 298 |
+
"tokens_per_second": 2012.6435238433276,
|
| 299 |
+
"batch_size": 1,
|
| 300 |
+
"batches_per_epoch": 512,
|
| 301 |
+
"grad_accumulation": 1,
|
| 302 |
+
"peak_allocated_bytes": 37960381952,
|
| 303 |
+
"peak_reserved_bytes": 50438602752,
|
| 304 |
+
"gpu_total_bytes": 85094825984,
|
| 305 |
+
"actual_forward_shapes": {
|
| 306 |
+
"teacher:1x1024": 512,
|
| 307 |
+
"student:1x1024": 512
|
| 308 |
+
}
|
| 309 |
+
},
|
| 310 |
+
"ablation": {
|
| 311 |
+
"lambda": null,
|
| 312 |
+
"endpoint_clamping": false,
|
| 313 |
+
"initial_u_nonzero": 0,
|
| 314 |
+
"merged_parameters": [
|
| 315 |
+
"self_attn.q_proj.weight",
|
| 316 |
+
"self_attn.k_proj.weight",
|
| 317 |
+
"self_attn.v_proj.weight",
|
| 318 |
+
"self_attn.o_proj.weight",
|
| 319 |
+
"mlp.gate_proj.weight",
|
| 320 |
+
"mlp.up_proj.weight",
|
| 321 |
+
"mlp.down_proj.weight"
|
| 322 |
+
],
|
| 323 |
+
"parameterization": "W_initial + U_add",
|
| 324 |
+
"fisher_computed": false,
|
| 325 |
+
"fit_scope": "attention_and_mlp",
|
| 326 |
+
"attention_initialization": "CoMe_channel_merge",
|
| 327 |
+
"norm_initialization": "CoMe_pair_mean",
|
| 328 |
+
"CoMe": {
|
| 329 |
+
"source_lineage": [
|
| 330 |
+
[
|
| 331 |
+
22
|
| 332 |
+
],
|
| 333 |
+
[
|
| 334 |
+
23,
|
| 335 |
+
24
|
| 336 |
+
]
|
| 337 |
+
],
|
| 338 |
+
"retention_ratios": [
|
| 339 |
+
0.9848857801796105,
|
| 340 |
+
0.015114219820389518
|
| 341 |
+
],
|
| 342 |
+
"retained_attention_groups": [
|
| 343 |
+
8,
|
| 344 |
+
0
|
| 345 |
+
],
|
| 346 |
+
"retained_mlp_neurons": [
|
| 347 |
+
14120,
|
| 348 |
+
216
|
| 349 |
+
],
|
| 350 |
+
"pair_score": 0.14353572814674168,
|
| 351 |
+
"minimum_retention": 0.97,
|
| 352 |
+
"adjusted_minimum": 0.9848857801796105,
|
| 353 |
+
"power": 1.0,
|
| 354 |
+
"allow_repeat": true,
|
| 355 |
+
"sbi_metric": "angular_last",
|
| 356 |
+
"calibration_padding": "trim_right_padding_before_native_CoMe_scoring",
|
| 357 |
+
"teacher_mutated_during_initialization": false
|
| 358 |
+
},
|
| 359 |
+
"norms_trainable": false,
|
| 360 |
+
"initialized_parameters": [
|
| 361 |
+
"self_attn.q_proj.weight",
|
| 362 |
+
"self_attn.k_proj.weight",
|
| 363 |
+
"self_attn.v_proj.weight",
|
| 364 |
+
"self_attn.o_proj.weight",
|
| 365 |
+
"mlp.gate_proj.weight",
|
| 366 |
+
"mlp.up_proj.weight",
|
| 367 |
+
"mlp.down_proj.weight",
|
| 368 |
+
"input_layernorm.weight",
|
| 369 |
+
"post_attention_layernorm.weight"
|
| 370 |
+
],
|
| 371 |
+
"frozen_CoMe_parameters": [
|
| 372 |
+
"input_layernorm.weight",
|
| 373 |
+
"post_attention_layernorm.weight"
|
| 374 |
+
],
|
| 375 |
+
"frozen_norm_expected_sha256": {
|
| 376 |
+
"input_layernorm.weight": "e2de6c839943789a47634b944d123337190fc5ffcea79fe4de1b4f089dc2e79d",
|
| 377 |
+
"post_attention_layernorm.weight": "e5afc61f99d7cdc1d2d3fb7744177e33946d5297c7abf2e3ee7e66b06e07a86b"
|
| 378 |
+
},
|
| 379 |
+
"frozen_norm_after_sha256": {
|
| 380 |
+
"input_layernorm.weight": "e2de6c839943789a47634b944d123337190fc5ffcea79fe4de1b4f089dc2e79d",
|
| 381 |
+
"post_attention_layernorm.weight": "e5afc61f99d7cdc1d2d3fb7744177e33946d5297c7abf2e3ee7e66b06e07a86b"
|
| 382 |
+
},
|
| 383 |
+
"frozen_norms_unchanged": true,
|
| 384 |
+
"source_feature_transport": false,
|
| 385 |
+
"initializer": "come",
|
| 386 |
+
"removed_count_per_cycle": 1,
|
| 387 |
+
"teacher_boundary_current_layer": 23,
|
| 388 |
+
"teacher_boundary_original_layer": 23
|
| 389 |
+
}
|
| 390 |
+
}
|
runs/vast-paper_revision-come-attn-fit-20261126-62646539/20261126-llama31-come-attn-mlp-batch/catalog/results/batch1/audit/cycle_04_fit.json
ADDED
|
@@ -0,0 +1,389 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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.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": "all",
|
| 16 |
+
"train_subset": "all",
|
| 17 |
+
"num_gates": 7,
|
| 18 |
+
"num_attn_gates": 4,
|
| 19 |
+
"num_mlp_gates": 3,
|
| 20 |
+
"num_other_gates": 0,
|
| 21 |
+
"num_trainable_attn_gates": 4,
|
| 22 |
+
"num_trainable_mlp_gates": 3,
|
| 23 |
+
"num_trainable_other_gates": 0,
|
| 24 |
+
"lambda_init_summary": {
|
| 25 |
+
"num_tensors": 7,
|
| 26 |
+
"num_elements": 7,
|
| 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 |
+
"self_attn.q_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 |
+
"self_attn.k_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 |
+
"self_attn.v_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 |
+
"self_attn.o_proj.weight": {
|
| 55 |
+
"mean": 0.9998999834060669,
|
| 56 |
+
"std": 0.0,
|
| 57 |
+
"min": 0.9998999834060669,
|
| 58 |
+
"max": 0.9998999834060669,
|
| 59 |
+
"mean_abs_from_0_5": 0.4998999834060669
|
| 60 |
+
},
|
| 61 |
+
"mlp.gate_proj.weight": {
|
| 62 |
+
"mean": 0.9998999834060669,
|
| 63 |
+
"std": 0.0,
|
| 64 |
+
"min": 0.9998999834060669,
|
| 65 |
+
"max": 0.9998999834060669,
|
| 66 |
+
"mean_abs_from_0_5": 0.4998999834060669
|
| 67 |
+
},
|
| 68 |
+
"mlp.up_proj.weight": {
|
| 69 |
+
"mean": 0.9998999834060669,
|
| 70 |
+
"std": 0.0,
|
| 71 |
+
"min": 0.9998999834060669,
|
| 72 |
+
"max": 0.9998999834060669,
|
| 73 |
+
"mean_abs_from_0_5": 0.4998999834060669
|
| 74 |
+
},
|
| 75 |
+
"mlp.down_proj.weight": {
|
| 76 |
+
"mean": 0.9998999834060669,
|
| 77 |
+
"std": 0.0,
|
| 78 |
+
"min": 0.9998999834060669,
|
| 79 |
+
"max": 0.9998999834060669,
|
| 80 |
+
"mean_abs_from_0_5": 0.4998999834060669
|
| 81 |
+
}
|
| 82 |
+
}
|
| 83 |
+
},
|
| 84 |
+
"lambda_final_summary": {
|
| 85 |
+
"num_tensors": 7,
|
| 86 |
+
"num_elements": 7,
|
| 87 |
+
"mean": 1.0,
|
| 88 |
+
"std": 0.0,
|
| 89 |
+
"min": 1.0,
|
| 90 |
+
"max": 1.0,
|
| 91 |
+
"mean_abs_from_0_5": 0.5,
|
| 92 |
+
"per_tensor": {
|
| 93 |
+
"self_attn.q_proj.weight": {
|
| 94 |
+
"mean": 1.0,
|
| 95 |
+
"std": 0.0,
|
| 96 |
+
"min": 1.0,
|
| 97 |
+
"max": 1.0,
|
| 98 |
+
"mean_abs_from_0_5": 0.5
|
| 99 |
+
},
|
| 100 |
+
"self_attn.k_proj.weight": {
|
| 101 |
+
"mean": 1.0,
|
| 102 |
+
"std": 0.0,
|
| 103 |
+
"min": 1.0,
|
| 104 |
+
"max": 1.0,
|
| 105 |
+
"mean_abs_from_0_5": 0.5
|
| 106 |
+
},
|
| 107 |
+
"self_attn.v_proj.weight": {
|
| 108 |
+
"mean": 1.0,
|
| 109 |
+
"std": 0.0,
|
| 110 |
+
"min": 1.0,
|
| 111 |
+
"max": 1.0,
|
| 112 |
+
"mean_abs_from_0_5": 0.5
|
| 113 |
+
},
|
| 114 |
+
"self_attn.o_proj.weight": {
|
| 115 |
+
"mean": 1.0,
|
| 116 |
+
"std": 0.0,
|
| 117 |
+
"min": 1.0,
|
| 118 |
+
"max": 1.0,
|
| 119 |
+
"mean_abs_from_0_5": 0.5
|
| 120 |
+
},
|
| 121 |
+
"mlp.gate_proj.weight": {
|
| 122 |
+
"mean": 1.0,
|
| 123 |
+
"std": 0.0,
|
| 124 |
+
"min": 1.0,
|
| 125 |
+
"max": 1.0,
|
| 126 |
+
"mean_abs_from_0_5": 0.5
|
| 127 |
+
},
|
| 128 |
+
"mlp.up_proj.weight": {
|
| 129 |
+
"mean": 1.0,
|
| 130 |
+
"std": 0.0,
|
| 131 |
+
"min": 1.0,
|
| 132 |
+
"max": 1.0,
|
| 133 |
+
"mean_abs_from_0_5": 0.5
|
| 134 |
+
},
|
| 135 |
+
"mlp.down_proj.weight": {
|
| 136 |
+
"mean": 1.0,
|
| 137 |
+
"std": 0.0,
|
| 138 |
+
"min": 1.0,
|
| 139 |
+
"max": 1.0,
|
| 140 |
+
"mean_abs_from_0_5": 0.5
|
| 141 |
+
}
|
| 142 |
+
}
|
| 143 |
+
},
|
| 144 |
+
"lambda_delta_from_init": {
|
| 145 |
+
"num_tensors": 7,
|
| 146 |
+
"num_elements": 7,
|
| 147 |
+
"mean_abs": 0.0,
|
| 148 |
+
"rms": 0.0,
|
| 149 |
+
"max_abs": 0.0,
|
| 150 |
+
"per_tensor": {
|
| 151 |
+
"self_attn.q_proj.weight": {
|
| 152 |
+
"mean_abs": 0.0,
|
| 153 |
+
"rms": 0.0,
|
| 154 |
+
"max_abs": 0.0
|
| 155 |
+
},
|
| 156 |
+
"self_attn.k_proj.weight": {
|
| 157 |
+
"mean_abs": 0.0,
|
| 158 |
+
"rms": 0.0,
|
| 159 |
+
"max_abs": 0.0
|
| 160 |
+
},
|
| 161 |
+
"self_attn.v_proj.weight": {
|
| 162 |
+
"mean_abs": 0.0,
|
| 163 |
+
"rms": 0.0,
|
| 164 |
+
"max_abs": 0.0
|
| 165 |
+
},
|
| 166 |
+
"self_attn.o_proj.weight": {
|
| 167 |
+
"mean_abs": 0.0,
|
| 168 |
+
"rms": 0.0,
|
| 169 |
+
"max_abs": 0.0
|
| 170 |
+
},
|
| 171 |
+
"mlp.gate_proj.weight": {
|
| 172 |
+
"mean_abs": 0.0,
|
| 173 |
+
"rms": 0.0,
|
| 174 |
+
"max_abs": 0.0
|
| 175 |
+
},
|
| 176 |
+
"mlp.up_proj.weight": {
|
| 177 |
+
"mean_abs": 0.0,
|
| 178 |
+
"rms": 0.0,
|
| 179 |
+
"max_abs": 0.0
|
| 180 |
+
},
|
| 181 |
+
"mlp.down_proj.weight": {
|
| 182 |
+
"mean_abs": 0.0,
|
| 183 |
+
"rms": 0.0,
|
| 184 |
+
"max_abs": 0.0
|
| 185 |
+
}
|
| 186 |
+
}
|
| 187 |
+
},
|
| 188 |
+
"first_grad_summary": {
|
| 189 |
+
"joint": {
|
| 190 |
+
"step": 1,
|
| 191 |
+
"phase": "joint",
|
| 192 |
+
"gate": {
|
| 193 |
+
"num_tensors": 7,
|
| 194 |
+
"num_tensors_without_grad": 7,
|
| 195 |
+
"num_elements": 0,
|
| 196 |
+
"l2": 0.0,
|
| 197 |
+
"mean_abs": null,
|
| 198 |
+
"max_abs": 0.0
|
| 199 |
+
},
|
| 200 |
+
"u": {
|
| 201 |
+
"num_tensors": 7,
|
| 202 |
+
"num_tensors_without_grad": 0,
|
| 203 |
+
"num_elements": 218103808,
|
| 204 |
+
"l2": 0.5982950317066206,
|
| 205 |
+
"mean_abs": 4.832568475439285e-06,
|
| 206 |
+
"max_abs": 0.137908935546875
|
| 207 |
+
},
|
| 208 |
+
"rho": {
|
| 209 |
+
"num_tensors": 0,
|
| 210 |
+
"num_tensors_without_grad": 0,
|
| 211 |
+
"num_elements": 0,
|
| 212 |
+
"l2": 0.0,
|
| 213 |
+
"mean_abs": null,
|
| 214 |
+
"max_abs": 0.0
|
| 215 |
+
}
|
| 216 |
+
}
|
| 217 |
+
},
|
| 218 |
+
"u_delta_summary": {
|
| 219 |
+
"num_tensors": 7,
|
| 220 |
+
"num_elements": 218103808,
|
| 221 |
+
"mean": -5.223049354386743e-07,
|
| 222 |
+
"std": 0.0018736110343698644,
|
| 223 |
+
"rms": 0.001873611107171112,
|
| 224 |
+
"mean_abs": 0.0014820298171029068,
|
| 225 |
+
"min": -0.02104644477367401,
|
| 226 |
+
"max": 0.017571818083524704,
|
| 227 |
+
"per_tensor": {
|
| 228 |
+
"self_attn.q_proj.weight": {
|
| 229 |
+
"mean": -4.6837567424518056e-07,
|
| 230 |
+
"std": 0.0020769322710746394,
|
| 231 |
+
"rms": 0.002076932323887091,
|
| 232 |
+
"mean_abs": 0.0016433370765298605,
|
| 233 |
+
"min": -0.014263656921684742,
|
| 234 |
+
"max": 0.013543583452701569
|
| 235 |
+
},
|
| 236 |
+
"self_attn.k_proj.weight": {
|
| 237 |
+
"mean": -4.118480774195632e-07,
|
| 238 |
+
"std": 0.00206073116797089,
|
| 239 |
+
"rms": 0.0020607312091259033,
|
| 240 |
+
"mean_abs": 0.0016250568442046642,
|
| 241 |
+
"min": -0.017627064138650894,
|
| 242 |
+
"max": 0.017571818083524704
|
| 243 |
+
},
|
| 244 |
+
"self_attn.v_proj.weight": {
|
| 245 |
+
"mean": 8.290214736916823e-07,
|
| 246 |
+
"std": 0.002261940425933634,
|
| 247 |
+
"rms": 0.002261940577855535,
|
| 248 |
+
"mean_abs": 0.0018184988293796778,
|
| 249 |
+
"min": -0.011807046830654144,
|
| 250 |
+
"max": 0.01043677981942892
|
| 251 |
+
},
|
| 252 |
+
"self_attn.o_proj.weight": {
|
| 253 |
+
"mean": -2.3227248391322064e-07,
|
| 254 |
+
"std": 0.002012952786927413,
|
| 255 |
+
"rms": 0.002012952800328251,
|
| 256 |
+
"mean_abs": 0.0016105263493955135,
|
| 257 |
+
"min": -0.017861852422356606,
|
| 258 |
+
"max": 0.01619986817240715
|
| 259 |
+
},
|
| 260 |
+
"mlp.gate_proj.weight": {
|
| 261 |
+
"mean": -9.844203694748494e-07,
|
| 262 |
+
"std": 0.0018735002264150943,
|
| 263 |
+
"rms": 0.0018735004850442055,
|
| 264 |
+
"mean_abs": 0.0014853554644754954,
|
| 265 |
+
"min": -0.013976985588669777,
|
| 266 |
+
"max": 0.013716453686356544
|
| 267 |
+
},
|
| 268 |
+
"mlp.up_proj.weight": {
|
| 269 |
+
"mean": -5.514389808273076e-07,
|
| 270 |
+
"std": 0.0017408893985120149,
|
| 271 |
+
"rms": 0.0017408894858481037,
|
| 272 |
+
"mean_abs": 0.0013789013028144836,
|
| 273 |
+
"min": -0.014248429797589779,
|
| 274 |
+
"max": 0.014657333493232727
|
| 275 |
+
},
|
| 276 |
+
"mlp.down_proj.weight": {
|
| 277 |
+
"mean": -2.3374332158709876e-07,
|
| 278 |
+
"std": 0.0018544630713049186,
|
| 279 |
+
"rms": 0.001854463086035851,
|
| 280 |
+
"mean_abs": 0.001464781883571829,
|
| 281 |
+
"min": -0.02104644477367401,
|
| 282 |
+
"max": 0.013052985072135925
|
| 283 |
+
}
|
| 284 |
+
}
|
| 285 |
+
},
|
| 286 |
+
"rho_objective": "none",
|
| 287 |
+
"rho_schedule": "joint",
|
| 288 |
+
"additive_u": true,
|
| 289 |
+
"rho_epochs": 0.0,
|
| 290 |
+
"rho_lr": null,
|
| 291 |
+
"rho_bounds": null,
|
| 292 |
+
"rho_after_phase": null,
|
| 293 |
+
"rho_final": {},
|
| 294 |
+
"u_fisher_orthogonality": {},
|
| 295 |
+
"runtime": {
|
| 296 |
+
"seconds": 257.1419789120555,
|
| 297 |
+
"dataset_tokens": 524288,
|
| 298 |
+
"tokens_per_second": 2038.904741334788,
|
| 299 |
+
"batch_size": 1,
|
| 300 |
+
"batches_per_epoch": 512,
|
| 301 |
+
"grad_accumulation": 1,
|
| 302 |
+
"peak_allocated_bytes": 36659661312,
|
| 303 |
+
"peak_reserved_bytes": 49117396992,
|
| 304 |
+
"gpu_total_bytes": 85094825984,
|
| 305 |
+
"actual_forward_shapes": {
|
| 306 |
+
"teacher:1x1024": 512,
|
| 307 |
+
"student:1x1024": 512
|
| 308 |
+
}
|
| 309 |
+
},
|
| 310 |
+
"ablation": {
|
| 311 |
+
"lambda": null,
|
| 312 |
+
"endpoint_clamping": false,
|
| 313 |
+
"initial_u_nonzero": 0,
|
| 314 |
+
"merged_parameters": [
|
| 315 |
+
"self_attn.q_proj.weight",
|
| 316 |
+
"self_attn.k_proj.weight",
|
| 317 |
+
"self_attn.v_proj.weight",
|
| 318 |
+
"self_attn.o_proj.weight",
|
| 319 |
+
"mlp.gate_proj.weight",
|
| 320 |
+
"mlp.up_proj.weight",
|
| 321 |
+
"mlp.down_proj.weight"
|
| 322 |
+
],
|
| 323 |
+
"parameterization": "W_initial + U_add",
|
| 324 |
+
"fisher_computed": false,
|
| 325 |
+
"fit_scope": "attention_and_mlp",
|
| 326 |
+
"attention_initialization": "CoMe_channel_merge",
|
| 327 |
+
"norm_initialization": "CoMe_pair_mean",
|
| 328 |
+
"CoMe": {
|
| 329 |
+
"source_lineage": [
|
| 330 |
+
[
|
| 331 |
+
27
|
| 332 |
+
],
|
| 333 |
+
[
|
| 334 |
+
28
|
| 335 |
+
]
|
| 336 |
+
],
|
| 337 |
+
"retention_ratios": [
|
| 338 |
+
0.030000000000000034,
|
| 339 |
+
0.97
|
| 340 |
+
],
|
| 341 |
+
"retained_attention_groups": [
|
| 342 |
+
0,
|
| 343 |
+
8
|
| 344 |
+
],
|
| 345 |
+
"retained_mlp_neurons": [
|
| 346 |
+
430,
|
| 347 |
+
13906
|
| 348 |
+
],
|
| 349 |
+
"pair_score": 0.15186802412454897,
|
| 350 |
+
"minimum_retention": 0.97,
|
| 351 |
+
"adjusted_minimum": 0.97,
|
| 352 |
+
"power": 1.0,
|
| 353 |
+
"allow_repeat": true,
|
| 354 |
+
"sbi_metric": "angular_last",
|
| 355 |
+
"calibration_padding": "trim_right_padding_before_native_CoMe_scoring",
|
| 356 |
+
"teacher_mutated_during_initialization": false
|
| 357 |
+
},
|
| 358 |
+
"norms_trainable": false,
|
| 359 |
+
"initialized_parameters": [
|
| 360 |
+
"self_attn.q_proj.weight",
|
| 361 |
+
"self_attn.k_proj.weight",
|
| 362 |
+
"self_attn.v_proj.weight",
|
| 363 |
+
"self_attn.o_proj.weight",
|
| 364 |
+
"mlp.gate_proj.weight",
|
| 365 |
+
"mlp.up_proj.weight",
|
| 366 |
+
"mlp.down_proj.weight",
|
| 367 |
+
"input_layernorm.weight",
|
| 368 |
+
"post_attention_layernorm.weight"
|
| 369 |
+
],
|
| 370 |
+
"frozen_CoMe_parameters": [
|
| 371 |
+
"input_layernorm.weight",
|
| 372 |
+
"post_attention_layernorm.weight"
|
| 373 |
+
],
|
| 374 |
+
"frozen_norm_expected_sha256": {
|
| 375 |
+
"input_layernorm.weight": "82c897a3c9ed44a32d59af7149cdae61993ce3e0afc07e3557368b43b278f3eb",
|
| 376 |
+
"post_attention_layernorm.weight": "6eae861fe21653049b5398bb9d917175e9078ff8631bc8a050561d2ff4e03010"
|
| 377 |
+
},
|
| 378 |
+
"frozen_norm_after_sha256": {
|
| 379 |
+
"input_layernorm.weight": "82c897a3c9ed44a32d59af7149cdae61993ce3e0afc07e3557368b43b278f3eb",
|
| 380 |
+
"post_attention_layernorm.weight": "6eae861fe21653049b5398bb9d917175e9078ff8631bc8a050561d2ff4e03010"
|
| 381 |
+
},
|
| 382 |
+
"frozen_norms_unchanged": true,
|
| 383 |
+
"source_feature_transport": false,
|
| 384 |
+
"initializer": "come",
|
| 385 |
+
"removed_count_per_cycle": 1,
|
| 386 |
+
"teacher_boundary_current_layer": 25,
|
| 387 |
+
"teacher_boundary_original_layer": 28
|
| 388 |
+
}
|
| 389 |
+
}
|
runs/vast-paper_revision-come-attn-fit-20261126-62646539/20261126-llama31-come-attn-mlp-batch/catalog/results/batch1/audit/cycle_05_fit.json
ADDED
|
@@ -0,0 +1,389 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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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": "all",
|
| 16 |
+
"train_subset": "all",
|
| 17 |
+
"num_gates": 7,
|
| 18 |
+
"num_attn_gates": 4,
|
| 19 |
+
"num_mlp_gates": 3,
|
| 20 |
+
"num_other_gates": 0,
|
| 21 |
+
"num_trainable_attn_gates": 4,
|
| 22 |
+
"num_trainable_mlp_gates": 3,
|
| 23 |
+
"num_trainable_other_gates": 0,
|
| 24 |
+
"lambda_init_summary": {
|
| 25 |
+
"num_tensors": 7,
|
| 26 |
+
"num_elements": 7,
|
| 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 |
+
"self_attn.q_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 |
+
"self_attn.k_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 |
+
"self_attn.v_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 |
+
"self_attn.o_proj.weight": {
|
| 55 |
+
"mean": 0.9998999834060669,
|
| 56 |
+
"std": 0.0,
|
| 57 |
+
"min": 0.9998999834060669,
|
| 58 |
+
"max": 0.9998999834060669,
|
| 59 |
+
"mean_abs_from_0_5": 0.4998999834060669
|
| 60 |
+
},
|
| 61 |
+
"mlp.gate_proj.weight": {
|
| 62 |
+
"mean": 0.9998999834060669,
|
| 63 |
+
"std": 0.0,
|
| 64 |
+
"min": 0.9998999834060669,
|
| 65 |
+
"max": 0.9998999834060669,
|
| 66 |
+
"mean_abs_from_0_5": 0.4998999834060669
|
| 67 |
+
},
|
| 68 |
+
"mlp.up_proj.weight": {
|
| 69 |
+
"mean": 0.9998999834060669,
|
| 70 |
+
"std": 0.0,
|
| 71 |
+
"min": 0.9998999834060669,
|
| 72 |
+
"max": 0.9998999834060669,
|
| 73 |
+
"mean_abs_from_0_5": 0.4998999834060669
|
| 74 |
+
},
|
| 75 |
+
"mlp.down_proj.weight": {
|
| 76 |
+
"mean": 0.9998999834060669,
|
| 77 |
+
"std": 0.0,
|
| 78 |
+
"min": 0.9998999834060669,
|
| 79 |
+
"max": 0.9998999834060669,
|
| 80 |
+
"mean_abs_from_0_5": 0.4998999834060669
|
| 81 |
+
}
|
| 82 |
+
}
|
| 83 |
+
},
|
| 84 |
+
"lambda_final_summary": {
|
| 85 |
+
"num_tensors": 7,
|
| 86 |
+
"num_elements": 7,
|
| 87 |
+
"mean": 1.0,
|
| 88 |
+
"std": 0.0,
|
| 89 |
+
"min": 1.0,
|
| 90 |
+
"max": 1.0,
|
| 91 |
+
"mean_abs_from_0_5": 0.5,
|
| 92 |
+
"per_tensor": {
|
| 93 |
+
"self_attn.q_proj.weight": {
|
| 94 |
+
"mean": 1.0,
|
| 95 |
+
"std": 0.0,
|
| 96 |
+
"min": 1.0,
|
| 97 |
+
"max": 1.0,
|
| 98 |
+
"mean_abs_from_0_5": 0.5
|
| 99 |
+
},
|
| 100 |
+
"self_attn.k_proj.weight": {
|
| 101 |
+
"mean": 1.0,
|
| 102 |
+
"std": 0.0,
|
| 103 |
+
"min": 1.0,
|
| 104 |
+
"max": 1.0,
|
| 105 |
+
"mean_abs_from_0_5": 0.5
|
| 106 |
+
},
|
| 107 |
+
"self_attn.v_proj.weight": {
|
| 108 |
+
"mean": 1.0,
|
| 109 |
+
"std": 0.0,
|
| 110 |
+
"min": 1.0,
|
| 111 |
+
"max": 1.0,
|
| 112 |
+
"mean_abs_from_0_5": 0.5
|
| 113 |
+
},
|
| 114 |
+
"self_attn.o_proj.weight": {
|
| 115 |
+
"mean": 1.0,
|
| 116 |
+
"std": 0.0,
|
| 117 |
+
"min": 1.0,
|
| 118 |
+
"max": 1.0,
|
| 119 |
+
"mean_abs_from_0_5": 0.5
|
| 120 |
+
},
|
| 121 |
+
"mlp.gate_proj.weight": {
|
| 122 |
+
"mean": 1.0,
|
| 123 |
+
"std": 0.0,
|
| 124 |
+
"min": 1.0,
|
| 125 |
+
"max": 1.0,
|
| 126 |
+
"mean_abs_from_0_5": 0.5
|
| 127 |
+
},
|
| 128 |
+
"mlp.up_proj.weight": {
|
| 129 |
+
"mean": 1.0,
|
| 130 |
+
"std": 0.0,
|
| 131 |
+
"min": 1.0,
|
| 132 |
+
"max": 1.0,
|
| 133 |
+
"mean_abs_from_0_5": 0.5
|
| 134 |
+
},
|
| 135 |
+
"mlp.down_proj.weight": {
|
| 136 |
+
"mean": 1.0,
|
| 137 |
+
"std": 0.0,
|
| 138 |
+
"min": 1.0,
|
| 139 |
+
"max": 1.0,
|
| 140 |
+
"mean_abs_from_0_5": 0.5
|
| 141 |
+
}
|
| 142 |
+
}
|
| 143 |
+
},
|
| 144 |
+
"lambda_delta_from_init": {
|
| 145 |
+
"num_tensors": 7,
|
| 146 |
+
"num_elements": 7,
|
| 147 |
+
"mean_abs": 0.0,
|
| 148 |
+
"rms": 0.0,
|
| 149 |
+
"max_abs": 0.0,
|
| 150 |
+
"per_tensor": {
|
| 151 |
+
"self_attn.q_proj.weight": {
|
| 152 |
+
"mean_abs": 0.0,
|
| 153 |
+
"rms": 0.0,
|
| 154 |
+
"max_abs": 0.0
|
| 155 |
+
},
|
| 156 |
+
"self_attn.k_proj.weight": {
|
| 157 |
+
"mean_abs": 0.0,
|
| 158 |
+
"rms": 0.0,
|
| 159 |
+
"max_abs": 0.0
|
| 160 |
+
},
|
| 161 |
+
"self_attn.v_proj.weight": {
|
| 162 |
+
"mean_abs": 0.0,
|
| 163 |
+
"rms": 0.0,
|
| 164 |
+
"max_abs": 0.0
|
| 165 |
+
},
|
| 166 |
+
"self_attn.o_proj.weight": {
|
| 167 |
+
"mean_abs": 0.0,
|
| 168 |
+
"rms": 0.0,
|
| 169 |
+
"max_abs": 0.0
|
| 170 |
+
},
|
| 171 |
+
"mlp.gate_proj.weight": {
|
| 172 |
+
"mean_abs": 0.0,
|
| 173 |
+
"rms": 0.0,
|
| 174 |
+
"max_abs": 0.0
|
| 175 |
+
},
|
| 176 |
+
"mlp.up_proj.weight": {
|
| 177 |
+
"mean_abs": 0.0,
|
| 178 |
+
"rms": 0.0,
|
| 179 |
+
"max_abs": 0.0
|
| 180 |
+
},
|
| 181 |
+
"mlp.down_proj.weight": {
|
| 182 |
+
"mean_abs": 0.0,
|
| 183 |
+
"rms": 0.0,
|
| 184 |
+
"max_abs": 0.0
|
| 185 |
+
}
|
| 186 |
+
}
|
| 187 |
+
},
|
| 188 |
+
"first_grad_summary": {
|
| 189 |
+
"joint": {
|
| 190 |
+
"step": 1,
|
| 191 |
+
"phase": "joint",
|
| 192 |
+
"gate": {
|
| 193 |
+
"num_tensors": 7,
|
| 194 |
+
"num_tensors_without_grad": 7,
|
| 195 |
+
"num_elements": 0,
|
| 196 |
+
"l2": 0.0,
|
| 197 |
+
"mean_abs": null,
|
| 198 |
+
"max_abs": 0.0
|
| 199 |
+
},
|
| 200 |
+
"u": {
|
| 201 |
+
"num_tensors": 7,
|
| 202 |
+
"num_tensors_without_grad": 0,
|
| 203 |
+
"num_elements": 218103808,
|
| 204 |
+
"l2": 0.09324119431589878,
|
| 205 |
+
"mean_abs": 1.3674420310613082e-06,
|
| 206 |
+
"max_abs": 0.00487518310546875
|
| 207 |
+
},
|
| 208 |
+
"rho": {
|
| 209 |
+
"num_tensors": 0,
|
| 210 |
+
"num_tensors_without_grad": 0,
|
| 211 |
+
"num_elements": 0,
|
| 212 |
+
"l2": 0.0,
|
| 213 |
+
"mean_abs": null,
|
| 214 |
+
"max_abs": 0.0
|
| 215 |
+
}
|
| 216 |
+
}
|
| 217 |
+
},
|
| 218 |
+
"u_delta_summary": {
|
| 219 |
+
"num_tensors": 7,
|
| 220 |
+
"num_elements": 218103808,
|
| 221 |
+
"mean": 1.9921924846882507e-06,
|
| 222 |
+
"std": 0.002182301208533929,
|
| 223 |
+
"rms": 0.002182302117856174,
|
| 224 |
+
"mean_abs": 0.0017332255464190473,
|
| 225 |
+
"min": -0.018716270104050636,
|
| 226 |
+
"max": 0.022067204117774963,
|
| 227 |
+
"per_tensor": {
|
| 228 |
+
"self_attn.q_proj.weight": {
|
| 229 |
+
"mean": -1.0391734122094931e-06,
|
| 230 |
+
"std": 0.0023490961073869363,
|
| 231 |
+
"rms": 0.0023490963372373294,
|
| 232 |
+
"mean_abs": 0.0018796587828546762,
|
| 233 |
+
"min": -0.013763688504695892,
|
| 234 |
+
"max": 0.013231544755399227
|
| 235 |
+
},
|
| 236 |
+
"self_attn.k_proj.weight": {
|
| 237 |
+
"mean": -2.8278805075387936e-07,
|
| 238 |
+
"std": 0.002402714904573589,
|
| 239 |
+
"rms": 0.0024027149212149895,
|
| 240 |
+
"mean_abs": 0.0019244340946897864,
|
| 241 |
+
"min": -0.012475471012294292,
|
| 242 |
+
"max": 0.011907367035746574
|
| 243 |
+
},
|
| 244 |
+
"self_attn.v_proj.weight": {
|
| 245 |
+
"mean": 8.513063676218735e-08,
|
| 246 |
+
"std": 0.002108610251235567,
|
| 247 |
+
"rms": 0.002108610252954051,
|
| 248 |
+
"mean_abs": 0.0016862122574821115,
|
| 249 |
+
"min": -0.011996750719845295,
|
| 250 |
+
"max": 0.011487919837236404
|
| 251 |
+
},
|
| 252 |
+
"self_attn.o_proj.weight": {
|
| 253 |
+
"mean": 1.55700519144375e-08,
|
| 254 |
+
"std": 0.0021518711585887893,
|
| 255 |
+
"rms": 0.002151871158645119,
|
| 256 |
+
"mean_abs": 0.0017192392842844129,
|
| 257 |
+
"min": -0.011615659110248089,
|
| 258 |
+
"max": 0.01293181162327528
|
| 259 |
+
},
|
| 260 |
+
"mlp.gate_proj.weight": {
|
| 261 |
+
"mean": 7.73359352024272e-06,
|
| 262 |
+
"std": 0.0023371857201628407,
|
| 263 |
+
"rms": 0.002337198515103463,
|
| 264 |
+
"mean_abs": 0.0018625504204205104,
|
| 265 |
+
"min": -0.015628132969141006,
|
| 266 |
+
"max": 0.01554960198700428
|
| 267 |
+
},
|
| 268 |
+
"mlp.up_proj.weight": {
|
| 269 |
+
"mean": 4.956151055271871e-07,
|
| 270 |
+
"std": 0.0021968962021254182,
|
| 271 |
+
"rms": 0.0021968962580302736,
|
| 272 |
+
"mean_abs": 0.0017514764996511595,
|
| 273 |
+
"min": -0.018716270104050636,
|
| 274 |
+
"max": 0.022067204117774963
|
| 275 |
+
},
|
| 276 |
+
"mlp.down_proj.weight": {
|
| 277 |
+
"mean": -5.230600501298406e-07,
|
| 278 |
+
"std": 0.0019418073032171997,
|
| 279 |
+
"rms": 0.001941807373664924,
|
| 280 |
+
"mean_abs": 0.0015375080651470593,
|
| 281 |
+
"min": -0.012317588552832603,
|
| 282 |
+
"max": 0.011758661828935146
|
| 283 |
+
}
|
| 284 |
+
}
|
| 285 |
+
},
|
| 286 |
+
"rho_objective": "none",
|
| 287 |
+
"rho_schedule": "joint",
|
| 288 |
+
"additive_u": true,
|
| 289 |
+
"rho_epochs": 0.0,
|
| 290 |
+
"rho_lr": null,
|
| 291 |
+
"rho_bounds": null,
|
| 292 |
+
"rho_after_phase": null,
|
| 293 |
+
"rho_final": {},
|
| 294 |
+
"u_fisher_orthogonality": {},
|
| 295 |
+
"runtime": {
|
| 296 |
+
"seconds": 246.00541301816702,
|
| 297 |
+
"dataset_tokens": 524288,
|
| 298 |
+
"tokens_per_second": 2131.2051371864827,
|
| 299 |
+
"batch_size": 1,
|
| 300 |
+
"batches_per_epoch": 512,
|
| 301 |
+
"grad_accumulation": 1,
|
| 302 |
+
"peak_allocated_bytes": 36215485952,
|
| 303 |
+
"peak_reserved_bytes": 47794094080,
|
| 304 |
+
"gpu_total_bytes": 85094825984,
|
| 305 |
+
"actual_forward_shapes": {
|
| 306 |
+
"teacher:1x1024": 512,
|
| 307 |
+
"student:1x1024": 512
|
| 308 |
+
}
|
| 309 |
+
},
|
| 310 |
+
"ablation": {
|
| 311 |
+
"lambda": null,
|
| 312 |
+
"endpoint_clamping": false,
|
| 313 |
+
"initial_u_nonzero": 0,
|
| 314 |
+
"merged_parameters": [
|
| 315 |
+
"self_attn.q_proj.weight",
|
| 316 |
+
"self_attn.k_proj.weight",
|
| 317 |
+
"self_attn.v_proj.weight",
|
| 318 |
+
"self_attn.o_proj.weight",
|
| 319 |
+
"mlp.gate_proj.weight",
|
| 320 |
+
"mlp.up_proj.weight",
|
| 321 |
+
"mlp.down_proj.weight"
|
| 322 |
+
],
|
| 323 |
+
"parameterization": "W_initial + U_add",
|
| 324 |
+
"fisher_computed": false,
|
| 325 |
+
"fit_scope": "attention_and_mlp",
|
| 326 |
+
"attention_initialization": "CoMe_channel_merge",
|
| 327 |
+
"norm_initialization": "CoMe_pair_mean",
|
| 328 |
+
"CoMe": {
|
| 329 |
+
"source_lineage": [
|
| 330 |
+
[
|
| 331 |
+
20
|
| 332 |
+
],
|
| 333 |
+
[
|
| 334 |
+
21
|
| 335 |
+
]
|
| 336 |
+
],
|
| 337 |
+
"retention_ratios": [
|
| 338 |
+
0.030000000000000034,
|
| 339 |
+
0.97
|
| 340 |
+
],
|
| 341 |
+
"retained_attention_groups": [
|
| 342 |
+
0,
|
| 343 |
+
8
|
| 344 |
+
],
|
| 345 |
+
"retained_mlp_neurons": [
|
| 346 |
+
430,
|
| 347 |
+
13906
|
| 348 |
+
],
|
| 349 |
+
"pair_score": 0.16033791234860054,
|
| 350 |
+
"minimum_retention": 0.97,
|
| 351 |
+
"adjusted_minimum": 0.97,
|
| 352 |
+
"power": 1.0,
|
| 353 |
+
"allow_repeat": true,
|
| 354 |
+
"sbi_metric": "angular_last",
|
| 355 |
+
"calibration_padding": "trim_right_padding_before_native_CoMe_scoring",
|
| 356 |
+
"teacher_mutated_during_initialization": false
|
| 357 |
+
},
|
| 358 |
+
"norms_trainable": false,
|
| 359 |
+
"initialized_parameters": [
|
| 360 |
+
"self_attn.q_proj.weight",
|
| 361 |
+
"self_attn.k_proj.weight",
|
| 362 |
+
"self_attn.v_proj.weight",
|
| 363 |
+
"self_attn.o_proj.weight",
|
| 364 |
+
"mlp.gate_proj.weight",
|
| 365 |
+
"mlp.up_proj.weight",
|
| 366 |
+
"mlp.down_proj.weight",
|
| 367 |
+
"input_layernorm.weight",
|
| 368 |
+
"post_attention_layernorm.weight"
|
| 369 |
+
],
|
| 370 |
+
"frozen_CoMe_parameters": [
|
| 371 |
+
"input_layernorm.weight",
|
| 372 |
+
"post_attention_layernorm.weight"
|
| 373 |
+
],
|
| 374 |
+
"frozen_norm_expected_sha256": {
|
| 375 |
+
"input_layernorm.weight": "ea6f758e06c4052277c8f3373b2c157ef693174484383223d292c676f9950fb0",
|
| 376 |
+
"post_attention_layernorm.weight": "184d78eeeffa2e6c7c43cc6c5b2dcacf936a6566ad18dad15a7fbc9fee4215ae"
|
| 377 |
+
},
|
| 378 |
+
"frozen_norm_after_sha256": {
|
| 379 |
+
"input_layernorm.weight": "ea6f758e06c4052277c8f3373b2c157ef693174484383223d292c676f9950fb0",
|
| 380 |
+
"post_attention_layernorm.weight": "184d78eeeffa2e6c7c43cc6c5b2dcacf936a6566ad18dad15a7fbc9fee4215ae"
|
| 381 |
+
},
|
| 382 |
+
"frozen_norms_unchanged": true,
|
| 383 |
+
"source_feature_transport": false,
|
| 384 |
+
"initializer": "come",
|
| 385 |
+
"removed_count_per_cycle": 1,
|
| 386 |
+
"teacher_boundary_current_layer": 21,
|
| 387 |
+
"teacher_boundary_original_layer": 21
|
| 388 |
+
}
|
| 389 |
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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": "all",
|
| 16 |
+
"train_subset": "all",
|
| 17 |
+
"num_gates": 7,
|
| 18 |
+
"num_attn_gates": 4,
|
| 19 |
+
"num_mlp_gates": 3,
|
| 20 |
+
"num_other_gates": 0,
|
| 21 |
+
"num_trainable_attn_gates": 4,
|
| 22 |
+
"num_trainable_mlp_gates": 3,
|
| 23 |
+
"num_trainable_other_gates": 0,
|
| 24 |
+
"lambda_init_summary": {
|
| 25 |
+
"num_tensors": 7,
|
| 26 |
+
"num_elements": 7,
|
| 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 |
+
"self_attn.q_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 |
+
"self_attn.k_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 |
+
"self_attn.v_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 |
+
"self_attn.o_proj.weight": {
|
| 55 |
+
"mean": 0.9998999834060669,
|
| 56 |
+
"std": 0.0,
|
| 57 |
+
"min": 0.9998999834060669,
|
| 58 |
+
"max": 0.9998999834060669,
|
| 59 |
+
"mean_abs_from_0_5": 0.4998999834060669
|
| 60 |
+
},
|
| 61 |
+
"mlp.gate_proj.weight": {
|
| 62 |
+
"mean": 0.9998999834060669,
|
| 63 |
+
"std": 0.0,
|
| 64 |
+
"min": 0.9998999834060669,
|
| 65 |
+
"max": 0.9998999834060669,
|
| 66 |
+
"mean_abs_from_0_5": 0.4998999834060669
|
| 67 |
+
},
|
| 68 |
+
"mlp.up_proj.weight": {
|
| 69 |
+
"mean": 0.9998999834060669,
|
| 70 |
+
"std": 0.0,
|
| 71 |
+
"min": 0.9998999834060669,
|
| 72 |
+
"max": 0.9998999834060669,
|
| 73 |
+
"mean_abs_from_0_5": 0.4998999834060669
|
| 74 |
+
},
|
| 75 |
+
"mlp.down_proj.weight": {
|
| 76 |
+
"mean": 0.9998999834060669,
|
| 77 |
+
"std": 0.0,
|
| 78 |
+
"min": 0.9998999834060669,
|
| 79 |
+
"max": 0.9998999834060669,
|
| 80 |
+
"mean_abs_from_0_5": 0.4998999834060669
|
| 81 |
+
}
|
| 82 |
+
}
|
| 83 |
+
},
|
| 84 |
+
"lambda_final_summary": {
|
| 85 |
+
"num_tensors": 7,
|
| 86 |
+
"num_elements": 7,
|
| 87 |
+
"mean": 1.0,
|
| 88 |
+
"std": 0.0,
|
| 89 |
+
"min": 1.0,
|
| 90 |
+
"max": 1.0,
|
| 91 |
+
"mean_abs_from_0_5": 0.5,
|
| 92 |
+
"per_tensor": {
|
| 93 |
+
"self_attn.q_proj.weight": {
|
| 94 |
+
"mean": 1.0,
|
| 95 |
+
"std": 0.0,
|
| 96 |
+
"min": 1.0,
|
| 97 |
+
"max": 1.0,
|
| 98 |
+
"mean_abs_from_0_5": 0.5
|
| 99 |
+
},
|
| 100 |
+
"self_attn.k_proj.weight": {
|
| 101 |
+
"mean": 1.0,
|
| 102 |
+
"std": 0.0,
|
| 103 |
+
"min": 1.0,
|
| 104 |
+
"max": 1.0,
|
| 105 |
+
"mean_abs_from_0_5": 0.5
|
| 106 |
+
},
|
| 107 |
+
"self_attn.v_proj.weight": {
|
| 108 |
+
"mean": 1.0,
|
| 109 |
+
"std": 0.0,
|
| 110 |
+
"min": 1.0,
|
| 111 |
+
"max": 1.0,
|
| 112 |
+
"mean_abs_from_0_5": 0.5
|
| 113 |
+
},
|
| 114 |
+
"self_attn.o_proj.weight": {
|
| 115 |
+
"mean": 1.0,
|
| 116 |
+
"std": 0.0,
|
| 117 |
+
"min": 1.0,
|
| 118 |
+
"max": 1.0,
|
| 119 |
+
"mean_abs_from_0_5": 0.5
|
| 120 |
+
},
|
| 121 |
+
"mlp.gate_proj.weight": {
|
| 122 |
+
"mean": 1.0,
|
| 123 |
+
"std": 0.0,
|
| 124 |
+
"min": 1.0,
|
| 125 |
+
"max": 1.0,
|
| 126 |
+
"mean_abs_from_0_5": 0.5
|
| 127 |
+
},
|
| 128 |
+
"mlp.up_proj.weight": {
|
| 129 |
+
"mean": 1.0,
|
| 130 |
+
"std": 0.0,
|
| 131 |
+
"min": 1.0,
|
| 132 |
+
"max": 1.0,
|
| 133 |
+
"mean_abs_from_0_5": 0.5
|
| 134 |
+
},
|
| 135 |
+
"mlp.down_proj.weight": {
|
| 136 |
+
"mean": 1.0,
|
| 137 |
+
"std": 0.0,
|
| 138 |
+
"min": 1.0,
|
| 139 |
+
"max": 1.0,
|
| 140 |
+
"mean_abs_from_0_5": 0.5
|
| 141 |
+
}
|
| 142 |
+
}
|
| 143 |
+
},
|
| 144 |
+
"lambda_delta_from_init": {
|
| 145 |
+
"num_tensors": 7,
|
| 146 |
+
"num_elements": 7,
|
| 147 |
+
"mean_abs": 0.0,
|
| 148 |
+
"rms": 0.0,
|
| 149 |
+
"max_abs": 0.0,
|
| 150 |
+
"per_tensor": {
|
| 151 |
+
"self_attn.q_proj.weight": {
|
| 152 |
+
"mean_abs": 0.0,
|
| 153 |
+
"rms": 0.0,
|
| 154 |
+
"max_abs": 0.0
|
| 155 |
+
},
|
| 156 |
+
"self_attn.k_proj.weight": {
|
| 157 |
+
"mean_abs": 0.0,
|
| 158 |
+
"rms": 0.0,
|
| 159 |
+
"max_abs": 0.0
|
| 160 |
+
},
|
| 161 |
+
"self_attn.v_proj.weight": {
|
| 162 |
+
"mean_abs": 0.0,
|
| 163 |
+
"rms": 0.0,
|
| 164 |
+
"max_abs": 0.0
|
| 165 |
+
},
|
| 166 |
+
"self_attn.o_proj.weight": {
|
| 167 |
+
"mean_abs": 0.0,
|
| 168 |
+
"rms": 0.0,
|
| 169 |
+
"max_abs": 0.0
|
| 170 |
+
},
|
| 171 |
+
"mlp.gate_proj.weight": {
|
| 172 |
+
"mean_abs": 0.0,
|
| 173 |
+
"rms": 0.0,
|
| 174 |
+
"max_abs": 0.0
|
| 175 |
+
},
|
| 176 |
+
"mlp.up_proj.weight": {
|
| 177 |
+
"mean_abs": 0.0,
|
| 178 |
+
"rms": 0.0,
|
| 179 |
+
"max_abs": 0.0
|
| 180 |
+
},
|
| 181 |
+
"mlp.down_proj.weight": {
|
| 182 |
+
"mean_abs": 0.0,
|
| 183 |
+
"rms": 0.0,
|
| 184 |
+
"max_abs": 0.0
|
| 185 |
+
}
|
| 186 |
+
}
|
| 187 |
+
},
|
| 188 |
+
"first_grad_summary": {
|
| 189 |
+
"joint": {
|
| 190 |
+
"step": 1,
|
| 191 |
+
"phase": "joint",
|
| 192 |
+
"gate": {
|
| 193 |
+
"num_tensors": 7,
|
| 194 |
+
"num_tensors_without_grad": 7,
|
| 195 |
+
"num_elements": 0,
|
| 196 |
+
"l2": 0.0,
|
| 197 |
+
"mean_abs": null,
|
| 198 |
+
"max_abs": 0.0
|
| 199 |
+
},
|
| 200 |
+
"u": {
|
| 201 |
+
"num_tensors": 7,
|
| 202 |
+
"num_tensors_without_grad": 0,
|
| 203 |
+
"num_elements": 218103808,
|
| 204 |
+
"l2": 0.038694951413377206,
|
| 205 |
+
"mean_abs": 1.1298694503763657e-06,
|
| 206 |
+
"max_abs": 0.0032958984375
|
| 207 |
+
},
|
| 208 |
+
"rho": {
|
| 209 |
+
"num_tensors": 0,
|
| 210 |
+
"num_tensors_without_grad": 0,
|
| 211 |
+
"num_elements": 0,
|
| 212 |
+
"l2": 0.0,
|
| 213 |
+
"mean_abs": null,
|
| 214 |
+
"max_abs": 0.0
|
| 215 |
+
}
|
| 216 |
+
}
|
| 217 |
+
},
|
| 218 |
+
"u_delta_summary": {
|
| 219 |
+
"num_tensors": 7,
|
| 220 |
+
"num_elements": 218103808,
|
| 221 |
+
"mean": 2.700281964525157e-07,
|
| 222 |
+
"std": 0.002413092578725195,
|
| 223 |
+
"rms": 0.002413092593833448,
|
| 224 |
+
"mean_abs": 0.0019182043145589817,
|
| 225 |
+
"min": -0.026222385466098785,
|
| 226 |
+
"max": 0.027783824130892754,
|
| 227 |
+
"per_tensor": {
|
| 228 |
+
"self_attn.q_proj.weight": {
|
| 229 |
+
"mean": 4.2545957512629684e-07,
|
| 230 |
+
"std": 0.0022531363156843933,
|
| 231 |
+
"rms": 0.002253136355854144,
|
| 232 |
+
"mean_abs": 0.001795110758394003,
|
| 233 |
+
"min": -0.013002215884625912,
|
| 234 |
+
"max": 0.012512745335698128
|
| 235 |
+
},
|
| 236 |
+
"self_attn.k_proj.weight": {
|
| 237 |
+
"mean": -1.1666757018247154e-06,
|
| 238 |
+
"std": 0.0023351197149979104,
|
| 239 |
+
"rms": 0.002335120006445946,
|
| 240 |
+
"mean_abs": 0.00185949367005378,
|
| 241 |
+
"min": -0.012737123295664787,
|
| 242 |
+
"max": 0.012046446092426777
|
| 243 |
+
},
|
| 244 |
+
"self_attn.v_proj.weight": {
|
| 245 |
+
"mean": 5.564544380831649e-07,
|
| 246 |
+
"std": 0.002157163379051155,
|
| 247 |
+
"rms": 0.0021571634508216896,
|
| 248 |
+
"mean_abs": 0.001720471540465951,
|
| 249 |
+
"min": -0.010654805228114128,
|
| 250 |
+
"max": 0.010871617123484612
|
| 251 |
+
},
|
| 252 |
+
"self_attn.o_proj.weight": {
|
| 253 |
+
"mean": 1.3545023875849438e-06,
|
| 254 |
+
"std": 0.0021193060584168777,
|
| 255 |
+
"rms": 0.0021193064912652915,
|
| 256 |
+
"mean_abs": 0.001682997215539217,
|
| 257 |
+
"min": -0.026222385466098785,
|
| 258 |
+
"max": 0.027783824130892754
|
| 259 |
+
},
|
| 260 |
+
"mlp.gate_proj.weight": {
|
| 261 |
+
"mean": 5.646104130261977e-07,
|
| 262 |
+
"std": 0.0025575989072711414,
|
| 263 |
+
"rms": 0.0025575989695922727,
|
| 264 |
+
"mean_abs": 0.002040990096117769,
|
| 265 |
+
"min": -0.01426706276834011,
|
| 266 |
+
"max": 0.014423456974327564
|
| 267 |
+
},
|
| 268 |
+
"mlp.up_proj.weight": {
|
| 269 |
+
"mean": 1.7033880794770084e-07,
|
| 270 |
+
"std": 0.002492530935687622,
|
| 271 |
+
"rms": 0.002492530941508073,
|
| 272 |
+
"mean_abs": 0.001987034854079996,
|
| 273 |
+
"min": -0.015412569046020508,
|
| 274 |
+
"max": 0.013995610177516937
|
| 275 |
+
},
|
| 276 |
+
"mlp.down_proj.weight": {
|
| 277 |
+
"mean": -1.9696067608622669e-07,
|
| 278 |
+
"std": 0.0023278136488605067,
|
| 279 |
+
"rms": 0.0023278136571931126,
|
| 280 |
+
"mean_abs": 0.0018472769962889807,
|
| 281 |
+
"min": -0.019714737311005592,
|
| 282 |
+
"max": 0.0232838187366724
|
| 283 |
+
}
|
| 284 |
+
}
|
| 285 |
+
},
|
| 286 |
+
"rho_objective": "none",
|
| 287 |
+
"rho_schedule": "joint",
|
| 288 |
+
"additive_u": true,
|
| 289 |
+
"rho_epochs": 0.0,
|
| 290 |
+
"rho_lr": null,
|
| 291 |
+
"rho_bounds": null,
|
| 292 |
+
"rho_after_phase": null,
|
| 293 |
+
"rho_final": {},
|
| 294 |
+
"u_fisher_orthogonality": {},
|
| 295 |
+
"runtime": {
|
| 296 |
+
"seconds": 240.0856456439942,
|
| 297 |
+
"dataset_tokens": 524288,
|
| 298 |
+
"tokens_per_second": 2183.754045743447,
|
| 299 |
+
"batch_size": 1,
|
| 300 |
+
"batches_per_epoch": 512,
|
| 301 |
+
"grad_accumulation": 1,
|
| 302 |
+
"peak_allocated_bytes": 35344086528,
|
| 303 |
+
"peak_reserved_bytes": 46472888320,
|
| 304 |
+
"gpu_total_bytes": 85094825984,
|
| 305 |
+
"actual_forward_shapes": {
|
| 306 |
+
"teacher:1x1024": 512,
|
| 307 |
+
"student:1x1024": 512
|
| 308 |
+
}
|
| 309 |
+
},
|
| 310 |
+
"ablation": {
|
| 311 |
+
"lambda": null,
|
| 312 |
+
"endpoint_clamping": false,
|
| 313 |
+
"initial_u_nonzero": 0,
|
| 314 |
+
"merged_parameters": [
|
| 315 |
+
"self_attn.q_proj.weight",
|
| 316 |
+
"self_attn.k_proj.weight",
|
| 317 |
+
"self_attn.v_proj.weight",
|
| 318 |
+
"self_attn.o_proj.weight",
|
| 319 |
+
"mlp.gate_proj.weight",
|
| 320 |
+
"mlp.up_proj.weight",
|
| 321 |
+
"mlp.down_proj.weight"
|
| 322 |
+
],
|
| 323 |
+
"parameterization": "W_initial + U_add",
|
| 324 |
+
"fisher_computed": false,
|
| 325 |
+
"fit_scope": "attention_and_mlp",
|
| 326 |
+
"attention_initialization": "CoMe_channel_merge",
|
| 327 |
+
"norm_initialization": "CoMe_pair_mean",
|
| 328 |
+
"CoMe": {
|
| 329 |
+
"source_lineage": [
|
| 330 |
+
[
|
| 331 |
+
19
|
| 332 |
+
],
|
| 333 |
+
[
|
| 334 |
+
20,
|
| 335 |
+
21
|
| 336 |
+
]
|
| 337 |
+
],
|
| 338 |
+
"retention_ratios": [
|
| 339 |
+
0.9848857801796105,
|
| 340 |
+
0.015114219820389522
|
| 341 |
+
],
|
| 342 |
+
"retained_attention_groups": [
|
| 343 |
+
8,
|
| 344 |
+
0
|
| 345 |
+
],
|
| 346 |
+
"retained_mlp_neurons": [
|
| 347 |
+
14120,
|
| 348 |
+
216
|
| 349 |
+
],
|
| 350 |
+
"pair_score": 0.17005293169519403,
|
| 351 |
+
"minimum_retention": 0.97,
|
| 352 |
+
"adjusted_minimum": 0.9848857801796105,
|
| 353 |
+
"power": 1.0,
|
| 354 |
+
"allow_repeat": true,
|
| 355 |
+
"sbi_metric": "angular_last",
|
| 356 |
+
"calibration_padding": "trim_right_padding_before_native_CoMe_scoring",
|
| 357 |
+
"teacher_mutated_during_initialization": false
|
| 358 |
+
},
|
| 359 |
+
"norms_trainable": false,
|
| 360 |
+
"initialized_parameters": [
|
| 361 |
+
"self_attn.q_proj.weight",
|
| 362 |
+
"self_attn.k_proj.weight",
|
| 363 |
+
"self_attn.v_proj.weight",
|
| 364 |
+
"self_attn.o_proj.weight",
|
| 365 |
+
"mlp.gate_proj.weight",
|
| 366 |
+
"mlp.up_proj.weight",
|
| 367 |
+
"mlp.down_proj.weight",
|
| 368 |
+
"input_layernorm.weight",
|
| 369 |
+
"post_attention_layernorm.weight"
|
| 370 |
+
],
|
| 371 |
+
"frozen_CoMe_parameters": [
|
| 372 |
+
"input_layernorm.weight",
|
| 373 |
+
"post_attention_layernorm.weight"
|
| 374 |
+
],
|
| 375 |
+
"frozen_norm_expected_sha256": {
|
| 376 |
+
"input_layernorm.weight": "ab31f8a39b78d89bd7ebde31d9d2734e20487fb2f3bb1f3dd818eee0055d157c",
|
| 377 |
+
"post_attention_layernorm.weight": "aef35cc46653ab191a199f4884133b857fd3ffd2f1c8478b02c01e5f8d12317b"
|
| 378 |
+
},
|
| 379 |
+
"frozen_norm_after_sha256": {
|
| 380 |
+
"input_layernorm.weight": "ab31f8a39b78d89bd7ebde31d9d2734e20487fb2f3bb1f3dd818eee0055d157c",
|
| 381 |
+
"post_attention_layernorm.weight": "aef35cc46653ab191a199f4884133b857fd3ffd2f1c8478b02c01e5f8d12317b"
|
| 382 |
+
},
|
| 383 |
+
"frozen_norms_unchanged": true,
|
| 384 |
+
"source_feature_transport": false,
|
| 385 |
+
"initializer": "come",
|
| 386 |
+
"removed_count_per_cycle": 1,
|
| 387 |
+
"teacher_boundary_current_layer": 20,
|
| 388 |
+
"teacher_boundary_original_layer": 20
|
| 389 |
+
}
|
| 390 |
+
}
|
runs/vast-paper_revision-come-attn-fit-20261126-62646539/20261126-llama31-come-attn-mlp-batch/catalog/results/batch1/audit/cycle_07_fit.json
ADDED
|
@@ -0,0 +1,390 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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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": "all",
|
| 16 |
+
"train_subset": "all",
|
| 17 |
+
"num_gates": 7,
|
| 18 |
+
"num_attn_gates": 4,
|
| 19 |
+
"num_mlp_gates": 3,
|
| 20 |
+
"num_other_gates": 0,
|
| 21 |
+
"num_trainable_attn_gates": 4,
|
| 22 |
+
"num_trainable_mlp_gates": 3,
|
| 23 |
+
"num_trainable_other_gates": 0,
|
| 24 |
+
"lambda_init_summary": {
|
| 25 |
+
"num_tensors": 7,
|
| 26 |
+
"num_elements": 7,
|
| 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 |
+
"self_attn.q_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 |
+
"self_attn.k_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 |
+
"self_attn.v_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 |
+
"self_attn.o_proj.weight": {
|
| 55 |
+
"mean": 0.9998999834060669,
|
| 56 |
+
"std": 0.0,
|
| 57 |
+
"min": 0.9998999834060669,
|
| 58 |
+
"max": 0.9998999834060669,
|
| 59 |
+
"mean_abs_from_0_5": 0.4998999834060669
|
| 60 |
+
},
|
| 61 |
+
"mlp.gate_proj.weight": {
|
| 62 |
+
"mean": 0.9998999834060669,
|
| 63 |
+
"std": 0.0,
|
| 64 |
+
"min": 0.9998999834060669,
|
| 65 |
+
"max": 0.9998999834060669,
|
| 66 |
+
"mean_abs_from_0_5": 0.4998999834060669
|
| 67 |
+
},
|
| 68 |
+
"mlp.up_proj.weight": {
|
| 69 |
+
"mean": 0.9998999834060669,
|
| 70 |
+
"std": 0.0,
|
| 71 |
+
"min": 0.9998999834060669,
|
| 72 |
+
"max": 0.9998999834060669,
|
| 73 |
+
"mean_abs_from_0_5": 0.4998999834060669
|
| 74 |
+
},
|
| 75 |
+
"mlp.down_proj.weight": {
|
| 76 |
+
"mean": 0.9998999834060669,
|
| 77 |
+
"std": 0.0,
|
| 78 |
+
"min": 0.9998999834060669,
|
| 79 |
+
"max": 0.9998999834060669,
|
| 80 |
+
"mean_abs_from_0_5": 0.4998999834060669
|
| 81 |
+
}
|
| 82 |
+
}
|
| 83 |
+
},
|
| 84 |
+
"lambda_final_summary": {
|
| 85 |
+
"num_tensors": 7,
|
| 86 |
+
"num_elements": 7,
|
| 87 |
+
"mean": 1.0,
|
| 88 |
+
"std": 0.0,
|
| 89 |
+
"min": 1.0,
|
| 90 |
+
"max": 1.0,
|
| 91 |
+
"mean_abs_from_0_5": 0.5,
|
| 92 |
+
"per_tensor": {
|
| 93 |
+
"self_attn.q_proj.weight": {
|
| 94 |
+
"mean": 1.0,
|
| 95 |
+
"std": 0.0,
|
| 96 |
+
"min": 1.0,
|
| 97 |
+
"max": 1.0,
|
| 98 |
+
"mean_abs_from_0_5": 0.5
|
| 99 |
+
},
|
| 100 |
+
"self_attn.k_proj.weight": {
|
| 101 |
+
"mean": 1.0,
|
| 102 |
+
"std": 0.0,
|
| 103 |
+
"min": 1.0,
|
| 104 |
+
"max": 1.0,
|
| 105 |
+
"mean_abs_from_0_5": 0.5
|
| 106 |
+
},
|
| 107 |
+
"self_attn.v_proj.weight": {
|
| 108 |
+
"mean": 1.0,
|
| 109 |
+
"std": 0.0,
|
| 110 |
+
"min": 1.0,
|
| 111 |
+
"max": 1.0,
|
| 112 |
+
"mean_abs_from_0_5": 0.5
|
| 113 |
+
},
|
| 114 |
+
"self_attn.o_proj.weight": {
|
| 115 |
+
"mean": 1.0,
|
| 116 |
+
"std": 0.0,
|
| 117 |
+
"min": 1.0,
|
| 118 |
+
"max": 1.0,
|
| 119 |
+
"mean_abs_from_0_5": 0.5
|
| 120 |
+
},
|
| 121 |
+
"mlp.gate_proj.weight": {
|
| 122 |
+
"mean": 1.0,
|
| 123 |
+
"std": 0.0,
|
| 124 |
+
"min": 1.0,
|
| 125 |
+
"max": 1.0,
|
| 126 |
+
"mean_abs_from_0_5": 0.5
|
| 127 |
+
},
|
| 128 |
+
"mlp.up_proj.weight": {
|
| 129 |
+
"mean": 1.0,
|
| 130 |
+
"std": 0.0,
|
| 131 |
+
"min": 1.0,
|
| 132 |
+
"max": 1.0,
|
| 133 |
+
"mean_abs_from_0_5": 0.5
|
| 134 |
+
},
|
| 135 |
+
"mlp.down_proj.weight": {
|
| 136 |
+
"mean": 1.0,
|
| 137 |
+
"std": 0.0,
|
| 138 |
+
"min": 1.0,
|
| 139 |
+
"max": 1.0,
|
| 140 |
+
"mean_abs_from_0_5": 0.5
|
| 141 |
+
}
|
| 142 |
+
}
|
| 143 |
+
},
|
| 144 |
+
"lambda_delta_from_init": {
|
| 145 |
+
"num_tensors": 7,
|
| 146 |
+
"num_elements": 7,
|
| 147 |
+
"mean_abs": 0.0,
|
| 148 |
+
"rms": 0.0,
|
| 149 |
+
"max_abs": 0.0,
|
| 150 |
+
"per_tensor": {
|
| 151 |
+
"self_attn.q_proj.weight": {
|
| 152 |
+
"mean_abs": 0.0,
|
| 153 |
+
"rms": 0.0,
|
| 154 |
+
"max_abs": 0.0
|
| 155 |
+
},
|
| 156 |
+
"self_attn.k_proj.weight": {
|
| 157 |
+
"mean_abs": 0.0,
|
| 158 |
+
"rms": 0.0,
|
| 159 |
+
"max_abs": 0.0
|
| 160 |
+
},
|
| 161 |
+
"self_attn.v_proj.weight": {
|
| 162 |
+
"mean_abs": 0.0,
|
| 163 |
+
"rms": 0.0,
|
| 164 |
+
"max_abs": 0.0
|
| 165 |
+
},
|
| 166 |
+
"self_attn.o_proj.weight": {
|
| 167 |
+
"mean_abs": 0.0,
|
| 168 |
+
"rms": 0.0,
|
| 169 |
+
"max_abs": 0.0
|
| 170 |
+
},
|
| 171 |
+
"mlp.gate_proj.weight": {
|
| 172 |
+
"mean_abs": 0.0,
|
| 173 |
+
"rms": 0.0,
|
| 174 |
+
"max_abs": 0.0
|
| 175 |
+
},
|
| 176 |
+
"mlp.up_proj.weight": {
|
| 177 |
+
"mean_abs": 0.0,
|
| 178 |
+
"rms": 0.0,
|
| 179 |
+
"max_abs": 0.0
|
| 180 |
+
},
|
| 181 |
+
"mlp.down_proj.weight": {
|
| 182 |
+
"mean_abs": 0.0,
|
| 183 |
+
"rms": 0.0,
|
| 184 |
+
"max_abs": 0.0
|
| 185 |
+
}
|
| 186 |
+
}
|
| 187 |
+
},
|
| 188 |
+
"first_grad_summary": {
|
| 189 |
+
"joint": {
|
| 190 |
+
"step": 1,
|
| 191 |
+
"phase": "joint",
|
| 192 |
+
"gate": {
|
| 193 |
+
"num_tensors": 7,
|
| 194 |
+
"num_tensors_without_grad": 7,
|
| 195 |
+
"num_elements": 0,
|
| 196 |
+
"l2": 0.0,
|
| 197 |
+
"mean_abs": null,
|
| 198 |
+
"max_abs": 0.0
|
| 199 |
+
},
|
| 200 |
+
"u": {
|
| 201 |
+
"num_tensors": 7,
|
| 202 |
+
"num_tensors_without_grad": 0,
|
| 203 |
+
"num_elements": 218103808,
|
| 204 |
+
"l2": 0.45507050615797,
|
| 205 |
+
"mean_abs": 3.5630629501890953e-06,
|
| 206 |
+
"max_abs": 0.0394287109375
|
| 207 |
+
},
|
| 208 |
+
"rho": {
|
| 209 |
+
"num_tensors": 0,
|
| 210 |
+
"num_tensors_without_grad": 0,
|
| 211 |
+
"num_elements": 0,
|
| 212 |
+
"l2": 0.0,
|
| 213 |
+
"mean_abs": null,
|
| 214 |
+
"max_abs": 0.0
|
| 215 |
+
}
|
| 216 |
+
}
|
| 217 |
+
},
|
| 218 |
+
"u_delta_summary": {
|
| 219 |
+
"num_tensors": 7,
|
| 220 |
+
"num_elements": 218103808,
|
| 221 |
+
"mean": 2.3565316765300918e-06,
|
| 222 |
+
"std": 0.0020472016945632552,
|
| 223 |
+
"rms": 0.0020472030508633496,
|
| 224 |
+
"mean_abs": 0.0016030524140940262,
|
| 225 |
+
"min": -0.021086333319544792,
|
| 226 |
+
"max": 0.027390535920858383,
|
| 227 |
+
"per_tensor": {
|
| 228 |
+
"self_attn.q_proj.weight": {
|
| 229 |
+
"mean": -1.619874637981411e-06,
|
| 230 |
+
"std": 0.0020042480818996664,
|
| 231 |
+
"rms": 0.002004248736507606,
|
| 232 |
+
"mean_abs": 0.0015930614899843931,
|
| 233 |
+
"min": -0.011007399298250675,
|
| 234 |
+
"max": 0.010887783020734787
|
| 235 |
+
},
|
| 236 |
+
"self_attn.k_proj.weight": {
|
| 237 |
+
"mean": 1.8595372921481612e-06,
|
| 238 |
+
"std": 0.00202228312900819,
|
| 239 |
+
"rms": 0.0020222839839523273,
|
| 240 |
+
"mean_abs": 0.00161248748190701,
|
| 241 |
+
"min": -0.014783766120672226,
|
| 242 |
+
"max": 0.017582086846232414
|
| 243 |
+
},
|
| 244 |
+
"self_attn.v_proj.weight": {
|
| 245 |
+
"mean": -1.6936414795054588e-06,
|
| 246 |
+
"std": 0.0015113316971256054,
|
| 247 |
+
"rms": 0.0015113326460968225,
|
| 248 |
+
"mean_abs": 0.0011934589128941298,
|
| 249 |
+
"min": -0.008890187367796898,
|
| 250 |
+
"max": 0.008494275622069836
|
| 251 |
+
},
|
| 252 |
+
"self_attn.o_proj.weight": {
|
| 253 |
+
"mean": 1.7005837094075105e-07,
|
| 254 |
+
"std": 0.0016204791408536904,
|
| 255 |
+
"rms": 0.0016204791497769308,
|
| 256 |
+
"mean_abs": 0.0012767778243869543,
|
| 257 |
+
"min": -0.019182942807674408,
|
| 258 |
+
"max": 0.016541173681616783
|
| 259 |
+
},
|
| 260 |
+
"mlp.gate_proj.weight": {
|
| 261 |
+
"mean": 9.221047678563212e-06,
|
| 262 |
+
"std": 0.0020270456505263115,
|
| 263 |
+
"rms": 0.0020270666237294536,
|
| 264 |
+
"mean_abs": 0.0015925593408090727,
|
| 265 |
+
"min": -0.017183711752295494,
|
| 266 |
+
"max": 0.015098482370376587
|
| 267 |
+
},
|
| 268 |
+
"mlp.up_proj.weight": {
|
| 269 |
+
"mean": -8.34384081827011e-08,
|
| 270 |
+
"std": 0.0019492552446087697,
|
| 271 |
+
"rms": 0.0019492552463945716,
|
| 272 |
+
"mean_abs": 0.0015300594802413667,
|
| 273 |
+
"min": -0.014822522178292274,
|
| 274 |
+
"max": 0.014558619819581509
|
| 275 |
+
},
|
| 276 |
+
"mlp.down_proj.weight": {
|
| 277 |
+
"mean": 1.760618926839795e-08,
|
| 278 |
+
"std": 0.0023032297832979312,
|
| 279 |
+
"rms": 0.0023032297833652233,
|
| 280 |
+
"mean_abs": 0.0018111970275640488,
|
| 281 |
+
"min": -0.021086333319544792,
|
| 282 |
+
"max": 0.027390535920858383
|
| 283 |
+
}
|
| 284 |
+
}
|
| 285 |
+
},
|
| 286 |
+
"rho_objective": "none",
|
| 287 |
+
"rho_schedule": "joint",
|
| 288 |
+
"additive_u": true,
|
| 289 |
+
"rho_epochs": 0.0,
|
| 290 |
+
"rho_lr": null,
|
| 291 |
+
"rho_bounds": null,
|
| 292 |
+
"rho_after_phase": null,
|
| 293 |
+
"rho_final": {},
|
| 294 |
+
"u_fisher_orthogonality": {},
|
| 295 |
+
"runtime": {
|
| 296 |
+
"seconds": 237.63627798995003,
|
| 297 |
+
"dataset_tokens": 524288,
|
| 298 |
+
"tokens_per_second": 2206.262463099901,
|
| 299 |
+
"batch_size": 1,
|
| 300 |
+
"batches_per_epoch": 512,
|
| 301 |
+
"grad_accumulation": 1,
|
| 302 |
+
"peak_allocated_bytes": 33900553728,
|
| 303 |
+
"peak_reserved_bytes": 45151682560,
|
| 304 |
+
"gpu_total_bytes": 85094825984,
|
| 305 |
+
"actual_forward_shapes": {
|
| 306 |
+
"teacher:1x1024": 512,
|
| 307 |
+
"student:1x1024": 512
|
| 308 |
+
}
|
| 309 |
+
},
|
| 310 |
+
"ablation": {
|
| 311 |
+
"lambda": null,
|
| 312 |
+
"endpoint_clamping": false,
|
| 313 |
+
"initial_u_nonzero": 0,
|
| 314 |
+
"merged_parameters": [
|
| 315 |
+
"self_attn.q_proj.weight",
|
| 316 |
+
"self_attn.k_proj.weight",
|
| 317 |
+
"self_attn.v_proj.weight",
|
| 318 |
+
"self_attn.o_proj.weight",
|
| 319 |
+
"mlp.gate_proj.weight",
|
| 320 |
+
"mlp.up_proj.weight",
|
| 321 |
+
"mlp.down_proj.weight"
|
| 322 |
+
],
|
| 323 |
+
"parameterization": "W_initial + U_add",
|
| 324 |
+
"fisher_computed": false,
|
| 325 |
+
"fit_scope": "attention_and_mlp",
|
| 326 |
+
"attention_initialization": "CoMe_channel_merge",
|
| 327 |
+
"norm_initialization": "CoMe_pair_mean",
|
| 328 |
+
"CoMe": {
|
| 329 |
+
"source_lineage": [
|
| 330 |
+
[
|
| 331 |
+
27,
|
| 332 |
+
28
|
| 333 |
+
],
|
| 334 |
+
[
|
| 335 |
+
29
|
| 336 |
+
]
|
| 337 |
+
],
|
| 338 |
+
"retention_ratios": [
|
| 339 |
+
0.9848857801796105,
|
| 340 |
+
0.015114219820389517
|
| 341 |
+
],
|
| 342 |
+
"retained_attention_groups": [
|
| 343 |
+
8,
|
| 344 |
+
0
|
| 345 |
+
],
|
| 346 |
+
"retained_mlp_neurons": [
|
| 347 |
+
14120,
|
| 348 |
+
216
|
| 349 |
+
],
|
| 350 |
+
"pair_score": 0.1788287984800863,
|
| 351 |
+
"minimum_retention": 0.97,
|
| 352 |
+
"adjusted_minimum": 0.9848857801796105,
|
| 353 |
+
"power": 1.0,
|
| 354 |
+
"allow_repeat": true,
|
| 355 |
+
"sbi_metric": "angular_last",
|
| 356 |
+
"calibration_padding": "trim_right_padding_before_native_CoMe_scoring",
|
| 357 |
+
"teacher_mutated_during_initialization": false
|
| 358 |
+
},
|
| 359 |
+
"norms_trainable": false,
|
| 360 |
+
"initialized_parameters": [
|
| 361 |
+
"self_attn.q_proj.weight",
|
| 362 |
+
"self_attn.k_proj.weight",
|
| 363 |
+
"self_attn.v_proj.weight",
|
| 364 |
+
"self_attn.o_proj.weight",
|
| 365 |
+
"mlp.gate_proj.weight",
|
| 366 |
+
"mlp.up_proj.weight",
|
| 367 |
+
"mlp.down_proj.weight",
|
| 368 |
+
"input_layernorm.weight",
|
| 369 |
+
"post_attention_layernorm.weight"
|
| 370 |
+
],
|
| 371 |
+
"frozen_CoMe_parameters": [
|
| 372 |
+
"input_layernorm.weight",
|
| 373 |
+
"post_attention_layernorm.weight"
|
| 374 |
+
],
|
| 375 |
+
"frozen_norm_expected_sha256": {
|
| 376 |
+
"input_layernorm.weight": "b3360de3bfb99f7a45e1b7f700a8aa0aa33705611fe19e6ed2486f32b15049a3",
|
| 377 |
+
"post_attention_layernorm.weight": "ae299501702af17be174746972900f4995023f6d966d0f6d37a15c15098f2467"
|
| 378 |
+
},
|
| 379 |
+
"frozen_norm_after_sha256": {
|
| 380 |
+
"input_layernorm.weight": "b3360de3bfb99f7a45e1b7f700a8aa0aa33705611fe19e6ed2486f32b15049a3",
|
| 381 |
+
"post_attention_layernorm.weight": "ae299501702af17be174746972900f4995023f6d966d0f6d37a15c15098f2467"
|
| 382 |
+
},
|
| 383 |
+
"frozen_norms_unchanged": true,
|
| 384 |
+
"source_feature_transport": false,
|
| 385 |
+
"initializer": "come",
|
| 386 |
+
"removed_count_per_cycle": 1,
|
| 387 |
+
"teacher_boundary_current_layer": 23,
|
| 388 |
+
"teacher_boundary_original_layer": 29
|
| 389 |
+
}
|
| 390 |
+
}
|
runs/vast-paper_revision-come-attn-fit-20261126-62646539/20261126-llama31-come-attn-mlp-batch/catalog/results/batch1/audit/cycle_08_fit.json
ADDED
|
@@ -0,0 +1,391 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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|
+
"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": "all",
|
| 16 |
+
"train_subset": "all",
|
| 17 |
+
"num_gates": 7,
|
| 18 |
+
"num_attn_gates": 4,
|
| 19 |
+
"num_mlp_gates": 3,
|
| 20 |
+
"num_other_gates": 0,
|
| 21 |
+
"num_trainable_attn_gates": 4,
|
| 22 |
+
"num_trainable_mlp_gates": 3,
|
| 23 |
+
"num_trainable_other_gates": 0,
|
| 24 |
+
"lambda_init_summary": {
|
| 25 |
+
"num_tensors": 7,
|
| 26 |
+
"num_elements": 7,
|
| 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 |
+
"self_attn.q_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 |
+
"self_attn.k_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 |
+
"self_attn.v_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 |
+
"self_attn.o_proj.weight": {
|
| 55 |
+
"mean": 0.9998999834060669,
|
| 56 |
+
"std": 0.0,
|
| 57 |
+
"min": 0.9998999834060669,
|
| 58 |
+
"max": 0.9998999834060669,
|
| 59 |
+
"mean_abs_from_0_5": 0.4998999834060669
|
| 60 |
+
},
|
| 61 |
+
"mlp.gate_proj.weight": {
|
| 62 |
+
"mean": 0.9998999834060669,
|
| 63 |
+
"std": 0.0,
|
| 64 |
+
"min": 0.9998999834060669,
|
| 65 |
+
"max": 0.9998999834060669,
|
| 66 |
+
"mean_abs_from_0_5": 0.4998999834060669
|
| 67 |
+
},
|
| 68 |
+
"mlp.up_proj.weight": {
|
| 69 |
+
"mean": 0.9998999834060669,
|
| 70 |
+
"std": 0.0,
|
| 71 |
+
"min": 0.9998999834060669,
|
| 72 |
+
"max": 0.9998999834060669,
|
| 73 |
+
"mean_abs_from_0_5": 0.4998999834060669
|
| 74 |
+
},
|
| 75 |
+
"mlp.down_proj.weight": {
|
| 76 |
+
"mean": 0.9998999834060669,
|
| 77 |
+
"std": 0.0,
|
| 78 |
+
"min": 0.9998999834060669,
|
| 79 |
+
"max": 0.9998999834060669,
|
| 80 |
+
"mean_abs_from_0_5": 0.4998999834060669
|
| 81 |
+
}
|
| 82 |
+
}
|
| 83 |
+
},
|
| 84 |
+
"lambda_final_summary": {
|
| 85 |
+
"num_tensors": 7,
|
| 86 |
+
"num_elements": 7,
|
| 87 |
+
"mean": 1.0,
|
| 88 |
+
"std": 0.0,
|
| 89 |
+
"min": 1.0,
|
| 90 |
+
"max": 1.0,
|
| 91 |
+
"mean_abs_from_0_5": 0.5,
|
| 92 |
+
"per_tensor": {
|
| 93 |
+
"self_attn.q_proj.weight": {
|
| 94 |
+
"mean": 1.0,
|
| 95 |
+
"std": 0.0,
|
| 96 |
+
"min": 1.0,
|
| 97 |
+
"max": 1.0,
|
| 98 |
+
"mean_abs_from_0_5": 0.5
|
| 99 |
+
},
|
| 100 |
+
"self_attn.k_proj.weight": {
|
| 101 |
+
"mean": 1.0,
|
| 102 |
+
"std": 0.0,
|
| 103 |
+
"min": 1.0,
|
| 104 |
+
"max": 1.0,
|
| 105 |
+
"mean_abs_from_0_5": 0.5
|
| 106 |
+
},
|
| 107 |
+
"self_attn.v_proj.weight": {
|
| 108 |
+
"mean": 1.0,
|
| 109 |
+
"std": 0.0,
|
| 110 |
+
"min": 1.0,
|
| 111 |
+
"max": 1.0,
|
| 112 |
+
"mean_abs_from_0_5": 0.5
|
| 113 |
+
},
|
| 114 |
+
"self_attn.o_proj.weight": {
|
| 115 |
+
"mean": 1.0,
|
| 116 |
+
"std": 0.0,
|
| 117 |
+
"min": 1.0,
|
| 118 |
+
"max": 1.0,
|
| 119 |
+
"mean_abs_from_0_5": 0.5
|
| 120 |
+
},
|
| 121 |
+
"mlp.gate_proj.weight": {
|
| 122 |
+
"mean": 1.0,
|
| 123 |
+
"std": 0.0,
|
| 124 |
+
"min": 1.0,
|
| 125 |
+
"max": 1.0,
|
| 126 |
+
"mean_abs_from_0_5": 0.5
|
| 127 |
+
},
|
| 128 |
+
"mlp.up_proj.weight": {
|
| 129 |
+
"mean": 1.0,
|
| 130 |
+
"std": 0.0,
|
| 131 |
+
"min": 1.0,
|
| 132 |
+
"max": 1.0,
|
| 133 |
+
"mean_abs_from_0_5": 0.5
|
| 134 |
+
},
|
| 135 |
+
"mlp.down_proj.weight": {
|
| 136 |
+
"mean": 1.0,
|
| 137 |
+
"std": 0.0,
|
| 138 |
+
"min": 1.0,
|
| 139 |
+
"max": 1.0,
|
| 140 |
+
"mean_abs_from_0_5": 0.5
|
| 141 |
+
}
|
| 142 |
+
}
|
| 143 |
+
},
|
| 144 |
+
"lambda_delta_from_init": {
|
| 145 |
+
"num_tensors": 7,
|
| 146 |
+
"num_elements": 7,
|
| 147 |
+
"mean_abs": 0.0,
|
| 148 |
+
"rms": 0.0,
|
| 149 |
+
"max_abs": 0.0,
|
| 150 |
+
"per_tensor": {
|
| 151 |
+
"self_attn.q_proj.weight": {
|
| 152 |
+
"mean_abs": 0.0,
|
| 153 |
+
"rms": 0.0,
|
| 154 |
+
"max_abs": 0.0
|
| 155 |
+
},
|
| 156 |
+
"self_attn.k_proj.weight": {
|
| 157 |
+
"mean_abs": 0.0,
|
| 158 |
+
"rms": 0.0,
|
| 159 |
+
"max_abs": 0.0
|
| 160 |
+
},
|
| 161 |
+
"self_attn.v_proj.weight": {
|
| 162 |
+
"mean_abs": 0.0,
|
| 163 |
+
"rms": 0.0,
|
| 164 |
+
"max_abs": 0.0
|
| 165 |
+
},
|
| 166 |
+
"self_attn.o_proj.weight": {
|
| 167 |
+
"mean_abs": 0.0,
|
| 168 |
+
"rms": 0.0,
|
| 169 |
+
"max_abs": 0.0
|
| 170 |
+
},
|
| 171 |
+
"mlp.gate_proj.weight": {
|
| 172 |
+
"mean_abs": 0.0,
|
| 173 |
+
"rms": 0.0,
|
| 174 |
+
"max_abs": 0.0
|
| 175 |
+
},
|
| 176 |
+
"mlp.up_proj.weight": {
|
| 177 |
+
"mean_abs": 0.0,
|
| 178 |
+
"rms": 0.0,
|
| 179 |
+
"max_abs": 0.0
|
| 180 |
+
},
|
| 181 |
+
"mlp.down_proj.weight": {
|
| 182 |
+
"mean_abs": 0.0,
|
| 183 |
+
"rms": 0.0,
|
| 184 |
+
"max_abs": 0.0
|
| 185 |
+
}
|
| 186 |
+
}
|
| 187 |
+
},
|
| 188 |
+
"first_grad_summary": {
|
| 189 |
+
"joint": {
|
| 190 |
+
"step": 1,
|
| 191 |
+
"phase": "joint",
|
| 192 |
+
"gate": {
|
| 193 |
+
"num_tensors": 7,
|
| 194 |
+
"num_tensors_without_grad": 7,
|
| 195 |
+
"num_elements": 0,
|
| 196 |
+
"l2": 0.0,
|
| 197 |
+
"mean_abs": null,
|
| 198 |
+
"max_abs": 0.0
|
| 199 |
+
},
|
| 200 |
+
"u": {
|
| 201 |
+
"num_tensors": 7,
|
| 202 |
+
"num_tensors_without_grad": 0,
|
| 203 |
+
"num_elements": 218103808,
|
| 204 |
+
"l2": 0.05922262440301075,
|
| 205 |
+
"mean_abs": 9.121126953896936e-07,
|
| 206 |
+
"max_abs": 0.010568618774414062
|
| 207 |
+
},
|
| 208 |
+
"rho": {
|
| 209 |
+
"num_tensors": 0,
|
| 210 |
+
"num_tensors_without_grad": 0,
|
| 211 |
+
"num_elements": 0,
|
| 212 |
+
"l2": 0.0,
|
| 213 |
+
"mean_abs": null,
|
| 214 |
+
"max_abs": 0.0
|
| 215 |
+
}
|
| 216 |
+
}
|
| 217 |
+
},
|
| 218 |
+
"u_delta_summary": {
|
| 219 |
+
"num_tensors": 7,
|
| 220 |
+
"num_elements": 218103808,
|
| 221 |
+
"mean": -3.6447076194707944e-07,
|
| 222 |
+
"std": 0.002172640532768722,
|
| 223 |
+
"rms": 0.0021726405633395716,
|
| 224 |
+
"mean_abs": 0.0017214623378374828,
|
| 225 |
+
"min": -0.025440361350774765,
|
| 226 |
+
"max": 0.026495186612010002,
|
| 227 |
+
"per_tensor": {
|
| 228 |
+
"self_attn.q_proj.weight": {
|
| 229 |
+
"mean": -2.983775715392767e-08,
|
| 230 |
+
"std": 0.0021445916450379254,
|
| 231 |
+
"rms": 0.0021445916452454924,
|
| 232 |
+
"mean_abs": 0.0017075068317353725,
|
| 233 |
+
"min": -0.013030008412897587,
|
| 234 |
+
"max": 0.012501784600317478
|
| 235 |
+
},
|
| 236 |
+
"self_attn.k_proj.weight": {
|
| 237 |
+
"mean": 7.635330803168472e-07,
|
| 238 |
+
"std": 0.002258624125181079,
|
| 239 |
+
"rms": 0.002258624254238132,
|
| 240 |
+
"mean_abs": 0.0018035147804766893,
|
| 241 |
+
"min": -0.013318262062966824,
|
| 242 |
+
"max": 0.013636087998747826
|
| 243 |
+
},
|
| 244 |
+
"self_attn.v_proj.weight": {
|
| 245 |
+
"mean": 7.109407533789636e-07,
|
| 246 |
+
"std": 0.0019525223283351737,
|
| 247 |
+
"rms": 0.0019525224577669172,
|
| 248 |
+
"mean_abs": 0.00154805276542902,
|
| 249 |
+
"min": -0.013831916265189648,
|
| 250 |
+
"max": 0.01026648934930563
|
| 251 |
+
},
|
| 252 |
+
"self_attn.o_proj.weight": {
|
| 253 |
+
"mean": 6.226056825653359e-07,
|
| 254 |
+
"std": 0.0019070286062190503,
|
| 255 |
+
"rms": 0.0019070287078530332,
|
| 256 |
+
"mean_abs": 0.001500802463851869,
|
| 257 |
+
"min": -0.025440361350774765,
|
| 258 |
+
"max": 0.026495186612010002
|
| 259 |
+
},
|
| 260 |
+
"mlp.gate_proj.weight": {
|
| 261 |
+
"mean": -1.290066263339083e-06,
|
| 262 |
+
"std": 0.0023280020597244654,
|
| 263 |
+
"rms": 0.0023280024171706344,
|
| 264 |
+
"mean_abs": 0.0018530337672148431,
|
| 265 |
+
"min": -0.014154711738228798,
|
| 266 |
+
"max": 0.014468871988356113
|
| 267 |
+
},
|
| 268 |
+
"mlp.up_proj.weight": {
|
| 269 |
+
"mean": -4.019090218727277e-07,
|
| 270 |
+
"std": 0.0021900410761132687,
|
| 271 |
+
"rms": 0.002190041112991769,
|
| 272 |
+
"mean_abs": 0.0017388159675257547,
|
| 273 |
+
"min": -0.013361481949687004,
|
| 274 |
+
"max": 0.01384005043655634
|
| 275 |
+
},
|
| 276 |
+
"mlp.down_proj.weight": {
|
| 277 |
+
"mean": 6.354491688398411e-08,
|
| 278 |
+
"std": 0.0020801609738350974,
|
| 279 |
+
"rms": 0.002080160974805685,
|
| 280 |
+
"mean_abs": 0.001646095753780433,
|
| 281 |
+
"min": -0.01841876283288002,
|
| 282 |
+
"max": 0.01769753359258175
|
| 283 |
+
}
|
| 284 |
+
}
|
| 285 |
+
},
|
| 286 |
+
"rho_objective": "none",
|
| 287 |
+
"rho_schedule": "joint",
|
| 288 |
+
"additive_u": true,
|
| 289 |
+
"rho_epochs": 0.0,
|
| 290 |
+
"rho_lr": null,
|
| 291 |
+
"rho_bounds": null,
|
| 292 |
+
"rho_after_phase": null,
|
| 293 |
+
"rho_final": {},
|
| 294 |
+
"u_fisher_orthogonality": {},
|
| 295 |
+
"runtime": {
|
| 296 |
+
"seconds": 228.42235328396782,
|
| 297 |
+
"dataset_tokens": 524288,
|
| 298 |
+
"tokens_per_second": 2295.2569766594643,
|
| 299 |
+
"batch_size": 1,
|
| 300 |
+
"batches_per_epoch": 512,
|
| 301 |
+
"grad_accumulation": 1,
|
| 302 |
+
"peak_allocated_bytes": 33456443904,
|
| 303 |
+
"peak_reserved_bytes": 43830476800,
|
| 304 |
+
"gpu_total_bytes": 85094825984,
|
| 305 |
+
"actual_forward_shapes": {
|
| 306 |
+
"teacher:1x1024": 512,
|
| 307 |
+
"student:1x1024": 512
|
| 308 |
+
}
|
| 309 |
+
},
|
| 310 |
+
"ablation": {
|
| 311 |
+
"lambda": null,
|
| 312 |
+
"endpoint_clamping": false,
|
| 313 |
+
"initial_u_nonzero": 0,
|
| 314 |
+
"merged_parameters": [
|
| 315 |
+
"self_attn.q_proj.weight",
|
| 316 |
+
"self_attn.k_proj.weight",
|
| 317 |
+
"self_attn.v_proj.weight",
|
| 318 |
+
"self_attn.o_proj.weight",
|
| 319 |
+
"mlp.gate_proj.weight",
|
| 320 |
+
"mlp.up_proj.weight",
|
| 321 |
+
"mlp.down_proj.weight"
|
| 322 |
+
],
|
| 323 |
+
"parameterization": "W_initial + U_add",
|
| 324 |
+
"fisher_computed": false,
|
| 325 |
+
"fit_scope": "attention_and_mlp",
|
| 326 |
+
"attention_initialization": "CoMe_channel_merge",
|
| 327 |
+
"norm_initialization": "CoMe_pair_mean",
|
| 328 |
+
"CoMe": {
|
| 329 |
+
"source_lineage": [
|
| 330 |
+
[
|
| 331 |
+
18
|
| 332 |
+
],
|
| 333 |
+
[
|
| 334 |
+
19,
|
| 335 |
+
20,
|
| 336 |
+
21
|
| 337 |
+
]
|
| 338 |
+
],
|
| 339 |
+
"retention_ratios": [
|
| 340 |
+
0.9898982992491293,
|
| 341 |
+
0.010101700750870692
|
| 342 |
+
],
|
| 343 |
+
"retained_attention_groups": [
|
| 344 |
+
8,
|
| 345 |
+
0
|
| 346 |
+
],
|
| 347 |
+
"retained_mlp_neurons": [
|
| 348 |
+
14192,
|
| 349 |
+
144
|
| 350 |
+
],
|
| 351 |
+
"pair_score": 0.18292371109946742,
|
| 352 |
+
"minimum_retention": 0.97,
|
| 353 |
+
"adjusted_minimum": 0.9898982992491293,
|
| 354 |
+
"power": 1.0,
|
| 355 |
+
"allow_repeat": true,
|
| 356 |
+
"sbi_metric": "angular_last",
|
| 357 |
+
"calibration_padding": "trim_right_padding_before_native_CoMe_scoring",
|
| 358 |
+
"teacher_mutated_during_initialization": false
|
| 359 |
+
},
|
| 360 |
+
"norms_trainable": false,
|
| 361 |
+
"initialized_parameters": [
|
| 362 |
+
"self_attn.q_proj.weight",
|
| 363 |
+
"self_attn.k_proj.weight",
|
| 364 |
+
"self_attn.v_proj.weight",
|
| 365 |
+
"self_attn.o_proj.weight",
|
| 366 |
+
"mlp.gate_proj.weight",
|
| 367 |
+
"mlp.up_proj.weight",
|
| 368 |
+
"mlp.down_proj.weight",
|
| 369 |
+
"input_layernorm.weight",
|
| 370 |
+
"post_attention_layernorm.weight"
|
| 371 |
+
],
|
| 372 |
+
"frozen_CoMe_parameters": [
|
| 373 |
+
"input_layernorm.weight",
|
| 374 |
+
"post_attention_layernorm.weight"
|
| 375 |
+
],
|
| 376 |
+
"frozen_norm_expected_sha256": {
|
| 377 |
+
"input_layernorm.weight": "f67e15f72f2827ac29003733914b68d39bd31e44d02f64d08c5c2b9f5ba22b93",
|
| 378 |
+
"post_attention_layernorm.weight": "42849b21a9a41ce4dabbecbcf7f06d06241769f83cc118a0e7fbd9f826fdd542"
|
| 379 |
+
},
|
| 380 |
+
"frozen_norm_after_sha256": {
|
| 381 |
+
"input_layernorm.weight": "f67e15f72f2827ac29003733914b68d39bd31e44d02f64d08c5c2b9f5ba22b93",
|
| 382 |
+
"post_attention_layernorm.weight": "42849b21a9a41ce4dabbecbcf7f06d06241769f83cc118a0e7fbd9f826fdd542"
|
| 383 |
+
},
|
| 384 |
+
"frozen_norms_unchanged": true,
|
| 385 |
+
"source_feature_transport": false,
|
| 386 |
+
"initializer": "come",
|
| 387 |
+
"removed_count_per_cycle": 1,
|
| 388 |
+
"teacher_boundary_current_layer": 19,
|
| 389 |
+
"teacher_boundary_original_layer": 19
|
| 390 |
+
}
|
| 391 |
+
}
|
runs/vast-paper_revision-come-attn-fit-20261126-62646539/20261126-llama31-come-attn-mlp-batch/catalog/results/batch1/audit/data_fingerprints.json
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"calib_loader": {
|
| 3 |
+
"sequences": 64,
|
| 4 |
+
"sha256": "fa4a6219f7a7b17364eef6b5b7771533b57a407f1d26db1d483bbd955814ce38",
|
| 5 |
+
"attention_mask_sha256": "b1476de1907209012e63fa502715fd97db26e595352faa808d8c10433a1472a4",
|
| 6 |
+
"valid_tokens": 65536
|
| 7 |
+
},
|
| 8 |
+
"distill_loader": {
|
| 9 |
+
"sequences": 512,
|
| 10 |
+
"sha256": "2b2d044c8c040f67891817ecc110f0fa0de2f469db4c6731114ff7816bbf1cd0",
|
| 11 |
+
"attention_mask_sha256": "c8e7f8e30cd532b82e6af4b98d596bc7106f29f9fb2b398b44355e624898a30d",
|
| 12 |
+
"valid_tokens": 524288
|
| 13 |
+
}
|
| 14 |
+
}
|
runs/vast-paper_revision-come-attn-fit-20261126-62646539/20261126-llama31-come-attn-mlp-batch/catalog/results/batch1/audit/selection.json
ADDED
|
@@ -0,0 +1,563 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
[
|
| 2 |
+
{
|
| 3 |
+
"cycle": 1,
|
| 4 |
+
"pair_index": 25,
|
| 5 |
+
"initializer": "come",
|
| 6 |
+
"lambda_left": null,
|
| 7 |
+
"recipient_original_layer": 25,
|
| 8 |
+
"recipient_side": "left",
|
| 9 |
+
"removed_original_layer": 26,
|
| 10 |
+
"source_lineage": [
|
| 11 |
+
[
|
| 12 |
+
25
|
| 13 |
+
],
|
| 14 |
+
[
|
| 15 |
+
26
|
| 16 |
+
]
|
| 17 |
+
],
|
| 18 |
+
"retention_ratios": [
|
| 19 |
+
0.030000000000000027,
|
| 20 |
+
0.97
|
| 21 |
+
],
|
| 22 |
+
"retained_attention_groups": [
|
| 23 |
+
0,
|
| 24 |
+
8
|
| 25 |
+
],
|
| 26 |
+
"retained_mlp_neurons": [
|
| 27 |
+
430,
|
| 28 |
+
13906
|
| 29 |
+
],
|
| 30 |
+
"pair_score": 0.1301000171474048,
|
| 31 |
+
"minimum_retention": 0.97,
|
| 32 |
+
"adjusted_minimum": 0.97,
|
| 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 |
+
26
|
| 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 |
+
27,
|
| 69 |
+
28,
|
| 70 |
+
29,
|
| 71 |
+
30,
|
| 72 |
+
31
|
| 73 |
+
]
|
| 74 |
+
},
|
| 75 |
+
{
|
| 76 |
+
"cycle": 2,
|
| 77 |
+
"pair_index": 23,
|
| 78 |
+
"initializer": "come",
|
| 79 |
+
"lambda_left": null,
|
| 80 |
+
"recipient_original_layer": 23,
|
| 81 |
+
"recipient_side": "left",
|
| 82 |
+
"removed_original_layer": 24,
|
| 83 |
+
"source_lineage": [
|
| 84 |
+
[
|
| 85 |
+
23
|
| 86 |
+
],
|
| 87 |
+
[
|
| 88 |
+
24
|
| 89 |
+
]
|
| 90 |
+
],
|
| 91 |
+
"retention_ratios": [
|
| 92 |
+
0.97,
|
| 93 |
+
0.03000000000000003
|
| 94 |
+
],
|
| 95 |
+
"retained_attention_groups": [
|
| 96 |
+
8,
|
| 97 |
+
0
|
| 98 |
+
],
|
| 99 |
+
"retained_mlp_neurons": [
|
| 100 |
+
13906,
|
| 101 |
+
430
|
| 102 |
+
],
|
| 103 |
+
"pair_score": 0.13651073019910645,
|
| 104 |
+
"minimum_retention": 0.97,
|
| 105 |
+
"adjusted_minimum": 0.97,
|
| 106 |
+
"power": 1.0,
|
| 107 |
+
"allow_repeat": true,
|
| 108 |
+
"sbi_metric": "angular_last",
|
| 109 |
+
"calibration_padding": "trim_right_padding_before_native_CoMe_scoring",
|
| 110 |
+
"teacher_mutated_during_initialization": false,
|
| 111 |
+
"removed_original_layers": [
|
| 112 |
+
24
|
| 113 |
+
],
|
| 114 |
+
"active_original_layers": [
|
| 115 |
+
0,
|
| 116 |
+
1,
|
| 117 |
+
2,
|
| 118 |
+
3,
|
| 119 |
+
4,
|
| 120 |
+
5,
|
| 121 |
+
6,
|
| 122 |
+
7,
|
| 123 |
+
8,
|
| 124 |
+
9,
|
| 125 |
+
10,
|
| 126 |
+
11,
|
| 127 |
+
12,
|
| 128 |
+
13,
|
| 129 |
+
14,
|
| 130 |
+
15,
|
| 131 |
+
16,
|
| 132 |
+
17,
|
| 133 |
+
18,
|
| 134 |
+
19,
|
| 135 |
+
20,
|
| 136 |
+
21,
|
| 137 |
+
22,
|
| 138 |
+
23,
|
| 139 |
+
25,
|
| 140 |
+
27,
|
| 141 |
+
28,
|
| 142 |
+
29,
|
| 143 |
+
30,
|
| 144 |
+
31
|
| 145 |
+
]
|
| 146 |
+
},
|
| 147 |
+
{
|
| 148 |
+
"cycle": 3,
|
| 149 |
+
"pair_index": 22,
|
| 150 |
+
"initializer": "come",
|
| 151 |
+
"lambda_left": null,
|
| 152 |
+
"recipient_original_layer": 22,
|
| 153 |
+
"recipient_side": "left",
|
| 154 |
+
"removed_original_layer": 23,
|
| 155 |
+
"source_lineage": [
|
| 156 |
+
[
|
| 157 |
+
22
|
| 158 |
+
],
|
| 159 |
+
[
|
| 160 |
+
23,
|
| 161 |
+
24
|
| 162 |
+
]
|
| 163 |
+
],
|
| 164 |
+
"retention_ratios": [
|
| 165 |
+
0.9848857801796105,
|
| 166 |
+
0.015114219820389518
|
| 167 |
+
],
|
| 168 |
+
"retained_attention_groups": [
|
| 169 |
+
8,
|
| 170 |
+
0
|
| 171 |
+
],
|
| 172 |
+
"retained_mlp_neurons": [
|
| 173 |
+
14120,
|
| 174 |
+
216
|
| 175 |
+
],
|
| 176 |
+
"pair_score": 0.14353572814674168,
|
| 177 |
+
"minimum_retention": 0.97,
|
| 178 |
+
"adjusted_minimum": 0.9848857801796105,
|
| 179 |
+
"power": 1.0,
|
| 180 |
+
"allow_repeat": true,
|
| 181 |
+
"sbi_metric": "angular_last",
|
| 182 |
+
"calibration_padding": "trim_right_padding_before_native_CoMe_scoring",
|
| 183 |
+
"teacher_mutated_during_initialization": false,
|
| 184 |
+
"removed_original_layers": [
|
| 185 |
+
23
|
| 186 |
+
],
|
| 187 |
+
"active_original_layers": [
|
| 188 |
+
0,
|
| 189 |
+
1,
|
| 190 |
+
2,
|
| 191 |
+
3,
|
| 192 |
+
4,
|
| 193 |
+
5,
|
| 194 |
+
6,
|
| 195 |
+
7,
|
| 196 |
+
8,
|
| 197 |
+
9,
|
| 198 |
+
10,
|
| 199 |
+
11,
|
| 200 |
+
12,
|
| 201 |
+
13,
|
| 202 |
+
14,
|
| 203 |
+
15,
|
| 204 |
+
16,
|
| 205 |
+
17,
|
| 206 |
+
18,
|
| 207 |
+
19,
|
| 208 |
+
20,
|
| 209 |
+
21,
|
| 210 |
+
22,
|
| 211 |
+
25,
|
| 212 |
+
27,
|
| 213 |
+
28,
|
| 214 |
+
29,
|
| 215 |
+
30,
|
| 216 |
+
31
|
| 217 |
+
]
|
| 218 |
+
},
|
| 219 |
+
{
|
| 220 |
+
"cycle": 4,
|
| 221 |
+
"pair_index": 24,
|
| 222 |
+
"initializer": "come",
|
| 223 |
+
"lambda_left": null,
|
| 224 |
+
"recipient_original_layer": 27,
|
| 225 |
+
"recipient_side": "left",
|
| 226 |
+
"removed_original_layer": 28,
|
| 227 |
+
"source_lineage": [
|
| 228 |
+
[
|
| 229 |
+
27
|
| 230 |
+
],
|
| 231 |
+
[
|
| 232 |
+
28
|
| 233 |
+
]
|
| 234 |
+
],
|
| 235 |
+
"retention_ratios": [
|
| 236 |
+
0.030000000000000034,
|
| 237 |
+
0.97
|
| 238 |
+
],
|
| 239 |
+
"retained_attention_groups": [
|
| 240 |
+
0,
|
| 241 |
+
8
|
| 242 |
+
],
|
| 243 |
+
"retained_mlp_neurons": [
|
| 244 |
+
430,
|
| 245 |
+
13906
|
| 246 |
+
],
|
| 247 |
+
"pair_score": 0.15186802412454897,
|
| 248 |
+
"minimum_retention": 0.97,
|
| 249 |
+
"adjusted_minimum": 0.97,
|
| 250 |
+
"power": 1.0,
|
| 251 |
+
"allow_repeat": true,
|
| 252 |
+
"sbi_metric": "angular_last",
|
| 253 |
+
"calibration_padding": "trim_right_padding_before_native_CoMe_scoring",
|
| 254 |
+
"teacher_mutated_during_initialization": false,
|
| 255 |
+
"removed_original_layers": [
|
| 256 |
+
28
|
| 257 |
+
],
|
| 258 |
+
"active_original_layers": [
|
| 259 |
+
0,
|
| 260 |
+
1,
|
| 261 |
+
2,
|
| 262 |
+
3,
|
| 263 |
+
4,
|
| 264 |
+
5,
|
| 265 |
+
6,
|
| 266 |
+
7,
|
| 267 |
+
8,
|
| 268 |
+
9,
|
| 269 |
+
10,
|
| 270 |
+
11,
|
| 271 |
+
12,
|
| 272 |
+
13,
|
| 273 |
+
14,
|
| 274 |
+
15,
|
| 275 |
+
16,
|
| 276 |
+
17,
|
| 277 |
+
18,
|
| 278 |
+
19,
|
| 279 |
+
20,
|
| 280 |
+
21,
|
| 281 |
+
22,
|
| 282 |
+
25,
|
| 283 |
+
27,
|
| 284 |
+
29,
|
| 285 |
+
30,
|
| 286 |
+
31
|
| 287 |
+
]
|
| 288 |
+
},
|
| 289 |
+
{
|
| 290 |
+
"cycle": 5,
|
| 291 |
+
"pair_index": 20,
|
| 292 |
+
"initializer": "come",
|
| 293 |
+
"lambda_left": null,
|
| 294 |
+
"recipient_original_layer": 20,
|
| 295 |
+
"recipient_side": "left",
|
| 296 |
+
"removed_original_layer": 21,
|
| 297 |
+
"source_lineage": [
|
| 298 |
+
[
|
| 299 |
+
20
|
| 300 |
+
],
|
| 301 |
+
[
|
| 302 |
+
21
|
| 303 |
+
]
|
| 304 |
+
],
|
| 305 |
+
"retention_ratios": [
|
| 306 |
+
0.030000000000000034,
|
| 307 |
+
0.97
|
| 308 |
+
],
|
| 309 |
+
"retained_attention_groups": [
|
| 310 |
+
0,
|
| 311 |
+
8
|
| 312 |
+
],
|
| 313 |
+
"retained_mlp_neurons": [
|
| 314 |
+
430,
|
| 315 |
+
13906
|
| 316 |
+
],
|
| 317 |
+
"pair_score": 0.16033791234860054,
|
| 318 |
+
"minimum_retention": 0.97,
|
| 319 |
+
"adjusted_minimum": 0.97,
|
| 320 |
+
"power": 1.0,
|
| 321 |
+
"allow_repeat": true,
|
| 322 |
+
"sbi_metric": "angular_last",
|
| 323 |
+
"calibration_padding": "trim_right_padding_before_native_CoMe_scoring",
|
| 324 |
+
"teacher_mutated_during_initialization": false,
|
| 325 |
+
"removed_original_layers": [
|
| 326 |
+
21
|
| 327 |
+
],
|
| 328 |
+
"active_original_layers": [
|
| 329 |
+
0,
|
| 330 |
+
1,
|
| 331 |
+
2,
|
| 332 |
+
3,
|
| 333 |
+
4,
|
| 334 |
+
5,
|
| 335 |
+
6,
|
| 336 |
+
7,
|
| 337 |
+
8,
|
| 338 |
+
9,
|
| 339 |
+
10,
|
| 340 |
+
11,
|
| 341 |
+
12,
|
| 342 |
+
13,
|
| 343 |
+
14,
|
| 344 |
+
15,
|
| 345 |
+
16,
|
| 346 |
+
17,
|
| 347 |
+
18,
|
| 348 |
+
19,
|
| 349 |
+
20,
|
| 350 |
+
22,
|
| 351 |
+
25,
|
| 352 |
+
27,
|
| 353 |
+
29,
|
| 354 |
+
30,
|
| 355 |
+
31
|
| 356 |
+
]
|
| 357 |
+
},
|
| 358 |
+
{
|
| 359 |
+
"cycle": 6,
|
| 360 |
+
"pair_index": 19,
|
| 361 |
+
"initializer": "come",
|
| 362 |
+
"lambda_left": null,
|
| 363 |
+
"recipient_original_layer": 19,
|
| 364 |
+
"recipient_side": "left",
|
| 365 |
+
"removed_original_layer": 20,
|
| 366 |
+
"source_lineage": [
|
| 367 |
+
[
|
| 368 |
+
19
|
| 369 |
+
],
|
| 370 |
+
[
|
| 371 |
+
20,
|
| 372 |
+
21
|
| 373 |
+
]
|
| 374 |
+
],
|
| 375 |
+
"retention_ratios": [
|
| 376 |
+
0.9848857801796105,
|
| 377 |
+
0.015114219820389522
|
| 378 |
+
],
|
| 379 |
+
"retained_attention_groups": [
|
| 380 |
+
8,
|
| 381 |
+
0
|
| 382 |
+
],
|
| 383 |
+
"retained_mlp_neurons": [
|
| 384 |
+
14120,
|
| 385 |
+
216
|
| 386 |
+
],
|
| 387 |
+
"pair_score": 0.17005293169519403,
|
| 388 |
+
"minimum_retention": 0.97,
|
| 389 |
+
"adjusted_minimum": 0.9848857801796105,
|
| 390 |
+
"power": 1.0,
|
| 391 |
+
"allow_repeat": true,
|
| 392 |
+
"sbi_metric": "angular_last",
|
| 393 |
+
"calibration_padding": "trim_right_padding_before_native_CoMe_scoring",
|
| 394 |
+
"teacher_mutated_during_initialization": false,
|
| 395 |
+
"removed_original_layers": [
|
| 396 |
+
20
|
| 397 |
+
],
|
| 398 |
+
"active_original_layers": [
|
| 399 |
+
0,
|
| 400 |
+
1,
|
| 401 |
+
2,
|
| 402 |
+
3,
|
| 403 |
+
4,
|
| 404 |
+
5,
|
| 405 |
+
6,
|
| 406 |
+
7,
|
| 407 |
+
8,
|
| 408 |
+
9,
|
| 409 |
+
10,
|
| 410 |
+
11,
|
| 411 |
+
12,
|
| 412 |
+
13,
|
| 413 |
+
14,
|
| 414 |
+
15,
|
| 415 |
+
16,
|
| 416 |
+
17,
|
| 417 |
+
18,
|
| 418 |
+
19,
|
| 419 |
+
22,
|
| 420 |
+
25,
|
| 421 |
+
27,
|
| 422 |
+
29,
|
| 423 |
+
30,
|
| 424 |
+
31
|
| 425 |
+
]
|
| 426 |
+
},
|
| 427 |
+
{
|
| 428 |
+
"cycle": 7,
|
| 429 |
+
"pair_index": 22,
|
| 430 |
+
"initializer": "come",
|
| 431 |
+
"lambda_left": null,
|
| 432 |
+
"recipient_original_layer": 27,
|
| 433 |
+
"recipient_side": "left",
|
| 434 |
+
"removed_original_layer": 29,
|
| 435 |
+
"source_lineage": [
|
| 436 |
+
[
|
| 437 |
+
27,
|
| 438 |
+
28
|
| 439 |
+
],
|
| 440 |
+
[
|
| 441 |
+
29
|
| 442 |
+
]
|
| 443 |
+
],
|
| 444 |
+
"retention_ratios": [
|
| 445 |
+
0.9848857801796105,
|
| 446 |
+
0.015114219820389517
|
| 447 |
+
],
|
| 448 |
+
"retained_attention_groups": [
|
| 449 |
+
8,
|
| 450 |
+
0
|
| 451 |
+
],
|
| 452 |
+
"retained_mlp_neurons": [
|
| 453 |
+
14120,
|
| 454 |
+
216
|
| 455 |
+
],
|
| 456 |
+
"pair_score": 0.1788287984800863,
|
| 457 |
+
"minimum_retention": 0.97,
|
| 458 |
+
"adjusted_minimum": 0.9848857801796105,
|
| 459 |
+
"power": 1.0,
|
| 460 |
+
"allow_repeat": true,
|
| 461 |
+
"sbi_metric": "angular_last",
|
| 462 |
+
"calibration_padding": "trim_right_padding_before_native_CoMe_scoring",
|
| 463 |
+
"teacher_mutated_during_initialization": false,
|
| 464 |
+
"removed_original_layers": [
|
| 465 |
+
29
|
| 466 |
+
],
|
| 467 |
+
"active_original_layers": [
|
| 468 |
+
0,
|
| 469 |
+
1,
|
| 470 |
+
2,
|
| 471 |
+
3,
|
| 472 |
+
4,
|
| 473 |
+
5,
|
| 474 |
+
6,
|
| 475 |
+
7,
|
| 476 |
+
8,
|
| 477 |
+
9,
|
| 478 |
+
10,
|
| 479 |
+
11,
|
| 480 |
+
12,
|
| 481 |
+
13,
|
| 482 |
+
14,
|
| 483 |
+
15,
|
| 484 |
+
16,
|
| 485 |
+
17,
|
| 486 |
+
18,
|
| 487 |
+
19,
|
| 488 |
+
22,
|
| 489 |
+
25,
|
| 490 |
+
27,
|
| 491 |
+
30,
|
| 492 |
+
31
|
| 493 |
+
]
|
| 494 |
+
},
|
| 495 |
+
{
|
| 496 |
+
"cycle": 8,
|
| 497 |
+
"pair_index": 18,
|
| 498 |
+
"initializer": "come",
|
| 499 |
+
"lambda_left": null,
|
| 500 |
+
"recipient_original_layer": 18,
|
| 501 |
+
"recipient_side": "left",
|
| 502 |
+
"removed_original_layer": 19,
|
| 503 |
+
"source_lineage": [
|
| 504 |
+
[
|
| 505 |
+
18
|
| 506 |
+
],
|
| 507 |
+
[
|
| 508 |
+
19,
|
| 509 |
+
20,
|
| 510 |
+
21
|
| 511 |
+
]
|
| 512 |
+
],
|
| 513 |
+
"retention_ratios": [
|
| 514 |
+
0.9898982992491293,
|
| 515 |
+
0.010101700750870692
|
| 516 |
+
],
|
| 517 |
+
"retained_attention_groups": [
|
| 518 |
+
8,
|
| 519 |
+
0
|
| 520 |
+
],
|
| 521 |
+
"retained_mlp_neurons": [
|
| 522 |
+
14192,
|
| 523 |
+
144
|
| 524 |
+
],
|
| 525 |
+
"pair_score": 0.18292371109946742,
|
| 526 |
+
"minimum_retention": 0.97,
|
| 527 |
+
"adjusted_minimum": 0.9898982992491293,
|
| 528 |
+
"power": 1.0,
|
| 529 |
+
"allow_repeat": true,
|
| 530 |
+
"sbi_metric": "angular_last",
|
| 531 |
+
"calibration_padding": "trim_right_padding_before_native_CoMe_scoring",
|
| 532 |
+
"teacher_mutated_during_initialization": false,
|
| 533 |
+
"removed_original_layers": [
|
| 534 |
+
19
|
| 535 |
+
],
|
| 536 |
+
"active_original_layers": [
|
| 537 |
+
0,
|
| 538 |
+
1,
|
| 539 |
+
2,
|
| 540 |
+
3,
|
| 541 |
+
4,
|
| 542 |
+
5,
|
| 543 |
+
6,
|
| 544 |
+
7,
|
| 545 |
+
8,
|
| 546 |
+
9,
|
| 547 |
+
10,
|
| 548 |
+
11,
|
| 549 |
+
12,
|
| 550 |
+
13,
|
| 551 |
+
14,
|
| 552 |
+
15,
|
| 553 |
+
16,
|
| 554 |
+
17,
|
| 555 |
+
18,
|
| 556 |
+
22,
|
| 557 |
+
25,
|
| 558 |
+
27,
|
| 559 |
+
30,
|
| 560 |
+
31
|
| 561 |
+
]
|
| 562 |
+
}
|
| 563 |
+
]
|
runs/vast-paper_revision-come-attn-fit-20261126-62646539/20261126-llama31-come-attn-mlp-batch/catalog/results/batch1/audit/selection_inputs.json
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"input_ids_sha256": "0d5ee3894a716120c8f738c25d05838ca6871137f7b471d4616da55cab4a7361",
|
| 3 |
+
"sequences": 91,
|
| 4 |
+
"source": "/workspace/come-attn-fit-20261126/calibration/selection.pt",
|
| 5 |
+
"independent_of_fit_loader": true
|
| 6 |
+
}
|
runs/vast-paper_revision-come-attn-fit-20261126-62646539/20261126-llama31-come-attn-mlp-batch/catalog/results/batch1/compact_metadata.json
ADDED
|
@@ -0,0 +1,91 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"format": "abprune_compact_stage_v2",
|
| 3 |
+
"model": "meta-llama/Llama-3.1-8B",
|
| 4 |
+
"base_model_revision": "d04e592bb4f6aa9cfee91e2e20afa771667e1d4b",
|
| 5 |
+
"run_id": "llama_3.1_8b_fit_come_attn_mlp_8block",
|
| 6 |
+
"target_prune_count": 8,
|
| 7 |
+
"stage": 8,
|
| 8 |
+
"removed_count": 8,
|
| 9 |
+
"original_layer_count": 32,
|
| 10 |
+
"layer_order": [
|
| 11 |
+
25,
|
| 12 |
+
23,
|
| 13 |
+
22,
|
| 14 |
+
24,
|
| 15 |
+
20,
|
| 16 |
+
19,
|
| 17 |
+
22,
|
| 18 |
+
18
|
| 19 |
+
],
|
| 20 |
+
"latest_pair_index": 18,
|
| 21 |
+
"latest_recipient_side": "left",
|
| 22 |
+
"latest_recipient_original_layer": 18,
|
| 23 |
+
"latest_removed_original_layer": 19,
|
| 24 |
+
"removed_original_layers": [
|
| 25 |
+
19,
|
| 26 |
+
20,
|
| 27 |
+
21,
|
| 28 |
+
23,
|
| 29 |
+
24,
|
| 30 |
+
26,
|
| 31 |
+
28,
|
| 32 |
+
29
|
| 33 |
+
],
|
| 34 |
+
"active_original_layers": [
|
| 35 |
+
0,
|
| 36 |
+
1,
|
| 37 |
+
2,
|
| 38 |
+
3,
|
| 39 |
+
4,
|
| 40 |
+
5,
|
| 41 |
+
6,
|
| 42 |
+
7,
|
| 43 |
+
8,
|
| 44 |
+
9,
|
| 45 |
+
10,
|
| 46 |
+
11,
|
| 47 |
+
12,
|
| 48 |
+
13,
|
| 49 |
+
14,
|
| 50 |
+
15,
|
| 51 |
+
16,
|
| 52 |
+
17,
|
| 53 |
+
18,
|
| 54 |
+
22,
|
| 55 |
+
25,
|
| 56 |
+
27,
|
| 57 |
+
30,
|
| 58 |
+
31
|
| 59 |
+
],
|
| 60 |
+
"retained_layer_states": [
|
| 61 |
+
{
|
| 62 |
+
"original_layer": 18,
|
| 63 |
+
"state_file": "layer_original_0018.pt",
|
| 64 |
+
"sha256": "e17b10bb8457c978e167bf4653ae797dc444b2ffe88a0bf6e444f8e3febc61db",
|
| 65 |
+
"source_cycle": 8,
|
| 66 |
+
"recipient_side": "left"
|
| 67 |
+
},
|
| 68 |
+
{
|
| 69 |
+
"original_layer": 22,
|
| 70 |
+
"state_file": "layer_original_0022.pt",
|
| 71 |
+
"sha256": "6b9bfbe9147d8761bd00bfbd95c69eb1d0b631770080addf612412e3f69c0079",
|
| 72 |
+
"source_cycle": 3,
|
| 73 |
+
"recipient_side": "left"
|
| 74 |
+
},
|
| 75 |
+
{
|
| 76 |
+
"original_layer": 25,
|
| 77 |
+
"state_file": "layer_original_0025.pt",
|
| 78 |
+
"sha256": "38555a45a8e268802f68f96609e73b637887827206da65940bfa4a97923d6fb5",
|
| 79 |
+
"source_cycle": 1,
|
| 80 |
+
"recipient_side": "left"
|
| 81 |
+
},
|
| 82 |
+
{
|
| 83 |
+
"original_layer": 27,
|
| 84 |
+
"state_file": "layer_original_0027.pt",
|
| 85 |
+
"sha256": "7c33f2b325519997b8171f59b526f9b844bb53866bb8ef006dc6a25f5710678a",
|
| 86 |
+
"source_cycle": 7,
|
| 87 |
+
"recipient_side": "left"
|
| 88 |
+
}
|
| 89 |
+
],
|
| 90 |
+
"source_cycle": "cycle_8"
|
| 91 |
+
}
|