Cukinator commited on
Commit
d7ef1d4
·
verified ·
1 Parent(s): 4234450

Rebuild model card from reproducible CPU audit; include evidence and limitations

Browse files
README.md CHANGED
@@ -13,7 +13,20 @@ tags:
13
 
14
  1,346 checkpoint files across 34 run folders, totaling **215.178 GB** (200.400 GiB). The inventory includes **21 `_final.pt` files** and **1325 step files**. Counts and sizes are derived from the pinned Hub inventory, not estimates from nominal architecture sizes.
15
 
16
- For evaluated FP32 exports, see [Cukinator/cpu1-ablations-final](https://huggingface.co/Cukinator/cpu1-ablations-final). Source code: [Cukinator/1.58bits](https://github.com/Cukinator/1.58bits).
 
 
 
 
 
 
 
 
 
 
 
 
 
17
 
18
  ## What is stored
19
 
@@ -65,7 +78,7 @@ Sizes use decimal MB and GB. Step counts include phase-2 step files. Highest ste
65
 
66
  ## Load one checkpoint
67
 
68
- Clone the [source repository](https://github.com/Cukinator/1.58bits) and run this from its root. These are custom PyTorch checkpoints; `AutoModelForCausalLM.from_pretrained()` does not load them. The examples use a trusted checkpoint source and strict state loading.
69
 
70
  ```python
71
  import os
 
13
 
14
  1,346 checkpoint files across 34 run folders, totaling **215.178 GB** (200.400 GiB). The inventory includes **21 `_final.pt` files** and **1325 step files**. Counts and sizes are derived from the pinned Hub inventory, not estimates from nominal architecture sizes.
15
 
16
+ For evaluated FP32 exports, see [Cukinator/cpu1-ablations-final](https://huggingface.co/Cukinator/cpu1-ablations-final). Source code: [Cukinator/1.58bits](https://github.com/igna-s/New-1.58).
17
+
18
+ ## What the audit found
19
+
20
+ The shared audit covers 34 FP32 exports on 32 short WikiText test passages, with CPU execution, one thread, and a fixed protocol. It does not evaluate every intermediate archive checkpoint.
21
+
22
+ | Check | Outcome |
23
+ |---|---|
24
+ | Strict checkpoint loading | 34/34 loaded |
25
+ | Numerical evaluation | 4 models produced an evaluation error |
26
+ | Prefix causality | 14/30 finite-output models failed |
27
+ | Recurrent chunk equivalence | 26/26 recurrent models failed |
28
+
29
+ Full results, generation examples, and the recurrent implementation diagnostic follow below. Loss units depend on tokenization. Loss from a model that fails causality cannot establish autoregressive prediction quality; printable output alone does not establish useful language generation.
30
 
31
  ## What is stored
32
 
 
78
 
79
  ## Load one checkpoint
80
 
81
+ Clone the [source repository](https://github.com/igna-s/New-1.58) and run this from its root. These are custom PyTorch checkpoints; `AutoModelForCausalLM.from_pretrained()` does not load them. The examples use a trusted checkpoint source and strict state loading.
82
 
83
  ```python
84
  import os
evaluation/publication.json CHANGED
@@ -1,6 +1,6 @@
1
  {
2
  "Cukinator/cpu1-ablations-final": {
3
- "oid": "9a3b939f9f033bf272d5dbb993fb7a370d6a9828",
4
- "url": "https://huggingface.co/Cukinator/cpu1-ablations-final/commit/9a3b939f9f033bf272d5dbb993fb7a370d6a9828"
5
  }
6
  }
 
1
  {
2
  "Cukinator/cpu1-ablations-final": {
3
+ "oid": "d38678e7c5d18577f36edade64495237c72a44b5",
4
+ "url": "https://huggingface.co/Cukinator/cpu1-ablations-final/commit/d38678e7c5d18577f36edade64495237c72a44b5"
5
  }
6
  }
evaluation/source/audit_model_cards.py CHANGED
@@ -13,7 +13,7 @@ def link(repo, filename, revision='main'):
13
  return f'https://huggingface.co/{repo}/blob/{revision}/{filename}'
14
 
15
 
16
- def manifest_rows(inventory):
17
  folders = defaultdict(list)
18
  for f in inventory[ARCHIVE]['siblings']:
19
  if f['rfilename'].endswith('.pt'):
@@ -24,7 +24,23 @@ def manifest_rows(inventory):
24
  finals = [f for f in files if f['rfilename'].endswith('_final.pt')]
25
  final = f'{sum(f["size"] for f in finals)/1e6:.2f}' if finals else '—'
26
  rows.append(f'| `{run}` | {len(steps)} | {max(steps) if steps else "—"} | {final} | {sum(f["size"] for f in files)/1e9:.3f} |')
27
- return rows
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
28
 
29
 
30
  def protocol(inventory, corpus, records):
@@ -37,8 +53,8 @@ def protocol(inventory, corpus, records):
37
  f'- Dataset revision: `{DATA_REV}`; exact file: `{DATA_FILE}`; parquet SHA-256: `{corpus["parquet_sha256"]}`.',
38
  f'- Shared sample JSON SHA-256: `{sha(OUT/"corpus.json")}`.',
39
  '- Byte targets are the next patch; incomplete final patches are discarded. The first patch is context only. LocalByteDecoder receives ground-truth target bytes and shifts them internally for causal teacher forcing within a patch. Cross-entropy is summed over all targets and divided by their total count.',
40
- '- Byte loss is nats/byte; `BPB = NLL / ln(2)` and byte PPL is `exp(NLL)`. A uniform byte predictor gives BPB=8 and PPL=256. BPE loss uses Qwen2.5-3B token IDs with IDs outside the configured vocabulary mapped to 0, matching the dataset adapter. Its PPL is over that lossy mapped token stream and cannot be compared with byte PPL or interpreted as the likelihood of the original text.',
41
- '- All BPE models shared one resolved Qwen tokenizer in this run. Its resolved revision is recorded in `run_01.json` and `environment.json`; reuse that tokenizer revision/cache for strict reproduction. The current evaluator resolves the tokenizer Hub name at runtime rather than hard-coding that revision.',
42
  '- Causality: change the last 16 of 32 input steps and compare all prefix logits, tolerance `1e-5`. Recurrent chunk equivalence: compare a 128-step forward against four 32-step chunks across all output heads, tolerance `1e-4`. Failed checks remain visible.',
43
  '- DeleteGate is disabled consistently: phase 1, elimination rate 0. The audit does not measure token elimination, phase-2 quality, or the benefit of DeleteGate.',
44
  '- Forward timing: 10 warm-up steps, then 100 measured single-input forwards. `steps/s = 100 / total measured seconds`; p50 and p95 are per-step latency. One byte-model step consumes a patch of 4 bytes; one BPE step consumes one token. Local decoder inputs are zeros in this microbenchmark. Transformer timing has one input step and no persistent attention context. This is not a context-scaling test or a generation benchmark.',
@@ -140,7 +156,7 @@ def architecture(records):
140
  def quickstart(repo, revision, compact=False):
141
  filename = 'run_04/checkpoint_run_04_final.pt' if compact else 'run_04/model.pt'
142
  loader = ['from train_ablation import build_ablation_model, load_ablation_checkpoint', f'state, config = load_ablation_checkpoint(path)'] if compact else ['from train_ablation import build_ablation_model', 'payload = torch.load(path, map_location="cpu", weights_only=False)', 'config, state = payload["config"], payload["state_dict"]']
143
- return ['## Load one checkpoint', '', 'Clone the [source repository](https://github.com/Cukinator/1.58bits) and run this from its root. These are custom PyTorch checkpoints; `AutoModelForCausalLM.from_pretrained()` does not load them. The examples use a trusted checkpoint source and strict state loading.', '', '```python', 'import os', 'os.environ["HF_HOME"] = "D:/cpu1/hf"', 'os.environ["HF_HUB_DISABLE_XET"] = "1"', 'import torch', 'from huggingface_hub import hf_hub_download', 'torch.set_num_threads(1)', f'path = hf_hub_download("{repo}", "{filename}",', f' revision="{revision}", local_dir="D:/cpu1/active", cache_dir="D:/cpu1/hf/hub")', *loader, 'config["use_gradient_checkpointing"] = False', 'model = build_ablation_model(config)', 'model.load_state_dict(state, strict=True)', 'model.eval()', 'x = torch.tensor(list(b"The history of AI. ")).reshape(1, -1, 4)', 'with torch.inference_mode():', ' logits, states, extra = model(x, training_phase=1, target_elimination=0.0)', 'print([tuple(head.shape) for head in logits])', '```', '', 'This forward uses zero target bytes in the local decoder; it is a shape smoke test. For scored likelihood, pass `byte_targets` as shown in the audit. For byte generation with retained Transformer context and one recurrent prefill, use `generation()` in `eval/audit_readmes.py`. Generation remains experimental; inspect the saved examples before choosing a checkpoint.', '']
144
 
145
 
146
  def build_cards(inventory, corpus):
@@ -156,8 +172,9 @@ def build_cards(inventory, corpus):
156
  final_files = [f for f in inventory[FINAL]['siblings'] if f['rfilename'].endswith('/model.pt')]
157
  final_card = header + ['# CPU-1 ablations: FP32 checkpoint exports', '',
158
  f'{len(final_files)} custom PyTorch model exports, {sum(f["size"] for f in final_files)/1e9:.3f} GB of checkpoint files (decimal units). This is a research ablation collection, not an instruction-tuned assistant. It includes Transformer and MLGRU variants with byte patches or truncated BPE vocabularies, and floating-point or simulated ternary projections.', '',
159
- f'Source: [Cukinator/1.58bits](https://github.com/Cukinator/1.58bits). Training archive: [{ARCHIVE}](https://huggingface.co/{ARCHIVE}). Training dataset companion: [Cukinator/cpu1-ablation-dataset](https://huggingface.co/datasets/Cukinator/cpu1-ablation-dataset).', '',
160
- '## Payload format', '', '`<run>/model.pt` contains `format="fp32"`, `state_dict`, `config`, `step`, `run_name`, `metrics`, and source metadata. The exported parameters occupy four bytes each. “1.58-bit” describes the ternary value alphabet; these files are not stored as 1.58-bit tensors and this PyTorch path does not use packed-weight inference.', '',
 
161
  'Historical `metrics` may be empty or come from different training validation protocols. They are preserved as metadata, not relabeled as freshly measured test results.', '',
162
  *quickstart(FINAL, inventory[FINAL]['sha']), *shared,
163
  '## License', '', 'The Hub metadata declares Apache-2.0 for the model repository. The source checkout does not include a standalone LICENSE file. Upstream datasets and tokenizer assets retain their own licenses.', '']
@@ -165,8 +182,9 @@ def build_cards(inventory, corpus):
165
  finals = [f for f in archived if f['rfilename'].endswith('_final.pt')]
166
  archive_card = header + ['# CPU-1 ablations: training checkpoint archive', '',
167
  f'{len(archived):,} checkpoint files across {len({f["rfilename"].split("/")[0] for f in archived})} run folders, totaling **{sum(f["size"] for f in archived)/1e9:.3f} GB** ({sum(f["size"] for f in archived)/2**30:.3f} GiB). The inventory includes **{len(finals)} `_final.pt` files** and **{len(archived)-len(finals)} step files**. Counts and sizes are derived from the pinned Hub inventory, not estimates from nominal architecture sizes.', '',
168
- f'For evaluated FP32 exports, see [{FINAL}](https://huggingface.co/{FINAL}). Source code: [Cukinator/1.58bits](https://github.com/Cukinator/1.58bits).', '',
169
- '## What is stored', '',
 
170
  '- `checkpoint_<run>_final.pt`: inference-oriented final checkpoints. Ternary runs use `compact_2bit`; floating-point baselines use floating-point checkpoint storage. File names alone do not identify the serialization format: inspect `format` inside the payload.',
171
  '- `checkpoint_<run>_step<N>.pt`: intermediate training state; includes saved configuration and model state, and may include optimizer state. `_phase2_step<N>.pt` names distinguish phase-2 files where present.',
172
  '- The 2-bit codec packs a ternary alphabet into two bits per stored value plus scales and floating-point tensors. It is not a guarantee of 1.58 effective bits per total model parameter. Resume step files and packed finals have different purposes.',
@@ -181,11 +199,11 @@ def build_cards(inventory, corpus):
181
  f'The results below were measured on the {len(records)} published exports in [{FINAL}](https://huggingface.co/{FINAL}), **not by evaluating every intermediate archive checkpoint**. Matching run names do not prove tensor identity between a packed final, an intermediate step, and an export. No packed/FP32 numerical-parity claim is made by this card.', '',
182
  *shared, '## License', '', 'Hub metadata declares Apache-2.0. Dataset and tokenizer licenses are separate. The source checkout does not include a standalone LICENSE file.', '']
183
  directory = ROOT / 'hf_readmes'
184
- for stem, card in [('cpu1-ablations-final', final_card), ('cpu1-ablation-checkpoints', archive_card)]:
185
- content = '\n'.join(card)
186
- repo = FINAL if stem == 'cpu1-ablations-final' else ARCHIVE
187
- content = content.replace('](evaluation/)', f'](https://huggingface.co/{repo}/tree/main/evaluation)')
188
- content = content.replace('](evaluation/', f'](https://huggingface.co/{repo}/blob/main/evaluation/')
189
  for suffix in ('.md', '_README.md'):
190
  (directory/(stem+suffix)).write_text(content, encoding='utf-8')
191
  save_environment(records)
@@ -222,7 +240,7 @@ def dataset_card():
222
  'Only a training split is declared by the Hub card. If you need held-out evaluation, create and document a deterministic independent split or use a separate test corpus. Never silently substitute the training split for validation. Do not zip the byte and BPE streams by shard index or row index.', '',
223
  '## Model evaluation', '',
224
  'The new model-card audit uses a separate 32-passage WikiText test sample and loads no teacher model. Its corpus, procedure and raw results are in the [FP32 model repository](https://huggingface.co/Cukinator/cpu1-ablations-final). That diagnostic does not evaluate this dataset’s teacher coverage, entropy, hidden-state alignment, or full training distribution.', '',
225
- '## Related artifacts', '', '- [Source and adapters](https://github.com/Cukinator/1.58bits)', '- [FP32 exports and common evaluation](https://huggingface.co/Cukinator/cpu1-ablations-final)', '- [Packed finals and intermediate checkpoints](https://huggingface.co/Cukinator/cpu1-ablation-checkpoints)', '',
226
  '## License', '', 'The dataset Hub metadata declares MIT. FineWeb source data and Qwen tokenizer/teacher assets retain their own upstream licenses. The repository label does not replace those upstream terms.', '']
227
  (ROOT/'hf_readmes'/'cpu1-ablation-dataset_README.md').write_text('\n'.join(lines), encoding='utf-8')
228
 
@@ -231,8 +249,8 @@ def save_environment(records):
231
  from audit_readmes import save
232
  from importlib.metadata import version
233
  packages = {name: version(name) for name in ('torch','transformers','tokenizers','huggingface_hub','datasets','numpy','pyarrow','psutil')}
234
- tokenizer_revision = next((r['tokenizer_revision'] for r in records if r.get('tokenizer_revision')), None)
235
- save(OUT/'environment.json', {'python': sys.version, 'packages': packages, 'hardware': 'Intel Core i7-8750H, 6 cores/12 logical processors', 'platform': records[0]['platform'], 'threads': 1, 'source_commit': '18826ec2827a09950797463633c1f5187af29a5b', 'source_changes': 'audit evaluator and correctness/quality fixes in this checkout', 'audit_script_sha256': sha(ROOT/'eval'/'audit_readmes.py'), 'qwen_tokenizer_resolved_revision': tokenizer_revision})
236
 
237
 
238
  def root_card(records, inventory):
@@ -291,9 +309,16 @@ def upload_cards(inventory):
291
  raise ValueError('Token does not belong to the authorized repository owner')
292
  commits = {}
293
  for repo, stem in [(FINAL,'cpu1-ablations-final'), (ARCHIVE,'cpu1-ablation-checkpoints')]:
294
- parent = api.model_info(repo).sha
295
- if parent != inventory[repo]['sha']:
296
- raise ValueError(f'{repo} changed since the audit; refresh before publishing')
 
 
 
 
 
 
 
297
  files = [('README.md', ROOT/'hf_readmes'/f'{stem}.md')]
298
  files += [(f'evaluation/{p.name}', p) for p in sorted(OUT.glob('*.json'))]
299
  files += [('evaluation/CORPUS_LICENSE.txt', OUT/'CORPUS_LICENSE.txt')]
 
13
  return f'https://huggingface.co/{repo}/blob/{revision}/{filename}'
14
 
15
 
16
+ def manifest_rows(inventory):
17
  folders = defaultdict(list)
18
  for f in inventory[ARCHIVE]['siblings']:
19
  if f['rfilename'].endswith('.pt'):
 
24
  finals = [f for f in files if f['rfilename'].endswith('_final.pt')]
25
  final = f'{sum(f["size"] for f in finals)/1e6:.2f}' if finals else '—'
26
  rows.append(f'| `{run}` | {len(steps)} | {max(steps) if steps else "—"} | {final} | {sum(f["size"] for f in files)/1e9:.3f} |')
27
+ return rows
28
+
29
+
30
+ def audit_summary(records):
31
+ checks = [r.get('correctness', {}) for r in records]
32
+ causal = [c.get('causality', {}) for c in checks]
33
+ recurrent = [c['state_prop'] for c in checks if c.get('state_prop', {}).get('status') != 'N/A']
34
+ return [
35
+ '## What the audit found', '',
36
+ f'The shared audit covers {len(records)} FP32 exports on 32 short WikiText test passages, with CPU execution, one thread, and a fixed protocol. It does not evaluate every intermediate archive checkpoint.', '',
37
+ '| Check | Outcome |', '|---|---|',
38
+ f'| Strict checkpoint loading | {sum(r.get("strict_load", False) for r in records)}/{len(records)} loaded |',
39
+ f'| Numerical evaluation | {sum(bool(r.get("error")) for r in records)} models produced an evaluation error |',
40
+ f'| Prefix causality | {sum(c.get("status") == "FAIL" for c in causal)}/{sum(c.get("status") in ("PASS", "FAIL") for c in causal)} finite-output models failed |',
41
+ f'| Recurrent chunk equivalence | {sum(c.get("status") == "FAIL" for c in recurrent)}/{len(recurrent)} recurrent models failed |', '',
42
+ 'Full results, generation examples, and the recurrent implementation diagnostic follow below. Loss units depend on tokenization. Loss from a model that fails causality cannot establish autoregressive prediction quality; printable output alone does not establish useful language generation.', '',
43
+ ]
44
 
45
 
46
  def protocol(inventory, corpus, records):
 
53
  f'- Dataset revision: `{DATA_REV}`; exact file: `{DATA_FILE}`; parquet SHA-256: `{corpus["parquet_sha256"]}`.',
54
  f'- Shared sample JSON SHA-256: `{sha(OUT/"corpus.json")}`.',
55
  '- Byte targets are the next patch; incomplete final patches are discarded. The first patch is context only. LocalByteDecoder receives ground-truth target bytes and shifts them internally for causal teacher forcing within a patch. Cross-entropy is summed over all targets and divided by their total count.',
56
+ '- Byte loss is nats/byte; `BPB = NLL / ln(2)` and byte PPL is `exp(NLL)`. A uniform byte predictor gives BPB=8 and PPL=256. BPE loss uses Qwen2.5-3B token IDs with IDs outside the configured vocabulary mapped to 0, matching the dataset adapter. Its PPL is over that lossy mapped token stream and cannot be compared with byte PPL or interpreted as the likelihood of the original text.',
57
+ '- All BPE models shared one resolved Qwen tokenizer in this run. Its resolved revision is recorded in `run_01.json` and `environment.json`; reuse that tokenizer revision/cache for strict reproduction. The current evaluator resolves the tokenizer Hub name at runtime rather than hard-coding that revision.',
58
  '- Causality: change the last 16 of 32 input steps and compare all prefix logits, tolerance `1e-5`. Recurrent chunk equivalence: compare a 128-step forward against four 32-step chunks across all output heads, tolerance `1e-4`. Failed checks remain visible.',
59
  '- DeleteGate is disabled consistently: phase 1, elimination rate 0. The audit does not measure token elimination, phase-2 quality, or the benefit of DeleteGate.',
60
  '- Forward timing: 10 warm-up steps, then 100 measured single-input forwards. `steps/s = 100 / total measured seconds`; p50 and p95 are per-step latency. One byte-model step consumes a patch of 4 bytes; one BPE step consumes one token. Local decoder inputs are zeros in this microbenchmark. Transformer timing has one input step and no persistent attention context. This is not a context-scaling test or a generation benchmark.',
 
156
  def quickstart(repo, revision, compact=False):
157
  filename = 'run_04/checkpoint_run_04_final.pt' if compact else 'run_04/model.pt'
158
  loader = ['from train_ablation import build_ablation_model, load_ablation_checkpoint', f'state, config = load_ablation_checkpoint(path)'] if compact else ['from train_ablation import build_ablation_model', 'payload = torch.load(path, map_location="cpu", weights_only=False)', 'config, state = payload["config"], payload["state_dict"]']
159
+ return ['## Load one checkpoint', '', 'Clone the [source repository](https://github.com/igna-s/New-1.58) and run this from its root. These are custom PyTorch checkpoints; `AutoModelForCausalLM.from_pretrained()` does not load them. The examples use a trusted checkpoint source and strict state loading.', '', '```python', 'import os', 'os.environ["HF_HOME"] = "D:/cpu1/hf"', 'os.environ["HF_HUB_DISABLE_XET"] = "1"', 'import torch', 'from huggingface_hub import hf_hub_download', 'torch.set_num_threads(1)', f'path = hf_hub_download("{repo}", "{filename}",', f' revision="{revision}", local_dir="D:/cpu1/active", cache_dir="D:/cpu1/hf/hub")', *loader, 'config["use_gradient_checkpointing"] = False', 'model = build_ablation_model(config)', 'model.load_state_dict(state, strict=True)', 'model.eval()', 'x = torch.tensor(list(b"The history of AI. ")).reshape(1, -1, 4)', 'with torch.inference_mode():', ' logits, states, extra = model(x, training_phase=1, target_elimination=0.0)', 'print([tuple(head.shape) for head in logits])', '```', '', 'This forward uses zero target bytes in the local decoder; it is a shape smoke test. For scored likelihood, pass `byte_targets` as shown in the audit. For byte generation with retained Transformer context and one recurrent prefill, use `generation()` in `eval/audit_readmes.py`. Generation remains experimental; inspect the saved examples before choosing a checkpoint.', '']
160
 
161
 
162
  def build_cards(inventory, corpus):
 
172
  final_files = [f for f in inventory[FINAL]['siblings'] if f['rfilename'].endswith('/model.pt')]
173
  final_card = header + ['# CPU-1 ablations: FP32 checkpoint exports', '',
174
  f'{len(final_files)} custom PyTorch model exports, {sum(f["size"] for f in final_files)/1e9:.3f} GB of checkpoint files (decimal units). This is a research ablation collection, not an instruction-tuned assistant. It includes Transformer and MLGRU variants with byte patches or truncated BPE vocabularies, and floating-point or simulated ternary projections.', '',
175
+ f'Source: [Cukinator/1.58bits](https://github.com/igna-s/New-1.58). Training archive: [{ARCHIVE}](https://huggingface.co/{ARCHIVE}). Training dataset companion: [Cukinator/cpu1-ablation-dataset](https://huggingface.co/datasets/Cukinator/cpu1-ablation-dataset).', '',
176
+ *audit_summary(records),
177
+ '## Payload format', '', '`<run>/model.pt` contains `format="fp32"`, `state_dict`, `config`, `step`, `run_name`, `metrics`, and source metadata. The exported parameters occupy four bytes each. “1.58-bit” describes the ternary value alphabet; these files are not stored as 1.58-bit tensors and this PyTorch path does not use packed-weight inference.', '',
178
  'Historical `metrics` may be empty or come from different training validation protocols. They are preserved as metadata, not relabeled as freshly measured test results.', '',
179
  *quickstart(FINAL, inventory[FINAL]['sha']), *shared,
180
  '## License', '', 'The Hub metadata declares Apache-2.0 for the model repository. The source checkout does not include a standalone LICENSE file. Upstream datasets and tokenizer assets retain their own licenses.', '']
 
182
  finals = [f for f in archived if f['rfilename'].endswith('_final.pt')]
183
  archive_card = header + ['# CPU-1 ablations: training checkpoint archive', '',
184
  f'{len(archived):,} checkpoint files across {len({f["rfilename"].split("/")[0] for f in archived})} run folders, totaling **{sum(f["size"] for f in archived)/1e9:.3f} GB** ({sum(f["size"] for f in archived)/2**30:.3f} GiB). The inventory includes **{len(finals)} `_final.pt` files** and **{len(archived)-len(finals)} step files**. Counts and sizes are derived from the pinned Hub inventory, not estimates from nominal architecture sizes.', '',
185
+ f'For evaluated FP32 exports, see [{FINAL}](https://huggingface.co/{FINAL}). Source code: [Cukinator/1.58bits](https://github.com/igna-s/New-1.58).', '',
186
+ *audit_summary(records),
187
+ '## What is stored', '',
188
  '- `checkpoint_<run>_final.pt`: inference-oriented final checkpoints. Ternary runs use `compact_2bit`; floating-point baselines use floating-point checkpoint storage. File names alone do not identify the serialization format: inspect `format` inside the payload.',
189
  '- `checkpoint_<run>_step<N>.pt`: intermediate training state; includes saved configuration and model state, and may include optimizer state. `_phase2_step<N>.pt` names distinguish phase-2 files where present.',
190
  '- The 2-bit codec packs a ternary alphabet into two bits per stored value plus scales and floating-point tensors. It is not a guarantee of 1.58 effective bits per total model parameter. Resume step files and packed finals have different purposes.',
 
199
  f'The results below were measured on the {len(records)} published exports in [{FINAL}](https://huggingface.co/{FINAL}), **not by evaluating every intermediate archive checkpoint**. Matching run names do not prove tensor identity between a packed final, an intermediate step, and an export. No packed/FP32 numerical-parity claim is made by this card.', '',
200
  *shared, '## License', '', 'Hub metadata declares Apache-2.0. Dataset and tokenizer licenses are separate. The source checkout does not include a standalone LICENSE file.', '']
201
  directory = ROOT / 'hf_readmes'
202
+ for stem, card in [('cpu1-ablations-final', final_card), ('cpu1-ablation-checkpoints', archive_card)]:
203
+ content = '\n'.join(card)
204
+ repo = FINAL if stem == 'cpu1-ablations-final' else ARCHIVE
205
+ content = content.replace('](evaluation/)', f'](https://huggingface.co/{repo}/tree/main/evaluation)')
206
+ content = content.replace('](evaluation/', f'](https://huggingface.co/{repo}/blob/main/evaluation/')
207
  for suffix in ('.md', '_README.md'):
208
  (directory/(stem+suffix)).write_text(content, encoding='utf-8')
209
  save_environment(records)
 
240
  'Only a training split is declared by the Hub card. If you need held-out evaluation, create and document a deterministic independent split or use a separate test corpus. Never silently substitute the training split for validation. Do not zip the byte and BPE streams by shard index or row index.', '',
241
  '## Model evaluation', '',
242
  'The new model-card audit uses a separate 32-passage WikiText test sample and loads no teacher model. Its corpus, procedure and raw results are in the [FP32 model repository](https://huggingface.co/Cukinator/cpu1-ablations-final). That diagnostic does not evaluate this dataset’s teacher coverage, entropy, hidden-state alignment, or full training distribution.', '',
243
+ '## Related artifacts', '', '- [Source and adapters](https://github.com/igna-s/New-1.58)', '- [FP32 exports and common evaluation](https://huggingface.co/Cukinator/cpu1-ablations-final)', '- [Packed finals and intermediate checkpoints](https://huggingface.co/Cukinator/cpu1-ablation-checkpoints)', '',
244
  '## License', '', 'The dataset Hub metadata declares MIT. FineWeb source data and Qwen tokenizer/teacher assets retain their own upstream licenses. The repository label does not replace those upstream terms.', '']
245
  (ROOT/'hf_readmes'/'cpu1-ablation-dataset_README.md').write_text('\n'.join(lines), encoding='utf-8')
246
 
 
249
  from audit_readmes import save
250
  from importlib.metadata import version
251
  packages = {name: version(name) for name in ('torch','transformers','tokenizers','huggingface_hub','datasets','numpy','pyarrow','psutil')}
252
+ tokenizer_revision = next((r['tokenizer_revision'] for r in records if r.get('tokenizer_revision')), None)
253
+ save(OUT/'environment.json', {'python': sys.version, 'packages': packages, 'hardware': 'Intel Core i7-8750H, 6 cores/12 logical processors', 'platform': records[0]['platform'], 'threads': 1, 'source_commit': '18826ec2827a09950797463633c1f5187af29a5b', 'source_changes': 'audit evaluator and correctness/quality fixes in this checkout', 'audit_script_sha256': sha(ROOT/'eval'/'audit_readmes.py'), 'qwen_tokenizer_resolved_revision': tokenizer_revision})
254
 
255
 
256
  def root_card(records, inventory):
 
309
  raise ValueError('Token does not belong to the authorized repository owner')
310
  commits = {}
311
  for repo, stem in [(FINAL,'cpu1-ablations-final'), (ARCHIVE,'cpu1-ablation-checkpoints')]:
312
+ current = api.model_info(repo, files_metadata=True)
313
+ parent = current.sha
314
+ # A README-only publication changes the tip without changing audited weights.
315
+ # Pin the new commit to that tip, but require the exact audited model inventory.
316
+ expected = {f['rfilename']: (f['size'], f['lfs']['sha256'])
317
+ for f in inventory[repo]['siblings'] if f['rfilename'].endswith('.pt')}
318
+ actual = {f.rfilename: (f.size, f.lfs.sha256 if f.lfs else None)
319
+ for f in current.siblings if f.rfilename.endswith('.pt')}
320
+ if actual != expected:
321
+ raise ValueError(f'{repo} model files changed since the audit; rerun evaluation before publishing')
322
  files = [('README.md', ROOT/'hf_readmes'/f'{stem}.md')]
323
  files += [(f'evaluation/{p.name}', p) for p in sorted(OUT.glob('*.json'))]
324
  files += [('evaluation/CORPUS_LICENSE.txt', OUT/'CORPUS_LICENSE.txt')]