Spaces:
Running
Running
File size: 8,524 Bytes
f791e67 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 | #!/usr/bin/env python3
"""Audit the exact Table 4 contract and all publicly released RLM artifacts."""
from __future__ import annotations
import csv
import hashlib
import json
import math
from collections import Counter, defaultdict
from pathlib import Path
import numpy as np
import requests
from scipy import stats
from check_claim4_audit import check
ROOT = Path(__file__).resolve().parents[2]
AUTHOR = "akhauriyash"
MODEL_PREFIX = f"{AUTHOR}/RLM-GemmaS-Code-"
EXPECTED_MODELS = {
"Amoeba": ("akhauriyash/RLM-GemmaS-Code-Amoeba-v0",
"2998b2c8cef6cbb899536e7451561ccfc9e5433f"),
"DARTS": ("akhauriyash/RLM-GemmaS-Code-DARTS-v0",
"7aedf5c3586c98bbadce5f09a97ce91a644d25cc"),
"PNAS": ("akhauriyash/RLM-GemmaS-Code-PNAS-v0",
"57c23247f6bbdc181fc29e5fd4c43a2a18e1fb23"),
}
PAPER_RLM = {
"NASNet": 0.382,
"Amoeba": 0.488,
"PNAS": 0.427,
"ENAS": 0.481,
"DARTS": 0.528,
}
PAPER_AVERAGES = {
"MLP": 0.052,
"Arch2Vec": 0.212,
"CATE": 0.238,
"GNN": 0.429,
"FLAN": 0.459,
"RLM": 0.461,
}
USER_AGENT = "OpenResearch-Reproduction/1.0 paper-2509.26476"
def manual_kendall_tau_b(x: np.ndarray, y: np.ndarray) -> float:
"""O(n^2) tau-b implementation independent of scipy.stats.kendalltau."""
n = len(x)
concordant = 0
discordant = 0
for left in range(n - 1):
products = np.sign(x[left] - x[left + 1:]) * np.sign(y[left] - y[left + 1:])
concordant += int(np.count_nonzero(products > 0))
discordant += int(np.count_nonzero(products < 0))
total_pairs = n * (n - 1) // 2
tied_x = sum(count * (count - 1) // 2 for count in Counter(x.tolist()).values())
tied_y = sum(count * (count - 1) // 2 for count in Counter(y.tolist()).values())
denominator = math.sqrt((total_pairs - tied_x) * (total_pairs - tied_y))
if denominator == 0:
return math.nan
return (concordant - discordant) / denominator
def retained_metric_reanalysis() -> list[dict]:
grouped: dict[str, list[tuple[float, float]]] = defaultdict(list)
path = ROOT / "outputs/claim1_accuracy/full_n512.csv"
with path.open(newline="") as handle:
for row in csv.DictReader(handle):
if row["space"] in {"ENAS", "NASNet"}:
grouped[row["space"]].append(
(float(row["target"]), float(row["prediction"]))
)
rng = np.random.default_rng(20260926476)
output = []
for space in ("ENAS", "NASNet"):
pairs = grouped[space]
if len(pairs) != 512:
raise AssertionError(f"{space}: expected 512 retained rows")
targets, predictions = map(np.asarray, zip(*pairs))
scipy_tau = float(stats.kendalltau(targets, predictions, variant="b").statistic)
manual_tau = float(manual_kendall_tau_b(targets, predictions))
shuffled = []
for _ in range(200):
shuffled.append(float(stats.kendalltau(
rng.permutation(targets), predictions, variant="b"
).statistic))
output.append({
"space": space,
"checkpoint_role": "released unified base; not a substitute for the missing target-specific checkpoint",
"n": len(pairs),
"scipy_kendall_tau_b": scipy_tau,
"manual_kendall_tau_b": manual_tau,
"source_csv_sha256": hashlib.sha256(path.read_bytes()).hexdigest(),
"shuffled_target_control": {
"seed": 20260926476,
"permutations": len(shuffled),
"mean_tau_b": float(np.mean(shuffled)),
"max_tau_b": float(np.max(shuffled)),
"threshold": PAPER_AVERAGES["GNN"],
"passes_gnn_threshold": bool(np.mean(shuffled) >= PAPER_AVERAGES["GNN"]),
},
})
return output
def public_artifact_audit() -> dict:
response = requests.get(
"https://huggingface.co/api/models",
params={"author": AUTHOR, "limit": 100, "full": "true"},
headers={"User-Agent": USER_AGENT},
timeout=120,
)
response.raise_for_status()
author_models = response.json()
visible = {model["id"]: model for model in author_models}
details = {}
training_row_manifests = []
for space, (model_id, expected_revision) in EXPECTED_MODELS.items():
if model_id not in visible:
raise AssertionError(f"expected public checkpoint missing: {model_id}")
detail_response = requests.get(
f"https://huggingface.co/api/models/{model_id}",
params={"blobs": "true"},
headers={"User-Agent": USER_AGENT},
timeout=120,
)
detail_response.raise_for_status()
detail = detail_response.json()
if detail["sha"] != expected_revision:
raise AssertionError(f"{model_id}: revision changed")
siblings = detail["siblings"]
filenames = sorted(item["rfilename"] for item in siblings)
manifests = [
name for name in filenames
if any(fragment in name.lower()
for fragment in ("train", "split", "manifest", "seed", "trainer"))
]
training_row_manifests.extend(f"{model_id}:{name}" for name in manifests)
weight = next(item for item in siblings if item["rfilename"] == "model.safetensors")
details[space] = {
"model_id": model_id,
"revision": detail["sha"],
"model_safetensors_size": weight.get("size"),
"model_safetensors_blob_id": weight.get("blobId"),
"files": filenames,
"training_row_manifest_files": manifests,
}
public_target_spaces = {
space for space in ("NASNet", "Amoeba", "PNAS", "ENAS", "DARTS")
if f"{MODEL_PREFIX}{space}-v0" in visible
}
return {
"api_url": "https://huggingface.co/api/models?author=akhauriyash&limit=100&full=true",
"user_agent": USER_AGENT,
"author_listing_sha256": hashlib.sha256(response.content).hexdigest(),
"released_target_specific": sorted(public_target_spaces),
"missing_target_specific": sorted(
{"NASNet", "Amoeba", "PNAS", "ENAS", "DARTS"} - public_target_spaces
),
"training_row_manifests_found": training_row_manifests,
"details": details,
}
def verify() -> dict:
result = {
"status": "PASS",
"claim_verdict": "BLOCKED",
"exact_claim_tested": (
"Table 4 Kendall tau-b over NASNet, Amoeba, PNAS, ENAS, and DARTS, "
"with RLM average 0.461 compared with Arch2Vec 0.212, CATE 0.238, "
"GNN 0.429, and FLAN 0.459"
),
"paper_table": {
"per_space_rlm": PAPER_RLM,
"reported_average": PAPER_AVERAGES,
"rlm_average_unrounded": float(np.mean(list(PAPER_RLM.values()))),
},
"protocol": {
"metric": "Kendall tau-b",
"source_training_examples": 1024,
"target_examples": {
"NASNet": 16,
"Amoeba": 16,
"PNAS": 16,
"ENAS": 16,
"DARTS": 100,
},
"evaluation_domain": "remaining target search-space architectures",
"flan_trials": 3,
},
"public_artifacts": public_artifact_audit(),
"retained_base_checkpoint_metric_reanalysis": retained_metric_reanalysis(),
"blockers": [
"No public ENAS target-specific RLM checkpoint was discoverable.",
"No public NASNet target-specific RLM checkpoint was discoverable.",
"The three public target-specific checkpoint repositories expose no training-row, evaluation-row, seed, or split manifest.",
"The public RLM repository does not contain a Table 4 training/evaluation script or committed configuration.",
],
"limitations": [
"The retained ENAS and NASNet rows only correct the prior metric mismatch; their unified base checkpoint is not the missing few-shot model.",
"Checkpoint availability is a public-artifact audit, not proof that a private checkpoint does not exist.",
"No Table 4 points are forecast from this audit alone.",
],
}
result["independent_checker"] = check(result)
return result
def main() -> None:
result = verify()
print("CLAIM4_AUDIT_RESULT " + json.dumps(result, sort_keys=True))
if __name__ == "__main__":
main()
|