ProCreations's picture
Publish validated PGCM ICML reproduction
262ac76 verified
Raw
History Blame Contribute Delete
3.23 kB
#!/usr/bin/env python3
import hashlib,json
from pathlib import Path
r=Path(__file__).resolve().parent
claims=json.loads((r/'official_claims.json').read_text()); matrix=json.loads((r/'EVIDENCE_MATRIX.json').read_text()); data=json.loads((r/'outputs/results.json').read_text())
assert claims==['Prototype-Grounded Concept Models (PGCMs) ground concept predictions in a fixed number of learned visual prototypes (m=30 for ColorMNIST+, m=120 for CelebA, m=100 for CLEVR-Hans) via a prototype selector, enabling inspection through concept alignment tables (Architecture & Components section).', "On ColorMNIST+, PGCM matches CBM performance with concept accuracy 99.2±0.0 vs 99.2±0.1 and task accuracy 99.7±0.0 vs 99.6±0.1, while on CelebA CBM's task accuracy (84.0±0.3) modestly exceeds PGCM's (83.0±0.0) (Table 4).", 'PGCM training uses an ELBO-style objective (Equation 2) combining a KL regularization term over prototype selection, task loss, concept loss, and image reconstruction loss (Equation 2).', 'On ColorMNIST+ with noisy labels, targeted prototype-level interventions improve accuracy from 92.9% to 96.9% by removing prototypes and from 92.8% to 97.8% by editing prototypes (Table 3).', 'A prototype-swapping procedure applied halfway through training replaces learned prototype embeddings with their nearest training instances to improve interpretability (Interpretability Optimizations section).', 'PGCM shows improved responsiveness to concept interventions compared to CBM, CRM, and CMR baselines, particularly when exploiting inter-concept dependencies in the PGCM* variant on ColorMNIST+ (Figure 4).']
assert data==json.loads((r/'replay_a/results.json').read_text())==json.loads((r/'replay_b/results.json').read_text())==json.loads((r/'packaged_replay/results.json').read_text())
assert [row['literal_claim'] for row in data['claims']]==claims
for index,claim in enumerate(claims,1):
payload=json.loads((r/f'outputs/claim{index}.json').read_text());assert payload['claim']==index and payload['literal_claim']==claim
assert [x['assessment'] for x in matrix['claims']]==['verified', 'verified', 'verified', 'falsified', 'verified', 'falsified']
assert all(x['direct_evidence'] and x['registered_system_executed'] and x['actual_model_or_dataset_used'] and x['paper_or_released_scale'] and x['destructive_control_executed'] for x in matrix['claims'])
assert matrix['release_quality_gate']['expected_total_points']==12 and not matrix['release_quality_gate']['proxy_support_counted']
pins={'source/source.tar':'259068a32788cff9e86c952203c3ccf7c44718bc5fc6a60b867ad6a38f554056','source/paper.pdf':'a0d4e08b5b4363c14fc32fe473af4e786b9f8b1edd0aeaab6027f796bec4972b','source/PGCM-8e8366c.tar.gz':'d3be291444c0cf7265c5cf6cb2c2abd2c09cdf2afd01b89ba88b42a67cc40f31','source/workstation-adaptations.patch':'b4de198ce7a7392e053e04560b65489038026cc4eb5a5929bceb8535cef3c347','source/torch-home/hub/checkpoints/resnet18-f37072fd.pth':'f37072fd47e89c5e827621c5baffa7500819f7896bbacec160b1a16c560e07ec'}
for name,digest in pins.items(): assert hashlib.sha256((r/name).read_bytes()).hexdigest()==digest,name
print('evidence validated: six direct resolved claims, exact source/code/checkpoint pins and three byte-identical replays')