diff --git a/README.md b/README.md index 41a97dce6a3507860504023a5cb1e7f3b1dc0f36..19c8059b3b40014b0c24facaa47b40beca7aecab 100644 --- a/README.md +++ b/README.md @@ -270,6 +270,12 @@ Scores and speed are unavailable when model loading or numerical evaluation fail | `run_02a_byte_only_heads_v3` | ValueError: nonfinite loss | | `run_08_v3` | ValueError: nonfinite loss | +## Source and dataset provenance + +Historical extraction and training code is retained in the [GitHub history](https://github.com/igna-s/New-1.58/tree/main/docs/provenance). Kaggle and Lightning recipes, AMD training, and 34 configuration records are included in `evaluation/source/`. The configuration records preserve published budgets, including the 150 tokens/parameter v3 setting; they do not prove the exact training source commit or achieved exposure. + +The [dataset review](https://huggingface.co/datasets/Cukinator/cpu1-ablation-dataset) documents short/empty teacher arrays, an observed dense-signal reader alignment defect, and UTF-8 conversion limitations. These observations do not isolate their effect on a training run. No weights, stored datasets or numerical model implementation were repaired in this documentation update. + ## Architecture recorded in each checkpoint Run names identify experiments; dimensions and features below come from the saved configuration. FP16 is the training quantization label, while this audit executes the loaded tensors in FP32. β€œ50M” and β€œ10M” in older cards were design families, not exact model sizes. diff --git a/evaluation/dataset_adapter_checks.json b/evaluation/dataset_adapter_checks.json new file mode 100644 index 0000000000000000000000000000000000000000..73185bf0a923c3e4a179e7ff42618d3cf74b1793 --- /dev/null +++ b/evaluation/dataset_adapter_checks.json @@ -0,0 +1,432 @@ +{ + "adapter": { + "file": "byte_marginalized/shard_0000.parquet", + "row": 0, + "prob_rows": 5000, + "mask_length": 5000, + "active_positions": 1333, + "stored_nonzero_distributions": 1333, + "adapter_nonzero_distributions": 369, + "max_alignment_difference": 1.0, + "short_mask_example": { + "row": 1, + "mask_length": 42, + "mask_element_type": "bool", + "adapter_integer_indices": [ + 0, + 1 + ] + } + }, + "tokenizer_utf8": [ + { + "text": "AπŸ™‚B", + "ids": [ + 32, + 145080, + 33 + ], + "offsets": [ + [ + 0, + 1 + ], + [ + 1, + 2 + ], + [ + 2, + 3 + ] + ], + "individual_token_decodes": [ + "A", + "πŸ™‚", + "B" + ], + "individual_first_bytes": [ + [ + 65 + ], + [ + 240 + ], + [ + 66 + ] + ], + "raw_utf8": [ + 65, + 240, + 159, + 153, + 130, + 66 + ] + }, + { + "text": "AζΌ’B", + "ids": [ + 32, + 110007, + 33 + ], + "offsets": [ + [ + 0, + 1 + ], + [ + 1, + 2 + ], + [ + 2, + 3 + ] + ], + "individual_token_decodes": [ + "A", + "ζΌ’", + "B" + ], + "individual_first_bytes": [ + [ + 65 + ], + [ + 230 + ], + [ + 66 + ] + ], + "raw_utf8": [ + 65, + 230, + 188, + 162, + 66 + ] + }, + { + "text": "AπŸ˜€B", + "ids": [ + 32, + 141334, + 33 + ], + "offsets": [ + [ + 0, + 1 + ], + [ + 1, + 2 + ], + [ + 2, + 3 + ] + ], + "individual_token_decodes": [ + "A", + "πŸ˜€", + "B" + ], + "individual_first_bytes": [ + [ + 65 + ], + [ + 240 + ], + [ + 66 + ] + ], + "raw_utf8": [ + 65, + 240, + 159, + 152, + 128, + 66 + ] + }, + { + "text": "A🫨B", + "ids": [ + 32, + 9284, + 104, + 101, + 33 + ], + "offsets": [ + [ + 0, + 1 + ], + [ + 1, + 2 + ], + [ + 1, + 2 + ], + [ + 1, + 2 + ], + [ + 2, + 3 + ] + ], + "individual_token_decodes": [ + "A", + "οΏ½", + "οΏ½", + "οΏ½", + "B" + ], + "individual_first_bytes": [ + [ + 65 + ], + [ + 239 + ], + [ + 239 + ], + [ + 239 + ], + [ + 66 + ] + ], + "raw_utf8": [ + 65, + 240, + 159, + 171, + 168, + 66 + ] + }, + { + "text": "A🩷B", + "ids": [ + 32, + 9284, + 102, + 115, + 33 + ], + "offsets": [ + [ + 0, + 1 + ], + [ + 1, + 2 + ], + [ + 1, + 2 + ], + [ + 1, + 2 + ], + [ + 2, + 3 + ] + ], + "individual_token_decodes": [ + "A", + "οΏ½", + "οΏ½", + "οΏ½", + "B" + ], + "individual_first_bytes": [ + [ + 65 + ], + [ + 239 + ], + [ + 239 + ], + [ + 239 + ], + [ + 66 + ] + ], + "raw_utf8": [ + 65, + 240, + 159, + 169, + 183, + 66 + ] + }, + { + "text": "Aπ €€B", + "ids": [ + 32, + 172, + 63219, + 222, + 33 + ], + "offsets": [ + [ + 0, + 1 + ], + [ + 1, + 2 + ], + [ + 1, + 2 + ], + [ + 1, + 2 + ], + [ + 2, + 3 + ] + ], + "individual_token_decodes": [ + "A", + "οΏ½", + "οΏ½οΏ½", + "οΏ½", + "B" + ], + "individual_first_bytes": [ + [ + 65 + ], + [ + 239 + ], + [ + 239 + ], + [ + 239 + ], + [ + 66 + ] + ], + "raw_utf8": [ + 65, + 240, + 160, + 128, + 128, + 66 + ] + }, + { + "text": "AπŸ§‘β€πŸš€B", + "ids": [ + 32, + 148738, + 378, + 235, + 145836, + 33 + ], + "offsets": [ + [ + 0, + 1 + ], + [ + 1, + 2 + ], + [ + 2, + 3 + ], + [ + 2, + 3 + ], + [ + 3, + 4 + ], + [ + 4, + 5 + ] + ], + "individual_token_decodes": [ + "A", + "πŸ§‘", + "οΏ½", + "οΏ½", + "πŸš€", + "B" + ], + "individual_first_bytes": [ + [ + 65 + ], + [ + 240 + ], + [ + 239 + ], + [ + 239 + ], + [ + 240 + ], + [ + 66 + ] + ], + "raw_utf8": [ + 65, + 240, + 159, + 167, + 145, + 226, + 128, + 141, + 240, + 159, + 154, + 128, + 66 + ] + } + ] +} \ No newline at end of file diff --git a/evaluation/dataset_current_inventory.json b/evaluation/dataset_current_inventory.json new file mode 100644 index 0000000000000000000000000000000000000000..d26e87182f220fb9e62242f16b4d3ff8b8a6a82e --- /dev/null +++ b/evaluation/dataset_current_inventory.json @@ -0,0 +1,3690 @@ +{ + "repo": "Cukinator/cpu1-ablation-dataset", + "sha": "bd75d7b811ab730cc912aaa671f9eaaf49ba4bdf", + "siblings": [ + { + "rfilename": ".gitattributes", + "size": 2504 + }, + { + "rfilename": "README.md", + "size": 10040 + }, + { + "rfilename": "bpe_tokenized/shard_0000.parquet", + "size": 155227266 + }, + { + "rfilename": "bpe_tokenized/shard_0001.parquet", + "size": 155548116 + }, + { + "rfilename": "bpe_tokenized/shard_0002.parquet", + "size": 155438900 + }, + { + "rfilename": "bpe_tokenized/shard_0003.parquet", + "size": 155464008 + }, + { + "rfilename": "bpe_tokenized/shard_0004.parquet", + "size": 155690945 + }, + { + "rfilename": "bpe_tokenized/shard_0005.parquet", + "size": 154347675 + }, + { + "rfilename": "bpe_tokenized/shard_0006.parquet", + "size": 154702330 + }, + { + "rfilename": "bpe_tokenized/shard_0007.parquet", + "size": 155774305 + }, + { + "rfilename": "bpe_tokenized/shard_0008.parquet", + "size": 153966982 + }, + { + "rfilename": "bpe_tokenized/shard_0009.parquet", + "size": 240172218 + }, + { + "rfilename": "bpe_tokenized/shard_0010.parquet", + "size": 155537183 + }, + { + "rfilename": "bpe_tokenized/shard_0011.parquet", + "size": 154487609 + }, + { + "rfilename": "bpe_tokenized/shard_0012.parquet", + "size": 154810935 + }, + { + "rfilename": "bpe_tokenized/shard_0013.parquet", + "size": 154993765 + }, + { + "rfilename": "bpe_tokenized/shard_0014.parquet", + "size": 154301844 + }, + { + "rfilename": "bpe_tokenized/shard_0015.parquet", + "size": 154927080 + }, + { + "rfilename": "bpe_tokenized/shard_0016.parquet", + "size": 153851157 + }, + { + "rfilename": "bpe_tokenized/shard_0017.parquet", + "size": 154632700 + }, + { + "rfilename": "bpe_tokenized/shard_0018.parquet", + "size": 155249458 + }, + { + "rfilename": "bpe_tokenized/shard_0019.parquet", + "size": 153559865 + }, + { + "rfilename": "bpe_tokenized/shard_0020.parquet", + "size": 154491424 + }, + { + "rfilename": "bpe_tokenized/shard_0021.parquet", + "size": 279449525 + }, + { + "rfilename": "bpe_tokenized/shard_0022.parquet", + "size": 154778138 + }, + { + "rfilename": "bpe_tokenized/shard_0023.parquet", + "size": 154333983 + }, + { + "rfilename": "bpe_tokenized/shard_0024.parquet", + "size": 153328206 + }, + { + "rfilename": "bpe_tokenized/shard_0025.parquet", + "size": 154460395 + }, + { + "rfilename": "bpe_tokenized/shard_0026.parquet", + "size": 154211750 + }, + { + "rfilename": "bpe_tokenized/shard_0027.parquet", + "size": 153929083 + }, + { + "rfilename": "bpe_tokenized/shard_0028.parquet", + "size": 154446130 + }, + { + "rfilename": "bpe_tokenized/shard_0029.parquet", + "size": 154398356 + }, + { + "rfilename": "bpe_tokenized/shard_0030.parquet", + "size": 153784743 + }, + { + "rfilename": "bpe_tokenized/shard_0031.parquet", + "size": 153949728 + }, + { + "rfilename": "bpe_tokenized/shard_0032.parquet", + "size": 154110791 + }, + { + "rfilename": "bpe_tokenized/shard_0033.parquet", + "size": 155122378 + }, + { + "rfilename": "bpe_tokenized/shard_0034.parquet", + "size": 154513606 + }, + { + "rfilename": "bpe_tokenized/shard_0035.parquet", + "size": 154384540 + }, + { + "rfilename": "bpe_tokenized/shard_0036.parquet", + "size": 154471321 + }, + { + "rfilename": "bpe_tokenized/shard_0037.parquet", + "size": 153982372 + }, + { + "rfilename": "bpe_tokenized/shard_0038.parquet", + "size": 154734238 + }, + { + "rfilename": "bpe_tokenized/shard_0039.parquet", + "size": 154040027 + }, + { + "rfilename": "bpe_tokenized/shard_0040.parquet", + "size": 154113037 + }, + { + "rfilename": "bpe_tokenized/shard_0041.parquet", + "size": 153285729 + }, + { + "rfilename": "bpe_tokenized/shard_0042.parquet", + "size": 153815955 + }, + { + "rfilename": "bpe_tokenized/shard_0043.parquet", + "size": 153938292 + }, + { + "rfilename": "bpe_tokenized/shard_0044.parquet", + "size": 153792715 + }, + { + "rfilename": "bpe_tokenized/shard_0045.parquet", + "size": 154029622 + }, + { + "rfilename": "bpe_tokenized/shard_0046.parquet", + "size": 152769154 + }, + { + "rfilename": "bpe_tokenized/shard_0047.parquet", + "size": 154452422 + }, + { + "rfilename": "bpe_tokenized/shard_0048.parquet", + "size": 153865590 + }, + { + "rfilename": "bpe_tokenized/shard_0049.parquet", + "size": 154455594 + }, + { + "rfilename": "bpe_tokenized/shard_0050.parquet", + "size": 153036074 + }, + { + "rfilename": "bpe_tokenized/shard_0051.parquet", + "size": 153835585 + }, + { + "rfilename": "bpe_tokenized/shard_0052.parquet", + "size": 153420468 + }, + { + "rfilename": "bpe_tokenized/shard_0053.parquet", + "size": 153989247 + }, + { + "rfilename": "bpe_tokenized/shard_0054.parquet", + "size": 153759017 + }, + { + "rfilename": "bpe_tokenized/shard_0055.parquet", + "size": 153984247 + }, + { + "rfilename": "bpe_tokenized/shard_0056.parquet", + "size": 154411221 + }, + { + "rfilename": "bpe_tokenized/shard_0057.parquet", + "size": 153063373 + }, + { + "rfilename": "bpe_tokenized/shard_0058.parquet", + "size": 153473998 + }, + { + "rfilename": "bpe_tokenized/shard_0059.parquet", + "size": 153999146 + }, + { + "rfilename": "bpe_tokenized/shard_0062.parquet", + "size": 153416405 + }, + { + "rfilename": "bpe_tokenized/shard_0063.parquet", + "size": 153225959 + }, + { + "rfilename": "bpe_tokenized/shard_0064.parquet", + "size": 152897995 + }, + { + "rfilename": "bpe_tokenized/shard_0065.parquet", + "size": 153183668 + }, + { + "rfilename": "bpe_tokenized/shard_0066.parquet", + "size": 153788406 + }, + { + "rfilename": "bpe_tokenized/shard_0067.parquet", + "size": 153865302 + }, + { + "rfilename": "bpe_tokenized/shard_0068.parquet", + "size": 153578648 + }, + { + "rfilename": "bpe_tokenized/shard_0069.parquet", + "size": 153320473 + }, + { + "rfilename": "bpe_tokenized/shard_0070.parquet", + "size": 152825806 + }, + { + "rfilename": "bpe_tokenized/shard_0071.parquet", + "size": 153914860 + }, + { + "rfilename": "bpe_tokenized/shard_0072.parquet", + "size": 153843104 + }, + { + "rfilename": "bpe_tokenized/shard_0073.parquet", + "size": 154116653 + }, + { + "rfilename": "bpe_tokenized/shard_0074.parquet", + "size": 154045715 + }, + { + "rfilename": "bpe_tokenized/shard_0075.parquet", + "size": 154371366 + }, + { + "rfilename": "bpe_tokenized/shard_0076.parquet", + "size": 153706052 + }, + { + "rfilename": "bpe_tokenized/shard_0077.parquet", + "size": 153866586 + }, + { + "rfilename": "bpe_tokenized/shard_0078.parquet", + "size": 154158152 + }, + { + "rfilename": "bpe_tokenized/shard_0079.parquet", + "size": 154378712 + }, + { + "rfilename": "bpe_tokenized/shard_0080.parquet", + "size": 154099407 + }, + { + "rfilename": "bpe_tokenized/shard_0081.parquet", + "size": 153991741 + }, + { + "rfilename": "bpe_tokenized/shard_0082.parquet", + "size": 153847288 + }, + { + "rfilename": "bpe_tokenized/shard_0083.parquet", + "size": 154559811 + }, + { + "rfilename": "bpe_tokenized/shard_0084.parquet", + "size": 154754748 + }, + { + "rfilename": "bpe_tokenized/shard_0085.parquet", + "size": 153855699 + }, + { + "rfilename": "bpe_tokenized/shard_0086.parquet", + "size": 153534432 + }, + { + "rfilename": "bpe_tokenized/shard_0087.parquet", + "size": 153672304 + }, + { + "rfilename": "bpe_tokenized/shard_0088.parquet", + "size": 153775238 + }, + { + "rfilename": "bpe_tokenized/shard_0089.parquet", + "size": 153941160 + }, + { + "rfilename": "bpe_tokenized/shard_0090.parquet", + "size": 153633594 + }, + { + "rfilename": "bpe_tokenized/shard_0091.parquet", + "size": 153617762 + }, + { + "rfilename": "bpe_tokenized/shard_0092.parquet", + "size": 153521116 + }, + { + "rfilename": "bpe_tokenized/shard_0093.parquet", + "size": 154280066 + }, + { + "rfilename": "bpe_tokenized/shard_0094.parquet", + "size": 154774127 + }, + { + "rfilename": "bpe_tokenized/shard_0095.parquet", + "size": 153336509 + }, + { + "rfilename": "bpe_tokenized/shard_0096.parquet", + "size": 154661195 + }, + { + "rfilename": "bpe_tokenized/shard_0097.parquet", + "size": 152995735 + }, + { + "rfilename": "bpe_tokenized/shard_0098.parquet", + "size": 152915149 + }, + { + "rfilename": "bpe_tokenized/shard_0099.parquet", + "size": 153552970 + }, + { + "rfilename": "bpe_tokenized/shard_0100.parquet", + "size": 154013925 + }, + { + "rfilename": "bpe_tokenized/shard_0101.parquet", + "size": 153721465 + }, + { + "rfilename": "bpe_tokenized/shard_0102.parquet", + "size": 152713592 + }, + { + "rfilename": "bpe_tokenized/shard_0103.parquet", + "size": 153065857 + }, + { + "rfilename": "bpe_tokenized/shard_0104.parquet", + "size": 154091940 + }, + { + "rfilename": "bpe_tokenized/shard_0105.parquet", + "size": 153353556 + }, + { + "rfilename": "bpe_tokenized/shard_0106.parquet", + "size": 152694764 + }, + { + "rfilename": "bpe_tokenized/shard_0107.parquet", + "size": 154195499 + }, + { + "rfilename": "bpe_tokenized/shard_0108.parquet", + "size": 153531963 + }, + { + "rfilename": "bpe_tokenized/shard_0109.parquet", + "size": 153028683 + }, + { + "rfilename": "bpe_tokenized/shard_0110.parquet", + "size": 153140121 + }, + { + "rfilename": "bpe_tokenized/shard_0111.parquet", + "size": 153990819 + }, + { + "rfilename": "bpe_tokenized/shard_0112.parquet", + "size": 152303394 + }, + { + "rfilename": "bpe_tokenized/shard_0113.parquet", + "size": 154209030 + }, + { + "rfilename": "bpe_tokenized/shard_0114.parquet", + "size": 154679795 + }, + { + "rfilename": "bpe_tokenized/shard_0115.parquet", + "size": 153995161 + }, + { + "rfilename": "bpe_tokenized/shard_0116.parquet", + "size": 154567484 + }, + { + "rfilename": "bpe_tokenized/shard_0117.parquet", + "size": 154041311 + }, + { + "rfilename": "bpe_tokenized/shard_0118.parquet", + "size": 152210748 + }, + { + "rfilename": "bpe_tokenized/shard_0119.parquet", + "size": 153930796 + }, + { + "rfilename": "bpe_tokenized/shard_0120.parquet", + "size": 153933885 + }, + { + "rfilename": "bpe_tokenized/shard_0121.parquet", + "size": 152902418 + }, + { + "rfilename": "bpe_tokenized/shard_0122.parquet", + "size": 153462214 + }, + { + "rfilename": "bpe_tokenized/shard_0123.parquet", + "size": 154262591 + }, + { + "rfilename": "bpe_tokenized/shard_0124.parquet", + "size": 153449547 + }, + { + "rfilename": "bpe_tokenized/shard_0125.parquet", + "size": 151946107 + }, + { + "rfilename": "bpe_tokenized/shard_0126.parquet", + "size": 153520695 + }, + { + "rfilename": "bpe_tokenized/shard_0127.parquet", + "size": 153658722 + }, + { + "rfilename": "bpe_tokenized/shard_0128.parquet", + "size": 154405075 + }, + { + "rfilename": "bpe_tokenized/shard_0129.parquet", + "size": 154509662 + }, + { + "rfilename": "bpe_tokenized/shard_0130.parquet", + "size": 153385573 + }, + { + "rfilename": "bpe_tokenized/shard_0131.parquet", + "size": 154229696 + }, + { + "rfilename": "bpe_tokenized/shard_0132.parquet", + "size": 153983961 + }, + { + "rfilename": "bpe_tokenized/shard_0133.parquet", + "size": 153386549 + }, + { + "rfilename": "bpe_tokenized/shard_0134.parquet", + "size": 153374980 + }, + { + "rfilename": "bpe_tokenized/shard_0135.parquet", + "size": 154155818 + }, + { + "rfilename": "bpe_tokenized/shard_0136.parquet", + "size": 153816761 + }, + { + "rfilename": "bpe_tokenized/shard_0137.parquet", + "size": 154355967 + }, + { + "rfilename": "bpe_tokenized/shard_0138.parquet", + "size": 152734441 + }, + { + "rfilename": "bpe_tokenized/shard_0139.parquet", + "size": 154006816 + }, + { + "rfilename": "bpe_tokenized/shard_0140.parquet", + "size": 152496468 + }, + { + "rfilename": "bpe_tokenized/shard_0141.parquet", + "size": 153390594 + }, + { + "rfilename": "bpe_tokenized/shard_0142.parquet", + "size": 154804566 + }, + { + "rfilename": "bpe_tokenized/shard_0143.parquet", + "size": 153954785 + }, + { + "rfilename": "bpe_tokenized/shard_0144.parquet", + "size": 153572102 + }, + { + "rfilename": "bpe_tokenized/shard_0145.parquet", + "size": 154200049 + }, + { + "rfilename": "bpe_tokenized/shard_0146.parquet", + "size": 153572069 + }, + { + "rfilename": "bpe_tokenized/shard_0147.parquet", + "size": 153914512 + }, + { + "rfilename": "bpe_tokenized/shard_0148.parquet", + "size": 153402739 + }, + { + "rfilename": "bpe_tokenized/shard_0149.parquet", + "size": 153604549 + }, + { + "rfilename": "bpe_tokenized/shard_0150.parquet", + "size": 153441562 + }, + { + "rfilename": "bpe_tokenized/shard_0151.parquet", + "size": 154214749 + }, + { + "rfilename": "bpe_tokenized/shard_0152.parquet", + "size": 153723111 + }, + { + "rfilename": "bpe_tokenized/shard_0153.parquet", + "size": 153459765 + }, + { + "rfilename": "bpe_tokenized/shard_0154.parquet", + "size": 153253306 + }, + { + "rfilename": "bpe_tokenized/shard_0155.parquet", + "size": 153164437 + }, + { + "rfilename": "bpe_tokenized/shard_0156.parquet", + "size": 152076947 + }, + { + "rfilename": "bpe_tokenized/shard_0157.parquet", + "size": 154079407 + }, + { + "rfilename": "bpe_tokenized/shard_0158.parquet", + "size": 153222561 + }, + { + "rfilename": "bpe_tokenized/shard_0159.parquet", + "size": 153304154 + }, + { + "rfilename": "bpe_tokenized/shard_0160.parquet", + "size": 153524633 + }, + { + "rfilename": "bpe_tokenized/shard_0161.parquet", + "size": 153777083 + }, + { + "rfilename": "bpe_tokenized/shard_0162.parquet", + "size": 154405642 + }, + { + "rfilename": "bpe_tokenized/shard_0163.parquet", + "size": 153180231 + }, + { + "rfilename": "bpe_tokenized/shard_0164.parquet", + "size": 153690902 + }, + { + "rfilename": "bpe_tokenized/shard_0165.parquet", + "size": 153933176 + }, + { + "rfilename": "bpe_tokenized/shard_0166.parquet", + "size": 153241742 + }, + { + "rfilename": "bpe_tokenized/shard_0167.parquet", + "size": 153179430 + }, + { + "rfilename": "bpe_tokenized/shard_0168.parquet", + "size": 154746768 + }, + { + "rfilename": "bpe_tokenized/shard_0169.parquet", + "size": 153920003 + }, + { + "rfilename": "bpe_tokenized/shard_0170.parquet", + "size": 153728505 + }, + { + "rfilename": "bpe_tokenized/shard_0171.parquet", + "size": 153763915 + }, + { + "rfilename": "bpe_tokenized/shard_0172.parquet", + "size": 154103761 + }, + { + "rfilename": "bpe_tokenized/shard_0173.parquet", + "size": 153231083 + }, + { + "rfilename": "bpe_tokenized/shard_0174.parquet", + "size": 152315156 + }, + { + "rfilename": "bpe_tokenized/shard_0175.parquet", + "size": 153434529 + }, + { + "rfilename": "bpe_tokenized/shard_0176.parquet", + "size": 153316052 + }, + { + "rfilename": "bpe_tokenized/shard_0177.parquet", + "size": 153612158 + }, + { + "rfilename": "bpe_tokenized/shard_0178.parquet", + "size": 153610743 + }, + { + "rfilename": "bpe_tokenized/shard_0179.parquet", + "size": 153310109 + }, + { + "rfilename": "bpe_tokenized/shard_0180.parquet", + "size": 152923654 + }, + { + "rfilename": "bpe_tokenized/shard_0181.parquet", + "size": 153045994 + }, + { + "rfilename": "bpe_tokenized/shard_0182.parquet", + "size": 153226044 + }, + { + "rfilename": "bpe_tokenized/shard_0183.parquet", + "size": 154241091 + }, + { + "rfilename": "bpe_tokenized/shard_0184.parquet", + "size": 153774838 + }, + { + "rfilename": "bpe_tokenized/shard_0185.parquet", + "size": 153756772 + }, + { + "rfilename": "bpe_tokenized/shard_0186.parquet", + "size": 152948884 + }, + { + "rfilename": "bpe_tokenized/shard_0187.parquet", + "size": 153679444 + }, + { + "rfilename": "bpe_tokenized/shard_0188.parquet", + "size": 154358824 + }, + { + "rfilename": "bpe_tokenized/shard_0189.parquet", + "size": 153974737 + }, + { + "rfilename": "bpe_tokenized/shard_0190.parquet", + "size": 153092850 + }, + { + "rfilename": "bpe_tokenized/shard_0191.parquet", + "size": 153554304 + }, + { + "rfilename": "bpe_tokenized/shard_0192.parquet", + "size": 152428266 + }, + { + "rfilename": "bpe_tokenized/shard_0193.parquet", + "size": 152698168 + }, + { + "rfilename": "bpe_tokenized/shard_0194.parquet", + "size": 153770898 + }, + { + "rfilename": "bpe_tokenized/shard_0195.parquet", + "size": 154746550 + }, + { + "rfilename": "bpe_tokenized/shard_0196.parquet", + "size": 152617695 + }, + { + "rfilename": "bpe_tokenized/shard_0197.parquet", + "size": 154410727 + }, + { + "rfilename": "bpe_tokenized/shard_0198.parquet", + "size": 154265235 + }, + { + "rfilename": "bpe_tokenized/shard_0199.parquet", + "size": 154201530 + }, + { + "rfilename": "bpe_tokenized/shard_0200.parquet", + "size": 155245803 + }, + { + "rfilename": "bpe_tokenized/shard_0201.parquet", + "size": 153675840 + }, + { + "rfilename": "bpe_tokenized/shard_0202.parquet", + "size": 152703444 + }, + { + "rfilename": "bpe_tokenized/shard_0203.parquet", + "size": 153172575 + }, + { + "rfilename": "bpe_tokenized/shard_0204.parquet", + "size": 153488433 + }, + { + "rfilename": "bpe_tokenized/shard_0205.parquet", + "size": 152714555 + }, + { + "rfilename": "bpe_tokenized/shard_0206.parquet", + "size": 154006388 + }, + { + "rfilename": "bpe_tokenized/shard_0207.parquet", + "size": 154035774 + }, + { + "rfilename": "bpe_tokenized/shard_0208.parquet", + "size": 153890921 + }, + { + "rfilename": "bpe_tokenized/shard_0209.parquet", + "size": 153553689 + }, + { + "rfilename": "bpe_tokenized/shard_0210.parquet", + "size": 152810429 + }, + { + "rfilename": "bpe_tokenized/shard_0211.parquet", + "size": 153221817 + }, + { + "rfilename": "bpe_tokenized/shard_0212.parquet", + "size": 154388097 + }, + { + "rfilename": "bpe_tokenized/shard_0213.parquet", + "size": 154112136 + }, + { + "rfilename": "bpe_tokenized/shard_0214.parquet", + "size": 152622021 + }, + { + "rfilename": "bpe_tokenized/shard_0215.parquet", + "size": 154491967 + }, + { + "rfilename": "bpe_tokenized/shard_0216.parquet", + "size": 152881225 + }, + { + "rfilename": "bpe_tokenized/shard_0217.parquet", + "size": 153701995 + }, + { + "rfilename": "bpe_tokenized/shard_0218.parquet", + "size": 152646132 + }, + { + "rfilename": "bpe_tokenized/shard_0219.parquet", + "size": 153305783 + }, + { + "rfilename": "bpe_tokenized/shard_0220.parquet", + "size": 154545007 + }, + { + "rfilename": "bpe_tokenized/shard_0221.parquet", + "size": 154034746 + }, + { + "rfilename": "bpe_tokenized/shard_0222.parquet", + "size": 153336103 + }, + { + "rfilename": "bpe_tokenized/shard_0223.parquet", + "size": 153458670 + }, + { + "rfilename": "bpe_tokenized/shard_0224.parquet", + "size": 153642232 + }, + { + "rfilename": "bpe_tokenized/shard_0225.parquet", + "size": 153354469 + }, + { + "rfilename": "bpe_tokenized/shard_0226.parquet", + "size": 154373954 + }, + { + "rfilename": "bpe_tokenized/shard_0227.parquet", + "size": 152739701 + }, + { + "rfilename": "bpe_tokenized/shard_0228.parquet", + "size": 154016885 + }, + { + "rfilename": "bpe_tokenized/shard_0229.parquet", + "size": 153145139 + }, + { + "rfilename": "bpe_tokenized/shard_0230.parquet", + "size": 153355512 + }, + { + "rfilename": "bpe_tokenized/shard_0231.parquet", + "size": 153872513 + }, + { + "rfilename": "bpe_tokenized/shard_0232.parquet", + "size": 153064830 + }, + { + "rfilename": "bpe_tokenized/shard_0233.parquet", + "size": 153187164 + }, + { + "rfilename": "bpe_tokenized/shard_0234.parquet", + "size": 152942498 + }, + { + "rfilename": "bpe_tokenized/shard_0235.parquet", + "size": 154707823 + }, + { + "rfilename": "bpe_tokenized/shard_0236.parquet", + "size": 152448733 + }, + { + "rfilename": "bpe_tokenized/shard_0237.parquet", + "size": 153169795 + }, + { + "rfilename": "bpe_tokenized/shard_0238.parquet", + "size": 153564863 + }, + { + "rfilename": "bpe_tokenized/shard_0239.parquet", + "size": 153968320 + }, + { + "rfilename": "bpe_tokenized/shard_0240.parquet", + "size": 154277860 + }, + { + "rfilename": "bpe_tokenized/shard_0241.parquet", + "size": 153482709 + }, + { + "rfilename": "bpe_tokenized/shard_0242.parquet", + "size": 153281443 + }, + { + "rfilename": "bpe_tokenized/shard_0243.parquet", + "size": 153514478 + }, + { + "rfilename": "bpe_tokenized/shard_0244.parquet", + "size": 153239602 + }, + { + "rfilename": "bpe_tokenized/shard_0245.parquet", + "size": 153418149 + }, + { + "rfilename": "bpe_tokenized/shard_0246.parquet", + "size": 153840096 + }, + { + "rfilename": "bpe_tokenized/shard_0247.parquet", + "size": 153014350 + }, + { + "rfilename": "bpe_tokenized/shard_0248.parquet", + "size": 152588049 + }, + { + "rfilename": "bpe_tokenized/shard_0249.parquet", + "size": 153511430 + }, + { + "rfilename": "bpe_tokenized/shard_0250.parquet", + "size": 153277088 + }, + { + "rfilename": "bpe_tokenized/shard_0251.parquet", + "size": 154176484 + }, + { + "rfilename": "bpe_tokenized/shard_0252.parquet", + "size": 154226580 + }, + { + "rfilename": "bpe_tokenized/shard_0253.parquet", + "size": 153790565 + }, + { + "rfilename": "bpe_tokenized/shard_0254.parquet", + "size": 152598779 + }, + { + "rfilename": "bpe_tokenized/shard_0255.parquet", + "size": 153942578 + }, + { + "rfilename": "bpe_tokenized/shard_0256.parquet", + "size": 153161972 + }, + { + "rfilename": "bpe_tokenized/shard_0257.parquet", + "size": 152986690 + }, + { + "rfilename": "bpe_tokenized/shard_0258.parquet", + "size": 153556206 + }, + { + "rfilename": "bpe_tokenized/shard_0259.parquet", + "size": 153154187 + }, + { + "rfilename": "bpe_tokenized/shard_0260.parquet", + "size": 152819281 + }, + { + "rfilename": "bpe_tokenized/shard_0261.parquet", + "size": 152819210 + }, + { + "rfilename": "bpe_tokenized/shard_0262.parquet", + "size": 152975049 + }, + { + "rfilename": "bpe_tokenized/shard_0263.parquet", + "size": 153750618 + }, + { + "rfilename": "bpe_tokenized/shard_0264.parquet", + "size": 153387778 + }, + { + "rfilename": "bpe_tokenized/shard_0265.parquet", + "size": 153219642 + }, + { + "rfilename": "bpe_tokenized/shard_0266.parquet", + "size": 154494837 + }, + { + "rfilename": "bpe_tokenized/shard_0267.parquet", + "size": 151862782 + }, + { + "rfilename": "bpe_tokenized/shard_0268.parquet", + "size": 153252268 + }, + { + "rfilename": "bpe_tokenized/shard_0269.parquet", + "size": 152644536 + }, + { + "rfilename": "bpe_tokenized/shard_0270.parquet", + "size": 153836452 + }, + { + "rfilename": "bpe_tokenized/shard_0271.parquet", + "size": 152644468 + }, + { + "rfilename": "bpe_tokenized/shard_0272.parquet", + "size": 154123144 + }, + { + "rfilename": "bpe_tokenized/shard_0273.parquet", + "size": 153894821 + }, + { + "rfilename": "bpe_tokenized/shard_0274.parquet", + "size": 153323963 + }, + { + "rfilename": "bpe_tokenized/shard_0275.parquet", + "size": 153538409 + }, + { + "rfilename": "bpe_tokenized/shard_0276.parquet", + "size": 152489404 + }, + { + "rfilename": "bpe_tokenized/shard_0277.parquet", + "size": 152929106 + }, + { + "rfilename": "bpe_tokenized/shard_0278.parquet", + "size": 152495146 + }, + { + "rfilename": "bpe_tokenized/shard_0279.parquet", + "size": 153684457 + }, + { + "rfilename": "bpe_tokenized/shard_0280.parquet", + "size": 153725141 + }, + { + "rfilename": "bpe_tokenized/shard_0281.parquet", + "size": 153125210 + }, + { + "rfilename": "bpe_tokenized/shard_0282.parquet", + "size": 154283695 + }, + { + "rfilename": "bpe_tokenized/shard_0283.parquet", + "size": 153115420 + }, + { + "rfilename": "bpe_tokenized/shard_0284.parquet", + "size": 154171876 + }, + { + "rfilename": "bpe_tokenized/shard_0285.parquet", + "size": 152833447 + }, + { + "rfilename": "bpe_tokenized/shard_0286.parquet", + "size": 152356930 + }, + { + "rfilename": "bpe_tokenized/shard_0287.parquet", + "size": 154218743 + }, + { + "rfilename": "bpe_tokenized/shard_0288.parquet", + "size": 153283332 + }, + { + "rfilename": "bpe_tokenized/shard_0289.parquet", + "size": 153262840 + }, + { + "rfilename": "bpe_tokenized/shard_0290.parquet", + "size": 153213408 + }, + { + "rfilename": "bpe_tokenized/shard_0291.parquet", + "size": 154050053 + }, + { + "rfilename": "bpe_tokenized/shard_0292.parquet", + "size": 153299778 + }, + { + "rfilename": "bpe_tokenized/shard_0293.parquet", + "size": 153238928 + }, + { + "rfilename": "bpe_tokenized/shard_0294.parquet", + "size": 153558101 + }, + { + "rfilename": "bpe_tokenized/shard_0295.parquet", + "size": 153496646 + }, + { + "rfilename": "bpe_tokenized/shard_0296.parquet", + "size": 153237920 + }, + { + "rfilename": "bpe_tokenized/shard_0297.parquet", + "size": 153596379 + }, + { + "rfilename": "bpe_tokenized/shard_0298.parquet", + "size": 153200970 + }, + { + "rfilename": "bpe_tokenized/shard_0299.parquet", + "size": 153288401 + }, + { + "rfilename": "bpe_tokenized/shard_0300.parquet", + "size": 152450153 + }, + { + "rfilename": "bpe_tokenized/shard_0301.parquet", + "size": 153761926 + }, + { + "rfilename": "bpe_tokenized/shard_0302.parquet", + "size": 152650507 + }, + { + "rfilename": "bpe_tokenized/shard_0303.parquet", + "size": 153622815 + }, + { + "rfilename": "bpe_tokenized/shard_0304.parquet", + "size": 154466272 + }, + { + "rfilename": "bpe_tokenized/shard_0305.parquet", + "size": 152458780 + }, + { + "rfilename": "bpe_tokenized/shard_0306.parquet", + "size": 152862852 + }, + { + "rfilename": "bpe_tokenized/shard_0307.parquet", + "size": 153052075 + }, + { + "rfilename": "bpe_tokenized/shard_0308.parquet", + "size": 153301857 + }, + { + "rfilename": "bpe_tokenized/shard_0309.parquet", + "size": 152719272 + }, + { + "rfilename": "bpe_tokenized/shard_0310.parquet", + "size": 153911463 + }, + { + "rfilename": "bpe_tokenized/shard_0311.parquet", + "size": 152974924 + }, + { + "rfilename": "bpe_tokenized/shard_0312.parquet", + "size": 153322851 + }, + { + "rfilename": "bpe_tokenized/shard_0313.parquet", + "size": 152970653 + }, + { + "rfilename": "bpe_tokenized/shard_0314.parquet", + "size": 154491726 + }, + { + "rfilename": "bpe_tokenized/shard_0315.parquet", + "size": 152346485 + }, + { + "rfilename": "bpe_tokenized/shard_0316.parquet", + "size": 152656210 + }, + { + "rfilename": "bpe_tokenized/shard_0317.parquet", + "size": 153069220 + }, + { + "rfilename": "bpe_tokenized/shard_0318.parquet", + "size": 152593172 + }, + { + "rfilename": "bpe_tokenized/shard_0319.parquet", + "size": 152980652 + }, + { + "rfilename": "bpe_tokenized/shard_0320.parquet", + "size": 153971734 + }, + { + "rfilename": "bpe_tokenized/shard_0321.parquet", + "size": 153360011 + }, + { + "rfilename": "bpe_tokenized/shard_0322.parquet", + "size": 153071111 + }, + { + "rfilename": "bpe_tokenized/shard_0323.parquet", + "size": 151571503 + }, + { + "rfilename": "bpe_tokenized/shard_0324.parquet", + "size": 152844932 + }, + { + "rfilename": "bpe_tokenized/shard_0325.parquet", + "size": 153916739 + }, + { + "rfilename": "bpe_tokenized/shard_0326.parquet", + "size": 153215110 + }, + { + "rfilename": "bpe_tokenized/shard_0327.parquet", + "size": 153127330 + }, + { + "rfilename": "bpe_tokenized/shard_0328.parquet", + "size": 153006954 + }, + { + "rfilename": "bpe_tokenized/shard_0329.parquet", + "size": 152446054 + }, + { + "rfilename": "bpe_tokenized/shard_0330.parquet", + "size": 154561356 + }, + { + "rfilename": "bpe_tokenized/shard_0331.parquet", + "size": 152485430 + }, + { + "rfilename": "bpe_tokenized/shard_0332.parquet", + "size": 152074883 + }, + { + "rfilename": "bpe_tokenized/shard_0333.parquet", + "size": 153661373 + }, + { + "rfilename": "bpe_tokenized/shard_0334.parquet", + "size": 154139664 + }, + { + "rfilename": "bpe_tokenized/shard_0335.parquet", + "size": 152968542 + }, + { + "rfilename": "bpe_tokenized/shard_0336.parquet", + "size": 153520120 + }, + { + "rfilename": "bpe_tokenized/shard_0337.parquet", + "size": 152865887 + }, + { + "rfilename": "bpe_tokenized/shard_0338.parquet", + "size": 153937022 + }, + { + "rfilename": "bpe_tokenized/shard_0339.parquet", + "size": 153931107 + }, + { + "rfilename": "bpe_tokenized/shard_0340.parquet", + "size": 153758307 + }, + { + "rfilename": "bpe_tokenized/shard_0341.parquet", + "size": 154306759 + }, + { + "rfilename": "bpe_tokenized/shard_0342.parquet", + "size": 153668489 + }, + { + "rfilename": "bpe_tokenized/shard_0343.parquet", + "size": 152584728 + }, + { + "rfilename": "bpe_tokenized/shard_0344.parquet", + "size": 154477489 + }, + { + "rfilename": "bpe_tokenized/shard_0345.parquet", + "size": 152988906 + }, + { + "rfilename": "bpe_tokenized/shard_0346.parquet", + "size": 153026544 + }, + { + "rfilename": "bpe_tokenized/shard_0347.parquet", + "size": 153556439 + }, + { + "rfilename": "bpe_tokenized/shard_0348.parquet", + "size": 152988005 + }, + { + "rfilename": "bpe_tokenized/shard_0349.parquet", + "size": 153394848 + }, + { + "rfilename": "bpe_tokenized/shard_0350.parquet", + "size": 154144513 + }, + { + "rfilename": "bpe_tokenized/shard_0351.parquet", + "size": 153088326 + }, + { + "rfilename": "bpe_tokenized/shard_0352.parquet", + "size": 153546955 + }, + { + "rfilename": "bpe_tokenized/shard_0353.parquet", + "size": 153551212 + }, + { + "rfilename": "bpe_tokenized/shard_0354.parquet", + "size": 153296406 + }, + { + "rfilename": "bpe_tokenized/shard_0355.parquet", + "size": 153345239 + }, + { + "rfilename": "bpe_tokenized/shard_0356.parquet", + "size": 153654736 + }, + { + "rfilename": "bpe_tokenized/shard_0357.parquet", + "size": 152477772 + }, + { + "rfilename": "bpe_tokenized/shard_0358.parquet", + "size": 152372024 + }, + { + "rfilename": "bpe_tokenized/shard_0359.parquet", + "size": 154201454 + }, + { + "rfilename": "bpe_tokenized/shard_0360.parquet", + "size": 152493684 + }, + { + "rfilename": "bpe_tokenized/shard_0361.parquet", + "size": 153406305 + }, + { + "rfilename": "bpe_tokenized/shard_0362.parquet", + "size": 153745348 + }, + { + "rfilename": "bpe_tokenized/shard_0363.parquet", + "size": 152792828 + }, + { + "rfilename": "bpe_tokenized/shard_0364.parquet", + "size": 152551301 + }, + { + "rfilename": "bpe_tokenized/shard_0365.parquet", + "size": 153822825 + }, + { + "rfilename": "bpe_tokenized/shard_0366.parquet", + "size": 153528536 + }, + { + "rfilename": "bpe_tokenized/shard_0367.parquet", + "size": 153064732 + }, + { + "rfilename": "bpe_tokenized/shard_0368.parquet", + "size": 154130773 + }, + { + "rfilename": "bpe_tokenized/shard_0369.parquet", + "size": 152508467 + }, + { + "rfilename": "bpe_tokenized/shard_0370.parquet", + "size": 153100670 + }, + { + "rfilename": "bpe_tokenized/shard_0371.parquet", + "size": 153551188 + }, + { + "rfilename": "bpe_tokenized/shard_0372.parquet", + "size": 152342715 + }, + { + "rfilename": "bpe_tokenized/shard_0373.parquet", + "size": 152820601 + }, + { + "rfilename": "bpe_tokenized/shard_0374.parquet", + "size": 152306490 + }, + { + "rfilename": "bpe_tokenized/shard_0375.parquet", + "size": 153243833 + }, + { + "rfilename": "bpe_tokenized/shard_0376.parquet", + "size": 152657782 + }, + { + "rfilename": "bpe_tokenized/shard_0377.parquet", + "size": 152542407 + }, + { + "rfilename": "bpe_tokenized/shard_0378.parquet", + "size": 153052649 + }, + { + "rfilename": "bpe_tokenized/shard_0379.parquet", + "size": 152729384 + }, + { + "rfilename": "bpe_tokenized/shard_0380.parquet", + "size": 152647786 + }, + { + "rfilename": "bpe_tokenized/shard_0381.parquet", + "size": 152379646 + }, + { + "rfilename": "bpe_tokenized/shard_0382.parquet", + "size": 152314306 + }, + { + "rfilename": "bpe_tokenized/shard_0383.parquet", + "size": 151823644 + }, + { + "rfilename": "bpe_tokenized/shard_0384.parquet", + "size": 152824876 + }, + { + "rfilename": "bpe_tokenized/shard_0385.parquet", + "size": 153519782 + }, + { + "rfilename": "bpe_tokenized/shard_0386.parquet", + "size": 152937716 + }, + { + "rfilename": "bpe_tokenized/shard_0387.parquet", + "size": 152526238 + }, + { + "rfilename": "bpe_tokenized/shard_0388.parquet", + "size": 152190708 + }, + { + "rfilename": "bpe_tokenized/shard_0389.parquet", + "size": 152942269 + }, + { + "rfilename": "bpe_tokenized/shard_0390.parquet", + "size": 152488810 + }, + { + "rfilename": "bpe_tokenized/shard_0391.parquet", + "size": 153349550 + }, + { + "rfilename": "bpe_tokenized/shard_0392.parquet", + "size": 154030217 + }, + { + "rfilename": "bpe_tokenized/shard_0393.parquet", + "size": 151589606 + }, + { + "rfilename": "bpe_tokenized/shard_0394.parquet", + "size": 154471247 + }, + { + "rfilename": "bpe_tokenized/shard_0395.parquet", + "size": 154344718 + }, + { + "rfilename": "bpe_tokenized/shard_0396.parquet", + "size": 154143925 + }, + { + "rfilename": "bpe_tokenized/shard_0397.parquet", + "size": 153168330 + }, + { + "rfilename": "bpe_tokenized/shard_0398.parquet", + "size": 152117748 + }, + { + "rfilename": "bpe_tokenized/shard_0399.parquet", + "size": 152253461 + }, + { + "rfilename": "bpe_tokenized/shard_0400.parquet", + "size": 152732874 + }, + { + "rfilename": "bpe_tokenized/shard_0401.parquet", + "size": 153689191 + }, + { + "rfilename": "bpe_tokenized/shard_0402.parquet", + "size": 152978103 + }, + { + "rfilename": "bpe_tokenized/shard_0403.parquet", + "size": 152343216 + }, + { + "rfilename": "bpe_tokenized/shard_0404.parquet", + "size": 153390010 + }, + { + "rfilename": "bpe_tokenized/shard_0405.parquet", + "size": 152145513 + }, + { + "rfilename": "bpe_tokenized/shard_0406.parquet", + "size": 153423459 + }, + { + "rfilename": "bpe_tokenized/shard_0407.parquet", + "size": 154225064 + }, + { + "rfilename": "bpe_tokenized/shard_0408.parquet", + "size": 152703325 + }, + { + "rfilename": "bpe_tokenized/shard_0409.parquet", + "size": 153445870 + }, + { + "rfilename": "bpe_tokenized/shard_0410.parquet", + "size": 153250777 + }, + { + "rfilename": "bpe_tokenized/shard_0411.parquet", + "size": 153253116 + }, + { + "rfilename": "bpe_tokenized/shard_0412.parquet", + "size": 151978727 + }, + { + "rfilename": "bpe_tokenized/shard_0413.parquet", + "size": 153483935 + }, + { + "rfilename": "bpe_tokenized/shard_0414.parquet", + "size": 153027304 + }, + { + "rfilename": "bpe_tokenized/shard_0415.parquet", + "size": 153440107 + }, + { + "rfilename": "bpe_tokenized/shard_0416.parquet", + "size": 153378218 + }, + { + "rfilename": "bpe_tokenized/shard_0417.parquet", + "size": 153040845 + }, + { + "rfilename": "bpe_tokenized/shard_0418.parquet", + "size": 153401056 + }, + { + "rfilename": "bpe_tokenized/shard_0419.parquet", + "size": 151487534 + }, + { + "rfilename": "bpe_tokenized/shard_0420.parquet", + "size": 154282246 + }, + { + "rfilename": "bpe_tokenized/shard_0421.parquet", + "size": 152061515 + }, + { + "rfilename": "bpe_tokenized/shard_0422.parquet", + "size": 180561629 + }, + { + "rfilename": "bpe_tokenized/shard_0423.parquet", + "size": 152416600 + }, + { + "rfilename": "bpe_tokenized/shard_0424.parquet", + "size": 153840718 + }, + { + "rfilename": "bpe_tokenized/shard_0425.parquet", + "size": 152780099 + }, + { + "rfilename": "bpe_tokenized/shard_0426.parquet", + "size": 153212460 + }, + { + "rfilename": "bpe_tokenized/shard_0427.parquet", + "size": 153593196 + }, + { + "rfilename": "bpe_tokenized/shard_0428.parquet", + "size": 153281881 + }, + { + "rfilename": "bpe_tokenized/shard_0429.parquet", + "size": 154606940 + }, + { + "rfilename": "bpe_tokenized/shard_0430.parquet", + "size": 152472102 + }, + { + "rfilename": "bpe_tokenized/shard_0431.parquet", + "size": 153777637 + }, + { + "rfilename": "bpe_tokenized/shard_0432.parquet", + "size": 153625463 + }, + { + "rfilename": "bpe_tokenized/shard_0433.parquet", + "size": 153240533 + }, + { + "rfilename": "bpe_tokenized/shard_0434.parquet", + "size": 153726437 + }, + { + "rfilename": "bpe_tokenized/shard_0435.parquet", + "size": 154320434 + }, + { + "rfilename": "bpe_tokenized/shard_0436.parquet", + "size": 153288049 + }, + { + "rfilename": "bpe_tokenized/shard_0437.parquet", + "size": 152510570 + }, + { + "rfilename": "bpe_tokenized/shard_0438.parquet", + "size": 153527706 + }, + { + "rfilename": "byte_marginalized/shard_0000.parquet", + "size": 1921771 + }, + { + "rfilename": "byte_marginalized/shard_0001.parquet", + "size": 1482412 + }, + { + "rfilename": "byte_marginalized/shard_0002.parquet", + "size": 1487913 + }, + { + "rfilename": "byte_marginalized/shard_0003.parquet", + "size": 1486966 + }, + { + "rfilename": "byte_marginalized/shard_0004.parquet", + "size": 1782983 + }, + { + "rfilename": "byte_marginalized/shard_0005.parquet", + "size": 1477131 + }, + { + "rfilename": "byte_marginalized/shard_0006.parquet", + "size": 1466994 + }, + { + "rfilename": "byte_marginalized/shard_0007.parquet", + "size": 1461669 + }, + { + "rfilename": "byte_marginalized/shard_0008.parquet", + "size": 1477177 + }, + { + "rfilename": "byte_marginalized/shard_0009.parquet", + "size": 1472788 + }, + { + "rfilename": "byte_marginalized/shard_0010.parquet", + "size": 1460138 + }, + { + "rfilename": "byte_marginalized/shard_0011.parquet", + "size": 1458332 + }, + { + "rfilename": "byte_marginalized/shard_0012.parquet", + "size": 1460483 + }, + { + "rfilename": "byte_marginalized/shard_0013.parquet", + "size": 1461722 + }, + { + "rfilename": "byte_marginalized/shard_0014.parquet", + "size": 1463165 + }, + { + "rfilename": "byte_marginalized/shard_0015.parquet", + "size": 1452721 + }, + { + "rfilename": "byte_marginalized/shard_0016.parquet", + "size": 1453997 + }, + { + "rfilename": "byte_marginalized/shard_0017.parquet", + "size": 1439726 + }, + { + "rfilename": "byte_marginalized/shard_0018.parquet", + "size": 1459079 + }, + { + "rfilename": "byte_marginalized/shard_0019.parquet", + "size": 1442103 + }, + { + "rfilename": "byte_marginalized/shard_0020.parquet", + "size": 1442689 + }, + { + "rfilename": "byte_marginalized/shard_0021.parquet", + "size": 2656940 + }, + { + "rfilename": "byte_marginalized/shard_0022.parquet", + "size": 1464996 + }, + { + "rfilename": "byte_marginalized/shard_0023.parquet", + "size": 1441440 + }, + { + "rfilename": "byte_marginalized/shard_0024.parquet", + "size": 1449698 + }, + { + "rfilename": "byte_marginalized/shard_0025.parquet", + "size": 1764667 + }, + { + "rfilename": "byte_marginalized/shard_0026.parquet", + "size": 1439275 + }, + { + "rfilename": "byte_marginalized/shard_0027.parquet", + "size": 1439132 + }, + { + "rfilename": "byte_marginalized/shard_0028.parquet", + "size": 1436989 + }, + { + "rfilename": "byte_marginalized/shard_0029.parquet", + "size": 1431374 + }, + { + "rfilename": "byte_marginalized/shard_0030.parquet", + "size": 1440076 + }, + { + "rfilename": "byte_marginalized/shard_0031.parquet", + "size": 1431667 + }, + { + "rfilename": "byte_marginalized/shard_0032.parquet", + "size": 1442894 + }, + { + "rfilename": "byte_marginalized/shard_0033.parquet", + "size": 1424184 + }, + { + "rfilename": "byte_marginalized/shard_0034.parquet", + "size": 1439542 + }, + { + "rfilename": "byte_marginalized/shard_0035.parquet", + "size": 1422723 + }, + { + "rfilename": "byte_marginalized/shard_0036.parquet", + "size": 1446917 + }, + { + "rfilename": "byte_marginalized/shard_0037.parquet", + "size": 1413151 + }, + { + "rfilename": "byte_marginalized/shard_0038.parquet", + "size": 1430810 + }, + { + "rfilename": "byte_marginalized/shard_0039.parquet", + "size": 1420246 + }, + { + "rfilename": "byte_marginalized/shard_0040.parquet", + "size": 1770109 + }, + { + "rfilename": "byte_marginalized/shard_0041.parquet", + "size": 1424701 + }, + { + "rfilename": "byte_marginalized/shard_0042.parquet", + "size": 1415356 + }, + { + "rfilename": "byte_marginalized/shard_0043.parquet", + "size": 2458351 + }, + { + "rfilename": "byte_marginalized/shard_0044.parquet", + "size": 1422219 + }, + { + "rfilename": "byte_marginalized/shard_0045.parquet", + "size": 1413474 + }, + { + "rfilename": "byte_marginalized/shard_0046.parquet", + "size": 1421307 + }, + { + "rfilename": "byte_marginalized/shard_0047.parquet", + "size": 1411453 + }, + { + "rfilename": "byte_marginalized/shard_0048.parquet", + "size": 1414306 + }, + { + "rfilename": "byte_marginalized/shard_0049.parquet", + "size": 1422298 + }, + { + "rfilename": "byte_marginalized/shard_0050.parquet", + "size": 1413629 + }, + { + "rfilename": "byte_marginalized/shard_0051.parquet", + "size": 1426360 + }, + { + "rfilename": "byte_marginalized/shard_0052.parquet", + "size": 1419214 + }, + { + "rfilename": "byte_marginalized/shard_0053.parquet", + "size": 1412170 + }, + { + "rfilename": "byte_marginalized/shard_0054.parquet", + "size": 1415787 + }, + { + "rfilename": "byte_marginalized/shard_0055.parquet", + "size": 1410094 + }, + { + "rfilename": "byte_marginalized/shard_0056.parquet", + "size": 1403470 + }, + { + "rfilename": "byte_marginalized/shard_0057.parquet", + "size": 1426847 + }, + { + "rfilename": "byte_marginalized/shard_0058.parquet", + "size": 1412312 + }, + { + "rfilename": "byte_marginalized/shard_0059.parquet", + "size": 1410630 + }, + { + "rfilename": "byte_marginalized/shard_0062.parquet", + "size": 1401365 + }, + { + "rfilename": "byte_marginalized/shard_0063.parquet", + "size": 1410164 + }, + { + "rfilename": "byte_marginalized/shard_0064.parquet", + "size": 1403730 + }, + { + "rfilename": "byte_marginalized/shard_0065.parquet", + "size": 1412911 + }, + { + "rfilename": "byte_marginalized/shard_0066.parquet", + "size": 1399567 + }, + { + "rfilename": "byte_marginalized/shard_0067.parquet", + "size": 1413228 + }, + { + "rfilename": "byte_marginalized/shard_0068.parquet", + "size": 1411723 + }, + { + "rfilename": "byte_marginalized/shard_0069.parquet", + "size": 1421152 + }, + { + "rfilename": "byte_marginalized/shard_0070.parquet", + "size": 1400646 + }, + { + "rfilename": "byte_marginalized/shard_0071.parquet", + "size": 1397049 + }, + { + "rfilename": "byte_marginalized/shard_0072.parquet", + "size": 1402639 + }, + { + "rfilename": "byte_marginalized/shard_0073.parquet", + "size": 1407315 + }, + { + "rfilename": "byte_marginalized/shard_0074.parquet", + "size": 1393803 + }, + { + "rfilename": "byte_marginalized/shard_0075.parquet", + "size": 1730780 + }, + { + "rfilename": "byte_marginalized/shard_0076.parquet", + "size": 1408517 + }, + { + "rfilename": "byte_marginalized/shard_0077.parquet", + "size": 1402124 + }, + { + "rfilename": "byte_marginalized/shard_0078.parquet", + "size": 1407344 + }, + { + "rfilename": "byte_marginalized/shard_0079.parquet", + "size": 1399401 + }, + { + "rfilename": "byte_marginalized/shard_0080.parquet", + "size": 1399192 + }, + { + "rfilename": "byte_marginalized/shard_0081.parquet", + "size": 1403879 + }, + { + "rfilename": "byte_marginalized/shard_0082.parquet", + "size": 1387251 + }, + { + "rfilename": "byte_marginalized/shard_0083.parquet", + "size": 1405581 + }, + { + "rfilename": "byte_marginalized/shard_0084.parquet", + "size": 1403158 + }, + { + "rfilename": "byte_marginalized/shard_0085.parquet", + "size": 1402351 + }, + { + "rfilename": "byte_marginalized/shard_0086.parquet", + "size": 1398393 + }, + { + "rfilename": "byte_marginalized/shard_0087.parquet", + "size": 2756488 + }, + { + "rfilename": "byte_marginalized/shard_0088.parquet", + "size": 1393363 + }, + { + "rfilename": "byte_marginalized/shard_0089.parquet", + "size": 1395873 + }, + { + "rfilename": "byte_marginalized/shard_0090.parquet", + "size": 1764088 + }, + { + "rfilename": "byte_marginalized/shard_0091.parquet", + "size": 1417263 + }, + { + "rfilename": "byte_marginalized/shard_0092.parquet", + "size": 1384938 + }, + { + "rfilename": "byte_marginalized/shard_0093.parquet", + "size": 1395244 + }, + { + "rfilename": "byte_marginalized/shard_0094.parquet", + "size": 1385111 + }, + { + "rfilename": "byte_marginalized/shard_0095.parquet", + "size": 1389170 + }, + { + "rfilename": "byte_marginalized/shard_0096.parquet", + "size": 1385758 + }, + { + "rfilename": "byte_marginalized/shard_0097.parquet", + "size": 1410862 + }, + { + "rfilename": "byte_marginalized/shard_0098.parquet", + "size": 1379919 + }, + { + "rfilename": "byte_marginalized/shard_0099.parquet", + "size": 1380768 + }, + { + "rfilename": "byte_marginalized/shard_0100.parquet", + "size": 1730385 + }, + { + "rfilename": "byte_marginalized/shard_0101.parquet", + "size": 1388529 + }, + { + "rfilename": "byte_marginalized/shard_0102.parquet", + "size": 1398572 + }, + { + "rfilename": "byte_marginalized/shard_0103.parquet", + "size": 1383903 + }, + { + "rfilename": "byte_marginalized/shard_0104.parquet", + "size": 1403109 + }, + { + "rfilename": "byte_marginalized/shard_0105.parquet", + "size": 1392516 + }, + { + "rfilename": "byte_marginalized/shard_0106.parquet", + "size": 1377122 + }, + { + "rfilename": "byte_marginalized/shard_0107.parquet", + "size": 1400155 + }, + { + "rfilename": "byte_marginalized/shard_0108.parquet", + "size": 1386382 + }, + { + "rfilename": "byte_marginalized/shard_0109.parquet", + "size": 1390442 + }, + { + "rfilename": "byte_marginalized/shard_0110.parquet", + "size": 1725803 + }, + { + "rfilename": "byte_marginalized/shard_0111.parquet", + "size": 1382042 + }, + { + "rfilename": "byte_marginalized/shard_0112.parquet", + "size": 1376202 + }, + { + "rfilename": "byte_marginalized/shard_0113.parquet", + "size": 1387017 + }, + { + "rfilename": "byte_marginalized/shard_0114.parquet", + "size": 1387492 + }, + { + "rfilename": "byte_marginalized/shard_0115.parquet", + "size": 1382336 + }, + { + "rfilename": "byte_marginalized/shard_0116.parquet", + "size": 1384989 + }, + { + "rfilename": "byte_marginalized/shard_0117.parquet", + "size": 1385959 + }, + { + "rfilename": "byte_marginalized/shard_0118.parquet", + "size": 1385817 + }, + { + "rfilename": "byte_marginalized/shard_0119.parquet", + "size": 1381763 + }, + { + "rfilename": "byte_marginalized/shard_0120.parquet", + "size": 1379480 + }, + { + "rfilename": "byte_marginalized/shard_0121.parquet", + "size": 1710338 + }, + { + "rfilename": "byte_marginalized/shard_0122.parquet", + "size": 1395092 + }, + { + "rfilename": "byte_marginalized/shard_0123.parquet", + "size": 1375114 + }, + { + "rfilename": "byte_marginalized/shard_0124.parquet", + "size": 1384095 + }, + { + "rfilename": "byte_marginalized/shard_0125.parquet", + "size": 1381098 + }, + { + "rfilename": "byte_marginalized/shard_0126.parquet", + "size": 1389281 + }, + { + "rfilename": "byte_marginalized/shard_0127.parquet", + "size": 3760450 + }, + { + "rfilename": "byte_marginalized/shard_0128.parquet", + "size": 1387010 + }, + { + "rfilename": "byte_marginalized/shard_0129.parquet", + "size": 1384377 + }, + { + "rfilename": "byte_marginalized/shard_0130.parquet", + "size": 1375779 + }, + { + "rfilename": "byte_marginalized/shard_0131.parquet", + "size": 1386651 + }, + { + "rfilename": "byte_marginalized/shard_0132.parquet", + "size": 1371989 + }, + { + "rfilename": "byte_marginalized/shard_0133.parquet", + "size": 1401417 + }, + { + "rfilename": "byte_marginalized/shard_0134.parquet", + "size": 1388682 + }, + { + "rfilename": "byte_marginalized/shard_0135.parquet", + "size": 1367979 + }, + { + "rfilename": "byte_marginalized/shard_0136.parquet", + "size": 1369634 + }, + { + "rfilename": "byte_marginalized/shard_0137.parquet", + "size": 1377454 + }, + { + "rfilename": "byte_marginalized/shard_0138.parquet", + "size": 2985689 + }, + { + "rfilename": "byte_marginalized/shard_0139.parquet", + "size": 3686451 + }, + { + "rfilename": "byte_marginalized/shard_0140.parquet", + "size": 1363245 + }, + { + "rfilename": "byte_marginalized/shard_0141.parquet", + "size": 1383806 + }, + { + "rfilename": "byte_marginalized/shard_0142.parquet", + "size": 2003568 + }, + { + "rfilename": "byte_marginalized/shard_0143.parquet", + "size": 1391999 + }, + { + "rfilename": "byte_marginalized/shard_0144.parquet", + "size": 1369289 + }, + { + "rfilename": "byte_marginalized/shard_0145.parquet", + "size": 1376442 + }, + { + "rfilename": "byte_marginalized/shard_0146.parquet", + "size": 1417104 + }, + { + "rfilename": "byte_marginalized/shard_0147.parquet", + "size": 1362486 + }, + { + "rfilename": "byte_marginalized/shard_0148.parquet", + "size": 1374183 + }, + { + "rfilename": "byte_marginalized/shard_0149.parquet", + "size": 1376707 + }, + { + "rfilename": "byte_marginalized/shard_0150.parquet", + "size": 1371827 + }, + { + "rfilename": "byte_marginalized/shard_0151.parquet", + "size": 1374392 + }, + { + "rfilename": "byte_marginalized/shard_0152.parquet", + "size": 1379331 + }, + { + "rfilename": "byte_marginalized/shard_0153.parquet", + "size": 1371583 + }, + { + "rfilename": "byte_marginalized/shard_0154.parquet", + "size": 1375797 + }, + { + "rfilename": "byte_marginalized/shard_0155.parquet", + "size": 1352365 + }, + { + "rfilename": "byte_marginalized/shard_0156.parquet", + "size": 1369996 + }, + { + "rfilename": "byte_marginalized/shard_0157.parquet", + "size": 1375981 + }, + { + "rfilename": "byte_marginalized/shard_0158.parquet", + "size": 1384220 + }, + { + "rfilename": "byte_marginalized/shard_0159.parquet", + "size": 1377371 + }, + { + "rfilename": "byte_marginalized/shard_0160.parquet", + "size": 1386253 + }, + { + "rfilename": "byte_marginalized/shard_0161.parquet", + "size": 1373530 + }, + { + "rfilename": "byte_marginalized/shard_0162.parquet", + "size": 1373934 + }, + { + "rfilename": "byte_marginalized/shard_0163.parquet", + "size": 1368051 + }, + { + "rfilename": "byte_marginalized/shard_0164.parquet", + "size": 1374796 + }, + { + "rfilename": "byte_marginalized/shard_0165.parquet", + "size": 1368689 + }, + { + "rfilename": "byte_marginalized/shard_0166.parquet", + "size": 1397884 + }, + { + "rfilename": "byte_marginalized/shard_0167.parquet", + "size": 2345896 + }, + { + "rfilename": "byte_marginalized/shard_0168.parquet", + "size": 1996083 + }, + { + "rfilename": "byte_marginalized/shard_0169.parquet", + "size": 2962416 + }, + { + "rfilename": "byte_marginalized/shard_0170.parquet", + "size": 1374462 + }, + { + "rfilename": "byte_marginalized/shard_0171.parquet", + "size": 1365891 + }, + { + "rfilename": "byte_marginalized/shard_0172.parquet", + "size": 1375631 + }, + { + "rfilename": "byte_marginalized/shard_0173.parquet", + "size": 1371202 + }, + { + "rfilename": "byte_marginalized/shard_0174.parquet", + "size": 1390001 + }, + { + "rfilename": "byte_marginalized/shard_0175.parquet", + "size": 1355053 + }, + { + "rfilename": "byte_marginalized/shard_0176.parquet", + "size": 1384202 + }, + { + "rfilename": "byte_marginalized/shard_0177.parquet", + "size": 1381066 + }, + { + "rfilename": "byte_marginalized/shard_0178.parquet", + "size": 1379343 + }, + { + "rfilename": "byte_marginalized/shard_0179.parquet", + "size": 1357944 + }, + { + "rfilename": "byte_marginalized/shard_0180.parquet", + "size": 1379523 + }, + { + "rfilename": "byte_marginalized/shard_0181.parquet", + "size": 1375966 + }, + { + "rfilename": "byte_marginalized/shard_0182.parquet", + "size": 1363682 + }, + { + "rfilename": "byte_marginalized/shard_0183.parquet", + "size": 1371814 + }, + { + "rfilename": "byte_marginalized/shard_0184.parquet", + "size": 1357252 + }, + { + "rfilename": "byte_marginalized/shard_0185.parquet", + "size": 1390118 + }, + { + "rfilename": "byte_marginalized/shard_0186.parquet", + "size": 1360991 + }, + { + "rfilename": "byte_marginalized/shard_0187.parquet", + "size": 1371112 + }, + { + "rfilename": "byte_marginalized/shard_0188.parquet", + "size": 1366731 + }, + { + "rfilename": "byte_marginalized/shard_0189.parquet", + "size": 1347358 + }, + { + "rfilename": "byte_marginalized/shard_0190.parquet", + "size": 1379198 + }, + { + "rfilename": "byte_marginalized/shard_0191.parquet", + "size": 1380472 + }, + { + "rfilename": "byte_marginalized/shard_0192.parquet", + "size": 1375862 + }, + { + "rfilename": "byte_marginalized/shard_0193.parquet", + "size": 1349417 + }, + { + "rfilename": "byte_marginalized/shard_0194.parquet", + "size": 1384147 + }, + { + "rfilename": "byte_marginalized/shard_0195.parquet", + "size": 1369914 + }, + { + "rfilename": "byte_marginalized/shard_0196.parquet", + "size": 1367454 + }, + { + "rfilename": "byte_marginalized/shard_0197.parquet", + "size": 1347365 + }, + { + "rfilename": "byte_marginalized/shard_0198.parquet", + "size": 1369309 + }, + { + "rfilename": "byte_marginalized/shard_0199.parquet", + "size": 1365854 + }, + { + "rfilename": "byte_marginalized/shard_0200.parquet", + "size": 1346537 + }, + { + "rfilename": "byte_marginalized/shard_0201.parquet", + "size": 1375419 + }, + { + "rfilename": "byte_marginalized/shard_0202.parquet", + "size": 1376074 + }, + { + "rfilename": "byte_marginalized/shard_0203.parquet", + "size": 1355820 + }, + { + "rfilename": "byte_marginalized/shard_0204.parquet", + "size": 1347709 + }, + { + "rfilename": "byte_marginalized/shard_0205.parquet", + "size": 3018483 + }, + { + "rfilename": "byte_marginalized/shard_0206.parquet", + "size": 1367464 + }, + { + "rfilename": "byte_marginalized/shard_0207.parquet", + "size": 1341389 + }, + { + "rfilename": "byte_marginalized/shard_0208.parquet", + "size": 1362896 + }, + { + "rfilename": "byte_marginalized/shard_0209.parquet", + "size": 1378632 + }, + { + "rfilename": "byte_marginalized/shard_0210.parquet", + "size": 1337844 + }, + { + "rfilename": "byte_marginalized/shard_0211.parquet", + "size": 1386713 + }, + { + "rfilename": "byte_marginalized/shard_0212.parquet", + "size": 1386476 + }, + { + "rfilename": "byte_marginalized/shard_0213.parquet", + "size": 1334468 + }, + { + "rfilename": "byte_marginalized/shard_0214.parquet", + "size": 1374100 + }, + { + "rfilename": "byte_marginalized/shard_0215.parquet", + "size": 1352777 + }, + { + "rfilename": "byte_marginalized/shard_0216.parquet", + "size": 1364156 + }, + { + "rfilename": "byte_marginalized/shard_0217.parquet", + "size": 1358607 + }, + { + "rfilename": "byte_marginalized/shard_0218.parquet", + "size": 1354776 + }, + { + "rfilename": "byte_marginalized/shard_0219.parquet", + "size": 1350297 + }, + { + "rfilename": "byte_marginalized/shard_0220.parquet", + "size": 1352823 + }, + { + "rfilename": "byte_marginalized/shard_0221.parquet", + "size": 1373874 + }, + { + "rfilename": "byte_marginalized/shard_0222.parquet", + "size": 1352005 + }, + { + "rfilename": "byte_marginalized/shard_0223.parquet", + "size": 1357238 + }, + { + "rfilename": "byte_marginalized/shard_0224.parquet", + "size": 1349690 + }, + { + "rfilename": "byte_marginalized/shard_0225.parquet", + "size": 1359020 + }, + { + "rfilename": "byte_marginalized/shard_0226.parquet", + "size": 1368290 + }, + { + "rfilename": "byte_marginalized/shard_0227.parquet", + "size": 1342331 + }, + { + "rfilename": "byte_marginalized/shard_0228.parquet", + "size": 1388798 + }, + { + "rfilename": "byte_marginalized/shard_0229.parquet", + "size": 3718556 + }, + { + "rfilename": "byte_marginalized/shard_0230.parquet", + "size": 1360583 + }, + { + "rfilename": "byte_marginalized/shard_0231.parquet", + "size": 1360678 + }, + { + "rfilename": "byte_marginalized/shard_0232.parquet", + "size": 2347227 + }, + { + "rfilename": "byte_marginalized/shard_0233.parquet", + "size": 1381614 + }, + { + "rfilename": "byte_marginalized/shard_0234.parquet", + "size": 1333091 + }, + { + "rfilename": "byte_marginalized/shard_0235.parquet", + "size": 1373587 + }, + { + "rfilename": "byte_marginalized/shard_0236.parquet", + "size": 1340140 + }, + { + "rfilename": "byte_marginalized/shard_0237.parquet", + "size": 1384784 + }, + { + "rfilename": "byte_marginalized/shard_0238.parquet", + "size": 1338618 + }, + { + "rfilename": "byte_marginalized/shard_0239.parquet", + "size": 1369614 + }, + { + "rfilename": "byte_marginalized/shard_0240.parquet", + "size": 1343555 + }, + { + "rfilename": "byte_marginalized/shard_0241.parquet", + "size": 1360032 + }, + { + "rfilename": "byte_marginalized/shard_0242.parquet", + "size": 1387205 + }, + { + "rfilename": "byte_marginalized/shard_0243.parquet", + "size": 1338798 + }, + { + "rfilename": "byte_marginalized/shard_0244.parquet", + "size": 1368286 + }, + { + "rfilename": "byte_marginalized/shard_0245.parquet", + "size": 1339563 + }, + { + "rfilename": "byte_marginalized/shard_0246.parquet", + "size": 1359895 + }, + { + "rfilename": "byte_marginalized/shard_0247.parquet", + "size": 1341721 + }, + { + "rfilename": "byte_marginalized/shard_0248.parquet", + "size": 1395792 + }, + { + "rfilename": "byte_marginalized/shard_0249.parquet", + "size": 1340150 + }, + { + "rfilename": "byte_marginalized/shard_0250.parquet", + "size": 1376724 + }, + { + "rfilename": "byte_marginalized/shard_0251.parquet", + "size": 1345404 + }, + { + "rfilename": "byte_marginalized/shard_0252.parquet", + "size": 1363247 + }, + { + "rfilename": "byte_marginalized/shard_0253.parquet", + "size": 1349438 + }, + { + "rfilename": "byte_marginalized/shard_0254.parquet", + "size": 1367036 + }, + { + "rfilename": "byte_marginalized/shard_0255.parquet", + "size": 1341414 + }, + { + "rfilename": "byte_marginalized/shard_0256.parquet", + "size": 1374788 + }, + { + "rfilename": "byte_marginalized/shard_0257.parquet", + "size": 1353671 + }, + { + "rfilename": "byte_marginalized/shard_0258.parquet", + "size": 1339346 + }, + { + "rfilename": "byte_marginalized/shard_0259.parquet", + "size": 1362196 + }, + { + "rfilename": "byte_marginalized/shard_0260.parquet", + "size": 1344538 + }, + { + "rfilename": "byte_marginalized/shard_0261.parquet", + "size": 1363958 + }, + { + "rfilename": "byte_marginalized/shard_0262.parquet", + "size": 1341330 + }, + { + "rfilename": "byte_marginalized/shard_0263.parquet", + "size": 1362675 + }, + { + "rfilename": "byte_marginalized/shard_0264.parquet", + "size": 1342239 + }, + { + "rfilename": "byte_marginalized/shard_0265.parquet", + "size": 1371777 + }, + { + "rfilename": "byte_marginalized/shard_0266.parquet", + "size": 1338042 + }, + { + "rfilename": "byte_marginalized/shard_0267.parquet", + "size": 1356000 + }, + { + "rfilename": "byte_marginalized/shard_0268.parquet", + "size": 1369084 + }, + { + "rfilename": "byte_marginalized/shard_0269.parquet", + "size": 1336420 + }, + { + "rfilename": "byte_marginalized/shard_0270.parquet", + "size": 1365898 + }, + { + "rfilename": "byte_marginalized/shard_0271.parquet", + "size": 1340265 + }, + { + "rfilename": "byte_marginalized/shard_0272.parquet", + "size": 1391736 + }, + { + "rfilename": "byte_marginalized/shard_0273.parquet", + "size": 1346250 + }, + { + "rfilename": "byte_marginalized/shard_0274.parquet", + "size": 1333205 + }, + { + "rfilename": "byte_marginalized/shard_0275.parquet", + "size": 1351007 + }, + { + "rfilename": "byte_marginalized/shard_0276.parquet", + "size": 1332942 + }, + { + "rfilename": "byte_marginalized/shard_0277.parquet", + "size": 1365464 + }, + { + "rfilename": "byte_marginalized/shard_0278.parquet", + "size": 1341828 + }, + { + "rfilename": "byte_marginalized/shard_0279.parquet", + "size": 1335452 + }, + { + "rfilename": "byte_marginalized/shard_0280.parquet", + "size": 1345126 + }, + { + "rfilename": "byte_marginalized/shard_0281.parquet", + "size": 1333830 + }, + { + "rfilename": "byte_marginalized/shard_0282.parquet", + "size": 1389008 + }, + { + "rfilename": "byte_marginalized/shard_0283.parquet", + "size": 1337200 + }, + { + "rfilename": "byte_marginalized/shard_0284.parquet", + "size": 1336690 + }, + { + "rfilename": "byte_marginalized/shard_0285.parquet", + "size": 1369396 + }, + { + "rfilename": "byte_marginalized/shard_0286.parquet", + "size": 1336372 + }, + { + "rfilename": "byte_marginalized/shard_0287.parquet", + "size": 1367097 + }, + { + "rfilename": "byte_marginalized/shard_0288.parquet", + "size": 1336942 + }, + { + "rfilename": "byte_marginalized/shard_0289.parquet", + "size": 1326879 + }, + { + "rfilename": "byte_marginalized/shard_0290.parquet", + "size": 1359826 + }, + { + "rfilename": "byte_marginalized/shard_0291.parquet", + "size": 1330973 + }, + { + "rfilename": "byte_marginalized/shard_0292.parquet", + "size": 1338487 + }, + { + "rfilename": "byte_marginalized/shard_0293.parquet", + "size": 1369082 + }, + { + "rfilename": "byte_marginalized/shard_0294.parquet", + "size": 1332014 + }, + { + "rfilename": "byte_marginalized/shard_0295.parquet", + "size": 1344454 + }, + { + "rfilename": "byte_marginalized/shard_0296.parquet", + "size": 1359566 + }, + { + "rfilename": "byte_marginalized/shard_0297.parquet", + "size": 1334888 + }, + { + "rfilename": "byte_marginalized/shard_0298.parquet", + "size": 1668449 + }, + { + "rfilename": "byte_marginalized/shard_0299.parquet", + "size": 1358863 + }, + { + "rfilename": "byte_marginalized/shard_0300.parquet", + "size": 1351369 + }, + { + "rfilename": "byte_marginalized/shard_0301.parquet", + "size": 1336513 + }, + { + "rfilename": "byte_marginalized/shard_0302.parquet", + "size": 1352556 + }, + { + "rfilename": "byte_marginalized/shard_0303.parquet", + "size": 1330484 + }, + { + "rfilename": "byte_marginalized/shard_0304.parquet", + "size": 1334701 + }, + { + "rfilename": "byte_marginalized/shard_0305.parquet", + "size": 1356473 + }, + { + "rfilename": "byte_marginalized/shard_0306.parquet", + "size": 1338875 + }, + { + "rfilename": "byte_marginalized/shard_0307.parquet", + "size": 1332930 + }, + { + "rfilename": "byte_marginalized/shard_0308.parquet", + "size": 1364076 + }, + { + "rfilename": "byte_marginalized/shard_0309.parquet", + "size": 1335625 + }, + { + "rfilename": "byte_marginalized/shard_0310.parquet", + "size": 1335941 + }, + { + "rfilename": "byte_marginalized/shard_0311.parquet", + "size": 1390587 + }, + { + "rfilename": "byte_marginalized/shard_0312.parquet", + "size": 1341424 + }, + { + "rfilename": "byte_marginalized/shard_0313.parquet", + "size": 1342094 + }, + { + "rfilename": "byte_marginalized/shard_0314.parquet", + "size": 1352929 + }, + { + "rfilename": "byte_marginalized/shard_0315.parquet", + "size": 1342119 + }, + { + "rfilename": "byte_marginalized/shard_0316.parquet", + "size": 1343262 + }, + { + "rfilename": "byte_marginalized/shard_0317.parquet", + "size": 1381358 + }, + { + "rfilename": "byte_marginalized/shard_0318.parquet", + "size": 1344476 + }, + { + "rfilename": "byte_marginalized/shard_0319.parquet", + "size": 1331857 + }, + { + "rfilename": "byte_marginalized/shard_0320.parquet", + "size": 1385338 + }, + { + "rfilename": "byte_marginalized/shard_0321.parquet", + "size": 1332137 + }, + { + "rfilename": "byte_marginalized/shard_0322.parquet", + "size": 1327357 + }, + { + "rfilename": "byte_marginalized/shard_0323.parquet", + "size": 1337084 + }, + { + "rfilename": "byte_marginalized/shard_0324.parquet", + "size": 1381441 + }, + { + "rfilename": "byte_marginalized/shard_0325.parquet", + "size": 1333382 + }, + { + "rfilename": "byte_marginalized/shard_0326.parquet", + "size": 1330120 + }, + { + "rfilename": "byte_marginalized/shard_0327.parquet", + "size": 1333849 + }, + { + "rfilename": "byte_marginalized/shard_0328.parquet", + "size": 1368819 + }, + { + "rfilename": "byte_marginalized/shard_0329.parquet", + "size": 1338314 + }, + { + "rfilename": "byte_marginalized/shard_0330.parquet", + "size": 1335293 + }, + { + "rfilename": "byte_marginalized/shard_0331.parquet", + "size": 1358311 + }, + { + "rfilename": "byte_marginalized/shard_0332.parquet", + "size": 1353028 + }, + { + "rfilename": "byte_marginalized/shard_0333.parquet", + "size": 1342306 + }, + { + "rfilename": "byte_marginalized/shard_0334.parquet", + "size": 1341481 + }, + { + "rfilename": "byte_marginalized/shard_0335.parquet", + "size": 1349541 + }, + { + "rfilename": "byte_marginalized/shard_0336.parquet", + "size": 1360002 + }, + { + "rfilename": "byte_marginalized/shard_0337.parquet", + "size": 1326482 + }, + { + "rfilename": "byte_marginalized/shard_0338.parquet", + "size": 1333918 + }, + { + "rfilename": "byte_marginalized/shard_0339.parquet", + "size": 1331897 + }, + { + "rfilename": "byte_marginalized/shard_0340.parquet", + "size": 1366760 + }, + { + "rfilename": "byte_marginalized/shard_0341.parquet", + "size": 1352587 + }, + { + "rfilename": "byte_marginalized/shard_0342.parquet", + "size": 1336853 + }, + { + "rfilename": "byte_marginalized/shard_0343.parquet", + "size": 1320568 + }, + { + "rfilename": "byte_marginalized/shard_0344.parquet", + "size": 1368118 + }, + { + "rfilename": "byte_marginalized/shard_0345.parquet", + "size": 1339220 + }, + { + "rfilename": "byte_marginalized/shard_0346.parquet", + "size": 1328450 + }, + { + "rfilename": "byte_marginalized/shard_0347.parquet", + "size": 1329506 + }, + { + "rfilename": "byte_marginalized/shard_0348.parquet", + "size": 1326895 + }, + { + "rfilename": "byte_marginalized/shard_0349.parquet", + "size": 1362547 + }, + { + "rfilename": "byte_marginalized/shard_0350.parquet", + "size": 1325376 + }, + { + "rfilename": "byte_marginalized/shard_0351.parquet", + "size": 1329005 + }, + { + "rfilename": "byte_marginalized/shard_0352.parquet", + "size": 1318395 + }, + { + "rfilename": "byte_marginalized/shard_0353.parquet", + "size": 1380368 + }, + { + "rfilename": "byte_marginalized/shard_0354.parquet", + "size": 1332320 + }, + { + "rfilename": "byte_marginalized/shard_0355.parquet", + "size": 1340907 + }, + { + "rfilename": "byte_marginalized/shard_0356.parquet", + "size": 1333339 + }, + { + "rfilename": "byte_marginalized/shard_0357.parquet", + "size": 1336794 + }, + { + "rfilename": "byte_marginalized/shard_0358.parquet", + "size": 1990148 + }, + { + "rfilename": "byte_marginalized/shard_0359.parquet", + "size": 1330510 + }, + { + "rfilename": "byte_marginalized/shard_0360.parquet", + "size": 1328911 + }, + { + "rfilename": "byte_marginalized/shard_0361.parquet", + "size": 1326087 + }, + { + "rfilename": "byte_marginalized/shard_0362.parquet", + "size": 1330204 + }, + { + "rfilename": "byte_marginalized/shard_0363.parquet", + "size": 1387823 + }, + { + "rfilename": "byte_marginalized/shard_0364.parquet", + "size": 1325113 + }, + { + "rfilename": "byte_marginalized/shard_0365.parquet", + "size": 1331958 + }, + { + "rfilename": "byte_marginalized/shard_0366.parquet", + "size": 1619250 + }, + { + "rfilename": "byte_marginalized/shard_0367.parquet", + "size": 1337722 + }, + { + "rfilename": "byte_marginalized/shard_0368.parquet", + "size": 1328413 + }, + { + "rfilename": "byte_marginalized/shard_0369.parquet", + "size": 1644393 + }, + { + "rfilename": "byte_marginalized/shard_0370.parquet", + "size": 2358646 + }, + { + "rfilename": "byte_marginalized/shard_0371.parquet", + "size": 1340186 + }, + { + "rfilename": "byte_marginalized/shard_0372.parquet", + "size": 1610329 + }, + { + "rfilename": "byte_marginalized/shard_0373.parquet", + "size": 1323145 + }, + { + "rfilename": "byte_marginalized/shard_0374.parquet", + "size": 1346525 + }, + { + "rfilename": "byte_marginalized/shard_0375.parquet", + "size": 1364951 + }, + { + "rfilename": "byte_marginalized/shard_0376.parquet", + "size": 1325691 + }, + { + "rfilename": "byte_marginalized/shard_0377.parquet", + "size": 1320573 + }, + { + "rfilename": "byte_marginalized/shard_0378.parquet", + "size": 1338869 + }, + { + "rfilename": "byte_marginalized/shard_0379.parquet", + "size": 1310347 + }, + { + "rfilename": "byte_marginalized/shard_0380.parquet", + "size": 1319603 + }, + { + "rfilename": "byte_marginalized/shard_0381.parquet", + "size": 1326267 + }, + { + "rfilename": "byte_marginalized/shard_0382.parquet", + "size": 1665090 + }, + { + "rfilename": "byte_marginalized/shard_0383.parquet", + "size": 1344920 + }, + { + "rfilename": "byte_marginalized/shard_0384.parquet", + "size": 1338653 + }, + { + "rfilename": "byte_marginalized/shard_0385.parquet", + "size": 1340595 + }, + { + "rfilename": "byte_marginalized/shard_0386.parquet", + "size": 1323692 + }, + { + "rfilename": "byte_marginalized/shard_0387.parquet", + "size": 1340745 + }, + { + "rfilename": "byte_marginalized/shard_0388.parquet", + "size": 1319406 + }, + { + "rfilename": "byte_marginalized/shard_0389.parquet", + "size": 1352370 + }, + { + "rfilename": "byte_marginalized/shard_0390.parquet", + "size": 1335443 + }, + { + "rfilename": "byte_marginalized/shard_0391.parquet", + "size": 1333008 + }, + { + "rfilename": "byte_marginalized/shard_0392.parquet", + "size": 1337387 + }, + { + "rfilename": "byte_marginalized/shard_0393.parquet", + "size": 1326181 + }, + { + "rfilename": "byte_marginalized/shard_0394.parquet", + "size": 1631060 + }, + { + "rfilename": "byte_marginalized/shard_0395.parquet", + "size": 1332325 + }, + { + "rfilename": "byte_marginalized/shard_0396.parquet", + "size": 1335706 + }, + { + "rfilename": "byte_marginalized/shard_0397.parquet", + "size": 1323820 + }, + { + "rfilename": "byte_marginalized/shard_0398.parquet", + "size": 1357829 + }, + { + "rfilename": "byte_marginalized/shard_0399.parquet", + "size": 1309381 + }, + { + "rfilename": "byte_marginalized/shard_0400.parquet", + "size": 1332271 + }, + { + "rfilename": "byte_marginalized/shard_0401.parquet", + "size": 1353768 + }, + { + "rfilename": "byte_marginalized/shard_0402.parquet", + "size": 1347711 + }, + { + "rfilename": "byte_marginalized/shard_0403.parquet", + "size": 1328082 + }, + { + "rfilename": "byte_marginalized/shard_0404.parquet", + "size": 1315403 + }, + { + "rfilename": "byte_marginalized/shard_0405.parquet", + "size": 1329755 + }, + { + "rfilename": "byte_marginalized/shard_0406.parquet", + "size": 1315828 + }, + { + "rfilename": "byte_marginalized/shard_0407.parquet", + "size": 1327434 + }, + { + "rfilename": "byte_marginalized/shard_0408.parquet", + "size": 1328524 + }, + { + "rfilename": "byte_marginalized/shard_0409.parquet", + "size": 1329882 + }, + { + "rfilename": "byte_marginalized/shard_0410.parquet", + "size": 1319061 + }, + { + "rfilename": "byte_marginalized/shard_0411.parquet", + "size": 1344774 + }, + { + "rfilename": "byte_marginalized/shard_0412.parquet", + "size": 1338198 + }, + { + "rfilename": "byte_marginalized/shard_0413.parquet", + "size": 1326816 + }, + { + "rfilename": "byte_marginalized/shard_0414.parquet", + "size": 1336154 + }, + { + "rfilename": "byte_marginalized/shard_0415.parquet", + "size": 1367468 + }, + { + "rfilename": "byte_marginalized/shard_0416.parquet", + "size": 1384660 + }, + { + "rfilename": "byte_marginalized/shard_0417.parquet", + "size": 1319381 + }, + { + "rfilename": "byte_marginalized/shard_0418.parquet", + "size": 1349342 + }, + { + "rfilename": "byte_marginalized/shard_0419.parquet", + "size": 1321310 + }, + { + "rfilename": "byte_marginalized/shard_0420.parquet", + "size": 1323335 + }, + { + "rfilename": "byte_marginalized/shard_0421.parquet", + "size": 1340832 + }, + { + "rfilename": "byte_marginalized/shard_0422.parquet", + "size": 1314308 + }, + { + "rfilename": "byte_marginalized/shard_0423.parquet", + "size": 1338534 + }, + { + "rfilename": "byte_marginalized/shard_0424.parquet", + "size": 1318321 + }, + { + "rfilename": "byte_marginalized/shard_0425.parquet", + "size": 1320677 + }, + { + "rfilename": "byte_marginalized/shard_0426.parquet", + "size": 1323349 + }, + { + "rfilename": "byte_marginalized/shard_0427.parquet", + "size": 1330485 + }, + { + "rfilename": "byte_marginalized/shard_0428.parquet", + "size": 1321976 + }, + { + "rfilename": "byte_marginalized/shard_0429.parquet", + "size": 1326869 + }, + { + "rfilename": "byte_marginalized/shard_0430.parquet", + "size": 1312451 + }, + { + "rfilename": "byte_marginalized/shard_0431.parquet", + "size": 1367614 + }, + { + "rfilename": "byte_marginalized/shard_0432.parquet", + "size": 1341131 + }, + { + "rfilename": "byte_marginalized/shard_0433.parquet", + "size": 1325300 + }, + { + "rfilename": "byte_marginalized/shard_0434.parquet", + "size": 1325900 + }, + { + "rfilename": "byte_marginalized/shard_0435.parquet", + "size": 1327354 + }, + { + "rfilename": "byte_marginalized/shard_0436.parquet", + "size": 1336869 + }, + { + "rfilename": "byte_marginalized/shard_0437.parquet", + "size": 1324788 + }, + { + "rfilename": "byte_marginalized/shard_0438.parquet", + "size": 1346632 + }, + { + "rfilename": "byte_marginalized/shard_0439.parquet", + "size": 1323242 + }, + { + "rfilename": "byte_marginalized/shard_0440.parquet", + "size": 1322832 + }, + { + "rfilename": "byte_marginalized/shard_0441.parquet", + "size": 1326342 + }, + { + "rfilename": "byte_marginalized/shard_0442.parquet", + "size": 1326357 + }, + { + "rfilename": "byte_marginalized/shard_0443.parquet", + "size": 1332023 + }, + { + "rfilename": "byte_marginalized/shard_0444.parquet", + "size": 1338020 + }, + { + "rfilename": "byte_marginalized/shard_0445.parquet", + "size": 1319964 + }, + { + "rfilename": "byte_marginalized/shard_0446.parquet", + "size": 1307278 + }, + { + "rfilename": "byte_marginalized/shard_0447.parquet", + "size": 1322585 + }, + { + "rfilename": "byte_marginalized/shard_0448.parquet", + "size": 1318607 + }, + { + "rfilename": "byte_marginalized/shard_0449.parquet", + "size": 1327213 + }, + { + "rfilename": "byte_marginalized/shard_0450.parquet", + "size": 1352150 + }, + { + "rfilename": "byte_marginalized/shard_0451.parquet", + "size": 1336189 + }, + { + "rfilename": "byte_marginalized/shard_0452.parquet", + "size": 1314002 + }, + { + "rfilename": "byte_marginalized/shard_0453.parquet", + "size": 1323446 + }, + { + "rfilename": "byte_marginalized/shard_0454.parquet", + "size": 1317968 + }, + { + "rfilename": "byte_marginalized/shard_0455.parquet", + "size": 1324335 + }, + { + "rfilename": "byte_marginalized/shard_0456.parquet", + "size": 1308220 + }, + { + "rfilename": "byte_marginalized/shard_0457.parquet", + "size": 1356216 + }, + { + "rfilename": "byte_marginalized/shard_0458.parquet", + "size": 1328997 + }, + { + "rfilename": "byte_marginalized/shard_0459.parquet", + "size": 1308908 + }, + { + "rfilename": "byte_marginalized/shard_0460.parquet", + "size": 1320150 + }, + { + "rfilename": "byte_marginalized/shard_0461.parquet", + "size": 1319516 + }, + { + "rfilename": "byte_marginalized/shard_0462.parquet", + "size": 2578842 + }, + { + "rfilename": "byte_marginalized/shard_0463.parquet", + "size": 1320868 + }, + { + "rfilename": "byte_marginalized/shard_0464.parquet", + "size": 1353760 + }, + { + "rfilename": "byte_marginalized/shard_0465.parquet", + "size": 1322213 + }, + { + "rfilename": "byte_marginalized/shard_0466.parquet", + "size": 1319708 + }, + { + "rfilename": "byte_marginalized/shard_0467.parquet", + "size": 1352781 + }, + { + "rfilename": "byte_marginalized/shard_0468.parquet", + "size": 5715125 + }, + { + "rfilename": "byte_marginalized/shard_0469.parquet", + "size": 1308051 + }, + { + "rfilename": "byte_marginalized/shard_0470.parquet", + "size": 1328174 + }, + { + "rfilename": "byte_marginalized/shard_0471.parquet", + "size": 1311371 + }, + { + "rfilename": "byte_marginalized/shard_0472.parquet", + "size": 1305838 + }, + { + "rfilename": "byte_marginalized/shard_0473.parquet", + "size": 1308207 + }, + { + "rfilename": "byte_marginalized/shard_0474.parquet", + "size": 1339796 + }, + { + "rfilename": "byte_marginalized/shard_0475.parquet", + "size": 1318693 + }, + { + "rfilename": "byte_marginalized/shard_0476.parquet", + "size": 1318817 + }, + { + "rfilename": "byte_marginalized/shard_0477.parquet", + "size": 1320298 + }, + { + "rfilename": "byte_marginalized/shard_0478.parquet", + "size": 1308045 + }, + { + "rfilename": "byte_marginalized/shard_0479.parquet", + "size": 1323739 + }, + { + "rfilename": "byte_marginalized/shard_0480.parquet", + "size": 1323049 + }, + { + "rfilename": "byte_marginalized/shard_0481.parquet", + "size": 1318078 + }, + { + "rfilename": "stream_carry.pkl", + "size": 6275929 + }, + { + "rfilename": "stream_checkpoint.json", + "size": 219 + } + ] +} \ No newline at end of file diff --git a/evaluation/dataset_reader_source.json b/evaluation/dataset_reader_source.json new file mode 100644 index 0000000000000000000000000000000000000000..b4d14575451b0b673a9706559ba491575f1f0821 --- /dev/null +++ b/evaluation/dataset_reader_source.json @@ -0,0 +1,7 @@ +{ + "repo": "Cukinator/cpu1-ablations-final", + "revision": "702ac8b8616c25454dede9a13b057c4da0a8f97b", + "file": "evaluation/source/cpu1/components.py", + "sha256": "b15779c727a0554bc3dd9ca028e79bfa7bb27e7ff48dce80c1a4239b7a764bc8", + "matches_reviewed_local": true +} \ No newline at end of file diff --git a/evaluation/dataset_readme_publication.json b/evaluation/dataset_readme_publication.json new file mode 100644 index 0000000000000000000000000000000000000000..a82f7ae9c312bb0dc633f6de827d7c36a168db06 --- /dev/null +++ b/evaluation/dataset_readme_publication.json @@ -0,0 +1,11 @@ +{ + "published": true, + "repo": "Cukinator/cpu1-ablation-dataset", + "parent": "bd75d7b811ab730cc912aaa671f9eaaf49ba4bdf", + "commit": "97206ec5714484e1abfbd7c30b42e2bbef27d221", + "url": "https://huggingface.co/datasets/Cukinator/cpu1-ablation-dataset/commit/97206ec5714484e1abfbd7c30b42e2bbef27d221", + "readme_sha256": "83076bbeb21eeb7858b659a48087a3804c392122f0b272a6b7c168689a7f1eb8", + "modified_files": [ + "README.md" + ] +} \ No newline at end of file diff --git a/evaluation/dataset_readme_review.json b/evaluation/dataset_readme_review.json new file mode 100644 index 0000000000000000000000000000000000000000..29861176f9192672e214fbde009874191f37fbe5 --- /dev/null +++ b/evaluation/dataset_readme_review.json @@ -0,0 +1,39 @@ +{ + "repo": "Cukinator/cpu1-ablation-dataset", + "parent": "bd75d7b811ab730cc912aaa671f9eaaf49ba4bdf", + "removed_sections": 1, + "inventory": { + "byte_marginalized": { + "files": 480, + "bytes": 686841331, + "range": [ + 0, + 481 + ], + "missing": [ + 60, + 61 + ] + }, + "bpe_tokenized": { + "files": 437, + "bytes": 67332026716, + "range": [ + 0, + 438 + ], + "missing": [ + 60, + 61 + ] + } + }, + "viewer_rows": { + "bpe_tokenized": 21928, + "byte_marginalized": 24101 + }, + "source_hashes": { + "data_pipeline/prepare.py": "13c6127dd203b4e4b33ea74b251a53bb5da3b121e1dedcb6b48dbc1226906c57", + "cpu1/components.py": "b15779c727a0554bc3dd9ca028e79bfa7bb27e7ff48dce80c1a4239b7a764bc8" + } +} \ No newline at end of file diff --git a/evaluation/dataset_readme_samples.json b/evaluation/dataset_readme_samples.json new file mode 100644 index 0000000000000000000000000000000000000000..1f4799534c204fb478a7936be961113e672f7a66 --- /dev/null +++ b/evaluation/dataset_readme_samples.json @@ -0,0 +1,104 @@ +[ + { + "file": "byte_marginalized/shard_0000.parquet", + "download_bytes": 1921771, + "rows": 50, + "schema": "patches: list\n child 0, element: uint8\ntargets: list\n child 0, element: uint8\nteacher_probs: list\n child 0, element: float\nteacher_mask: list\n child 0, element: bool\nteacher_hidden: list\n child 0, element: float\nteacher_dim: int32", + "signal_rows": 10, + "true_positions": 1468, + "total_positions": 5561, + "samples": [ + { + "row": 0, + "seq_len": 5000, + "signal_positions": 1333, + "patches_length": 20000, + "teacher_dim": 128, + "hidden_length": 640000 + }, + { + "row": 1, + "seq_len": 42, + "signal_positions": 7, + "patches_length": 20000, + "teacher_dim": 128, + "hidden_length": 5376 + }, + { + "row": 2, + "seq_len": 0, + "signal_positions": 0, + "patches_length": 20000, + "teacher_dim": 128, + "hidden_length": 0 + }, + { + "row": 5, + "seq_len": 59, + "signal_positions": 16, + "patches_length": 20000, + "teacher_dim": 128, + "hidden_length": 7552 + }, + { + "row": 10, + "seq_len": 62, + "signal_positions": 16, + "patches_length": 20000, + "teacher_dim": 128, + "hidden_length": 7936 + }, + { + "row": 17, + "seq_len": 63, + "signal_positions": 11, + "patches_length": 20000, + "teacher_dim": 128, + "hidden_length": 8064 + } + ] + }, + { + "file": "byte_marginalized/shard_0481.parquet", + "download_bytes": 1318078, + "rows": 50, + "schema": "patches: list\n child 0, element: uint8\ntargets: list\n child 0, element: uint8\nteacher_probs: list\n child 0, element: float\nteacher_mask: list\n child 0, element: bool\nteacher_hidden: list\n child 0, element: float\nteacher_dim: int32", + "signal_rows": 1, + "true_positions": 111, + "total_positions": 513, + "samples": [ + { + "row": 0, + "seq_len": 0, + "signal_positions": 0, + "patches_length": 20000, + "teacher_dim": 128, + "hidden_length": 0 + }, + { + "row": 1, + "seq_len": 0, + "signal_positions": 0, + "patches_length": 20000, + "teacher_dim": 128, + "hidden_length": 0 + }, + { + "row": 2, + "seq_len": 0, + "signal_positions": 0, + "patches_length": 20000, + "teacher_dim": 128, + "hidden_length": 0 + }, + { + "row": 13, + "seq_len": 513, + "signal_positions": 111, + "patches_length": 20000, + "teacher_dim": 128, + "hidden_length": 65664 + } + ] + } +] \ No newline at end of file diff --git a/evaluation/dataset_readme_validation.json b/evaluation/dataset_readme_validation.json new file mode 100644 index 0000000000000000000000000000000000000000..933eb5840d1d50caa8e4f130e2b51c335d6114ef --- /dev/null +++ b/evaluation/dataset_readme_validation.json @@ -0,0 +1,23 @@ +{ + "yaml_metadata_valid": true, + "configs_preserved": true, + "python_example_syntax_valid": true, + "tokenizer_revision": "3aab1f1954e9cc14eb9509a215f9e5ca08227a9b", + "tokenizer_sha256": "c0382117ea329cdf097041132f6d735924b697924d6f6fc3945713e96ce87539", + "utf8_example_reproduced": true, + "readme_sha256": "83076bbeb21eeb7858b659a48087a3804c392122f0b272a6b7c168689a7f1eb8", + "sample_shape_checks": [ + { + "file": "shard_0000.parquet", + "rows": 50, + "patch_lengths_verified_all_rows": true, + "teacher_dim_verified_all_rows": 128 + }, + { + "file": "shard_0481.parquet", + "rows": 50, + "patch_lengths_verified_all_rows": true, + "teacher_dim_verified_all_rows": 128 + } + ] +} \ No newline at end of file diff --git a/evaluation/dataset_stream_checkpoint.json b/evaluation/dataset_stream_checkpoint.json new file mode 100644 index 0000000000000000000000000000000000000000..1abf65cc2a8689990c1e49b9804396f622e0611d --- /dev/null +++ b/evaluation/dataset_stream_checkpoint.json @@ -0,0 +1,10 @@ +{ + "last_completed_chunk": 943, + "byte_seq_offset": 24571, + "bpe_seq_offset": 22354, + "shard_offset": 469, + "initial_byte_seq_offset": 23906, + "initial_bpe_seq_offset": 21765, + "byte_shard_offset": 482, + "bpe_shard_offset": 439 +} \ No newline at end of file diff --git a/evaluation/dataset_viewer_info.json b/evaluation/dataset_viewer_info.json new file mode 100644 index 0000000000000000000000000000000000000000..daf8c3c76d2c161879de38890f5c72dbddd2cd08 --- /dev/null +++ b/evaluation/dataset_viewer_info.json @@ -0,0 +1,125 @@ +{ + "dataset_info": { + "bpe_tokenized": { + "description": "", + "citation": "", + "homepage": "", + "license": "", + "features": { + "input_ids": [ + { + "dtype": "int32", + "_type": "Value" + } + ], + "labels": [ + { + "dtype": "int32", + "_type": "Value" + } + ], + "teacher_probs_bpe": [ + { + "dtype": "float32", + "_type": "Value" + } + ], + "teacher_ids_bpe": [ + { + "dtype": "int32", + "_type": "Value" + } + ], + "teacher_mask_bpe": [ + { + "dtype": "bool", + "_type": "Value" + } + ] + }, + "builder_name": "parquet", + "dataset_name": "cpu1-ablation-dataset", + "config_name": "bpe_tokenized", + "version": { + "version_str": "0.0.0", + "major": 0, + "minor": 0, + "patch": 0 + }, + "splits": { + "train": { + "name": "train", + "num_bytes": 86422439125, + "num_examples": 21928, + "dataset_name": null + } + }, + "download_size": 67332026716, + "dataset_size": 86422439125 + }, + "byte_marginalized": { + "description": "", + "citation": "", + "homepage": "", + "license": "", + "features": { + "patches": [ + { + "dtype": "uint8", + "_type": "Value" + } + ], + "targets": [ + { + "dtype": "uint8", + "_type": "Value" + } + ], + "teacher_probs": [ + { + "dtype": "float32", + "_type": "Value" + } + ], + "teacher_mask": [ + { + "dtype": "bool", + "_type": "Value" + } + ], + "teacher_hidden": [ + { + "dtype": "float32", + "_type": "Value" + } + ], + "teacher_dim": { + "dtype": "int32", + "_type": "Value" + } + }, + "builder_name": "parquet", + "dataset_name": "cpu1-ablation-dataset", + "config_name": "byte_marginalized", + "version": { + "version_str": "0.0.0", + "major": 0, + "minor": 0, + "patch": 0 + }, + "splits": { + "train": { + "name": "train", + "num_bytes": 1020517295, + "num_examples": 24101, + "dataset_name": null + } + }, + "download_size": 686841331, + "dataset_size": 1020517295 + } + }, + "pending": [], + "failed": [], + "partial": false +} \ No newline at end of file diff --git a/evaluation/publication.json b/evaluation/publication.json index 9509c54c0dadce783e08632dcfb3e679743c69f9..51ddb342ac706d74a1fb781bc4465a8f1406a611 100644 --- a/evaluation/publication.json +++ b/evaluation/publication.json @@ -1,10 +1,10 @@ { "Cukinator/cpu1-ablations-final": { - "oid": "304d4a9f7414da8682aae5825daa16e40d74713a", - "url": "https://huggingface.co/Cukinator/cpu1-ablations-final/commit/304d4a9f7414da8682aae5825daa16e40d74713a" + "oid": "702ac8b8616c25454dede9a13b057c4da0a8f97b", + "url": "https://huggingface.co/Cukinator/cpu1-ablations-final/commit/702ac8b8616c25454dede9a13b057c4da0a8f97b" }, "Cukinator/cpu1-ablation-checkpoints": { - "oid": "be12dfa7e74a4604e1bc65bf74e09cc45e3eb0f9", - "url": "https://huggingface.co/Cukinator/cpu1-ablation-checkpoints/commit/be12dfa7e74a4604e1bc65bf74e09cc45e3eb0f9" + "oid": "71283b6871f3e985fd60f9e0fa85e9686d97e1aa", + "url": "https://huggingface.co/Cukinator/cpu1-ablation-checkpoints/commit/71283b6871f3e985fd60f9e0fa85e9686d97e1aa" } } diff --git a/evaluation/source-publication.json b/evaluation/source-publication.json new file mode 100644 index 0000000000000000000000000000000000000000..23710ff63c6bb8c30f4b75a30259df1cd1ebcf19 --- /dev/null +++ b/evaluation/source-publication.json @@ -0,0 +1,91 @@ +{ + "github_repository": "https://github.com/igna-s/New-1.58", + "github_commit": "8735951d374bed75aff70d847a5d6ac79d3da4d5", + "files": { + ".gitattributes": "457dbb741f820794688e0934a02bffc3660ac1091f1b7d0fca4640f1adf04749", + ".gitignore": "44c57a5b5b7d73bc2498e51ae90d12dd0ebaae431dd53338132d967700e3ab1b", + "README.md": "f89707058a8e64a907686684f4832adbae1f491cfda07d6d40e19d93825b73e5", + "cpu1/__init__.py": "9f16cd75dd837dca808a55f40d8bf68110dfaf7a59df123a1ceedbe5b659c743", + "cpu1/components.py": "b15779c727a0554bc3dd9ca028e79bfa7bb27e7ff48dce80c1a4239b7a764bc8", + "cpu1/hub_storage.py": "fb0613cf5b268bbbb940064cd242337be72d29e1bcfd4c91e12aa4c8ae8b618c", + "data_pipeline/__init__.py": "95a7a6bac095b69e397bd2d9fad2bbeccd82a634b67515e37951ed411a335253", + "data_pipeline/prepare.py": "1dec272889a340dfd4ca9e8f31fb7f3502f13996dc89b29a723a65e888a464e4", + "docs/model_cards/cpu1-ablation-checkpoints.md": "e20bcf6b586a1d9ecddbcf64896dd648ed93426d82ab0b56bd357dd01599f558", + "docs/model_cards/cpu1-ablation-dataset.md": "3839d16f63b2b06445e78a77d4c4a151dff51877ca7bf110d0ae82d4b88884a1", + "docs/model_cards/cpu1-ablations-final.md": "228228c416cbddff8b37d5804b103ba8228a3768d6d18e37d0799f701922d483", + "docs/provenance/README.md": "0b53e44e2f77a7b29219dfd91bbc6bf851efd5cb67d7d05253581daccbf9eac1", + "docs/provenance/history-map.json": "4844c4f4846ebfa29b453f2f63212c3205beeaa65ff89c3b9346a9131f1b31a0", + "docs/provenance/restored-files.json": "375851361c523d97e046f90bcefb6e54ef90ee97906d783f5b6595e7e7275bb0", + "docs/provenance/source-versions.json": "0e2553126d3d201dd708eb8fbe8f92077545f8d1835d524eb69e224eefa89843", + "evaluation/__init__.py": "ef0acd0ba11be04bb2425048cc458521b9f5b64cee211ed8fd734c8388081531", + "evaluation/audit.py": "7a859e7f2237ae7acea1660c419f4bb038367e7184d952bba460fe82f3e8c955", + "evaluation/cards.py": "584bc5d5c3fd1f59829a8eda0ef8aeef13508f1b830b011f5d6d84fa3d4f5c43", + "evaluation/checkpoints.py": "0c952ec22f3e17a494f6930d89f2494ee643b05dd0256200cf5b45db5f1db969", + "evaluation/correctness.py": "ca4b17d44f81fe15ae6f71e001e37fc2fb7c1e4d4c5f39496a1decd88a43127b", + "evaluation/dataset.py": "88081223b70c600d1c770185d06103ecfc2b50acf065b7b14fc8d48b259f14ac", + "evaluation/diagnostics.py": "a30f4ff5ecd2e63c32215654569dd0354fc44751806e942dfe3a91a524a60de7", + "evaluation/export.py": "d31cecb4f6280a4ab9177d3972a05f38fe65a4adc051099b5ba1e04d62146779", + "evaluation/helpers.py": "0001568714f754de3b5e01e600f5de1ac3636424104a551cd0a0ebfea3ba9ee3", + "evaluation/verify_checkpoints.py": "8db0ad3860fdc97ce9ce8a101992e021666c6e378aa1971488bd2950b139758a", + "experiments/README.md": "642d82b72167e414fcbcb2b13d3b93bf0f70a076415e23b70236ed068cf20333", + "experiments/published/configs/run_01.json": "e2f98fd9fdc8cdfabd7e2f72f2b3b04d4268a2b870e0d4ba2e4c4e2098d6f629", + "experiments/published/configs/run_01_v3.json": "0f4c9db036b8b264c5ad5580c86afeeebe4a29e036206e60a433b0b5ab4dda0c", + "experiments/published/configs/run_02.json": "e908d470890f410d9dc15583946a9b51a3532b75f111c9a542dca11a3edbe0d6", + "experiments/published/configs/run_02_v3.json": "7c4954e3131a65f7e582c4a09b630fa9eaf1dc1c7885e2dadc05a47fa1313b14", + "experiments/published/configs/run_02a_byte_only_heads.json": "7d46728d4bc47eca5f4466cf629d5bacb3ba7439408fc925df54606f43c1ee04", + "experiments/published/configs/run_02a_byte_only_heads_v3.json": "3afc68d32cbde4be5bc7ee586d2f058a6c5c1137e53bfefc0617228c1b67d6b5", + "experiments/published/configs/run_03.json": "9bc89e9a5bddad995155773ea045f70f72fc98ecabf89c821c0ef0b0ceba9ac1", + "experiments/published/configs/run_03_v3.json": "6ab5bedcd96448e00f65e47cf809aa482c72cb8d713e34389bb844655d1170df", + "experiments/published/configs/run_04.json": "6f25943422b4da024a608e0a0f577623d2e611686ac8357da7923514c4804b49", + "experiments/published/configs/run_04_r2.json": "187928a4b35b4983653f13d2e3adfd0040f5c51736338cd93afb92e1b58eafe8", + "experiments/published/configs/run_04_v3.json": "fbf755ddaf8bfb4123b1df6cbeaad0b65e4b14e0065a7b936ad2edbd6d06ea4a", + "experiments/published/configs/run_05.json": "4e04b8cca73a9f299034a429a5bf711f3e419909b2ebd91c9d7865e318efae8b", + "experiments/published/configs/run_05_v3.json": "36e28f0ccd488ac8c9b3a3b8695a3c9c854524b97bf7d25d0f05bdd5743a97e4", + "experiments/published/configs/run_05b_kernel_strict.json": "3d43c99ac50d3a57a75139fa2ceccd5c3ed63b826d21a8fa8a8b932bbc5f5924", + "experiments/published/configs/run_05b_kernel_strict_v3.json": "8d9d6d41140985130c78f9dec9bb84ddb5f031eebe3d89d1237755a8027481e7", + "experiments/published/configs/run_06.json": "d0698be1854b8a50f7d0b504d86719de59a88caa28be41e04bf57349bc8951b8", + "experiments/published/configs/run_06_v3.json": "44c0f88735708a071d351f967746b909ef77b23f6724015ee43c84781b6d32b2", + "experiments/published/configs/run_07.json": "347a3f9ca8ca26decfcfcb720be554eac62251a793ce708d755ce0283b73cb9b", + "experiments/published/configs/run_07_r2.json": "b92329e2e123104c8282afaf736cda831f5b08d2abfd9b843b8159e3f13194d3", + "experiments/published/configs/run_08.json": "f93ed9c4057564dc019d3ace1f2d8010f1b56c79d3c89d581e55b2921f78474f", + "experiments/published/configs/run_08_v3.json": "b3f464f363095fe8fce71b8c7f9d409563c675187ea5ba0b96d6fb46110877d3", + "experiments/published/configs/run_09.json": "da8577c7a668e8bfce7553074a835ba5bc88683d228e5dcbfb1705c87428c0b5", + "experiments/published/configs/run_10.json": "4b036ebc04ed65e2bc469e7a51c2daf2777c6b58875db280c240d9677c7c6571", + "experiments/published/configs/run_13.json": "dfaba6de44e6bb36d768b08dfdfe9e555eb6c53ea354f7c6391aa34d66710aff", + "experiments/published/configs/run_13_r2.json": "cdd1de12b675d1cc65e519ea169f5fcb6cad34d6cb98c46425da01db3a358ac8", + "experiments/published/configs/run_13_v3.json": "843976af95d0bb2dd2345e57d2cf3d12855367774ad8a25b6187a9dca4e5f39a", + "experiments/published/configs/run_14.json": "498592c3dcd1bcb5b078b6446c05f00e3713305577eb73735c60d09a385c2e8e", + "experiments/published/configs/run_14_r2.json": "6747d092b87090f9d34e29ce0d68be88d1c732961a89967acbcd45b5a96091fd", + "experiments/published/configs/run_14_v3.json": "dcca5697cdb6901d2def389f5d3574828d9f09bd1ffe4c07c70e86860d54e905", + "experiments/published/configs/run_15.json": "c7592ef602f1443e1c3e1f72d29e149b3977b4fb49db0308dc3d8603317b5048", + "experiments/published/configs/run_15_r2.json": "58b95f087f3c3659940cc5168fcbc7b65422bb8bdaecb478477fa97e45859eb7", + "experiments/published/configs/run_15_v3.json": "8e5ed148279277102b3d9b1646f69299d6dedfe5a84ebf101c046a9c3b5005e4", + "experiments/published/configs/run_16.json": "035e01bdf4b072c76178b66a139a0eb66d0903a62601677a61fd49b1becd43ba", + "experiments/published/configs/run_16_r2.json": "644b2e47deca224a25fd0ef6fab0d99d27caeb24277f9779616241c7b7dd4c4a", + "experiments/published/manifest.json": "1ec0485bc9e4ce3a6e443591bf7a3f5a6dd99bd552f203726fa7e6b075640c03", + "inference/benchmark.c": "ec138f47c04d404f9065838e2ad4ad697d085832f3e43c45a3f3750e1e16b922", + "inference/kernels.cpp": "685e06e9442fbd2562467ceabf3190394c6c6d602b0b2b6bbf140e7eb6489883", + "inference/links.md": "8e7d62f17be500d5f9629f9aa4b111843313c22d3a27e2d82cdb829ffac5c4eb", + "requirements/audit.txt": "d4cd80befb82eef6bec41623836c66583951ed8dac4b4b6afc8187678bdd5810", + "requirements/data.txt": "3b3b9f2c265b3bce339de1c58c3fdf4976afd17d5c6ae05a11bb0427ed35d95c", + "requirements/training.txt": "b205597310eac63edfec212c19e364d8a89f8114f38c303232e230d0adf01b00", + "runners/__init__.py": "4832dbde3f23ef5d50fe82254a20d2c67692af39c4735e7e53587de6388f039f", + "runners/common.py": "7f010ad5e4dd861af878a88192c46662aafcd6fba1d4f73526930b373ff78caf", + "runners/kaggle.py": "9398d06fec35d76ec73496997073f101ce34fc6243c5b6c523963a3abc63bf0b", + "runners/lightning.py": "93d98e41c0513efb3fa997ae7b7b778c4f73392498a96b58e7b283302b2e07ba", + "tests/__init__.py": "910bf1675373205e8daf5c0eef563516dd5c128e2e6109faa1149b1be9b9f673", + "tests/test_audit.py": "77b905f32b310502cf937ed41600f409eb8c3d896c9a58bb390840a6907dff4f", + "tests/test_checkpoints.py": "b8eaa367af92d5b951b13233446355bcbc4bef2354398c932b9c2033f57a0629", + "tests/test_provenance.py": "eac25666f55131b08fec32c4a52575b7d28803f563fb26b41eb0192862ef2e7b", + "training/__init__.py": "88ea9f3bbe25c928a9b7ee8f588491c0f928a41133f65581e965002c1dce9693", + "training/ablation.py": "4125cafe4f5cfd927719876cdf64b74c986ad99593433769254e48dd6490f7c5", + "training/ablation_amd.py": "80eac0b0a6ccec30887542f5aa8818f00269d9618a4987cd553a411184434975", + "training/configuration.py": "91dac15233dd19584c6c7b6d5222f7779a44af8dab1c71508415a6a67697c5ce", + "training/final.py": "80c82ee9d8d9de0c59d83a94bb5916779431bb398031718abc322e6582d76909" + }, + "scope": "Tracked public source/documentation snapshot; weights and stored datasets unchanged; original model-audit metadata retained", + "offline_tests": 14, + "recorded_architectures_verified": 34, + "restored_historical_paths": 148, + "public_commits": 90 +} diff --git a/evaluation/source/.gitattributes b/evaluation/source/.gitattributes new file mode 100644 index 0000000000000000000000000000000000000000..cf7558ffce8b00767086de4137b2e3a635222714 --- /dev/null +++ b/evaluation/source/.gitattributes @@ -0,0 +1,2 @@ +# Keep published JSON checksums identical on Windows and Linux. +*.json text eol=lf diff --git a/evaluation/source/.gitignore b/evaluation/source/.gitignore new file mode 100644 index 0000000000000000000000000000000000000000..f13ff67775b6ec17de0bbda339e1ce731711b5f5 --- /dev/null +++ b/evaluation/source/.gitignore @@ -0,0 +1,94 @@ +# Local assets, archived code, and generated reports +/local/ +/outputs/ +/models/ +/papers/ +/resultados/ +/Prompts/ +/prompts/ +/checkpoints/ +/dataset/ +/shared_dataset/ +/logprobs/ +/run_*/ +/small_*/ +/run_logs/ +/run_results.json +metrics_run_*.json +ablation_results.json +ablation_table.tex +checkpoint_run_* + +# Virtual environments, credentials, and personal tools +.venv/ +venv/ +env/ +ENV/ +.env +.env.* +!.env.example +.claude/ +.claudeignore +.codex/ +.agents/ +.aws/ +.ssh/ +.azure/ +.gcloud/ +.kaggle/ +.cache/ +/secrets/ +/credentials/ +*.pem +*.key +*.p12 +*.pfx +*.jks +.netrc +_netrc +.pypirc +.npmrc +kaggle.json +credentials.json +service-account*.json +service_account*.json +application_default_credentials.json +.vscode/ +.idea/ + +# Python and notebook caches +__pycache__/ +*.py[cod] +*.egg-info/ +.Python +.ipynb_checkpoints/ +build/ +dist/ +*.egg + +# Downloaded weights, datasets, and binary build outputs +*.pt +*.pth +*.bin +*.safetensors +*.gguf +*.onnx +*.parquet +*.arrow +*.pdf +*.exe +*.dll +*.so +*.o +*.obj +*.pyd +llamacpp/ + +# Logs and temporary files +*.log +*.tmp +runs/ +wandb/ +.DS_Store +Thumbs.db +*.swp diff --git a/evaluation/source/README.md b/evaluation/source/README.md new file mode 100644 index 0000000000000000000000000000000000000000..880d81f7f73ca03a33385c7bef5c84e02ca91bcc --- /dev/null +++ b/evaluation/source/README.md @@ -0,0 +1,504 @@ +# CPU-1: byte-patch and ternary language-model research + +CPU-1 studies language models intended for CPU inference: four-byte patches, recurrent MLGRU token mixing, ternary projections, and small floating-point modules. This repository contains the PyTorch reference implementation, ablation training and dataset pipelines, checkpoint codecs, native C/C++ kernel experiments, and reproducible evaluation evidence. + +The published collection contains **34 research checkpoints with 10.7M–54.7M parameters**. Larger configurations in the source are development targets. These models are not instruction-tuned assistants, and the audit found numerical, causality, and recurrent-state defects that limit their use. + +## Contents + +- [Published artifacts](#published-artifacts) +- [Verified status and results](#verified-status-and-results) +- [Architecture](#architecture) +- [Ablation experiments](#ablation-experiments) +- [Installation and storage](#installation-and-storage) +- [Load, score, and generate](#load-score-and-generate) +- [Training](#training) +- [Datasets and teacher signals](#datasets-and-teacher-signals) +- [Checkpoint formats and export](#checkpoint-formats-and-export) +- [Reproduce the evaluation](#reproduce-the-evaluation) +- [Native CPU kernels](#native-cpu-kernels) +- [Experiment provenance and recovered history](#experiment-provenance-and-recovered-history) +- [Repository map](#repository-map) +- [Current limitations and next work](#current-limitations-and-next-work) +- [Research references](#research-references) +- [License](#license) + +## Published artifacts + +| Artifact | Contents at the audited revision | Documentation | +|---|---|---| +| [FP32 exports](https://huggingface.co/Cukinator/cpu1-ablations-final) | 34 `/model.pt` files; 4.178 GB total | [Complete model card](docs/model_cards/cpu1-ablations-final.md) | +| [Training archive](https://huggingface.co/Cukinator/cpu1-ablation-checkpoints) | 1,346 `.pt` files across 34 folders: 21 finals and 1,325 steps; 215.178 GB / 200.400 GiB | [Archive card and inventory](docs/model_cards/cpu1-ablation-checkpoints.md) | +| [Teacher dataset](https://huggingface.co/datasets/Cukinator/cpu1-ablation-dataset) | Byte and BPE Parquet subsets with precomputed teacher signals | [Local dataset documentation](docs/model_cards/cpu1-ablation-dataset.md) | + +These are custom PyTorch payloads, not Transformers model packages. Use the model factory in this repository. The archive is much larger than the exports; download one named file rather than an entire repository snapshot. + +The audit pins export revision `65951289352c1a036b12ba6d888af037e7c90b13` and archive revision `fb402d025e843ed00fb990966bf2430c32eb958c`. Later README publications do not change the assessed weights. Exact paths, sizes, and LFS hashes are in [inventory.json](https://huggingface.co/Cukinator/cpu1-ablations-final/blob/d38678e7c5d18577f36edade64495237c72a44b5/evaluation/inventory.json). + +## Verified status and results + +The **2026-10-06 CPU audit** attempted every published FP32 export under a common protocol. Failures overlap; they are not separate groups of models. + +| Check | Observed result | +|---|---| +| Strict checkpoint loading | 34/34 loaded with no missing or unexpected state keys | +| Finite loss on the shared corpus | 30/34; four exports produced nonfinite loss | +| Prefix causality | 16 PASS, 14 FAIL, 4 ERROR | +| Recurrent chunk equivalence | All 26 MLGRU exports failed; 8 Transformer exports were N/A | +| Packed/FP32 example | The `run_04` pair loaded strictly with finite outputs and identical decoded state dictionaries | + +The numerical failures are `run_01_v3`, `run_02_v3`, `run_02a_byte_only_heads_v3`, and `run_08_v3`. They loaded successfully; their outputs/loss failed numerical evaluation. + +Representative results illustrate the different units and checks. The [complete card](docs/model_cards/cpu1-ablations-final.md) contains all 34 rows and generated samples. + +| Export | Saved step | Mean NLL | Byte PPL | Bits/byte | Prefix causality | Chunk equivalence | +|---|---:|---:|---:|---:|---|---| +| `run_01` | 912 | 5.3742 per mapped BPE token | N/A | N/A | PASS | N/A | +| `run_02` | 647 | 1.9702 per byte | 7.1723 | 2.8424 | PASS | N/A | +| `run_03_v3` | 6,187 | 1.7640 per byte | 5.8357 | 2.5449 | PASS | FAIL | +| `run_04_v3` | 6,074 | 1.5515 per byte | 4.7187 | 2.2384 | PASS | FAIL | +| `run_06_v3` | 4,237 | 1.0572 per byte | 2.8784 | 1.5253 | FAIL | FAIL | +| `run_14_v3` | 9,775 | 0.8811 per byte | 2.4136 | 1.2712 | FAIL | FAIL | + +These are diagnostics on **32 short WikiText test passages**, not full benchmark scores. Low full-sequence loss from a model that fails causality may benefit from future input and does not establish causal prediction quality. A recurrent model can pass prefix causality yet fail equivalence between full-sequence and incremental execution. Check both columns before interpreting a result. + +BPE maps Qwen token IDs outside the student vocabulary to ID 0. The mapped fraction in this sample was about 14.26% for the 16K vocabulary and 31.77% for the 4K vocabulary. Token PPL, byte PPL, and bits/byte measure different units. Different parameter counts, saved steps, signals, and budgets prevent treating the table as a controlled component ranking. + +Timing uses PyTorch FP32 on an Intel Core i7-8750H with one thread. For example, `run_04_v3` measured 3.49 isolated forward steps/s and 21.74–25.91 generated bytes/s across three prompts. A forward step excludes autoregressive local-byte sampling; it is not a generation rate. See its [raw result](https://huggingface.co/Cukinator/cpu1-ablations-final/blob/d38678e7c5d18577f36edade64495237c72a44b5/evaluation/run_04_v3.json) for conditions and samples. + +## Architecture + +The saved checkpoint `config` selects the actual model. The byte path is: + +```mermaid +flowchart LR + A[UTF-8 bytes] --> B[Four-byte patches] + B --> C[Patch embedding] + C --> D[Global blocks: MLGRU or attention] + D --> E[Final RMSNorm] + E --> F[LocalByteDecoder or independent byte heads] + F --> G[Next-patch byte distributions] +``` + +Global input patch `i` predicts patch `i+1`. The local decoder predicts each byte from the global representation and the preceding target bytes within that next patch. Shifted targets enter through `byte_targets`; future bytes within the target patch must not enter an earlier byte prediction. Without `byte_targets`, the decoder receives zero placeholders, suitable for shape checks but not teacher-forced likelihood scoring. + +| Component | Role in the implementation | +|---|---| +| `BitLinear` / `BitEmbedding` | Simulate ternary weights with scales and straight-through gradients; Python uses floating-point operations | +| MLGRU | Intended recurrence `h[t] = f[t] * h[t-1] + (1-f[t]) * c[t]`; retains per-layer state | +| Sliding-window attention | Transformer mixer alternative; the ablation inference wrapper has no persistent KV cache | +| RMSNorm / SwiGLU | Normalization and feed-forward computation | +| `FPResidual` | Optional low-rank floating-point mixer correction | +| `PFNet` | Optional small nonlinear residual, sized by `pfnet_hidden` | +| `BolmoPatchEmbedding` | Boundary scoring and byte cross-attention, optionally across adjacent patches | +| `LocalByteDecoder` | Autoregressive next-patch prediction; usually width 128 and four heads | +| Independent byte heads | Control predicting patch positions independently | +| `DeleteGate` | Second-phase state selection/merging with hard/soft and gather controls | +| `EmbeddingAligner` | Optional projected teacher hidden-state supervision | + +The `byte_dynamic` label can select boundary-aware embedding while the model still accepts fixed four-byte patches. Inspect gates and the actual forward path before assuming variable-length patching or a measured compression ratio. + +The ternary alphabet has `log2(3) β‰ˆ 1.585` bits of information per value. The codec packs each ternary value into **two bits**, with scales and other floating-point tensors stored separately. FP32 exports use four bytes per parameter. Packed disk size, unpacked parameter RAM, peak process RAM, and native throughput are distinct measurements. + +## Ablation experiments + +The main family uses width 512, 12 layers, and FFN width 1,376. The small family uses width 320, 8 layers, and FFN width 853. Counts come from loaded published models; historical β€œ50M” and β€œ10M” labels are approximate design names. + +| Base run | Representation / mixer | Main distinction | Actual parameters | +|---|---|---|---:| +| `run_01` | 16K BPE / Transformer | Floating-point baseline | 54.735M | +| `run_02a_byte_only_heads` | Bytes / Transformer | Independent byte heads | 38.501M | +| `run_02` | Bytes / Transformer | LocalByteDecoder | 38.830M | +| `run_03` | Bytes / MLGRU | Floating-point recurrent control | 38.830M | +| `run_04` | Bytes / MLGRU | Ternary projections | 38.854M | +| `run_05` | Bytes / MLGRU | Adds FPResidual | 38.994M | +| `run_05b_kernel_strict` | Bytes / MLGRU | Removes the MLGRU output projection | 35.842M | +| `run_06` | Boundary-aware bytes / MLGRU | Adds Bolmo embedding | 38.994M | +| `run_07` | Boundary-aware bytes / MLGRU | Adds DeleteGate | 39.029M | +| `run_08` | Bytes / Transformer | Ternary attention control | 38.854M | +| `run_09` | Boundary-aware bytes / MLGRU | Adds PFNet, hidden width 32 | 39.428M | +| `run_10` | Boundary-aware bytes / MLGRU | Adds learned per-channel decay | 39.434M | +| `run_13` | 4K BPE / MLGRU | Small model, teacher distillation | 12.548M | +| `run_14` | Boundary-aware bytes / MLGRU | Small model, teacher distillation | 10.691M | +| `run_15` | Boundary-aware bytes / MLGRU | Adds teacher hidden-state alignment | 10.732M | +| `run_16` | Boundary-aware bytes / MLGRU | Small CE-only control on raw FineWeb | 10.691M | + +Published exports include selected `_r2` and `_v3` names. Current training presets include selected `_r2` and `_r3` names; **published names and current CLI presets are not identical**. Use `--config experiments/published/configs/.json` to select one of the 34 recorded published configurations; without it, the CLI uses current presets. See [the manifest](experiments/published/manifest.json). A suffix does not prove that architecture, data exposure, or training settings stayed constant. + +Source budgets use `chinchilla_tokens_per_param` (including 2, 15, and 50 in different rounds). These are configured targets, not measured exposure. Complete saved configs and steps are in [the audit records](https://huggingface.co/Cukinator/cpu1-ablations-final/tree/d38678e7c5d18577f36edade64495237c72a44b5/evaluation). + +## Installation and storage + +The audit used Python 3.12.10 and PyTorch 2.6.0+cu124 on Windows 11, running on the CPU. Recorded dependencies include Transformers 5.3.0, tokenizers 0.22.2, huggingface_hub 1.19.0, datasets 4.8.3, and NumPy 2.3.5. See [environment.json](https://huggingface.co/Cukinator/cpu1-ablations-final/blob/d38678e7c5d18577f36edade64495237c72a44b5/evaluation/environment.json) for the full setup. The repository does not provide a dependency lockfile. + +These PowerShell examples keep the checkout, downloads, and caches on **D:**: + +```powershell +git clone https://github.com/igna-s/New-1.58.git D:/cpu1/New-1.58 +Set-Location D:/cpu1/New-1.58 +New-Item -ItemType Directory -Force D:/cpu1/hf, D:/cpu1/datasets, D:/cpu1/temp, D:/cpu1/pip-cache | Out-Null +$env:HF_HOME = "D:/cpu1/hf" +$env:HF_HUB_CACHE = "D:/cpu1/hf/hub" +$env:HF_DATASETS_CACHE = "D:/cpu1/datasets" +$env:TEMP = "D:/cpu1/temp" +$env:TMP = "D:/cpu1/temp" +$env:PIP_CACHE_DIR = "D:/cpu1/pip-cache" +$env:HF_HUB_DISABLE_XET = "1" +python -m venv .venv +.venv/Scripts/Activate.ps1 +python -m pip install torch --index-url https://download.pytorch.org/whl/cpu +python -m pip install -r requirements/audit.txt +``` + +This is enough for loading and CPU auditing without the teacher. For GPU training, first install the PyTorch build for your OS and accelerator using the [official installation selector](https://pytorch.org/get-started/locally/), then install the relevant dependency set: + +```powershell +python -m pip install -r requirements/training.txt +# Both CUDA and ROCm entry points use this dependency set. +``` + +Training dependencies are in `requirements/training.txt`; CPU evaluation adds `requirements/audit.txt`, and teacher extraction uses `requirements/data.txt`. Optional teacher quantization requires a suitable `bitsandbytes` or `torchao` installation. PyTorch is installed separately. Both ablation scripts otherwise install requirements when launched; use `--skip-install` after setup. ROCm uses the `torch.cuda` API here; device/OS support depends on the installed build. + +Set cache variables before importing Hugging Face libraries; see their [environment variable reference](https://huggingface.co/docs/huggingface_hub/package_reference/environment_variables). The audit enforces D: storage, runs one model at a time, and deletes its downloaded `model.pt` after saving results. Manual examples retain one checkpoint until removed. Training writes checkpoints/logs relative to the working directory, so use the D: checkout to keep those outputs there. + +Public downloads need no write token. Publishing and training uploads use your own `HF_TOKEN` through the environment or Hugging Face authentication; keep credentials outside tracked files. Scripts report only whether the token is configured, without revealing its characters. The card uploader hides interactive token entry. Private key files, credential JSONs, and local secret directories are also ignored. + +## Load, score, and generate + +Run examples from the repository root. `AutoModelForCausalLM.from_pretrained()` cannot load these checkpoints. This loads the audited `run_04` FP32 export and scores correctly shifted byte targets: + +```python +import os +os.environ["HF_HOME"] = "D:/cpu1/hf" +os.environ["HF_HUB_DISABLE_XET"] = "1" + +import torch +import torch.nn.functional as F +from huggingface_hub import hf_hub_download +from training.ablation import build_ablation_model + +torch.set_num_threads(1) +path = hf_hub_download( + "Cukinator/cpu1-ablations-final", "run_04/model.pt", + revision="65951289352c1a036b12ba6d888af037e7c90b13", + local_dir="D:/cpu1/active", cache_dir="D:/cpu1/hf/hub", +) +# Trusted checkpoint from the pinned project source. +payload = torch.load(path, map_location="cpu", weights_only=False) +config = dict(payload["config"]) +config["use_gradient_checkpointing"] = False +model = build_ablation_model(config) +model.load_state_dict(payload["state_dict"], strict=True) +model.eval() +del payload + +patch_size = config["patch_size"] +raw = list(b"The history of artificial intelligence is long.") +patches = torch.tensor(raw[:len(raw) // patch_size * patch_size]).reshape(1, -1, patch_size) +x, targets = patches[:, :-1], patches[:, 1:] +with torch.inference_mode(): + heads, states, extra = model( + x, byte_targets=targets, training_phase=1, target_elimination=0.0, + ) + logits = torch.stack(heads, dim=2) # [batch, input patches, byte positions, 256] + nll = F.cross_entropy(logits.reshape(-1, 256), targets.reshape(-1)) +assert torch.isfinite(nll) +print("Mean NLL per byte:", nll.item()) +``` + +This is a loadable example, not a quality recommendation. For a packed final, replace payload extraction with `state, config = load_ablation_checkpoint(path)` from `training.ablation`, then build and load `state` strictly. Download the named archive file only after releasing/removing the previous model. [Loading evidence](https://huggingface.co/Cukinator/cpu1-ablations-final/blob/d38678e7c5d18577f36edade64495237c72a44b5/evaluation/loading_examples.json) verifies only the `run_04` export/archive pair. + +Sample bytes with the loaded CPU model using the audit helper: + +```python +from evaluation.audit import generation +torch.manual_seed(42) +generated = generation(model, config, "The history of artificial intelligence", length=128) +print(generated.decode("utf-8", errors="replace")) +``` + +The helper prefills recurrent state once and carries it thereafter; Transformer variants retain and recompute context instead. Sampling uses temperature 1.0, top-k 40, top-p 0.9, and sequential local-byte prediction. Prompt bytes are zero-padded to a patch boundary. Invalid UTF-8 can occur; replacement decoding is only for display, and the audit retains raw bytes as hex. Inspect samples and state failures before interpreting generation results. + +Training scripts also expose inference through top-of-file `TRAIN`, `INFER`, and `INFER_CONFIG` settings. That built-in path is separate from the helper used for fresh audit measurements. + +## Training + +### Individual ablations + +The standard entry point is [training/ablation.py](training/ablation.py). With dependencies installed: + +```powershell +# Synthetic CPU data; checks training plumbing. +python -m training.ablation --run run_04 --dry_run --total_steps 2 --skip-install + +# Dataset and budget selected by the preset. +python -m training.ablation --run run_04 --skip-install + +# Resume a local intermediate checkpoint. +python -m training.ablation --run run_04 --resume_ckpt D:/cpu1/checkpoint_run_04_step640.pt --skip-install +``` + +Dry runs use synthetic CPU data with the preset model and sequence length; `--total_steps` limits steps, not memory. For a small CPU check, reduce the preset sequence length and batch settings first. Synthetic runs do not establish quality or real-data throughput. Normal training selects CUDA/ROCm devices, uses AdamW parameter groups and mixed precision, and supports multiple GPUs. `--total_steps` overrides the calculated budget. Presets and optimizer controls are in `BASE_CONFIG`, `ALL_RUN_CONFIGS`, and `get_run_config()`. + +Without `--resume_ckpt`, normal training can automatically download the latest matching phase's step checkpoint from its configured checkpoint repository. For a separate fresh experiment, set `checkpoint_repo` and the output run directory appropriately. Training saves under `/`, records metrics, and attempts Hub uploads using configured authentication. Finals are inference artifacts; intermediate checkpoints can include optimizer state. + +### DeleteGate phases + +Runs in `TWO_PHASE_RUNS` automatically chain ordinary training into DeleteGate training. The gate is active in phase 2; a phase-1 gate's presence does not prove training or its elimination target. Start phase 2 explicitly with: + +```powershell +python -m training.ablation --run run_07 --phase 2 --phase1_ckpt D:/cpu1/run_07/checkpoint_run_07_final.pt --skip-install +``` + +Inspect saved `_current_phase`; the final filename alone does not distinguish phases. The common audit disables elimination (`training_phase=1`, `target_elimination=0.0`), so it does not measure gate compression or phase-2 speedups. + +### Orchestration and AMD + +```powershell +# Cap execution at one training process. +python -m training.ablation --orchestrate --runs run_04 run_05 --max-parallel 1 --skip-install + +# Indices refer to PARALLEL_GROUPS in the source. +python -m training.ablation --orchestrate --groups 2 3 --max-parallel 1 --skip-install + +# ROCm-oriented entry point with its dependencies installed. +python -m training.ablation_amd --run run_04 --skip-install +``` + +Orchestration assigns visible GPU slots, processes groups in order, chains required phases, and logs to `run_logs/` unless `--log-dir` changes it. `--steps` sets orchestration budgets; single-run mode uses `--total_steps`. Non-dry orchestrated subprocesses automatically request `--hf-mount` and fall back to download if mounting fails. Child processes reuse the parent environment and skip dependency installation. Training can retain multiple checkpoints with one active process; the one-file cleanup policy belongs to the audit. + +### Larger CPU1ModelV2 path + +[training/final.py](training/final.py) constructs `CPU1ModelV2` separately from ablations. Defaults in `cpu1/components.py` are width 1,024, 14 layers, FFN width 2,730, FPResidual rank 8, and PFNet hidden width 64. They do not identify a published, evaluated production model. + +```powershell +# Synthetic check; still constructs the larger model. +python -m training.final --dry-run --dry-run-samples 2 --seq-len 8 --batch-per-gpu 1 --total-steps 1 --output-dir D:/cpu1/final-smoke + +# Inspect this separate development CLI. +python -m training.final --help +``` + +Phase 1 selects CE-only FineWeb by default, but its DataLoader currently requests `shuffle=True` for an iterable streaming dataset; that path needs a loader correction before normal training. The larger training path was not validated by the export audit. + +Its options use hyphens: `--resume-from`, `--data-path`, `--phase2`, and `--phase1-ckpt`, unlike ablation underscore options. `--upload-hf` enables phase-1 uploads. Precomputed distillation data is selected through `--data-path`; the teacher is not run automatically. Consult `--help` and phase-2 code for separate output behavior. + +## Datasets and teacher signals + +`load_ablation_dataset()` in [cpu1/components.py](cpu1/components.py) routes presets as follows: + +| Route | Representation and supervision | +|---|---| +| `HuggingFaceFW/fineweb` | Streams `sample-10BT`; preset selects byte/BPE adaptation and CE training | +| `cpu1-ablation-dataset` / `byte_marginalized` | Patches, shifted targets, teacher probabilities/masks, optional projected hidden states | +| `cpu1-ablation-dataset` / `bpe_tokenized` | Token IDs, shifted labels, teacher top-k probabilities/IDs/masks | +| Dry run | Synthetic tensors matching the interface | + +At revision `bd75d7b811ab730cc912aaa671f9eaaf49ba4bdf`, the dataset has 480 byte Parquet files (0.687 GB compressed) and 437 BPE files (67.332 GB compressed). IDs 0060 and 0061 are absent in both ranges. Unequal subsets must not be zipped by row or shard index. These are file-listing measurements; row counts and teacher coverage were not fully audited. + +Only `train` is declared by the dataset card. The adapter can use `split_info.json`; without it, validation selects the last 5% while training retains the full dataset. That fallback does **not** establish an independent held-out set. Fresh model evaluation uses a separate WikiText test corpus. + +The non-mounted precomputed loader selects shards up to a nominal 5 GiB per subset and deletes the configured datasets cache if its size exceeds 10 GiB. Use a dedicated `HF_DATASETS_CACHE` directory for this loader. Byte and BPE runs can therefore see different coverage. `--hf-mount` selects a mounted-shard path; it does not establish document equivalence. + +Inspect one row without downloading the complete dataset: + +```python +import os +os.environ["HF_HOME"] = "D:/cpu1/hf" +os.environ["HF_DATASETS_CACHE"] = "D:/cpu1/datasets" +from datasets import load_dataset +rows = load_dataset( + "Cukinator/cpu1-ablation-dataset", "byte_marginalized", + revision="bd75d7b811ab730cc912aaa671f9eaaf49ba4bdf", + split="train", streaming=True, cache_dir="D:/cpu1/datasets", +) +print(next(iter(rows)).keys()) +``` + +### Building teacher data + +[data_pipeline/prepare.py](data_pipeline/prepare.py) extracts `Qwen/Qwen2.5-3B` signals over FineWeb and builds both representations, with local, Hub-streaming, and mounted workflows. Writer settings include four-byte patches, 5,000-step sequences, top-128 BPE teacher entries, and projected hidden width 128. Inspect rows and `teacher_dim`; not every stored shard has been checked against these settings. + +Byte supervision marginalizes BPE candidates to their first byte at mapped boundaries and uses coverage masks. It is not a complete joint teacher distribution for all four bytes. BPE student vocabularies also filter/map out-of-range IDs. + +```powershell +# Alignment/marginalization tests; no full teacher extraction. +python -m data_pipeline.prepare + +# Full extraction/build/publication; needs teacher compute and Hub write auth. +python -m data_pipeline.prepare --n_docs 50000 --stream-to-hub + +# Convert extracted logprobs into local training data. +python -m data_pipeline.prepare --logprobs-dir D:/cpu1/logprobs --output-dir D:/cpu1/dataset +``` + +The [platform recipes](docs/provenance/README.md#current-platform-recipes) print a plan until `--execute` is supplied. Kaggle preserves the 500-document chunk recipe and Lightning the 3,000-document recipe, both with a configured 850,000-document target. These targets do not establish the number actually processed. The full pipeline can publish as it builds; it is not a read-only preview. `--skip_extraction` reuses extraction output, `--only_upload` publishes existing data, and `--shard-offset` sets numbering. Full-pipeline output defaults to `./shared_dataset`. Current package-based launchers live in `runners/`; the original platform wrappers and notebooks are preserved in Git history. Optional mounts use `cpu1/hub_storage.py` and require a separately installed hf-mount on Linux/macOS. + +## Checkpoint formats and export + +| Payload | Intended use | Loading | +|---|---|---| +| `format="fp32"` | Unpacked parameters, config, step, metrics, run name, source metadata | `torch.load()`, factory, strict `state_dict` loading | +| `format="compact_2bit"` | Packed ternary final with scales and remaining float tensors | `load_ablation_checkpoint()` to decode, then build/load | +| Floating-point final | Baseline inference artifact | Inspect `format`; use checkpoint loader | +| Intermediate step | Model/config and, where saved, optimizer/resumption state | Matching training entry point | + +Inspect payloads instead of assuming every final is packed or every step interchangeable. Historical `metrics` may be empty or use older protocols; fresh evidence is separate. + +[evaluation/export.py](evaluation/export.py) reads local finals at `local/models/ablation_models//checkpoint__final.pt` and writes `local/models/ablations_final//model.pt`: + +```powershell +python -m evaluation.export --runs run_04 --skip-upload +``` + +The source final must exist locally. The exporter does not recreate every current Hub export automatically. Without `--skip-upload`, it can publish models and a README; use the complete audit/card workflow for fresh results. Model files and cache/build outputs are excluded by `.gitignore`. + +## Reproduce the evaluation + +Use the activated CPU environment from installation: + +```powershell +# Pinned collection, one model file at a time. +python -m evaluation.audit --storage D:/cpu1-readme-audit --threads 1 + +# Force fresh evaluation of named exports. +python -m evaluation.audit --storage D:/cpu1-readme-audit --threads 1 --runs run_04 run_14_v3 --force + +# Restore the published metadata/corpus only, without downloading any model. +python -m evaluation.audit --storage D:/cpu1-readme-audit --restore-evidence + +# Generate local cards from complete evidence; preserves this root README. +python -m evaluation.audit --storage D:/cpu1-readme-audit --cards + +# Publish both model cards and evidence with owner write authentication. +python -m evaluation.audit --storage D:/cpu1-readme-audit --upload + +# Evaluator regression checks; no model downloads. +python -m unittest discover -s tests -v + +# Isolate the scan defect without a checkpoint. +python -m evaluation.diagnostics +``` + +A clean checkout contains source and documentation, not model weights or generated reports. `--restore-evidence` downloads the published JSONs and corpus license for card regeneration without evaluating models. For a new audit, the model/corpus revisions remain pinned. Existing records are reused when the evaluator hash matches; `--force` reruns them. Card generation requires all 34 records at the pinned revision with consistent evaluator/corpus hashes. Upload verifies audited model paths, sizes, and LFS hashes still match before publishing. These commands update `outputs/audit/` and local Hub templates. + +Scoring takes the first 32 non-heading WikiText test paragraphs with at least 260 UTF-8 bytes, truncating to 260 bytes. Byte scoring uses the first patch as context, shifted next-patch targets, and correct local teacher forcing. Loss is weighted by target count. BPE uses the training vocabulary mapping. Batch size is 1, no teacher is loaded, and elimination is disabled. + +Correctness covers shapes, probabilities, determinism, recurrent carry, and prefix causality. Timing separates 10 warmup / 100 measured single-input forwards from real generation. Byte samples use three prompts, 128 bytes each, seeds 42–44, temperature 1.0, top-k 40, and top-p 0.9. BPE generation is N/A because its lossy mapping is not comparable to byte sampling. + +| Evidence | Contents | +|---|---| +| [inventory.json](https://huggingface.co/Cukinator/cpu1-ablations-final/blob/d38678e7c5d18577f36edade64495237c72a44b5/evaluation/inventory.json) | Model revisions, sizes, and LFS hashes | +| [corpus.json](https://huggingface.co/Cukinator/cpu1-ablations-final/blob/d38678e7c5d18577f36edade64495237c72a44b5/evaluation/corpus.json) | Exact passages, upstream revision, selection | +| [environment.json](https://huggingface.co/Cukinator/cpu1-ablations-final/blob/d38678e7c5d18577f36edade64495237c72a44b5/evaluation/environment.json) | Packages, hardware, threads, source metadata | +| [Per-run JSON files](https://huggingface.co/Cukinator/cpu1-ablations-final/tree/d38678e7c5d18577f36edade64495237c72a44b5/evaluation) | Configs, loading, losses, failures, timings, raw generated bytes | +| [implementation_diagnostics.json](https://huggingface.co/Cukinator/cpu1-ablations-final/blob/d38678e7c5d18577f36edade64495237c72a44b5/evaluation/implementation_diagnostics.json) | Parallel scan versus serial and chunked execution | +| [loading_examples.json](https://huggingface.co/Cukinator/cpu1-ablations-final/blob/d38678e7c5d18577f36edade64495237c72a44b5/evaluation/loading_examples.json) | Sequential packed/FP32 `run_04` smoke checks | +| [publication.json](https://huggingface.co/Cukinator/cpu1-ablations-final/blob/d38678e7c5d18577f36edade64495237c72a44b5/evaluation/publication.json) | Published Hub card commit IDs | + +The Qwen tokenizer's resolved commit was not captured (`null` in the environment record). Models and corpus are pinned, but this missing pin limits exact BPE reproducibility. Dependencies are recorded rather than locked. + +The current tree contains the common audit and its supporting tools. Historical runners, experimental variants and 34 older training reports are preserved in Git history; they use different protocols and are not fresh evaluation results. Historical evidence remains on Hugging Face; restored reports and newly generated results stay under ignored `outputs/audit/`. + +## Native CPU kernels + +[inference/kernels.cpp](inference/kernels.cpp) implements experimental packed-weight kernels and forward paths. [inference/benchmark.c](inference/benchmark.c) is a C++-compiled driver using **random weights and synthetic inputs**. It does not load published trained checkpoints, and the Python audit does not call it. + +Build from the root with a GCC/MinGW toolchain supporting AVX2, FMA, and OpenMP: + +```powershell +g++ -O3 -mavx2 -mfma -fopenmp -falign-loops=32 -funroll-loops -ffast-math -std=c++11 -x c++ -o benchmark.exe inference/benchmark.c inference/kernels.cpp -lm +./benchmark.exe --mode 2 --threads 1 --patches 100 --warmup 20 --local 1 +``` + +| Mode | Benchmark path | +|---:|---| +| 0 | Full forward with OpenMP | +| 1 | Per-layer forward | +| 2 | Single-thread full forward | +| 3 | Multiple independent streams via `--batch` | +| 4 | Layer pipeline via `--chunk`, `--stages`, `--pin`, `--calibrate` | + +The driver accepts `--d_model`, `--n_layers`, `--d_ff`, and `--fp_rank`; defaults differ from the larger PyTorch model. `--local 1` includes local decoding. Multi-stream aggregate and pipeline patch throughput are not end-to-end trained-model generation. [Build notes](inference/links.md) cover further experiments; trained-checkpoint loading and numerical parity need separate verification. + +## Experiment provenance and recovered history + +The first cleanup filtered experimental code too broadly. The correction restores **148 historical paths**: extraction/marginalization, early architectures, ablation implementations, Kaggle/Lightning code and notebooks, historical evaluation/inference, and 34 training reports plus their summary. The 87 original commits and the security commit retain their messages, authors, dates and relationships after remapping; historical hashes change. The current tree keeps the organized packages. + +[The provenance review](docs/provenance/README.md) explains every category. [The restored-file manifest](docs/provenance/restored-files.json) lists all recovered paths, their hashes and source links, plus the 109 paths still excluded. [The history map](docs/provenance/history-map.json) maps original commit IDs to their public replacements. Downloaded weights/caches, papers, compiled outputs and credentials remain excluded. + +[The published configuration manifest](experiments/published/manifest.json) binds 34 configuration records to pinned checkpoint hashes, saved steps, audited parameter counts and result URLs. The `_v3` records preserve the 150 tokens/parameter setting, consistent with the AMD preset. This does not establish each job's source commit or platform. The records came from the audit loader, which disabled gradient checkpointing; GPU training enables it. They are not an untouched copy of the checkpoint configuration bytes. + +```powershell +# Print cloud recipes without starting work. +python -m runners.kaggle dataset +python -m runners.lightning dataset +python -m runners.lightning ablation --backend amd --run run_04_v3 --config experiments/published/configs/run_04_v3.json + +# Inspect three pinned dataset shards and a synthetic tokenizer case, using D:. +python -m evaluation.dataset --storage D:/cpu1-readme-audit --tokenizer +``` + +The dataset inspection reproduced a dense-signal reader mismatch (1,333 nonzero stored distributions became 369) and short boolean masks treated as indices. The tokenizer test also reproduced replacement-character decoding for partial UTF-8 tokens. See [the dataset card](docs/model_cards/cpu1-ablation-dataset.md) for sample scope and evidence. These defects remain visible; the recovery did not repair data or trained behavior, retrain models, or re-date the October 6 model evaluation. Exact end-to-end reconstruction remains limited by missing job/source/environment and per-shard extraction records. + +## Repository map + +```text +cpu1/ + components.py Shared modules, adapters, losses, checkpoint codecs + hub_storage.py Optional HF mounts; credentials in child environment +training/ + ablation.py Main training/inference entry point and presets + ablation_amd.py ROCm-oriented variant + final.py Larger CPU1ModelV2 training path + configuration.py Explicit published configuration loader +data_pipeline/ + prepare.py Teacher extraction and dataset preparation +runners/ Kaggle/Lightning recipes; CUDA or AMD training +experiments/published/ 34 config records and pinned checkpoint manifest +evaluation/ + audit.py Common scoring, correctness, timing and generation + checkpoints.py Strict checkpoint loader and model metadata + correctness.py Architecture-aware correctness checks + cards.py Model-card generation and publication + export.py Packed-to-FP32 export + diagnostics.py Isolated recurrence diagnostic + verify_checkpoints.py Sequential packed/FP32 loading example + helpers.py Check result handling + dataset.py Pinned shard/reader/tokenizer inspection +inference/ Native kernels, synthetic benchmark, build notes +tests/ Offline evaluator and integration tests +docs/model_cards/ Three canonical model/dataset cards +docs/provenance/ Recovery report, file manifest and commit map +requirements/ Training, audit and data dependency sets +README.md Project guide and verified status +.gitignore Local assets, credentials, reports and build outputs +``` + +`local/` holds private checkpoints, reference material, and archived files on the developer machine. `outputs/` holds generated reports. Both directories are ignored and absent from a clean GitHub checkout. Training run folders, virtual environments, caches, and model/dataset binaries are also ignored. Published evaluation evidence and model weights are linked from Hugging Face rather than duplicated in this repository. + +## Current limitations and next work + +`AblationMLGRU._parallel_scan()` differs from its defining serial recurrence and chunked execution. With the saved seed/shape, maximum differences were 19.1005 and 11.4713 against tolerance `1e-4`. The `cummax`/`cumsum` construction does not correctly rescale cumulative terms when its stabilizing maximum changes. This is an implementation defect, not a successful streaming test. + +Saved Bolmo configurations with noncausal boundary/cross-patch context allow future patches to change prefix logits in 14 exports. Fixing causality flags or recurrence changes behavior, so repairs need fresh evaluation rather than inheriting these scores. Existing weights may need retraining. + +Next milestones: resolve and validate teacher array positional layout and UTF-8 conversion; correct and validate recurrence; make the boundary path causal in full and incremental execution; define independent, comparable splits; rerun quality/generation; and establish trained-checkpoint parity for native kernels. This collection currently has no demonstrated larger-model production result, reliable gate speedup, external leaderboard result, or packed native generation rate. + +## Research references + +The project draws ideas from these papers; experimental local code should not be assumed to reproduce their implementations or results: + +- [Scalable MatMul-free Language Modeling](https://arxiv.org/abs/2406.02528): recurrent mixing and low-bit projections. +- [MEGABYTE: Predicting Million-byte Sequences with Multiscale Transformers](https://arxiv.org/abs/2305.07185): global/local byte prediction. +- [Bolmo](https://arxiv.org/abs/2512.15586): byte-level modeling and boundary experiments. +- [MrT5](https://arxiv.org/abs/2410.20771): learned deletion/merging. +- [HGRN2](https://arxiv.org/abs/2404.07904): gated recurrence and state expansion ideas. +- [T-MAC](https://arxiv.org/abs/2407.00088): lookup-based low-bit CPU computation. +- [Distilling token models into byte-level models](https://arxiv.org/abs/2602.01007): supervision across representations. + +References link to their original publications; PDFs and personal working notes are excluded from Git. Config comments are design context; measurements come from evaluation records. + +## License + +The two Hugging Face model repositories declare Apache-2.0; companion dataset metadata declares MIT. This GitHub checkout has no standalone `LICENSE` file, so Hub labels alone do not establish a repository-wide source license. FineWeb, Qwen, papers, and other assets retain upstream terms. WikiText excerpts retain CC-BY-SA-3.0/GFDL terms documented in [CORPUS_LICENSE.txt](https://huggingface.co/Cukinator/cpu1-ablations-final/blob/d38678e7c5d18577f36edade64495237c72a44b5/evaluation/CORPUS_LICENSE.txt). diff --git a/evaluation/source/cpu1/hub_storage.py b/evaluation/source/cpu1/hub_storage.py new file mode 100644 index 0000000000000000000000000000000000000000..219fc31a9b2eb538470b89f2e1985813ed6e039b --- /dev/null +++ b/evaluation/source/cpu1/hub_storage.py @@ -0,0 +1,47 @@ +"""Optional lazy HF mounts, recovered from the historical hf_mount helper. + +Install hf-mount separately from https://github.com/huggingface/hf-mount. +Credentials are passed through the child environment, never command arguments. +""" +import os +from pathlib import Path +import shutil +import subprocess +import sys + +HF_MOUNT_DIR = Path("/tmp/hf_mount_dataset") + + +def _run_mount(kind: str, name: str, mount_path: str | Path, token: str | None = None) -> Path: + executable = shutil.which("hf-mount") + if sys.platform == "win32" or not executable: + raise RuntimeError("Install hf-mount on Linux/macOS, or use standard Hub streaming") + path = Path(mount_path) + path.mkdir(parents=True, exist_ok=True) + env = os.environ.copy() + credential = token or env.get("HF_TOKEN") or env.get("Hugginface") + if credential: + env["HF_TOKEN"] = credential + command = [executable, "start", kind, name, str(path)] + result = subprocess.run(command, env=env, capture_output=True, text=True) + if result.returncode: + raise RuntimeError(f"hf-mount failed with exit code {result.returncode}") + print(f"[hf-mount] Mounted {kind} {name} -> {path}") + return path + + +def mount_bucket(bucket: str, mount_path: str | Path = HF_MOUNT_DIR, token: str | None = None) -> Path: + return _run_mount("bucket", bucket, mount_path, token) + + +def mount_repo(repo: str, mount_path: str | Path = HF_MOUNT_DIR, token: str | None = None) -> Path: + return _run_mount("repo", repo, mount_path, token) + + +def unmount(mount_path: str | Path = HF_MOUNT_DIR) -> None: + executable = shutil.which("hf-mount") + if not executable: + raise RuntimeError("hf-mount is not installed") + result = subprocess.run([executable, "stop", str(mount_path)], capture_output=True, text=True) + if result.returncode: + raise RuntimeError(f"hf-mount stop failed with exit code {result.returncode}") diff --git a/evaluation/source/data_pipeline/__init__.py b/evaluation/source/data_pipeline/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e32ad437332613f7f656d27dfce5eb20627faeb6 --- /dev/null +++ b/evaluation/source/data_pipeline/__init__.py @@ -0,0 +1 @@ +"""Dataset preparation and teacher signal extraction.""" diff --git a/evaluation/source/data_pipeline/prepare.py b/evaluation/source/data_pipeline/prepare.py new file mode 100644 index 0000000000000000000000000000000000000000..6439980c25c712ff6f8c1c95063fd67fd03ff892 --- /dev/null +++ b/evaluation/source/data_pipeline/prepare.py @@ -0,0 +1,3984 @@ +""" +Dataset creation for CPU-1: BPE-to-byte alignment and dataset pipeline. + +Section 1 - Core algorithms: BPE-to-byte alignment, first-byte marginalization, + document packing, and dynamic patch marginalization. +Section 2 - Pipeline: teacher logprob extraction (Qwen2.5-3B default), byte-level and + BPE dataset construction, and HuggingFace Hub upload. + +Usage: + # Full pipeline + python -m data_pipeline.prepare --n_docs 50000 + + # Build byte marginalization dataset from logprobs + python -m data_pipeline.prepare --logprobs-dir ./logprobs --output-dir ./dataset +""" + +# MUST be set before any HuggingFace tokenizer import. +# ProcessPoolExecutor uses fork() on Linux; the tokenizer's internal Rust threads +# hold locks that get cloned in a locked state, deadlocking all CPU workers. +import os +os.environ["TOKENIZERS_PARALLELISM"] = "false" + +import argparse +import enum +import gc +import json +import math +import random +import shutil +import threading +import time +import traceback +from collections import deque +from concurrent.futures import ProcessPoolExecutor +from functools import partial +from pathlib import Path +from queue import Queue, Empty +from typing import NamedTuple + +import numpy as np +import torch + +try: + import pyarrow as pa + import pyarrow.parquet as pq +except ImportError: + pa = None + pq = None + +try: + from tqdm import tqdm +except ImportError: + def tqdm(it, **kw): return it + + +# ============================================================================= +# Section 1: BPE-to-Byte Alignment Core +# ============================================================================= + +# CPU-1 procesa texto como patches de 4 bytes cada uno +PATCH_SIZE = 4 +# Vocabulario de bytes: 0-255 (un byte = un valor posible) +VOCAB_SIZE = 256 + + +# ============================================================================= +# 1. Tipos +# ============================================================================= + +class AlignmentCase(enum.Enum): + """ + Tipo de alineamiento entre patch boundary y BPE boundary. + + El problema central: los patches son de 4 bytes fijos, pero los tokens BPE + tienen largo variable (1-15 bytes). Los boundaries casi nunca coinciden. + Este enum clasifica cada posicion para saber si hay senal del teacher. + """ + ALIGNED = "aligned" # Caso 1: boundary patch = boundary BPE -> hay senal teacher + INSIDE_TOKEN = "inside" # Caso 2: dentro de un token BPE -> byte deterministico, solo CE + MULTI_TOKEN = "multi" # Caso 3: multiples tokens BPE en un patch -> senal en el primero + + +class TokenInfo(NamedTuple): + """Info de un token BPE con su span en bytes (inicio inclusive, fin exclusive).""" + token_str: str # texto del token decodificado + token_bytes: list[int] # bytes UTF-8 del token + byte_start: int # posicion del primer byte en el texto completo + byte_end: int # posicion despues del ultimo byte (exclusive) + + +class PatchTeacherSignal(NamedTuple): + """Senal del teacher para un patch target (4 bytes).""" + has_teacher: list[bool] # [4] True por cada byte con senal teacher + byte_distributions: list[dict[int, float] | None] # [4] P(byte) marginalizada o None + + +# ============================================================================= +# 2. BPEToByteAligner +# ============================================================================= + +class BPEToByteAligner: + """ + Alinea tokens BPE del teacher con patches de bytes del student. + Determina que posiciones tienen senal del teacher y cuales no. + """ + + def __init__(self, patch_size: int = PATCH_SIZE): + """ + Args: + patch_size: bytes por patch del student (4 para CPU-1) + """ + self.patch_size = patch_size + + def tokens_to_byte_spans(self, token_infos: list[dict]) -> list[TokenInfo]: + """ + Convierte lista de tokens con bytes en TokenInfo con byte spans. + + Args: + token_infos: lista de dicts con 'token_str'/'token' y + 'token_bytes'/'bytes' (list[int]) + Returns: + lista de TokenInfo con byte_start, byte_end + """ + spans = [] + pos = 0 + for info in token_infos: + token_str = info.get('token_str', info.get('token', '')) + token_bytes = info.get('token_bytes', info.get('bytes', [])) + n = len(token_bytes) + spans.append(TokenInfo( + token_str=token_str, + token_bytes=token_bytes, + byte_start=pos, + byte_end=pos + n, + )) + pos += n + return spans + + def find_alignment_cases( + self, + token_spans: list[TokenInfo], + total_bytes: int, + ) -> list[tuple[int, AlignmentCase, int | None]]: + """ + Para cada byte de cada patch target, determina el caso de alineamiento. + + Returns: + Lista de (byte_position, AlignmentCase, token_index_or_None) + donde token_index es el indice del token BPE que empieza en esa posicion + (solo para ALIGNED), None para los demas. + """ + # Indice rapido: posicion_byte -> indice_token (O(1) lookup) + bpe_starts: dict[int, int] = {} + for i, span in enumerate(token_spans): + bpe_starts[span.byte_start] = i + + # Mapear cada byte a su token BPE contenedor. + # Necesario para saber si un byte esta "dentro" de un token. + byte_to_token = [0] * total_bytes + for i, span in enumerate(token_spans): + for b in range(span.byte_start, min(span.byte_end, total_bytes)): + byte_to_token[b] = i + + results = [] + n_patches = (total_bytes + self.patch_size - 1) // self.patch_size + + for p in range(n_patches): + for offset in range(self.patch_size): + byte_pos = p * self.patch_size + offset + if byte_pos >= total_bytes: + results.append((byte_pos, AlignmentCase.INSIDE_TOKEN, None)) + continue + + if byte_pos in bpe_starts: + results.append((byte_pos, AlignmentCase.ALIGNED, bpe_starts[byte_pos])) + else: + results.append((byte_pos, AlignmentCase.INSIDE_TOKEN, None)) + + return results + + def build_teacher_targets( + self, + logprobs_positions: list[dict], + token_spans: list[TokenInfo], + text_bytes: bytes, + ) -> list[PatchTeacherSignal]: + """ + Construye senales del teacher para cada patch target. + + El patch target[i] contiene los bytes del proximo patch (i+1). + Para cada byte del patch target, determina: + - Si hay senal teacher (ALIGNED con BPE boundary) + - La distribucion marginalizada del teacher (o None) + + Args: + logprobs_positions: output de extract_logprobs (lista de dicts por posicion) + token_spans: tokens BPE con byte spans + text_bytes: texto original en bytes + Returns: + Lista de PatchTeacherSignal, uno por patch target + """ + total_bytes = len(text_bytes) + n_patches = (total_bytes + self.patch_size - 1) // self.patch_size + + # Mapa token_index -> logprobs de prediccion. + # En modelo autoregresivo: logprobs_positions[i] predice token[i+1]. + # Entonces lo indexamos por i+1 (el token que se esta prediciendo). + token_logprobs: dict[int, list[dict]] = {} + for i, pos_data in enumerate(logprobs_positions): + token_logprobs[i + 1] = pos_data.get('top_tokens', []) + + # BPE boundaries + bpe_starts: dict[int, int] = {} + for i, span in enumerate(token_spans): + bpe_starts[span.byte_start] = i + + marginalizer = FirstByteMarginalization() + signals = [] + + for p in range(n_patches): + has_teacher = [False] * self.patch_size + byte_dists: list[dict[int, float] | None] = [None] * self.patch_size + + for offset in range(self.patch_size): + byte_pos = p * self.patch_size + offset + if byte_pos >= total_bytes: + continue + + # Solo hay senal si este byte es el inicio de un token BPE + # Y tenemos logprobs para la prediccion de ese token + if byte_pos in bpe_starts: + token_idx = bpe_starts[byte_pos] + if token_idx in token_logprobs: + top_tokens = token_logprobs[token_idx] + if top_tokens: + dist = marginalizer.marginalize(top_tokens) + if dist: + has_teacher[offset] = True + byte_dists[offset] = dist + + signals.append(PatchTeacherSignal( + has_teacher=has_teacher, + byte_distributions=byte_dists, + )) + + return signals + + +# ============================================================================= +# 3. FirstByteMarginalization +# ============================================================================= + +class FirstByteMarginalization: + """ + Convierte P(next_token) del teacher en P(next_byte) para el student. + + Para cada token candidato, toma SOLO su primer byte y acumula probabilidad. + Normaliza sobre bytes observados. + """ + + def marginalize(self, top_tokens: list[dict]) -> dict[int, float]: + """ + Marginalizacion basica: normalizar sobre top-k. + + Args: + top_tokens: lista de {token, bytes, logprob} + Returns: + dict byte_value (0-255) -> probabilidad normalizada + """ + byte_probs: dict[int, float] = {} + for item in top_tokens: + token_bytes = item.get('bytes', item.get('token_bytes', [])) + if not token_bytes: + continue + first_byte = token_bytes[0] + prob = math.exp(item['logprob']) + byte_probs[first_byte] = byte_probs.get(first_byte, 0.0) + prob + + total = sum(byte_probs.values()) + if total > 0: + byte_probs = {k: v / total for k, v in byte_probs.items()} + + return byte_probs + + def marginalize_with_smoothing( + self, + top_tokens: list[dict], + alpha: float = 0.01, + ) -> dict[int, float]: + """ + Marginalizacion con smoothing uniforme para bytes no observados. + + Args: + top_tokens: lista de {token, bytes, logprob} del teacher + alpha: fraccion de masa reservada para bytes no vistos (0.01 = 1%) + + Returns: + dict con 256 entries (todas las posibles), byte_value -> prob + + Reserva alpha de masa de probabilidad para distribuir uniformemente + entre bytes no vistos en el top-k. Evita que el student asigne prob=0 + a bytes validos que el top-k del teacher no cubrio. + """ + raw = self.marginalize(top_tokens) + if not raw: + return {} + + smoothed: dict[int, float] = {} + for k, v in raw.items(): + smoothed[k] = v * (1.0 - alpha) + + unseen = VOCAB_SIZE - len(smoothed) + if unseen > 0: + uniform = alpha / unseen + for b in range(VOCAB_SIZE): + if b not in smoothed: + smoothed[b] = uniform + + return smoothed + + def to_256_array(self, byte_probs: dict[int, float]) -> np.ndarray: + """ + Convierte dict sparse a array denso [256] para el dataset. + + Args: + byte_probs: dict byte -> prob (claves pueden ser int o str tras JSON roundtrip) + Returns: + np.ndarray float32 [256] + """ + arr = np.zeros(VOCAB_SIZE, dtype=np.float32) + for byte_val, prob in byte_probs.items(): + byte_val = int(byte_val) # JSON deserializa claves int como str + if 0 <= byte_val < VOCAB_SIZE: + arr[byte_val] = prob + return arr + + +# ============================================================================= +# 4. DistillationDatasetBuilder +# ============================================================================= + +class DistillationDatasetBuilder: + """ + Construye el dataset final de distillation a partir de logprobs crudos. + + Input: directorio con Parquet de logprobs (de extract_logprobs.py) + Output: dataset HuggingFace-compatible con patches, targets, teacher signals + + Formato de salida por sample: + patches: [seq_len, 4] uint8 -- input patches + targets: [seq_len, 4] uint8 -- next patches (shifted) + teacher_probs: [seq_len, 256] float32 -- distribucion byte 0 del target + teacher_mask: [seq_len] bool -- True donde hay senal teacher para byte 0 + """ + + def __init__( + self, + logprobs_dir: str, + output_dir: str, + patch_size: int = PATCH_SIZE, + seq_len: int = 2048, + ): + """ + Args: + logprobs_dir: directorio con logprobs_*.parquet (output de extract_logprobs.py) + output_dir: directorio para guardar distillation_dataset.parquet + patch_size: bytes por patch (4 para CPU-1) + seq_len: patches por secuencia despues del packing (2048 = 8KB de contexto) + """ + self.logprobs_dir = Path(logprobs_dir) + self.output_dir = Path(output_dir) + self.patch_size = patch_size + self.seq_len = seq_len + self.aligner = BPEToByteAligner(patch_size) + self.marginalizer = FirstByteMarginalization() + + def process_document(self, record: dict) -> dict | None: + """ + Procesa un documento de logprobs en patches + teacher signals. + + Args: + record: dict con doc_id, text_bytes, positions + Returns: + dict con patches, targets, teacher_probs, teacher_mask o None + """ + text_bytes = record.get('text_bytes', b'') + if isinstance(text_bytes, str): + text_bytes = text_bytes.encode('utf-8') + + positions = record.get('positions', []) + if not text_bytes or not positions: + return None + + n_bytes = len(text_bytes) + + # Pad a multiplo de patch_size con bytes nulos. + # Ej: 11 bytes -> 12 bytes (3 patches de 4) + pad = (self.patch_size - n_bytes % self.patch_size) % self.patch_size + padded = text_bytes + b'\x00' * pad + n_patches = len(padded) // self.patch_size + + if n_patches < 2: + return None + + # Construir array de patches [n_patches, 4] + patches = np.zeros((n_patches, self.patch_size), dtype=np.uint8) + for i in range(n_patches): + start = i * self.patch_size + for j in range(self.patch_size): + patches[i, j] = padded[start + j] + + # Targets: siguiente patch (shifted by 1). + # El modelo predice el patch siguiente dado el actual: + # patches[i] -> targets[i] = patches[i+1]. + # El ultimo target queda en ceros (no hay patch siguiente). + targets = np.zeros_like(patches) + targets[:-1] = patches[1:] + + # Teacher signals + # Para cada posicion de patch target, verificar si el primer byte + # del target patch coincide con un boundary BPE + teacher_probs = np.zeros((n_patches, VOCAB_SIZE), dtype=np.float32) + teacher_mask = np.zeros(n_patches, dtype=bool) + + # Reconstruir token spans desde las posiciones de logprobs + for pos_data in positions: + first_byte_probs = pos_data.get('first_byte_probs', {}) + if not first_byte_probs: + continue + + byte_position = pos_data.get('byte_position', -1) + if byte_position < 0: + continue + + # Este byte_position corresponde al inicio de un token BPE + # Lo mapeamos al patch que lo contiene + patch_idx = byte_position // self.patch_size + byte_offset = byte_position % self.patch_size + + # Logica de alineamiento: + # target[i] predice patches[i+1]. Si byte_position es el primer byte + # de patches[k] (byte_offset=0), la senal teacher aplica a target[k-1]. + # Solo usamos senal en byte_offset=0 (primer byte del patch target) + # porque la first-byte marginalization solo da P(primer byte del siguiente token). + if byte_offset == 0 and patch_idx > 0: + target_idx = patch_idx - 1 + if 0 <= target_idx < n_patches: + probs_array = self.marginalizer.to_256_array(first_byte_probs) + teacher_probs[target_idx] = probs_array + teacher_mask[target_idx] = True + + return { + 'doc_id': record.get('doc_id', ''), + 'patches': patches.tolist(), + 'targets': targets.tolist(), + 'teacher_probs': teacher_probs.tolist(), + 'teacher_mask': teacher_mask.tolist(), + } + + def pack_documents( + self, + documents: list[dict], + ) -> list[dict]: + """ + Document packing: concatena documentos hasta llenar seq_len patches. + Inserta patch separador [0,0,0,0] entre documentos. + + Args: + documents: lista de dicts procesados (output de process_document) + + Returns: + Lista de samples empaquetados, cada uno con exactamente seq_len patches. + Secuencias incompletas (< seq_len) se descartan. + + Nota: el packing maximiza utilizacion de GPU al evitar padding excesivo. + Sin packing, documentos cortos desperdician la mayor parte de la secuencia. + """ + packed = [] + current_patches = [] + current_targets = [] + current_teacher_probs = [] + current_teacher_mask = [] + + separator_patch = [0] * self.patch_size + separator_probs = [0.0] * VOCAB_SIZE + + for doc in documents: + doc_patches = doc['patches'] + doc_targets = doc['targets'] + doc_teacher_probs = doc['teacher_probs'] + doc_teacher_mask = doc['teacher_mask'] + + # Agregar separador si hay contenido previo + if current_patches: + current_patches.append(separator_patch) + current_targets.append(separator_patch) + current_teacher_probs.append(separator_probs) + current_teacher_mask.append(False) + + # Agregar documento + for i in range(len(doc_patches)): + current_patches.append(doc_patches[i]) + current_targets.append(doc_targets[i]) + current_teacher_probs.append(doc_teacher_probs[i]) + current_teacher_mask.append(doc_teacher_mask[i]) + + # Emitir sample cuando llegamos a seq_len + if len(current_patches) >= self.seq_len: + packed.append({ + 'patches': current_patches[:self.seq_len], + 'targets': current_targets[:self.seq_len], + 'teacher_probs': current_teacher_probs[:self.seq_len], + 'teacher_mask': current_teacher_mask[:self.seq_len], + }) + current_patches = [] + current_targets = [] + current_teacher_probs = [] + current_teacher_mask = [] + + # Descartar sobrante incompleto (no padear) + return packed + + def build(self, n_workers: int = 0): + """ + Pipeline completo: lee logprobs -> procesa docs -> empaqueta -> guarda Parquet. + Paralelizado con ProcessPoolExecutor para saturar CPU multi-core. + + Flujo: + 1. Lee todos los logprobs_*.parquet de logprobs_dir + 2. Procesa cada documento en paralelo: bytes -> patches + teacher signals + 3. Empaqueta documentos en secuencias de seq_len patches + 4. Guarda como distillation_dataset.parquet con zstd + """ + if pq is None: + raise ImportError("pyarrow requerido: pip install pyarrow") + + self.output_dir.mkdir(parents=True, exist_ok=True) + + parquet_files = sorted(self.logprobs_dir.glob("logprobs_*.parquet")) + if not parquet_files: + print(f"No hay archivos logprobs_*.parquet en {self.logprobs_dir}") + return + + if n_workers <= 0: + n_workers = max(1, (os.cpu_count() or 4) - 1) + + print(f"Procesando {len(parquet_files)} archivos de logprobs ({n_workers} workers)...") + + # Cargar todos los records + all_records = [] + for pf in parquet_files: + table = pq.read_table(pf) + for i in range(len(table)): + all_records.append({ + 'doc_id': table['doc_id'][i].as_py(), + 'text_bytes': table['text_bytes'][i].as_py(), + 'positions': json.loads(table['positions'][i].as_py()), + }) + + # DescomposiciΓ³n de datos: cada worker procesa un documento independiente + if n_workers > 1 and len(all_records) > 10: + with ProcessPoolExecutor(max_workers=n_workers) as executor: + results = list(executor.map( + self.process_document, all_records, + chunksize=max(1, len(all_records) // (n_workers * 4)), + )) + all_docs = [r for r in results if r is not None] + else: + all_docs = [r for r in (self.process_document(rec) for rec in all_records) if r] + + print(f"Documentos procesados: {len(all_docs)}") + + # Document packing + packed = self.pack_documents(all_docs) + print(f"Samples empaquetados (seq_len={self.seq_len}): {len(packed)}") + + if not packed: + print("Sin samples para guardar") + return + + # Guardar como Parquet + output_file = self.output_dir / "distillation_dataset.parquet" + arrays = { + 'patches': pa.array([json.dumps(s['patches']) for s in packed], type=pa.large_string()), + 'targets': pa.array([json.dumps(s['targets']) for s in packed], type=pa.large_string()), + 'teacher_probs': pa.array([json.dumps(s['teacher_probs']) for s in packed], type=pa.large_string()), + 'teacher_mask': pa.array([json.dumps(s['teacher_mask']) for s in packed], type=pa.large_string()), + } + table = pa.table(arrays) + pq.write_table(table, str(output_file), compression='zstd') + + print(f"Dataset guardado: {output_file}") + print(f" Samples: {len(packed)}") + print(f" Patches/sample: {self.seq_len}") + + def validate_sample(self, n: int = 10): + """ + Valida consistencia del dataset construido. + + Args: + n: cantidad de samples a validar + + Verifica shapes y reporta teacher coverage promedio (~20-30% esperado). + """ + output_file = self.output_dir / "distillation_dataset.parquet" + if not output_file.exists(): + print(f"Dataset no encontrado: {output_file}") + return + + table = pq.read_table(str(output_file)) + n = min(n, len(table)) + total_coverage = 0.0 + + for i in range(n): + patches = json.loads(table['patches'][i].as_py()) + targets = json.loads(table['targets'][i].as_py()) + teacher_mask = json.loads(table['teacher_mask'][i].as_py()) + + assert len(patches) == self.seq_len + assert len(targets) == self.seq_len + assert len(teacher_mask) == self.seq_len + + coverage = sum(teacher_mask) / len(teacher_mask) + total_coverage += coverage + + avg_coverage = total_coverage / n + print(f"Validacion ({n} samples):") + print(f" Teacher coverage promedio: {avg_coverage:.1%}") + print(f" Patches/sample: {self.seq_len}") + + +# ============================================================================= +# 5. DynamicPatchMarginalization β€” Parches dinΓ‘micos (Bolmo) +# ============================================================================= + +class DynamicPatchMarginalization: + """ + VersiΓ³n de byte_marginalization que soporta parches dinΓ‘micos (Bolmo). + + La diferencia vs la versiΓ³n estΓ‘tica: + - Los boundaries no son fijos cada 4 bytes + - Los boundaries vienen del BoundaryPredictor o de las reglas naturales + - La marginalizaciΓ³n BPEβ†’byte sigue siendo igual para los primeros bytes + + COMPATIBILIDAD: + - Si boundaries=None β†’ comportamiento idΓ©ntico a la versiΓ³n estΓ‘tica + - Los runs 01-11 usan la versiΓ³n estΓ‘tica (boundaries=None) + - Los runs 12-15 usan la versiΓ³n dinΓ‘mica + """ + + def __init__(self, patch_size_max: int = 8, patch_size_static: int = 4): + self.patch_size_max = patch_size_max + self.patch_size_static = patch_size_static + + def build_teacher_targets_dynamic( + self, + text_bytes: bytes, + byte_to_teacher: dict, # byte_offset β†’ {byte_val: prob} + boundaries: list[bool], # del BoundaryPredictor o reglas naturales + ) -> list[dict]: + """ + Construir targets de distilaciΓ³n para parches dinΓ‘micos. + + Para cada parche: + - Si el primer byte del parche coincide con un boundary BPE + β†’ tiene seΓ±al del teacher (marginalizaciΓ³n) + - Si no β†’ solo CE + + La seΓ±al del teacher siempre es para el primer byte del parche + (igual que en la versiΓ³n estΓ‘tica). + + Returns: lista de dicts por parche: + { + 'patch': list[int], # bytes del parche (paddeados) + 'patch_len': int, # longitud real sin padding + 'has_teacher': bool, + 'teacher_probs': list[float] | None, # [256] o None + } + """ + patches = _bytes_to_dynamic_patches( + text_bytes, boundaries, self.patch_size_max + ) + + results = [] + byte_offset = 0 + + for patch in patches: + # Longitud real (sin padding) + patch_len = sum(1 for b in patch if b != 0) or 1 + + # ΒΏHay seΓ±al del teacher para el primer byte de este parche? + has_teacher = byte_offset in byte_to_teacher + teacher_probs = None + + if has_teacher: + bp = byte_to_teacher[byte_offset] + teacher_probs = [bp.get(b, 0.0) for b in range(256)] + + results.append({ + 'patch': patch, + 'patch_len': patch_len, + 'has_teacher': has_teacher, + 'teacher_probs': teacher_probs, + }) + + byte_offset += patch_len + + return results + + +def _bytes_to_dynamic_patches( + byte_seq: bytes, + boundaries: list[bool], + max_patch_size: int = 8, + pad_byte: int = 0, +) -> list[list[int]]: + """ + Convertir secuencia de bytes a parches de longitud variable. + + Los parches tienen longitud entre 1 y max_patch_size bytes. + Se paddean a max_patch_size con pad_byte para batch processing. + + Returns: lista de parches, cada uno de longitud max_patch_size (paddeado) + """ + patches = [] + current_patch = [] + + for i, (b, is_boundary) in enumerate(zip(byte_seq, boundaries)): + current_patch.append(b) + if is_boundary or len(current_patch) >= max_patch_size: + padded = current_patch + [pad_byte] * (max_patch_size - len(current_patch)) + patches.append(padded[:max_patch_size]) + current_patch = [] + + if current_patch: + padded = current_patch + [pad_byte] * (max_patch_size - len(current_patch)) + patches.append(padded[:max_patch_size]) + + return patches + + +# ============================================================================= +# 6. Tests +# ============================================================================= + +def test_alignment_cases(): + """Verifica los 3 casos de alineamiento BPE <-> byte patches.""" + aligner = BPEToByteAligner(patch_size=4) + + # "Hello world" (11 bytes) + # BPE: ["Hello"(5 bytes), " world"(6 bytes)] + # Patches: [0:4], [4:8], [8:12] (con padding) + tokens = [ + {'token_str': 'Hello', 'token_bytes': [72, 101, 108, 108, 111]}, + {'token_str': ' world', 'token_bytes': [32, 119, 111, 114, 108, 100]}, + ] + spans = aligner.tokens_to_byte_spans(tokens) + + assert spans[0].byte_start == 0 + assert spans[0].byte_end == 5 + assert spans[1].byte_start == 5 + assert spans[1].byte_end == 11 + + # Verificar alineamiento + cases = aligner.find_alignment_cases(spans, total_bytes=11) + + # Byte 0: inicio patch 0 Y inicio token 0 -> ALIGNED + assert cases[0][1] == AlignmentCase.ALIGNED + + # Byte 4: inicio patch 1, pero DENTRO de token "Hello" (que va 0-4) -> INSIDE + assert cases[4][1] == AlignmentCase.INSIDE_TOKEN + + # Byte 5: NO inicio de patch (offset 1 del patch 1), pero inicio de token 1 -> ALIGNED + assert cases[5][1] == AlignmentCase.ALIGNED + + # Byte 8: inicio patch 2, dentro de token " world" (5-10) -> INSIDE + assert cases[8][1] == AlignmentCase.INSIDE_TOKEN + + print("[OK] Caso 1 (ALIGNED): byte 0 coincide con BPE boundary") + print("[OK] Caso 2 (INSIDE_TOKEN): byte 4 cae dentro de 'Hello'") + print("[OK] Caso 3 (ALIGNED en offset): byte 5 es BPE boundary aunque no es patch boundary") + + +def test_first_byte_marginalization(): + """Verifica marginalizacion con el ejemplo del spec.""" + marginalizer = FirstByteMarginalization() + + top_tokens = [ + {'token': 'the', 'bytes': [116, 104, 101], 'logprob': -0.5}, + {'token': 'The', 'bytes': [84, 104, 101], 'logprob': -1.2}, + {'token': 'to', 'bytes': [116, 111], 'logprob': -1.5}, + ] + + probs = marginalizer.marginalize(top_tokens) + assert abs(probs[116] - 0.7336) < 0.001 + assert abs(probs[84] - 0.2664) < 0.001 + assert len(probs) == 2 + print("[OK] Marginalization basica: valores correctos") + + # Smoothing + smoothed = marginalizer.marginalize_with_smoothing(top_tokens, alpha=0.01) + assert len(smoothed) == VOCAB_SIZE + assert abs(sum(smoothed.values()) - 1.0) < 0.001 + assert smoothed[116] > smoothed[0] # byte 116 deberia ser mayor que uniform + print("[OK] Marginalization con smoothing: 256 entries, suman 1.0") + + # to_256_array + arr = marginalizer.to_256_array(probs) + assert arr.shape == (256,) + assert abs(arr[116] - 0.7336) < 0.001 + assert arr[0] == 0.0 # no observado + print("[OK] to_256_array: shape y valores correctos") + + +def test_document_processing(): + """Verifica procesamiento end-to-end de un documento.""" + builder = DistillationDatasetBuilder( + logprobs_dir=".", + output_dir=".", + seq_len=8, + ) + + # Documento simple: "ABCDEFGH" (8 bytes = 2 patches) + text = "ABCDEFGH" + text_bytes = text.encode('utf-8') + + record = { + 'doc_id': 'test', + 'text_bytes': text_bytes, + 'positions': [ + { + 'byte_position': 0, + 'top_tokens': [ + {'token': 'AB', 'bytes': [65, 66], 'logprob': -0.5}, + {'token': 'AC', 'bytes': [65, 67], 'logprob': -1.0}, + ], + 'first_byte_probs': {65: 1.0}, # 100% byte 'A' + }, + { + 'byte_position': 4, + 'top_tokens': [ + {'token': 'EF', 'bytes': [69, 70], 'logprob': -0.3}, + {'token': 'EG', 'bytes': [69, 71], 'logprob': -2.0}, + ], + 'first_byte_probs': {69: 1.0}, # 100% byte 'E' + }, + ], + } + + result = builder.process_document(record) + assert result is not None + assert len(result['patches']) == 2 + assert len(result['targets']) == 2 + assert len(result['teacher_mask']) == 2 + + # El byte_position=4 es el inicio del patch 1. + # Esto da senal al target[0] (que predice patch[1]). + assert result['teacher_mask'][0] == True, "Target 0 deberia tener senal (byte 4 = inicio patch 1)" + + print("[OK] Document processing: patches, targets, teacher signals correctos") + + +def test_document_packing(): + """Verifica document packing con separador.""" + builder = DistillationDatasetBuilder( + logprobs_dir=".", + output_dir=".", + seq_len=8, + ) + + doc1 = { + 'patches': [[1, 2, 3, 4], [5, 6, 7, 8], [9, 10, 11, 12]], + 'targets': [[5, 6, 7, 8], [9, 10, 11, 12], [0, 0, 0, 0]], + 'teacher_probs': [[0.0] * 256] * 3, + 'teacher_mask': [False, True, False], + } + doc2 = { + 'patches': [[13, 14, 15, 16], [17, 18, 19, 20]], + 'targets': [[17, 18, 19, 20], [0, 0, 0, 0]], + 'teacher_probs': [[0.0] * 256] * 2, + 'teacher_mask': [True, False], + } + + packed = builder.pack_documents([doc1, doc2]) + + # doc1 (3) + separator (1) + doc2 (2) = 6 patches + # 6 < seq_len=8, asi que no se emite sample completo + assert len(packed) == 0, "No deberia haber sample completo (6 < 8)" + + # Con seq_len=6 + builder.seq_len = 6 + packed = builder.pack_documents([doc1, doc2]) + assert len(packed) == 1 + assert len(packed[0]['patches']) == 6 + + # Verificar separador en posicion 3 + assert packed[0]['patches'][3] == [0, 0, 0, 0], "Posicion 3 debe ser separador" + assert packed[0]['teacher_mask'][3] == False, "Separador no tiene teacher" + + print("[OK] Document packing: separador y truncamiento correctos") + + +# ============================================================================= +# 6. CLI +# ============================================================================= + +def parse_args() -> argparse.Namespace: + p = argparse.ArgumentParser(description="Byte marginalization y dataset builder") + + p.add_argument('--logprobs-dir', type=str, default=None, + help="Directorio con Parquet de logprobs") + p.add_argument('--output-dir', type=str, default='./dataset', + help="Directorio de salida para dataset") + p.add_argument('--seq-len', type=int, default=2048, + help="Patches por secuencia (para document packing)") + p.add_argument('--validate', action='store_true', + help="Validar dataset existente") + + return p.parse_args() + + +def main(): + import sys + + if len(sys.argv) == 1: + print("Sin argumentos -> corriendo tests\n") + print("=" * 60) + test_alignment_cases() + print() + test_first_byte_marginalization() + print() + test_document_processing() + print() + test_document_packing() + print("\n" + "=" * 60) + print("Todos los tests pasaron.") + return + + args = parse_args() + + if args.validate: + builder = DistillationDatasetBuilder( + logprobs_dir=args.logprobs_dir or ".", + output_dir=args.output_dir, + seq_len=args.seq_len, + ) + builder.validate_sample() + return + + if args.logprobs_dir is None: + print("Error: --logprobs-dir requerido") + return + + builder = DistillationDatasetBuilder( + logprobs_dir=args.logprobs_dir, + output_dir=args.output_dir, + seq_len=args.seq_len, + ) + builder.build() + + + + +# ============================================================================= +# Section 2: Dataset Pipeline +# ============================================================================= + +# ============================================================ +# Configuration +# ============================================================ + +TEACHER_MODEL = "Qwen/Qwen2.5-3B" + +# Module-level cache: tokenizer id β†’ {token_id: bytes} +_TOKEN_BYTES_CACHE: dict = {} +DATASET_REPO = "Cukinator/cpu1-ablation-dataset" +DATASET_BUCKET = "Cukinator/cpu1-ablation-dataset" # HF Bucket (read-write via hf-mount) +OUTPUT_DIR = Path("./shared_dataset") +TOP_K_LOGPROBS = 128 +PATCH_SIZE = 4 +SEQ_LEN_PATCHES = 5000 +SEQ_LEN_TOKENS = 5000 +MAX_EXTRACTION_TOKENS = 700 # 700 max tokens per doc β†’ shorter seqs = bigger batch +TEACHER_HIDDEN_DIM = 2048 # Qwen2.5-3B hidden size (2048); -7B seria 3584 +ALIGN_DIM = 128 # Project teacher hidden 2048β†’128 (Johnson-Lindenstrauss) +SEQS_PER_SHARD = 50 # Align with 500-doc chunks to upload immediately +SEED = 42 +BATCH_SIZE_TEACHER = 29 # T4 optimal: avoids OOM cascade (was 120β†’57β†’42β†’31) +BATCH_SIZE_TEACHER_L4 = 100 # L4 24GB: FP8 model ~7GB + attn@4096. Restored to 100. +MAX_EXTRACTION_TOKENS_L4 = 4096 # L4: 4k seq fits at batch 14 (bucket batching cuts avg) + +# --- Concurrency & Resource Control --- +TARGET_VRAM_GB = 13.0 # Hard cap: 13GB per T4 GPU (15GB total, 2GB headroom) +VRAM_SAFETY_FACTOR = 0.96 # Aggressive: OOM-halving fallback is the real safety net +RAM_HARD_LIMIT_GB = 25.0 # Hard cap: never exceed 25GB RAM total +CALIBRATION_SAMPLES = 30 # More samples = accurate per-doc VRAM (overhead diluted) +CALIBRATION_WARMUP = 2 # Warm-up passes before measuring (eliminates GPU cold-start bias) +# GPU buffer: how many chunks GPU can run ahead of CPU before blocking. +# Each queued chunk is just a tuple β€” actual data is on /tmp disk (57GB available). +EXTRACTION_QUEUE_DEPTH = 2 # GPU can queue 2 chunks ahead (reduced to prevent deadlock) +UPLOAD_QUEUE_DEPTH = 2 # CPU can queue 2 shards for upload (reduced to prevent deadlock) +MAX_ACCUMULATED_PATCHES = 50_000 # ~10Γ— SEQ_LEN_PATCHES, larger buffer with flattened reads +MAX_ACCUMULATED_TOKENS = 50_000 # ~10Γ— SEQ_LEN_TOKENS, larger buffer with flattened reads +MODEL_RESET_EVERY_CHUNKS = 30 # Reload models to defragment VRAM (was 20, extended) +CORPUS_PROGRESS_INTERVAL = 10_000 # Print progress every N docs during download +RAM_HEADROOM_FRACTION = 0.17 # Keep 17% RAM free (25/30 = 83% usable) +CHECKPOINT_EVERY_SHARDS = 1 # Checkpoint every 1 shard (upload immediately to prevent deadlock) +UPLOAD_EVERY_SHARDS = 1 # Upload byte+BPE shard files to HF every 1 shard (no batching) + + +def _get_ram_usage(): + """Return (used_gb, total_gb, fraction_used).""" + try: + import psutil + mem = psutil.virtual_memory() + return mem.used / 1024**3, mem.total / 1024**3, mem.percent / 100.0 + except ImportError: + try: + with open('/proc/meminfo') as f: + lines = f.readlines() + info = {} + for line in lines: + parts = line.split() + info[parts[0].rstrip(':')] = int(parts[1]) * 1024 + total = info.get('MemTotal', 0) + avail = info.get('MemAvailable', info.get('MemFree', 0)) + used = total - avail + return used / 1024**3, total / 1024**3, used / max(total, 1) + except Exception: + return 0, 0, 0 + + +def _check_ram_pressure(label=""): + """Force GC if RAM headroom < RAM_HEADROOM_FRACTION. Returns True if pressure high.""" + used_gb, total_gb, frac = _get_ram_usage() + headroom = 1.0 - frac + if headroom < RAM_HEADROOM_FRACTION: + gc.collect() + used_gb2, _, frac2 = _get_ram_usage() + print(f" [RAM {label}] Pressure! {frac*100:.0f}%β†’{frac2*100:.0f}% " + f"({used_gb:.1f}β†’{used_gb2:.1f}/{total_gb:.1f}GB) β€” forced GC", flush=True) + return True + return False + + +def detect_gpu_profile() -> dict: + """Detect GPU and return optimal extraction config. + + Profiles: + L4 (24GB, Ada Lovelace): FP8 W8A8 dynamic, batch 14, seq 4096, bucket sorted + T4 (15GB, Turing): 4-bit NF4, batch 2, seq 2048 + other: fallback based on VRAM + + Returns dict with keys: name, vram_gb, batch_size, max_tokens, fp8, dtype + """ + if not torch.cuda.is_available(): + return { + 'name': 'cpu', 'vram_gb': 0, + 'batch_size': 1, 'max_tokens': MAX_EXTRACTION_TOKENS, + 'fp8': False, 'dtype': torch.float32, + } + + props = torch.cuda.get_device_properties(0) + name = props.name.lower() + vram_gb = props.total_memory / (1024 ** 3) + + if 'l4' in name or (vram_gb >= 22 and vram_gb < 28): + # L4: Ada Lovelace, FP8 W8A8 via torch._scaled_mm, 24 GB GDDR6, 4 CPU cores + # logit_chunk_size=512: 14Γ—512Γ—3584 BF16 = ~49 MB/chunk + return { + 'name': props.name, 'vram_gb': vram_gb, + 'batch_size': BATCH_SIZE_TEACHER_L4, + 'max_tokens': MAX_EXTRACTION_TOKENS_L4, + 'fp8': True, 'dtype': torch.bfloat16, + 'logit_chunk_size': 512, + 'cpu_workers': 4, + } + elif 't4' in name or (vram_gb >= 13 and vram_gb < 18): + # T4: 15GB, cap at 13GB. With use_cache=False, 700 tok max: + # NF4 model: ~3 GB + # Attention [B,H,S,S] FP16: 120Γ—28Γ—700Β²Γ—2B = ~3.3 GB + # Hidden hooks: 120Γ—700Γ—2048Γ—2BΓ—2 = ~0.7 GB + # logit chunk [120,64,151643] FP32: 120Γ—64Γ—151643Γ—4B = ~4.4 GB + # Total peak: ~11.4 GB β†’ under 13GB cap (calibrator will adjust) + return { + 'name': props.name, 'vram_gb': vram_gb, + 'batch_size': BATCH_SIZE_TEACHER, + 'max_tokens': MAX_EXTRACTION_TOKENS, + 'fp8': False, 'dtype': torch.float16, + 'logit_chunk_size': 64, # 4x larger chunks β†’ fewer kernel launches, better occupancy + 'cpu_workers': 2, + } + elif 'a100' in name or 'h100' in name: + return { + 'name': props.name, 'vram_gb': vram_gb, + 'batch_size': 16, 'max_tokens': 4096, + 'fp8': False, 'dtype': torch.bfloat16, + 'logit_chunk_size': 512, + 'cpu_workers': 4, + } + else: + batch = max(1, int(vram_gb / 8)) + dtype = torch.bfloat16 if vram_gb >= 20 else torch.float16 + cpu_w = min(4, max(1, os.cpu_count() or 2)) + return { + 'name': props.name, 'vram_gb': vram_gb, + 'batch_size': batch, 'max_tokens': MAX_EXTRACTION_TOKENS, + 'fp8': False, 'dtype': dtype, + 'logit_chunk_size': 256, + 'cpu_workers': cpu_w, + } + + +# Per-GPU calibration cache: avoids re-calibrating every chunk (~10s idle per call) +_CALIBRATED_BATCH_CACHE: dict[int, int] = {} # device_index β†’ batch_size + + +def _calibrate_batch_size(model, tokenizer, profile: dict, + target_vram_gb: float = TARGET_VRAM_GB) -> int: + """Profile VRAM with a small calibration batch and calculate optimal batch size. + + Uses per-GPU cache: first call runs actual calibration (~5-10s), + subsequent calls return cached result instantly. Cache is cleared + by _reset_models() so batch sizes are recalibrated after defrag. + + Returns: + Optimal batch_size that keeps peak VRAM at target_vram_gb. + """ + device = next(model.parameters()).device + dev_idx = device.index if (hasattr(device, 'index') and device.index is not None) else 0 + + # Return cached result if available (saves ~10s per call) + if dev_idx in _CALIBRATED_BATCH_CACHE: + cached = _CALIBRATED_BATCH_CACHE[dev_idx] + print(f"[Calibrate] GPU {dev_idx}: using cached batch_size={cached}") + return cached + + torch.cuda.reset_peak_memory_stats(device) + torch.cuda.empty_cache() + gc.collect() + + # Use texts that match the actual workload: ~max_tokens length (not ~50 tokens). + # Short texts massively underestimate per-doc VRAM (no KV cache pressure, tiny + # activations). A 768-token doc uses ~10Γ— more VRAM than a 50-token doc. + _chars_per_token = 4 # conservative for English text + _cal_len = profile.get('max_tokens', MAX_EXTRACTION_TOKENS) * _chars_per_token + cal_text = ("The quick brown fox jumps over the lazy dog. " * 200)[:_cal_len] + cal_texts = [cal_text] * CALIBRATION_SAMPLES + + seq_len = profile.get('max_tokens', MAX_EXTRACTION_TOKENS) + logit_chunk = profile.get('logit_chunk_size', 16) + + # Warm-up pass: eliminate CUDA cold-start bias (first run always allocates more) + for _ in range(CALIBRATION_WARMUP): + try: + _ = extract_logprobs_and_hidden_batch( + model, tokenizer, cal_texts[:1], + top_k=TOP_K_LOGPROBS, seq_len=seq_len, + logit_chunk_size=logit_chunk, + ) + except torch.cuda.OutOfMemoryError: + torch.cuda.empty_cache(); gc.collect(); break + torch.cuda.reset_peak_memory_stats(device) + torch.cuda.empty_cache() + gc.collect() + + baseline_vram = torch.cuda.memory_allocated(device) / (1024**3) + + try: + _ = extract_logprobs_and_hidden_batch( + model, tokenizer, cal_texts, + top_k=TOP_K_LOGPROBS, seq_len=seq_len, + logit_chunk_size=logit_chunk, + ) + except torch.cuda.OutOfMemoryError: + torch.cuda.empty_cache() + gc.collect() + print(f"[Calibrate] WARNING: OOM on {CALIBRATION_SAMPLES} docs! Using batch_size=1") + _CALIBRATED_BATCH_CACHE[dev_idx] = 1 + return 1 + + peak_vram = torch.cuda.max_memory_allocated(device) / (1024**3) + vram_per_doc = (peak_vram - baseline_vram) / CALIBRATION_SAMPLES + + # (target - model_baseline) * safety / per_doc + available = (target_vram_gb - baseline_vram) * VRAM_SAFETY_FACTOR + if vram_per_doc > 0: + optimal_batch = max(1, int(available / vram_per_doc)) + else: + optimal_batch = profile['batch_size'] + + # Cap at 4Γ— profile default to allow aggressive VRAM usage + optimal_batch = min(optimal_batch, profile['batch_size'] * 4) + + torch.cuda.empty_cache() + gc.collect() + + _CALIBRATED_BATCH_CACHE[dev_idx] = optimal_batch + print(f"[Calibrate] GPU {dev_idx}: baseline={baseline_vram:.2f}GB " + f"peak={peak_vram:.2f}GB per_doc={vram_per_doc*1000:.1f}MB " + f"β†’ batch_size={optimal_batch}") + return optimal_batch + + +def _fast_download_corpus(corpus_name: str, n_docs: int, + hf_token: str = None) -> list[str]: + """Download corpus with optimized streaming for fast cold start. + + Optimizations vs naive iteration: + - Authenticated requests via HF_TOKEN (higher rate limits, priority CDN) + - No shuffle during download (shuffle in-memory after β€” much faster) + - Progress tracking with ETA + - Filter empty docs during download to avoid wasted GPU work + """ + from datasets import load_dataset + + t0 = time.time() + print(f"[Corpus] Downloading {n_docs:,} docs from {corpus_name}...") + + kwargs: dict = {'streaming': True} + if hf_token: + kwargs['token'] = hf_token + print(f"[Corpus] Using HF_TOKEN for authenticated download (faster CDN)") + + fw = load_dataset(corpus_name, name="sample-10BT", split="train", **kwargs) + + texts: list[str] = [] + skipped = 0 + for i, doc in enumerate(fw): + if i >= n_docs: + break + text = doc.get('text', '') + if text.strip(): + texts.append(text) + else: + skipped += 1 + if (i + 1) % CORPUS_PROGRESS_INTERVAL == 0: + elapsed = time.time() - t0 + rate = (i + 1) / elapsed + eta = (n_docs - i - 1) / rate if rate > 0 else 0 + print(f" [Corpus] {i+1:,}/{n_docs:,} docs " + f"({rate:.0f} docs/s, ETA {eta:.0f}s)", flush=True) + + # Shuffle in-memory (instantaneous vs streaming shuffle's buffer overhead) + rng = np.random.RandomState(SEED) + idx = rng.permutation(len(texts)) + texts = [texts[j] for j in idx] + + elapsed = time.time() - t0 + print(f"[Corpus] {len(texts):,} docs in {elapsed:.1f}s " + f"({len(texts)/max(elapsed,0.1):.0f} docs/s, {skipped} empty skipped)") + return texts + + +def _reset_models(models: list, profile: dict) -> list: + """Reload all teacher models to defragment CUDA memory. + + After thousands of batches, CUDA memory becomes fragmented β€” + allocated+freed blocks leave gaps that can't satisfy large contiguous + allocations (like logit tensors). Reloading the model forces a clean + CUDA memory layout. + + Takes ~30-60 seconds per GPU. Call every MODEL_RESET_EVERY_CHUNKS chunks. + Clears calibration cache so batch sizes are recalculated with fresh VRAM. + + Args: + models: list of (model, tokenizer) tuples + profile: GPU profile dict + + Returns: + New list of (model, tokenizer) tuples with fresh CUDA allocations. + """ + global _CALIBRATED_BATCH_CACHE + _CALIBRATED_BATCH_CACHE.clear() # Force recalibration after defrag + print(f"\n[Reset] Reloading {len(models)} model(s) to defragment VRAM...") + t0 = time.time() + + # Phase 1: Delete all models and free CUDA memory + for i, (model, _tok) in enumerate(models): + dev = next(model.parameters()).device + del model + models.clear() + gc.collect() + for i in range(torch.cuda.device_count()): + with torch.cuda.device(i): + torch.cuda.empty_cache() + torch.cuda.reset_peak_memory_stats(i) + + # Phase 2: Reload fresh models + new_models = [] + for gpu_id in range(torch.cuda.device_count()): + dev = f"cuda:{gpu_id}" + m, tok = load_teacher(device=dev, profile=profile) + torch.cuda.empty_cache() + new_models.append((m, tok)) + + elapsed = time.time() - t0 + vram_info = [] + for i in range(torch.cuda.device_count()): + free, total = torch.cuda.mem_get_info(i) + vram_info.append(f"GPU{i}: {(total-free)/1024**3:.1f}/{total/1024**3:.1f}GB") + print(f"[Reset] Done in {elapsed:.1f}s. VRAM: {', '.join(vram_info)}") + return new_models + + +def _check_vram_fragmentation(device: int = 0) -> float: + """Return VRAM fragmentation ratio (0.0 = clean, 1.0 = fully fragmented). + + Fragmentation = (reserved - allocated) / reserved. + High fragmentation means the allocator has many small free gaps + between allocated blocks, making large contiguous allocations fail. + """ + allocated = torch.cuda.memory_allocated(device) + reserved = torch.cuda.memory_reserved(device) + if reserved == 0: + return 0.0 + return (reserved - allocated) / reserved + + +# Lazy-initialized random orthogonal projection matrix (CPU) and per-device GPU cache +_PROJECTION_MATRIX = None +_PROJECTION_MATRIX_GPU: dict = {} # device_str β†’ GPU tensor, avoids re-transfer every batch + +def _get_projection_matrix(teacher_dim: int, align_dim: int = ALIGN_DIM): + """Random orthogonal projection, seeded for reproducibility.""" + global _PROJECTION_MATRIX + if _PROJECTION_MATRIX is None: + rng = np.random.RandomState(SEED) + rand_mat = rng.randn(teacher_dim, align_dim).astype(np.float32) + q, _ = np.linalg.qr(rand_mat) + _PROJECTION_MATRIX = torch.from_numpy(q[:, :align_dim]) + return _PROJECTION_MATRIX + + +def _get_projection_matrix_gpu(device, dtype): + """Return projection matrix cached on the given device+dtype. Transfers once per run.""" + key = (str(device), dtype) + if key not in _PROJECTION_MATRIX_GPU: + cpu_proj = _get_projection_matrix(TEACHER_HIDDEN_DIM) + _PROJECTION_MATRIX_GPU[key] = cpu_proj.to(device=device, dtype=dtype) + return _PROJECTION_MATRIX_GPU[key] + + +# ============================================================ +# STEP 1: Extract teacher logprobs +# ============================================================ + +def _load_teacher_fp8(model_name: str, device: str, dtype=torch.bfloat16): + """Load teacher in BF16 then apply FP8 dynamic-activation quantization via torchao. + + Uses Float8DynamicActivationFloat8WeightConfig (W8A8 FP8): + - Weights AND activations in FP8 E4M3 during matmuls + - Activations quantized dynamically per-token at runtime + - Fires L4 Ada Lovelace FP8 tensor cores on every linear layer (attention + MLP) + - Weights ~7 GB; activations quantized on-the-fly (no extra VRAM) + - Requires torchao >= 0.4 and PyTorch >= 2.5 with CUDA 12.x + + Fallback chain: + torchao W8A8 β†’ torchao W8A16 (weight-only, no tensor cores) β†’ plain BF16 + """ + from transformers import AutoModelForCausalLM + + print(f"[Teacher] Loading {model_name} in BF16 on {device} for FP8 quantization...") + model = AutoModelForCausalLM.from_pretrained( + model_name, + torch_dtype=dtype, + device_map={"": device}, + ) + + try: + # Validate runtime prerequisites for FP8 tensor core path + if torch.version.cuda and tuple(int(x) for x in torch.version.cuda.split('.')) < (12, 0): + print(f"[Teacher] WARNING: CUDA {torch.version.cuda} < 12.0 β€” " + "FP8 tensor cores require CUDA 12.x. Falling back to BF16.") + model.eval() + return model + from torchao.quantization import quantize_, Float8DynamicActivationFloat8WeightConfig + print("[Teacher] Applying FP8 W8A8 dynamic quantization (torchao) ...") + quantize_(model, Float8DynamicActivationFloat8WeightConfig()) + print("[Teacher] FP8 W8A8 applied β€” L4 Ada FP8 tensor cores active on all linears. " + "Weights ~7 GB, activations quantized per-token at runtime.") + except (ImportError, AttributeError): + # Float8DynamicActivationFloat8WeightConfig requires torchao >= 0.4 + try: + from torchao.quantization import quantize_, Float8WeightOnlyConfig + print("[Teacher] torchao < 0.4 detected β€” falling back to FP8 W8A16 " + "(weight-only, NO tensor cores, memory savings only). " + "Upgrade with: pip install -U torchao") + quantize_(model, Float8WeightOnlyConfig()) + except ImportError: + print("[Teacher] torchao not found β€” running BF16 (~14 GB). " + "Install: pip install torchao") + + model.eval() + return model + + +def load_teacher(model_name: str = TEACHER_MODEL, device: str = "cuda:0", + profile: dict = None): + """Load Qwen-7B with the optimal quantization for the detected GPU. + + - T4 (15 GB): 4-bit NF4 (~4 GB VRAM) β€” original Kaggle path + - L4 (24 GB): BF16 + FP8 weights via torchao (~7 GB VRAM, batchΓ—4 throughput) + - CPU: 4-bit NF4 via bitsandbytes CPU path + """ + from transformers import AutoModelForCausalLM, AutoTokenizer, BitsAndBytesConfig + + if profile is None: + profile = detect_gpu_profile() + + print(f"[Teacher] GPU: {profile['name']} ({profile['vram_gb']:.1f} GB VRAM)") + tokenizer = AutoTokenizer.from_pretrained(model_name) + + if profile['fp8'] and device != 'cpu': + model = _load_teacher_fp8(model_name, device, profile['dtype']) + else: + # Original 4-bit NF4 path (T4 / CPU / unknown GPU) + compute_dtype = profile.get('dtype', torch.float16) + print(f"[Teacher] Loading {model_name} in 4-bit NF4 on {device}...") + bnb_config = BitsAndBytesConfig( + load_in_4bit=True, + bnb_4bit_compute_dtype=compute_dtype, + bnb_4bit_use_double_quant=True, + bnb_4bit_quant_type="nf4", + ) + model = AutoModelForCausalLM.from_pretrained( + model_name, + quantization_config=bnb_config, + device_map={"": device}, + ) + model.eval() + + # Cache tokenizer locally so BPE ProcessPoolExecutor workers don't hit network + local_cache = Path("/tmp/_bpe_tokenizer_cache") + if not local_cache.exists(): + tokenizer.save_pretrained(str(local_cache)) + print(f"[Teacher] Ready on {device}. Vocab size: {tokenizer.vocab_size}") + return model, tokenizer + + +def extract_logprobs_single( + model, + tokenizer, + text: str, + top_k: int = TOP_K_LOGPROBS, + seq_len: int = SEQ_LEN_TOKENS, +) -> dict: + """ + Extract top-k logprobs for every position of a single text. + + Returns dict with: + text_bytes: list[int] β€” UTF-8 bytes of original text + positions: list[dict] β€” per-position top-k logprobs + n_tokens: int + """ + enc = tokenizer( + text, return_tensors='pt', + truncation=True, max_length=seq_len, + return_offsets_mapping=True, + ) + input_ids = enc['input_ids'].to(model.device) + + with torch.no_grad(): + logits = model(input_ids).logits[0] # [seq_len, vocab_size] + + log_probs = torch.log_softmax(logits, dim=-1) + top_logprobs, top_indices = torch.topk(log_probs, k=top_k, dim=-1) + + tokens = tokenizer.convert_ids_to_tokens(input_ids[0].tolist()) + offsets = enc['offset_mapping'][0].tolist() + + for pos_idx, (token_id, token_str) in enumerate( + zip(input_ids[0].tolist(), tokens) + ): + start_char, end_char = offsets[pos_idx] + byte_offset = len(text[:start_char].encode('utf-8')) + + pos_top = [] + for k_idx in range(top_k): + cand_id = top_indices[pos_idx, k_idx].item() + cand_lp = top_logprobs[pos_idx, k_idx].item() + cand_tok = tokenizer.convert_ids_to_tokens([cand_id])[0] + try: + cand_bytes = list( + tokenizer.convert_tokens_to_string( + [cand_tok] + ).encode('utf-8') + ) + except Exception: + cand_bytes = [0] + + pos_top.append({ + 'token_id': cand_id, + 'token': cand_tok, + 'bytes': cand_bytes, + 'logprob': cand_lp, + }) + + positions.append({ + 'byte_offset': byte_offset, + 'top_tokens': pos_top, + }) + + return { + 'text_bytes': list(text.encode('utf-8')), + 'positions': positions, + 'n_tokens': len(tokens), + } + + +def extract_logprobs_and_hidden( + model, + tokenizer, + text: str, + top_k: int = TOP_K_LOGPROBS, + seq_len: int = SEQ_LEN_TOKENS, + hidden_layer: int = -1, # -1 = capa del medio, o especΓ­fica +) -> dict: + """ + VersiΓ³n extendida de extract_logprobs_single que tambiΓ©n guarda + los hidden states del teacher en la capa del medio. + + El hidden state se usa para EmbeddingAligner en Fase 1. + + Costo adicional: ~50% mΓ‘s memoria por batch (activaciones intermedias). + Workaround si la memoria es justa: extraer en un segundo pass separado. + + Output adicional por posiciΓ³n: + 'teacher_hidden': list[list[float]] # [n_tokens, teacher_dim] FP16 + """ + enc = tokenizer( + text, return_tensors='pt', + truncation=True, max_length=seq_len, + return_offsets_mapping=True, + ) + input_ids = enc['input_ids'].to(model.device) + + with torch.no_grad(): + outputs = model( + input_ids, + output_hidden_states=True, + ) + logits = outputs.logits[0] # [seq_len, vocab_size] + + # Hidden state de la capa del medio + n_layers = len(outputs.hidden_states) + mid_layer = hidden_layer if hidden_layer >= 0 else n_layers // 2 + teacher_hidden = outputs.hidden_states[mid_layer][0] # [S, D] + + # Project 5120β†’ALIGN_DIM and compress to FP16 + proj = _get_projection_matrix(teacher_hidden.shape[-1]) + teacher_hidden_proj = (teacher_hidden.float().cpu() @ proj).half() + + log_probs = torch.log_softmax(logits, dim=-1) + top_logprobs, top_indices = torch.topk(log_probs, k=top_k, dim=-1) + + tokens = tokenizer.convert_ids_to_tokens(input_ids[0].tolist()) + offsets = enc['offset_mapping'][0].tolist() + + for pos_idx, (token_id, token_str) in enumerate( + zip(input_ids[0].tolist(), tokens) + ): + start_char, end_char = offsets[pos_idx] + byte_offset = len(text[:start_char].encode('utf-8')) + + pos_top = [] + for k_idx in range(top_k): + cand_id = top_indices[pos_idx, k_idx].item() + cand_lp = top_logprobs[pos_idx, k_idx].item() + cand_tok = tokenizer.convert_ids_to_tokens([cand_id])[0] + try: + cand_bytes = list( + tokenizer.convert_tokens_to_string( + [cand_tok] + ).encode('utf-8') + ) + except Exception: + cand_bytes = [0] + + pos_top.append({ + 'token_id': cand_id, + 'token': cand_tok, + 'bytes': cand_bytes, + 'logprob': cand_lp, + }) + + positions.append({ + 'byte_offset': byte_offset, + 'top_tokens': pos_top, + }) + + return { + 'text_bytes': list(text.encode('utf-8')), + 'positions': positions, + 'n_tokens': len(tokens), + 'teacher_hidden': teacher_hidden_proj.tolist(), # [n_tokens, ALIGN_DIM] + 'teacher_dim': teacher_hidden_proj.shape[-1], + } + + +def _get_token_bytes_cache(tokenizer) -> dict: + """Build (once per tokenizer) a full vocab id β†’ UTF-8 bytes lookup table.""" + key = id(tokenizer) + if key not in _TOKEN_BYTES_CACHE: + print("[BatchExtract] Building tokenβ†’bytes cache (~1 s)...") + vocab_size = tokenizer.vocab_size + all_tokens = tokenizer.convert_ids_to_tokens(list(range(vocab_size))) + cache: dict = {} + for tid, tok in enumerate(all_tokens): + if tok is None: + cache[tid] = b'\x00' + else: + try: + cache[tid] = tokenizer.convert_tokens_to_string([tok]).encode('utf-8') + except Exception: + cache[tid] = b'\x00' + _TOKEN_BYTES_CACHE[key] = cache + print(f"[BatchExtract] Cache ready: {vocab_size} tokens") + return _TOKEN_BYTES_CACHE[key] + + +def extract_logprobs_and_hidden_batch( + model, + tokenizer, + texts: list[str], + top_k: int = TOP_K_LOGPROBS, + seq_len: int = MAX_EXTRACTION_TOKENS, + hidden_layer: int = -1, + logit_chunk_size: int = 256, +) -> list[dict]: + """ + Batched version of extract_logprobs_and_hidden. + + Processes a list of texts in one forward pass for better GPU utilisation. + + Memory optimisations vs naΓ―ve batch: + - Forward hooks instead of output_hidden_states=True β†’ stores 2 layers, not 28 + - Chunked lm_head (logit_chunk_size positions per step) β†’ avoids BΓ—SΓ—151k tensor + - Pre-built tokenβ†’bytes cache β†’ no per-token tokenizer calls at build time + + Returns list[dict] with the same schema as extract_logprobs_and_hidden. + """ + if not texts: + return [] + + bytes_cache = _get_token_bytes_cache(tokenizer) + n_layers = model.config.num_hidden_layers + mid_idx = hidden_layer if hidden_layer >= 0 else n_layers // 2 + + # ── Register hooks to capture mid-layer and last-layer hidden states ── + # IMPORTANT: .clone() is required β€” without it the detached tensor still + # holds a reference to the full forward-pass memory (activations, KV cache) + # preventing CUDA from freeing those buffers after the forward call. + captured: dict = {} + + def _mid_hook(module, inp, out): + h = out[0] if isinstance(out, tuple) else out + captured['mid'] = h.detach().clone() # [B, S, D] β€” own allocation, no lingering refs + + def _last_hook(module, inp, out): + h = out[0] if isinstance(out, tuple) else out + captured['last'] = h.detach().clone() # [B, S, D] β€” own allocation, no lingering refs + + hook_mid = model.model.layers[mid_idx].register_forward_hook(_mid_hook) + hook_last = model.model.layers[-1].register_forward_hook(_last_hook) + + try: + enc = tokenizer( + texts, + return_tensors='pt', + padding=True, + truncation=True, + max_length=seq_len, + return_offsets_mapping=True, + ) + input_ids = enc['input_ids'].to(model.device) # [B, S_pad] + attn_mask = enc['attention_mask'].to(model.device) # [B, S_pad] + offset_mapping_cpu = enc['offset_mapping'] + + with torch.no_grad(): + # use_cache=False prevents the model from retaining the KV cache in VRAM + # after the forward pass. Without this, Qwen2.5-3B at batch=8, seq=2048 + # allocates ~3-4 GB of KV cache that is never freed until the next call. + model(input_ids, attention_mask=attn_mask, use_cache=False) + + finally: + hook_mid.remove() + hook_last.remove() + + B, S_pad = input_ids.shape + + # ── Project mid-layer hidden β†’ ALIGN_DIM (on GPU to avoid CPU bottleneck) ─ + # Projection on GPU: BF16 matmul [B,S,3584]Γ—[3584,128] β†’ ~14 MB result. + # Old path moved 800 MB to CPU for a float32 matmul; this is 50Γ— less data + # and fires BF16 tensor cores instead of CPU SIMD. + proj_gpu = _get_projection_matrix_gpu(captured['mid'].device, captured['mid'].dtype) + with torch.no_grad(): + mid_proj = (captured['mid'] @ proj_gpu).cpu() # [B, S_pad, ALIGN_DIM] β€” stays BF16 + del captured['mid'] + torch.cuda.empty_cache() # free mid-layer GPU buffer before logit computation + + # ── Chunked logit computation from last-layer hidden + final norm ───── + # Apply norm on GPU then immediately move to CPU to free VRAM before chunked logits. + with torch.no_grad(): + last_normed = model.model.norm(captured['last']) # [B, S_pad, D] + del captured['last'] + torch.cuda.empty_cache() # free last-layer raw buffer before lm_head chunks + + all_top_idx: list = [] + all_top_lp: list = [] + with torch.no_grad(): + for cs in range(0, S_pad, logit_chunk_size): + ce = min(cs + logit_chunk_size, S_pad) + chunk = last_normed[:, cs:ce, :].contiguous() # [B, C, D] + logits = model.lm_head(chunk).float() # [B, C, V] + log_p = torch.log_softmax(logits, dim=-1) + top_lp, top_idx = torch.topk(log_p, k=top_k, dim=-1) + del logits, log_p + # .cpu() implicitly synchronizes β€” no explicit sync needed + all_top_idx.append(top_idx.cpu()) + all_top_lp.append(top_lp.cpu()) + + top_idx_all = torch.cat(all_top_idx, dim=1) # [B, S_pad, K] + top_lp_all = torch.cat(all_top_lp, dim=1) # [B, S_pad, K] + + del last_normed, all_top_idx, all_top_lp + + input_ids_cpu = input_ids.cpu() + attn_mask_cpu = attn_mask.cpu() + del input_ids, attn_mask + + # ── Build one result dict per sample ────────────────────────────────── + results = [] + for b in range(B): + actual_len = int(attn_mask_cpu[b].sum().item()) + ids = input_ids_cpu[b, :actual_len].tolist() + offsets = offset_mapping_cpu[b].tolist() + + # Pre-compute charβ†’byte offset map: O(n) instead of O(nΒ²) per-position encoding + _txt = texts[b] + _txt_bytes = _txt.encode('utf-8') + _cum_byte = [0] * (len(_txt) + 1) + _bi = 0 + for _ci, _ch in enumerate(_txt): + _cum_byte[_ci] = _bi + _bi += len(_ch.encode('utf-8')) + _cum_byte[len(_txt)] = _bi + + positions = [] + for pos_idx, token_id in enumerate(ids): + start_char, end_char = offsets[pos_idx] + byte_offset = _cum_byte[start_char] if start_char < len(_cum_byte) else len(_txt_bytes) + + pos_top = [] + for k_idx in range(top_k): + cand_id = top_idx_all[b, pos_idx, k_idx].item() + cand_lp = top_lp_all[b, pos_idx, k_idx].item() + pos_top.append({ + 'token_id': cand_id, + 'token': '', # not used downstream + 'bytes': list(bytes_cache.get(cand_id, b'\x00')), + 'logprob': cand_lp, + }) + + positions.append({ + 'byte_offset': byte_offset, + 'top_tokens': pos_top, + }) + + hidden_proj = mid_proj[b, :actual_len, :] # [L, ALIGN_DIM] + results.append({ + 'text_bytes': list(_txt_bytes), + 'positions': positions, + 'n_tokens': actual_len, + 'teacher_hidden': hidden_proj.tolist(), + 'teacher_dim': int(hidden_proj.shape[-1]), + }) + + return results + + +def _append_to_parquet(records: list[dict], path: Path) -> None: + """Append records to a Parquet file (legacy, used by monkey-patch).""" + columns = { + 'doc_id': pa.array([r['doc_id'] for r in records], type=pa.int32()), + 'text_bytes': pa.array([r['text_bytes'] for r in records]), + 'positions': pa.array([r['positions'] for r in records], type=pa.string()), + 'n_tokens': pa.array([r['n_tokens'] for r in records], type=pa.int32()), + } + if records and 'teacher_hidden' in records[0]: + columns['teacher_hidden'] = pa.array( + [r['teacher_hidden'] for r in records], + type=pa.list_(pa.float32()), + ) + columns['teacher_dim'] = pa.array( + [r['teacher_dim'] for r in records], type=pa.int32(), + ) + table = pa.table(columns) + if path.exists(): + existing = pq.read_table(str(path)) + combined = pa.concat_tables([existing, table]) + pq.write_table(combined, str(path)) + else: + pq.write_table(table, str(path)) + + +def _write_parquet_part(records: list[dict], part_path: Path) -> None: + """Write records to a NEW parquet part file β€” O(1), no read-merge. + + Used by extraction workers instead of _append_to_parquet to avoid + O(nΒ²) read-concat-write and to eliminate lock contention between GPUs. + """ + columns = { + 'doc_id': pa.array([r['doc_id'] for r in records], type=pa.int32()), + 'text_bytes': pa.array([r['text_bytes'] for r in records]), + 'positions': pa.array([r['positions'] for r in records], type=pa.string()), + 'n_tokens': pa.array([r['n_tokens'] for r in records], type=pa.int32()), + } + if records and 'teacher_hidden' in records[0]: + columns['teacher_hidden'] = pa.array( + [r['teacher_hidden'] for r in records], + type=pa.large_binary(), + ) + columns['teacher_dim'] = pa.array( + [r['teacher_dim'] for r in records], type=pa.int32(), + ) + pq.write_table(pa.table(columns), str(part_path)) + + +def _merge_parquet_parts(output_path: Path) -> None: + """Merge all _partNNNN.parquet files into a single output parquet.""" + parts = sorted(output_path.parent.glob(f"{output_path.stem}_part*.parquet")) + if not parts: + return + tables = [pq.read_table(str(p)) for p in parts] + combined = pa.concat_tables(tables) + pq.write_table(combined, str(output_path)) + for p in parts: + p.unlink() + print(f" [merge] {len(parts)} parts β†’ {output_path.name} ({len(combined)} docs)") + + +def run_logprob_extraction( + corpus_texts: list[str], + output_path: str, + resume: bool = True, + preloaded_models: list = None, +) -> None: + """Extract logprobs + projected hidden states for entire corpus. + + GPU configs: + Kaggle 2Γ—T4 (15 GB each): 4-bit NF4, batch 2 per GPU, 2Γ— parallel throughput + Lightning AI 1Γ—L4 (24 GB): FP8 W8A8 via torchao, batch 14, Ada FP8 tensor cores + + Always extracts teacher hidden states (projected 5120β†’ALIGN_DIM) + for EmbeddingAligner (runs 13, 15). + """ + output_path = Path(output_path) + output_path.parent.mkdir(parents=True, exist_ok=True) + + start_idx = 0 + if resume and output_path.exists(): + existing = pq.read_table(str(output_path)) + start_idx = len(existing) + print(f"[Extraction] Resuming from doc {start_idx}/{len(corpus_texts)}") + + if start_idx >= len(corpus_texts): + print("[Extraction] All docs already extracted") + return + + profile = detect_gpu_profile() + batch_size = profile['batch_size'] + seq_len = profile['max_tokens'] + logit_chunk_size = profile.get('logit_chunk_size', 256) + print(f"[Extraction] Profile: {profile['name']} " + f"batch={batch_size} seq={seq_len} " + f"logit_chunk={logit_chunk_size} fp8={profile['fp8']}") + + n_gpus = torch.cuda.device_count() if torch.cuda.is_available() else 0 + + if n_gpus >= 2: + print(f"[Extraction] Using {n_gpus} GPUs in parallel " + f"({', '.join(torch.cuda.get_device_name(i) for i in range(n_gpus))})") + _run_extraction_multi_gpu(corpus_texts, output_path, start_idx, n_gpus, + preloaded_models, batch_size=batch_size, + seq_len=seq_len, logit_chunk_size=logit_chunk_size) + else: + _run_extraction_single_gpu(corpus_texts, output_path, start_idx, + batch_size=batch_size, seq_len=seq_len, + logit_chunk_size=logit_chunk_size, + preloaded_models=preloaded_models) + + # Only free VRAM if models were loaded locally (not pre-loaded for pipeline) + if preloaded_models is None: + gc.collect() + if torch.cuda.is_available(): + for i in range(torch.cuda.device_count()): + with torch.cuda.device(i): + torch.cuda.empty_cache() + vram_free = [torch.cuda.mem_get_info(i)[0] / (1024**3) for i in range(torch.cuda.device_count())] + print(f"[Extraction] VRAM freed. Available: {['%.1fG' % v for v in vram_free]}") + + print(f"[Extraction] Complete: {output_path}") + + +def _extract_batch_with_oom_retry(model, tokenizer, batch_texts, gpu_tag="GPU 0", + seq_len: int = MAX_EXTRACTION_TOKENS, + logit_chunk_size: int = 256): + """Try extraction, halve batch on OOM until batch_size=1.""" + import traceback + sub_batches = [batch_texts] + while sub_batches: + texts = sub_batches.pop(0) + try: + return extract_logprobs_and_hidden_batch( + model, tokenizer, texts, + top_k=TOP_K_LOGPROBS, seq_len=seq_len, + logit_chunk_size=logit_chunk_size, + ) + except torch.cuda.OutOfMemoryError: + torch.cuda.empty_cache() + gc.collect() + if len(texts) > 1: + mid = len(texts) // 2 + print(f"\n [{gpu_tag}] OOM with {len(texts)} docs, splitting to {mid}+{len(texts)-mid}") + r1 = _extract_batch_with_oom_retry(model, tokenizer, texts[:mid], gpu_tag, + seq_len, logit_chunk_size) + r2 = _extract_batch_with_oom_retry(model, tokenizer, texts[mid:], gpu_tag, + seq_len, logit_chunk_size) + return (r1 or []) + (r2 or []) + else: + print(f"\n [{gpu_tag}] OOM on single doc, skipping") + traceback.print_exc() + return [] + except Exception: + print(f"\n [{gpu_tag}] ERROR:") + traceback.print_exc() + torch.cuda.empty_cache() + return [] + return [] + + +def _run_extraction_single_gpu(corpus_texts, output_path, start_idx, + batch_size: int = BATCH_SIZE_TEACHER, + seq_len: int = MAX_EXTRACTION_TOKENS, + logit_chunk_size: int = 256, + preloaded_models=None): + """Single-GPU extraction with bucket batching and adaptive OOM recovery. + + Bucket batching: + Docs sorted by estimated token length so each batch has similar-length docs. + Average FineWeb doc is ~613 bytes β‰ˆ 175 tokens β†’ most batches pad to ~200 + instead of the max 2048+, cutting attention compute by ~10Γ—. + + Adaptive OOM: + On CUDA OOM the effective batch size is permanently halved and extraction + resumes from the exact position that failed. It never stops. + + VRAM hygiene: + empty_cache + gc after every flush to keep VRAM stable and avoid + fragmentation accumulating over thousands of batches. + """ + if preloaded_models: + model, tokenizer = preloaded_models[0] + else: + model, tokenizer = load_teacher(profile=detect_gpu_profile()) + + batch_results = [] + _FLUSH_EVERY = 50 + _part_counter = [0] + _eff_batch = [batch_size] # mutable: permanently reduced on OOM + output_path = Path(output_path) + + valid_indices = [i for i in range(start_idx, len(corpus_texts)) + if corpus_texts[i].strip()] + + # ── Bucket sort: group docs by estimated token length to minimise padding ── + # Qwen2.5 BPE: ~3.5 bytes/token for English. +1 to avoid zero for empty. + def _est_tok(idx): + return min(len(corpus_texts[idx].encode('utf-8')) // 3 + 1, seq_len) + + sorted_indices = sorted(valid_indices, key=_est_tok) + n_valid = len(sorted_indices) + + pbar = tqdm(total=n_valid, desc="Extracting logprobs", unit="doc") + + i = 0 # pointer into sorted_indices β€” only advances on success + while i < n_valid: + n = _eff_batch[0] + batch_indices = sorted_indices[i:i + n] + batch_texts = [corpus_texts[j] for j in batch_indices] + + # Cap seq_len to the actual max in this bucket + 128 token margin. + # Avoids allocating a 4096-length KV cache for a batch of 150-token docs. + bucket_max_tok = max(_est_tok(j) for j in batch_indices) + bucket_seq_len = min(seq_len, bucket_max_tok + 128) + + try: + batch_out = extract_logprobs_and_hidden_batch( + model, tokenizer, batch_texts, + top_k=TOP_K_LOGPROBS, + seq_len=bucket_seq_len, + logit_chunk_size=logit_chunk_size, + ) + + for j, result in zip(batch_indices, batch_out): + _h = result.get('teacher_hidden') + if _h is not None: + _hb = np.array(_h, dtype=np.float16).tobytes() + else: + _hb = b'' + batch_results.append({ + 'doc_id': j, + 'text_bytes': result['text_bytes'], + 'positions': json.dumps(result['positions']), + 'n_tokens': result['n_tokens'], + 'teacher_hidden': _hb, + 'teacher_dim': result['teacher_dim'], + }) + del _h + del batch_out + + i += len(batch_indices) + pbar.update(len(batch_indices)) + + if len(batch_results) >= _FLUSH_EVERY: + part_path = (output_path.parent + / f"{output_path.stem}_part{_part_counter[0]:04d}.parquet") + _part_counter[0] += 1 + _write_parquet_part(batch_results, part_path) + batch_results = [] + gc.collect() + torch.cuda.empty_cache() + + except torch.cuda.OutOfMemoryError: + torch.cuda.empty_cache() + gc.collect() + new_n = max(1, _eff_batch[0] * 3 // 4) + pbar.write(f"[OOM] batch {_eff_batch[0]} β†’ {new_n} (permanent, 75%). " + f"Resuming from doc {i}/{n_valid}") + _eff_batch[0] = new_n + # i is NOT advanced β€” retries the same position with a smaller batch + + except Exception: + import traceback + pbar.write(f"[ERROR] skipping batch at {i}") + traceback.print_exc() + torch.cuda.empty_cache() + i += len(batch_indices) + pbar.update(len(batch_indices)) + + pbar.close() + + if batch_results: + part_path = (output_path.parent + / f"{output_path.stem}_part{_part_counter[0]:04d}.parquet") + _write_parquet_part(batch_results, part_path) + + _merge_parquet_parts(output_path) + + +def _run_extraction_multi_gpu(corpus_texts, output_path, start_idx, n_gpus, + preloaded_models=None, batch_size: int = BATCH_SIZE_TEACHER, + seq_len: int = MAX_EXTRACTION_TOKENS, + logit_chunk_size: int = 256): + """Multi-GPU extraction with VRAM-calibrated batches and work-stealing. + + Architecture: + - VRAM calibration: profile each GPU at startup β†’ exact batch size for 13GB target + - Work-stealing queue: both GPUs pull from shared queue (load-balanced) + - Bucket seq_len: cap KV length to actual max in batch + margin (less wasted compute) + - OOM β†’ permanent batch halving (no recursive split) + - Async parquet writes: GPU never waits for I/O + - VRAM monitoring: report fragmentation every N batches + """ + output_path = Path(output_path) + lock = threading.Lock() # only for part counter (microseconds) + + if preloaded_models is not None: + models = preloaded_models + print(f"[Extraction] Reusing {len(models)} pre-loaded models") + else: + print("[Extraction] Loading models sequentially...") + profile = detect_gpu_profile() + models = [] + for gpu_id in range(n_gpus): + m, tok = load_teacher(device=f"cuda:{gpu_id}", profile=profile) + torch.cuda.empty_cache() + models.append((m, tok)) + print("[Extraction] All models loaded.") + + # --- VRAM Calibration: profile each GPU to find optimal batch size --- + calibrated_bs = {} + for gpu_id in range(len(models)): + model, tokenizer = models[gpu_id] + cal_profile = detect_gpu_profile() + cal_profile['logit_chunk_size'] = logit_chunk_size + cal_profile['max_tokens'] = seq_len + cal_bs = _calibrate_batch_size(model, tokenizer, cal_profile) + calibrated_bs[gpu_id] = cal_bs + + # Work-stealing queue: all valid doc indices, bucket-sorted by length + valid_indices = [i for i in range(start_idx, len(corpus_texts)) + if corpus_texts[i].strip()] + + def _est_tok(idx): + return min(len(corpus_texts[idx].encode('utf-8')) // 3 + 1, seq_len) + + sorted_indices = sorted(valid_indices, key=_est_tok) + _work_q = Queue() + for idx in sorted_indices: + _work_q.put(idx) + total_docs = len(sorted_indices) + print(f"[Extraction] {total_docs} docs β†’ work-stealing queue, {n_gpus} GPUs") + print(f"[Extraction] Calibrated batch sizes: " + f"{', '.join(f'GPU{g}={calibrated_bs[g]}' for g in range(len(models)))}") + + _part_counter = [0] + _async_write_threads: list[threading.Thread] = [] # track for cleanup + + def worker(gpu_id, model, tokenizer): + bs = calibrated_bs[gpu_id] + batch_results = [] + processed = 0 + _batch_count = 0 + + while True: + # Peek first doc to estimate length for dynamic batch sizing + try: + first_idx = _work_q.get_nowait() + except Empty: + break + est_len = _est_tok(first_idx) + bucket_seq_len = min(seq_len, est_len + 128) + + # Dynamic batch size: shorter docs β†’ bigger batch + # Attention VRAM is O(SΒ²), so shorter seqs allow much bigger batches. + # Docs are sorted by length, so consecutive docs are similar size. + if bucket_seq_len < seq_len * 0.9: + vram_scale = (bucket_seq_len / seq_len) ** 1.5 + dynamic_bs = min(int(bs / max(vram_scale, 0.1)), bs * 5) + else: + dynamic_bs = bs + + batch_indices = [first_idx] + for _ in range(dynamic_bs - 1): + try: + batch_indices.append(_work_q.get_nowait()) + except Empty: + break + + batch_texts = [corpus_texts[i] for i in batch_indices] + + # Recompute actual bucket_seq_len with full batch + bucket_max_tok = max(_est_tok(j) for j in batch_indices) + bucket_seq_len = min(seq_len, bucket_max_tok + 128) + + try: + batch_out = extract_logprobs_and_hidden_batch( + model, tokenizer, batch_texts, + top_k=TOP_K_LOGPROBS, seq_len=bucket_seq_len, + logit_chunk_size=logit_chunk_size, + ) + except torch.cuda.OutOfMemoryError: + torch.cuda.empty_cache() + gc.collect() + new_bs = max(1, bs * 3 // 4) + print(f"\n [GPU {gpu_id}] OOM at batch={bs}, reducing to {new_bs} (permanent, 75%)") + calibrated_bs[gpu_id] = new_bs + bs = new_bs + # Put docs back for retry with smaller batch + for idx in reversed(batch_indices): + _work_q.put(idx) + continue + except Exception: + print(f"\n [GPU {gpu_id}] ERROR, skipping batch") + traceback.print_exc() + torch.cuda.empty_cache() + processed += len(batch_indices) + continue + + for i, result in zip(batch_indices, batch_out): + # Store hidden states as compact float16 bytes instead of Python list. + # Python list of 768*2048 floats = ~12MB per doc (float64 objects + overhead). + # numpy float16 bytes = 768*2048*2 = 3.1MB per doc. ~4x smaller, no overhead. + _h = result['teacher_hidden'] + if _h is not None: + import numpy as _np + _hb = _np.array(_h, dtype=_np.float16).tobytes() + else: + _hb = b'' + batch_results.append({ + 'doc_id': i, + 'text_bytes': result['text_bytes'], + 'positions': json.dumps(result['positions']), + 'n_tokens': result['n_tokens'], + 'teacher_hidden': _hb, + 'teacher_dim': result['teacher_dim'], + }) + del _h, _hb + del batch_out + processed += len(batch_indices) + _batch_count += 1 + + # Flush after every batch β€” async write so GPU never waits for I/O + if batch_results: + with lock: + pidx = _part_counter[0]; _part_counter[0] += 1 + part_path = output_path.parent / f"{output_path.stem}_part{pidx:04d}.parquet" + + _to_write = batch_results + wt = threading.Thread( + target=_write_parquet_part, + args=(_to_write, part_path), + daemon=True + ) + wt.start() + _async_write_threads.append(wt) + + # Cap concurrent write threads at 2: join oldest to prevent + # unbounded RAM accumulation (each holds ~100MB of batch data) + if len(_async_write_threads) > 2: + _async_write_threads[0].join() + _async_write_threads.pop(0) + + batch_results = [] + pct = min(100, int((total_docs - _work_q.qsize()) / total_docs * 100)) + + # VRAM monitoring every 10 batches + vram_msg = "" + if _batch_count % 10 == 0: + dev_idx = gpu_id + frag = _check_vram_fragmentation(dev_idx) + free_gb, total_gb = torch.cuda.mem_get_info(dev_idx) + used_gb = (total_gb - free_gb) / 1024**3 + vram_msg = f" VRAM={used_gb:.1f}GB frag={frag:.0%}" + + print(f" [GPU {gpu_id}] {processed} docs ({pct}%) " + f"bs={bs}{vram_msg}", flush=True) + + # Flush remaining + if batch_results: + with lock: + pidx = _part_counter[0]; _part_counter[0] += 1 + part_path = output_path.parent / f"{output_path.stem}_part{pidx:04d}.parquet" + _write_parquet_part(batch_results, part_path) + del batch_results + torch.cuda.empty_cache() + print(f" [GPU {gpu_id}] Done β€” {processed} docs total", flush=True) + + threads = [] + for gpu_id in range(n_gpus): + model, tokenizer = models[gpu_id] + t = threading.Thread(target=worker, args=(gpu_id, model, tokenizer)) + threads.append(t) + t.start() + + for t in threads: + t.join() + + # Wait for all async parquet writes to complete + for wt in _async_write_threads: + wt.join(timeout=30) + + # NO merge β€” caller reads part files directly via output_path.parent glob + # This eliminates the GPU-blocking read-concat-write of ~1GB of data. + print(f" [Extraction] Complete: {output_path} ({_part_counter[0]} parts)", flush=True) + + +# ============================================================ +# STEP 2a: Marginalize BPEβ†’Byte +# ============================================================ + +def _marginalize_one_row(row: dict) -> dict: + """Marginalizar un doc BPEβ†’byte. DiseΓ±ado para multiprocessing (sin estado compartido). + + RAM-optimized: teacher_hidden decoded from float16 bytes, teacher_probs + returned as numpy arrays instead of Python lists (~7x less RAM per patch). + """ + text_bytes = bytes(row['text_bytes']) + positions = json.loads(row['positions']) + + # Teacher hidden alignment (for EmbeddingAligner, runs 13/15) + has_hidden = 'teacher_hidden' in row and row['teacher_hidden'] is not None + teacher_dim = row.get('teacher_dim', 0) if has_hidden else 0 + if has_hidden: + _raw = row['teacher_hidden'] + if isinstance(_raw, (bytes, bytearray)): + hidden_flat = np.frombuffer(_raw, dtype=np.float16).astype(np.float32) + elif isinstance(_raw, np.ndarray): + hidden_flat = _raw.astype(np.float32) + else: + hidden_flat = np.array(_raw, dtype=np.float32) + del _raw + + # Autoregressive: pos[i] predicts what comes at positions[i+1]['byte_offset']. + byte_to_teacher = {} + byte_offset_to_pos = {} + for idx, pos in enumerate(positions): + if idx + 1 >= len(positions): + break + top_toks = pos['top_tokens'] + byte_probs = {} + for item in top_toks: + if not item['bytes']: + continue + first_byte = item['bytes'][0] + prob = math.exp(item['logprob']) + byte_probs[first_byte] = byte_probs.get(first_byte, 0.0) + prob + if not byte_probs: + continue + total = sum(byte_probs.values()) + byte_probs = {k: v / total for k, v in byte_probs.items()} + next_byte_off = positions[idx + 1]['byte_offset'] + byte_to_teacher[next_byte_off] = byte_probs + if has_hidden: + byte_offset_to_pos[next_byte_off] = idx + del positions # free JSON memory early + + n_patches = len(text_bytes) // PATCH_SIZE + n_out = max(0, n_patches - 1) + + # Pre-allocate numpy arrays instead of Python lists for large fields + out_patches = [] + out_targets = [] + out_teacher_probs = np.zeros((n_out, 256), dtype=np.float32) + out_teacher_mask = np.zeros(n_out, dtype=bool) + out_teacher_hidden = np.zeros((n_out, teacher_dim), dtype=np.float32) if has_hidden else None + n_with_teacher = 0 + + for p_idx in range(n_out): + patch_start = p_idx * PATCH_SIZE + target_start = (p_idx + 1) * PATCH_SIZE + out_patches.append(list(text_bytes[patch_start:patch_start + PATCH_SIZE])) + out_targets.append(list(text_bytes[target_start:target_start + PATCH_SIZE])) + if target_start in byte_to_teacher: + bp = byte_to_teacher[target_start] + for b_val, prob in bp.items(): + out_teacher_probs[p_idx, b_val] = prob + out_teacher_mask[p_idx] = True + n_with_teacher += 1 + + if has_hidden and target_start in byte_offset_to_pos: + pos_idx = byte_offset_to_pos[target_start] + start = pos_idx * teacher_dim + end = start + teacher_dim + if end <= len(hidden_flat): + out_teacher_hidden[p_idx] = hidden_flat[start:end] + + result = { + 'patches': out_patches, 'targets': out_targets, + 'teacher_probs': out_teacher_probs, # numpy [n_out, 256] float32 + 'teacher_mask': out_teacher_mask, # numpy [n_out] bool + 'n_with_teacher': n_with_teacher, + } + if has_hidden: + result['teacher_hidden'] = out_teacher_hidden # numpy [n_out, teacher_dim] + result['teacher_dim'] = teacher_dim + return result + + +def build_byte_level_dataset( + logprobs_parquet: str, + output_dir: str, + seq_len: int = SEQ_LEN_PATCHES, + n_workers: int = 0, + seq_offset: int = 0, + carry_state: dict = None, + shard_offset: int = 0, + executor=None, # optional persistent ProcessPoolExecutor + initial_seq_offset: int = 0, +) -> tuple: + """ + Convert BPE logprobs to byte-level distributions. + Parallelizado con ProcessPoolExecutor para saturar CPU multi-core. + + RAM-optimized: numpy arrays for teacher_probs/mask/hidden, + persistent ProcessPoolExecutor (no per-batch fork overhead), + shard writes without read-concat-write, RAM pressure monitoring. + """ + output_dir = Path(output_dir) + output_dir.mkdir(parents=True, exist_ok=True) + + # Support single file or glob of part files + _p = Path(logprobs_parquet) + if _p.exists() and _p.is_file(): + part_files = [_p] + else: + stem = _p.stem + part_files = sorted(_p.parent.glob(f"{stem}_part*.parquet")) + if not part_files: + print(f"[Byte dataset] No part files found for {logprobs_parquet}") + empty_carry = {'patches': [], 'targets': [], + 'teacher_probs_np': np.zeros((0, 256), dtype=np.float32), + 'teacher_mask_np': np.zeros(0, dtype=bool), + 'teacher_hidden_np': np.zeros((0, 0), dtype=np.float32), + 'has_hidden': False, 'teacher_dim': 0} + return {'n_sequences': 0, 'n_patches_total': 0, 'n_with_teacher': 0, 'coverage_pct': 0.0}, empty_carry + + n_total_rows = sum(pq.ParquetFile(str(f)).metadata.num_rows for f in part_files) + + if n_workers <= 0: + n_workers = max(1, (os.cpu_count() or 4) - 1) + + # --- Restore carry state --- + if carry_state is not None: + all_patches = carry_state.get('patches', []) + all_targets = carry_state.get('targets', []) + # Support both old (list) and new (numpy) carry formats + _tp = carry_state.get('teacher_probs_np', carry_state.get('teacher_probs')) + if isinstance(_tp, np.ndarray): + carry_tp = _tp + elif _tp: + carry_tp = np.array(_tp, dtype=np.float32) + else: + carry_tp = np.zeros((0, 256), dtype=np.float32) + _tm = carry_state.get('teacher_mask_np', carry_state.get('teacher_mask')) + if isinstance(_tm, np.ndarray): + carry_tm = _tm + elif _tm: + carry_tm = np.array(_tm, dtype=bool) + else: + carry_tm = np.zeros(0, dtype=bool) + _th = carry_state.get('teacher_hidden_np', carry_state.get('teacher_hidden')) + has_hidden = carry_state.get('has_hidden', False) + teacher_dim = carry_state.get('teacher_dim', 0) + if isinstance(_th, np.ndarray) and _th.size > 0: + carry_th = _th + elif _th and has_hidden: + carry_th = np.array(_th, dtype=np.float32).reshape(-1, max(teacher_dim, 1)) + else: + carry_th = np.zeros((0, max(teacher_dim, 1)), dtype=np.float32) + else: + all_patches = [] + all_targets = [] + carry_tp = np.zeros((0, 256), dtype=np.float32) + carry_tm = np.zeros(0, dtype=bool) + carry_th = np.zeros((0, 1), dtype=np.float32) + has_hidden = False + teacher_dim = 0 + + stats = {'n_sequences': 0, 'n_patches_total': 0, 'n_with_teacher': 0} + + _MARGIN_BATCH = 500 # Read batch from parquet (larger = fewer I/O calls) + print(f"[Byte dataset] Marginalizing {n_total_rows} docs from {len(part_files)} part file(s)...") + + # Shard part-file tracking: write incremental parts to avoid read-concat-write + _shard_part_counters: dict[int, int] = {} # shard_idx -> part counter + + def _flush_records_to_disk(records: list[dict], shard_idx: int): + """Write records as a NEW part file β€” no read-merge. O(write_size) only.""" + if not records: + return + cnt = _shard_part_counters.get(shard_idx, 0) + part_path = output_dir / f"shard_{shard_idx:04d}_part{cnt:02d}.parquet" + _shard_part_counters[shard_idx] = cnt + 1 + _write_byte_shard(records, part_path) + + shard_records: dict[int, list[dict]] = {} + + # ---- S1: Flatten all parquet rows upfront, single map() call ---- + # This eliminates idle gaps between batches. Workers are ALWAYS busy. + # RAM cost: ~1500 docs Γ— 400KB β‰ˆ 600MB (safe under 25GB cap) + _read_t0 = time.time() + all_rows = [] + for part_file in part_files: + for batch in pq.ParquetFile(str(part_file)).iter_batches(batch_size=_MARGIN_BATCH): + all_rows.extend(batch.to_pylist()) + print(f" [Byte] Read {len(all_rows)} rows in {time.time()-_read_t0:.2f}s") + + # RAM guard: check before processing + _ram_used, _ram_total, _ram_frac = _get_ram_usage() + if _ram_used > RAM_HARD_LIMIT_GB: + print(f" [Byte] WARNING: RAM {_ram_used:.1f}GB > {RAM_HARD_LIMIT_GB}GB limit, forcing GC") + gc.collect() + + # Single map() β€” workers pull items continuously with chunksize=1 (no straggler effect) + if n_workers > 1 and len(all_rows) > 4: + _exec = executor if executor is not None else ProcessPoolExecutor(max_workers=n_workers) + try: + _map_iter = _exec.map( + _marginalize_one_row, all_rows, + chunksize=1, # S2: workers get items immediately, zero idle + ) + if executor is None: + all_results = list(_map_iter) + else: + all_results = _map_iter # lazy β€” stream as workers finish + finally: + if executor is None: + _exec.shutdown(wait=False) + else: + all_results = [_marginalize_one_row(r) for r in all_rows] + del all_rows # free input memory + + # ---- Stream results into accumulators ---- + _tp_parts = [carry_tp] if carry_tp.shape[0] > 0 else [] + _tm_parts = [carry_tm] if carry_tm.shape[0] > 0 else [] + _th_parts = [carry_th] if carry_th.shape[0] > 0 else [] + _result_count = 0 + for result in all_results: + all_patches.extend(result['patches']) + all_targets.extend(result['targets']) + n_res = len(result['patches']) + _tp_parts.append(result['teacher_probs']) + _tm_parts.append(result['teacher_mask']) + stats['n_with_teacher'] += result['n_with_teacher'] + stats['n_patches_total'] += n_res + if 'teacher_hidden' in result: + has_hidden = True + teacher_dim = result['teacher_dim'] + _th_parts.append(result['teacher_hidden']) + del result + _result_count += 1 + + # Emit complete sequences inline (streaming) + while len(all_patches) >= seq_len: + hidden_slice = carry_th[:seq_len] if has_hidden and carry_th.shape[0] >= seq_len else None + # Need to concat accumulated parts to check carry sizes + if _tp_parts and (len(_tp_parts) > 50 or len(all_patches) >= seq_len): + carry_tp = np.concatenate(_tp_parts, axis=0) if _tp_parts else carry_tp + carry_tm = np.concatenate(_tm_parts) if _tm_parts else carry_tm + if has_hidden: + valid_th = [p for p in _th_parts if p.shape[1] == teacher_dim] if _th_parts else [] + carry_th = np.concatenate(valid_th, axis=0) if valid_th else np.zeros((0, teacher_dim), dtype=np.float32) + _tp_parts = [] + _tm_parts = [] + _th_parts = [] + hidden_slice = carry_th[:seq_len] if has_hidden and carry_th.shape[0] >= seq_len else None + + if carry_tp.shape[0] < seq_len: + break # not enough teacher data yet + + record = _make_byte_record( + all_patches[:seq_len], all_targets[:seq_len], + carry_tp[:seq_len], carry_tm[:seq_len], + teacher_hidden=hidden_slice, teacher_dim=teacher_dim, + ) + run_seqs = (seq_offset - initial_seq_offset) + stats['n_sequences'] + shard = shard_offset + run_seqs // SEQS_PER_SHARD + shard_records.setdefault(shard, []).append(record) + all_patches = all_patches[seq_len:] + all_targets = all_targets[seq_len:] + carry_tp = carry_tp[seq_len:] + carry_tm = carry_tm[seq_len:] + if has_hidden: + carry_th = carry_th[seq_len:] + stats['n_sequences'] += 1 + + # Periodic flush to disk + for shard_idx in list(shard_records.keys()): + if len(shard_records[shard_idx]) >= 10: + _flush_records_to_disk(shard_records[shard_idx], shard_idx) + shard_records[shard_idx] = [] + + # RAM pressure check every 200 rows + if _result_count % 200 == 0: + _ram_used, _, _ = _get_ram_usage() + if _ram_used > RAM_HARD_LIMIT_GB: + print(f" [Byte] RAM {_ram_used:.1f}GB > limit, forcing flush+GC") + for _si in list(shard_records.keys()): + if shard_records[_si]: + _flush_records_to_disk(shard_records[_si], _si) + shard_records[_si] = [] + gc.collect() + if len(all_patches) > MAX_ACCUMULATED_PATCHES: + print(f" [Byte] WARNING: {len(all_patches)} patches accumulated " + f"(limit {MAX_ACCUMULATED_PATCHES}), forcing GC") + gc.collect() + _check_ram_pressure("byte-margin") + + # Final concat of any remaining parts + if _tp_parts: + carry_tp = np.concatenate(_tp_parts, axis=0) + carry_tm = np.concatenate(_tm_parts) + if has_hidden: + valid_th = [p for p in _th_parts if p.shape[1] == teacher_dim] if _th_parts else [] + carry_th = np.concatenate(valid_th, axis=0) if valid_th else np.zeros((0, teacher_dim), dtype=np.float32) + del _tp_parts, _tm_parts, _th_parts + + # Emit any remaining complete sequences + while len(all_patches) >= seq_len: + hidden_slice = carry_th[:seq_len] if has_hidden else None + record = _make_byte_record( + all_patches[:seq_len], all_targets[:seq_len], + carry_tp[:seq_len], carry_tm[:seq_len], + teacher_hidden=hidden_slice, teacher_dim=teacher_dim, + ) + run_seqs = (seq_offset - initial_seq_offset) + stats['n_sequences'] + shard = shard_offset + run_seqs // SEQS_PER_SHARD + shard_records.setdefault(shard, []).append(record) + all_patches = all_patches[seq_len:] + all_targets = all_targets[seq_len:] + carry_tp = carry_tp[seq_len:] + carry_tm = carry_tm[seq_len:] + if has_hidden: + carry_th = carry_th[seq_len:] + stats['n_sequences'] += 1 + + for shard_idx in list(shard_records.keys()): + if len(shard_records[shard_idx]) >= 10: + _flush_records_to_disk(shard_records[shard_idx], shard_idx) + shard_records[shard_idx] = [] + + del all_results + + # Final flush + for shard_idx, records in shard_records.items(): + if records: + _flush_records_to_disk(records, shard_idx) + shard_records.clear() + + # Merge shard part files into final shard files + for shard_idx in _shard_part_counters: + shard_path = output_dir / f"shard_{shard_idx:04d}.parquet" + parts = sorted(output_dir.glob(f"shard_{shard_idx:04d}_part*.parquet")) + if parts: + tables = [] + if shard_path.exists(): + tables.append(pq.read_table(str(shard_path))) + tables.extend([pq.read_table(str(p)) for p in parts]) + combined = pa.concat_tables(tables) + pq.write_table(combined, str(shard_path)) + for p in parts: + p.unlink() + del tables, combined + _shard_part_counters.clear() + gc.collect() + + coverage = stats['n_with_teacher'] / max(stats['n_patches_total'], 1) * 100 + stats['coverage_pct'] = coverage + + print(f"[Byte dataset] {stats['n_sequences']} sequences (chunk), total offset {seq_offset + stats['n_sequences']}") + print(f"[Byte dataset] Teacher coverage: {coverage:.1f}%") + + next_carry = { + 'patches': all_patches, 'targets': all_targets, + 'teacher_probs_np': carry_tp, 'teacher_mask_np': carry_tm, + 'teacher_hidden_np': carry_th, + 'has_hidden': has_hidden, 'teacher_dim': teacher_dim, + } + return stats, next_carry + + +def _make_byte_record(patches, targets, teacher_probs, teacher_mask, + teacher_hidden=None, teacher_dim: int = 0) -> dict: + """Build a flat record dict for one byte-level sequence. + + Accepts numpy arrays or Python lists for teacher_probs/mask/hidden. + Flattens using numpy for efficiency. + """ + record = { + 'patches': [b for p in patches for b in p], + 'targets': [b for t in targets for b in t], + } + # teacher_probs: numpy [seq_len, 256] or list of [256] lists + if isinstance(teacher_probs, np.ndarray): + record['teacher_probs'] = teacher_probs.ravel().tolist() + else: + record['teacher_probs'] = [v for row in teacher_probs for v in row] + # teacher_mask: numpy [seq_len] bool or list of bools + if isinstance(teacher_mask, np.ndarray): + record['teacher_mask'] = teacher_mask.tolist() + else: + record['teacher_mask'] = list(teacher_mask) + if teacher_hidden is not None: + if isinstance(teacher_hidden, np.ndarray): + record['teacher_hidden'] = teacher_hidden.ravel().tolist() + else: + record['teacher_hidden'] = [v for row in teacher_hidden for v in row] + record['teacher_dim'] = teacher_dim + return record + + +def _write_byte_shard(records: list[dict], shard_path: Path) -> None: + """Write byte-level records to a shard parquet. No read-concat-write.""" + if not records: + return + columns = { + 'patches': pa.array([r['patches'] for r in records], type=pa.list_(pa.uint8())), + 'targets': pa.array([r['targets'] for r in records], type=pa.list_(pa.uint8())), + 'teacher_probs': pa.array([r['teacher_probs'] for r in records], type=pa.list_(pa.float32())), + 'teacher_mask': pa.array([r['teacher_mask'] for r in records], type=pa.list_(pa.bool_())), + } + if 'teacher_hidden' in records[0]: + columns['teacher_hidden'] = pa.array( + [r['teacher_hidden'] for r in records], type=pa.list_(pa.float32()), + ) + columns['teacher_dim'] = pa.array( + [r['teacher_dim'] for r in records], type=pa.int32(), + ) + table = pa.table(columns) + # Write directly β€” no read-concat-write. Caller uses part files for incremental writes. + pq.write_table(table, str(shard_path)) + + +# ============================================================ +# STEP 2b: Build BPE dataset +# ============================================================ + +def _tokenize_bpe_row(args: tuple) -> dict: + """Procesar un documento BPE -> tokens + teacher signals. + DiseΓ±ado para ProcessPoolExecutor (sin estado compartido). + + Args: + args: (row_dict, tokenizer_name, seq_len, top_k) + Returns: + dict con ids, probs, top_ids, mask + """ + row, tokenizer_name, seq_len_max, top_k = args + + # Lazy import para workers (cada worker importa una vez) + # Use local cache path if available to avoid network timeouts + from transformers import AutoTokenizer + if not hasattr(_tokenize_bpe_row, '_tokenizer'): + local_cache = Path("/tmp/_bpe_tokenizer_cache") + if local_cache.exists(): + _tokenize_bpe_row._tokenizer = AutoTokenizer.from_pretrained(str(local_cache)) + else: + _tokenize_bpe_row._tokenizer = AutoTokenizer.from_pretrained(tokenizer_name) + tokenizer = _tokenize_bpe_row._tokenizer + + text_bytes = bytes(row['text_bytes']) + positions = json.loads(row['positions']) + text = text_bytes.decode('utf-8', errors='replace') + enc = tokenizer(text, truncation=True, max_length=seq_len_max * 2) + ids = enc['input_ids'] + + result_ids = [] + result_probs = [] + result_top_ids = [] + result_mask = [] + + for pos_idx, (token_id, pos_data) in enumerate( + zip(ids, positions[:len(ids)]) + ): + top_toks = pos_data.get('top_tokens', []) + probs = [0.0] * top_k + top_ids = [0] * top_k + has_teacher = len(top_toks) > 0 + + if has_teacher: + for k_idx, item in enumerate(top_toks[:top_k]): + probs[k_idx] = math.exp(item['logprob']) + top_ids[k_idx] = item.get('token_id', 0) + + result_ids.append(token_id) + result_probs.append(probs) + result_top_ids.append(top_ids) + result_mask.append(has_teacher) + + return { + 'ids': result_ids, 'probs': result_probs, + 'top_ids': result_top_ids, 'mask': result_mask, + } + + +def build_bpe_dataset( + logprobs_parquet: str, + output_dir: str, + seq_len: int = SEQ_LEN_TOKENS, + n_workers: int = 0, + seq_offset: int = 0, + carry_state: dict = None, + executor=None, # optional persistent ProcessPoolExecutor + shard_offset: int = 0, + initial_seq_offset: int = 0, +) -> tuple: + """ + Build BPE dataset from the same teacher logprobs. + Produces dataset for runs 01-07 (BPE). + Paralelizado con ProcessPoolExecutor: cada worker tokeniza un doc independiente. + + Teacher logprobs are kept in BPE space (no marginalization). + """ + output_dir = Path(output_dir) + output_dir.mkdir(parents=True, exist_ok=True) + + # Support single file or glob of part files + _p = Path(logprobs_parquet) + if _p.exists() and _p.is_file(): + part_files = [_p] + else: + stem = _p.stem + part_files = sorted(_p.parent.glob(f"{stem}_part*.parquet")) + if not part_files: + print(f"[BPE dataset] No part files found for {logprobs_parquet}") + empty_carry = {'ids': [], 'probs': [], 'top_ids': [], 'mask': []} + return {'n_sequences': 0, 'n_tokens_total': 0}, empty_carry + + n_total_rows = sum(pq.ParquetFile(str(f)).metadata.num_rows for f in part_files) + + stats = {'n_sequences': 0, 'n_tokens_total': 0} + if carry_state is not None: + buffer_ids = carry_state['ids'] + buffer_probs = carry_state['probs'] + buffer_top_ids = carry_state['top_ids'] + buffer_mask = carry_state['mask'] + else: + buffer_ids = [] + buffer_probs = [] + buffer_top_ids = [] + buffer_mask = [] + + global _BPE_TOKENIZER_CACHE + if '_BPE_TOKENIZER_CACHE' not in globals() or _BPE_TOKENIZER_CACHE is None: + from transformers import AutoTokenizer + _BPE_TOKENIZER_CACHE = AutoTokenizer.from_pretrained(TEACHER_MODEL) + + _BPE_BATCH = 500 # Read batch from parquet (larger = fewer I/O calls) + print(f"[BPE dataset] Tokenizing {n_total_rows} docs from {len(part_files)} part file(s)...") + + shard_records: dict[int, list[dict]] = {} + + if n_workers <= 0: + n_workers = max(1, (os.cpu_count() or 4) - 1) + + # ---- S1: Flatten all parquet rows upfront, single map() call ---- + # Eliminates idle gaps between batches. Workers are ALWAYS busy. + _read_t0 = time.time() + all_args = [] + for part_file in part_files: + for batch in pq.ParquetFile(str(part_file)).iter_batches(batch_size=_BPE_BATCH): + for r in batch.to_pylist(): + all_args.append((r, TEACHER_MODEL, seq_len, TOP_K_LOGPROBS)) + print(f" [BPE] Read {len(all_args)} rows in {time.time()-_read_t0:.2f}s") + + # RAM guard: check before processing + _ram_used, _, _ = _get_ram_usage() + if _ram_used > RAM_HARD_LIMIT_GB: + print(f" [BPE] WARNING: RAM {_ram_used:.1f}GB > {RAM_HARD_LIMIT_GB}GB limit, forcing GC") + gc.collect() + + # Single map() β€” workers pull items continuously with chunksize=1 (no straggler effect) + if n_workers > 1 and len(all_args) > 4: + _exec = executor if executor is not None else ProcessPoolExecutor(max_workers=n_workers) + try: + _map_iter = _exec.map( + _tokenize_bpe_row, all_args, + chunksize=1, # S2: workers get items immediately, zero idle + ) + if executor is None: + all_results = list(_map_iter) + else: + all_results = _map_iter # lazy β€” stream as workers finish + finally: + if executor is None: + _exec.shutdown(wait=False) + else: + all_results = [_tokenize_bpe_row(a) for a in all_args] + del all_args # free input memory + + # ---- Stream results into accumulators ---- + _result_count = 0 + for result in all_results: + buffer_ids.extend(result['ids']) + buffer_probs.extend(result['probs']) + buffer_top_ids.extend(result['top_ids']) + buffer_mask.extend(result['mask']) + stats['n_tokens_total'] += len(result['ids']) + del result + _result_count += 1 + + # Emit complete sequences inline (streaming) + while len(buffer_ids) >= seq_len + 1: + record = _make_bpe_record( + buffer_ids[:seq_len], + buffer_ids[1:seq_len + 1], + buffer_probs[:seq_len], + buffer_top_ids[:seq_len], + buffer_mask[:seq_len], + ) + run_seqs = (seq_offset - initial_seq_offset) + stats['n_sequences'] + shard = shard_offset + run_seqs // SEQS_PER_SHARD + shard_records.setdefault(shard, []).append(record) + buffer_ids = buffer_ids[seq_len:] + buffer_probs = buffer_probs[seq_len:] + buffer_top_ids = buffer_top_ids[seq_len:] + buffer_mask = buffer_mask[seq_len:] + stats['n_sequences'] += 1 + + # Periodic flush to save RAM + for shard_idx in list(shard_records.keys()): + if len(shard_records[shard_idx]) >= 10: + shard_path = output_dir / f"shard_{shard_idx:04d}.parquet" + _write_bpe_shard(shard_records[shard_idx], shard_path) + shard_records[shard_idx] = [] + + # RAM pressure check every 200 rows + if _result_count % 200 == 0: + _ram_used, _, _ = _get_ram_usage() + if _ram_used > RAM_HARD_LIMIT_GB: + print(f" [BPE] RAM {_ram_used:.1f}GB > limit, forcing flush+GC") + for _si in list(shard_records.keys()): + if shard_records[_si]: + shard_path = output_dir / f"shard_{_si:04d}.parquet" + _write_bpe_shard(shard_records[_si], shard_path) + shard_records[_si] = [] + gc.collect() + if len(buffer_ids) > MAX_ACCUMULATED_TOKENS: + print(f" [BPE] WARNING: {len(buffer_ids)} tokens accumulated " + f"(limit {MAX_ACCUMULATED_TOKENS}), forcing GC") + gc.collect() + _check_ram_pressure("bpe-tok") + + # Batch write all remaining records per shard + for shard, records in shard_records.items(): + if records: + shard_path = output_dir / f"shard_{shard:04d}.parquet" + _write_bpe_shard(records, shard_path) + + print(f"[BPE dataset] {stats['n_sequences']} sequences (chunk), total offset {seq_offset + stats['n_sequences']}") + next_carry = { + 'ids': buffer_ids, 'probs': buffer_probs, + 'top_ids': buffer_top_ids, 'mask': buffer_mask, + } + return stats, next_carry + + +def _make_bpe_record(input_ids, labels, teacher_probs, teacher_ids_top, + teacher_mask) -> dict: + """Build a flat record dict for one BPE sequence.""" + return { + 'input_ids': input_ids, + 'labels': labels, + 'teacher_probs_bpe': [v for row in teacher_probs for v in row], + 'teacher_ids_bpe': [v for row in teacher_ids_top for v in row], + 'teacher_mask_bpe': list(teacher_mask), + } + + +def _write_bpe_shard(records: list[dict], shard_path: Path) -> None: + """Write multiple BPE records to a shard parquet in one shot.""" + if not records: + return + table = pa.table({ + 'input_ids': pa.array([r['input_ids'] for r in records], type=pa.list_(pa.int32())), + 'labels': pa.array([r['labels'] for r in records], type=pa.list_(pa.int32())), + 'teacher_probs_bpe': pa.array([r['teacher_probs_bpe'] for r in records], type=pa.list_(pa.float32())), + 'teacher_ids_bpe': pa.array([r['teacher_ids_bpe'] for r in records], type=pa.list_(pa.int32())), + 'teacher_mask_bpe': pa.array([r['teacher_mask_bpe'] for r in records], type=pa.list_(pa.bool_())), + }) + if shard_path.exists(): + existing = pq.read_table(str(shard_path)) + table = pa.concat_tables([existing, table]) + pq.write_table(table, str(shard_path)) + + +# ============================================================ +# STEP 3: Split info & upload +# ============================================================ + +def _save_stream_checkpoint(api, repo_id: str, chunk_idx: int, + byte_seq_offset: int, bpe_seq_offset: int, + byte_carry: dict, bpe_carry: dict, + shard_offset: int = 0, + initial_byte_seq_offset: int = 0, + initial_bpe_seq_offset: int = 0, + byte_shard_offset: int = 0, + bpe_shard_offset: int = 0) -> None: + """Guarda checkpoint en HF Hub para poder retomar si se corta la sesion.""" + import pickle, io + checkpoint = { + 'last_completed_chunk': chunk_idx, + 'byte_seq_offset': byte_seq_offset, + 'bpe_seq_offset': bpe_seq_offset, + 'shard_offset': shard_offset, # persisted so resume regenerates correct shard names + 'initial_byte_seq_offset': initial_byte_seq_offset, + 'initial_bpe_seq_offset': initial_bpe_seq_offset, + 'byte_shard_offset': byte_shard_offset, # per-stream offsets (v2 checkpoint) + 'bpe_shard_offset': bpe_shard_offset, + } + # Metadata JSON + buf = io.BytesIO(json.dumps(checkpoint).encode()) + _hf_upload_with_retry(api, buf, 'stream_checkpoint.json', repo_id) + # Carry states (pickle) + carry_buf = io.BytesIO(pickle.dumps({'byte': byte_carry, 'bpe': bpe_carry})) + _hf_upload_with_retry(api, carry_buf, 'stream_carry.pkl', repo_id) + print(f" [checkpoint] Chunk {chunk_idx} saved to HF Hub") + + +def _load_stream_checkpoint(api, repo_id: str): + """Carga checkpoint de HF Hub. Retorna (checkpoint_dict, carry_dict) o (None, None).""" + import pickle + from huggingface_hub import hf_hub_download + try: + files = list(api.list_repo_files(repo_id, repo_type='dataset')) + if 'stream_checkpoint.json' not in files: + return None, None + ckpt_path = hf_hub_download(repo_id=repo_id, filename='stream_checkpoint.json', + repo_type='dataset') + with open(ckpt_path) as f: + checkpoint = json.load(f) + carry_path = hf_hub_download(repo_id=repo_id, filename='stream_carry.pkl', + repo_type='dataset') + with open(carry_path, 'rb') as f: + carry = pickle.load(f) + print(f" [checkpoint] Resuming from chunk {checkpoint['last_completed_chunk'] + 1}") + return checkpoint, carry + except Exception as e: + print(f" [checkpoint] No checkpoint found or error loading: {e}") + return None, None + + +def _save_split_info(n_sequences: int, output_dir: Path) -> None: + """Save train/val/test split with fixed seed.""" + rng = np.random.RandomState(SEED) + indices = rng.permutation(n_sequences).tolist() + + n_train = int(0.95 * n_sequences) + n_val = int(0.025 * n_sequences) + + split = { + 'train': indices[:n_train], + 'val': indices[n_train:n_train + n_val], + 'test': indices[n_train + n_val:], + 'seed': SEED, + 'n_sequences': n_sequences, + } + with open(output_dir / 'split_info.json', 'w') as f: + json.dump(split, f) + + +def _hf_upload_with_retry(api, path_or_fileobj, path_in_repo, repo_id, max_retries=3): + """Upload to HF Hub with retry on timeout/network errors.""" + for attempt in range(max_retries): + try: + api.upload_file( + path_or_fileobj=path_or_fileobj, + path_in_repo=path_in_repo, + repo_id=repo_id, + repo_type="dataset", + ) + return + except Exception as e: + if attempt < max_retries - 1: + wait = 5 * (attempt + 1) + print(f" [hub] Upload failed ({e}), retry in {wait}s...") + time.sleep(wait) + else: + print(f" [hub] Upload failed after {max_retries} attempts: {e}") + raise + + +def _upload_sealed_shards(output_dir: Path, api, repo_id: str, + repo_subdir: str, run_seqs: int, + shard_offset: int = 0) -> int: + """Upload and delete only COMPLETE shards (exactly SEQS_PER_SHARD records). + + A shard is sealed when all SEQS_PER_SHARD sequences have been written. + Incomplete (in-progress) shards are left on disk for the next chunk. + run_seqs: total sequences produced in this session (not global). + Returns count of shards uploaded. + """ + n_complete = run_seqs // SEQS_PER_SHARD + count = 0 + for i in range(n_complete): + shard_idx = shard_offset + i + shard_path = output_dir / f"shard_{shard_idx:04d}.parquet" + if shard_path.exists(): + _hf_upload_with_retry(api, str(shard_path), + f"{repo_subdir}/shard_{shard_idx:04d}.parquet", repo_id) + shard_path.unlink() + count += 1 + print(f" [hub] Uploaded + deleted {repo_subdir}/shard_{shard_idx:04d}.parquet") + return count + + +def _upload_all_shards(output_dir: Path, api, repo_id: str, repo_subdir: str) -> int: + """Upload ALL shards (sealed + incomplete). Returns count uploaded. + + Per-shard error isolation: one failed shard does NOT block the rest. + Failed shards stay on disk and will be retried on the next upload cycle. + """ + count = 0 + failed = 0 + for shard_path in sorted(output_dir.glob("shard_*.parquet")): + if '_part' in shard_path.name: + continue # skip temporary part files (shard_XXXX_partNN.parquet) + try: + _hf_upload_with_retry(api, str(shard_path), + f"{repo_subdir}/{shard_path.name}", repo_id) + shard_path.unlink() + count += 1 + except Exception as e: + failed += 1 + print(f" [hub] FAILED {repo_subdir}/{shard_path.name}: {e}", flush=True) + if count: + print(f" [hub] Uploaded {count} shards from {repo_subdir}/", flush=True) + if failed: + print(f" [hub] WARNING: {failed} shards FAILED in {repo_subdir}/ " + f"(will retry next cycle)", flush=True) + return count + + +def _clear_hf_dataset(api, repo_id: str) -> None: + """Delete ALL files from the HF dataset repo for a fresh start. + + Called when --clear-dataset is passed. Removes all shards, checkpoints, + and metadata so the pipeline starts completely fresh. + """ + try: + files = list(api.list_repo_files(repo_id, repo_type='dataset')) + # Filter out .gitattributes and README + to_delete = [f for f in files + if not f.startswith('.git') and f != 'README.md'] + if not to_delete: + print(f" [hub] Repo {repo_id} is already empty.") + return + print(f" [hub] Clearing {len(to_delete)} files from {repo_id}...") + for f in to_delete: + try: + api.delete_file(f, repo_id=repo_id, repo_type='dataset') + except Exception as e: + print(f" [hub] Could not delete {f}: {e}") + print(f" [hub] Cleared {len(to_delete)} files from {repo_id}") + except Exception as e: + print(f" [hub] Error clearing repo: {e}") + + +def upload_dataset_to_hub(local_dir: str = str(OUTPUT_DIR)) -> None: + """Upload complete dataset to HuggingFace Hub (fallback si no se usa hf-mount).""" + from huggingface_hub import HfApi + + api = HfApi() + api.create_repo(DATASET_REPO, repo_type="dataset", exist_ok=True) + api.upload_folder( + folder_path=local_dir, + repo_id=DATASET_REPO, + repo_type="dataset", + ignore_patterns=["*.tmp", "__pycache__"], + ) + print(f"\n[Upload] Dataset available at:") + print(f" https://huggingface.co/datasets/{DATASET_REPO}") + + +# ============================================================ +# MAIN: Full pipeline +# ============================================================ + +def build_full_dataset(corpus_name: str = "HuggingFaceFW/fineweb", + n_docs: int = 500_000, + skip_extraction: bool = False, + use_hf_mount: bool = False, + stream_to_hub: bool = False, + chunk_size: int = 1000, + gpu_profile_override: dict = None, + shard_offset: int = 0, + **_kwargs) -> None: + """ + Complete dataset construction pipeline. + + Step 1: Download FineWeb corpus + Step 2: Extract logprobs + projected hidden states with Qwen-7B + Step 3a: Marginalize BPEβ†’byte (with teacher_hidden for runs 13, 15) + Step 3b: Build BPE dataset + Step 4: Upload (hf-mount: ya esta en el bucket; sin mount: upload via API) + + Only needs to run ONCE. Covers all 15 ablation runs. + + Args: + use_hf_mount: si True, monta un HF Bucket y escribe directo ahi. + Los archivos van a HF storage en tiempo real, sin paso + de upload separado. Ahorra disco local en Kaggle. + """ + global OUTPUT_DIR + from datasets import load_dataset + + # Global seed for reproducibility + random.seed(SEED) + np.random.seed(SEED) + torch.manual_seed(SEED) + if torch.cuda.is_available(): + torch.cuda.manual_seed_all(SEED) + + # chunk_size=500: ~250 docs/GPU, ~63 batches at batch_size=4. + # RAM for 500-doc logprobs: ~1-2GB. Safe on Kaggle's 13GB. + chunk_size = min(chunk_size, 2500) + print(f" [config] chunk_size = {chunk_size}") + + # Si hf-mount esta habilitado, montar bucket y escribir directo ahi + mount_path = None + if use_hf_mount: + from cpu1.hub_storage import mount_bucket + mount_path = mount_bucket(DATASET_BUCKET) + OUTPUT_DIR = mount_path + print(f"[hf-mount] Output dir -> {OUTPUT_DIR} (bucket: {DATASET_BUCKET})") + + OUTPUT_DIR.mkdir(parents=True, exist_ok=True) + logprobs_path = OUTPUT_DIR / "teacher_logprobs" / "logprobs_raw.parquet" + + if not skip_extraction: + # Step 1: Download corpus + print(f"\n{'=' * 60}") + print("STEP 1: Downloading FineWeb corpus") + print(f"{'=' * 60}") + + # Step 2: Extract logprobs (the slow part) + n_gpus = torch.cuda.device_count() if torch.cuda.is_available() else 0 + _gpu_profile = gpu_profile_override or detect_gpu_profile() + print(f"\n{'=' * 60}") + print(f"STEP 2: Extracting teacher logprobs ({TEACHER_MODEL})") + print(f" GPU: {_gpu_profile['name']} ({_gpu_profile['vram_gb']:.1f} GB) " + f"fp8={_gpu_profile['fp8']} batch={_gpu_profile['batch_size']} " + f"seq={_gpu_profile['max_tokens']}") + if n_gpus >= 2: + print(f" {n_gpus} GPUs detectadas β†’ extraccion en paralelo (~3-5 hours)") + elif _gpu_profile['fp8']: + print(f" L4 detected β†’ FP8 W8A8, batch {BATCH_SIZE_TEACHER_L4}, ~2-3 hours") + else: + print(" (~6-10 hours on single T4, supports resume)") + print(f"{'=' * 60}") + + if stream_to_hub: + # === STREAMING MODE === + # 6-thread architecture with bounded queues for backpressure: + # Thread 1: corpus_download (fast, with HF_TOKEN auth) + # Thread 2: model_loader (NF4 quantization to VRAM) + # Thread 3: gpu_producer (extraction loop β†’ extraction_q) + # Thread 4: cpu_consumer (byte+BPE processing, reads extraction_q) + # Thread 5: upload_worker (reads upload_q, uploads to HF) + # Main: orchestrator + from huggingface_hub import HfApi + hf_token = os.environ.get('HF_TOKEN') + print(f" [hub] HF_TOKEN: {'configured' if hf_token else 'NOT SET / EMPTY'}") + api = HfApi(token=hf_token) + try: + api.create_repo(DATASET_REPO, repo_type="dataset", exist_ok=True) + print(f" [hub] Repo ready: {DATASET_REPO}") + except Exception as e: + print(f" [hub] create_repo FAILED: {e}") + raise + + # Verify upload actually works before spending hours on GPU + import io as _io + _test_buf = _io.BytesIO(b"upload_test") + try: + api.upload_file( + path_or_fileobj=_test_buf, + path_in_repo=".upload_test", + repo_id=DATASET_REPO, + repo_type="dataset", + ) + api.delete_file(".upload_test", repo_id=DATASET_REPO, + repo_type="dataset") + print(f" [hub] Upload verification OK (write access confirmed)") + except Exception as e: + print(f"\n [hub] *** UPLOAD VERIFICATION FAILED ***") + print(f" [hub] Token can create repo but CANNOT upload files: {e}") + print(f" [hub] Fix HF_TOKEN permissions before running pipeline!") + raise RuntimeError(f"HF upload verification failed: {e}") + + byte_dir = OUTPUT_DIR / "byte_marginalized" + bpe_dir = OUTPUT_DIR / "bpe_tokenized" + byte_dir.mkdir(parents=True, exist_ok=True) + bpe_dir.mkdir(parents=True, exist_ok=True) + + byte_seq_offset = 0 + bpe_seq_offset = 0 + byte_carry = None + bpe_carry = None + total_byte_coverage = 0.0 + total_chunks = 0 + resume_from_chunk = 0 + byte_shard_offset = shard_offset + bpe_shard_offset = shard_offset + + # Resume desde checkpoint si existe + ckpt, carry = _load_stream_checkpoint(api, DATASET_REPO) + if ckpt is not None: + resume_from_chunk = ckpt['last_completed_chunk'] + 1 + byte_seq_offset = ckpt['byte_seq_offset'] + bpe_seq_offset = ckpt['bpe_seq_offset'] + # Restore per-stream shard offsets from checkpoint + if 'byte_shard_offset' in ckpt and 'bpe_shard_offset' in ckpt: + # v2 checkpoint: per-stream offsets saved directly + byte_shard_offset = ckpt['byte_shard_offset'] + bpe_shard_offset = ckpt['bpe_shard_offset'] + elif 'shard_offset' in ckpt: + # v1 checkpoint: compute independently for each stream + _ckpt_base = ckpt['shard_offset'] + _init_byte = ckpt.get('initial_byte_seq_offset', 0) + _init_bpe = ckpt.get('initial_bpe_seq_offset', 0) + byte_shard_offset = _ckpt_base + (byte_seq_offset - _init_byte) // SEQS_PER_SHARD + bpe_shard_offset = _ckpt_base + (bpe_seq_offset - _init_bpe) // SEQS_PER_SHARD + shard_offset = byte_shard_offset # kept for backward compat references + print(f" [resume] byte_shard_offset={byte_shard_offset}, " + f"bpe_shard_offset={bpe_shard_offset}") + byte_carry = carry['byte'] + bpe_carry = carry['bpe'] + print(f" [resume] Saltando chunks 0-{resume_from_chunk - 1}, " + f"byte_seqs={byte_seq_offset}, bpe_seqs={bpe_seq_offset}") + else: + # No checkpoint β€” scan existing HF Hub shards to reconstruct state. + # If a previous session wrote shards but ended before checkpoint (chunk 5), + # we recover seq offsets and shard_offset from the actual data on HF. + try: + from huggingface_hub import hf_hub_download as _hf_dl + import pyarrow.parquet as _pq + + _existing = list(api.list_repo_files(DATASET_REPO, repo_type='dataset')) + + def _shard_files(prefix): + out = [] + for f in _existing: + if f.startswith(prefix + '/shard_') and f.endswith('.parquet'): + try: + idx = int(f.split('shard_')[1].split('.')[0]) + out.append((idx, f)) + except ValueError: + pass + return sorted(out) + + def _count_rows_on_hf(shard_list): + """Download each shard metadata-only and count rows.""" + total = 0 + max_idx = -1 + for idx, fname in shard_list: + try: + _p = _hf_dl(repo_id=DATASET_REPO, filename=fname, + repo_type='dataset') + _meta = _pq.read_metadata(_p) + total += _meta.num_rows + max_idx = max(max_idx, idx) + except Exception as _re: + print(f" [shard_scan] Could not read {fname}: {_re}") + return total, max_idx + + _byte_shards = _shard_files('byte_marginalized') + _bpe_shards = _shard_files('bpe_tokenized') + + print(f" [shard_scan] Found {len(_byte_shards)} byte shards, " + f"{len(_bpe_shards)} BPE shards on HF Hub. Counting rows...") + + _byte_rows, _byte_max_idx = _count_rows_on_hf(_byte_shards) + _bpe_rows, _bpe_max_idx = _count_rows_on_hf(_bpe_shards) + + # Next free shard index + _safe_offset = max( + _byte_max_idx + 1 if _byte_max_idx >= 0 else 0, + _bpe_max_idx + 1 if _bpe_max_idx >= 0 else 0, + shard_offset) + + # Restore seq offsets from actual shard row counts + if _byte_rows > 0: + byte_seq_offset = _byte_rows + if _bpe_rows > 0: + bpe_seq_offset = _bpe_rows + + # Estimate which chunk to skip based on bpe sequences + # BPE seqs contain SEQ_LEN_TOKENS tokens each. + # Average FineWeb doc ~200 tokens. total_tokens / tokens_per_doc = docs. + if _bpe_rows > 0: + _total_tokens = _bpe_rows * SEQ_LEN_TOKENS + _avg_tokens_per_doc = 200 # FineWeb English average + _est_docs_done = int(_total_tokens / _avg_tokens_per_doc) + _est_chunks_done = max(0, _est_docs_done // chunk_size - 1) + resume_from_chunk = _est_chunks_done + print(f" [shard_scan] ~{_est_docs_done:,} docs ({_total_tokens:,} tokens) " + f"in shards \u2192 skipping ~{_est_chunks_done} chunks") + + shard_offset = _safe_offset + byte_shard_offset = shard_offset + bpe_shard_offset = shard_offset + + print(f" [shard_scan] Recovered: byte_seqs={byte_seq_offset}, " + f"bpe_seqs={bpe_seq_offset}, shard_offset={shard_offset}, " + f"resume_from_chunkβ‰ˆ{resume_from_chunk}") + print(f" [shard_scan] NOTE: carry state unknown (no checkpoint). " + f"Sequences will append correctly but boundary may shift slightly.") + + except Exception as _e: + print(f" [shard_scan] Could not scan HF Hub: {_e}. " + f"Using defaults (shard_offset={shard_offset})") + + initial_byte_seq_offset = byte_seq_offset + initial_bpe_seq_offset = bpe_seq_offset + _pipeline_t0 = time.time() + + # Pre-import to avoid threading import lock and lazy module race conditions + import transformers + import datasets + + # ================================================================ + # PHASE 0: Fast Cold Start β€” corpus + models in parallel (<3 min) + # ================================================================ + n_gpus = torch.cuda.device_count() if torch.cuda.is_available() else 0 + _gpu_profile = gpu_profile_override or detect_gpu_profile() + + _preloaded_models = [] + _corpus_texts = [] + _load_errors = [] + + def _load_corpus(): + try: + _texts = _fast_download_corpus( + corpus_name, n_docs, hf_token=hf_token) + _corpus_texts.extend(_texts) + except Exception as _e: + _load_errors.append(("corpus", _e)) + + def _load_models(): + try: + for _gid in range(max(n_gpus, 1)): + _dev = f"cuda:{_gid}" if n_gpus > 0 else "cpu" + _m, _tok = load_teacher(device=_dev, profile=_gpu_profile) + torch.cuda.empty_cache() + _preloaded_models.append((_m, _tok)) + print(f" [models] {len(_preloaded_models)} teacher(s) loaded", flush=True) + except Exception as _e: + _load_errors.append(("models", _e)) + + print(f"\n[Pipeline] Phase 0: Fast cold start (target <3 min)...") + _t0_cold = time.time() + _t_corpus = threading.Thread(target=_load_corpus, name="corpus-loader", daemon=True) + _t_models = threading.Thread(target=_load_models, name="model-loader", daemon=True) + _t_corpus.start(); _t_models.start() + _t_corpus.join(); _t_models.join() + + if _load_errors: + for _n, _e in _load_errors: + print(f" [ERROR] {_n}: {_e}") + raise _load_errors[0][1] + + texts = _corpus_texts + # Sort by length: enables efficient bucket batching (short docs get + # bigger batches since attention is O(SΒ²)). ~3Γ— throughput improvement. + texts.sort(key=len) + _cold_time = time.time() - _t0_cold + print(f"[Pipeline] Cold start done in {_cold_time:.1f}s β€” " + f"{len(texts):,} docs + {len(_preloaded_models)} models ready.") + + # Save corpus sample (non-blocking, tiny) + corpus_path = OUTPUT_DIR / "corpus_texts.json" + with open(corpus_path, 'w') as f: + json.dump(texts[:1000], f) + + # ================================================================ + # PHASE 1: VRAM Calibration β€” find optimal batch size per GPU + # ================================================================ + print(f"\n[Pipeline] Phase 1: VRAM calibration (target {TARGET_VRAM_GB}GB)...") + _calibrated_batch = {} + for _gid in range(len(_preloaded_models)): + _m, _tok = _preloaded_models[_gid] + _cal_profile = dict(_gpu_profile) + _calibrated_batch[_gid] = _calibrate_batch_size(_m, _tok, _cal_profile) + print(f"[Pipeline] Calibrated: " + f"{', '.join(f'GPU{g}={_calibrated_batch[g]}' for g in _calibrated_batch)}") + + # ================================================================ + # PHASE 2: Concurrent Pipeline β€” GPU β†’ CPU β†’ Upload + # ================================================================ + # Bounded queues enforce backpressure: + # - extraction_q(maxsize=2): GPU blocks if CPU falls behind + # - upload_q(maxsize=6): CPU blocks if upload falls behind + # This keeps resource usage stable and predictable. + print(f"\n[Pipeline] Phase 2: Starting pipeline " + f"(extraction_q={EXTRACTION_QUEUE_DEPTH}, " + f"upload_q={UPLOAD_QUEUE_DEPTH})...") + + # Use conservative CPU workers to avoid deadlock from fork() lock + # contention. Oversubscription was causing frozen workers on Kaggle. + _total_cpu = max(2, os.cpu_count() or 2) + _byte_workers = max(1, _total_cpu - 1) # cores-1 to avoid lock contention deadlock + _bpe_workers = max(1, _total_cpu - 1) # cores-1 for BPE (same to avoid deadlock) + print(f" [CPU] {_total_cpu} cores: {_byte_workers} byte + {_bpe_workers} BPE workers (conservative)") + _extraction_q = Queue(maxsize=EXTRACTION_QUEUE_DEPTH) + _upload_q = Queue(maxsize=UPLOAD_QUEUE_DEPTH) + _gpu_error = [None] + _upload_error = [None] + _upload_success_count = [0] # total shards successfully uploaded + _upload_fail_count = [0] # total shard upload failures + _chunks_since_reset = [0] + _upload_done = threading.Event() + _last_ckpt_shard = [0] # track last checkpointed shard for every-N-shard checkpoint + _last_upload_shard = [0] # track last uploaded shard for batched uploads + + # ---- Persistent worker pools (no per-batch fork overhead) ---- + # NO max_tasks_per_child: restarting workers via fork() inherits the + # tokenizer's locked Rust mutexes from the parent process, causing + # instant deadlock. Workers live for the entire pipeline run. + _bpe_pool = ProcessPoolExecutor(max_workers=_bpe_workers) + _byte_pool = ProcessPoolExecutor(max_workers=_byte_workers) + + # ---- Upload Worker Thread ---- + def _upload_worker(): + """Dedicated upload thread: reads from upload_q, uploads to HF.""" + try: + while True: + item = _upload_q.get() + if item is None: # sentinel + break + action, payload = item + try: + if action == 'shards': + _byte_dir, _bpe_dir, _byte_run, _bpe_run, _bso, _pso = payload + _n1 = _upload_sealed_shards(_byte_dir, api, DATASET_REPO, "byte_marginalized", _byte_run, _bso) + _n2 = _upload_sealed_shards(_bpe_dir, api, DATASET_REPO, "bpe_tokenized", _bpe_run, _pso) + _upload_success_count[0] += _n1 + _n2 + gc.collect() # free memory from uploaded shard data + elif action == 'final_shards': + _byte_dir, _bpe_dir = payload + _n1 = _upload_all_shards(_byte_dir, api, DATASET_REPO, "byte_marginalized") + _n2 = _upload_all_shards(_bpe_dir, api, DATASET_REPO, "bpe_tokenized") + _upload_success_count[0] += _n1 + _n2 + gc.collect() + elif action == 'checkpoint': + _ci, _bso, _pso, _bc, _pc, _so, _ibso, _ipso, _byte_so, _bpe_so = payload + _save_stream_checkpoint(api, DATASET_REPO, _ci, + _bso, _pso, _bc, _pc, + shard_offset=_so, + initial_byte_seq_offset=_ibso, + initial_bpe_seq_offset=_ipso, + byte_shard_offset=_byte_so, + bpe_shard_offset=_bpe_so) + except Exception as _e: + _upload_fail_count[0] += 1 + print(f" [Upload] *** ERROR #{_upload_fail_count[0]} ***: {_e}", + flush=True) + traceback.print_exc() + except Exception as _e: + _upload_error[0] = _e + print(f" [Upload] *** FATAL: upload worker died: {_e} ***", flush=True) + traceback.print_exc() + finally: + _upload_done.set() + + _upload_thread = threading.Thread( + target=_upload_worker, daemon=True, name="upload-worker") + _upload_thread.start() + + # ---- GPU Producer Thread ---- + _gpu_idle_total = [0.0] # S11: total time GPU blocked on queue.put() + + def _gpu_producer(): + """Extract logprobs on GPU, push chunk info to extraction_q. + + The extraction_q has maxsize=EXTRACTION_QUEUE_DEPTH, so if CPU + processing falls behind, this thread blocks on .put() β€” natural + backpressure that prevents /tmp from filling up. + """ + try: + n_chunks = (len(texts) + chunk_size - 1) // chunk_size + for _cs in range(0, len(texts), chunk_size): + _ce = min(_cs + chunk_size, len(texts)) + _ci = _cs // chunk_size + if _ci < resume_from_chunk: + continue + + # --- Model reset for VRAM defragmentation --- + _chunks_since_reset[0] += 1 + if (_chunks_since_reset[0] > MODEL_RESET_EVERY_CHUNKS + and torch.cuda.is_available()): + _chunks_since_reset[0] = 0 + print(f"\n [GPU] Model reset triggered " + f"(every {MODEL_RESET_EVERY_CHUNKS} chunks)...") + new_models = _reset_models( + _preloaded_models, _gpu_profile) + _preloaded_models.clear() + _preloaded_models.extend(new_models) + # Re-calibrate after reset + for _gid in range(len(_preloaded_models)): + _m, _tok = _preloaded_models[_gid] + _calibrated_batch[_gid] = _calibrate_batch_size( + _m, _tok, dict(_gpu_profile)) + + _ctexts = texts[_cs:_ce] + _tmp = Path(f'/tmp/logprobs_chunk_{_ci:04d}.parquet') + _elapsed = time.time() - _pipeline_t0 + print(f"\n [GPU] Extracting chunk {_ci+1}/{n_chunks} " + f"(docs {_cs}-{_ce-1}) " + f"[{_elapsed/60:.1f}min elapsed]...", flush=True) + _extract_t0 = time.time() + run_logprob_extraction( + _ctexts, str(_tmp), resume=False, + preloaded_models=_preloaded_models) + _extract_elapsed = time.time() - _extract_t0 + # S11: Track GPU idle time (blocked on queue.put) + _put_t0 = time.time() + _extraction_q.put((_ci, _cs, _ce)) + _put_wait = time.time() - _put_t0 + _gpu_idle_total[0] += _put_wait + if _put_wait > 0.5: + print(f" [GPU IDLE] Blocked {_put_wait:.1f}s on extraction_q.put() " + f"(CPU too slow) β€” extraction took {_extract_elapsed:.1f}s") + del _ctexts + except Exception as _e: + traceback.print_exc() + _gpu_error[0] = _e + finally: + _extraction_q.put(None) # sentinel + + _gpu_thread = threading.Thread( + target=_gpu_producer, name="gpu-producer", daemon=True) + _gpu_thread.start() + + chunk_idx = max(0, resume_from_chunk - 1) + _cpu_idle_total = 0.0 # S11: total time CPU blocked on extraction_q.get() + + # ---- CPU Consumer: byte + BPE in parallel, then queue upload ---- + while True: + # S11: Track CPU idle time (waiting for GPU) + _get_t0 = time.time() + _item = _extraction_q.get() + _get_wait = time.time() - _get_t0 + _cpu_idle_total += _get_wait + if _item is None: + break + if _get_wait > 0.5: + print(f" [CPU IDLE] Blocked {_get_wait:.1f}s on extraction_q.get() " + f"(GPU too slow)") + chunk_idx, chunk_start, chunk_end = _item + total_chunks += 1 + + _chunk_t0 = time.time() + print(f"\n{'=' * 60}") + print(f"CHUNK {chunk_idx+1}: docs {chunk_start}-{chunk_end-1} " + f"[CPU processing while GPU extracts next]") + print(f"{'=' * 60}") + + # Parquet path used as glob stem + tmp_parquet = Path(f'/tmp/logprobs_chunk_{chunk_idx:04d}.parquet') + _tmp_stem = tmp_parquet.stem + _part_files = sorted(tmp_parquet.parent.glob(f"{_tmp_stem}_part*.parquet")) + if not _part_files: + raise RuntimeError( + f"Extraction failed for chunk {chunk_idx}: " + f"no part files found matching /tmp/{_tmp_stem}_part*.parquet") + + # Run byte then BPE SEQUENTIALLY (not parallel). + # Two ProcessPoolExecutor pools fighting for the same CPU cores + # causes IPC pipe deadlocks where both pools block waiting for + # workers that are starved of CPU time. Sequential avoids this. + _byte_res = [None] + _bpe_res = [None] + _cpu_errs = [] + + _byte_t0 = time.time() + try: + _byte_res[0] = build_byte_level_dataset( + str(tmp_parquet), str(byte_dir), + seq_offset=byte_seq_offset, carry_state=byte_carry, + n_workers=_byte_workers, + shard_offset=byte_shard_offset, + executor=_byte_pool, + initial_seq_offset=initial_byte_seq_offset) + except Exception as _e: + _cpu_errs.append(("byte", _e)) + + try: + _bpe_res[0] = build_bpe_dataset( + str(tmp_parquet), str(bpe_dir), + seq_offset=bpe_seq_offset, carry_state=bpe_carry, + n_workers=_bpe_workers, + executor=_bpe_pool, + shard_offset=bpe_shard_offset, + initial_seq_offset=initial_bpe_seq_offset) + except Exception as _e: + _cpu_errs.append(("bpe", _e)) + _cpu_proc_elapsed = time.time() - _byte_t0 + + if _cpu_errs: + for _n, _e in _cpu_errs: + print(f" [ERROR] {_n}: {_e}") + raise _cpu_errs[0][1] + + b_stats, byte_carry = _byte_res[0] + p_stats, bpe_carry = _bpe_res[0] + byte_seq_offset += b_stats['n_sequences'] + bpe_seq_offset += p_stats['n_sequences'] + total_byte_coverage += b_stats.get('coverage_pct', 0) + + # Clean up part files AFTER both builders finish (safe β€” no race) + for _pf in _part_files: + _pf.unlink(missing_ok=True) + + _chunk_elapsed = time.time() - _chunk_t0 + _docs_in_chunk = chunk_end - chunk_start + _docs_per_sec = _docs_in_chunk / max(_chunk_elapsed, 0.01) + + # Queue upload every UPLOAD_EVERY_SHARDS complete shards + # (byte+BPE together so HF always has complete sets) + _current_upload_shard = byte_seq_offset // SEQS_PER_SHARD + if _current_upload_shard >= _last_upload_shard[0] + UPLOAD_EVERY_SHARDS: + _last_upload_shard[0] = _current_upload_shard + _upload_q.put(('shards', (byte_dir, bpe_dir, + byte_seq_offset - initial_byte_seq_offset, + bpe_seq_offset - initial_bpe_seq_offset, + byte_shard_offset, bpe_shard_offset))) + + # S12: Per-chunk resource summary + _vram_msg = "" + if torch.cuda.is_available(): + for _gi in range(torch.cuda.device_count()): + free, total = torch.cuda.mem_get_info(_gi) + used = (total - free) / 1024**3 + frag = _check_vram_fragmentation(_gi) + _vram_msg += f" GPU{_gi}={used:.1f}GB(frag={frag:.0%})" + + gc.collect() + _ram_used, _ram_total, _ram_frac = _get_ram_usage() + _check_ram_pressure("chunk-end") + + # RAM backpressure: if too high, wait for upload worker to drain shards + if _ram_used > RAM_HARD_LIMIT_GB: + print(f" [RAM] {_ram_used:.1f}GB > {RAM_HARD_LIMIT_GB}GB limit, " + f"waiting for upload queue to drain...", flush=True) + while not _upload_q.empty(): + time.sleep(0.5) + gc.collect() + _ram_used, _ram_total, _ram_frac = _get_ram_usage() + print(f" [RAM] After drain+GC: {_ram_used:.1f}/{_ram_total:.1f}GB") + + # S11+S12: Combined resource + idle summary + try: + import psutil + _cpu_pct = psutil.cpu_percent(interval=0.1) + except Exception: + _cpu_pct = -1 + print(f" [Chunk {chunk_idx+1}] Done in {_chunk_elapsed:.1f}s " + f"(byte+BPE={_cpu_proc_elapsed:.1f}s, {_docs_per_sec:.1f} docs/s)") + print(f" CPU={_cpu_pct:.0f}%{_vram_msg} " + f"RAM={_ram_used:.1f}/{_ram_total:.1f}GB({_ram_frac*100:.0f}%)") + print(f" Idle totals: GPU_blocked={_gpu_idle_total[0]:.1f}s " + f"CPU_blocked={_cpu_idle_total:.1f}s") + print(f" Uploads: {_upload_success_count[0]} ok, " + f"{_upload_fail_count[0]} failed, " + f"queue={_upload_q.qsize()}/{UPLOAD_QUEUE_DEPTH}") + + # Early warning if upload worker died + if _upload_done.is_set() and _upload_error[0]: + print(f" [Upload] *** UPLOAD WORKER DIED: {_upload_error[0]} ***", + flush=True) + + # Checkpoint every CHECKPOINT_EVERY_SHARDS complete shard pairs + _current_shard = byte_seq_offset // SEQS_PER_SHARD + if (_current_shard >= _last_ckpt_shard[0] + CHECKPOINT_EVERY_SHARDS + and _current_shard > 0): + _last_ckpt_shard[0] = _current_shard + # Compute CURRENT shard offsets so resume doesn't overwrite existing shards + _ckpt_byte_shard = byte_shard_offset + (byte_seq_offset - initial_byte_seq_offset) // SEQS_PER_SHARD + _ckpt_bpe_shard = bpe_shard_offset + (bpe_seq_offset - initial_bpe_seq_offset) // SEQS_PER_SHARD + _upload_q.put(('checkpoint', ( + chunk_idx, byte_seq_offset, bpe_seq_offset, + byte_carry, bpe_carry, shard_offset, + initial_byte_seq_offset, initial_bpe_seq_offset, + _ckpt_byte_shard, _ckpt_bpe_shard))) + print(f" [checkpoint] Triggered at shard {_current_shard} " + f"(every {CHECKPOINT_EVERY_SHARDS})") + + _gpu_thread.join() + _bpe_pool.shutdown(wait=False) + _byte_pool.shutdown(wait=False) + + # S11: Final pipeline idle summary + _pipeline_elapsed = time.time() - _pipeline_t0 + print(f"\n{'=' * 60}") + print(f"PIPELINE IDLE SUMMARY ({_pipeline_elapsed/60:.1f}min total)") + print(f" GPU blocked on queue.put(): {_gpu_idle_total[0]:.1f}s " + f"({_gpu_idle_total[0]/_pipeline_elapsed*100:.1f}% of pipeline)") + print(f" CPU blocked on queue.get(): {_cpu_idle_total:.1f}s " + f"({_cpu_idle_total/_pipeline_elapsed*100:.1f}% of pipeline)") + if _gpu_idle_total[0] > _cpu_idle_total: + print(f" β†’ BOTTLENECK: CPU is slower than GPU " + f"(GPU waited {_gpu_idle_total[0]-_cpu_idle_total:.1f}s more)") + elif _cpu_idle_total > _gpu_idle_total[0]: + print(f" β†’ BOTTLENECK: GPU is slower than CPU " + f"(CPU waited {_cpu_idle_total-_gpu_idle_total[0]:.1f}s more)") + else: + print(f" β†’ Pipeline perfectly balanced") + print(f"{'=' * 60}") + + if _gpu_error[0]: + raise _gpu_error[0] + + # Queue final uploads for any remaining shards (including incomplete ones) + _upload_q.put(('final_shards', (byte_dir, bpe_dir))) + + # Queue final checkpoint with CURRENT shard offsets + _final_byte_shard = byte_shard_offset + (byte_seq_offset - initial_byte_seq_offset) // SEQS_PER_SHARD + _final_bpe_shard = bpe_shard_offset + (bpe_seq_offset - initial_bpe_seq_offset) // SEQS_PER_SHARD + _upload_q.put(('checkpoint', ( + chunk_idx, byte_seq_offset, bpe_seq_offset, + byte_carry, bpe_carry, shard_offset, + initial_byte_seq_offset, initial_bpe_seq_offset, + _final_byte_shard, _final_bpe_shard))) + + # Signal upload worker to finish and wait + _upload_q.put(None) # sentinel + _upload_thread.join(timeout=300) # 5 min max for final uploads + + if _upload_error[0]: + print(f" [WARN] Upload worker had errors: {_upload_error[0]}") + + # Upload any truly remaining shards (safety net) + print("\n Uploading remaining shards (safety net)...") + _upload_all_shards(byte_dir, api, DATASET_REPO, "byte_marginalized") + _upload_all_shards(bpe_dir, api, DATASET_REPO, "bpe_tokenized") + + # Save split info and upload + _save_split_info(byte_seq_offset, byte_dir) + _save_split_info(bpe_seq_offset, bpe_dir) + for info_file in [byte_dir / 'split_info.json', bpe_dir / 'split_info.json']: + if info_file.exists(): + subdir = "byte_marginalized" if "byte" in info_file.parent.name else "bpe_tokenized" + api.upload_file( + path_or_fileobj=str(info_file), + path_in_repo=f"{subdir}/split_info.json", + repo_id=DATASET_REPO, repo_type="dataset", + ) + + # Save projection matrix and upload + proj = _get_projection_matrix(TEACHER_HIDDEN_DIM) + proj_path = OUTPUT_DIR / "projection_matrix.npy" + np.save(str(proj_path), proj.numpy()) + api.upload_file( + path_or_fileobj=str(proj_path), + path_in_repo="projection_matrix.npy", + repo_id=DATASET_REPO, repo_type="dataset", + ) + proj_path.unlink(missing_ok=True) + + byte_stats = {'n_sequences': byte_seq_offset, + 'coverage_pct': total_byte_coverage / max(total_chunks, 1)} + bpe_stats = {'n_sequences': bpe_seq_offset} + + _total_elapsed = time.time() - _pipeline_t0 + print(f"\n[Pipeline] Total time: {_total_elapsed/60:.1f} min " + f"({_total_elapsed/3600:.2f} hours)") + print(f"[Pipeline] Cold start: {_cold_time:.1f}s, " + f"Chunks: {total_chunks}, " + f"Throughput: {len(texts)/_total_elapsed:.1f} docs/s") + + else: + run_logprob_extraction(texts, str(logprobs_path), resume=True) + + if not stream_to_hub: + if skip_extraction: + assert logprobs_path.exists(), ( + f"Logprobs not found at {logprobs_path}. " + f"Run without --skip_extraction first." + ) + + # Step 3a: Byte-level dataset + print(f"\n{'=' * 60}") + print("STEP 3a: Building byte-level dataset (runs 08-15)") + print(f"{'=' * 60}") + + byte_dir = OUTPUT_DIR / "byte_marginalized" + byte_stats, _ = build_byte_level_dataset( + str(logprobs_path), + str(byte_dir), + ) + _save_split_info(byte_stats['n_sequences'], byte_dir) + + # Step 3b: BPE dataset + print(f"\n{'=' * 60}") + print("STEP 3b: Building BPE dataset (runs 01-07)") + print(f"{'=' * 60}") + + bpe_dir = OUTPUT_DIR / "bpe_tokenized" + bpe_stats, _ = build_bpe_dataset( + str(logprobs_path), + str(bpe_dir), + ) + _save_split_info(bpe_stats['n_sequences'], bpe_dir) + + # Save projection matrix for reproducibility + proj = _get_projection_matrix(TEACHER_HIDDEN_DIM) + np.save(str(OUTPUT_DIR / "projection_matrix.npy"), proj.numpy()) + + # Step 4: Upload o unmount + if use_hf_mount and mount_path is not None: + print(f"\n{'=' * 60}") + print("STEP 4: Datos ya en HF Bucket (hf-mount, sin upload separado)") + print(f"{'=' * 60}") + from cpu1.hub_storage import unmount + unmount(mount_path) + else: + print(f"\n{'=' * 60}") + print("STEP 4: Uploading to HuggingFace Hub") + print(f"{'=' * 60}") + upload_dataset_to_hub() + + # Summary + print(f"\n{'=' * 60}") + print("DATASET READY β€” Summary") + print(f"{'=' * 60}") + print(f" Byte-level: {byte_stats['n_sequences']:,} sequences") + print(f" BPE: {bpe_stats['n_sequences']:,} sequences") + print(f" Coverage teacher (byte): {byte_stats['coverage_pct']:.1f}%") + if stream_to_hub: + print(f" Hub: https://huggingface.co/datasets/{DATASET_REPO} (streaming mode)") + elif use_hf_mount: + print(f" Bucket: {DATASET_BUCKET} (via hf-mount)") + else: + print(f" Hub: https://huggingface.co/datasets/{DATASET_REPO}") + print(f"\n All 15 ablation runs can start now.") + print(f" Teacher hidden (projected {ALIGN_DIM}d) included for EmbeddingAligner.") + print(f" Teacher does NOT need to run again.") + + +if __name__ == "__main__": + import sys + + if len(sys.argv) == 1: + # No arguments -> run byte_marginalization tests + print("Sin argumentos -> corriendo tests\n") + print("=" * 60) + test_alignment_cases() + print() + test_first_byte_marginalization() + print() + test_document_processing() + print() + test_document_packing() + print("\n" + "=" * 60) + print("Todos los tests pasaron.") + elif '--logprobs-dir' in sys.argv or '--validate' in sys.argv: + # Byte marginalization mode + args = parse_args() + if args.validate: + builder = DistillationDatasetBuilder( + logprobs_dir=args.logprobs_dir or ".", + output_dir=args.output_dir, + seq_len=args.seq_len, + ) + builder.validate_sample() + elif args.logprobs_dir: + builder = DistillationDatasetBuilder( + logprobs_dir=args.logprobs_dir, + output_dir=args.output_dir, + seq_len=args.seq_len, + ) + builder.build() + else: + print("Error: --logprobs-dir requerido") + else: + # Full pipeline mode + parser = argparse.ArgumentParser( + description="Build shared dataset for CPU-1 ablation study" + ) + parser.add_argument('--n_docs', type=int, default=50_000, + help="Number of FineWeb documents") + parser.add_argument('--skip_extraction', action='store_true', + help="Skip logprob extraction (if already exists)") + parser.add_argument('--only_upload', action='store_true', + help="Only upload existing dataset to Hub") + parser.add_argument('--hf-mount', action='store_true', + help="Write dataset directly to HF Bucket via hf-mount " + "(no local copy, no upload step)") + parser.add_argument('--stream-to-hub', action='store_true', + help="Stream dataset directly to HF Hub chunk-by-chunk " + "(enables checkpointing, required for long runs on Kaggle)") + parser.add_argument('--shard-offset', type=int, default=0, + help="Shard index offset β€” use 1 if series 0000 is already " + "on HF Hub (shard_0001.parquet, shard_0002.parquet, ...)") + parser.add_argument('--lightning-l4', action='store_true', + help="Force L4 profile (Lightning AI 24GB L4): " + f"FP8 W8A8 quantization, batch {BATCH_SIZE_TEACHER_L4}, seq {MAX_EXTRACTION_TOKENS_L4}") + args = parser.parse_args() + + _forced_profile = None + if args.lightning_l4: + _forced_profile = { + 'name': 'NVIDIA L4 (forced)', 'vram_gb': 24.0, + 'batch_size': BATCH_SIZE_TEACHER_L4, + 'max_tokens': MAX_EXTRACTION_TOKENS_L4, + 'fp8': True, 'dtype': torch.bfloat16, + 'logit_chunk_size': 512, + 'cpu_workers': 4, + } + print("[Config] --lightning-l4: L4 profile forced " + f"(batch={BATCH_SIZE_TEACHER_L4}, seq={MAX_EXTRACTION_TOKENS_L4}, fp8=True)") + + if args.only_upload: + upload_dataset_to_hub() + else: + build_full_dataset(n_docs=args.n_docs, + skip_extraction=args.skip_extraction, + use_hf_mount=args.hf_mount, + stream_to_hub=args.stream_to_hub, + gpu_profile_override=_forced_profile, + shard_offset=args.shard_offset) diff --git a/evaluation/source/docs/model_cards/cpu1-ablation-checkpoints.md b/evaluation/source/docs/model_cards/cpu1-ablation-checkpoints.md new file mode 100644 index 0000000000000000000000000000000000000000..0c8a58df992ededfb55ff2a776dfa41df14b2102 --- /dev/null +++ b/evaluation/source/docs/model_cards/cpu1-ablation-checkpoints.md @@ -0,0 +1,383 @@ +--- +license: apache-2.0 +language: +- en +tags: +- cpu-1 +- ablation +- ternary +- research +--- + +# CPU-1 ablations: training checkpoint archive + +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. + +For evaluated FP32 exports, see [Cukinator/cpu1-ablations-final](https://huggingface.co/Cukinator/cpu1-ablations-final). Source code: [igna-s/New-1.58](https://github.com/igna-s/New-1.58). + +## What the audit found + +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. + +| Check | Outcome | +|---|---| +| Strict checkpoint loading | 34/34 loaded | +| Numerical evaluation | 4 models produced an evaluation error | +| Prefix causality | 14/30 finite-output models failed | +| Recurrent chunk equivalence | 26/26 recurrent models failed | + +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. + +## What is stored + +- `checkpoint__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. +- `checkpoint__step.pt`: intermediate training state; includes saved configuration and model state, and may include optimizer state. `_phase2_step.pt` names distinguish phase-2 files where present. +- 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. +- A folder without `_final.pt` is an intermediate-checkpoint archive. The highest filename step establishes the highest stored step; it does not establish convergence, completed training budget, or an early-stop reason. + +## Archive inventory + +| Folder | Step files | Highest filename step | Final file MB | Total GB | +|---|---:|---:|---:|---:| +| `run_01` | 21 | 900 | 109.51 | 7.009 | +| `run_01_v3` | 72 | 12173 | β€” | 23.656 | +| `run_02` | 21 | 640 | 77.71 | 4.974 | +| `run_02_v3` | 73 | 10963 | β€” | 17.020 | +| `run_02a_byte_only_heads` | 21 | 640 | 77.04 | 4.931 | +| `run_02a_byte_only_heads_v3` | 75 | 16327 | β€” | 17.337 | +| `run_03` | 21 | 640 | 77.72 | 4.974 | +| `run_03_v3` | 71 | 6187 | β€” | 16.555 | +| `run_04` | 21 | 640 | 9.89 | 1.643 | +| `run_04_r2` | 21 | 4840 | 9.90 | 1.643 | +| `run_04_v3` | 71 | 6074 | β€” | 16.568 | +| `run_05` | 21 | 640 | 10.19 | 1.650 | +| `run_05_v3` | 71 | 4390 | β€” | 16.632 | +| `run_05b_kernel_strict` | 21 | 600 | 9.38 | 1.517 | +| `run_05b_kernel_strict_v3` | 71 | 2573 | β€” | 15.288 | +| `run_06` | 21 | 640 | 10.19 | 1.650 | +| `run_06_v3` | 71 | 4237 | β€” | 16.632 | +| `run_07` | 21 | 640 | 10.26 | 1.652 | +| `run_07_r2` | 21 | 4860 | β€” | 1.641 | +| `run_08` | 21 | 640 | 9.88 | 1.643 | +| `run_08_v3` | 71 | 3858 | β€” | 16.567 | +| `run_09` | 21 | 640 | 10.39 | 1.669 | +| `run_10` | 21 | 640 | 10.41 | 1.669 | +| `run_13` | 21 | 600 | 3.38 | 1.586 | +| `run_13_r2` | 21 | 1560 | 3.39 | 1.586 | +| `run_13_v3` | 72 | 9290 | β€” | 5.426 | +| `run_14` | 21 | 600 | 2.94 | 0.453 | +| `run_14_r2` | 21 | 1320 | 2.94 | 0.453 | +| `run_14_v3` | 75 | 9775 | β€” | 4.820 | +| `run_15` | 21 | 600 | 3.02 | 0.455 | +| `run_15_r2` | 21 | 1340 | 3.02 | 0.455 | +| `run_15_v3` | 70 | 2350 | β€” | 4.516 | +| `run_16` | 21 | 600 | 2.94 | 0.453 | +| `run_16_r2` | 21 | 1320 | 2.94 | 0.453 | + +Sizes use decimal MB and GB. Step counts include phase-2 step files. Highest step is parsed from filenames and does not merge training phases into a continuous training counter. + +## 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) +path = hf_hub_download("Cukinator/cpu1-ablation-checkpoints", "run_04/checkpoint_run_04_final.pt", + revision="fb402d025e843ed00fb990966bf2430c32eb958c", local_dir="D:/cpu1/active", cache_dir="D:/cpu1/hf/hub") +from training.ablation import build_ablation_model, load_ablation_checkpoint +state, config = load_ablation_checkpoint(path) +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 `evaluation/audit.py`. Generation remains experimental; inspect the saved examples before choosing a checkpoint. + +## Experiment provenance + +The source repository preserves the historical Kaggle, Lightning and AMD code. The 34 exported configurations, checkpoint hashes and saved steps are indexed in `evaluation/source/experiments/published/manifest.json`. See the [provenance review](https://github.com/igna-s/New-1.58/tree/main/docs/provenance). Current presets differ from some published configurations; use `--config` to select a recorded experiment. The source commit of each training job and a complete training dependency lock were not recorded. + +## Resume training + +Use an intermediate checkpoint, not an inference-only packed final. The current source CLI names the argument `--resume_ckpt`: + +```powershell +python -m training.ablation --run run_04 --config experiments/published/configs/run_04.json --resume_ckpt D:/cpu1/active/run_04/checkpoint_run_04_step640.pt --skip-install +``` + +Download the exact step file from its run folder first. Resume requires matching source/configuration, dependencies, and suitable training hardware. This audit did not run a training-resume experiment. + +## Scope of the measured results + +The results below were measured on the 34 published exports in [Cukinator/cpu1-ablations-final](https://huggingface.co/Cukinator/cpu1-ablations-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. + +## Evaluation protocol + +This card was rebuilt from a fresh CPU audit on **2026-10-06**. All 34 published FP32 exports were attempted; 34 loaded with zero missing or unexpected state keys. Numerical and loading errors remain visible. Raw JSON, the exact text sample, and the repository inventories are included in [`evaluation/`](https://huggingface.co/Cukinator/cpu1-ablation-checkpoints/tree/main/evaluation). Previous `resultados/ablation_*.json` reports are historical and were not mixed into these tables. + +- Hardware: Intel Core i7-8750H (6 cores / 12 logical processors), Windows 11; CPU execution with **1 PyTorch thread**, batch size 1, FP32 parameters. PyTorch 2.6.0+cu124. No custom C/C++ kernels were used. +- Test text: [`Salesforce/wikitext`, `wikitext-2-raw-v1`, test split](https://huggingface.co/datasets/Salesforce/wikitext). First 32 non-heading paragraphs with at least 260 UTF-8 bytes, each truncated to 260 bytes without an incomplete trailing character. This is a small diagnostic sample, not the complete benchmark. No exhaustive training-overlap audit was performed. +- Corpus attribution: WikiText by its dataset authors, based on English Wikipedia contributions. The dataset metadata lists CC-BY-SA-3.0 and GFDL; the included corpus excerpt retains those upstream terms, separately from the model repository license. See `evaluation/CORPUS_LICENSE.txt`. +- Dataset revision: `b08601e04326c79dfdd32d625aee71d232d685c3`; exact file: `wikitext-2-raw-v1/test-00000-of-00001.parquet`; parquet SHA-256: `5f1bea067869d04849c0f975a2b29c4ff47d867f484f5010ea5e861eab246d91`. +- Shared sample JSON SHA-256: `11d143c06478ff7bbe364c541a58e6a2e76504c4cb0595b294f46e98f3cfe798`. +- 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. +- 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. +- BPE models shared one Qwen tokenizer, resolved at runtime. The original audit did not capture its resolved revision (null in the records); that missing pin limits exact BPE reproduction. Inspect tokenizer_revision in each result when reproducing later runs. +- 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. +- DeleteGate is disabled consistently: phase 1, elimination rate 0. The audit does not measure token elimination, phase-2 quality, or the benefit of DeleteGate. +- 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. +- Byte generation: three prompts, 128 new bytes per prompt, seeds 42/43/44, temperature 1.0, top-k 40, top-p 0.9. Recurrent models carry state; Transformers reprocess the growing context. Generated bytes/s includes prompt prefill and local sampling. UTF-8 validity is tested on the complete continuation. Samples are retained as hex and decoded text. BPE generation is N/A because vocabulary truncation prevents an equivalent byte-output comparison. +- Printable ASCII fraction, UTF-8 validity, and repetition are diagnostics; they do not measure factual accuracy, instruction following, or useful language quality. RAM columns report parameter storage, not a measured peak process footprint. Ternary models still hold FP32 parameters and simulate quantization in PyTorch. + +Export repository revision audited: `65951289352c1a036b12ba6d888af037e7c90b13`. Archive inventory revision: `fb402d025e843ed00fb990966bf2430c32eb958c`. Each result records its checkpoint SHA-256, actual parameter count, saved step, configuration, thread count, time, sample hash, and evaluator hash. + +### Reproduce + +From the source checkout, install PyTorch plus `huggingface_hub`, `transformers`, `tokenizers`, `pyarrow`, `psutil`, `numpy`, and `datasets`. Pin the versions from `evaluation/environment.json` when reproducing this run. + +The audit additions are bundled in `evaluation/source/`. Copy those Python files into the checkout’s `evaluation/` directory when using a source revision that predates this audit. The base Git commit is recorded in `evaluation/environment.json`. + +```powershell +python -m evaluation.audit --storage D:/cpu1-readme-audit --threads 1 +python -m evaluation.audit --storage D:/cpu1-readme-audit --cards +``` + +Model downloads, tokenizer files, Hugging Face caches, and temporary files go to D:. Only one model checkpoint is kept in the task storage at a time; it is removed after its result is saved. Interrupted runs resume from matching evaluator hashes. Raw reports remain in `outputs/audit/`. + +## Fresh diagnostic results + +**Do not rank models across tokenizations or treat a failed-causality loss as autoregressive language-model perplexity.** Saved training metrics are retained separately in the JSONs; the numbers below are recomputed on the shared test sample. + +### Byte models + +| Run | Params M | Saved step | File MB | NLL | BPB | PPL | Causal | State chunks | +|---|---:|---:|---:|---:|---:|---:|---|---| +| [`run_02`](https://huggingface.co/Cukinator/cpu1-ablation-checkpoints/blob/main/evaluation/run_02.json) | 38.830 | 647 | 155.35 | 1.9702 | 2.8424 | 7.172 | PASS | N/A | +| [`run_02_v3`](https://huggingface.co/Cukinator/cpu1-ablation-checkpoints/blob/main/evaluation/run_02_v3.json) | 38.830 | 10963 | 155.35 | ERROR | β€” | β€” | ERROR | N/A | +| [`run_02a_byte_only_heads`](https://huggingface.co/Cukinator/cpu1-ablation-checkpoints/blob/main/evaluation/run_02a_byte_only_heads.json) | 38.501 | 641 | 154.04 | 2.4755 | 3.5714 | 11.888 | PASS | N/A | +| [`run_02a_byte_only_heads_v3`](https://huggingface.co/Cukinator/cpu1-ablation-checkpoints/blob/main/evaluation/run_02a_byte_only_heads_v3.json) | 38.501 | 16327 | 154.03 | ERROR | β€” | β€” | ERROR | N/A | +| [`run_03`](https://huggingface.co/Cukinator/cpu1-ablation-checkpoints/blob/main/evaluation/run_03.json) | 38.830 | 647 | 155.38 | 2.1622 | 3.1194 | 8.690 | PASS | FAIL | +| [`run_03_v3`](https://huggingface.co/Cukinator/cpu1-ablation-checkpoints/blob/main/evaluation/run_03_v3.json) | 38.830 | 6187 | 155.38 | 1.7640 | 2.5449 | 5.836 | PASS | FAIL | +| [`run_04`](https://huggingface.co/Cukinator/cpu1-ablation-checkpoints/blob/main/evaluation/run_04.json) | 38.854 | 647 | 155.49 | 5.5551 | 8.0144 | 258.565 | PASS | FAIL | +| [`run_04_r2`](https://huggingface.co/Cukinator/cpu1-ablation-checkpoints/blob/main/evaluation/run_04_r2.json) | 38.854 | 4840 | 155.49 | 5.5676 | 8.0323 | 261.803 | PASS | FAIL | +| [`run_04_v3`](https://huggingface.co/Cukinator/cpu1-ablation-checkpoints/blob/main/evaluation/run_04_v3.json) | 38.854 | 6074 | 155.49 | 1.5515 | 2.2384 | 4.719 | PASS | FAIL | +| [`run_05`](https://huggingface.co/Cukinator/cpu1-ablation-checkpoints/blob/main/evaluation/run_05.json) | 38.994 | 649 | 156.06 | 5.5485 | 8.0048 | 256.854 | PASS | FAIL | +| [`run_05_v3`](https://huggingface.co/Cukinator/cpu1-ablation-checkpoints/blob/main/evaluation/run_05_v3.json) | 38.994 | 4390 | 156.06 | 1.5921 | 2.2969 | 4.914 | PASS | FAIL | +| [`run_05b_kernel_strict`](https://huggingface.co/Cukinator/cpu1-ablation-checkpoints/blob/main/evaluation/run_05b_kernel_strict.json) | 35.842 | 600 | 143.44 | 5.5789 | 8.0486 | 264.778 | PASS | FAIL | +| [`run_05b_kernel_strict_v3`](https://huggingface.co/Cukinator/cpu1-ablation-checkpoints/blob/main/evaluation/run_05b_kernel_strict_v3.json) | 35.842 | 2573 | 143.44 | 1.8552 | 2.6764 | 6.393 | PASS | FAIL | +| [`run_06`](https://huggingface.co/Cukinator/cpu1-ablation-checkpoints/blob/main/evaluation/run_06.json) | 38.994 | 649 | 156.06 | 5.5535 | 8.0120 | 258.144 | FAIL | FAIL | +| [`run_06_v3`](https://huggingface.co/Cukinator/cpu1-ablation-checkpoints/blob/main/evaluation/run_06_v3.json) | 38.994 | 4237 | 156.06 | 1.0572 | 1.5253 | 2.878 | FAIL | FAIL | +| [`run_07`](https://huggingface.co/Cukinator/cpu1-ablation-checkpoints/blob/main/evaluation/run_07.json) | 39.029 | 650 | 156.20 | 5.5535 | 8.0120 | 258.144 | FAIL | FAIL | +| [`run_07_r2`](https://huggingface.co/Cukinator/cpu1-ablation-checkpoints/blob/main/evaluation/run_07_r2.json) | 39.029 | 4860 | 156.20 | 5.5569 | 8.0169 | 259.010 | FAIL | FAIL | +| [`run_08`](https://huggingface.co/Cukinator/cpu1-ablation-checkpoints/blob/main/evaluation/run_08.json) | 38.854 | 647 | 155.46 | 5.5535 | 8.0121 | 258.150 | PASS | N/A | +| [`run_08_v3`](https://huggingface.co/Cukinator/cpu1-ablation-checkpoints/blob/main/evaluation/run_08_v3.json) | 38.854 | 3858 | 155.46 | ERROR | β€” | β€” | ERROR | N/A | +| [`run_09`](https://huggingface.co/Cukinator/cpu1-ablation-checkpoints/blob/main/evaluation/run_09.json) | 39.428 | 657 | 157.81 | 5.5334 | 7.9830 | 253.007 | FAIL | FAIL | +| [`run_10`](https://huggingface.co/Cukinator/cpu1-ablation-checkpoints/blob/main/evaluation/run_10.json) | 39.434 | 657 | 157.83 | 5.5337 | 7.9834 | 253.068 | FAIL | FAIL | +| [`run_14`](https://huggingface.co/Cukinator/cpu1-ablation-checkpoints/blob/main/evaluation/run_14.json) | 10.691 | 600 | 42.82 | 5.5700 | 8.0358 | 262.432 | FAIL | FAIL | +| [`run_14_r2`](https://huggingface.co/Cukinator/cpu1-ablation-checkpoints/blob/main/evaluation/run_14_r2.json) | 10.691 | 1336 | 42.82 | 5.5700 | 8.0358 | 262.432 | FAIL | FAIL | +| [`run_14_v3`](https://huggingface.co/Cukinator/cpu1-ablation-checkpoints/blob/main/evaluation/run_14_v3.json) | 10.691 | 9775 | 42.82 | 0.8811 | 1.2712 | 2.414 | FAIL | FAIL | +| [`run_15`](https://huggingface.co/Cukinator/cpu1-ablation-checkpoints/blob/main/evaluation/run_15.json) | 10.732 | 600 | 42.99 | 5.5700 | 8.0358 | 262.432 | FAIL | FAIL | +| [`run_15_r2`](https://huggingface.co/Cukinator/cpu1-ablation-checkpoints/blob/main/evaluation/run_15_r2.json) | 10.732 | 1341 | 42.99 | 5.5700 | 8.0358 | 262.432 | FAIL | FAIL | +| [`run_15_v3`](https://huggingface.co/Cukinator/cpu1-ablation-checkpoints/blob/main/evaluation/run_15_v3.json) | 10.732 | 2350 | 42.99 | 1.3248 | 1.9113 | 3.761 | FAIL | FAIL | +| [`run_16`](https://huggingface.co/Cukinator/cpu1-ablation-checkpoints/blob/main/evaluation/run_16.json) | 10.691 | 600 | 42.82 | 5.5700 | 8.0358 | 262.432 | FAIL | FAIL | +| [`run_16_r2`](https://huggingface.co/Cukinator/cpu1-ablation-checkpoints/blob/main/evaluation/run_16_r2.json) | 10.691 | 1336 | 42.82 | 5.5700 | 8.0358 | 262.432 | FAIL | FAIL | + +### BPE models (mapped Qwen token stream) + +| Run | Params M | Saved step | File MB | NLL | BPB | PPL | Causal | State chunks | +|---|---:|---:|---:|---:|---:|---:|---|---| +| [`run_01`](https://huggingface.co/Cukinator/cpu1-ablation-checkpoints/blob/main/evaluation/run_01.json) | 54.735 | 912 | 218.97 | 5.3742 | β€” | 215.773 | PASS | N/A | +| [`run_01_v3`](https://huggingface.co/Cukinator/cpu1-ablation-checkpoints/blob/main/evaluation/run_01_v3.json) | 54.735 | 12173 | 218.97 | ERROR | β€” | β€” | ERROR | N/A | +| [`run_13`](https://huggingface.co/Cukinator/cpu1-ablation-checkpoints/blob/main/evaluation/run_13.json) | 12.548 | 600 | 50.24 | 6.3429 | β€” | 568.445 | PASS | FAIL | +| [`run_13_r2`](https://huggingface.co/Cukinator/cpu1-ablation-checkpoints/blob/main/evaluation/run_13_r2.json) | 12.548 | 1568 | 50.24 | 6.4205 | β€” | 614.313 | PASS | FAIL | +| [`run_13_v3`](https://huggingface.co/Cukinator/cpu1-ablation-checkpoints/blob/main/evaluation/run_13_v3.json) | 12.548 | 9290 | 50.24 | 6.7925 | β€” | 891.155 | PASS | FAIL | + +| BPE run | IDs mapped to 0 | Vocabulary cap | +|---|---:|---:| +| `run_01` | 14.26% | 16,384 | +| `run_13` | 31.77% | 4,096 | +| `run_13_r2` | 31.77% | 4,096 | +| `run_13_v3` | 31.77% | 4,096 | + +### CPU timing and byte generation + +| Run | Param MB (FP32) | Forward steps/s | p50 ms | p95 ms | Generated bytes/s | Valid UTF-8 samples | +|---|---:|---:|---:|---:|---:|---:| +| `run_01` | 218.94 | 54.64 | 18.21 | 20.63 | N/A | N/A | +| `run_01_v3` | 218.94 | ERROR | β€” | β€” | N/A | N/A | +| `run_02` | 155.32 | 54.58 | 16.69 | 30.12 | 88.75 | 3/3 | +| `run_02_v3` | 155.32 | ERROR | β€” | β€” | N/A | N/A | +| `run_02a_byte_only_heads` | 154.00 | 67.85 | 14.24 | 18.56 | 99.13 | 2/3 | +| `run_02a_byte_only_heads_v3` | 154.00 | ERROR | β€” | β€” | N/A | N/A | +| `run_03` | 155.32 | 52.42 | 17.68 | 30.45 | 154.92 | 3/3 | +| `run_03_v3` | 155.32 | 51.10 | 18.68 | 27.36 | 173.00 | 3/3 | +| `run_04` | 155.42 | 6.66 | 146.44 | 189.02 | 22.32 | 0/3 | +| `run_04_r2` | 155.42 | 5.92 | 164.12 | 231.57 | 18.60 | 0/3 | +| `run_04_v3` | 155.42 | 3.49 | 294.80 | 378.66 | 23.96 | 3/3 | +| `run_05` | 155.98 | 6.11 | 156.23 | 224.46 | 17.37 | 0/3 | +| `run_05_v3` | 155.98 | 5.71 | 157.44 | 225.37 | 20.31 | 3/3 | +| `run_05b_kernel_strict` | 143.37 | 5.41 | 171.47 | 288.26 | 18.87 | 0/3 | +| `run_05b_kernel_strict_v3` | 143.37 | 6.69 | 148.31 | 181.31 | 20.92 | 3/3 | +| `run_06` | 155.98 | 6.19 | 158.21 | 206.27 | 23.91 | 0/3 | +| `run_06_v3` | 155.98 | 6.73 | 135.85 | 223.51 | 20.98 | 2/3 | +| `run_07` | 156.11 | 6.78 | 140.98 | 193.73 | 19.25 | 0/3 | +| `run_07_r2` | 156.11 | 6.24 | 151.17 | 223.57 | 21.20 | 0/3 | +| `run_08` | 155.42 | 7.65 | 124.09 | 175.60 | 23.24 | 0/3 | +| `run_08_v3` | 155.42 | ERROR | β€” | β€” | N/A | N/A | +| `run_09` | 157.71 | 6.39 | 144.30 | 208.93 | 19.73 | 0/3 | +| `run_10` | 157.74 | 7.14 | 135.05 | 166.90 | 23.57 | 0/3 | +| `run_13` | 50.19 | 23.66 | 41.46 | 47.41 | N/A | N/A | +| `run_13_r2` | 50.19 | 24.46 | 40.26 | 44.37 | N/A | N/A | +| `run_13_v3` | 50.19 | 21.69 | 43.21 | 61.74 | N/A | N/A | +| `run_14` | 42.77 | 28.00 | 35.19 | 38.19 | 80.37 | 0/3 | +| `run_14_r2` | 42.77 | 25.51 | 37.39 | 49.82 | 73.29 | 0/3 | +| `run_14_v3` | 42.77 | 24.80 | 37.64 | 57.30 | 76.37 | 3/3 | +| `run_15` | 42.93 | 28.36 | 35.05 | 36.72 | 81.61 | 0/3 | +| `run_15_r2` | 42.93 | 27.10 | 36.58 | 38.68 | 73.25 | 0/3 | +| `run_15_v3` | 42.93 | 14.17 | 60.10 | 124.86 | 53.99 | 3/3 | +| `run_16` | 42.77 | 20.26 | 44.73 | 73.85 | 71.64 | 0/3 | +| `run_16_r2` | 42.77 | 21.75 | 43.29 | 59.96 | 55.22 | 0/3 | + +### Example continuations + +The following fixed examples use the first audit prompt, `The history of artificial intelligence`, seed 42, and the sampling settings above. They illustrate why low diagnostic loss or valid UTF-8 alone does not establish useful text generation. Escapes preserve the recorded characters; complete byte sequences and all three prompts are in the JSON reports. + +`run_04_v3`: + +```text +"atite white waterfalper diangiets opespucica continues apoliomin for natinal envical grapable tha rust of pria a treating papora" +``` + +`run_14_v3`: + +```text +"al C APLEOSTrorog's NC. Overness I Co eforgram.\nAt 2odromist - Careforrs, Milz Drology in M Ontooyoum , one volume late from obs" +``` + + +### Correctness checks + +| Run | Shapes | Probabilities | Determinism | State chunks | Ternary projection | State size | Causality | +|---|---|---|---|---|---|---|---| +| `run_01` | PASS | PASS | PASS | N/A | N/A | N/A | PASS | +| `run_01_v3` | FAIL | FAIL | FAIL | N/A | N/A | N/A | ERROR | +| `run_02` | PASS | PASS | PASS | N/A | N/A | N/A | PASS | +| `run_02_v3` | FAIL | FAIL | FAIL | N/A | N/A | N/A | ERROR | +| `run_02a_byte_only_heads` | PASS | PASS | PASS | N/A | N/A | N/A | PASS | +| `run_02a_byte_only_heads_v3` | FAIL | FAIL | FAIL | N/A | N/A | N/A | ERROR | +| `run_03` | PASS | PASS | PASS | FAIL | N/A | PASS | PASS | +| `run_03_v3` | PASS | PASS | PASS | FAIL | N/A | PASS | PASS | +| `run_04` | PASS | PASS | PASS | FAIL | PASS | PASS | PASS | +| `run_04_r2` | PASS | PASS | PASS | FAIL | PASS | PASS | PASS | +| `run_04_v3` | PASS | PASS | PASS | FAIL | PASS | PASS | PASS | +| `run_05` | PASS | PASS | PASS | FAIL | PASS | PASS | PASS | +| `run_05_v3` | PASS | PASS | PASS | FAIL | PASS | PASS | PASS | +| `run_05b_kernel_strict` | PASS | PASS | PASS | FAIL | PASS | PASS | PASS | +| `run_05b_kernel_strict_v3` | PASS | PASS | PASS | FAIL | PASS | PASS | PASS | +| `run_06` | PASS | PASS | PASS | FAIL | PASS | PASS | FAIL | +| `run_06_v3` | PASS | PASS | PASS | FAIL | PASS | PASS | FAIL | +| `run_07` | PASS | PASS | PASS | FAIL | PASS | PASS | FAIL | +| `run_07_r2` | PASS | PASS | PASS | FAIL | PASS | PASS | FAIL | +| `run_08` | PASS | PASS | PASS | N/A | PASS | N/A | PASS | +| `run_08_v3` | FAIL | FAIL | FAIL | N/A | FAIL | N/A | ERROR | +| `run_09` | PASS | PASS | PASS | FAIL | PASS | PASS | FAIL | +| `run_10` | PASS | PASS | PASS | FAIL | PASS | PASS | FAIL | +| `run_13` | PASS | PASS | PASS | FAIL | PASS | PASS | PASS | +| `run_13_r2` | PASS | PASS | PASS | FAIL | PASS | PASS | PASS | +| `run_13_v3` | PASS | PASS | PASS | FAIL | PASS | PASS | PASS | +| `run_14` | PASS | PASS | PASS | FAIL | PASS | PASS | FAIL | +| `run_14_r2` | PASS | PASS | PASS | FAIL | PASS | PASS | FAIL | +| `run_14_v3` | PASS | PASS | PASS | FAIL | PASS | PASS | FAIL | +| `run_15` | PASS | PASS | PASS | FAIL | PASS | PASS | FAIL | +| `run_15_r2` | PASS | PASS | PASS | FAIL | PASS | PASS | FAIL | +| `run_15_v3` | PASS | PASS | PASS | FAIL | PASS | PASS | FAIL | +| `run_16` | PASS | PASS | PASS | FAIL | PASS | PASS | FAIL | +| `run_16_r2` | PASS | PASS | PASS | FAIL | PASS | PASS | FAIL | + +**Causality failures: 14/34.** `run_06`, `run_06_v3`, `run_07`, `run_07_r2`, `run_09`, `run_10`, `run_14`, `run_14_r2`, `run_14_v3`, `run_15`, `run_15_r2`, `run_15_v3`, `run_16`, `run_16_r2` + +Changing future inputs changed prefix logits in these models. Some saved configurations enable noncausal Bolmo cross-patch operations; the test detects the effect without isolating its individual source. Their full-sequence losses are descriptive reconstruction scores and cannot establish causal prediction quality. + +**State chunk failures: 26.** `run_03`, `run_03_v3`, `run_04`, `run_04_r2`, `run_04_v3`, `run_05`, `run_05_v3`, `run_05b_kernel_strict`, `run_05b_kernel_strict_v3`, `run_06`, `run_06_v3`, `run_07`, `run_07_r2`, `run_09`, `run_10`, `run_13`, `run_13_r2`, `run_13_v3`, `run_14`, `run_14_r2`, `run_14_v3`, `run_15`, `run_15_r2`, `run_15_v3`, `run_16`, `run_16_r2` + +These configurations did not reproduce a full-sequence forward when carrying state between chunks at the stated tolerance. An O(1) state tensor alone does not establish correct streaming equivalence. No fix to the trained architectures or weights was made for this audit. + +### Recurrent implementation diagnostic + +The source’s `AblationMLGRU._parallel_scan` was tested independently against its defining serial recurrence with random candidate/forget tensors, seed 19, shape `[1,32,8]`, FP32. The maximum difference was **19.100506**; splitting the same scan into two 16-step chunks differed by **11.471270** (tolerance `1e-4`). See [`implementation_diagnostics.json`](https://huggingface.co/Cukinator/cpu1-ablation-checkpoints/blob/main/evaluation/implementation_diagnostics.json) and the bundled `evaluation/diagnostics.py`. + +The implementation replaces log-cumulative-sum-exp with a cumulative-maximum normalization followed by a cumulative sum; accumulated terms are not rescaled when that maximum changes. The observed outputs therefore do not satisfy the intended recurrence. This is a source implementation defect; disabling or repairing the scan would create a different inference protocol and was not silently applied to these results. The trained-checkpoint audit uses the source as supplied. + +### Evaluation errors + +Scores and speed are unavailable when model loading or numerical evaluation fails. Nonfinite values are represented as JSON null; they are never substituted with valid-looking numbers. + +| Run | Error | +|---|---| +| `run_01_v3` | ValueError: nonfinite loss | +| `run_02_v3` | ValueError: nonfinite loss | +| `run_02a_byte_only_heads_v3` | ValueError: nonfinite loss | +| `run_08_v3` | ValueError: nonfinite loss | + +## Source and dataset provenance + +Historical extraction and training code is retained in the [GitHub history](https://github.com/igna-s/New-1.58/tree/main/docs/provenance). Kaggle and Lightning recipes, AMD training, and 34 configuration records are included in `evaluation/source/`. The configuration records preserve published budgets, including the 150 tokens/parameter v3 setting; they do not prove the exact training source commit or achieved exposure. + +The [dataset review](https://huggingface.co/datasets/Cukinator/cpu1-ablation-dataset) documents short/empty teacher arrays, an observed dense-signal reader alignment defect, and UTF-8 conversion limitations. These observations do not isolate their effect on a training run. No weights, stored datasets or numerical model implementation were repaired in this documentation update. + +## Architecture recorded in each checkpoint + +Run names identify experiments; dimensions and features below come from the saved configuration. FP16 is the training quantization label, while this audit executes the loaded tensors in FP32. β€œ50M” and β€œ10M” in older cards were design families, not exact model sizes. + +| Run | Mixer | Tokens | Quant. label | Width / layers / FFN | Local decoder | FP residual | Bolmo | DeleteGate | PFNet hidden | Channel decay | +|---|---|---|---|---|---|---|---|---|---:|---| +| `run_01` | transformer | bpe | fp16 | 512 / 12 / 1376 | N/A | no | no | no | 0 | no | +| `run_01_v3` | transformer | bpe | fp16 | 512 / 12 / 1376 | N/A | no | no | no | 0 | no | +| `run_02` | transformer | byte | fp16 | 512 / 12 / 1376 | yes | no | no | no | 0 | no | +| `run_02_v3` | transformer | byte | fp16 | 512 / 12 / 1376 | yes | no | no | no | 0 | no | +| `run_02a_byte_only_heads` | transformer | byte | fp16 | 512 / 12 / 1376 | no | no | no | no | 0 | no | +| `run_02a_byte_only_heads_v3` | transformer | byte | fp16 | 512 / 12 / 1376 | no | no | no | no | 0 | no | +| `run_03` | mlgru | byte | fp16 | 512 / 12 / 1376 | yes | no | no | no | 0 | no | +| `run_03_v3` | mlgru | byte | fp16 | 512 / 12 / 1376 | yes | no | no | no | 0 | no | +| `run_04` | mlgru | byte | ternary | 512 / 12 / 1376 | yes | no | no | no | 0 | no | +| `run_04_r2` | mlgru | byte_dynamic | ternary | 512 / 12 / 1376 | yes | no | no | no | 0 | no | +| `run_04_v3` | mlgru | byte | ternary | 512 / 12 / 1376 | yes | no | no | no | 0 | no | +| `run_05` | mlgru | byte | ternary | 512 / 12 / 1376 | yes | yes | no | no | 0 | no | +| `run_05_v3` | mlgru | byte | ternary | 512 / 12 / 1376 | yes | yes | no | no | 0 | no | +| `run_05b_kernel_strict` | mlgru | byte | ternary | 512 / 12 / 1376 | yes | yes | no | no | 0 | no | +| `run_05b_kernel_strict_v3` | mlgru | byte | ternary | 512 / 12 / 1376 | yes | yes | no | no | 0 | no | +| `run_06` | mlgru | byte_dynamic | ternary | 512 / 12 / 1376 | yes | yes | yes | no | 0 | no | +| `run_06_v3` | mlgru | byte_dynamic | ternary | 512 / 12 / 1376 | yes | yes | yes | no | 0 | no | +| `run_07` | mlgru | byte_dynamic | ternary | 512 / 12 / 1376 | yes | yes | yes | yes | 0 | no | +| `run_07_r2` | mlgru | byte_dynamic | ternary | 512 / 12 / 1376 | yes | yes | yes | yes | 0 | no | +| `run_08` | transformer | byte | ternary | 512 / 12 / 1376 | yes | no | no | no | 0 | no | +| `run_08_v3` | transformer | byte | ternary | 512 / 12 / 1376 | yes | no | no | no | 0 | no | +| `run_09` | mlgru | byte_dynamic | ternary | 512 / 12 / 1376 | yes | yes | yes | yes | 32 | no | +| `run_10` | mlgru | byte_dynamic | ternary | 512 / 12 / 1376 | yes | yes | yes | yes | 32 | yes | +| `run_13` | mlgru | bpe | ternary | 320 / 8 / 853 | N/A | yes | no | yes | 0 | no | +| `run_13_r2` | mlgru | bpe | ternary | 320 / 8 / 853 | N/A | yes | no | yes | 0 | no | +| `run_13_v3` | mlgru | bpe | ternary | 320 / 8 / 853 | N/A | yes | no | yes | 0 | no | +| `run_14` | mlgru | byte_dynamic | ternary | 320 / 8 / 853 | yes | yes | yes | yes | 0 | no | +| `run_14_r2` | mlgru | byte_dynamic | ternary | 320 / 8 / 853 | yes | yes | yes | yes | 0 | no | +| `run_14_v3` | mlgru | byte_dynamic | ternary | 320 / 8 / 853 | yes | yes | yes | yes | 0 | no | +| `run_15` | mlgru | byte_dynamic | ternary | 320 / 8 / 853 | yes | yes | yes | yes | 0 | no | +| `run_15_r2` | mlgru | byte_dynamic | ternary | 320 / 8 / 853 | yes | yes | yes | yes | 0 | no | +| `run_15_v3` | mlgru | byte_dynamic | ternary | 320 / 8 / 853 | yes | yes | yes | yes | 0 | no | +| `run_16` | mlgru | byte_dynamic | ternary | 320 / 8 / 853 | yes | yes | yes | yes | 0 | no | +| `run_16_r2` | mlgru | byte_dynamic | ternary | 320 / 8 / 853 | yes | yes | yes | yes | 0 | no | + +These experiments change parameter counts, representations, training signal, budgets, saved steps, and sometimes multiple architectural settings. The audit is not a controlled causal estimate of the benefit of an individual component. `chinchilla_tokens_per_param` is a configured budget; it does not prove that a run completed that budget. Actual saved steps are reported separately. + +## License + +Hub metadata declares Apache-2.0. Dataset and tokenizer licenses are separate. The source checkout does not include a standalone LICENSE file. diff --git a/evaluation/source/docs/model_cards/cpu1-ablation-dataset.md b/evaluation/source/docs/model_cards/cpu1-ablation-dataset.md new file mode 100644 index 0000000000000000000000000000000000000000..c637007bab7533197e124bc8d2393eefa1261034 --- /dev/null +++ b/evaluation/source/docs/model_cards/cpu1-ablation-dataset.md @@ -0,0 +1,139 @@ +--- +license: mit +task_categories: +- text-generation +language: +- en +configs: +- config_name: byte_marginalized + data_files: + - split: train + path: byte_marginalized/shard_*.parquet +- config_name: bpe_tokenized + data_files: + - split: train + path: bpe_tokenized/shard_*.parquet +--- + +# CPU-1 ablation dataset + +Precomputed training data for the CPU-1 knowledge-distillation and tokenization experiments. The dataset contains independently packed byte-patch and BPE-token subsets with stored teacher probabilities. The extraction pipeline is configured to use [Qwen/Qwen2.5-3B](https://huggingface.co/Qwen/Qwen2.5-3B) over English text from [FineWeb](https://huggingface.co/datasets/HuggingFaceFW/fineweb), `sample-10BT`. Teacher/source revisions and hidden-layer selection are not specified for every historical shard. + +**The byte subset contains incomplete teacher arrays, and the companion dataset reader has positional-alignment defects. Resolve these limitations before using the stored signals for distillation.** + +## Dataset contents + +Data revision: `bd75d7b811ab730cc912aaa671f9eaaf49ba4bdf`. + +| Subset | Parquet files | Compressed size, decimal GB | Shard IDs | Missing IDs | Rows, HF dataset service | +|---|---:|---:|---|---|---:| +| `byte_marginalized` | 480 | 0.686841331 | 0000–0481 | 0060, 0061 | 24,101 | +| `bpe_tokenized` | 437 | 67.332026716 | 0000–0438 | 0060, 0061 | 21,928 | + +Total: 917 parquet files, approximately 68.02 GB, and 46,029 rows according to the HF dataset service. Compressed file size differs from source-text size and loaded-memory requirements. Only a `train` split is declared. + +The two streams pack text at different densities and maintain independent residual state and shard offsets. Matching shard IDs or row indices do not identify matching source spans. Load each subset independently; do not zip them by index. File globs skip the missing shard IDs. + +## Stored fields + +Lists are physically flattened in parquet. The writer uses four-byte patches, 5,000 steps per packed sequence, top-128 BPE candidates and a 128-dimensional hidden projection. Teacher arrays in the byte subset can be shorter than the input sequence or empty. + +### Byte subset: `byte_marginalized` + +| Field | Physical type | Nominal logical shape | Meaning | +|---|---|---|---| +| `patches` | list of uint8 | `[5000, 4]` | Input bytes grouped into four-byte patches. | +| `targets` | list of uint8 | `[5000, 4]` | Next-patch target bytes constructed before document packing. | +| `teacher_probs` | list of float32 | `[5000, 256]` | First-byte teacher distributions; short and empty arrays also occur. | +| `teacher_mask` | list of bool | `[5000]` | Teacher-signal coverage mask; short and empty masks also occur. | +| `teacher_hidden` | list of float32 | `[5000, 128]` | Projected teacher hidden values; short and empty arrays also occur. | +| `teacher_dim` | int32 | scalar | Hidden projection width, configured as 128. | + +The target construction includes document-local shifts and separators. A global shift of the packed input row need not reproduce every target at document boundaries. + +### BPE subset: `bpe_tokenized` + +| Field | Physical type | Nominal logical shape | Meaning | +|---|---|---|---| +| `input_ids` | list of int32 | `[5000]` | Qwen BPE token IDs. | +| `labels` | list of int32 | `[5000]` | Next-token targets. | +| `teacher_probs_bpe` | list of float32 | `[5000, 128]` | Retained next-token probabilities. | +| `teacher_ids_bpe` | list of int32 | `[5000, 128]` | Vocabulary IDs paired with the retained probabilities. | +| `teacher_mask_bpe` | list of bool | `[5000]` | Teacher-signal availability mask. | + +The stored probability columns contain probabilities. The BPE writer exponentiates retained log probabilities. The byte converter sums candidate probability masses by first byte and renormalizes the retained top-k mass. This approximates the full-vocabulary first-byte distribution; it does not provide a joint distribution over all four target bytes. + +The extraction code defaults to a middle-layer hidden projection and uses last-layer states separately to compute logits. A last-layer origin for the stored hidden projection is not guaranteed. + +## Teacher-signal layout and reader compatibility + +Byte teacher arrays do not consistently span all 5,000 patch positions. Examples of stored layouts: + +| Byte shard | Row, zero-based | Input byte count | Mask length | Hidden-value count | +|---|---:|---:|---:|---:| +| `0000` | 0 | 20,000 | 5,000 | 640,000 | +| `0000` | 1 | 20,000 | 42 | 5,376 | +| `0000` | 2 | 20,000 | 0 | 0 | +| `0481` | 13 | 20,000 | 513 | 65,664 | + +Check array lengths before reshaping. A short boolean mask does not encode integer position indices, and its length alone does not identify the corresponding positions in the full sequence. Padding missing values does not recover their positional mapping. + +The companion [ByteLevelDataset reader](https://huggingface.co/Cukinator/cpu1-ablations-final/blob/702ac8b8616c25454dede9a13b057c4da0a8f97b/evaluation/source/cpu1/components.py) treats probability arrays as compact lists of supervised rows, even when the stored layout is already dense. It scatters the leading rows onto true-mask positions, moving or discarding teacher signals. For short masks, it casts boolean values to integer indices 0 and 1. Hidden arrays are scattered using the resulting mask and can also become misaligned. + +A compatible reader must preserve dense positional layouts and handle short arrays only when their full-sequence positions are available. The linked reader requires changes before it can reliably consume these signals. + +BPE-token boundaries do not always coincide with four-byte patch boundaries, so some patch positions lack a first-byte teacher distribution. This does not account for all missing or truncated arrays. Coverage varies between shards: `0000` has 10 of 50 rows with at least one true mask entry, while `0481` has 1 of 50. These examples do not define a dataset-wide coverage rate. + +## UTF-8 limitations + +The extractor uses character offsets to locate source spans, but converts individual candidate tokens to strings before encoding them as UTF-8. A token containing only part of a multibyte character can decode to the replacement character U+FFFD, changing the candidate bytes used for marginalization. + +For example, the Qwen tokenizer at revision `3aab1f1954e9cc14eb9509a215f9e5ca08227a9b` splits U+1FAE8 in `A` + U+1FAE8 + `B` into token IDs `9284`, `104` and `101`, sharing character offset `(1, 2)`. Decoding each token independently produces U+FFFD, whose first UTF-8 byte is 239; the emoji begins with byte 240. Source-string offsets alone do not fix candidate-byte conversion. Exact BPE-to-byte alignment is therefore not guaranteed. + +## Loading + +Streaming avoids an upfront full download. Parquet reads can still require substantial transfer and memory. + +```python +from datasets import load_dataset + +rows = load_dataset( + "Cukinator/cpu1-ablation-dataset", + "byte_marginalized", # or "bpe_tokenized" + revision="bd75d7b811ab730cc912aaa671f9eaaf49ba4bdf", + split="train", + streaming=True, +) + +row = next(iter(rows)) +for name, value in row.items(): + print(name, len(value) if isinstance(value, list) else value) +``` + +This example loads a row and displays its field lengths. Training requires an adapter that handles the actual signal layout and missing values. + +The companion BPE reader maps IDs outside the configured student vocabulary to ID 0 and filters teacher IDs accordingly. This mapping is lossy. Loss on the mapped stream cannot be interpreted as likelihood under the full Qwen vocabulary or directly compared with per-byte loss. Establish document-level separation when creating training and evaluation splits. + +## Reproducible inspection and source history + +The [provenance review](https://github.com/igna-s/New-1.58/tree/main/docs/provenance) links the recovered historical extraction, training and platform code. Kaggle and Lightning launchers configure an 850,000-document target with chunks of 500 or 3,000 respectively. These are recipe settings, not verified document totals. Earlier teacher settings used 14B/7B; the exact extraction commit and teacher revision for each shard remain unestablished. + +```powershell +python -m evaluation.dataset --storage D:/cpu1-readme-audit --tokenizer +``` + +The [sample report](https://huggingface.co/datasets/Cukinator/cpu1-ablation-dataset/blob/main/provenance/dataset-review.json) contains pinned SHA-256 values, schemas and footers for two byte shards (`0000`, `0481`) and one BPE shard (`0000`), all row lengths/masks in the two byte shards, the first BPE row, the dense-reader comparison and the synthetic tokenizer case. The parquet samples total about 158.5 MB and are stored on D:. No teacher or student model is loaded. Append `--offline` to reuse downloaded files. + +The inspected dense byte row has 1,333 nonzero stored distributions; the linked reader returns 369 with a maximum absolute difference of 1.0. The first BPE row has zero next-token shift mismatches across 4,999 positions. A global shift comparison across the first packed byte rows observes 368 differences in `0000` and 40 in `0481`, across 19,996 positions each; document-local target construction and separators prevent interpreting that comparison alone as target corruption. + +Inventory totals come from the pinned Hub listing; row totals are dataset-service reports, not a scan of every parquet footer. This limited inspection does not validate all teacher distributions, hidden-state alignment, per-shard provenance, document deduplication or train/evaluation independence. The dataset and model weights were not altered. + +## Related resources + +- [Source code](https://github.com/igna-s/New-1.58): extraction pipeline, dataset readers and training configurations. +- [Packed and intermediate checkpoints](https://huggingface.co/Cukinator/cpu1-ablation-checkpoints). +- [FP32 model exports](https://huggingface.co/Cukinator/cpu1-ablations-final). + +## License + +Dataset repository metadata declares MIT. Source text and teacher/tokenizer assets are subject to their respective upstream terms. diff --git a/evaluation/source/docs/model_cards/cpu1-ablations-final.md b/evaluation/source/docs/model_cards/cpu1-ablations-final.md new file mode 100644 index 0000000000000000000000000000000000000000..19c8059b3b40014b0c24facaa47b40beca7aecab --- /dev/null +++ b/evaluation/source/docs/model_cards/cpu1-ablations-final.md @@ -0,0 +1,324 @@ +--- +license: apache-2.0 +language: +- en +tags: +- cpu-1 +- ablation +- ternary +- research +--- + +# CPU-1 ablations: FP32 checkpoint exports + +34 custom PyTorch model exports, 4.178 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. + +Source: [igna-s/New-1.58](https://github.com/igna-s/New-1.58). Training archive: [Cukinator/cpu1-ablation-checkpoints](https://huggingface.co/Cukinator/cpu1-ablation-checkpoints). Training dataset companion: [Cukinator/cpu1-ablation-dataset](https://huggingface.co/datasets/Cukinator/cpu1-ablation-dataset). + +## What the audit found + +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. + +| Check | Outcome | +|---|---| +| Strict checkpoint loading | 34/34 loaded | +| Numerical evaluation | 4 models produced an evaluation error | +| Prefix causality | 14/30 finite-output models failed | +| Recurrent chunk equivalence | 26/26 recurrent models failed | + +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. + +## Payload format + +`/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. + +Historical `metrics` may be empty or come from different training validation protocols. They are preserved as metadata, not relabeled as freshly measured test results. + +## 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) +path = hf_hub_download("Cukinator/cpu1-ablations-final", "run_04/model.pt", + revision="65951289352c1a036b12ba6d888af037e7c90b13", local_dir="D:/cpu1/active", cache_dir="D:/cpu1/hf/hub") +from training.ablation import build_ablation_model +payload = torch.load(path, map_location="cpu", weights_only=False) +config, state = payload["config"], payload["state_dict"] +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 `evaluation/audit.py`. Generation remains experimental; inspect the saved examples before choosing a checkpoint. + +## Evaluation protocol + +This card was rebuilt from a fresh CPU audit on **2026-10-06**. All 34 published FP32 exports were attempted; 34 loaded with zero missing or unexpected state keys. Numerical and loading errors remain visible. Raw JSON, the exact text sample, and the repository inventories are included in [`evaluation/`](https://huggingface.co/Cukinator/cpu1-ablations-final/tree/main/evaluation). Previous `resultados/ablation_*.json` reports are historical and were not mixed into these tables. + +- Hardware: Intel Core i7-8750H (6 cores / 12 logical processors), Windows 11; CPU execution with **1 PyTorch thread**, batch size 1, FP32 parameters. PyTorch 2.6.0+cu124. No custom C/C++ kernels were used. +- Test text: [`Salesforce/wikitext`, `wikitext-2-raw-v1`, test split](https://huggingface.co/datasets/Salesforce/wikitext). First 32 non-heading paragraphs with at least 260 UTF-8 bytes, each truncated to 260 bytes without an incomplete trailing character. This is a small diagnostic sample, not the complete benchmark. No exhaustive training-overlap audit was performed. +- Corpus attribution: WikiText by its dataset authors, based on English Wikipedia contributions. The dataset metadata lists CC-BY-SA-3.0 and GFDL; the included corpus excerpt retains those upstream terms, separately from the model repository license. See `evaluation/CORPUS_LICENSE.txt`. +- Dataset revision: `b08601e04326c79dfdd32d625aee71d232d685c3`; exact file: `wikitext-2-raw-v1/test-00000-of-00001.parquet`; parquet SHA-256: `5f1bea067869d04849c0f975a2b29c4ff47d867f484f5010ea5e861eab246d91`. +- Shared sample JSON SHA-256: `11d143c06478ff7bbe364c541a58e6a2e76504c4cb0595b294f46e98f3cfe798`. +- 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. +- 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. +- BPE models shared one Qwen tokenizer, resolved at runtime. The original audit did not capture its resolved revision (null in the records); that missing pin limits exact BPE reproduction. Inspect tokenizer_revision in each result when reproducing later runs. +- 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. +- DeleteGate is disabled consistently: phase 1, elimination rate 0. The audit does not measure token elimination, phase-2 quality, or the benefit of DeleteGate. +- 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. +- Byte generation: three prompts, 128 new bytes per prompt, seeds 42/43/44, temperature 1.0, top-k 40, top-p 0.9. Recurrent models carry state; Transformers reprocess the growing context. Generated bytes/s includes prompt prefill and local sampling. UTF-8 validity is tested on the complete continuation. Samples are retained as hex and decoded text. BPE generation is N/A because vocabulary truncation prevents an equivalent byte-output comparison. +- Printable ASCII fraction, UTF-8 validity, and repetition are diagnostics; they do not measure factual accuracy, instruction following, or useful language quality. RAM columns report parameter storage, not a measured peak process footprint. Ternary models still hold FP32 parameters and simulate quantization in PyTorch. + +Export repository revision audited: `65951289352c1a036b12ba6d888af037e7c90b13`. Archive inventory revision: `fb402d025e843ed00fb990966bf2430c32eb958c`. Each result records its checkpoint SHA-256, actual parameter count, saved step, configuration, thread count, time, sample hash, and evaluator hash. + +### Reproduce + +From the source checkout, install PyTorch plus `huggingface_hub`, `transformers`, `tokenizers`, `pyarrow`, `psutil`, `numpy`, and `datasets`. Pin the versions from `evaluation/environment.json` when reproducing this run. + +The audit additions are bundled in `evaluation/source/`. Copy those Python files into the checkout’s `evaluation/` directory when using a source revision that predates this audit. The base Git commit is recorded in `evaluation/environment.json`. + +```powershell +python -m evaluation.audit --storage D:/cpu1-readme-audit --threads 1 +python -m evaluation.audit --storage D:/cpu1-readme-audit --cards +``` + +Model downloads, tokenizer files, Hugging Face caches, and temporary files go to D:. Only one model checkpoint is kept in the task storage at a time; it is removed after its result is saved. Interrupted runs resume from matching evaluator hashes. Raw reports remain in `outputs/audit/`. + +## Fresh diagnostic results + +**Do not rank models across tokenizations or treat a failed-causality loss as autoregressive language-model perplexity.** Saved training metrics are retained separately in the JSONs; the numbers below are recomputed on the shared test sample. + +### Byte models + +| Run | Params M | Saved step | File MB | NLL | BPB | PPL | Causal | State chunks | +|---|---:|---:|---:|---:|---:|---:|---|---| +| [`run_02`](https://huggingface.co/Cukinator/cpu1-ablations-final/blob/main/evaluation/run_02.json) | 38.830 | 647 | 155.35 | 1.9702 | 2.8424 | 7.172 | PASS | N/A | +| [`run_02_v3`](https://huggingface.co/Cukinator/cpu1-ablations-final/blob/main/evaluation/run_02_v3.json) | 38.830 | 10963 | 155.35 | ERROR | β€” | β€” | ERROR | N/A | +| [`run_02a_byte_only_heads`](https://huggingface.co/Cukinator/cpu1-ablations-final/blob/main/evaluation/run_02a_byte_only_heads.json) | 38.501 | 641 | 154.04 | 2.4755 | 3.5714 | 11.888 | PASS | N/A | +| [`run_02a_byte_only_heads_v3`](https://huggingface.co/Cukinator/cpu1-ablations-final/blob/main/evaluation/run_02a_byte_only_heads_v3.json) | 38.501 | 16327 | 154.03 | ERROR | β€” | β€” | ERROR | N/A | +| [`run_03`](https://huggingface.co/Cukinator/cpu1-ablations-final/blob/main/evaluation/run_03.json) | 38.830 | 647 | 155.38 | 2.1622 | 3.1194 | 8.690 | PASS | FAIL | +| [`run_03_v3`](https://huggingface.co/Cukinator/cpu1-ablations-final/blob/main/evaluation/run_03_v3.json) | 38.830 | 6187 | 155.38 | 1.7640 | 2.5449 | 5.836 | PASS | FAIL | +| [`run_04`](https://huggingface.co/Cukinator/cpu1-ablations-final/blob/main/evaluation/run_04.json) | 38.854 | 647 | 155.49 | 5.5551 | 8.0144 | 258.565 | PASS | FAIL | +| [`run_04_r2`](https://huggingface.co/Cukinator/cpu1-ablations-final/blob/main/evaluation/run_04_r2.json) | 38.854 | 4840 | 155.49 | 5.5676 | 8.0323 | 261.803 | PASS | FAIL | +| [`run_04_v3`](https://huggingface.co/Cukinator/cpu1-ablations-final/blob/main/evaluation/run_04_v3.json) | 38.854 | 6074 | 155.49 | 1.5515 | 2.2384 | 4.719 | PASS | FAIL | +| [`run_05`](https://huggingface.co/Cukinator/cpu1-ablations-final/blob/main/evaluation/run_05.json) | 38.994 | 649 | 156.06 | 5.5485 | 8.0048 | 256.854 | PASS | FAIL | +| [`run_05_v3`](https://huggingface.co/Cukinator/cpu1-ablations-final/blob/main/evaluation/run_05_v3.json) | 38.994 | 4390 | 156.06 | 1.5921 | 2.2969 | 4.914 | PASS | FAIL | +| [`run_05b_kernel_strict`](https://huggingface.co/Cukinator/cpu1-ablations-final/blob/main/evaluation/run_05b_kernel_strict.json) | 35.842 | 600 | 143.44 | 5.5789 | 8.0486 | 264.778 | PASS | FAIL | +| [`run_05b_kernel_strict_v3`](https://huggingface.co/Cukinator/cpu1-ablations-final/blob/main/evaluation/run_05b_kernel_strict_v3.json) | 35.842 | 2573 | 143.44 | 1.8552 | 2.6764 | 6.393 | PASS | FAIL | +| [`run_06`](https://huggingface.co/Cukinator/cpu1-ablations-final/blob/main/evaluation/run_06.json) | 38.994 | 649 | 156.06 | 5.5535 | 8.0120 | 258.144 | FAIL | FAIL | +| [`run_06_v3`](https://huggingface.co/Cukinator/cpu1-ablations-final/blob/main/evaluation/run_06_v3.json) | 38.994 | 4237 | 156.06 | 1.0572 | 1.5253 | 2.878 | FAIL | FAIL | +| [`run_07`](https://huggingface.co/Cukinator/cpu1-ablations-final/blob/main/evaluation/run_07.json) | 39.029 | 650 | 156.20 | 5.5535 | 8.0120 | 258.144 | FAIL | FAIL | +| [`run_07_r2`](https://huggingface.co/Cukinator/cpu1-ablations-final/blob/main/evaluation/run_07_r2.json) | 39.029 | 4860 | 156.20 | 5.5569 | 8.0169 | 259.010 | FAIL | FAIL | +| [`run_08`](https://huggingface.co/Cukinator/cpu1-ablations-final/blob/main/evaluation/run_08.json) | 38.854 | 647 | 155.46 | 5.5535 | 8.0121 | 258.150 | PASS | N/A | +| [`run_08_v3`](https://huggingface.co/Cukinator/cpu1-ablations-final/blob/main/evaluation/run_08_v3.json) | 38.854 | 3858 | 155.46 | ERROR | β€” | β€” | ERROR | N/A | +| [`run_09`](https://huggingface.co/Cukinator/cpu1-ablations-final/blob/main/evaluation/run_09.json) | 39.428 | 657 | 157.81 | 5.5334 | 7.9830 | 253.007 | FAIL | FAIL | +| [`run_10`](https://huggingface.co/Cukinator/cpu1-ablations-final/blob/main/evaluation/run_10.json) | 39.434 | 657 | 157.83 | 5.5337 | 7.9834 | 253.068 | FAIL | FAIL | +| [`run_14`](https://huggingface.co/Cukinator/cpu1-ablations-final/blob/main/evaluation/run_14.json) | 10.691 | 600 | 42.82 | 5.5700 | 8.0358 | 262.432 | FAIL | FAIL | +| [`run_14_r2`](https://huggingface.co/Cukinator/cpu1-ablations-final/blob/main/evaluation/run_14_r2.json) | 10.691 | 1336 | 42.82 | 5.5700 | 8.0358 | 262.432 | FAIL | FAIL | +| [`run_14_v3`](https://huggingface.co/Cukinator/cpu1-ablations-final/blob/main/evaluation/run_14_v3.json) | 10.691 | 9775 | 42.82 | 0.8811 | 1.2712 | 2.414 | FAIL | FAIL | +| [`run_15`](https://huggingface.co/Cukinator/cpu1-ablations-final/blob/main/evaluation/run_15.json) | 10.732 | 600 | 42.99 | 5.5700 | 8.0358 | 262.432 | FAIL | FAIL | +| [`run_15_r2`](https://huggingface.co/Cukinator/cpu1-ablations-final/blob/main/evaluation/run_15_r2.json) | 10.732 | 1341 | 42.99 | 5.5700 | 8.0358 | 262.432 | FAIL | FAIL | +| [`run_15_v3`](https://huggingface.co/Cukinator/cpu1-ablations-final/blob/main/evaluation/run_15_v3.json) | 10.732 | 2350 | 42.99 | 1.3248 | 1.9113 | 3.761 | FAIL | FAIL | +| [`run_16`](https://huggingface.co/Cukinator/cpu1-ablations-final/blob/main/evaluation/run_16.json) | 10.691 | 600 | 42.82 | 5.5700 | 8.0358 | 262.432 | FAIL | FAIL | +| [`run_16_r2`](https://huggingface.co/Cukinator/cpu1-ablations-final/blob/main/evaluation/run_16_r2.json) | 10.691 | 1336 | 42.82 | 5.5700 | 8.0358 | 262.432 | FAIL | FAIL | + +### BPE models (mapped Qwen token stream) + +| Run | Params M | Saved step | File MB | NLL | BPB | PPL | Causal | State chunks | +|---|---:|---:|---:|---:|---:|---:|---|---| +| [`run_01`](https://huggingface.co/Cukinator/cpu1-ablations-final/blob/main/evaluation/run_01.json) | 54.735 | 912 | 218.97 | 5.3742 | β€” | 215.773 | PASS | N/A | +| [`run_01_v3`](https://huggingface.co/Cukinator/cpu1-ablations-final/blob/main/evaluation/run_01_v3.json) | 54.735 | 12173 | 218.97 | ERROR | β€” | β€” | ERROR | N/A | +| [`run_13`](https://huggingface.co/Cukinator/cpu1-ablations-final/blob/main/evaluation/run_13.json) | 12.548 | 600 | 50.24 | 6.3429 | β€” | 568.445 | PASS | FAIL | +| [`run_13_r2`](https://huggingface.co/Cukinator/cpu1-ablations-final/blob/main/evaluation/run_13_r2.json) | 12.548 | 1568 | 50.24 | 6.4205 | β€” | 614.313 | PASS | FAIL | +| [`run_13_v3`](https://huggingface.co/Cukinator/cpu1-ablations-final/blob/main/evaluation/run_13_v3.json) | 12.548 | 9290 | 50.24 | 6.7925 | β€” | 891.155 | PASS | FAIL | + +| BPE run | IDs mapped to 0 | Vocabulary cap | +|---|---:|---:| +| `run_01` | 14.26% | 16,384 | +| `run_13` | 31.77% | 4,096 | +| `run_13_r2` | 31.77% | 4,096 | +| `run_13_v3` | 31.77% | 4,096 | + +### CPU timing and byte generation + +| Run | Param MB (FP32) | Forward steps/s | p50 ms | p95 ms | Generated bytes/s | Valid UTF-8 samples | +|---|---:|---:|---:|---:|---:|---:| +| `run_01` | 218.94 | 54.64 | 18.21 | 20.63 | N/A | N/A | +| `run_01_v3` | 218.94 | ERROR | β€” | β€” | N/A | N/A | +| `run_02` | 155.32 | 54.58 | 16.69 | 30.12 | 88.75 | 3/3 | +| `run_02_v3` | 155.32 | ERROR | β€” | β€” | N/A | N/A | +| `run_02a_byte_only_heads` | 154.00 | 67.85 | 14.24 | 18.56 | 99.13 | 2/3 | +| `run_02a_byte_only_heads_v3` | 154.00 | ERROR | β€” | β€” | N/A | N/A | +| `run_03` | 155.32 | 52.42 | 17.68 | 30.45 | 154.92 | 3/3 | +| `run_03_v3` | 155.32 | 51.10 | 18.68 | 27.36 | 173.00 | 3/3 | +| `run_04` | 155.42 | 6.66 | 146.44 | 189.02 | 22.32 | 0/3 | +| `run_04_r2` | 155.42 | 5.92 | 164.12 | 231.57 | 18.60 | 0/3 | +| `run_04_v3` | 155.42 | 3.49 | 294.80 | 378.66 | 23.96 | 3/3 | +| `run_05` | 155.98 | 6.11 | 156.23 | 224.46 | 17.37 | 0/3 | +| `run_05_v3` | 155.98 | 5.71 | 157.44 | 225.37 | 20.31 | 3/3 | +| `run_05b_kernel_strict` | 143.37 | 5.41 | 171.47 | 288.26 | 18.87 | 0/3 | +| `run_05b_kernel_strict_v3` | 143.37 | 6.69 | 148.31 | 181.31 | 20.92 | 3/3 | +| `run_06` | 155.98 | 6.19 | 158.21 | 206.27 | 23.91 | 0/3 | +| `run_06_v3` | 155.98 | 6.73 | 135.85 | 223.51 | 20.98 | 2/3 | +| `run_07` | 156.11 | 6.78 | 140.98 | 193.73 | 19.25 | 0/3 | +| `run_07_r2` | 156.11 | 6.24 | 151.17 | 223.57 | 21.20 | 0/3 | +| `run_08` | 155.42 | 7.65 | 124.09 | 175.60 | 23.24 | 0/3 | +| `run_08_v3` | 155.42 | ERROR | β€” | β€” | N/A | N/A | +| `run_09` | 157.71 | 6.39 | 144.30 | 208.93 | 19.73 | 0/3 | +| `run_10` | 157.74 | 7.14 | 135.05 | 166.90 | 23.57 | 0/3 | +| `run_13` | 50.19 | 23.66 | 41.46 | 47.41 | N/A | N/A | +| `run_13_r2` | 50.19 | 24.46 | 40.26 | 44.37 | N/A | N/A | +| `run_13_v3` | 50.19 | 21.69 | 43.21 | 61.74 | N/A | N/A | +| `run_14` | 42.77 | 28.00 | 35.19 | 38.19 | 80.37 | 0/3 | +| `run_14_r2` | 42.77 | 25.51 | 37.39 | 49.82 | 73.29 | 0/3 | +| `run_14_v3` | 42.77 | 24.80 | 37.64 | 57.30 | 76.37 | 3/3 | +| `run_15` | 42.93 | 28.36 | 35.05 | 36.72 | 81.61 | 0/3 | +| `run_15_r2` | 42.93 | 27.10 | 36.58 | 38.68 | 73.25 | 0/3 | +| `run_15_v3` | 42.93 | 14.17 | 60.10 | 124.86 | 53.99 | 3/3 | +| `run_16` | 42.77 | 20.26 | 44.73 | 73.85 | 71.64 | 0/3 | +| `run_16_r2` | 42.77 | 21.75 | 43.29 | 59.96 | 55.22 | 0/3 | + +### Example continuations + +The following fixed examples use the first audit prompt, `The history of artificial intelligence`, seed 42, and the sampling settings above. They illustrate why low diagnostic loss or valid UTF-8 alone does not establish useful text generation. Escapes preserve the recorded characters; complete byte sequences and all three prompts are in the JSON reports. + +`run_04_v3`: + +```text +"atite white waterfalper diangiets opespucica continues apoliomin for natinal envical grapable tha rust of pria a treating papora" +``` + +`run_14_v3`: + +```text +"al C APLEOSTrorog's NC. Overness I Co eforgram.\nAt 2odromist - Careforrs, Milz Drology in M Ontooyoum , one volume late from obs" +``` + + +### Correctness checks + +| Run | Shapes | Probabilities | Determinism | State chunks | Ternary projection | State size | Causality | +|---|---|---|---|---|---|---|---| +| `run_01` | PASS | PASS | PASS | N/A | N/A | N/A | PASS | +| `run_01_v3` | FAIL | FAIL | FAIL | N/A | N/A | N/A | ERROR | +| `run_02` | PASS | PASS | PASS | N/A | N/A | N/A | PASS | +| `run_02_v3` | FAIL | FAIL | FAIL | N/A | N/A | N/A | ERROR | +| `run_02a_byte_only_heads` | PASS | PASS | PASS | N/A | N/A | N/A | PASS | +| `run_02a_byte_only_heads_v3` | FAIL | FAIL | FAIL | N/A | N/A | N/A | ERROR | +| `run_03` | PASS | PASS | PASS | FAIL | N/A | PASS | PASS | +| `run_03_v3` | PASS | PASS | PASS | FAIL | N/A | PASS | PASS | +| `run_04` | PASS | PASS | PASS | FAIL | PASS | PASS | PASS | +| `run_04_r2` | PASS | PASS | PASS | FAIL | PASS | PASS | PASS | +| `run_04_v3` | PASS | PASS | PASS | FAIL | PASS | PASS | PASS | +| `run_05` | PASS | PASS | PASS | FAIL | PASS | PASS | PASS | +| `run_05_v3` | PASS | PASS | PASS | FAIL | PASS | PASS | PASS | +| `run_05b_kernel_strict` | PASS | PASS | PASS | FAIL | PASS | PASS | PASS | +| `run_05b_kernel_strict_v3` | PASS | PASS | PASS | FAIL | PASS | PASS | PASS | +| `run_06` | PASS | PASS | PASS | FAIL | PASS | PASS | FAIL | +| `run_06_v3` | PASS | PASS | PASS | FAIL | PASS | PASS | FAIL | +| `run_07` | PASS | PASS | PASS | FAIL | PASS | PASS | FAIL | +| `run_07_r2` | PASS | PASS | PASS | FAIL | PASS | PASS | FAIL | +| `run_08` | PASS | PASS | PASS | N/A | PASS | N/A | PASS | +| `run_08_v3` | FAIL | FAIL | FAIL | N/A | FAIL | N/A | ERROR | +| `run_09` | PASS | PASS | PASS | FAIL | PASS | PASS | FAIL | +| `run_10` | PASS | PASS | PASS | FAIL | PASS | PASS | FAIL | +| `run_13` | PASS | PASS | PASS | FAIL | PASS | PASS | PASS | +| `run_13_r2` | PASS | PASS | PASS | FAIL | PASS | PASS | PASS | +| `run_13_v3` | PASS | PASS | PASS | FAIL | PASS | PASS | PASS | +| `run_14` | PASS | PASS | PASS | FAIL | PASS | PASS | FAIL | +| `run_14_r2` | PASS | PASS | PASS | FAIL | PASS | PASS | FAIL | +| `run_14_v3` | PASS | PASS | PASS | FAIL | PASS | PASS | FAIL | +| `run_15` | PASS | PASS | PASS | FAIL | PASS | PASS | FAIL | +| `run_15_r2` | PASS | PASS | PASS | FAIL | PASS | PASS | FAIL | +| `run_15_v3` | PASS | PASS | PASS | FAIL | PASS | PASS | FAIL | +| `run_16` | PASS | PASS | PASS | FAIL | PASS | PASS | FAIL | +| `run_16_r2` | PASS | PASS | PASS | FAIL | PASS | PASS | FAIL | + +**Causality failures: 14/34.** `run_06`, `run_06_v3`, `run_07`, `run_07_r2`, `run_09`, `run_10`, `run_14`, `run_14_r2`, `run_14_v3`, `run_15`, `run_15_r2`, `run_15_v3`, `run_16`, `run_16_r2` + +Changing future inputs changed prefix logits in these models. Some saved configurations enable noncausal Bolmo cross-patch operations; the test detects the effect without isolating its individual source. Their full-sequence losses are descriptive reconstruction scores and cannot establish causal prediction quality. + +**State chunk failures: 26.** `run_03`, `run_03_v3`, `run_04`, `run_04_r2`, `run_04_v3`, `run_05`, `run_05_v3`, `run_05b_kernel_strict`, `run_05b_kernel_strict_v3`, `run_06`, `run_06_v3`, `run_07`, `run_07_r2`, `run_09`, `run_10`, `run_13`, `run_13_r2`, `run_13_v3`, `run_14`, `run_14_r2`, `run_14_v3`, `run_15`, `run_15_r2`, `run_15_v3`, `run_16`, `run_16_r2` + +These configurations did not reproduce a full-sequence forward when carrying state between chunks at the stated tolerance. An O(1) state tensor alone does not establish correct streaming equivalence. No fix to the trained architectures or weights was made for this audit. + +### Recurrent implementation diagnostic + +The source’s `AblationMLGRU._parallel_scan` was tested independently against its defining serial recurrence with random candidate/forget tensors, seed 19, shape `[1,32,8]`, FP32. The maximum difference was **19.100506**; splitting the same scan into two 16-step chunks differed by **11.471270** (tolerance `1e-4`). See [`implementation_diagnostics.json`](https://huggingface.co/Cukinator/cpu1-ablations-final/blob/main/evaluation/implementation_diagnostics.json) and the bundled `evaluation/diagnostics.py`. + +The implementation replaces log-cumulative-sum-exp with a cumulative-maximum normalization followed by a cumulative sum; accumulated terms are not rescaled when that maximum changes. The observed outputs therefore do not satisfy the intended recurrence. This is a source implementation defect; disabling or repairing the scan would create a different inference protocol and was not silently applied to these results. The trained-checkpoint audit uses the source as supplied. + +### Evaluation errors + +Scores and speed are unavailable when model loading or numerical evaluation fails. Nonfinite values are represented as JSON null; they are never substituted with valid-looking numbers. + +| Run | Error | +|---|---| +| `run_01_v3` | ValueError: nonfinite loss | +| `run_02_v3` | ValueError: nonfinite loss | +| `run_02a_byte_only_heads_v3` | ValueError: nonfinite loss | +| `run_08_v3` | ValueError: nonfinite loss | + +## Source and dataset provenance + +Historical extraction and training code is retained in the [GitHub history](https://github.com/igna-s/New-1.58/tree/main/docs/provenance). Kaggle and Lightning recipes, AMD training, and 34 configuration records are included in `evaluation/source/`. The configuration records preserve published budgets, including the 150 tokens/parameter v3 setting; they do not prove the exact training source commit or achieved exposure. + +The [dataset review](https://huggingface.co/datasets/Cukinator/cpu1-ablation-dataset) documents short/empty teacher arrays, an observed dense-signal reader alignment defect, and UTF-8 conversion limitations. These observations do not isolate their effect on a training run. No weights, stored datasets or numerical model implementation were repaired in this documentation update. + +## Architecture recorded in each checkpoint + +Run names identify experiments; dimensions and features below come from the saved configuration. FP16 is the training quantization label, while this audit executes the loaded tensors in FP32. β€œ50M” and β€œ10M” in older cards were design families, not exact model sizes. + +| Run | Mixer | Tokens | Quant. label | Width / layers / FFN | Local decoder | FP residual | Bolmo | DeleteGate | PFNet hidden | Channel decay | +|---|---|---|---|---|---|---|---|---|---:|---| +| `run_01` | transformer | bpe | fp16 | 512 / 12 / 1376 | N/A | no | no | no | 0 | no | +| `run_01_v3` | transformer | bpe | fp16 | 512 / 12 / 1376 | N/A | no | no | no | 0 | no | +| `run_02` | transformer | byte | fp16 | 512 / 12 / 1376 | yes | no | no | no | 0 | no | +| `run_02_v3` | transformer | byte | fp16 | 512 / 12 / 1376 | yes | no | no | no | 0 | no | +| `run_02a_byte_only_heads` | transformer | byte | fp16 | 512 / 12 / 1376 | no | no | no | no | 0 | no | +| `run_02a_byte_only_heads_v3` | transformer | byte | fp16 | 512 / 12 / 1376 | no | no | no | no | 0 | no | +| `run_03` | mlgru | byte | fp16 | 512 / 12 / 1376 | yes | no | no | no | 0 | no | +| `run_03_v3` | mlgru | byte | fp16 | 512 / 12 / 1376 | yes | no | no | no | 0 | no | +| `run_04` | mlgru | byte | ternary | 512 / 12 / 1376 | yes | no | no | no | 0 | no | +| `run_04_r2` | mlgru | byte_dynamic | ternary | 512 / 12 / 1376 | yes | no | no | no | 0 | no | +| `run_04_v3` | mlgru | byte | ternary | 512 / 12 / 1376 | yes | no | no | no | 0 | no | +| `run_05` | mlgru | byte | ternary | 512 / 12 / 1376 | yes | yes | no | no | 0 | no | +| `run_05_v3` | mlgru | byte | ternary | 512 / 12 / 1376 | yes | yes | no | no | 0 | no | +| `run_05b_kernel_strict` | mlgru | byte | ternary | 512 / 12 / 1376 | yes | yes | no | no | 0 | no | +| `run_05b_kernel_strict_v3` | mlgru | byte | ternary | 512 / 12 / 1376 | yes | yes | no | no | 0 | no | +| `run_06` | mlgru | byte_dynamic | ternary | 512 / 12 / 1376 | yes | yes | yes | no | 0 | no | +| `run_06_v3` | mlgru | byte_dynamic | ternary | 512 / 12 / 1376 | yes | yes | yes | no | 0 | no | +| `run_07` | mlgru | byte_dynamic | ternary | 512 / 12 / 1376 | yes | yes | yes | yes | 0 | no | +| `run_07_r2` | mlgru | byte_dynamic | ternary | 512 / 12 / 1376 | yes | yes | yes | yes | 0 | no | +| `run_08` | transformer | byte | ternary | 512 / 12 / 1376 | yes | no | no | no | 0 | no | +| `run_08_v3` | transformer | byte | ternary | 512 / 12 / 1376 | yes | no | no | no | 0 | no | +| `run_09` | mlgru | byte_dynamic | ternary | 512 / 12 / 1376 | yes | yes | yes | yes | 32 | no | +| `run_10` | mlgru | byte_dynamic | ternary | 512 / 12 / 1376 | yes | yes | yes | yes | 32 | yes | +| `run_13` | mlgru | bpe | ternary | 320 / 8 / 853 | N/A | yes | no | yes | 0 | no | +| `run_13_r2` | mlgru | bpe | ternary | 320 / 8 / 853 | N/A | yes | no | yes | 0 | no | +| `run_13_v3` | mlgru | bpe | ternary | 320 / 8 / 853 | N/A | yes | no | yes | 0 | no | +| `run_14` | mlgru | byte_dynamic | ternary | 320 / 8 / 853 | yes | yes | yes | yes | 0 | no | +| `run_14_r2` | mlgru | byte_dynamic | ternary | 320 / 8 / 853 | yes | yes | yes | yes | 0 | no | +| `run_14_v3` | mlgru | byte_dynamic | ternary | 320 / 8 / 853 | yes | yes | yes | yes | 0 | no | +| `run_15` | mlgru | byte_dynamic | ternary | 320 / 8 / 853 | yes | yes | yes | yes | 0 | no | +| `run_15_r2` | mlgru | byte_dynamic | ternary | 320 / 8 / 853 | yes | yes | yes | yes | 0 | no | +| `run_15_v3` | mlgru | byte_dynamic | ternary | 320 / 8 / 853 | yes | yes | yes | yes | 0 | no | +| `run_16` | mlgru | byte_dynamic | ternary | 320 / 8 / 853 | yes | yes | yes | yes | 0 | no | +| `run_16_r2` | mlgru | byte_dynamic | ternary | 320 / 8 / 853 | yes | yes | yes | yes | 0 | no | + +These experiments change parameter counts, representations, training signal, budgets, saved steps, and sometimes multiple architectural settings. The audit is not a controlled causal estimate of the benefit of an individual component. `chinchilla_tokens_per_param` is a configured budget; it does not prove that a run completed that budget. Actual saved steps are reported separately. + +## 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. diff --git a/evaluation/source/docs/provenance/README.md b/evaluation/source/docs/provenance/README.md new file mode 100644 index 0000000000000000000000000000000000000000..a04170640e91c328bbc627e3e5612904aa97ab5a --- /dev/null +++ b/evaluation/source/docs/provenance/README.md @@ -0,0 +1,66 @@ +# Experiment provenance review β€” 2026-10-08 + +The initial cleanup excluded experimental source too broadly. This correction restores **148 historical paths** while keeping the working tree organized. The 87 original commits and the subsequent security commit retain their authors, dates, messages and parent relationships after remapping. Commit IDs change because their trees or ancestors change. + +[restored-files.json](restored-files.json) lists every restored path, its original and remapped source commit, blob, SHA-256 and direct source link. It also lists the 109 paths that remain excluded. [history-map.json](history-map.json) maps the original commits to the public history. The retained file modes and blobs were compared in every original commit; the cleanup tip's tree is unchanged. + +## What belongs in the project + +| Material | Treatment | +|---|---| +| Earlier architectures, ablation configuration/model/training modules, extraction and byte-marginalization code | Preserved in Git history with original contents | +| Kaggle and Lightning launchers, SDK helpers, three notebooks and platform metadata | Preserved in history; current package-based recipes live in `runners/` | +| Eighteen Python files formerly under `models/ablation_models/` | Preserved in history as experimental source, distinct from downloaded weights | +| Historical evaluation and inference tools, including the earlier 26 checks | Preserved in history; current common evaluator remains in `evaluation/` | +| 34 historical `resultados/ablation_run_*.json` files and their summary | Preserved in history; historical metrics are not substituted for the October CPU audit | +| Model weights, downloaded tokenizer/config caches, parquet data, papers, compiled binaries and generated benchmark outputs | Excluded from Git; model/data artifacts are linked on Hugging Face | +| Personal prompts, reference summaries, private backups, environments and credentials | Remain local and ignored; design proposals are not treated as experimental evidence | + +Historical code is an audit trail, not a claim that every old snapshot runs successfully. Six distinct historical `train_ablation.py` blobs have a syntax error. Earlier run numbers refer to different architectures; matching a name alone does not identify the same experiment. Use the current packages and an explicit recorded configuration. + +## Training platforms and recorded configurations + +The author confirmed using **Kaggle, Lightning and AMD**, with the code committed. That statement identifies the platforms used across the project; it does not assign each checkpoint to a job. + +- Kaggle dataset launcher: target 850,000 documents, chunks of 500, initial shard offset 0, streaming upload. +- Lightning dataset launcher: target 850,000 documents, chunks of 3,000, initial shard offset 0, streaming upload. +- These are committed recipe settings, not verified document totals. Resume bookkeeping and changed extraction versions prevent deriving exposure from those settings alone. +- The current AMD preset uses 150 configured tokens/parameter and the historical `cpu1-ablation-checkpoints-v3` upload destination. Published `_v3` configurations are consistent with those settings. This does not prove the exact job platform or source commit. + +[experiments/published/manifest.json](../../experiments/published/manifest.json) indexes the **34 published FP32 exports**, checkpoint SHA-256 values, pinned model revision, saved steps, parameter counts and configuration files. Configurations come from the pinned CPU audit records. The evaluation loader disabled `use_gradient_checkpointing` before recording them; they are not byte-for-byte original checkpoint config payloads. The trainer enables gradient checkpointing for actual GPU training. + +`--config` loads the record without merging current presets. Explicit configurations run their selected phase instead of silently chaining another phase. The records include historical upload destinations; copy a record and set your own destination when starting a new experiment. Saved steps are actual checkpoint metadata; configured token budgets are not measured completion. + +## Current platform recipes + +Run from a writable checkout, such as `/kaggle/working/New-1.58` or a Lightning Studio project. Install the appropriate PyTorch build and `requirements/data.txt` or `requirements/training.txt` first. The recipes run inside the selected platform; they do not submit remote jobs through the platform SDK. + +```bash +# Prints the committed dataset recipe without extracting or uploading. +python -m runners.kaggle dataset +python -m runners.lightning dataset + +# Executes extraction and streaming upload; configure your own HF_TOKEN first. +python -m runners.kaggle dataset --execute +python -m runners.lightning dataset --execute + +# Preview a recorded training configuration. +python -m runners.lightning ablation --backend amd --run run_04_v3 --config experiments/published/configs/run_04_v3.json +# Append --execute to run, with a compatible ROCm installation and GPU. +``` + +Kaggle execution can read `HF_TOKEN` from Kaggle Secrets; Lightning/AMD use the environment. Tokens are never printed by these recipes. Optional HF mounts use `cpu1/hub_storage.py`; install hf-mount separately on Linux/macOS. Training mounts a dataset repository for reading. The helper passes credentials in the child environment and does not run a remote installer. + +## Evidence and unresolved provenance + +The [dataset card](../model_cards/cpu1-ablation-dataset.md) documents the 917 parquet files, revision, sample scope, teacher formatting, observed reader alignment defect and UTF-8 limitations. The inspection is repeatable: + +```powershell +python -m evaluation.dataset --storage D:/cpu1-readme-audit --tokenizer +# Reuse the same three downloaded shards/tokenizer without network access: +python -m evaluation.dataset --storage D:/cpu1-readme-audit --tokenizer --offline +``` + +This downloads about 158.5 MB of parquet samples to D:, not a teacher or student model. Results are written under ignored `outputs/provenance/`. Each sample is checked against its reviewed SHA-256. To publish the reviewed dataset card and report with owner authentication, append `--publish-card`; all parquet paths, sizes and LFS hashes must still match the reviewed data revision. All 34 recorded configurations were checked against their audited parameter counts using meta tensors; no model weights were downloaded for that check. Fourteen offline tests passed. + +The available artifacts do not bind each training job to its exact source commit, dependency lock, resolved teacher/tokenizer revision, extraction version, source documents or projection matrix. Restoring committed code makes its evolution inspectable; it does not fill those missing records. A deterministic end-to-end retraining or dataset reconstruction is therefore not established. The stored model/data artifacts and the known numerical implementations were left unchanged; existing audit results retain their original date and limitations. diff --git a/evaluation/source/docs/provenance/history-map.json b/evaluation/source/docs/provenance/history-map.json new file mode 100644 index 0000000000000000000000000000000000000000..00dbb7608e82b9d83b8264bb5e183fda4af1f8a1 --- /dev/null +++ b/evaluation/source/docs/provenance/history-map.json @@ -0,0 +1,93 @@ +{ + "scope": "Original 87 commits plus the subsequent security commit; messages, authors, dates and retained blobs unchanged; parents remapped", + "commits": { + "1511b7505a3f18727afb09e6328bba26f4cb7491": "e824d641f804ee624b10bf09e8d5e95a64d953cf", + "18826ec2827a09950797463633c1f5187af29a5b": "366f44dd44715a7dec4928c8fcaa2c09c85ecd1b", + "189b002f4040a5fc7660b693d11a7765bf294e1b": "374dff3ba079a65813e5430107f2931bcdad6888", + "1abbc146b3c4a09b8a145183798f54823051a0cc": "cd49c83d57fb151ce8e523be14116c56e6e4e95b", + "1aec9c8db3b59b1660a917450ef79cc273e06c15": "fcad26abba32988857cba07d276e30b2f14141fe", + "1b33dcaf0c50a9b79e0f8535144d5097d6e8d9b8": "b641259f33a7ef44a02d060d8c090f5d8ed704fb", + "1b3c2c94783688c0b4c5e3e4b6ef1c496f8c5491": "59fe5a8dff043aa1e864c6f96bc7013ef7cc4631", + "1fd4aa6b68c808d2f6335c537e273be2b739a69a": "c531f174df6deaa090968966f101fdbf7a6a155d", + "20affc1da4485efbf6fb2a3e276a4bc78ef50e8c": "53fadb5f1e397cbb85d3712f020cf20a80d19b6a", + "2107fbbff494d01ad27f2fdfecf2610dc2addee2": "d2bfad7aeed8132812b8a329a1836d8f797029a5", + "242e9461f49c7a0b5c6a036b358970f742e776c8": "bd79b1640ce91ebd424c957cb16b45c5a53de517", + "24e2c3994e33c53e85c895822ae7f63273602f1e": "3bca583aee4b013037e62d57a2973eb760496d85", + "2e36857efbbad631a60db5c80fbe41413b9e9ab8": "968fe49961b1b6d350254140e97f92a5dedfb2b4", + "2f072828892c68d2698593ef39c3e35fca2da933": "9e14b932099c654e81a08898e97b2aff8ef53ece", + "337ce3ee6196427ad8d580e5b996bcc59dfcfc9b": "c93352b2f1e8df7be39fc5ef38c018532bfb9dab", + "34ce0b085ed182fc96b25c7a49e8170aae6f43a1": "03dfef766f406b8e3f0fe23de9f995555c7a7f10", + "36a60a829fb8e5b91896fa18ca32ae1c98dbc959": "46cade96f49c98e7b9249b91d3ba4ea7b95d34c8", + "3741d103118e876563e21b294c3a97a2e3170a88": "c1c835d1c2ee01ca6322e4019b5fda1c2289a20a", + "39be192084aa30a2af7f2efd7fa1910796e73d63": "7ef585f0efb9a10957f4cc885e3c6f3cd8035c2d", + "3a79d22c0b3b4e22cc350613bf81c1c52d38905b": "cef209e226a34662ea8965917bdda82273947595", + "3b82b905289bab7bafacf1cfb3b1cc90e195b525": "bf4e16329c0ddbd770b83b41b671d62969f18311", + "3bdd8255b7096612a1640cab831f89d12a8ca8ec": "1258390a9bf353568a6e17510e1a6e66d3cb165e", + "45f81b2917a3c7f72c10185baef137bb7dbde90e": "470ac42a472de339067ec995d033f3a870dba4e3", + "46bd46dece5db8eba2275eb796e7ae710cf2d8d4": "bac59ceca8af71777fbbb004c698befd7e3351e6", + "478567a771af3b5decb62545a352f58cd7a14e1c": "93b6fdddc4a276e4ad7c67e3aba9a4391e1b04c9", + "488a086ab6a0d21e7ed6580ccc7bcf387311a921": "24e64a311b0affd1394d9af7f41bff35da098c47", + "55b47609edb849884daabddcdd57c3806e3904df": "3c1aa50a15ee6fcd8a8c90b728da6db0c6836561", + "5833a042dcdfe883dc3a1832c463a7ab1fa2d56c": "edce5b9fa057c3e8afd4737254a9804780ae7a70", + "5e6b1bcd685820cc3e4f00aae25565f904d9f17b": "c21f2e41a90875be2736f7f54c58a28cf48db205", + "5e6e34e5c9d8826afa56b5d55e8f5545175b69d1": "1f348725012fbe731b72a4e09f4ddf0553e13a21", + "6777bf8eaca79700ec5a0378eadc6182ec68435c": "2e59123ea6600ed27f3108a4341bf9d8d28aebbe", + "6f97ebd101644dddab57d201b8f303518baf2d09": "dcafa9518e2097bd9eda756558e4085fd778c1cf", + "769da9b67f160bc93fa18baea508cd8c91f8488d": "1a6a27c8b57c17d88a64f999b94d5597b6b7bdc3", + "799e54bc87b23710a8ffce921d38f776030b997b": "0c767db6aca778f9e2d5e87afa8c04698b7a0dcf", + "7bc42aa0da0cf088e187814d47787b6754194574": "c4028da1a6324e1c5d0a8b298657cad7b7a2f794", + "7c7375fecaaf0c3fff0d29ee565f9a85a9a155b4": "3d8a93b36051cb68ba955ed61b9153a7a7ffa4bc", + "7df2203cb16054e129be03394c97c09a55249682": "a5f3009cbc2022ad3e28bf8fafc4c96e7bcb74a6", + "7e047daa4b7f7e5cc5b89219fb71bbbcec0c158f": "688651db885e9499f28f156abc4893cba7cd7dd0", + "80c5042e3624d89af5d1bf953f29380b5fbdcd8c": "9e6900dd528597c385021860c606833486194b4f", + "82522e014451843dc512cd4f7ce2933b6288dd4d": "e183a1ea0fc27958c9da63a6a6ead4946d8ad196", + "844b0312ba6760751e27a93c64ed3dd4e2394d12": "93b1fd03b01499ad7eb85b52a8d3973bb8db74fc", + "8bf278803e65141aa1f5bde0b01b2d1dcb37f815": "a113f0e16ca2ec229d1ef14912e5a45a608aeba4", + "8faf6d0486e91beab843068c0176ba7ac603db31": "67005146fefe387c573e8e52c95b83260d116b3f", + "95c664dbb6fa9fc135ad816222435f98f2c69c1c": "f05a50758f73bda0832a661a6908793cba066a99", + "99a62e99ca8d2f3715cc140996a93849588c1720": "99a62e99ca8d2f3715cc140996a93849588c1720", + "99da1e826f44e1cc02cbb7ae987146a06a15f45a": "c027e8e1baaa0b25afe1378139c03f054921d892", + "9a71cdb2953ab65b24ca7633dc6853b575ff2ebf": "d1c651e427d2a0354eae5b2aac4b1754ffc28a5d", + "9c2e0db80c47294744e5a9753e92801241708d7b": "1e10bcd53e8ef621a76ce042b7af6bb198c5ac63", + "a194335547bd10768cde3fcb61129230cb896f43": "7a40853b2eea2eb520ab7b90c35cd7f8486cbc93", + "a2b29b13f8667a1b97bc1881cb38641dfcfa3a38": "a80f30ebd1769b565b41a559878ad98ac4a99d77", + "a2f4a65655030c4df3a9a1fc2e83c9afa5216bb5": "996ae7d0e2b4894107593c331e2d4abd6260c9d0", + "a582d54dde10e6de6c46a3bbc87bcc20fdf5ec06": "26bc26b8d1bcde3f9e318c3cf9a360adc084e623", + "a9e49cf28e8bb02d312caad62a2592fdb7f59ec4": "6eeb2a3b2a5d2f87b41bd0a82b1f2d4bc03488f4", + "ac4ae35ad899c4767cedae14b907c8153edb0a4b": "828b42dd133c868051579846a1626d5f794fbee3", + "b28227379a0d8ac1bc2bd61318b3f8cffeecb8f1": "11aab006418ba63a56d44473ba20b75677874815", + "b3c8dca5bdacefd51549cb28cbd55983a4fa299e": "2dac01dda30d0ef734016af2303c819438ed04f1", + "bb21da80de485363d1b92ac43acf9ec23f9141b9": "ab444d1f8912832c6ad1cffb46234d9b82f0b32e", + "bccdd9618bbbc446ac903c590c142e942e14eea8": "a3d9b32391c64752ea2a6136ebe5e747d09caee3", + "c11022c98db2e42c8d44f582bf2cb655cdcec7d2": "706f1282d7f6c4c087689affc31127b10d9eb64f", + "c2fb5d37a3b6c0906abbfb2480202055aaee8c86": "a90ec3e01ad30b0e1701dff1dd60bae655708bf1", + "c8b666206d5243ce665b1cadb11d678b032f6176": "c7225d00c5e872236b7573ad61cfbeb3c580078b", + "ca3c779cb955a2c0cc9368de4044bcbd3dd3575d": "e2882c0ba872b88682f390d386ec5ea0ce3a0645", + "cc3479340c42a2b8a696b9237fea80e758283434": "fa6bd8b1dcdd7976fc07a480b3662c579c302568", + "cda7a9018b321e78a9c9a434f31899f7834be1ab": "280a02daf800f99c91f2059cdb5825e3be7ed4a8", + "cfc06362a2814e076c5a3e8f37545e92c00cef1f": "cfeba34ede1ea41e10ce95a8a2836b232714bb0c", + "d57b3791b7398793c788cf7af8aaef1b1de32528": "8dc0a5f14f2761f04db3d4beae3510e797593580", + "d5e1152a2cf6f452132f8f4b7b45cf273e523dca": "2a15e3468f53bc9f93dc0e001aa86662e3460f15", + "d66ce10b8b24f3946dd041c81da6dd9a461d7446": "da7353c78433ad049fa1702604f66a9ed9f265f8", + "d7a0813462a104751756e2daecb4ced942497a14": "f6573f85e12e92b7736cc46d655313f583c3a223", + "daa07e07bdad8d3627a4e16cac96ddcb7e694951": "23741096fc497f92b1c81dbfd387bce5575a6eef", + "dba7c80caf446492e6539fa0b075fa4d489aec80": "fffcd2af9f7be798e6035542a7774416bc77d1e3", + "de5a924176de54338af549222dd0a59a62ea790d": "2dec8c72fc11c9bdf8c657c76d80cfedd182f5a9", + "df0d3722042302c676790fc35daefeef14eaa045": "8c4265cd5bc442292983d21f62feb8d2dee8bdf4", + "dfbf151efb9aed52b7d1a3beeef513c3f70eec18": "08265b3bd8ea55d34c24f02674d64d6cea41d269", + "e57c25df71237e74dbf3a453778bbf8f1308b1ac": "e30b66897e569a47f70b4a41193ca15bdb886a9e", + "e93c10b113ca008dd46547e2bea0a165303c3a93": "b42a447cbd377937784851cd81fc03ac7b117a25", + "eb9cb8db2ad5b81a35f73b3cf62b7d715732f79e": "e67c48eb14ca89cac4ae63e02e706a71ddf8f197", + "eca01850c62a7a2a085809e9a5fd03aa154130f9": "aff17b05a2b1fd5ee3f2e42919e27b99770b2816", + "eda181d83536bb3bc6e759c98e1dfa633fb0bbef": "c4c73b223e4e9f854362bb4dcc655fae0b406762", + "efd9f6a25445225f114fbc94fdd2ecd95727c872": "b2dc348be01ea067a79fae5fc6aa47a0ab9872a3", + "f02684d5c2d4828f97b4e79b5a26f4eb172b6950": "8cf94406de7efe8ec754edcea34362b4091d77e5", + "f152fd68aa174b20a918453c81077dd3a202c977": "acd823007b3396c62ac0f588d88756291a6b8bc7", + "f318df50e6b0de41e13eba0feefc868a7c419830": "29c9439db6a7ba4cb9395840477aa592a537ac98", + "f52f2dcae8ce0cd12e24f419a5545e15750b4f72": "bc58efaa7ef00dc24f57ea7479415520fb92705f", + "f6594dfe2bfc0bc0b4e70e9afe0e5751ccdfe955": "27eb0e05196c3f38876548659314d069573e251b", + "fb07736c5757982f6f1087e99be426d5ee6c7ba3": "f93e8a749692f43d78bc1b26c90e65a0dcffaf38", + "fd5b6df6f0418d211d7816166e17f30bf86e3d4a": "435c287726cc6efe54033b0bf933156eb7459990", + "5b96fddb07e4d2aff3661ee3b2bc308f15fe37d2": "096c1e8caa0a392372ff742a81e45277ab13b0d7" + } +} diff --git a/evaluation/source/docs/provenance/restored-files.json b/evaluation/source/docs/provenance/restored-files.json new file mode 100644 index 0000000000000000000000000000000000000000..1dcfd6625eed8b151e6fe152889d51ea8c53d071 --- /dev/null +++ b/evaluation/source/docs/provenance/restored-files.json @@ -0,0 +1,1596 @@ +{ + "restored_paths": 148, + "files": [ + { + "path": "_upload_tmp/ablation.py", + "original_commit": "799e54bc87b23710a8ffce921d38f776030b997b", + "restored_commit": "0c767db6aca778f9e2d5e87afa8c04698b7a0dcf", + "blob": "fb76b4f420f7fead724f096ea1b531150f328573", + "sha256": "63d717109c8de60727708328c29e4de70167345ea9812f624705109cac5723f7", + "bytes": 36394, + "role": "historical experimental source or platform metadata", + "url": "https://github.com/igna-s/New-1.58/blob/0c767db6aca778f9e2d5e87afa8c04698b7a0dcf/_upload_tmp/ablation.py" + }, + { + "path": "_upload_tmp/create_dataset.py", + "original_commit": "799e54bc87b23710a8ffce921d38f776030b997b", + "restored_commit": "0c767db6aca778f9e2d5e87afa8c04698b7a0dcf", + "blob": "33ce56d5d27c315353253dce00d37ffe6c7a9b88", + "sha256": "194226414f189d2d3b62c87bb942bebe73fdf8f8c4a77e0b163fcaa296c83701", + "bytes": 102711, + "role": "historical experimental source or platform metadata", + "url": "https://github.com/igna-s/New-1.58/blob/0c767db6aca778f9e2d5e87afa8c04698b7a0dcf/_upload_tmp/create_dataset.py" + }, + { + "path": "_upload_tmp/dataset-metadata.json", + "original_commit": "799e54bc87b23710a8ffce921d38f776030b997b", + "restored_commit": "0c767db6aca778f9e2d5e87afa8c04698b7a0dcf", + "blob": "9eabb11352181aeddd02f56fc5480a6565421457", + "sha256": "bb2b86123de16ab99869991c42601b7e47915a7331da8481d72d2ddbd1e39986", + "bytes": 120, + "role": "historical experimental source or platform metadata", + "url": "https://github.com/igna-s/New-1.58/blob/0c767db6aca778f9e2d5e87afa8c04698b7a0dcf/_upload_tmp/dataset-metadata.json" + }, + { + "path": "_upload_tmp/hf_mount.py", + "original_commit": "799e54bc87b23710a8ffce921d38f776030b997b", + "restored_commit": "0c767db6aca778f9e2d5e87afa8c04698b7a0dcf", + "blob": "b2ae3a181a52f77d5a3692e20ebc7fdf91f8e07c", + "sha256": "f79a7690d8305b726ac25e50a1c2b56e91f447bc6e5dfc1bf66a1adb057769af", + "bytes": 3873, + "role": "historical experimental source or platform metadata", + "url": "https://github.com/igna-s/New-1.58/blob/0c767db6aca778f9e2d5e87afa8c04698b7a0dcf/_upload_tmp/hf_mount.py" + }, + { + "path": "_upload_tmp/inference.py", + "original_commit": "799e54bc87b23710a8ffce921d38f776030b997b", + "restored_commit": "0c767db6aca778f9e2d5e87afa8c04698b7a0dcf", + "blob": "ed8747c3e90a6e93ec61594bdc120781b4a6f591", + "sha256": "efd3d5d1193e2f3e50a7876e41f3c8aac2daaed904e14ab72699a5e38d1ac311", + "bytes": 59646, + "role": "historical experimental source or platform metadata", + "url": "https://github.com/igna-s/New-1.58/blob/0c767db6aca778f9e2d5e87afa8c04698b7a0dcf/_upload_tmp/inference.py" + }, + { + "path": "_upload_tmp/model.py", + "original_commit": "799e54bc87b23710a8ffce921d38f776030b997b", + "restored_commit": "0c767db6aca778f9e2d5e87afa8c04698b7a0dcf", + "blob": "41c000c6bb9cf25a2d1b570a3297127ab43f4eec", + "sha256": "ba22de8966a569f823714351597b67fc5c4565bed022e6edd89d816789441440", + "bytes": 63483, + "role": "historical experimental source or platform metadata", + "url": "https://github.com/igna-s/New-1.58/blob/0c767db6aca778f9e2d5e87afa8c04698b7a0dcf/_upload_tmp/model.py" + }, + { + "path": "_upload_tmp/train.py", + "original_commit": "799e54bc87b23710a8ffce921d38f776030b997b", + "restored_commit": "0c767db6aca778f9e2d5e87afa8c04698b7a0dcf", + "blob": "54aeece68360ea3e35617c08fae5997ed46a2f82", + "sha256": "60187cefb4da2d0d55c3d065ca05e5a8098b8417b00f64e81b461f5507ecda68", + "bytes": 69919, + "role": "historical experimental source or platform metadata", + "url": "https://github.com/igna-s/New-1.58/blob/0c767db6aca778f9e2d5e87afa8c04698b7a0dcf/_upload_tmp/train.py" + }, + { + "path": "ablation.py", + "original_commit": "c2fb5d37a3b6c0906abbfb2480202055aaee8c86", + "restored_commit": "a90ec3e01ad30b0e1701dff1dd60bae655708bf1", + "blob": "912bd66331c7173530104155248fca8d01d6b318", + "sha256": "57225e407fc2e1fe9ae9e815b0436f87f4ec9159f9ff8a99a684451fd981b54c", + "bytes": 71863, + "role": "historical experimental source or platform metadata", + "url": "https://github.com/igna-s/New-1.58/blob/a90ec3e01ad30b0e1701dff1dd60bae655708bf1/ablation.py" + }, + { + "path": "ablation_analysis.py", + "original_commit": "ac4ae35ad899c4767cedae14b907c8153edb0a4b", + "restored_commit": "828b42dd133c868051579846a1626d5f794fbee3", + "blob": "d0802678ecc11edff8965dca135c80d05a27b99e", + "sha256": "9f4a19eebe6cef37e327763664de743edeec6d5b04dc721a273f36242f2bc22a", + "bytes": 7404, + "role": "historical experimental source or platform metadata", + "url": "https://github.com/igna-s/New-1.58/blob/828b42dd133c868051579846a1626d5f794fbee3/ablation_analysis.py" + }, + { + "path": "ablation_config.py", + "original_commit": "ac4ae35ad899c4767cedae14b907c8153edb0a4b", + "restored_commit": "828b42dd133c868051579846a1626d5f794fbee3", + "blob": "992cc468e30b231a319334abf9f2617a13f9763b", + "sha256": "da413a404cf408e31a1e332cfc46b754c1a9548d19bee150f2c5d3527dfe2056", + "bytes": 11787, + "role": "historical experimental source or platform metadata", + "url": "https://github.com/igna-s/New-1.58/blob/828b42dd133c868051579846a1626d5f794fbee3/ablation_config.py" + }, + { + "path": "ablation_models.py", + "original_commit": "ac4ae35ad899c4767cedae14b907c8153edb0a4b", + "restored_commit": "828b42dd133c868051579846a1626d5f794fbee3", + "blob": "4ae98bebe947c8b1f156bd180114571c42ecb20c", + "sha256": "505b5b15f7eac577aa7f177b2f0f02d69d4a4898403276d3d3e8affedf2d9e00", + "bytes": 17950, + "role": "historical experimental source or platform metadata", + "url": "https://github.com/igna-s/New-1.58/blob/828b42dd133c868051579846a1626d5f794fbee3/ablation_models.py" + }, + { + "path": "ablation_train.py", + "original_commit": "ac4ae35ad899c4767cedae14b907c8153edb0a4b", + "restored_commit": "828b42dd133c868051579846a1626d5f794fbee3", + "blob": "c2d4f7aa4bfea5ff29480cbf8ab390226dd57175", + "sha256": "821d5d578f211b26d9082dac0e1678d76eee5db42db5886bc1810bf03d1c83e9", + "bytes": 25831, + "role": "historical experimental source or platform metadata", + "url": "https://github.com/igna-s/New-1.58/blob/828b42dd133c868051579846a1626d5f794fbee3/ablation_train.py" + }, + { + "path": "build_shared_dataset.py", + "original_commit": "ac4ae35ad899c4767cedae14b907c8153edb0a4b", + "restored_commit": "828b42dd133c868051579846a1626d5f794fbee3", + "blob": "bda8365abfca34f9cc127580dc82b92eede0f935", + "sha256": "0b171d8881e3f2e5c818c3e77da9a3e8fb9c07334e23095f8110c7a4a049d895", + "bytes": 30289, + "role": "historical experimental source or platform metadata", + "url": "https://github.com/igna-s/New-1.58/blob/828b42dd133c868051579846a1626d5f794fbee3/build_shared_dataset.py" + }, + { + "path": "byte_marginalization.py", + "original_commit": "ac4ae35ad899c4767cedae14b907c8153edb0a4b", + "restored_commit": "828b42dd133c868051579846a1626d5f794fbee3", + "blob": "8dc36953f52a4ce916090c02a746060dd982054d", + "sha256": "ff1b3553a78e45c23f66d46910d344153faea3e1432eac4e79077da414638284", + "bytes": 34857, + "role": "historical experimental source or platform metadata", + "url": "https://github.com/igna-s/New-1.58/blob/828b42dd133c868051579846a1626d5f794fbee3/byte_marginalization.py" + }, + { + "path": "download_model.py", + "original_commit": "799e54bc87b23710a8ffce921d38f776030b997b", + "restored_commit": "0c767db6aca778f9e2d5e87afa8c04698b7a0dcf", + "blob": "42812263d13751ad0ba1cdc15c86316c1c3b7d60", + "sha256": "0e0fe76ba62d41c8aac78b644ec7216fb99ae7bef45eba02152558291aa84ec2", + "bytes": 649, + "role": "historical experimental source or platform metadata", + "url": "https://github.com/igna-s/New-1.58/blob/0c767db6aca778f9e2d5e87afa8c04698b7a0dcf/download_model.py" + }, + { + "path": "eval/benchmark_external.py", + "original_commit": "6777bf8eaca79700ec5a0378eadc6182ec68435c", + "restored_commit": "2e59123ea6600ed27f3108a4341bf9d8d28aebbe", + "blob": "afde629809c651ff3bcaf71bd9e0f1ef979dfc22", + "sha256": "4155936574a402417a3f087bad1ae5f0dce4532e5205e04470add0e69306b34d", + "bytes": 32514, + "role": "historical experimental source or platform metadata", + "url": "https://github.com/igna-s/New-1.58/blob/2e59123ea6600ed27f3108a4341bf9d8d28aebbe/eval/benchmark_external.py" + }, + { + "path": "eval/bpe_vs_bytebatch_benchmark.py", + "original_commit": "6777bf8eaca79700ec5a0378eadc6182ec68435c", + "restored_commit": "2e59123ea6600ed27f3108a4341bf9d8d28aebbe", + "blob": "bd4496d66d2572c53db7e4bb961583bba7b512ca", + "sha256": "1117a96a4e4aa7a2266319a73812e0ee84375f60d46947645e1c56459967f148", + "bytes": 6671, + "role": "historical experimental source or platform metadata", + "url": "https://github.com/igna-s/New-1.58/blob/2e59123ea6600ed27f3108a4341bf9d8d28aebbe/eval/bpe_vs_bytebatch_benchmark.py" + }, + { + "path": "eval/compute_missing_val_loss.py", + "original_commit": "f52f2dcae8ce0cd12e24f419a5545e15750b4f72", + "restored_commit": "bc58efaa7ef00dc24f57ea7479415520fb92705f", + "blob": "5cae59679bade6c903ea94a27821c959037ffe10", + "sha256": "ab6768f79e283bb9b96f9a551741720a504c40cac23bf5d468e1899a8863ac72", + "bytes": 21489, + "role": "historical experimental source or platform metadata", + "url": "https://github.com/igna-s/New-1.58/blob/bc58efaa7ef00dc24f57ea7479415520fb92705f/eval/compute_missing_val_loss.py" + }, + { + "path": "eval/eval_ablations.py", + "original_commit": "f52f2dcae8ce0cd12e24f419a5545e15750b4f72", + "restored_commit": "bc58efaa7ef00dc24f57ea7479415520fb92705f", + "blob": "9fbe26fd13373952054a6f20db522acf1bd012cd", + "sha256": "5621eb3c4cbb8455413f9dfcc01e2d615b64dee12b651d717ac03976b93921d2", + "bytes": 37805, + "role": "historical experimental source or platform metadata", + "url": "https://github.com/igna-s/New-1.58/blob/bc58efaa7ef00dc24f57ea7479415520fb92705f/eval/eval_ablations.py" + }, + { + "path": "eval/eval_cpu.py", + "original_commit": "6777bf8eaca79700ec5a0378eadc6182ec68435c", + "restored_commit": "2e59123ea6600ed27f3108a4341bf9d8d28aebbe", + "blob": "a80ec3100aa4c1064eb47e3b74066ce4ae86c4db", + "sha256": "4fdb78ffc418488c484b22a919de14a21de215c7635a80ec3f36932e8a840347", + "bytes": 3956, + "role": "historical experimental source or platform metadata", + "url": "https://github.com/igna-s/New-1.58/blob/2e59123ea6600ed27f3108a4341bf9d8d28aebbe/eval/eval_cpu.py" + }, + { + "path": "eval/eval_dataset.py", + "original_commit": "f52f2dcae8ce0cd12e24f419a5545e15750b4f72", + "restored_commit": "bc58efaa7ef00dc24f57ea7479415520fb92705f", + "blob": "79af901c66becbb6ba3806b0e0ffaab67f80ac98", + "sha256": "b35256cf3d5fb287b6b1ca687c5653342c663b602be8c084d98aa0d23b650b39", + "bytes": 2833, + "role": "historical experimental source or platform metadata", + "url": "https://github.com/igna-s/New-1.58/blob/bc58efaa7ef00dc24f57ea7479415520fb92705f/eval/eval_dataset.py" + }, + { + "path": "eval/eval_external.py", + "original_commit": "f52f2dcae8ce0cd12e24f419a5545e15750b4f72", + "restored_commit": "bc58efaa7ef00dc24f57ea7479415520fb92705f", + "blob": "9ff235cf112dc841bbec4a38b150732fa476f932", + "sha256": "a3124d04de3f37e5e1a55048d1fab90bfc46e5242691a2961fa86dca74435937", + "bytes": 7135, + "role": "historical experimental source or platform metadata", + "url": "https://github.com/igna-s/New-1.58/blob/bc58efaa7ef00dc24f57ea7479415520fb92705f/eval/eval_external.py" + }, + { + "path": "eval/eval_performance.py", + "original_commit": "f52f2dcae8ce0cd12e24f419a5545e15750b4f72", + "restored_commit": "bc58efaa7ef00dc24f57ea7479415520fb92705f", + "blob": "2b3fd2f64d990109dd18f80fc0073adcc2d7fac6", + "sha256": "6b947294b8db56ec530685ff336bc12fb8ec4bdeaaae8d2ec7fa046d37fc8963", + "bytes": 8910, + "role": "historical experimental source or platform metadata", + "url": "https://github.com/igna-s/New-1.58/blob/bc58efaa7ef00dc24f57ea7479415520fb92705f/eval/eval_performance.py" + }, + { + "path": "eval/eval_quality.py", + "original_commit": "f52f2dcae8ce0cd12e24f419a5545e15750b4f72", + "restored_commit": "bc58efaa7ef00dc24f57ea7479415520fb92705f", + "blob": "d399f19f27dd2161cef35d4ab46a8b1a5fde9ac6", + "sha256": "1cc7d433daaf1dcefdb3acc688d1ffde166fd5ab3ab954c1ffbf523201931e40", + "bytes": 6223, + "role": "historical experimental source or platform metadata", + "url": "https://github.com/igna-s/New-1.58/blob/bc58efaa7ef00dc24f57ea7479415520fb92705f/eval/eval_quality.py" + }, + { + "path": "eval/run_all_models.py", + "original_commit": "1511b7505a3f18727afb09e6328bba26f4cb7491", + "restored_commit": "e824d641f804ee624b10bf09e8d5e95a64d953cf", + "blob": "766ccad0d282573cf7da6abadc8298c41f5e3727", + "sha256": "2c67fdff9980f7800fb2e28b1be332e0506c297ca809b063eed8bca7b06e8f3b", + "bytes": 7274, + "role": "historical experimental source or platform metadata", + "url": "https://github.com/igna-s/New-1.58/blob/e824d641f804ee624b10bf09e8d5e95a64d953cf/eval/run_all_models.py" + }, + { + "path": "eval/run_all_tests.py", + "original_commit": "799e54bc87b23710a8ffce921d38f776030b997b", + "restored_commit": "0c767db6aca778f9e2d5e87afa8c04698b7a0dcf", + "blob": "d486838110a6b410154b268b05fb3538e11b5aa0", + "sha256": "b194ea2bf7dd27de6e70bffd6743c440d3bc180309d0cd722d97a61d1fd6888c", + "bytes": 17061, + "role": "historical experimental source or platform metadata", + "url": "https://github.com/igna-s/New-1.58/blob/0c767db6aca778f9e2d5e87afa8c04698b7a0dcf/eval/run_all_tests.py" + }, + { + "path": "eval/run_eval.py", + "original_commit": "f52f2dcae8ce0cd12e24f419a5545e15750b4f72", + "restored_commit": "bc58efaa7ef00dc24f57ea7479415520fb92705f", + "blob": "91965e5cf6a96694df908b82052d3353b2da20f7", + "sha256": "63adb3240e2703d40df15eb209178b6fb9199b2b541e6fffed4be5107bd8ed39", + "bytes": 14000, + "role": "historical experimental source or platform metadata", + "url": "https://github.com/igna-s/New-1.58/blob/bc58efaa7ef00dc24f57ea7479415520fb92705f/eval/run_eval.py" + }, + { + "path": "eval/test_01_forward.py", + "original_commit": "799e54bc87b23710a8ffce921d38f776030b997b", + "restored_commit": "0c767db6aca778f9e2d5e87afa8c04698b7a0dcf", + "blob": "7fa3632c524f89b783703bb57c3cb103b929279d", + "sha256": "693dab65c50fe72155d7c18f1adfabc556b1807f1ca9295948b29192207eb076", + "bytes": 2256, + "role": "historical experimental source or platform metadata", + "url": "https://github.com/igna-s/New-1.58/blob/0c767db6aca778f9e2d5e87afa8c04698b7a0dcf/eval/test_01_forward.py" + }, + { + "path": "eval/test_02_probs.py", + "original_commit": "799e54bc87b23710a8ffce921d38f776030b997b", + "restored_commit": "0c767db6aca778f9e2d5e87afa8c04698b7a0dcf", + "blob": "07143f145d160f3cca583616e54d301a4fbf8ec0", + "sha256": "5236f07501288359bdedf8e2aada522a2f5834b100539b37da7545b14fab9fb4", + "bytes": 1018, + "role": "historical experimental source or platform metadata", + "url": "https://github.com/igna-s/New-1.58/blob/0c767db6aca778f9e2d5e87afa8c04698b7a0dcf/eval/test_02_probs.py" + }, + { + "path": "eval/test_03_determinism.py", + "original_commit": "799e54bc87b23710a8ffce921d38f776030b997b", + "restored_commit": "0c767db6aca778f9e2d5e87afa8c04698b7a0dcf", + "blob": "e89cde31ad90c8f9b9178ae833394d10408e7bb1", + "sha256": "d0092a147c8e0d01a882823edb594ae18898d9cbcb0a01e2aa6e6b36881b27af", + "bytes": 1035, + "role": "historical experimental source or platform metadata", + "url": "https://github.com/igna-s/New-1.58/blob/0c767db6aca778f9e2d5e87afa8c04698b7a0dcf/eval/test_03_determinism.py" + }, + { + "path": "eval/test_04_state_propagation.py", + "original_commit": "799e54bc87b23710a8ffce921d38f776030b997b", + "restored_commit": "0c767db6aca778f9e2d5e87afa8c04698b7a0dcf", + "blob": "cf01dd09ecf20e64b915198be15cfe16042fdf40", + "sha256": "30ba936a7fae21776453b5468de4cd13fc3aae81dad48c4d8cf2a85bb09db611", + "bytes": 1331, + "role": "historical experimental source or platform metadata", + "url": "https://github.com/igna-s/New-1.58/blob/0c767db6aca778f9e2d5e87afa8c04698b7a0dcf/eval/test_04_state_propagation.py" + }, + { + "path": "eval/test_05_ternary_weights.py", + "original_commit": "799e54bc87b23710a8ffce921d38f776030b997b", + "restored_commit": "0c767db6aca778f9e2d5e87afa8c04698b7a0dcf", + "blob": "acd26afe70f94c56724760aedf07077987e13654", + "sha256": "cb3cd978508edaaaa705a133f93e112fbd72e3a780b819df210b4dcb80d2c94f", + "bytes": 2011, + "role": "historical experimental source or platform metadata", + "url": "https://github.com/igna-s/New-1.58/blob/0c767db6aca778f9e2d5e87afa8c04698b7a0dcf/eval/test_05_ternary_weights.py" + }, + { + "path": "eval/test_06_cpu_throughput.py", + "original_commit": "799e54bc87b23710a8ffce921d38f776030b997b", + "restored_commit": "0c767db6aca778f9e2d5e87afa8c04698b7a0dcf", + "blob": "861873c5ada19c770ff613628c1e0d2fc06a0791", + "sha256": "daf876632c3fe85daa459e2186577c3c62302accae91dad0807cd3b4021e6948", + "bytes": 2116, + "role": "historical experimental source or platform metadata", + "url": "https://github.com/igna-s/New-1.58/blob/0c767db6aca778f9e2d5e87afa8c04698b7a0dcf/eval/test_06_cpu_throughput.py" + }, + { + "path": "eval/test_07_latency.py", + "original_commit": "799e54bc87b23710a8ffce921d38f776030b997b", + "restored_commit": "0c767db6aca778f9e2d5e87afa8c04698b7a0dcf", + "blob": "96d1c67beb7877741adc5181c9e210a79667a354", + "sha256": "763968c1e116c070a2fea31fac11c05f4b39eaca63a1ea0dc05e0c35249c1e4c", + "bytes": 1870, + "role": "historical experimental source or platform metadata", + "url": "https://github.com/igna-s/New-1.58/blob/0c767db6aca778f9e2d5e87afa8c04698b7a0dcf/eval/test_07_latency.py" + }, + { + "path": "eval/test_08_jitter.py", + "original_commit": "799e54bc87b23710a8ffce921d38f776030b997b", + "restored_commit": "0c767db6aca778f9e2d5e87afa8c04698b7a0dcf", + "blob": "10d2cbd9ee2aef5809d39c80e197985193665286", + "sha256": "30033592b7739a1d46f5b03d5ef22bf50bef53be914122e856ba5b336ee7cf0b", + "bytes": 1805, + "role": "historical experimental source or platform metadata", + "url": "https://github.com/igna-s/New-1.58/blob/0c767db6aca778f9e2d5e87afa8c04698b7a0dcf/eval/test_08_jitter.py" + }, + { + "path": "eval/test_09_context_scaling.py", + "original_commit": "799e54bc87b23710a8ffce921d38f776030b997b", + "restored_commit": "0c767db6aca778f9e2d5e87afa8c04698b7a0dcf", + "blob": "8e4615a0c13ab2eacb8eb3000ac7b9212045647d", + "sha256": "04f5f32c005f21b0e9c482578f9ec9715854767075425bab73c00d33fb53ed83", + "bytes": 2515, + "role": "historical experimental source or platform metadata", + "url": "https://github.com/igna-s/New-1.58/blob/0c767db6aca778f9e2d5e87afa8c04698b7a0dcf/eval/test_09_context_scaling.py" + }, + { + "path": "eval/test_10_ram_usage.py", + "original_commit": "799e54bc87b23710a8ffce921d38f776030b997b", + "restored_commit": "0c767db6aca778f9e2d5e87afa8c04698b7a0dcf", + "blob": "64d2e1a32d8ff073e178c6c1caad01dfa4c5c5f7", + "sha256": "d1ae844b0bcb2d4520639f599197ac9597507c5c137196fa9e90d574ecf3fd3a", + "bytes": 1378, + "role": "historical experimental source or platform metadata", + "url": "https://github.com/igna-s/New-1.58/blob/0c767db6aca778f9e2d5e87afa8c04698b7a0dcf/eval/test_10_ram_usage.py" + }, + { + "path": "eval/test_11_perplexity.py", + "original_commit": "799e54bc87b23710a8ffce921d38f776030b997b", + "restored_commit": "0c767db6aca778f9e2d5e87afa8c04698b7a0dcf", + "blob": "82dd34f92de04466b05ba76b73454800ee24a44d", + "sha256": "7dae2c70f0371034648170126c18f8f8ae4f19cc437ade7e25f676f4a9104119", + "bytes": 2650, + "role": "historical experimental source or platform metadata", + "url": "https://github.com/igna-s/New-1.58/blob/0c767db6aca778f9e2d5e87afa8c04698b7a0dcf/eval/test_11_perplexity.py" + }, + { + "path": "eval/test_12_generation_quality.py", + "original_commit": "799e54bc87b23710a8ffce921d38f776030b997b", + "restored_commit": "0c767db6aca778f9e2d5e87afa8c04698b7a0dcf", + "blob": "081fb0ab53811977e16b47df2cdec9fb454517be", + "sha256": "1c1b7dd2068e134e2ed9c7bba0f2dc160b03ab0135cc3287bc66ea10b0a65b77", + "bytes": 2182, + "role": "historical experimental source or platform metadata", + "url": "https://github.com/igna-s/New-1.58/blob/0c767db6aca778f9e2d5e87afa8c04698b7a0dcf/eval/test_12_generation_quality.py" + }, + { + "path": "eval/test_13_utf8_validity.py", + "original_commit": "799e54bc87b23710a8ffce921d38f776030b997b", + "restored_commit": "0c767db6aca778f9e2d5e87afa8c04698b7a0dcf", + "blob": "e1fab6c1d349ecc86367250c49fbe5b415c864cd", + "sha256": "3576b2baeeea81f115953eb13bdd299be387ef884f9139191b209477497806f0", + "bytes": 1369, + "role": "historical experimental source or platform metadata", + "url": "https://github.com/igna-s/New-1.58/blob/0c767db6aca778f9e2d5e87afa8c04698b7a0dcf/eval/test_13_utf8_validity.py" + }, + { + "path": "eval/test_14_training_convergence.py", + "original_commit": "799e54bc87b23710a8ffce921d38f776030b997b", + "restored_commit": "0c767db6aca778f9e2d5e87afa8c04698b7a0dcf", + "blob": "a5b6202680585f96b5d13e0c813e8c823e29f02a", + "sha256": "d370f3aa58cd8db035898e050427c9dafea385334255ed27ff63aaec0067c55a", + "bytes": 1868, + "role": "historical experimental source or platform metadata", + "url": "https://github.com/igna-s/New-1.58/blob/0c767db6aca778f9e2d5e87afa8c04698b7a0dcf/eval/test_14_training_convergence.py" + }, + { + "path": "eval/test_15_fpresidual_ablation.py", + "original_commit": "799e54bc87b23710a8ffce921d38f776030b997b", + "restored_commit": "0c767db6aca778f9e2d5e87afa8c04698b7a0dcf", + "blob": "bb6848beb08434b34ddb88045337f3c4c18fbc48", + "sha256": "b42434ff711e346bd84a4d25618c0024524fdd3588617cab1f88dfd03099402a", + "bytes": 3021, + "role": "historical experimental source or platform metadata", + "url": "https://github.com/igna-s/New-1.58/blob/0c767db6aca778f9e2d5e87afa8c04698b7a0dcf/eval/test_15_fpresidual_ablation.py" + }, + { + "path": "eval/test_16_mlgru_vs_transformer.py", + "original_commit": "799e54bc87b23710a8ffce921d38f776030b997b", + "restored_commit": "0c767db6aca778f9e2d5e87afa8c04698b7a0dcf", + "blob": "d9aea5cdbc63a2145589f4d91fb2f22d9fa3ebba", + "sha256": "3a780fd887f41f7199743b9b999601d53cc44808911e8558e959833d15837e49", + "bytes": 3186, + "role": "historical experimental source or platform metadata", + "url": "https://github.com/igna-s/New-1.58/blob/0c767db6aca778f9e2d5e87afa8c04698b7a0dcf/eval/test_16_mlgru_vs_transformer.py" + }, + { + "path": "eval/test_17_teacher_coverage.py", + "original_commit": "799e54bc87b23710a8ffce921d38f776030b997b", + "restored_commit": "0c767db6aca778f9e2d5e87afa8c04698b7a0dcf", + "blob": "51245fc77a75c743c83ac6468d776c2f200e301c", + "sha256": "4f1d5257d736b25ef0763f7542d6f6ddf8e6af2530ca39713b8b412fb4fd9312", + "bytes": 1622, + "role": "historical experimental source or platform metadata", + "url": "https://github.com/igna-s/New-1.58/blob/0c767db6aca778f9e2d5e87afa8c04698b7a0dcf/eval/test_17_teacher_coverage.py" + }, + { + "path": "eval/test_18_teacher_entropy.py", + "original_commit": "799e54bc87b23710a8ffce921d38f776030b997b", + "restored_commit": "0c767db6aca778f9e2d5e87afa8c04698b7a0dcf", + "blob": "3cbb851a796bf7d2fcdd4e2c62775158c3006390", + "sha256": "61d30629af679b1018db0972fe019a7c407d172ffb8d47a83947dcc67bac0028", + "bytes": 2114, + "role": "historical experimental source or platform metadata", + "url": "https://github.com/igna-s/New-1.58/blob/0c767db6aca778f9e2d5e87afa8c04698b7a0dcf/eval/test_18_teacher_entropy.py" + }, + { + "path": "eval/test_19_full_benchmark.py", + "original_commit": "799e54bc87b23710a8ffce921d38f776030b997b", + "restored_commit": "0c767db6aca778f9e2d5e87afa8c04698b7a0dcf", + "blob": "e9b970080e71b55ec206ff1711d589c5a72c5ca4", + "sha256": "6e11ff852c51f3718499dbb0f5f5ff9e81dcbf282b940233c68216e83067853a", + "bytes": 3929, + "role": "historical experimental source or platform metadata", + "url": "https://github.com/igna-s/New-1.58/blob/0c767db6aca778f9e2d5e87afa8c04698b7a0dcf/eval/test_19_full_benchmark.py" + }, + { + "path": "eval/test_20_scaling.py", + "original_commit": "799e54bc87b23710a8ffce921d38f776030b997b", + "restored_commit": "0c767db6aca778f9e2d5e87afa8c04698b7a0dcf", + "blob": "6c451d48cfd7059256d46ac3552827e076efc0d8", + "sha256": "6b3147deb855ced74eb196191125f9227d0e3adf5676572ad94f821221bb86a1", + "bytes": 2238, + "role": "historical experimental source or platform metadata", + "url": "https://github.com/igna-s/New-1.58/blob/0c767db6aca778f9e2d5e87afa8c04698b7a0dcf/eval/test_20_scaling.py" + }, + { + "path": "eval/test_21_mlgru_state_size.py", + "original_commit": "799e54bc87b23710a8ffce921d38f776030b997b", + "restored_commit": "0c767db6aca778f9e2d5e87afa8c04698b7a0dcf", + "blob": "2b3e972c1878a53b21bce014f266a5e32249a469", + "sha256": "64e8f4896382a3d1581d0b42f315de06f5e2b53d65b0b4951b7290a66826aa76", + "bytes": 1442, + "role": "historical experimental source or platform metadata", + "url": "https://github.com/igna-s/New-1.58/blob/0c767db6aca778f9e2d5e87afa8c04698b7a0dcf/eval/test_21_mlgru_state_size.py" + }, + { + "path": "eval/test_22_eval_cpu_raw.py", + "original_commit": "799e54bc87b23710a8ffce921d38f776030b997b", + "restored_commit": "0c767db6aca778f9e2d5e87afa8c04698b7a0dcf", + "blob": "89a368e3c557af81a761831990855082210f7655", + "sha256": "ed8c7c9af0fc5dfb510dc0f3a3dd3905f777051edbe5fde9484e5aba927afe60", + "bytes": 3185, + "role": "historical experimental source or platform metadata", + "url": "https://github.com/igna-s/New-1.58/blob/0c767db6aca778f9e2d5e87afa8c04698b7a0dcf/eval/test_22_eval_cpu_raw.py" + }, + { + "path": "eval/test_23_bpe_vs_bytebatch.py", + "original_commit": "799e54bc87b23710a8ffce921d38f776030b997b", + "restored_commit": "0c767db6aca778f9e2d5e87afa8c04698b7a0dcf", + "blob": "46f88276a21c8cb1a9f6ec371a5b3f2490c1cacf", + "sha256": "1bf921d98f9944a4f93e5779519a5647d60432457500118513c37c8b8a8c21d1", + "bytes": 4060, + "role": "historical experimental source or platform metadata", + "url": "https://github.com/igna-s/New-1.58/blob/0c767db6aca778f9e2d5e87afa8c04698b7a0dcf/eval/test_23_bpe_vs_bytebatch.py" + }, + { + "path": "eval/test_24_benchmark_external_hf.py", + "original_commit": "799e54bc87b23710a8ffce921d38f776030b997b", + "restored_commit": "0c767db6aca778f9e2d5e87afa8c04698b7a0dcf", + "blob": "93b559abd16d4be7022a279d2b6f6ee2073afcea", + "sha256": "253d61876ef0edaa30135ef8d46f9a9cdc7761a325f398186477e2639e97bb3c", + "bytes": 2553, + "role": "historical experimental source or platform metadata", + "url": "https://github.com/igna-s/New-1.58/blob/0c767db6aca778f9e2d5e87afa8c04698b7a0dcf/eval/test_24_benchmark_external_hf.py" + }, + { + "path": "eval/test_25_benchmark_external_optimized.py", + "original_commit": "799e54bc87b23710a8ffce921d38f776030b997b", + "restored_commit": "0c767db6aca778f9e2d5e87afa8c04698b7a0dcf", + "blob": "f94ccc0df9979d50007071c60959e2460aaa650d", + "sha256": "3d7f4c92b8cd0b6b1c0ed7256277e495342f5aa57ea3eb4651c19e94b280a8df", + "bytes": 3244, + "role": "historical experimental source or platform metadata", + "url": "https://github.com/igna-s/New-1.58/blob/0c767db6aca778f9e2d5e87afa8c04698b7a0dcf/eval/test_25_benchmark_external_optimized.py" + }, + { + "path": "eval/test_26_benchmark_llama_cpp.py", + "original_commit": "799e54bc87b23710a8ffce921d38f776030b997b", + "restored_commit": "0c767db6aca778f9e2d5e87afa8c04698b7a0dcf", + "blob": "51ca10725adfd3d14fa7b58ad60c82253c4a51d6", + "sha256": "9e1a5689600f2b5e56c9613c359f18dfd272daaefd75007ca426c504f716be63", + "bytes": 13332, + "role": "historical experimental source or platform metadata", + "url": "https://github.com/igna-s/New-1.58/blob/0c767db6aca778f9e2d5e87afa8c04698b7a0dcf/eval/test_26_benchmark_llama_cpp.py" + }, + { + "path": "eval/verify_all.py", + "original_commit": "799e54bc87b23710a8ffce921d38f776030b997b", + "restored_commit": "0c767db6aca778f9e2d5e87afa8c04698b7a0dcf", + "blob": "ba932688b6469e900daf89f78056b109ef60b8ca", + "sha256": "e7175253c487ac4242086b7b644e4c02503155aee61d2a1a53a814de5ff7f797", + "bytes": 8994, + "role": "historical experimental source or platform metadata", + "url": "https://github.com/igna-s/New-1.58/blob/0c767db6aca778f9e2d5e87afa8c04698b7a0dcf/eval/verify_all.py" + }, + { + "path": "extract_logprobs.py", + "original_commit": "eb9cb8db2ad5b81a35f73b3cf62b7d715732f79e", + "restored_commit": "e67c48eb14ca89cac4ae63e02e706a71ddf8f197", + "blob": "9695ba40fbba18f62bac5310df8b1eac87eb7b7b", + "sha256": "0f7c7a6403604f056442acbbbae2fe3fcb656775c4b048269af2712c4e5d8e48", + "bytes": 33417, + "role": "historical experimental source or platform metadata", + "url": "https://github.com/igna-s/New-1.58/blob/e67c48eb14ca89cac4ae63e02e706a71ddf8f197/extract_logprobs.py" + }, + { + "path": "inference.py", + "original_commit": "6f97ebd101644dddab57d201b8f303518baf2d09", + "restored_commit": "dcafa9518e2097bd9eda756558e4085fd778c1cf", + "blob": "eaa67e9baf0b3968be4180a1b80a7cf5f2c52d0e", + "sha256": "cb3935860f6b756621144ffda1d0554dffd90e0fcddfcd08b2e7ec5ceee70b2b", + "bytes": 78300, + "role": "historical experimental source or platform metadata", + "url": "https://github.com/igna-s/New-1.58/blob/dcafa9518e2097bd9eda756558e4085fd778c1cf/inference.py" + }, + { + "path": "inference/__init__.py", + "original_commit": "b3c8dca5bdacefd51549cb28cbd55983a4fa299e", + "restored_commit": "2dac01dda30d0ef734016af2303c819438ed04f1", + "blob": "d9fbbec19a7bda324b6eea03aca069433d167192", + "sha256": "4da5175f865becea9a5fe380e1ed394592946cc358e5794282f07181cbee4800", + "bytes": 25, + "role": "historical experimental source or platform metadata", + "url": "https://github.com/igna-s/New-1.58/blob/2dac01dda30d0ef734016af2303c819438ed04f1/inference/__init__.py" + }, + { + "path": "inference/bench_quick.py", + "original_commit": "7c7375fecaaf0c3fff0d29ee565f9a85a9a155b4", + "restored_commit": "3d8a93b36051cb68ba955ed61b9153a7a7ffa4bc", + "blob": "bd6881f661c5d9c446be521349f864505bb4d86b", + "sha256": "a6eebcf0e4182f0d9bae27cba5df9803a2e3934771575ca87853da1ee26ca651", + "bytes": 1293, + "role": "historical experimental source or platform metadata", + "url": "https://github.com/igna-s/New-1.58/blob/3d8a93b36051cb68ba955ed61b9153a7a7ffa4bc/inference/bench_quick.py" + }, + { + "path": "inference/benchmark.py", + "original_commit": "b3c8dca5bdacefd51549cb28cbd55983a4fa299e", + "restored_commit": "2dac01dda30d0ef734016af2303c819438ed04f1", + "blob": "d5437ad8a25d5ab670d3a23367db5d5c069124cf", + "sha256": "184010f72a86cc434282357d99f3a9afd32cf1b2333ca79f4263ebe362a76344", + "bytes": 12354, + "role": "historical experimental source or platform metadata", + "url": "https://github.com/igna-s/New-1.58/blob/2dac01dda30d0ef734016af2303c819438ed04f1/inference/benchmark.py" + }, + { + "path": "inference/benchmark_d57b379.c", + "original_commit": "55b47609edb849884daabddcdd57c3806e3904df", + "restored_commit": "3c1aa50a15ee6fcd8a8c90b728da6db0c6836561", + "blob": "1fc63bfc14452d6d5b4f26fd4568bff3bc1a141f", + "sha256": "e16b2344a61b86d16154075d9a4a1cb83247a008649eb131c7615cdd5f39c6fc", + "bytes": 15726, + "role": "historical experimental source or platform metadata", + "url": "https://github.com/igna-s/New-1.58/blob/3c1aa50a15ee6fcd8a8c90b728da6db0c6836561/inference/benchmark_d57b379.c" + }, + { + "path": "inference/benchmark_packed.py", + "original_commit": "b28227379a0d8ac1bc2bd61318b3f8cffeecb8f1", + "restored_commit": "11aab006418ba63a56d44473ba20b75677874815", + "blob": "2050e7a0224c06047d2ef5737bd24604b4df2bef", + "sha256": "4e13dfeeb7e28ee4516399dc782229ac16987e843140b16dae346ec21b6ffb44", + "bytes": 10501, + "role": "historical experimental source or platform metadata", + "url": "https://github.com/igna-s/New-1.58/blob/11aab006418ba63a56d44473ba20b75677874815/inference/benchmark_packed.py" + }, + { + "path": "inference/benchmark_quick.py", + "original_commit": "b28227379a0d8ac1bc2bd61318b3f8cffeecb8f1", + "restored_commit": "11aab006418ba63a56d44473ba20b75677874815", + "blob": "34355ae33ab1a24d36b5491ef4a1856f9454a041", + "sha256": "f140b3e137c867f4f9b845f99ca3361fe69b0b197742e870af93bed470909608", + "bytes": 4539, + "role": "historical experimental source or platform metadata", + "url": "https://github.com/igna-s/New-1.58/blob/11aab006418ba63a56d44473ba20b75677874815/inference/benchmark_quick.py" + }, + { + "path": "inference/inference.py", + "original_commit": "b3c8dca5bdacefd51549cb28cbd55983a4fa299e", + "restored_commit": "2dac01dda30d0ef734016af2303c819438ed04f1", + "blob": "2258df6b5c88cd137499ffd273afc8741ab4805c", + "sha256": "eabe94fe3e5c5e4c26f53ff2dbb57e562a50fc190e9ec052e5aa0066c2c3e994", + "bytes": 127131, + "role": "historical experimental source or platform metadata", + "url": "https://github.com/igna-s/New-1.58/blob/2dac01dda30d0ef734016af2303c819438ed04f1/inference/inference.py" + }, + { + "path": "inference/kernels_d57b379.cpp", + "original_commit": "55b47609edb849884daabddcdd57c3806e3904df", + "restored_commit": "3c1aa50a15ee6fcd8a8c90b728da6db0c6836561", + "blob": "4748545e9d4b15fe9f226c44876807ff77c7a872", + "sha256": "b4ff4ff81e43b1e30b0b88e170028642d08759133223a35abd936be925b9a740", + "bytes": 98863, + "role": "historical experimental source or platform metadata", + "url": "https://github.com/igna-s/New-1.58/blob/3c1aa50a15ee6fcd8a8c90b728da6db0c6836561/inference/kernels_d57b379.cpp" + }, + { + "path": "inference_hf.py", + "original_commit": "5e6b1bcd685820cc3e4f00aae25565f904d9f17b", + "restored_commit": "c21f2e41a90875be2736f7f54c58a28cf48db205", + "blob": "94669b4f83a7ba756ca51779340b0346502e3bc7", + "sha256": "09fa567b24cc391dbbbfaa07554d8b9800d4ac226e147a48b7ae14c6fcbdcc00", + "bytes": 347, + "role": "historical experimental source or platform metadata", + "url": "https://github.com/igna-s/New-1.58/blob/c21f2e41a90875be2736f7f54c58a28cf48db205/inference_hf.py" + }, + { + "path": "inference_tmac.py", + "original_commit": "ac4ae35ad899c4767cedae14b907c8153edb0a4b", + "restored_commit": "828b42dd133c868051579846a1626d5f794fbee3", + "blob": "b195915b06cc856011b3c37dcc263ae57a57a6b0", + "sha256": "9c2b594a2fe2a69a5627a834c121f098267c8cc8d2dda408a6f578115af77ec1", + "bytes": 29893, + "role": "historical experimental source or platform metadata", + "url": "https://github.com/igna-s/New-1.58/blob/828b42dd133c868051579846a1626d5f794fbee3/inference_tmac.py" + }, + { + "path": "inference_v2.py", + "original_commit": "ac4ae35ad899c4767cedae14b907c8153edb0a4b", + "restored_commit": "828b42dd133c868051579846a1626d5f794fbee3", + "blob": "f094f76cf5a0b53cff16b63a20a2b27bc44895ec", + "sha256": "33cf33a0e44f161836fb304b4f5f0168c1bd0df4b4b7c4aabc637abd93a0a498", + "bytes": 31331, + "role": "historical experimental source or platform metadata", + "url": "https://github.com/igna-s/New-1.58/blob/828b42dd133c868051579846a1626d5f794fbee3/inference_v2.py" + }, + { + "path": "kaggle/cpu1-create-dataset.py", + "original_commit": "f52f2dcae8ce0cd12e24f419a5545e15750b4f72", + "restored_commit": "bc58efaa7ef00dc24f57ea7479415520fb92705f", + "blob": "a3f2c8fa256113e371b1fa11b1e4233e5c5d11be", + "sha256": "b3e6d1bad28015941453ff96407e1a6e215e53fc3a0a59888625af8ce7b72cb1", + "bytes": 3979, + "role": "historical experimental source or platform metadata", + "url": "https://github.com/igna-s/New-1.58/blob/bc58efaa7ef00dc24f57ea7479415520fb92705f/kaggle/cpu1-create-dataset.py" + }, + { + "path": "kaggle/cpu1-run-all.py", + "original_commit": "24e2c3994e33c53e85c895822ae7f63273602f1e", + "restored_commit": "3bca583aee4b013037e62d57a2973eb760496d85", + "blob": "fb60b26fce60d764e207a88ea7ce3a2aa9dcbaac", + "sha256": "bc36b1b7f4f29d5cf863f648ed8785502df070a2e8cff47a368ed85f25afd570", + "bytes": 4740, + "role": "historical experimental source or platform metadata", + "url": "https://github.com/igna-s/New-1.58/blob/3bca583aee4b013037e62d57a2973eb760496d85/kaggle/cpu1-run-all.py" + }, + { + "path": "kaggle/cpu1-training.py", + "original_commit": "24e2c3994e33c53e85c895822ae7f63273602f1e", + "restored_commit": "3bca583aee4b013037e62d57a2973eb760496d85", + "blob": "db34b6ecd2b9d693eaaeeeea3a4e061deb8474f9", + "sha256": "72890a292a78f323f3cc471af591f977443487b6060d2ec31531cf3453c39d1d", + "bytes": 2343, + "role": "historical experimental source or platform metadata", + "url": "https://github.com/igna-s/New-1.58/blob/3bca583aee4b013037e62d57a2973eb760496d85/kaggle/cpu1-training.py" + }, + { + "path": "kaggle/create-dataset-metadata.json", + "original_commit": "f52f2dcae8ce0cd12e24f419a5545e15750b4f72", + "restored_commit": "bc58efaa7ef00dc24f57ea7479415520fb92705f", + "blob": "870f3ee2875450d1f4e1dacd977f11dd5f654f74", + "sha256": "4d552555c7d06eaf6c74d732b4c3e6dcb797a49ccecbd61de77d25e6095950e5", + "bytes": 471, + "role": "historical experimental source or platform metadata", + "url": "https://github.com/igna-s/New-1.58/blob/bc58efaa7ef00dc24f57ea7479415520fb92705f/kaggle/create-dataset-metadata.json" + }, + { + "path": "kaggle/generate_notebook.py", + "original_commit": "f02684d5c2d4828f97b4e79b5a26f4eb172b6950", + "restored_commit": "8cf94406de7efe8ec754edcea34362b4091d77e5", + "blob": "72a94aabac94f5082f67e8044441eb3837d3d634", + "sha256": "37fe9371e5d1abd7aa095cf978b0efc77aace5f3ad31e5f156afc92a40dea93a", + "bytes": 8309, + "role": "historical experimental source or platform metadata", + "url": "https://github.com/igna-s/New-1.58/blob/8cf94406de7efe8ec754edcea34362b4091d77e5/kaggle/generate_notebook.py" + }, + { + "path": "kaggle/kernel-metadata.json", + "original_commit": "24e2c3994e33c53e85c895822ae7f63273602f1e", + "restored_commit": "3bca583aee4b013037e62d57a2973eb760496d85", + "blob": "870f3ee2875450d1f4e1dacd977f11dd5f654f74", + "sha256": "4d552555c7d06eaf6c74d732b4c3e6dcb797a49ccecbd61de77d25e6095950e5", + "bytes": 471, + "role": "historical experimental source or platform metadata", + "url": "https://github.com/igna-s/New-1.58/blob/3bca583aee4b013037e62d57a2973eb760496d85/kaggle/kernel-metadata.json" + }, + { + "path": "kaggle/model_v2.py", + "original_commit": "f02684d5c2d4828f97b4e79b5a26f4eb172b6950", + "restored_commit": "8cf94406de7efe8ec754edcea34362b4091d77e5", + "blob": "65f22e8c08211e810fffb82e38a93c3a1292500e", + "sha256": "bed3f27f49124c01943c9bb4e341ff0d3c0d7cd0c4dd568daa5303d9b241e89d", + "bytes": 40923, + "role": "historical experimental source or platform metadata", + "url": "https://github.com/igna-s/New-1.58/blob/8cf94406de7efe8ec754edcea34362b4091d77e5/kaggle/model_v2.py" + }, + { + "path": "kaggle/train.py", + "original_commit": "f02684d5c2d4828f97b4e79b5a26f4eb172b6950", + "restored_commit": "8cf94406de7efe8ec754edcea34362b4091d77e5", + "blob": "2102a3bd8646783da4e9cd1674e7f74dc4585403", + "sha256": "c9647acf33bccd1a88dae08f02f7f96b7045cfeb9f330eb7a6e5c372d9fe0bb9", + "bytes": 33310, + "role": "historical experimental source or platform metadata", + "url": "https://github.com/igna-s/New-1.58/blob/8cf94406de7efe8ec754edcea34362b4091d77e5/kaggle/train.py" + }, + { + "path": "kaggle/train_kaggle.ipynb", + "original_commit": "f02684d5c2d4828f97b4e79b5a26f4eb172b6950", + "restored_commit": "8cf94406de7efe8ec754edcea34362b4091d77e5", + "blob": "caf6ef80398ca9402c275b6ec65b57c1f4c338d0", + "sha256": "31fc52fe2b507433481ee338c0c54283707503e73844d55cc3d6edf4bc340441", + "bytes": 101451, + "role": "historical experimental source or platform metadata", + "url": "https://github.com/igna-s/New-1.58/blob/8cf94406de7efe8ec754edcea34362b4091d77e5/kaggle/train_kaggle.ipynb" + }, + { + "path": "kaggle/training-metadata.json", + "original_commit": "24e2c3994e33c53e85c895822ae7f63273602f1e", + "restored_commit": "3bca583aee4b013037e62d57a2973eb760496d85", + "blob": "353073953a4d8beba00dab4a5c801233d7f0fe71", + "sha256": "ff05b1d0c3193116fc3ef00f1f3b8c6babf533e4d81f27deb43ec086d96e0303", + "bytes": 453, + "role": "historical experimental source or platform metadata", + "url": "https://github.com/igna-s/New-1.58/blob/3bca583aee4b013037e62d57a2973eb760496d85/kaggle/training-metadata.json" + }, + { + "path": "kaggle/upload_dataset.py", + "original_commit": "f52f2dcae8ce0cd12e24f419a5545e15750b4f72", + "restored_commit": "bc58efaa7ef00dc24f57ea7479415520fb92705f", + "blob": "e2f1c42534bf83d1baf244e8a7395f96991ac228", + "sha256": "0244ed0b98b8101b7fba4c536756b9909c8154b5df5e90d9c5d9e6434dabcb99", + "bytes": 1245, + "role": "historical experimental source or platform metadata", + "url": "https://github.com/igna-s/New-1.58/blob/bc58efaa7ef00dc24f57ea7479415520fb92705f/kaggle/upload_dataset.py" + }, + { + "path": "kaggle_output/model_v2.py", + "original_commit": "f02684d5c2d4828f97b4e79b5a26f4eb172b6950", + "restored_commit": "8cf94406de7efe8ec754edcea34362b4091d77e5", + "blob": "65f22e8c08211e810fffb82e38a93c3a1292500e", + "sha256": "bed3f27f49124c01943c9bb4e341ff0d3c0d7cd0c4dd568daa5303d9b241e89d", + "bytes": 40923, + "role": "historical experimental source or platform metadata", + "url": "https://github.com/igna-s/New-1.58/blob/8cf94406de7efe8ec754edcea34362b4091d77e5/kaggle_output/model_v2.py" + }, + { + "path": "kaggle_output/train.py", + "original_commit": "f02684d5c2d4828f97b4e79b5a26f4eb172b6950", + "restored_commit": "8cf94406de7efe8ec754edcea34362b4091d77e5", + "blob": "2102a3bd8646783da4e9cd1674e7f74dc4585403", + "sha256": "c9647acf33bccd1a88dae08f02f7f96b7045cfeb9f330eb7a6e5c372d9fe0bb9", + "bytes": 33310, + "role": "historical experimental source or platform metadata", + "url": "https://github.com/igna-s/New-1.58/blob/8cf94406de7efe8ec754edcea34362b4091d77e5/kaggle_output/train.py" + }, + { + "path": "kaggle_pull/cpu1-training.ipynb", + "original_commit": "f02684d5c2d4828f97b4e79b5a26f4eb172b6950", + "restored_commit": "8cf94406de7efe8ec754edcea34362b4091d77e5", + "blob": "f625d412507619dbd0e9849288714bb59b1fcb6e", + "sha256": "81b9fac1f7f015abcd7a7c4aef1fe77d29cbff47a3204e69c16df1ce521e3efe", + "bytes": 5108, + "role": "historical experimental source or platform metadata", + "url": "https://github.com/igna-s/New-1.58/blob/8cf94406de7efe8ec754edcea34362b4091d77e5/kaggle_pull/cpu1-training.ipynb" + }, + { + "path": "kaggle_pull/kernel-metadata.json", + "original_commit": "f02684d5c2d4828f97b4e79b5a26f4eb172b6950", + "restored_commit": "8cf94406de7efe8ec754edcea34362b4091d77e5", + "blob": "5f4e786e4d3d5524f220c743f822f72725de0bde", + "sha256": "7ce9072fab43a4eef207bbf36cdb4b763928a1fe4a0629a315a7ed9f770982dc", + "bytes": 555, + "role": "historical experimental source or platform metadata", + "url": "https://github.com/igna-s/New-1.58/blob/8cf94406de7efe8ec754edcea34362b4091d77e5/kaggle_pull/kernel-metadata.json" + }, + { + "path": "kaggle_pull2/cpu1-training.ipynb", + "original_commit": "f02684d5c2d4828f97b4e79b5a26f4eb172b6950", + "restored_commit": "8cf94406de7efe8ec754edcea34362b4091d77e5", + "blob": "f8098447db5852e2f11e8faf5ece1321b02c8a48", + "sha256": "2412c83f366929c9361a3d0efd0f793da8b3a9b4ce012da471ca5fc266fcb683", + "bytes": 83439, + "role": "historical experimental source or platform metadata", + "url": "https://github.com/igna-s/New-1.58/blob/8cf94406de7efe8ec754edcea34362b4091d77e5/kaggle_pull2/cpu1-training.ipynb" + }, + { + "path": "kaggle_pull2/kernel-metadata.json", + "original_commit": "f02684d5c2d4828f97b4e79b5a26f4eb172b6950", + "restored_commit": "8cf94406de7efe8ec754edcea34362b4091d77e5", + "blob": "5f4e786e4d3d5524f220c743f822f72725de0bde", + "sha256": "7ce9072fab43a4eef207bbf36cdb4b763928a1fe4a0629a315a7ed9f770982dc", + "bytes": 555, + "role": "historical experimental source or platform metadata", + "url": "https://github.com/igna-s/New-1.58/blob/8cf94406de7efe8ec754edcea34362b4091d77e5/kaggle_pull2/kernel-metadata.json" + }, + { + "path": "lightning/cpu1-create-dataset.py", + "original_commit": "7c7375fecaaf0c3fff0d29ee565f9a85a9a155b4", + "restored_commit": "3d8a93b36051cb68ba955ed61b9153a7a7ffa4bc", + "blob": "2be2e7ba57b3f25227bb5b1317dc39681b0aacb3", + "sha256": "9e4b2ac94676d20f5eb39fa3c52092edbd41c783eca3a3963acec542733ecb36", + "bytes": 2809, + "role": "historical experimental source or platform metadata", + "url": "https://github.com/igna-s/New-1.58/blob/3d8a93b36051cb68ba955ed61b9153a7a7ffa4bc/lightning/cpu1-create-dataset.py" + }, + { + "path": "lightning/submit.py", + "original_commit": "7c7375fecaaf0c3fff0d29ee565f9a85a9a155b4", + "restored_commit": "3d8a93b36051cb68ba955ed61b9153a7a7ffa4bc", + "blob": "c058b5e8ef456315099febd1c25c06753f6e1f77", + "sha256": "90c1850dc6811f8f1ffcf5efced7ef149e02cb022400d9bfab803bd7eb8a7bc9", + "bytes": 2558, + "role": "historical experimental source or platform metadata", + "url": "https://github.com/igna-s/New-1.58/blob/3d8a93b36051cb68ba955ed61b9153a7a7ffa4bc/lightning/submit.py" + }, + { + "path": "lightning/train_ablation_submit.py", + "original_commit": "7c7375fecaaf0c3fff0d29ee565f9a85a9a155b4", + "restored_commit": "3d8a93b36051cb68ba955ed61b9153a7a7ffa4bc", + "blob": "c0c313e24af03f7ed7976041d1b50eede6147355", + "sha256": "8e29342f25200942188347a795d363801149b98822f1144d0dec252a7fd6b241", + "bytes": 4524, + "role": "historical experimental source or platform metadata", + "url": "https://github.com/igna-s/New-1.58/blob/3d8a93b36051cb68ba955ed61b9153a7a7ffa4bc/lightning/train_ablation_submit.py" + }, + { + "path": "lightning/upload_and_run.py", + "original_commit": "7c7375fecaaf0c3fff0d29ee565f9a85a9a155b4", + "restored_commit": "3d8a93b36051cb68ba955ed61b9153a7a7ffa4bc", + "blob": "f54d2071eaa1f5f9372f9b6517d347664acff8e4", + "sha256": "0cd47b29cdd8f29cf96ec0f1a0158488059d47317db1f363d0fe44e74080f589", + "bytes": 2841, + "role": "historical experimental source or platform metadata", + "url": "https://github.com/igna-s/New-1.58/blob/3d8a93b36051cb68ba955ed61b9153a7a7ffa4bc/lightning/upload_and_run.py" + }, + { + "path": "load_lfm_model.py", + "original_commit": "799e54bc87b23710a8ffce921d38f776030b997b", + "restored_commit": "0c767db6aca778f9e2d5e87afa8c04698b7a0dcf", + "blob": "1bef7397690d401eb9c083c05d85fa8a5a266c2f", + "sha256": "28abf31f1a2661a2dd8d0c1f62b0f84918a58522c87aab6ce4c6c004c819d7fa", + "bytes": 1084, + "role": "historical experimental source or platform metadata", + "url": "https://github.com/igna-s/New-1.58/blob/0c767db6aca778f9e2d5e87afa8c04698b7a0dcf/load_lfm_model.py" + }, + { + "path": "main.py", + "original_commit": "f52f2dcae8ce0cd12e24f419a5545e15750b4f72", + "restored_commit": "bc58efaa7ef00dc24f57ea7479415520fb92705f", + "blob": "de8a4b6c32c00536f4d6e343f9ea7926563dc458", + "sha256": "10f3275780dab7ce70fca52cf847a73d90149b15797578ae03dc56408e747319", + "bytes": 5086, + "role": "historical experimental source or platform metadata", + "url": "https://github.com/igna-s/New-1.58/blob/bc58efaa7ef00dc24f57ea7479415520fb92705f/main.py" + }, + { + "path": "main_ligtning_studio.py", + "original_commit": "c2fb5d37a3b6c0906abbfb2480202055aaee8c86", + "restored_commit": "a90ec3e01ad30b0e1701dff1dd60bae655708bf1", + "blob": "dc764ebcc4d31945837e9bfc95e4888a4de3da38", + "sha256": "dee4c82b7c6f3ad7e81bce2de80aa91a36a50a19bb7d6ab304d296446641dfe3", + "bytes": 6912, + "role": "historical experimental source or platform metadata", + "url": "https://github.com/igna-s/New-1.58/blob/a90ec3e01ad30b0e1701dff1dd60bae655708bf1/main_ligtning_studio.py" + }, + { + "path": "model.py", + "original_commit": "c2fb5d37a3b6c0906abbfb2480202055aaee8c86", + "restored_commit": "a90ec3e01ad30b0e1701dff1dd60bae655708bf1", + "blob": "819d4564b3af170f34e150f8432760ccafd66e39", + "sha256": "00eee49117c26990e1ec97f384fa3bce83219b0396e0e5138e4b0bb5fc133a54", + "bytes": 80051, + "role": "historical experimental source or platform metadata", + "url": "https://github.com/igna-s/New-1.58/blob/a90ec3e01ad30b0e1701dff1dd60bae655708bf1/model.py" + }, + { + "path": "model_v2.py", + "original_commit": "ac4ae35ad899c4767cedae14b907c8153edb0a4b", + "restored_commit": "828b42dd133c868051579846a1626d5f794fbee3", + "blob": "319b3c5b9dc5d8f7d00b09c731f3d1476f8937a9", + "sha256": "331c54c96fe2ab8eaab961132fb1028a4790f5b1648e9fbaed74203f0198e23a", + "bytes": 63147, + "role": "historical experimental source or platform metadata", + "url": "https://github.com/igna-s/New-1.58/blob/828b42dd133c868051579846a1626d5f794fbee3/model_v2.py" + }, + { + "path": "models/ablation_models/__init__.py", + "original_commit": "a2f4a65655030c4df3a9a1fc2e83c9afa5216bb5", + "restored_commit": "996ae7d0e2b4894107593c331e2d4abd6260c9d0", + "blob": "29fc2a1a904e88742f177775b8059d46260243e2", + "sha256": "4662eea05b1c4d1a3814c2220af83411f79c2577b16dd1422b070aab7015f8c3", + "bytes": 2018, + "role": "historical experimental source or platform metadata", + "url": "https://github.com/igna-s/New-1.58/blob/996ae7d0e2b4894107593c331e2d4abd6260c9d0/models/ablation_models/__init__.py" + }, + { + "path": "models/ablation_models/run_01_transformer_bpe_fp16.py", + "original_commit": "c2fb5d37a3b6c0906abbfb2480202055aaee8c86", + "restored_commit": "a90ec3e01ad30b0e1701dff1dd60bae655708bf1", + "blob": "c3764bccdd57e061be77979fa67b066febdc1362", + "sha256": "0fd55b6decbdcf2c09ec1147d2917dbc79cfe5c754507977da830a5e18bbf795", + "bytes": 2348, + "role": "historical experimental source or platform metadata", + "url": "https://github.com/igna-s/New-1.58/blob/a90ec3e01ad30b0e1701dff1dd60bae655708bf1/models/ablation_models/run_01_transformer_bpe_fp16.py" + }, + { + "path": "models/ablation_models/run_02_transformer_byte_fp16.py", + "original_commit": "c2fb5d37a3b6c0906abbfb2480202055aaee8c86", + "restored_commit": "a90ec3e01ad30b0e1701dff1dd60bae655708bf1", + "blob": "454dd189de24b2fb9a07295a63ee92afd0a08277", + "sha256": "b9aa8623e10c27e96edc5fa56977ebd7655cecf65278feaa50008e02924bae37", + "bytes": 2349, + "role": "historical experimental source or platform metadata", + "url": "https://github.com/igna-s/New-1.58/blob/a90ec3e01ad30b0e1701dff1dd60bae655708bf1/models/ablation_models/run_02_transformer_byte_fp16.py" + }, + { + "path": "models/ablation_models/run_03_mlgru_bpe_fp16.py", + "original_commit": "c2fb5d37a3b6c0906abbfb2480202055aaee8c86", + "restored_commit": "a90ec3e01ad30b0e1701dff1dd60bae655708bf1", + "blob": "417fba6040c55d8cba26c2a4e95d4e43a009699e", + "sha256": "abd893082a9b2492f47c185f7d1cd9373349c057fc7a49f4f26a41b7a838a871", + "bytes": 2544, + "role": "historical experimental source or platform metadata", + "url": "https://github.com/igna-s/New-1.58/blob/a90ec3e01ad30b0e1701dff1dd60bae655708bf1/models/ablation_models/run_03_mlgru_bpe_fp16.py" + }, + { + "path": "models/ablation_models/run_04_mlgru_byte_fp16.py", + "original_commit": "c2fb5d37a3b6c0906abbfb2480202055aaee8c86", + "restored_commit": "a90ec3e01ad30b0e1701dff1dd60bae655708bf1", + "blob": "7a482622ca9cd0fbb4171ccfb6ef05758116dd28", + "sha256": "36a9b4903c4af4bd0bb4836d2ece77858f70992ed7152ccce595e976acb2a45d", + "bytes": 2196, + "role": "historical experimental source or platform metadata", + "url": "https://github.com/igna-s/New-1.58/blob/a90ec3e01ad30b0e1701dff1dd60bae655708bf1/models/ablation_models/run_04_mlgru_byte_fp16.py" + }, + { + "path": "models/ablation_models/run_05_mlgru_byte_ternary.py", + "original_commit": "c2fb5d37a3b6c0906abbfb2480202055aaee8c86", + "restored_commit": "a90ec3e01ad30b0e1701dff1dd60bae655708bf1", + "blob": "984bd669ad0f8f71e8bfad9e08a3f2e45b810600", + "sha256": "a262a28a1efa78cde540ec8766c9c52eed93aedcf4dcf573e9bd4077630c4ebc", + "bytes": 2777, + "role": "historical experimental source or platform metadata", + "url": "https://github.com/igna-s/New-1.58/blob/a90ec3e01ad30b0e1701dff1dd60bae655708bf1/models/ablation_models/run_05_mlgru_byte_ternary.py" + }, + { + "path": "models/ablation_models/run_06_cpu1_core.py", + "original_commit": "c2fb5d37a3b6c0906abbfb2480202055aaee8c86", + "restored_commit": "a90ec3e01ad30b0e1701dff1dd60bae655708bf1", + "blob": "d2fe8ffb3399ca81ab064b1a116da936cbabad43", + "sha256": "d54199e6e917c195b8167c17fdae993aebb0bea878a67afc9dbcb33f4c2e523a", + "bytes": 2963, + "role": "historical experimental source or platform metadata", + "url": "https://github.com/igna-s/New-1.58/blob/a90ec3e01ad30b0e1701dff1dd60bae655708bf1/models/ablation_models/run_06_cpu1_core.py" + }, + { + "path": "models/ablation_models/run_07_cpu1_bolmo.py", + "original_commit": "c2fb5d37a3b6c0906abbfb2480202055aaee8c86", + "restored_commit": "a90ec3e01ad30b0e1701dff1dd60bae655708bf1", + "blob": "4d5ff0a8389609af8e22827b95bcb0e00e15487f", + "sha256": "f27c609055ebcf1fe56ca5411fdc76a2d66ef4f4f04ff34957ee47e764b76783", + "bytes": 3167, + "role": "historical experimental source or platform metadata", + "url": "https://github.com/igna-s/New-1.58/blob/a90ec3e01ad30b0e1701dff1dd60bae655708bf1/models/ablation_models/run_07_cpu1_bolmo.py" + }, + { + "path": "models/ablation_models/run_08_cpu1_deletegate.py", + "original_commit": "c2fb5d37a3b6c0906abbfb2480202055aaee8c86", + "restored_commit": "a90ec3e01ad30b0e1701dff1dd60bae655708bf1", + "blob": "c0376a0167839d7eceeba20fbc9d06d2306acd15", + "sha256": "35281437fe341f8574fbf1b5ffb1a91c8d40fac2729889ee84fcd9fe1d011f7a", + "bytes": 3299, + "role": "historical experimental source or platform metadata", + "url": "https://github.com/igna-s/New-1.58/blob/a90ec3e01ad30b0e1701dff1dd60bae655708bf1/models/ablation_models/run_08_cpu1_deletegate.py" + }, + { + "path": "models/ablation_models/run_09_folded_transformer.py", + "original_commit": "c2fb5d37a3b6c0906abbfb2480202055aaee8c86", + "restored_commit": "a90ec3e01ad30b0e1701dff1dd60bae655708bf1", + "blob": "d3d70a713df2acb5a4c6e2330127e0300f64bec6", + "sha256": "e2f27d86d09d164662efd84c0f279aa853d6f487d9a8db18e6fad29fc40cb41d", + "bytes": 3360, + "role": "historical experimental source or platform metadata", + "url": "https://github.com/igna-s/New-1.58/blob/a90ec3e01ad30b0e1701dff1dd60bae655708bf1/models/ablation_models/run_09_folded_transformer.py" + }, + { + "path": "models/ablation_models/run_10_cpu1_complete.py", + "original_commit": "c2fb5d37a3b6c0906abbfb2480202055aaee8c86", + "restored_commit": "a90ec3e01ad30b0e1701dff1dd60bae655708bf1", + "blob": "e30a571984069f7fc65eb9f18a29cd1e2971b49c", + "sha256": "ae5df801ad83efa6c4fc4ffa0abcbf42453258d777de63dc0823d65493eb83f7", + "bytes": 3327, + "role": "historical experimental source or platform metadata", + "url": "https://github.com/igna-s/New-1.58/blob/a90ec3e01ad30b0e1701dff1dd60bae655708bf1/models/ablation_models/run_10_cpu1_complete.py" + }, + { + "path": "models/ablation_models/run_11_cpu1_pfnet.py", + "original_commit": "c2fb5d37a3b6c0906abbfb2480202055aaee8c86", + "restored_commit": "a90ec3e01ad30b0e1701dff1dd60bae655708bf1", + "blob": "e05200732e6130ef4fa1c1e3e48e3947292ddf33", + "sha256": "dbb120d1b962a1039fc89f232a6949102539aadf0710cdbad132a51035d9d28a", + "bytes": 3556, + "role": "historical experimental source or platform metadata", + "url": "https://github.com/igna-s/New-1.58/blob/a90ec3e01ad30b0e1701dff1dd60bae655708bf1/models/ablation_models/run_11_cpu1_pfnet.py" + }, + { + "path": "models/ablation_models/run_400M_cpu1_kernel_optimal.py", + "original_commit": "c2fb5d37a3b6c0906abbfb2480202055aaee8c86", + "restored_commit": "a90ec3e01ad30b0e1701dff1dd60bae655708bf1", + "blob": "a1bd3d1562befa194b762fbe23a811a07982e574", + "sha256": "fec48805647d2adc5647327bdc4c24b70f7a7a7b013dba97ad1a5bd99d866289", + "bytes": 8601, + "role": "historical experimental source or platform metadata", + "url": "https://github.com/igna-s/New-1.58/blob/a90ec3e01ad30b0e1701dff1dd60bae655708bf1/models/ablation_models/run_400M_cpu1_kernel_optimal.py" + }, + { + "path": "models/ablation_models/small_01_cpu1_bpe.py", + "original_commit": "c2fb5d37a3b6c0906abbfb2480202055aaee8c86", + "restored_commit": "a90ec3e01ad30b0e1701dff1dd60bae655708bf1", + "blob": "d89cc58c92640b557522d7098c21510024bf4bf8", + "sha256": "8e339e0aff2863473bbedc0ad26a9dfc2cbc858f8b7cac39f41d8e6b83bd9703", + "bytes": 3128, + "role": "historical experimental source or platform metadata", + "url": "https://github.com/igna-s/New-1.58/blob/a90ec3e01ad30b0e1701dff1dd60bae655708bf1/models/ablation_models/small_01_cpu1_bpe.py" + }, + { + "path": "models/ablation_models/small_02_cpu1_byte.py", + "original_commit": "c2fb5d37a3b6c0906abbfb2480202055aaee8c86", + "restored_commit": "a90ec3e01ad30b0e1701dff1dd60bae655708bf1", + "blob": "f38ce247cdfd130115f14937070b97a3f90c91e0", + "sha256": "2efcd0c34b1ce77d95a2a2f4309ea84cfb770d0ff7fb94ebcf75c1bc8f7e2359", + "bytes": 3054, + "role": "historical experimental source or platform metadata", + "url": "https://github.com/igna-s/New-1.58/blob/a90ec3e01ad30b0e1701dff1dd60bae655708bf1/models/ablation_models/small_02_cpu1_byte.py" + }, + { + "path": "models/ablation_models/small_03_cpu1_complement.py", + "original_commit": "c2fb5d37a3b6c0906abbfb2480202055aaee8c86", + "restored_commit": "a90ec3e01ad30b0e1701dff1dd60bae655708bf1", + "blob": "567fef163965059a676283d0f1294f05aa8af863", + "sha256": "f96e9d9a195815cb8f2dbc64a85e0b11ba58d8b563101ab7ab03bf56ec075d7e", + "bytes": 4487, + "role": "historical experimental source or platform metadata", + "url": "https://github.com/igna-s/New-1.58/blob/a90ec3e01ad30b0e1701dff1dd60bae655708bf1/models/ablation_models/small_03_cpu1_complement.py" + }, + { + "path": "models/ablation_models/small_04_cpu1_raw_bytes.py", + "original_commit": "c2fb5d37a3b6c0906abbfb2480202055aaee8c86", + "restored_commit": "a90ec3e01ad30b0e1701dff1dd60bae655708bf1", + "blob": "04784b9cd4c72253d97687b4e870c9bdebe808e0", + "sha256": "b393c466f86e81583867307199301aa64fab2bd2e4e8c2e20ffc2b999f1b3236", + "bytes": 4042, + "role": "historical experimental source or platform metadata", + "url": "https://github.com/igna-s/New-1.58/blob/a90ec3e01ad30b0e1701dff1dd60bae655708bf1/models/ablation_models/small_04_cpu1_raw_bytes.py" + }, + { + "path": "models/ablation_models/zave_ablation_models.py", + "original_commit": "c2fb5d37a3b6c0906abbfb2480202055aaee8c86", + "restored_commit": "a90ec3e01ad30b0e1701dff1dd60bae655708bf1", + "blob": "0b4ef01afb4cb293782ef7905acb37e1b6ca099e", + "sha256": "30229871029d3a710066289b9d54cc75d2166aa298be63a69bc61c287f5e1ada", + "bytes": 2898, + "role": "historical experimental source or platform metadata", + "url": "https://github.com/igna-s/New-1.58/blob/a90ec3e01ad30b0e1701dff1dd60bae655708bf1/models/ablation_models/zave_ablation_models.py" + }, + { + "path": "patch_train.py", + "original_commit": "6f97ebd101644dddab57d201b8f303518baf2d09", + "restored_commit": "dcafa9518e2097bd9eda756558e4085fd778c1cf", + "blob": "a06a702586d3e7ae141b8baa6a8cf9c458df6c4c", + "sha256": "ba5ec7e9c40dec0096726d7faa4271de5785acd01918a1df702545a71093562f", + "bytes": 4834, + "role": "historical experimental source or platform metadata", + "url": "https://github.com/igna-s/New-1.58/blob/dcafa9518e2097bd9eda756558e4085fd778c1cf/patch_train.py" + }, + { + "path": "resultados/ablation_run_01.json", + "original_commit": "f52f2dcae8ce0cd12e24f419a5545e15750b4f72", + "restored_commit": "bc58efaa7ef00dc24f57ea7479415520fb92705f", + "blob": "4e17834740e7acad59adb0eb36c47b26a5664155", + "sha256": "59c710d5f4e5c0d6cfbb8fe91d973a18881c4b684aa7985f3e6d63d3b290b9d1", + "bytes": 2533, + "role": "historical training record", + "url": "https://github.com/igna-s/New-1.58/blob/bc58efaa7ef00dc24f57ea7479415520fb92705f/resultados/ablation_run_01.json" + }, + { + "path": "resultados/ablation_run_01_v3.json", + "original_commit": "f52f2dcae8ce0cd12e24f419a5545e15750b4f72", + "restored_commit": "bc58efaa7ef00dc24f57ea7479415520fb92705f", + "blob": "9b54a0a953f552748c5594d7342b2a4e75f02944", + "sha256": "f454192a0266f9c6c8151417c32eb7e525fcfd72134d34caa212a7fd3fae5945", + "bytes": 2616, + "role": "historical training record", + "url": "https://github.com/igna-s/New-1.58/blob/bc58efaa7ef00dc24f57ea7479415520fb92705f/resultados/ablation_run_01_v3.json" + }, + { + "path": "resultados/ablation_run_02.json", + "original_commit": "f52f2dcae8ce0cd12e24f419a5545e15750b4f72", + "restored_commit": "bc58efaa7ef00dc24f57ea7479415520fb92705f", + "blob": "80325d521408237a57c28645f7d9414f7170a94d", + "sha256": "b3964f331cfdbe734cb429fe76035d7852af5840427bdadab4a174ceeff0a674", + "bytes": 2705, + "role": "historical training record", + "url": "https://github.com/igna-s/New-1.58/blob/bc58efaa7ef00dc24f57ea7479415520fb92705f/resultados/ablation_run_02.json" + }, + { + "path": "resultados/ablation_run_02_v3.json", + "original_commit": "f52f2dcae8ce0cd12e24f419a5545e15750b4f72", + "restored_commit": "bc58efaa7ef00dc24f57ea7479415520fb92705f", + "blob": "1ffa15bbe527baaee1e8549b7a3711d7d5036263", + "sha256": "ef73cf4cb34e415d21699df26773e500c82f6765c670b4618c7b1b1c39015b20", + "bytes": 3343, + "role": "historical training record", + "url": "https://github.com/igna-s/New-1.58/blob/bc58efaa7ef00dc24f57ea7479415520fb92705f/resultados/ablation_run_02_v3.json" + }, + { + "path": "resultados/ablation_run_02a_byte_only_heads.json", + "original_commit": "f52f2dcae8ce0cd12e24f419a5545e15750b4f72", + "restored_commit": "bc58efaa7ef00dc24f57ea7479415520fb92705f", + "blob": "40f949db9bbf84b9454e5919709ba3614683aea8", + "sha256": "4752b8164c517bc69d57021697dff3f78529919ddf8b6c067fc7ad9003f30548", + "bytes": 2741, + "role": "historical training record", + "url": "https://github.com/igna-s/New-1.58/blob/bc58efaa7ef00dc24f57ea7479415520fb92705f/resultados/ablation_run_02a_byte_only_heads.json" + }, + { + "path": "resultados/ablation_run_02a_byte_only_heads_v3.json", + "original_commit": "f52f2dcae8ce0cd12e24f419a5545e15750b4f72", + "restored_commit": "bc58efaa7ef00dc24f57ea7479415520fb92705f", + "blob": "dab3c9903ff9545035443fb409d9da764275cb79", + "sha256": "e081835ec5103d1671153da812bb75f6555749a063169fb75f8796423f02d80b", + "bytes": 3380, + "role": "historical training record", + "url": "https://github.com/igna-s/New-1.58/blob/bc58efaa7ef00dc24f57ea7479415520fb92705f/resultados/ablation_run_02a_byte_only_heads_v3.json" + }, + { + "path": "resultados/ablation_run_03.json", + "original_commit": "f52f2dcae8ce0cd12e24f419a5545e15750b4f72", + "restored_commit": "bc58efaa7ef00dc24f57ea7479415520fb92705f", + "blob": "27448f248f183ac63e4b6119a82c100c02bf875b", + "sha256": "415cdbb78f455034e0ee2a71b4be678f48d36ceb6b2a9784bcbe948270749c63", + "bytes": 2637, + "role": "historical training record", + "url": "https://github.com/igna-s/New-1.58/blob/bc58efaa7ef00dc24f57ea7479415520fb92705f/resultados/ablation_run_03.json" + }, + { + "path": "resultados/ablation_run_03_v3.json", + "original_commit": "f52f2dcae8ce0cd12e24f419a5545e15750b4f72", + "restored_commit": "bc58efaa7ef00dc24f57ea7479415520fb92705f", + "blob": "24641e75f4d608e584c9207c6052f208fb8dc88e", + "sha256": "6592224390b8ccc9f910143770c5fe02df374dad33ce8ab45b84f46964516cc6", + "bytes": 2648, + "role": "historical training record", + "url": "https://github.com/igna-s/New-1.58/blob/bc58efaa7ef00dc24f57ea7479415520fb92705f/resultados/ablation_run_03_v3.json" + }, + { + "path": "resultados/ablation_run_04.json", + "original_commit": "f52f2dcae8ce0cd12e24f419a5545e15750b4f72", + "restored_commit": "bc58efaa7ef00dc24f57ea7479415520fb92705f", + "blob": "5de951e2eb97ffe94dcce10fa5eced80f0d3fc97", + "sha256": "b56a61634e0845a344b4a3520a80fb04fca17263824af94680b896e33a2ee038", + "bytes": 2544, + "role": "historical training record", + "url": "https://github.com/igna-s/New-1.58/blob/bc58efaa7ef00dc24f57ea7479415520fb92705f/resultados/ablation_run_04.json" + }, + { + "path": "resultados/ablation_run_04_r2.json", + "original_commit": "f52f2dcae8ce0cd12e24f419a5545e15750b4f72", + "restored_commit": "bc58efaa7ef00dc24f57ea7479415520fb92705f", + "blob": "4fe112889cd4878e3b43c06aca65724db7e83f86", + "sha256": "94b08aa6f17d895f39aae9ed19157fade48ce7b640efcd7f258a9c7dc4b0348e", + "bytes": 2562, + "role": "historical training record", + "url": "https://github.com/igna-s/New-1.58/blob/bc58efaa7ef00dc24f57ea7479415520fb92705f/resultados/ablation_run_04_r2.json" + }, + { + "path": "resultados/ablation_run_04_v3.json", + "original_commit": "f52f2dcae8ce0cd12e24f419a5545e15750b4f72", + "restored_commit": "bc58efaa7ef00dc24f57ea7479415520fb92705f", + "blob": "fab6195ac4211bb326dc81d49d48ab0af0a1009b", + "sha256": "de8dc03698eea54ad0fe2cb444557605ac1840dca6f1f79225d4e40eb0936938", + "bytes": 2491, + "role": "historical training record", + "url": "https://github.com/igna-s/New-1.58/blob/bc58efaa7ef00dc24f57ea7479415520fb92705f/resultados/ablation_run_04_v3.json" + }, + { + "path": "resultados/ablation_run_05.json", + "original_commit": "f52f2dcae8ce0cd12e24f419a5545e15750b4f72", + "restored_commit": "bc58efaa7ef00dc24f57ea7479415520fb92705f", + "blob": "ad5bc626d6409a613ef546f876454d1abd21c60f", + "sha256": "8677bd0edf64f924d44e44f2481a849ba55092cacacde53b56b74d4f4e6383b8", + "bytes": 2547, + "role": "historical training record", + "url": "https://github.com/igna-s/New-1.58/blob/bc58efaa7ef00dc24f57ea7479415520fb92705f/resultados/ablation_run_05.json" + }, + { + "path": "resultados/ablation_run_05_v3.json", + "original_commit": "f52f2dcae8ce0cd12e24f419a5545e15750b4f72", + "restored_commit": "bc58efaa7ef00dc24f57ea7479415520fb92705f", + "blob": "1f869eee5b5905bead67bc5bfd528768b3b260a0", + "sha256": "1977869cd6dc94252e3147a48e041f466aacdcaf27ce37e69858f5ad4b6f88a4", + "bytes": 2610, + "role": "historical training record", + "url": "https://github.com/igna-s/New-1.58/blob/bc58efaa7ef00dc24f57ea7479415520fb92705f/resultados/ablation_run_05_v3.json" + }, + { + "path": "resultados/ablation_run_05b_kernel_strict.json", + "original_commit": "f52f2dcae8ce0cd12e24f419a5545e15750b4f72", + "restored_commit": "bc58efaa7ef00dc24f57ea7479415520fb92705f", + "blob": "d2c24f48bc82518e312c7a0da2a61fd00f4b550d", + "sha256": "df8ee6ad6110a04fd32485e0a7efdb67391377d6f0776185e597cd9287c56430", + "bytes": 2576, + "role": "historical training record", + "url": "https://github.com/igna-s/New-1.58/blob/bc58efaa7ef00dc24f57ea7479415520fb92705f/resultados/ablation_run_05b_kernel_strict.json" + }, + { + "path": "resultados/ablation_run_05b_kernel_strict_v3.json", + "original_commit": "f52f2dcae8ce0cd12e24f419a5545e15750b4f72", + "restored_commit": "bc58efaa7ef00dc24f57ea7479415520fb92705f", + "blob": "954c54be62dfdf0b1fd3afc1d3bd108bbf8a3dec", + "sha256": "7835a1673f89a6551b198bd34b26ea480198948fe5425c2591f8c5d13cec6eca", + "bytes": 2639, + "role": "historical training record", + "url": "https://github.com/igna-s/New-1.58/blob/bc58efaa7ef00dc24f57ea7479415520fb92705f/resultados/ablation_run_05b_kernel_strict_v3.json" + }, + { + "path": "resultados/ablation_run_06.json", + "original_commit": "f52f2dcae8ce0cd12e24f419a5545e15750b4f72", + "restored_commit": "bc58efaa7ef00dc24f57ea7479415520fb92705f", + "blob": "df625c26ddc4d1115b75d0d376b18cc747598eaa", + "sha256": "2af17dd7a09d98e1a9cdfbedda93d926150fd2d7c8edb54c503b4a1ebf73794d", + "bytes": 2553, + "role": "historical training record", + "url": "https://github.com/igna-s/New-1.58/blob/bc58efaa7ef00dc24f57ea7479415520fb92705f/resultados/ablation_run_06.json" + }, + { + "path": "resultados/ablation_run_06_v3.json", + "original_commit": "f52f2dcae8ce0cd12e24f419a5545e15750b4f72", + "restored_commit": "bc58efaa7ef00dc24f57ea7479415520fb92705f", + "blob": "5d4a918b2d565ea5acd024a0e0a9be351da9f456", + "sha256": "b5fe80bc51d76dd5bc4fbdfc75d7d6af0fa14614fbb58e311b7ee4c78e6b82b3", + "bytes": 2616, + "role": "historical training record", + "url": "https://github.com/igna-s/New-1.58/blob/bc58efaa7ef00dc24f57ea7479415520fb92705f/resultados/ablation_run_06_v3.json" + }, + { + "path": "resultados/ablation_run_07.json", + "original_commit": "f52f2dcae8ce0cd12e24f419a5545e15750b4f72", + "restored_commit": "bc58efaa7ef00dc24f57ea7479415520fb92705f", + "blob": "1037f2dff73cb67867c32fd736d5e28329edb297", + "sha256": "ff7f923cb6ac1e9fc9cd1bb2b39d4008550c3ae980e6db27a744e60c166a125e", + "bytes": 2555, + "role": "historical training record", + "url": "https://github.com/igna-s/New-1.58/blob/bc58efaa7ef00dc24f57ea7479415520fb92705f/resultados/ablation_run_07.json" + }, + { + "path": "resultados/ablation_run_07_r2.json", + "original_commit": "f52f2dcae8ce0cd12e24f419a5545e15750b4f72", + "restored_commit": "bc58efaa7ef00dc24f57ea7479415520fb92705f", + "blob": "0d9182a590415e86226858cc77de7d0e0af1f0fa", + "sha256": "60a4473d9057bbadb13288b7b6d1ff30993a60806f0c1cb6ecd7eea6e2f156f5", + "bytes": 2560, + "role": "historical training record", + "url": "https://github.com/igna-s/New-1.58/blob/bc58efaa7ef00dc24f57ea7479415520fb92705f/resultados/ablation_run_07_r2.json" + }, + { + "path": "resultados/ablation_run_08.json", + "original_commit": "f52f2dcae8ce0cd12e24f419a5545e15750b4f72", + "restored_commit": "bc58efaa7ef00dc24f57ea7479415520fb92705f", + "blob": "52d2cf5a63b3e153088c2feeb43cdd1a4bad777c", + "sha256": "b55de9dc4ad81637a7687c4a6e8bcc6719ffc90258dd9f3e8cb3ad27fd34879f", + "bytes": 2615, + "role": "historical training record", + "url": "https://github.com/igna-s/New-1.58/blob/bc58efaa7ef00dc24f57ea7479415520fb92705f/resultados/ablation_run_08.json" + }, + { + "path": "resultados/ablation_run_08_v3.json", + "original_commit": "f52f2dcae8ce0cd12e24f419a5545e15750b4f72", + "restored_commit": "bc58efaa7ef00dc24f57ea7479415520fb92705f", + "blob": "040265029a8fbdccfa1ef0e51bb8c8144980a705", + "sha256": "0744b7b20a4091f97ddec962b98fb35d506965440bb281f41d0a068b20c74e0e", + "bytes": 85210, + "role": "historical training record", + "url": "https://github.com/igna-s/New-1.58/blob/bc58efaa7ef00dc24f57ea7479415520fb92705f/resultados/ablation_run_08_v3.json" + }, + { + "path": "resultados/ablation_run_09.json", + "original_commit": "f52f2dcae8ce0cd12e24f419a5545e15750b4f72", + "restored_commit": "bc58efaa7ef00dc24f57ea7479415520fb92705f", + "blob": "c1338b39f7b2026f782397eeaf6d533b39e7fa54", + "sha256": "1adf30a8aba96e29efd28c8655b9cf26caff8f345613c6d121fc08e175962b94", + "bytes": 2555, + "role": "historical training record", + "url": "https://github.com/igna-s/New-1.58/blob/bc58efaa7ef00dc24f57ea7479415520fb92705f/resultados/ablation_run_09.json" + }, + { + "path": "resultados/ablation_run_10.json", + "original_commit": "f52f2dcae8ce0cd12e24f419a5545e15750b4f72", + "restored_commit": "bc58efaa7ef00dc24f57ea7479415520fb92705f", + "blob": "b173e39874fe4b6f33d740229be6a2296ad5ed14", + "sha256": "d74f6adbc95a3e9620dcd97d7cc78e174fe8f1cc7d72b9a22e837858f863afe6", + "bytes": 2556, + "role": "historical training record", + "url": "https://github.com/igna-s/New-1.58/blob/bc58efaa7ef00dc24f57ea7479415520fb92705f/resultados/ablation_run_10.json" + }, + { + "path": "resultados/ablation_run_13.json", + "original_commit": "f52f2dcae8ce0cd12e24f419a5545e15750b4f72", + "restored_commit": "bc58efaa7ef00dc24f57ea7479415520fb92705f", + "blob": "e4088de69838cd86689377816e14eba329d5a8a3", + "sha256": "0fbfc194e5e3171b73af9e2208104e4b92f71f13bba598f82faa17be19566d3f", + "bytes": 2438, + "role": "historical training record", + "url": "https://github.com/igna-s/New-1.58/blob/bc58efaa7ef00dc24f57ea7479415520fb92705f/resultados/ablation_run_13.json" + }, + { + "path": "resultados/ablation_run_13_r2.json", + "original_commit": "f52f2dcae8ce0cd12e24f419a5545e15750b4f72", + "restored_commit": "bc58efaa7ef00dc24f57ea7479415520fb92705f", + "blob": "0fb77a767cb214be5a704b4db852593d0fa5ce61", + "sha256": "b4c031f8b77799b35ad501b43912c8a539c7d48f3f860dbf3bbf3726ff6d3811", + "bytes": 2442, + "role": "historical training record", + "url": "https://github.com/igna-s/New-1.58/blob/bc58efaa7ef00dc24f57ea7479415520fb92705f/resultados/ablation_run_13_r2.json" + }, + { + "path": "resultados/ablation_run_13_v3.json", + "original_commit": "f52f2dcae8ce0cd12e24f419a5545e15750b4f72", + "restored_commit": "bc58efaa7ef00dc24f57ea7479415520fb92705f", + "blob": "4c7a443daa84feb88c7c7e3253689fa84bf82035", + "sha256": "fe794f4d4d7275a906f2e6813baf4f046c1f595e089d566ddccdd0190c1efb28", + "bytes": 2436, + "role": "historical training record", + "url": "https://github.com/igna-s/New-1.58/blob/bc58efaa7ef00dc24f57ea7479415520fb92705f/resultados/ablation_run_13_v3.json" + }, + { + "path": "resultados/ablation_run_14.json", + "original_commit": "f52f2dcae8ce0cd12e24f419a5545e15750b4f72", + "restored_commit": "bc58efaa7ef00dc24f57ea7479415520fb92705f", + "blob": "a6dab785ae1efc2435888ed2c8e7414b4a99ed43", + "sha256": "f6c699e129b226176f9af047c060fc8a84670cbdf128ce034637c80a2b005c10", + "bytes": 2550, + "role": "historical training record", + "url": "https://github.com/igna-s/New-1.58/blob/bc58efaa7ef00dc24f57ea7479415520fb92705f/resultados/ablation_run_14.json" + }, + { + "path": "resultados/ablation_run_14_r2.json", + "original_commit": "f52f2dcae8ce0cd12e24f419a5545e15750b4f72", + "restored_commit": "bc58efaa7ef00dc24f57ea7479415520fb92705f", + "blob": "26226511fe00262f60ec56b1ece502d4ed56b11d", + "sha256": "dfa61be17e927cc52ce7ff8d333c708f91412eaeb42d6b20622954e30b758e22", + "bytes": 2559, + "role": "historical training record", + "url": "https://github.com/igna-s/New-1.58/blob/bc58efaa7ef00dc24f57ea7479415520fb92705f/resultados/ablation_run_14_r2.json" + }, + { + "path": "resultados/ablation_run_14_v3.json", + "original_commit": "f52f2dcae8ce0cd12e24f419a5545e15750b4f72", + "restored_commit": "bc58efaa7ef00dc24f57ea7479415520fb92705f", + "blob": "b2c0cc187b1dd23adb785e850ab939cafa77258a", + "sha256": "69dae011ffad377aeebfed22a36743fe27136a553ba50f0040e657bd085507dc", + "bytes": 2614, + "role": "historical training record", + "url": "https://github.com/igna-s/New-1.58/blob/bc58efaa7ef00dc24f57ea7479415520fb92705f/resultados/ablation_run_14_v3.json" + }, + { + "path": "resultados/ablation_run_15.json", + "original_commit": "f52f2dcae8ce0cd12e24f419a5545e15750b4f72", + "restored_commit": "bc58efaa7ef00dc24f57ea7479415520fb92705f", + "blob": "3208b722d4fa8404a3ea9e16d05704a82ee951a2", + "sha256": "7a81382cd18acb80abaee4505565dc47d50b92e42534f4b538d18953aa8386c9", + "bytes": 2552, + "role": "historical training record", + "url": "https://github.com/igna-s/New-1.58/blob/bc58efaa7ef00dc24f57ea7479415520fb92705f/resultados/ablation_run_15.json" + }, + { + "path": "resultados/ablation_run_15_r2.json", + "original_commit": "f52f2dcae8ce0cd12e24f419a5545e15750b4f72", + "restored_commit": "bc58efaa7ef00dc24f57ea7479415520fb92705f", + "blob": "733b137068a2c23865bf8f6bac7d1c08b159528e", + "sha256": "970277b6dcbf3fc833a4c028ce357af5aaf160e5b7434d2a6344d6b7d7007176", + "bytes": 2560, + "role": "historical training record", + "url": "https://github.com/igna-s/New-1.58/blob/bc58efaa7ef00dc24f57ea7479415520fb92705f/resultados/ablation_run_15_r2.json" + }, + { + "path": "resultados/ablation_run_15_v3.json", + "original_commit": "f52f2dcae8ce0cd12e24f419a5545e15750b4f72", + "restored_commit": "bc58efaa7ef00dc24f57ea7479415520fb92705f", + "blob": "e1986d03a9825d4740e5be90908c982cc9d4f8b8", + "sha256": "ddc90f24f5eb97ee5f225ffec6dc70d346d981bc2a87d974f5aeb5107e91ae30", + "bytes": 2615, + "role": "historical training record", + "url": "https://github.com/igna-s/New-1.58/blob/bc58efaa7ef00dc24f57ea7479415520fb92705f/resultados/ablation_run_15_v3.json" + }, + { + "path": "resultados/ablation_run_16.json", + "original_commit": "f52f2dcae8ce0cd12e24f419a5545e15750b4f72", + "restored_commit": "bc58efaa7ef00dc24f57ea7479415520fb92705f", + "blob": "79bf73d02ccc38f63e8526794ac37db52e9ce882", + "sha256": "62d264ee7134cd9f6d9c9892712b61e4ee5a646d51353448800c33da0807d7ce", + "bytes": 2551, + "role": "historical training record", + "url": "https://github.com/igna-s/New-1.58/blob/bc58efaa7ef00dc24f57ea7479415520fb92705f/resultados/ablation_run_16.json" + }, + { + "path": "resultados/ablation_run_16_r2.json", + "original_commit": "f52f2dcae8ce0cd12e24f419a5545e15750b4f72", + "restored_commit": "bc58efaa7ef00dc24f57ea7479415520fb92705f", + "blob": "41b6955a9b973a8dc5122767ce089e2d85577a35", + "sha256": "4a1146f2a2249290f588a03999f047db75e88ff2659ea222c749c0ef37114add", + "bytes": 2560, + "role": "historical training record", + "url": "https://github.com/igna-s/New-1.58/blob/bc58efaa7ef00dc24f57ea7479415520fb92705f/resultados/ablation_run_16_r2.json" + }, + { + "path": "resultados/ablation_summary.md", + "original_commit": "f52f2dcae8ce0cd12e24f419a5545e15750b4f72", + "restored_commit": "bc58efaa7ef00dc24f57ea7479415520fb92705f", + "blob": "c98e0fc1cccbfbcca7477b042fb96f52cb334bca", + "sha256": "d96e1b29dba9e682e05c9f442cdad515c78b671675b72dc7d51aa8472eae02e2", + "bytes": 3010, + "role": "historical training record", + "url": "https://github.com/igna-s/New-1.58/blob/bc58efaa7ef00dc24f57ea7479415520fb92705f/resultados/ablation_summary.md" + }, + { + "path": "train.py", + "original_commit": "c2fb5d37a3b6c0906abbfb2480202055aaee8c86", + "restored_commit": "a90ec3e01ad30b0e1701dff1dd60bae655708bf1", + "blob": "60d9dc6c0b2a8713553aaebe67401838018fe22c", + "sha256": "f64c83bd458d956bd6b573afa9664f4dc5072c4243cf1379ec6dff9f28de931c", + "bytes": 74105, + "role": "historical experimental source or platform metadata", + "url": "https://github.com/igna-s/New-1.58/blob/a90ec3e01ad30b0e1701dff1dd60bae655708bf1/train.py" + } + ], + "excluded_paths": [ + ".claudeignore", + "_upload_tmp/hf_cache/datasets--Cukinator--cpu1-ablation-dataset/refs/main", + "benchmark_optimized.exe", + "hf_readmes/cpu1-ablation-checkpoints_README.md", + "hf_readmes/cpu1-ablations-final_README.md", + "inference/benchmark.exe", + "inference/benchmark_debug.exe", + "inference/benchmark_opt.exe", + "inference/benchmark_output.txt", + "inference/benchmark_test.exe", + "inference/benchmark_v3.exe", + "inference/kernels.dll", + "models/LFM2.5-350M/refs/main", + "models/LFM2.5-350M/snapshots/70810220513bfdbdfcbeade479f358390af187b4/.eval_results/gpqa_diamond.yaml", + "models/LFM2.5-350M/snapshots/70810220513bfdbdfcbeade479f358390af187b4/.eval_results/mmlu_pro.yaml", + "models/LFM2.5-350M/snapshots/70810220513bfdbdfcbeade479f358390af187b4/.gitattributes", + "models/LFM2.5-350M/snapshots/70810220513bfdbdfcbeade479f358390af187b4/LICENSE", + "models/LFM2.5-350M/snapshots/70810220513bfdbdfcbeade479f358390af187b4/README.md", + "models/LFM2.5-350M/snapshots/70810220513bfdbdfcbeade479f358390af187b4/chat_template.jinja", + "models/LFM2.5-350M/snapshots/70810220513bfdbdfcbeade479f358390af187b4/config.json", + "models/LFM2.5-350M/snapshots/70810220513bfdbdfcbeade479f358390af187b4/generation_config.json", + "models/LFM2.5-350M/snapshots/70810220513bfdbdfcbeade479f358390af187b4/tokenizer.json", + "models/LFM2.5-350M/snapshots/70810220513bfdbdfcbeade479f358390af187b4/tokenizer_config.json", + "models/distilgpt2/config.json", + "models/distilgpt2/generation_config.json", + "models/distilgpt2/tokenizer.json", + "models/distilgpt2/tokenizer_config.json", + "papers/2025.coling-main.316.pdf", + "papers/2311.00502v2.pdf", + "papers/2406.02528v7.pdf", + "papers/2407.00088v2.pdf", + "papers/2410.20771v3.pdf", + "papers/2505.06461v1.pdf", + "papers/2511.23404v1.pdf", + "papers/2512.15586v2.pdf", + "papers/2602.01007v1 (1).pdf", + "papers/2602.01007v1.pdf", + "papers/MEGABYTE-Predicting-byte-sequences.pdf", + "papers/Practica1.pdf", + "papers/bolmo-byteifying-next-gen-language-models.pdf", + "papers/challenging-gpu-dominance-cpu-on-device-llm.pdf", + "papers/distilling-token-models-into-byte-level.pdf", + "papers/efficient-llm-inference-on-cpus.pdf", + "papers/gemma3-technical-report.pdf", + "papers/hgrn2-gated-linear-rnns-state-expansion.pdf", + "papers/lfm2-liquid-foundation-models-technical-report.pdf", + "papers/mrt5-dynamic-token-merging-byte-level-lm.pdf", + "papers/resumen_papers_cpu1.md", + "papers/scalable-matmul-free-language-modeling.pdf", + "papers/slender-mamba-fully-quantized-1.58bits.pdf", + "papers/stuffed-mamba-oversized-states-inability-to-forget.pdf", + "papers/tide-token-informed-depth-execution-early-exit.pdf", + "papers/tmac-cpu-table-lookup-low-bit-llm.pdf", + "resultados/benchmark_output.txt", + "resultados/checkpoint_1t.json", + "resultados/checkpoint_1t.md", + "resultados/checkpoint_6t.json", + "resultados/checkpoint_6t.md", + "resultados/distilgpt2.md", + "resultados/gpt2-medium_q4_1t.json", + "resultados/gpt2-medium_q4_1t.md", + "resultados/gpt2-medium_q4_6t.json", + "resultados/gpt2-medium_q4_6t.md", + "resultados/gpt2-medium_q8_1t.json", + "resultados/gpt2-medium_q8_1t.md", + "resultados/gpt2-medium_q8_6t.json", + "resultados/gpt2-medium_q8_6t.md", + "resultados/readme_audit/CORPUS_LICENSE.txt", + "resultados/readme_audit/corpus.json", + "resultados/readme_audit/dataset_inventory.json", + "resultados/readme_audit/environment.json", + "resultados/readme_audit/implementation_diagnostics.json", + "resultados/readme_audit/inventory.json", + "resultados/readme_audit/loading_examples.json", + "resultados/readme_audit/publication.json", + "resultados/readme_audit/run_01.json", + "resultados/readme_audit/run_01_v3.json", + "resultados/readme_audit/run_02.json", + "resultados/readme_audit/run_02_v3.json", + "resultados/readme_audit/run_02a_byte_only_heads.json", + "resultados/readme_audit/run_02a_byte_only_heads_v3.json", + "resultados/readme_audit/run_03.json", + "resultados/readme_audit/run_03_v3.json", + "resultados/readme_audit/run_04.json", + "resultados/readme_audit/run_04_r2.json", + "resultados/readme_audit/run_04_v3.json", + "resultados/readme_audit/run_05.json", + "resultados/readme_audit/run_05_v3.json", + "resultados/readme_audit/run_05b_kernel_strict.json", + "resultados/readme_audit/run_05b_kernel_strict_v3.json", + "resultados/readme_audit/run_06.json", + "resultados/readme_audit/run_06_v3.json", + "resultados/readme_audit/run_07.json", + "resultados/readme_audit/run_07_r2.json", + "resultados/readme_audit/run_08.json", + "resultados/readme_audit/run_08_v3.json", + "resultados/readme_audit/run_09.json", + "resultados/readme_audit/run_10.json", + "resultados/readme_audit/run_13.json", + "resultados/readme_audit/run_13_r2.json", + "resultados/readme_audit/run_13_v3.json", + "resultados/readme_audit/run_14.json", + "resultados/readme_audit/run_14_r2.json", + "resultados/readme_audit/run_14_v3.json", + "resultados/readme_audit/run_15.json", + "resultados/readme_audit/run_15_r2.json", + "resultados/readme_audit/run_15_v3.json", + "resultados/readme_audit/run_16.json", + "resultados/readme_audit/run_16_r2.json" + ] +} diff --git a/evaluation/source/docs/provenance/source-versions.json b/evaluation/source/docs/provenance/source-versions.json new file mode 100644 index 0000000000000000000000000000000000000000..1e5442c67050ac96a58732fd24c9e58b44dcc2e0 --- /dev/null +++ b/evaluation/source/docs/provenance/source-versions.json @@ -0,0 +1,459 @@ +{ + "scope": "Unique source blobs of the reorganized dataset/CUDA/AMD entry points; not a per-job lineage assignment", + "versions": [ + { + "path": "train_ablation.py", + "original_commit": "f52f2dcae8ce0cd12e24f419a5545e15750b4f72", + "blob": "54189efff70651a015350f6af83cf65d1f00b594", + "restored_commit": "bc58efaa7ef00dc24f57ea7479415520fb92705f", + "preset_names": [ + "run_01", + "run_02a_byte_only_heads", + "run_02", + "run_03", + "run_04", + "run_05", + "run_05b_kernel_strict", + "run_06", + "run_07", + "run_08", + "run_09", + "run_10", + "run_04_r2", + "run_05_r2", + "run_07_r2", + "run_08_r2", + "run_09_r2", + "run_10_r2", + "run_04_r3", + "run_07_r3", + "run_13", + "run_14", + "run_15", + "run_16", + "run_14_r2", + "run_15_r2", + "run_16_r2", + "run_13_r2", + "run_14_r3", + "run_15_r3" + ] + }, + { + "path": "train_ablation.py", + "original_commit": "82522e014451843dc512cd4f7ce2933b6288dd4d", + "blob": "f96c0e44388b8232b6b61327791c06b614fa5188", + "restored_commit": "e183a1ea0fc27958c9da63a6a6ead4946d8ad196", + "preset_names": [ + "run_01", + "run_02a_byte_only_heads", + "run_02", + "run_03", + "run_04", + "run_05", + "run_05b_kernel_strict", + "run_06", + "run_07", + "run_08", + "run_09", + "run_10", + "run_13", + "run_14", + "run_15", + "run_16" + ] + }, + { + "path": "train_ablation.py", + "original_commit": "a2f4a65655030c4df3a9a1fc2e83c9afa5216bb5", + "blob": "3838e0288ace535ed5fa3849a1e19e2c58da14eb", + "restored_commit": "996ae7d0e2b4894107593c331e2d4abd6260c9d0", + "preset_names": [ + "run_01", + "run_02a_byte_only_heads", + "run_02", + "run_03", + "run_04", + "run_05", + "run_05b_kernel_strict", + "run_06", + "run_07", + "run_08", + "run_09", + "run_10", + "run_13", + "run_14", + "run_15", + "run_16" + ] + }, + { + "path": "train_ablation.py", + "original_commit": "34ce0b085ed182fc96b25c7a49e8170aae6f43a1", + "blob": "5fc84ce9aaee0f71823eee8a07bd8f40aef62a59", + "parse_error": "'{' was never closed, line 258", + "restored_commit": "03dfef766f406b8e3f0fe23de9f995555c7a7f10" + }, + { + "path": "train_ablation.py", + "original_commit": "a9e49cf28e8bb02d312caad62a2592fdb7f59ec4", + "blob": "bb7d6265d0bc5e41b26c0549d9b4ebc1e3ae17c5", + "parse_error": "'{' was never closed, line 258", + "restored_commit": "6eeb2a3b2a5d2f87b41bd0a82b1f2d4bc03488f4" + }, + { + "path": "train_ablation.py", + "original_commit": "c11022c98db2e42c8d44f582bf2cb655cdcec7d2", + "blob": "38b9d4ac09519463a67bc6db09650108d240440d", + "parse_error": "'{' was never closed, line 258", + "restored_commit": "706f1282d7f6c4c087689affc31127b10d9eb64f" + }, + { + "path": "train_ablation.py", + "original_commit": "a2b29b13f8667a1b97bc1881cb38641dfcfa3a38", + "blob": "de9494b008aeda9cd8d61cb375829aeecb6a792f", + "parse_error": "'{' was never closed, line 258", + "restored_commit": "a80f30ebd1769b565b41a559878ad98ac4a99d77" + }, + { + "path": "train_ablation.py", + "original_commit": "1fd4aa6b68c808d2f6335c537e273be2b739a69a", + "blob": "d1b8b6da35eeae07892cac35a0a78b788e7ff1e4", + "parse_error": "'{' was never closed, line 258", + "restored_commit": "c531f174df6deaa090968966f101fdbf7a6a155d" + }, + { + "path": "train_ablation.py", + "original_commit": "5e6e34e5c9d8826afa56b5d55e8f5545175b69d1", + "blob": "7dcd015c2d44c7bcb45dc04412d61a5962f02755", + "parse_error": "'{' was never closed, line 258", + "restored_commit": "1f348725012fbe731b72a4e09f4ddf0553e13a21" + }, + { + "path": "train_ablation.py", + "original_commit": "46bd46dece5db8eba2275eb796e7ae710cf2d8d4", + "blob": "2bebb1c7396a595c9f7942176e868fc4deb9d181", + "restored_commit": "bac59ceca8af71777fbbb004c698befd7e3351e6", + "preset_names": [ + "run_01", + "run_02", + "run_03", + "run_04", + "run_05", + "run_06", + "run_07", + "run_08", + "run_09", + "run_10", + "run_11", + "run_12", + "run_13", + "run_14", + "run_15", + "run_16" + ] + }, + { + "path": "train_ablation.py", + "original_commit": "7df2203cb16054e129be03394c97c09a55249682", + "blob": "00652f1abde0ddd486641976d90d7e0942f9e8af", + "restored_commit": "a5f3009cbc2022ad3e28bf8fafc4c96e7bcb74a6", + "preset_names": [ + "run_01", + "run_02", + "run_03", + "run_04", + "run_05", + "run_06", + "run_07", + "run_08", + "run_09", + "run_10", + "run_11", + "run_12", + "run_13", + "run_14", + "run_15", + "run_16" + ] + }, + { + "path": "train_ablation.py", + "original_commit": "bb21da80de485363d1b92ac43acf9ec23f9141b9", + "blob": "0ed8b88f86b93b9662fb11321aee49b393dfd9fa", + "restored_commit": "ab444d1f8912832c6ad1cffb46234d9b82f0b32e", + "preset_names": [ + "run_01", + "run_02", + "run_03", + "run_04", + "run_05", + "run_06", + "run_07", + "run_08", + "run_09", + "run_10", + "run_11", + "run_12", + "run_13", + "run_14", + "run_15", + "run_16" + ] + }, + { + "path": "train_ablation_amd.py", + "original_commit": "f52f2dcae8ce0cd12e24f419a5545e15750b4f72", + "blob": "eb751636bddceb594e5dc414424c1a84626926bd", + "restored_commit": "bc58efaa7ef00dc24f57ea7479415520fb92705f", + "preset_names": [ + "run_01", + "run_02a_byte_only_heads", + "run_02", + "run_03", + "run_04", + "run_05", + "run_05b_kernel_strict", + "run_06", + "run_07", + "run_08", + "run_09", + "run_10", + "run_04_r2", + "run_05_r2", + "run_07_r2", + "run_08_r2", + "run_09_r2", + "run_10_r2", + "run_04_r3", + "run_07_r3", + "run_13", + "run_14", + "run_15", + "run_16", + "run_14_r2", + "run_15_r2", + "run_16_r2", + "run_13_r2", + "run_14_r3", + "run_15_r3" + ] + }, + { + "path": "create_dataset.py", + "original_commit": "f52f2dcae8ce0cd12e24f419a5545e15750b4f72", + "blob": "dac231e80400a2585bd68d13054f4458fc4854b9", + "TEACHER_MODEL": "Qwen/Qwen2.5-3B", + "ALIGN_DIM": 128, + "restored_commit": "bc58efaa7ef00dc24f57ea7479415520fb92705f" + }, + { + "path": "create_dataset.py", + "original_commit": "bccdd9618bbbc446ac903c590c142e942e14eea8", + "blob": "98b80adbdffeebbd694929454798e6aa4c523d56", + "TEACHER_MODEL": "Qwen/Qwen2.5-3B", + "ALIGN_DIM": 128, + "restored_commit": "a3d9b32391c64752ea2a6136ebe5e747d09caee3" + }, + { + "path": "create_dataset.py", + "original_commit": "e93c10b113ca008dd46547e2bea0a165303c3a93", + "blob": "a58c07a2f8ecf93cc970b4edfac919dcfcfd62a8", + "TEACHER_MODEL": "Qwen/Qwen2.5-3B", + "ALIGN_DIM": 128, + "restored_commit": "b42a447cbd377937784851cd81fc03ac7b117a25" + }, + { + "path": "create_dataset.py", + "original_commit": "3b82b905289bab7bafacf1cfb3b1cc90e195b525", + "blob": "e89426ce05da23dcfa8976ef045571c8909838b0", + "TEACHER_MODEL": "Qwen/Qwen2.5-3B", + "ALIGN_DIM": 128, + "restored_commit": "bf4e16329c0ddbd770b83b41b671d62969f18311" + }, + { + "path": "create_dataset.py", + "original_commit": "769da9b67f160bc93fa18baea508cd8c91f8488d", + "blob": "0b49b799f27c7eef97d71796f5bc6ea1f697a388", + "TEACHER_MODEL": "Qwen/Qwen2.5-3B", + "ALIGN_DIM": 128, + "restored_commit": "1a6a27c8b57c17d88a64f999b94d5597b6b7bdc3" + }, + { + "path": "create_dataset.py", + "original_commit": "80c5042e3624d89af5d1bf953f29380b5fbdcd8c", + "blob": "9f57f81fd066116de0f44a9a22595b5d121118b0", + "TEACHER_MODEL": "Qwen/Qwen2.5-3B", + "ALIGN_DIM": 128, + "restored_commit": "9e6900dd528597c385021860c606833486194b4f" + }, + { + "path": "create_dataset.py", + "original_commit": "7e047daa4b7f7e5cc5b89219fb71bbbcec0c158f", + "blob": "a9adcc363774ae41f59f0227c872b6ba23c92d6d", + "TEACHER_MODEL": "Qwen/Qwen2.5-3B", + "ALIGN_DIM": 128, + "restored_commit": "688651db885e9499f28f156abc4893cba7cd7dd0" + }, + { + "path": "create_dataset.py", + "original_commit": "1b33dcaf0c50a9b79e0f8535144d5097d6e8d9b8", + "blob": "6fdb9a0bed6e84ba005f0badd01fedddeba37c41", + "TEACHER_MODEL": "Qwen/Qwen2.5-3B", + "ALIGN_DIM": 128, + "restored_commit": "b641259f33a7ef44a02d060d8c090f5d8ed704fb" + }, + { + "path": "create_dataset.py", + "original_commit": "8bf278803e65141aa1f5bde0b01b2d1dcb37f815", + "blob": "4503a8867cc9f61ca9ce4ef4db3b70e759c5f7af", + "TEACHER_MODEL": "Qwen/Qwen2.5-3B", + "ALIGN_DIM": 128, + "restored_commit": "a113f0e16ca2ec229d1ef14912e5a45a608aeba4" + }, + { + "path": "create_dataset.py", + "original_commit": "e57c25df71237e74dbf3a453778bbf8f1308b1ac", + "blob": "23a947bfde71bf1a5744e55b1fa275bc67620e6f", + "TEACHER_MODEL": "Qwen/Qwen2.5-3B", + "ALIGN_DIM": 128, + "restored_commit": "e30b66897e569a47f70b4a41193ca15bdb886a9e" + }, + { + "path": "create_dataset.py", + "original_commit": "5833a042dcdfe883dc3a1832c463a7ab1fa2d56c", + "blob": "5c1a50c1986f8a0a9a9b5adb82fe31e8e79b0700", + "TEACHER_MODEL": "Qwen/Qwen2.5-3B", + "ALIGN_DIM": 128, + "restored_commit": "edce5b9fa057c3e8afd4737254a9804780ae7a70" + }, + { + "path": "create_dataset.py", + "original_commit": "8faf6d0486e91beab843068c0176ba7ac603db31", + "blob": "0ac6d1f44c91e85137f2c13eb84dcd70d4f55cd2", + "TEACHER_MODEL": "Qwen/Qwen2.5-3B", + "ALIGN_DIM": 128, + "restored_commit": "67005146fefe387c573e8e52c95b83260d116b3f" + }, + { + "path": "create_dataset.py", + "original_commit": "de5a924176de54338af549222dd0a59a62ea790d", + "blob": "d4ca3e890176d2c72279e43cc48c4cca1f2dc663", + "TEACHER_MODEL": "Qwen/Qwen2.5-3B", + "ALIGN_DIM": 128, + "restored_commit": "2dec8c72fc11c9bdf8c657c76d80cfedd182f5a9" + }, + { + "path": "create_dataset.py", + "original_commit": "6f97ebd101644dddab57d201b8f303518baf2d09", + "blob": "30e2acbc9bde8a1d0ecd4ca166a482261038d1e4", + "TEACHER_MODEL": "Qwen/Qwen2.5-3B", + "ALIGN_DIM": 128, + "restored_commit": "dcafa9518e2097bd9eda756558e4085fd778c1cf" + }, + { + "path": "create_dataset.py", + "original_commit": "1b3c2c94783688c0b4c5e3e4b6ef1c496f8c5491", + "blob": "970c0ce9ea0102a24d3674b07e355d1fb771512e", + "TEACHER_MODEL": "Qwen/Qwen2.5-3B", + "ALIGN_DIM": 128, + "restored_commit": "59fe5a8dff043aa1e864c6f96bc7013ef7cc4631" + }, + { + "path": "create_dataset.py", + "original_commit": "5e6b1bcd685820cc3e4f00aae25565f904d9f17b", + "blob": "c54c40384f31f3f8753e6d2f68d7b230fbf15831", + "TEACHER_MODEL": "Qwen/Qwen2.5-3B", + "ALIGN_DIM": 128, + "restored_commit": "c21f2e41a90875be2736f7f54c58a28cf48db205" + }, + { + "path": "create_dataset.py", + "original_commit": "2e36857efbbad631a60db5c80fbe41413b9e9ab8", + "blob": "96582e21c727f8fbec3c2cfd95fe87a5fc86989d", + "TEACHER_MODEL": "Qwen/Qwen2.5-3B", + "ALIGN_DIM": 128, + "restored_commit": "968fe49961b1b6d350254140e97f92a5dedfb2b4" + }, + { + "path": "create_dataset.py", + "original_commit": "3a79d22c0b3b4e22cc350613bf81c1c52d38905b", + "blob": "a63ab84ac493b0ab69c7e37a8200fd7742fce160", + "TEACHER_MODEL": "Qwen/Qwen2.5-3B", + "ALIGN_DIM": 128, + "restored_commit": "cef209e226a34662ea8965917bdda82273947595" + }, + { + "path": "create_dataset.py", + "original_commit": "f152fd68aa174b20a918453c81077dd3a202c977", + "blob": "0b8def847c004ee71b32355bf64a3dd1cfb43df5", + "TEACHER_MODEL": "Qwen/Qwen2.5-3B", + "ALIGN_DIM": 128, + "restored_commit": "acd823007b3396c62ac0f588d88756291a6b8bc7" + }, + { + "path": "create_dataset.py", + "original_commit": "39be192084aa30a2af7f2efd7fa1910796e73d63", + "blob": "d45fccb24a825cd79098596abf841156fa284dfe", + "TEACHER_MODEL": "Qwen/Qwen2.5-3B", + "ALIGN_DIM": 128, + "restored_commit": "7ef585f0efb9a10957f4cc885e3c6f3cd8035c2d" + }, + { + "path": "create_dataset.py", + "original_commit": "45f81b2917a3c7f72c10185baef137bb7dbde90e", + "blob": "04f0f1db2d41be64ad990d28f30277a38da47dee", + "TEACHER_MODEL": "Qwen/Qwen2.5-3B", + "ALIGN_DIM": 128, + "restored_commit": "470ac42a472de339067ec995d033f3a870dba4e3" + }, + { + "path": "create_dataset.py", + "original_commit": "daa07e07bdad8d3627a4e16cac96ddcb7e694951", + "blob": "0577268375fa7da0558077e98023e4cf89e10110", + "TEACHER_MODEL": "Qwen/Qwen2.5-3B", + "ALIGN_DIM": 128, + "restored_commit": "23741096fc497f92b1c81dbfd387bce5575a6eef" + }, + { + "path": "create_dataset.py", + "original_commit": "799e54bc87b23710a8ffce921d38f776030b997b", + "blob": "e72d990ce923c83cd88ef264a8f7e71ff608298f", + "TEACHER_MODEL": "Qwen/Qwen2.5-7B", + "ALIGN_DIM": 128, + "restored_commit": "0c767db6aca778f9e2d5e87afa8c04698b7a0dcf" + }, + { + "path": "create_dataset.py", + "original_commit": "3bdd8255b7096612a1640cab831f89d12a8ca8ec", + "blob": "1e449a80d6b9f998483f1afbd93e72589e66b770", + "TEACHER_MODEL": "Qwen/Qwen2.5-7B", + "ALIGN_DIM": 128, + "restored_commit": "1258390a9bf353568a6e17510e1a6e66d3cb165e" + }, + { + "path": "create_dataset.py", + "original_commit": "f6594dfe2bfc0bc0b4e70e9afe0e5751ccdfe955", + "blob": "d4d2f34cded644c82cc9133827f0261a68384f8b", + "TEACHER_MODEL": "Qwen/Qwen2.5-7B", + "ALIGN_DIM": 128, + "restored_commit": "27eb0e05196c3f38876548659314d069573e251b" + }, + { + "path": "create_dataset.py", + "original_commit": "99da1e826f44e1cc02cbb7ae987146a06a15f45a", + "blob": "092127caa73b72e88141e80089100a727811389f", + "TEACHER_MODEL": "Qwen/Qwen2.5-7B", + "ALIGN_DIM": 128, + "restored_commit": "c027e8e1baaa0b25afe1378139c03f054921d892" + }, + { + "path": "create_dataset.py", + "original_commit": "95c664dbb6fa9fc135ad816222435f98f2c69c1c", + "blob": "a80e1082852cec992411cf21aa092e603810fcb9", + "TEACHER_MODEL": "Qwen/Qwen2.5-14B", + "ALIGN_DIM": 128, + "restored_commit": "f05a50758f73bda0832a661a6908793cba066a99" + } + ] +} diff --git a/evaluation/source/evaluation/cards.py b/evaluation/source/evaluation/cards.py index a8344c48489243ca2208f46b0acc674f6aa9715c..341c4a901065a997e13e10186978723410bd05f6 100644 --- a/evaluation/source/evaluation/cards.py +++ b/evaluation/source/evaluation/cards.py @@ -139,7 +139,10 @@ def tables(records): def architecture(records): - lines = ['## Architecture recorded in each checkpoint', '', + lines = ['## Source and dataset provenance', '', + 'Historical extraction and training code is retained in the [GitHub history](https://github.com/igna-s/New-1.58/tree/main/docs/provenance). Kaggle and Lightning recipes, AMD training, and 34 configuration records are included in `evaluation/source/`. The configuration records preserve published budgets, including the 150 tokens/parameter v3 setting; they do not prove the exact training source commit or achieved exposure.', '', + 'The [dataset review](https://huggingface.co/datasets/Cukinator/cpu1-ablation-dataset) documents short/empty teacher arrays, an observed dense-signal reader alignment defect, and UTF-8 conversion limitations. These observations do not isolate their effect on a training run. No weights, stored datasets or numerical model implementation were repaired in this documentation update.', '', + '## Architecture recorded in each checkpoint', '', 'Run names identify experiments; dimensions and features below come from the saved configuration. FP16 is the training quantization label, while this audit executes the loaded tensors in FP32. β€œ50M” and β€œ10M” in older cards were design families, not exact model sizes.', '', '| Run | Mixer | Tokens | Quant. label | Width / layers / FFN | Local decoder | FP residual | Bolmo | DeleteGate | PFNet hidden | Channel decay |', '|---|---|---|---|---|---|---|---|---|---:|---|'] @@ -192,8 +195,10 @@ def build_cards(inventory, corpus): '## Archive inventory', '', *manifest_rows(inventory), '', 'Sizes use decimal MB and GB. Step counts include phase-2 step files. Highest step is parsed from filenames and does not merge training phases into a continuous training counter.', '', *quickstart(ARCHIVE, inventory[ARCHIVE]['sha'], compact=True), + '## Experiment provenance', '', + 'The source repository preserves the historical Kaggle, Lightning and AMD code. The 34 exported configurations, checkpoint hashes and saved steps are indexed in `evaluation/source/experiments/published/manifest.json`. See the [provenance review](https://github.com/igna-s/New-1.58/tree/main/docs/provenance). Current presets differ from some published configurations; use `--config` to select a recorded experiment. The source commit of each training job and a complete training dependency lock were not recorded.', '', '## Resume training', '', 'Use an intermediate checkpoint, not an inference-only packed final. The current source CLI names the argument `--resume_ckpt`:', '', - '```powershell', 'python -m training.ablation --run run_04 --resume_ckpt D:/cpu1/active/run_04/checkpoint_run_04_step640.pt', '```', '', + '```powershell', 'python -m training.ablation --run run_04 --config experiments/published/configs/run_04.json --resume_ckpt D:/cpu1/active/run_04/checkpoint_run_04_step640.pt --skip-install', '```', '', 'Download the exact step file from its run folder first. Resume requires matching source/configuration, dependencies, and suitable training hardware. This audit did not run a training-resume experiment.', '', '## Scope of the measured results', '', 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.', '', @@ -212,35 +217,19 @@ def build_cards(inventory, corpus): def dataset_card(): - """Update the local companion template; publication scope is the two model repos.""" + """Preserve the reviewed canonical dataset card; reject inventory drift.""" path = OUT/'dataset_inventory.json' if not path.exists(): return - v = json.loads(path.read_text(encoding='utf-8')) - lines = ['---', 'license: mit', 'task_categories:', '- text-generation', 'language:', '- en', 'configs:', '- config_name: byte_marginalized', ' data_files:', ' - split: train', ' path: byte_marginalized/shard_*.parquet', '- config_name: bpe_tokenized', ' data_files:', ' - split: train', ' path: bpe_tokenized/shard_*.parquet', '---', '', - '# CPU-1 ablation training dataset', '', - 'Companion dataset for the CPU-1 distillation experiments. The extraction source config uses Qwen/Qwen2.5-3B as teacher over FineWeb text. The byte and BPE subsets have different schemas and different shard counts; they must not be assumed to be aligned row by row.', '', - '## Verified Hub inventory: 2026-10-06', '', f'Revision: `{v["sha"]}`. The following counts and compressed sizes are from the Hub file listing, not from a full scan of the dataset rows.', '', '| Subset | Parquet files | Compressed GB | Shard range | Missing IDs within range |', '|---|---:|---:|---|---|'] - for subset in ('byte_marginalized','bpe_tokenized'): - fs = [f for f in v['siblings'] if f['rfilename'].startswith(subset+'/') and f['rfilename'].endswith('.parquet')] - ids = sorted(int(re.search(r'shard_(\d+)\.parquet$',f['rfilename']).group(1)) for f in fs) - missing = sorted(set(range(min(ids),max(ids)+1))-set(ids)) - lines.append(f'| `{subset}` | {len(fs)} | {sum(f["size"] for f in fs)/1e9:.3f} | {min(ids):04d}–{max(ids):04d} | '+', '.join(f'{n:04d}' for n in missing)+' |') - lines += ['', 'Sizes use decimal GB. Auxiliary `stream_checkpoint.json` and `stream_carry.pkl` files are extraction bookkeeping, not dataset examples. The file listing does not establish document totals, row totals, teacher coverage, split independence, or whether extraction has finished. Older shard and token totals must not be treated as current.', '', - '## Schema expected by the source adapters', '', - '| Subset | Fields | Interpretation |', '|---|---|---|', - '| Byte | `patches`, `targets`, `teacher_probs`, `teacher_mask`; optional `teacher_hidden`, `teacher_dim` | Flattened byte patches and next-patch targets; teacher signal and mask. Hidden arrays may be compacted to teacher-covered positions; follow the adapter. |', - '| BPE | `input_ids`, `labels`, `teacher_probs_bpe`, `teacher_ids_bpe`, `teacher_mask_bpe` | Qwen token IDs and shifted labels; flattened teacher top-k values and their original IDs. |', '', - 'This table describes `data_pipeline/prepare.py` and the readers in `cpu1/components.py`; the October audit did not validate every row or measure teacher-signal quality. Check actual row lengths, optional fields and `teacher_dim` rather than assuming a fixed hidden width or identical schemas in all shards.', '', - 'The extraction source currently configures four-byte patches, 5,000-step sequences, and top-128 BPE teacher entries. Those are writer settings, not a claim that every stored row matches them. Byte teacher signals are first-byte marginalizations of BPE candidates at mapped boundaries; they are not full autoregressive distributions for all four positions. Training uses the coverage masks.', '', - 'The BPE adapter maps IDs outside the configured student vocabulary to ID 0, and filters teacher IDs accordingly. This is a lossy representation. Its token perplexity cannot be compared directly with byte perplexity or with an untruncated Qwen language model.', '', - '## Stream one subset', '', '```python', 'import os', 'os.environ["HF_HOME"] = "D:/cpu1/hf"', 'os.environ["HF_DATASETS_CACHE"] = "D:/cpu1/datasets"', 'from datasets import load_dataset', 'dataset = load_dataset(', ' "Cukinator/cpu1-ablation-dataset",', ' "byte_marginalized",', f' revision="{v["sha"]}",', ' split="train", streaming=True,', ' cache_dir="D:/cpu1/datasets",', ')', 'row = next(iter(dataset))', 'print(row.keys())', '```', '', - '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.', '', - '## Model evaluation', '', - '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.', '', - '## 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)', '', - '## 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.', ''] - (ROOT/'docs'/'model_cards'/'cpu1-ablation-dataset.md').write_text('\n'.join(lines), encoding='utf-8') + inventory = json.loads(path.read_text(encoding='utf-8')) + card = (ROOT/'docs/model_cards/cpu1-ablation-dataset.md').read_text(encoding='utf-8') + if inventory['sha'] not in card: + raise ValueError('Dataset card revision differs from the restored evidence') + for subset in ('byte_marginalized', 'bpe_tokenized'): + count = sum(f['rfilename'].startswith(subset+'/') and + f['rfilename'].endswith('.parquet') for f in inventory['siblings']) + if f'| `{subset}` | {count} |' not in card: + raise ValueError('Review the dataset card before publishing changed shard counts') def save_environment(records): @@ -283,12 +272,14 @@ def upload_cards(inventory): files = [('README.md', ROOT/'docs'/'model_cards'/f'{stem}.md')] files += [(f'evaluation/{p.name}', p) for p in sorted(OUT.glob('*.json'))] files += [('evaluation/CORPUS_LICENSE.txt', OUT/'CORPUS_LICENSE.txt')] - source_dirs = ('cpu1', 'training', 'evaluation', 'tests') - files += [(f'evaluation/source/{p.relative_to(ROOT).as_posix()}', p) - for directory in source_dirs for p in sorted((ROOT/directory).glob('*.py'))] - files += [(f'evaluation/source/requirements/{p.name}', p) - for p in sorted((ROOT/'requirements').glob('*.txt'))] - commit = api.create_commit(repo_id=repo, repo_type='model', parent_commit=parent, commit_message='Rebuild model card from reproducible CPU audit; include evidence and limitations', operations=[CommitOperationAdd(path_in_repo=name,path_or_fileobj=str(path)) for name,path in files]) + # Bundle only tracked public files, never ignored binaries/caches/secrets. + import subprocess + public_paths = subprocess.check_output(['git', 'ls-files', '-z'], cwd=ROOT).decode('utf-8').split('\0') + files += [(f'evaluation/source/{name}', ROOT/name) for name in public_paths if name] + publication = ROOT/'outputs/provenance/source-publication.json' + if publication.exists(): + files += [('evaluation/source-publication.json', publication)] + commit = api.create_commit(repo_id=repo, repo_type='model', parent_commit=parent, commit_message='Document recovered experiment sources, saved configurations and dataset limitations', operations=[CommitOperationAdd(path_in_repo=name,path_or_fileobj=str(path)) for name,path in files]) commits[repo] = {'oid': commit.oid, 'url': commit.commit_url} # Verify the actual published README bytes against the local card. from huggingface_hub import hf_hub_download diff --git a/evaluation/source/evaluation/dataset.py b/evaluation/source/evaluation/dataset.py new file mode 100644 index 0000000000000000000000000000000000000000..6a6ec09e4f3007ec162623187c7b3ce140ee31bb --- /dev/null +++ b/evaluation/source/evaluation/dataset.py @@ -0,0 +1,178 @@ +"""Inspect three pinned dataset shards without loading a teacher or model.""" +import argparse +import hashlib +import json +import os +from pathlib import Path +import sys + +REPO = "Cukinator/cpu1-ablation-dataset" +REVISION = "bd75d7b811ab730cc912aaa671f9eaaf49ba4bdf" +FILES = ("byte_marginalized/shard_0000.parquet", + "byte_marginalized/shard_0481.parquet", "bpe_tokenized/shard_0000.parquet") +EXPECTED_HASHES = { + FILES[0]: "f68a6659ef7b3ddd7c0e7066766f6d1bfbfba639c640a3aa1265b485a2420dae", + FILES[1]: "a78f45e1510308b7d6be01fbc52c4043ccc7a9ad9a0b47634e16c508496e3dd9", + FILES[2]: "684797be8d37a18ef3a31af7fc5964cf63d51b2dca1fab29894da267a1229e5b"} +ROOT = Path(__file__).resolve().parents[1] + + +def file_hash(path): + digest = hashlib.sha256() + with path.open("rb") as stream: + for chunk in iter(lambda: stream.read(1024 * 1024), b""): + digest.update(chunk) + return digest.hexdigest() + + +def inspect_shard(path, filename): + import numpy as np + import pyarrow.parquet as pq + import torch + from cpu1.components import ByteLevelDataset + digest = file_hash(path) + if digest != EXPECTED_HASHES[filename]: + raise ValueError("Sample hash differs from the reviewed dataset revision") + parquet = pq.ParquetFile(path) + first = next(parquet.iter_batches(batch_size=1)).to_pylist()[0] + result = {"file": filename, "bytes": path.stat().st_size, "sha256": digest, + "rows": parquet.metadata.num_rows, "schema": str(parquet.schema_arrow), + "first_row_lengths": {k: len(v) if isinstance(v, list) else v + for k, v in first.items()}} + if filename.startswith("byte"): + table = parquet.read() + rows = table.to_pylist() + result["rows_with_any_teacher_mask"] = sum(any(r["teacher_mask"]) for r in rows) + result["all_row_lengths"] = [{k: len(v) if isinstance(v, list) else v + for k,v in r.items()} for r in rows] + result["mask_lengths"] = sorted(set(len(r["teacher_mask"]) for r in rows)) + source = np.asarray(first["patches"]) + targets = np.asarray(first["targets"]) + result["global_shift_mismatches_first_row"] = int(np.count_nonzero(source[4:] != targets[:-4])) + result["global_shift_positions_first_row"] = len(source) - 4 + result["shift_note"] = "Comparison across the packed row; document separators/ends can differ. No targets were rewritten." + seq_len = len(source) // 4 + config = {"seq_len": seq_len, "patch_size": 4, "training_signal": "distillation", + "use_embedding_alignment": True, "teacher_dim": first["teacher_dim"]} + sample = ByteLevelDataset([first], config)[0] + stored = torch.tensor(first["teacher_probs"], dtype=torch.float32).reshape(-1, 256) + loaded = sample["teacher_probs"] + if stored.shape == loaded.shape: + result["reader_dense_comparison"] = { + "stored_nonzero_positions": int((stored.sum(-1) != 0).sum()), + "reader_nonzero_positions": int((loaded.sum(-1) != 0).sum()), + "max_absolute_difference": float((stored-loaded).abs().max()), + "mask_true_positions": int(sum(first["teacher_mask"]))} + result["short_boolean_masks"] = sum(0 < len(r["teacher_mask"]) < seq_len and + all(isinstance(x, bool) for x in r["teacher_mask"]) + for r in rows) + else: + result["global_shift_mismatches_first_row"] = sum( + a != b for a, b in zip(first["input_ids"][1:], first["labels"][:-1])) + result["global_shift_positions_first_row"] = len(first["input_ids"]) - 1 + return result + + + +def inspect_tokenizer(storage, offline=False): + from transformers import AutoTokenizer + revision = "3aab1f1954e9cc14eb9509a215f9e5ca08227a9b" + tokenizer = AutoTokenizer.from_pretrained("Qwen/Qwen2.5-3B", revision=revision, + cache_dir=storage/"hf/hub", local_files_only=offline, trust_remote_code=False) + text = "A" + chr(0x1FAE8) + "B" + encoded = tokenizer(text, return_offsets_mapping=True, add_special_tokens=False) + return {"model": "Qwen/Qwen2.5-3B", "revision": revision, + "synthetic_text_codepoints": [ord(c) for c in text], + "ids": encoded["input_ids"], "character_offsets": encoded["offset_mapping"], + "individually_decoded_codepoints": [[ord(c) for c in tokenizer.decode([i])] + for i in encoded["input_ids"]], + "individually_decoded_first_bytes": [tokenizer.decode([i]).encode("utf-8")[0] + for i in encoded["input_ids"]], + "original_emoji_first_byte": chr(0x1FAE8).encode("utf-8")[0]} + + + +def parquet_inventory(info): + return {f.rfilename: (f.size, f.lfs.sha256 if f.lfs else f.blob_id) + for f in info.siblings if f.rfilename.endswith(".parquet")} + + +def publish_card(report_path, storage): + """Publish documentation/evidence only after checking every parquet hash.""" + from huggingface_hub import HfApi, CommitOperationAdd, hf_hub_download + token = os.environ.get("HF_TOKEN") + if not token: + raise RuntimeError("Set HF_TOKEN in the environment before publishing") + api = HfApi(token=token) + if api.whoami()["name"].lower() != "cukinator": + raise ValueError("Token does not belong to the authorized repository owner") + expected = api.dataset_info(REPO, revision=REVISION, files_metadata=True) + current = api.dataset_info(REPO, files_metadata=True) + if parquet_inventory(expected) != parquet_inventory(current): + raise ValueError("Dataset files changed; review changed data before publishing") + card = ROOT/"docs/model_cards/cpu1-ablation-dataset.md" + files = [("README.md", card), ("provenance/dataset-review.json", report_path)] + for name in ("source-publication.json", "history-verification.json"): + path = ROOT/"outputs/provenance"/name + if path.exists(): + files.append(("provenance/"+name, path)) + commit = api.create_commit(repo_id=REPO, repo_type="dataset", parent_commit=current.sha, + commit_message="Document extraction history, reproducible sample checks and reader limitations", + operations=[CommitOperationAdd(path_in_repo=name, path_or_fileobj=str(path)) + for name,path in files]) + published = hf_hub_download(REPO, "README.md", repo_type="dataset", + revision=commit.oid, cache_dir=storage/"hf/hub", token=token) + if Path(published).read_bytes() != card.read_bytes(): + raise RuntimeError("Published dataset card verification failed") + result = {"repo": REPO, "oid": commit.oid, "url": commit.commit_url, + "data_inventory_unchanged": True} + (ROOT/"outputs/provenance/dataset-publication.json").write_text( + json.dumps(result,indent=2)+"\n",encoding="utf-8") + print("Published and verified dataset card:", commit.oid) + return result + + +def main(): + parser = argparse.ArgumentParser(description=__doc__) + parser.add_argument("--storage", type=Path, default=Path("D:/cpu1-readme-audit")) + parser.add_argument("--offline", action="store_true", help="Inspect previously downloaded files") + parser.add_argument("--output", type=Path, default=ROOT/"outputs/provenance/dataset-review.json") + parser.add_argument("--tokenizer", action="store_true", help="Also inspect a pinned tokenizer on synthetic UTF-8 text") + parser.add_argument("--publish-card", action="store_true", help="Publish the reviewed card/report with HF_TOKEN; parquet inventory must match") + args = parser.parse_args() + storage = args.storage.resolve() + if sys.platform == "win32" and storage.drive.upper() != "D:": + parser.error("Use D: for dataset files and caches") + samples = storage/"provenance-samples" + os.environ["HF_HOME"] = str(storage/"hf") + os.environ["HF_HUB_CACHE"] = str(storage/"hf/hub") + os.environ["HF_HUB_DISABLE_XET"] = "1" + inventory = {} + if not args.offline: + from huggingface_hub import HfApi, hf_hub_download + info = HfApi().dataset_info(REPO, revision=REVISION, files_metadata=True) + for subset in ("byte_marginalized", "bpe_tokenized"): + files = [f for f in info.siblings if f.rfilename.startswith(subset+"/") + and f.rfilename.endswith(".parquet")] + ids = sorted(int(Path(f.rfilename).stem.split("_")[-1]) for f in files) + inventory[subset] = {"files": len(files), "bytes": sum(f.size for f in files), + "min_shard": min(ids), "max_shard": max(ids), + "missing_shards": sorted(set(range(min(ids), max(ids)+1))-set(ids))} + for filename in FILES: + hf_hub_download(REPO, filename, repo_type="dataset", revision=REVISION, + local_dir=samples, cache_dir=storage/"hf/hub") + records = [inspect_shard(samples/filename, filename) for filename in FILES] + result = {"dataset": REPO, "revision": REVISION, "inventory": inventory, + "scope": "Three shard footers; all lengths/teacher masks in two byte shards; first BPE row. Not dataset-wide validation.", + "records": records} + if args.tokenizer: + result["tokenizer_conversion"] = inspect_tokenizer(storage, args.offline) + args.output.parent.mkdir(parents=True, exist_ok=True) + args.output.write_text(json.dumps(result, indent=2)+"\n", encoding="utf-8") + print(json.dumps({**result, "records": [{k:v for k,v in r.items() if k not in ("schema", "all_row_lengths")} for r in records]}, indent=2)) + if args.publish_card: + publish_card(args.output, storage) + + +if __name__ == "__main__": + main() diff --git a/evaluation/source/experiments/README.md b/evaluation/source/experiments/README.md new file mode 100644 index 0000000000000000000000000000000000000000..805b8592879940401616dfae121185908a48e704 --- /dev/null +++ b/evaluation/source/experiments/README.md @@ -0,0 +1,16 @@ +# Published experiment records + +`published/manifest.json` links 34 FP32 exports to configuration JSON, model SHA-256, saved step, parameter count and the pinned audit result. See [the provenance review](../docs/provenance/README.md) for source history and platform recipes. + +These configuration records preserve published architecture and budget settings. They were recorded by the evaluation loader, which disabled gradient checkpointing; GPU training enables it. They do not pin the exact original training source or environment. + +```powershell +python -m training.ablation --run run_04_v3 --config experiments/published/configs/run_04_v3.json --skip-install +python -m training.ablation_amd --run run_04_v3 --config experiments/published/configs/run_04_v3.json --skip-install +``` + +These commands start real training. They need suitable hardware, dependencies and dataset access. Use the backend appropriate to the machine, and configure your own upload destination in a copied config before a new run. The historical `checkpoint_repo` value is preserved as provenance. + +For an intermediate training checkpoint, append `--resume_ckpt PATH`. The recorded configuration must match the checkpoint and source. The recovery review did not perform a training-resume test or retrain models. An inference-only packed final is not equivalent to a full optimizer checkpoint. + +Without `--config`, the CLI uses current presets and rejects unknown names such as `run_04_v3`. With an explicit configuration, phase defaults to its recorded `_current_phase` (or 1); another phase requires an explicit selection and appropriate checkpoint. Historical reports in Git and the October CPU evaluation use different protocols and remain distinct. diff --git a/evaluation/source/experiments/published/configs/run_01.json b/evaluation/source/experiments/published/configs/run_01.json new file mode 100644 index 0000000000000000000000000000000000000000..6452986c4f3ec7f753bce07b2997f98e047b9fd9 --- /dev/null +++ b/evaluation/source/experiments/published/configs/run_01.json @@ -0,0 +1,67 @@ +{ + "d_model": 512, + "n_layers": 12, + "d_ff": 1376, + "fp_rank": 0, + "n_heads": 8, + "head_dim": 64, + "window_size": 512, + "pfnet_hidden": 0, + "batch_per_gpu": 8, + "gradient_accumulation_steps": 3, + "lr": 0.0003, + "min_lr": 3e-05, + "warmup_steps": 50, + "total_steps": 912, + "weight_decay_bitlinear": 0.1, + "weight_decay_fpresidual": 0.0, + "weight_decay_heads": 0.01, + "grad_clip": 1.0, + "seed": 42, + "training_signal": "ce_only", + "temperature": 4.0, + "alpha_kl": 0.9, + "alpha_ce": 0.1, + "dataset_repo": "HuggingFaceFW/fineweb", + "seq_len": 5000, + "patch_size": 4, + "use_local_decoder": true, + "local_decoder_dim": 128, + "local_decoder_heads": 4, + "local_decoder_ff_ratio": 4.0, + "local_decoder_fp16": false, + "checkpoint_repo": "Cukinator/cpu1-ablation-checkpoints", + "save_every_steps": 45, + "checkpoint_fraction": 0.05, + "log_every_steps": 500, + "chinchilla": true, + "chinchilla_tokens_per_param": 2, + "warmup_ratio": 0.05, + "target_elimination": 0.4, + "mlgru_use_wo": true, + "mlgru_state_expansion": 1, + "delete_gate_hard": true, + "delete_gate_gumbel": true, + "delete_gate_merge": true, + "delete_gate_bimodal_lambda": 0.05, + "bolmo_cross_attn_heads": 2, + "bolmo_cross_patch_window": 3, + "bolmo_causal_boundary": false, + "bolmo_causal_cross_patch": false, + "use_real_gather": false, + "phase2_budget_fraction": 0.5, + "use_ternary": false, + "use_boundary_predictor": false, + "use_delete_gate": false, + "use_embedding_alignment": false, + "name": "transformer_bpe_fp16", + "token_mixer": "transformer", + "tokenization": "bpe", + "quantization": "fp16", + "fp_residual": false, + "bpe_vocab_size": 16384, + "description": "Absolute baseline β€” FP16 Transformer, BPE tokens (16K vocab), CE-only.", + "cites": [], + "_current_phase": 1, + "use_gradient_checkpointing": false +} diff --git a/evaluation/source/experiments/published/configs/run_01_v3.json b/evaluation/source/experiments/published/configs/run_01_v3.json new file mode 100644 index 0000000000000000000000000000000000000000..6bb5cb1e0ce78fe28a62b4209ba35714fd0fb450 --- /dev/null +++ b/evaluation/source/experiments/published/configs/run_01_v3.json @@ -0,0 +1,68 @@ +{ + "d_model": 512, + "n_layers": 12, + "d_ff": 1376, + "fp_rank": 0, + "n_heads": 8, + "head_dim": 64, + "window_size": 512, + "pfnet_hidden": 0, + "batch_per_gpu": 8, + "gradient_accumulation_steps": 3, + "lr": 0.0003, + "min_lr": 3e-05, + "warmup_steps": 3420, + "total_steps": 68419, + "weight_decay_bitlinear": 0.1, + "weight_decay_fpresidual": 0.0, + "weight_decay_heads": 0.01, + "bitlinear_lr_scale": 2.0, + "grad_clip": 1.0, + "seed": 42, + "training_signal": "ce_only", + "temperature": 4.0, + "alpha_kl": 0.9, + "alpha_ce": 0.1, + "dataset_repo": "HuggingFaceFW/fineweb", + "seq_len": 5000, + "patch_size": 4, + "use_local_decoder": true, + "local_decoder_dim": 128, + "local_decoder_heads": 4, + "local_decoder_ff_ratio": 4.0, + "local_decoder_fp16": false, + "checkpoint_repo": "Cukinator/cpu1-ablation-checkpoints-v3", + "save_every_steps": 3420, + "checkpoint_fraction": 0.05, + "log_every_steps": 500, + "chinchilla": true, + "chinchilla_tokens_per_param": 150, + "warmup_ratio": 0.05, + "target_elimination": 0.4, + "mlgru_use_wo": true, + "mlgru_state_expansion": 1, + "delete_gate_hard": true, + "delete_gate_gumbel": true, + "delete_gate_merge": true, + "delete_gate_bimodal_lambda": 0.05, + "bolmo_cross_attn_heads": 2, + "bolmo_cross_patch_window": 3, + "bolmo_causal_boundary": false, + "bolmo_causal_cross_patch": false, + "use_real_gather": false, + "phase2_budget_fraction": 0.5, + "use_ternary": false, + "use_boundary_predictor": false, + "use_delete_gate": false, + "use_embedding_alignment": false, + "name": "transformer_bpe_fp16", + "token_mixer": "transformer", + "tokenization": "bpe", + "quantization": "fp16", + "fp_residual": false, + "bpe_vocab_size": 16384, + "description": "Absolute baseline β€” FP16 Transformer, BPE tokens (16K vocab), CE-only.", + "cites": [], + "_current_phase": 1, + "use_gradient_checkpointing": false +} diff --git a/evaluation/source/experiments/published/configs/run_02.json b/evaluation/source/experiments/published/configs/run_02.json new file mode 100644 index 0000000000000000000000000000000000000000..d9756cbf93d71e1e7ebf12d78c6b81b26717ea19 --- /dev/null +++ b/evaluation/source/experiments/published/configs/run_02.json @@ -0,0 +1,68 @@ +{ + "d_model": 512, + "n_layers": 12, + "d_ff": 1376, + "fp_rank": 0, + "n_heads": 8, + "head_dim": 64, + "window_size": 512, + "pfnet_hidden": 0, + "batch_per_gpu": 8, + "gradient_accumulation_steps": 3, + "lr": 0.0003, + "min_lr": 3e-05, + "warmup_steps": 50, + "total_steps": 647, + "weight_decay_bitlinear": 0.1, + "weight_decay_fpresidual": 0.0, + "weight_decay_heads": 0.01, + "grad_clip": 1.0, + "seed": 42, + "training_signal": "ce_only", + "temperature": 4.0, + "alpha_kl": 0.9, + "alpha_ce": 0.1, + "dataset_repo": "HuggingFaceFW/fineweb", + "seq_len": 5000, + "patch_size": 4, + "use_local_decoder": true, + "local_decoder_dim": 128, + "local_decoder_heads": 4, + "local_decoder_ff_ratio": 4.0, + "local_decoder_fp16": false, + "checkpoint_repo": "Cukinator/cpu1-ablation-checkpoints", + "save_every_steps": 32, + "checkpoint_fraction": 0.05, + "log_every_steps": 500, + "chinchilla": true, + "chinchilla_tokens_per_param": 2, + "warmup_ratio": 0.05, + "target_elimination": 0.4, + "mlgru_use_wo": true, + "mlgru_state_expansion": 1, + "delete_gate_hard": true, + "delete_gate_gumbel": true, + "delete_gate_merge": true, + "delete_gate_bimodal_lambda": 0.05, + "bolmo_cross_attn_heads": 2, + "bolmo_cross_patch_window": 3, + "bolmo_causal_boundary": false, + "bolmo_causal_cross_patch": false, + "use_real_gather": false, + "phase2_budget_fraction": 0.5, + "use_ternary": false, + "use_boundary_predictor": false, + "use_delete_gate": false, + "use_embedding_alignment": false, + "name": "transformer_byte_fp16", + "token_mixer": "transformer", + "tokenization": "byte", + "quantization": "fp16", + "fp_residual": false, + "description": "+Byte patches + LocalByteDecoder β€” adds MegaByte intra-patch autoregression on top of run_02a.", + "cites": [ + "MegaByte (Yu et al., 2023)" + ], + "_current_phase": 1, + "use_gradient_checkpointing": false +} diff --git a/evaluation/source/experiments/published/configs/run_02_v3.json b/evaluation/source/experiments/published/configs/run_02_v3.json new file mode 100644 index 0000000000000000000000000000000000000000..f7ef12305c518a6f5abbf0f398c46e8f400693d5 --- /dev/null +++ b/evaluation/source/experiments/published/configs/run_02_v3.json @@ -0,0 +1,69 @@ +{ + "d_model": 512, + "n_layers": 12, + "d_ff": 1376, + "fp_rank": 0, + "n_heads": 8, + "head_dim": 64, + "window_size": 512, + "pfnet_hidden": 0, + "batch_per_gpu": 8, + "gradient_accumulation_steps": 3, + "lr": 0.0003, + "min_lr": 3e-05, + "warmup_steps": 2426, + "total_steps": 48536, + "weight_decay_bitlinear": 0.1, + "weight_decay_fpresidual": 0.0, + "weight_decay_heads": 0.01, + "bitlinear_lr_scale": 2.0, + "grad_clip": 1.0, + "seed": 42, + "training_signal": "ce_only", + "temperature": 4.0, + "alpha_kl": 0.9, + "alpha_ce": 0.1, + "dataset_repo": "HuggingFaceFW/fineweb", + "seq_len": 5000, + "patch_size": 4, + "use_local_decoder": true, + "local_decoder_dim": 128, + "local_decoder_heads": 4, + "local_decoder_ff_ratio": 4.0, + "local_decoder_fp16": false, + "checkpoint_repo": "Cukinator/cpu1-ablation-checkpoints-v3", + "save_every_steps": 2426, + "checkpoint_fraction": 0.05, + "log_every_steps": 500, + "chinchilla": true, + "chinchilla_tokens_per_param": 150, + "warmup_ratio": 0.05, + "target_elimination": 0.4, + "mlgru_use_wo": true, + "mlgru_state_expansion": 1, + "delete_gate_hard": true, + "delete_gate_gumbel": true, + "delete_gate_merge": true, + "delete_gate_bimodal_lambda": 0.05, + "bolmo_cross_attn_heads": 2, + "bolmo_cross_patch_window": 3, + "bolmo_causal_boundary": false, + "bolmo_causal_cross_patch": false, + "use_real_gather": false, + "phase2_budget_fraction": 0.5, + "use_ternary": false, + "use_boundary_predictor": false, + "use_delete_gate": false, + "use_embedding_alignment": false, + "name": "transformer_byte_fp16", + "token_mixer": "transformer", + "tokenization": "byte", + "quantization": "fp16", + "fp_residual": false, + "description": "+Byte patches + LocalByteDecoder β€” adds MegaByte intra-patch autoregression on top of run_02a.", + "cites": [ + "MegaByte (Yu et al., 2023)" + ], + "_current_phase": 1, + "use_gradient_checkpointing": false +} diff --git a/evaluation/source/experiments/published/configs/run_02a_byte_only_heads.json b/evaluation/source/experiments/published/configs/run_02a_byte_only_heads.json new file mode 100644 index 0000000000000000000000000000000000000000..520def7efb74d9479041660dfe91405c041920f2 --- /dev/null +++ b/evaluation/source/experiments/published/configs/run_02a_byte_only_heads.json @@ -0,0 +1,68 @@ +{ + "d_model": 512, + "n_layers": 12, + "d_ff": 1376, + "fp_rank": 0, + "n_heads": 8, + "head_dim": 64, + "window_size": 512, + "pfnet_hidden": 0, + "batch_per_gpu": 8, + "gradient_accumulation_steps": 3, + "lr": 0.0003, + "min_lr": 3e-05, + "warmup_steps": 50, + "total_steps": 641, + "weight_decay_bitlinear": 0.1, + "weight_decay_fpresidual": 0.0, + "weight_decay_heads": 0.01, + "grad_clip": 1.0, + "seed": 42, + "training_signal": "ce_only", + "temperature": 4.0, + "alpha_kl": 0.9, + "alpha_ce": 0.1, + "dataset_repo": "HuggingFaceFW/fineweb", + "seq_len": 5000, + "patch_size": 4, + "use_local_decoder": false, + "local_decoder_dim": 128, + "local_decoder_heads": 4, + "local_decoder_ff_ratio": 4.0, + "local_decoder_fp16": false, + "checkpoint_repo": "Cukinator/cpu1-ablation-checkpoints", + "save_every_steps": 32, + "checkpoint_fraction": 0.05, + "log_every_steps": 500, + "chinchilla": true, + "chinchilla_tokens_per_param": 2, + "warmup_ratio": 0.05, + "target_elimination": 0.4, + "mlgru_use_wo": true, + "mlgru_state_expansion": 1, + "delete_gate_hard": true, + "delete_gate_gumbel": true, + "delete_gate_merge": true, + "delete_gate_bimodal_lambda": 0.05, + "bolmo_cross_attn_heads": 2, + "bolmo_cross_patch_window": 3, + "bolmo_causal_boundary": false, + "bolmo_causal_cross_patch": false, + "use_real_gather": false, + "phase2_budget_fraction": 0.5, + "use_ternary": false, + "use_boundary_predictor": false, + "use_delete_gate": false, + "use_embedding_alignment": false, + "name": "transformer_byte_fp16_no_lbd", + "token_mixer": "transformer", + "tokenization": "byte", + "quantization": "fp16", + "fp_residual": false, + "description": "+Byte patches (no LocalByteDecoder) β€” FP16 Transformer + 4 independent byte heads. Pure tokenization isolation.", + "cites": [ + "MegaByte (Yu et al., 2023)" + ], + "_current_phase": 1, + "use_gradient_checkpointing": false +} diff --git a/evaluation/source/experiments/published/configs/run_02a_byte_only_heads_v3.json b/evaluation/source/experiments/published/configs/run_02a_byte_only_heads_v3.json new file mode 100644 index 0000000000000000000000000000000000000000..155f7fee143fed2dd103a8e4defab717d9a6a0b9 --- /dev/null +++ b/evaluation/source/experiments/published/configs/run_02a_byte_only_heads_v3.json @@ -0,0 +1,69 @@ +{ + "d_model": 512, + "n_layers": 12, + "d_ff": 1376, + "fp_rank": 0, + "n_heads": 8, + "head_dim": 64, + "window_size": 512, + "pfnet_hidden": 0, + "batch_per_gpu": 8, + "gradient_accumulation_steps": 3, + "lr": 0.0003, + "min_lr": 3e-05, + "warmup_steps": 2406, + "total_steps": 48126, + "weight_decay_bitlinear": 0.1, + "weight_decay_fpresidual": 0.0, + "weight_decay_heads": 0.01, + "bitlinear_lr_scale": 2.0, + "grad_clip": 1.0, + "seed": 42, + "training_signal": "ce_only", + "temperature": 4.0, + "alpha_kl": 0.9, + "alpha_ce": 0.1, + "dataset_repo": "HuggingFaceFW/fineweb", + "seq_len": 5000, + "patch_size": 4, + "use_local_decoder": false, + "local_decoder_dim": 128, + "local_decoder_heads": 4, + "local_decoder_ff_ratio": 4.0, + "local_decoder_fp16": false, + "checkpoint_repo": "Cukinator/cpu1-ablation-checkpoints-v3", + "save_every_steps": 2406, + "checkpoint_fraction": 0.05, + "log_every_steps": 500, + "chinchilla": true, + "chinchilla_tokens_per_param": 150, + "warmup_ratio": 0.05, + "target_elimination": 0.4, + "mlgru_use_wo": true, + "mlgru_state_expansion": 1, + "delete_gate_hard": true, + "delete_gate_gumbel": true, + "delete_gate_merge": true, + "delete_gate_bimodal_lambda": 0.05, + "bolmo_cross_attn_heads": 2, + "bolmo_cross_patch_window": 3, + "bolmo_causal_boundary": false, + "bolmo_causal_cross_patch": false, + "use_real_gather": false, + "phase2_budget_fraction": 0.5, + "use_ternary": false, + "use_boundary_predictor": false, + "use_delete_gate": false, + "use_embedding_alignment": false, + "name": "transformer_byte_fp16_no_lbd", + "token_mixer": "transformer", + "tokenization": "byte", + "quantization": "fp16", + "fp_residual": false, + "description": "+Byte patches (no LocalByteDecoder) β€” FP16 Transformer + 4 independent byte heads. Pure tokenization isolation.", + "cites": [ + "MegaByte (Yu et al., 2023)" + ], + "_current_phase": 1, + "use_gradient_checkpointing": false +} diff --git a/evaluation/source/experiments/published/configs/run_03.json b/evaluation/source/experiments/published/configs/run_03.json new file mode 100644 index 0000000000000000000000000000000000000000..a2b0f13a8bbd165e471036df4dc4006b7f7c4490 --- /dev/null +++ b/evaluation/source/experiments/published/configs/run_03.json @@ -0,0 +1,69 @@ +{ + "d_model": 512, + "n_layers": 12, + "d_ff": 1376, + "fp_rank": 0, + "n_heads": 8, + "head_dim": 64, + "window_size": 512, + "pfnet_hidden": 0, + "batch_per_gpu": 8, + "gradient_accumulation_steps": 3, + "lr": 0.0003, + "min_lr": 3e-05, + "warmup_steps": 50, + "total_steps": 647, + "weight_decay_bitlinear": 0.1, + "weight_decay_fpresidual": 0.0, + "weight_decay_heads": 0.01, + "grad_clip": 1.0, + "seed": 42, + "training_signal": "ce_only", + "temperature": 4.0, + "alpha_kl": 0.9, + "alpha_ce": 0.1, + "dataset_repo": "HuggingFaceFW/fineweb", + "seq_len": 5000, + "patch_size": 4, + "use_local_decoder": true, + "local_decoder_dim": 128, + "local_decoder_heads": 4, + "local_decoder_ff_ratio": 4.0, + "local_decoder_fp16": false, + "checkpoint_repo": "Cukinator/cpu1-ablation-checkpoints", + "save_every_steps": 32, + "checkpoint_fraction": 0.05, + "log_every_steps": 500, + "chinchilla": true, + "chinchilla_tokens_per_param": 2, + "warmup_ratio": 0.05, + "target_elimination": 0.4, + "mlgru_use_wo": true, + "mlgru_state_expansion": 1, + "delete_gate_hard": true, + "delete_gate_gumbel": true, + "delete_gate_merge": true, + "delete_gate_bimodal_lambda": 0.05, + "bolmo_cross_attn_heads": 2, + "bolmo_cross_patch_window": 3, + "bolmo_causal_boundary": false, + "bolmo_causal_cross_patch": false, + "use_real_gather": false, + "phase2_budget_fraction": 0.5, + "use_ternary": false, + "use_boundary_predictor": false, + "use_delete_gate": false, + "use_embedding_alignment": false, + "name": "mlgru_byte_fp16", + "token_mixer": "mlgru", + "tokenization": "byte", + "quantization": "fp16", + "fp_residual": false, + "description": "MLGRU + byte patches, FP16. Combined mixer+tokenization.", + "cites": [ + "MatMul-free LM", + "MegaByte (Yu et al., 2023)" + ], + "_current_phase": 1, + "use_gradient_checkpointing": false +} diff --git a/evaluation/source/experiments/published/configs/run_03_v3.json b/evaluation/source/experiments/published/configs/run_03_v3.json new file mode 100644 index 0000000000000000000000000000000000000000..701b8992ebc78d53731cc55ceacd3af946585d9e --- /dev/null +++ b/evaluation/source/experiments/published/configs/run_03_v3.json @@ -0,0 +1,70 @@ +{ + "d_model": 512, + "n_layers": 12, + "d_ff": 1376, + "fp_rank": 0, + "n_heads": 8, + "head_dim": 64, + "window_size": 512, + "pfnet_hidden": 0, + "batch_per_gpu": 8, + "gradient_accumulation_steps": 3, + "lr": 0.0003, + "min_lr": 3e-05, + "warmup_steps": 2426, + "total_steps": 48536, + "weight_decay_bitlinear": 0.1, + "weight_decay_fpresidual": 0.0, + "weight_decay_heads": 0.01, + "bitlinear_lr_scale": 2.0, + "grad_clip": 1.0, + "seed": 42, + "training_signal": "ce_only", + "temperature": 4.0, + "alpha_kl": 0.9, + "alpha_ce": 0.1, + "dataset_repo": "HuggingFaceFW/fineweb", + "seq_len": 5000, + "patch_size": 4, + "use_local_decoder": true, + "local_decoder_dim": 128, + "local_decoder_heads": 4, + "local_decoder_ff_ratio": 4.0, + "local_decoder_fp16": false, + "checkpoint_repo": "Cukinator/cpu1-ablation-checkpoints-v3", + "save_every_steps": 2426, + "checkpoint_fraction": 0.05, + "log_every_steps": 500, + "chinchilla": true, + "chinchilla_tokens_per_param": 150, + "warmup_ratio": 0.05, + "target_elimination": 0.4, + "mlgru_use_wo": true, + "mlgru_state_expansion": 1, + "delete_gate_hard": true, + "delete_gate_gumbel": true, + "delete_gate_merge": true, + "delete_gate_bimodal_lambda": 0.05, + "bolmo_cross_attn_heads": 2, + "bolmo_cross_patch_window": 3, + "bolmo_causal_boundary": false, + "bolmo_causal_cross_patch": false, + "use_real_gather": false, + "phase2_budget_fraction": 0.5, + "use_ternary": false, + "use_boundary_predictor": false, + "use_delete_gate": false, + "use_embedding_alignment": false, + "name": "mlgru_byte_fp16", + "token_mixer": "mlgru", + "tokenization": "byte", + "quantization": "fp16", + "fp_residual": false, + "description": "MLGRU + byte patches, FP16. Combined mixer+tokenization.", + "cites": [ + "MatMul-free LM", + "MegaByte (Yu et al., 2023)" + ], + "_current_phase": 1, + "use_gradient_checkpointing": false +} diff --git a/evaluation/source/experiments/published/configs/run_04.json b/evaluation/source/experiments/published/configs/run_04.json new file mode 100644 index 0000000000000000000000000000000000000000..71c63ee2ffcbc8b74da644a3628fb48dabaf952d --- /dev/null +++ b/evaluation/source/experiments/published/configs/run_04.json @@ -0,0 +1,69 @@ +{ + "d_model": 512, + "n_layers": 12, + "d_ff": 1376, + "fp_rank": 0, + "n_heads": 8, + "head_dim": 64, + "window_size": 512, + "pfnet_hidden": 0, + "batch_per_gpu": 8, + "gradient_accumulation_steps": 3, + "lr": 0.0003, + "min_lr": 3e-05, + "warmup_steps": 50, + "total_steps": 647, + "weight_decay_bitlinear": 0.1, + "weight_decay_fpresidual": 0.0, + "weight_decay_heads": 0.01, + "grad_clip": 1.0, + "seed": 42, + "training_signal": "ce_only", + "temperature": 4.0, + "alpha_kl": 0.9, + "alpha_ce": 0.1, + "dataset_repo": "HuggingFaceFW/fineweb", + "seq_len": 5000, + "patch_size": 4, + "use_local_decoder": true, + "local_decoder_dim": 128, + "local_decoder_heads": 4, + "local_decoder_ff_ratio": 4.0, + "local_decoder_fp16": false, + "checkpoint_repo": "Cukinator/cpu1-ablation-checkpoints", + "save_every_steps": 32, + "checkpoint_fraction": 0.05, + "log_every_steps": 500, + "chinchilla": true, + "chinchilla_tokens_per_param": 2, + "warmup_ratio": 0.05, + "target_elimination": 0.4, + "mlgru_use_wo": true, + "mlgru_state_expansion": 1, + "delete_gate_hard": true, + "delete_gate_gumbel": true, + "delete_gate_merge": true, + "delete_gate_bimodal_lambda": 0.05, + "bolmo_cross_attn_heads": 2, + "bolmo_cross_patch_window": 3, + "bolmo_causal_boundary": false, + "bolmo_causal_cross_patch": false, + "use_real_gather": false, + "phase2_budget_fraction": 0.5, + "use_ternary": true, + "use_boundary_predictor": false, + "use_delete_gate": false, + "use_embedding_alignment": false, + "name": "mlgru_byte_ternary", + "token_mixer": "mlgru", + "tokenization": "byte", + "quantization": "ternary", + "fp_residual": false, + "description": "+Ternary β€” 1.58-bit weights on MLGRU+byte. Isolates quantization cost.", + "cites": [ + "BitNet b1.58 (Wang et al., 2024)", + "MatMul-free LM" + ], + "_current_phase": 1, + "use_gradient_checkpointing": false +} diff --git a/evaluation/source/experiments/published/configs/run_04_r2.json b/evaluation/source/experiments/published/configs/run_04_r2.json new file mode 100644 index 0000000000000000000000000000000000000000..a0971b1dd1917faea6663bbbcd4a5a5cb5c589ad --- /dev/null +++ b/evaluation/source/experiments/published/configs/run_04_r2.json @@ -0,0 +1,65 @@ +{ + "d_model": 512, + "n_layers": 12, + "d_ff": 1376, + "fp_rank": 0, + "n_heads": 8, + "head_dim": 64, + "window_size": 512, + "pfnet_hidden": 0, + "batch_per_gpu": 8, + "gradient_accumulation_steps": 3, + "lr": 0.0003, + "min_lr": 3e-05, + "warmup_steps": 242, + "total_steps": 4856, + "weight_decay_bitlinear": 0.1, + "weight_decay_fpresidual": 0.0, + "weight_decay_heads": 0.01, + "grad_clip": 1.0, + "seed": 42, + "training_signal": "ce_only", + "temperature": 4.0, + "alpha_kl": 0.9, + "alpha_ce": 0.1, + "dataset_repo": "HuggingFaceFW/fineweb", + "seq_len": 5000, + "patch_size": 4, + "use_local_decoder": true, + "local_decoder_dim": 128, + "local_decoder_heads": 4, + "local_decoder_ff_ratio": 4.0, + "local_decoder_fp16": false, + "checkpoint_repo": "Cukinator/cpu1-ablation-checkpoints", + "save_every_steps": 242, + "checkpoint_fraction": 0.05, + "log_every_steps": 500, + "chinchilla": true, + "chinchilla_tokens_per_param": 15, + "warmup_ratio": 0.05, + "target_elimination": 0.4, + "mlgru_use_wo": true, + "mlgru_state_expansion": 1, + "delete_gate_hard": true, + "delete_gate_gumbel": true, + "delete_gate_merge": true, + "delete_gate_bimodal_lambda": 0.05, + "bolmo_cross_attn_heads": 2, + "bolmo_cross_patch_window": 3, + "bolmo_causal_boundary": false, + "bolmo_causal_cross_patch": false, + "use_real_gather": false, + "phase2_budget_fraction": 0.5, + "use_ternary": true, + "use_boundary_predictor": false, + "use_delete_gate": false, + "use_embedding_alignment": false, + "name": "mlgru_byte_ternary_15t", + "token_mixer": "mlgru", + "tokenization": "byte_dynamic", + "quantization": "ternary", + "fp_residual": false, + "description": "run_04 at 15 tok/param β€” ternary baseline with real budget.", + "_current_phase": 1, + "use_gradient_checkpointing": false +} diff --git a/evaluation/source/experiments/published/configs/run_04_v3.json b/evaluation/source/experiments/published/configs/run_04_v3.json new file mode 100644 index 0000000000000000000000000000000000000000..1e9321992542d12f67bd187ab13fbeeb6d7e5112 --- /dev/null +++ b/evaluation/source/experiments/published/configs/run_04_v3.json @@ -0,0 +1,70 @@ +{ + "d_model": 512, + "n_layers": 12, + "d_ff": 1376, + "fp_rank": 0, + "n_heads": 8, + "head_dim": 64, + "window_size": 512, + "pfnet_hidden": 0, + "batch_per_gpu": 8, + "gradient_accumulation_steps": 3, + "lr": 0.0003, + "min_lr": 3e-05, + "warmup_steps": 2428, + "total_steps": 48567, + "weight_decay_bitlinear": 0.1, + "weight_decay_fpresidual": 0.0, + "weight_decay_heads": 0.01, + "bitlinear_lr_scale": 2.0, + "grad_clip": 1.0, + "seed": 42, + "training_signal": "ce_only", + "temperature": 4.0, + "alpha_kl": 0.9, + "alpha_ce": 0.1, + "dataset_repo": "HuggingFaceFW/fineweb", + "seq_len": 5000, + "patch_size": 4, + "use_local_decoder": true, + "local_decoder_dim": 128, + "local_decoder_heads": 4, + "local_decoder_ff_ratio": 4.0, + "local_decoder_fp16": false, + "checkpoint_repo": "Cukinator/cpu1-ablation-checkpoints-v3", + "save_every_steps": 2428, + "checkpoint_fraction": 0.05, + "log_every_steps": 500, + "chinchilla": true, + "chinchilla_tokens_per_param": 150, + "warmup_ratio": 0.05, + "target_elimination": 0.4, + "mlgru_use_wo": true, + "mlgru_state_expansion": 1, + "delete_gate_hard": true, + "delete_gate_gumbel": true, + "delete_gate_merge": true, + "delete_gate_bimodal_lambda": 0.05, + "bolmo_cross_attn_heads": 2, + "bolmo_cross_patch_window": 3, + "bolmo_causal_boundary": false, + "bolmo_causal_cross_patch": false, + "use_real_gather": false, + "phase2_budget_fraction": 0.5, + "use_ternary": true, + "use_boundary_predictor": false, + "use_delete_gate": false, + "use_embedding_alignment": false, + "name": "mlgru_byte_ternary", + "token_mixer": "mlgru", + "tokenization": "byte", + "quantization": "ternary", + "fp_residual": false, + "description": "+Ternary β€” 1.58-bit weights on MLGRU+byte. Isolates quantization cost.", + "cites": [ + "BitNet b1.58 (Wang et al., 2024)", + "MatMul-free LM" + ], + "_current_phase": 1, + "use_gradient_checkpointing": false +} diff --git a/evaluation/source/experiments/published/configs/run_05.json b/evaluation/source/experiments/published/configs/run_05.json new file mode 100644 index 0000000000000000000000000000000000000000..e73ad7d21b5b24357c3072a34c5a4b2eafb8fa74 --- /dev/null +++ b/evaluation/source/experiments/published/configs/run_05.json @@ -0,0 +1,69 @@ +{ + "d_model": 512, + "n_layers": 12, + "d_ff": 1376, + "fp_rank": 4, + "n_heads": 8, + "head_dim": 64, + "window_size": 512, + "pfnet_hidden": 0, + "batch_per_gpu": 8, + "gradient_accumulation_steps": 3, + "lr": 0.0003, + "min_lr": 3e-05, + "warmup_steps": 50, + "total_steps": 649, + "weight_decay_bitlinear": 0.1, + "weight_decay_fpresidual": 0.0, + "weight_decay_heads": 0.01, + "grad_clip": 1.0, + "seed": 42, + "training_signal": "ce_only", + "temperature": 4.0, + "alpha_kl": 0.9, + "alpha_ce": 0.1, + "dataset_repo": "HuggingFaceFW/fineweb", + "seq_len": 5000, + "patch_size": 4, + "use_local_decoder": true, + "local_decoder_dim": 128, + "local_decoder_heads": 4, + "local_decoder_ff_ratio": 4.0, + "local_decoder_fp16": false, + "checkpoint_repo": "Cukinator/cpu1-ablation-checkpoints", + "save_every_steps": 32, + "checkpoint_fraction": 0.05, + "log_every_steps": 500, + "chinchilla": true, + "chinchilla_tokens_per_param": 2, + "warmup_ratio": 0.05, + "target_elimination": 0.4, + "mlgru_use_wo": true, + "mlgru_state_expansion": 1, + "delete_gate_hard": true, + "delete_gate_gumbel": true, + "delete_gate_merge": true, + "delete_gate_bimodal_lambda": 0.05, + "bolmo_cross_attn_heads": 2, + "bolmo_cross_patch_window": 3, + "bolmo_causal_boundary": false, + "bolmo_causal_cross_patch": false, + "use_real_gather": false, + "phase2_budget_fraction": 0.5, + "use_ternary": true, + "use_boundary_predictor": false, + "use_delete_gate": false, + "use_embedding_alignment": false, + "name": "mlgru_byte_ternary_fpres", + "token_mixer": "mlgru", + "tokenization": "byte", + "quantization": "ternary", + "fp_residual": true, + "description": "+FPResidual β€” low-rank FP16 correction alongside ternary weights. CPU-1 core architecture.", + "cites": [ + "Slender-Mamba (Yu et al., 2025)", + "BitNet b1.58" + ], + "_current_phase": 1, + "use_gradient_checkpointing": false +} diff --git a/evaluation/source/experiments/published/configs/run_05_v3.json b/evaluation/source/experiments/published/configs/run_05_v3.json new file mode 100644 index 0000000000000000000000000000000000000000..ef6e666374ec74b002a2af82c5ea27ee6e832a76 --- /dev/null +++ b/evaluation/source/experiments/published/configs/run_05_v3.json @@ -0,0 +1,70 @@ +{ + "d_model": 512, + "n_layers": 12, + "d_ff": 1376, + "fp_rank": 4, + "n_heads": 8, + "head_dim": 64, + "window_size": 512, + "pfnet_hidden": 0, + "batch_per_gpu": 8, + "gradient_accumulation_steps": 3, + "lr": 0.0003, + "min_lr": 3e-05, + "warmup_steps": 2437, + "total_steps": 48742, + "weight_decay_bitlinear": 0.1, + "weight_decay_fpresidual": 0.0, + "weight_decay_heads": 0.01, + "bitlinear_lr_scale": 2.0, + "grad_clip": 1.0, + "seed": 42, + "training_signal": "ce_only", + "temperature": 4.0, + "alpha_kl": 0.9, + "alpha_ce": 0.1, + "dataset_repo": "HuggingFaceFW/fineweb", + "seq_len": 5000, + "patch_size": 4, + "use_local_decoder": true, + "local_decoder_dim": 128, + "local_decoder_heads": 4, + "local_decoder_ff_ratio": 4.0, + "local_decoder_fp16": false, + "checkpoint_repo": "Cukinator/cpu1-ablation-checkpoints-v3", + "save_every_steps": 2437, + "checkpoint_fraction": 0.05, + "log_every_steps": 500, + "chinchilla": true, + "chinchilla_tokens_per_param": 150, + "warmup_ratio": 0.05, + "target_elimination": 0.4, + "mlgru_use_wo": true, + "mlgru_state_expansion": 1, + "delete_gate_hard": true, + "delete_gate_gumbel": true, + "delete_gate_merge": true, + "delete_gate_bimodal_lambda": 0.05, + "bolmo_cross_attn_heads": 2, + "bolmo_cross_patch_window": 3, + "bolmo_causal_boundary": false, + "bolmo_causal_cross_patch": false, + "use_real_gather": false, + "phase2_budget_fraction": 0.5, + "use_ternary": true, + "use_boundary_predictor": false, + "use_delete_gate": false, + "use_embedding_alignment": false, + "name": "mlgru_byte_ternary_fpres", + "token_mixer": "mlgru", + "tokenization": "byte", + "quantization": "ternary", + "fp_residual": true, + "description": "+FPResidual β€” low-rank FP16 correction alongside ternary weights. CPU-1 core architecture.", + "cites": [ + "Slender-Mamba (Yu et al., 2025)", + "BitNet b1.58" + ], + "_current_phase": 1, + "use_gradient_checkpointing": false +} diff --git a/evaluation/source/experiments/published/configs/run_05b_kernel_strict.json b/evaluation/source/experiments/published/configs/run_05b_kernel_strict.json new file mode 100644 index 0000000000000000000000000000000000000000..47e0cfc8e65c53930899601bc96f4560e412979c --- /dev/null +++ b/evaluation/source/experiments/published/configs/run_05b_kernel_strict.json @@ -0,0 +1,73 @@ +{ + "d_model": 512, + "n_layers": 12, + "d_ff": 1376, + "fp_rank": 4, + "n_heads": 8, + "head_dim": 64, + "window_size": 512, + "pfnet_hidden": 0, + "batch_per_gpu": 8, + "gradient_accumulation_steps": 3, + "lr": 0.0003, + "min_lr": 3e-05, + "warmup_steps": 50, + "total_steps": 600, + "weight_decay_bitlinear": 0.1, + "weight_decay_fpresidual": 0.0, + "weight_decay_heads": 0.01, + "grad_clip": 1.0, + "seed": 42, + "training_signal": "ce_only", + "temperature": 4.0, + "alpha_kl": 0.9, + "alpha_ce": 0.1, + "dataset_repo": "HuggingFaceFW/fineweb", + "seq_len": 5000, + "patch_size": 4, + "use_local_decoder": true, + "local_decoder_dim": 128, + "local_decoder_heads": 4, + "local_decoder_ff_ratio": 4.0, + "local_decoder_fp16": false, + "checkpoint_repo": "Cukinator/cpu1-ablation-checkpoints", + "save_every_steps": 30, + "checkpoint_fraction": 0.05, + "log_every_steps": 500, + "chinchilla": true, + "chinchilla_tokens_per_param": 2, + "warmup_ratio": 0.05, + "target_elimination": 0.4, + "mlgru_use_wo": false, + "mlgru_state_expansion": 1, + "delete_gate_hard": true, + "delete_gate_gumbel": true, + "delete_gate_merge": true, + "delete_gate_bimodal_lambda": 0.05, + "bolmo_cross_attn_heads": 2, + "bolmo_cross_patch_window": 3, + "bolmo_causal_boundary": false, + "bolmo_causal_cross_patch": false, + "use_real_gather": false, + "phase2_budget_fraction": 0.5, + "use_ternary": true, + "use_boundary_predictor": false, + "use_delete_gate": false, + "use_embedding_alignment": false, + "name": "mlgru_kernel_strict", + "token_mixer": "mlgru", + "tokenization": "byte", + "quantization": "ternary", + "fp_residual": true, + "mlgru_per_channel_decay": false, + "state_reset_period": 0, + "mlgru_parallel_scan": true, + "description": "Kernel-strict MLGRU β€” run_05 minus W_o, matching the layout the production C++ kernel can run. Measures the cost of dropping the paper's 4th matrix to fit OMP scheduling.", + "cites": [ + "MatMul-free LM (Zhu et al., 2024)", + "BitNet b1.58 (Wang et al., 2024)", + "Slender-Mamba (Yu et al., 2025)" + ], + "_current_phase": 1, + "use_gradient_checkpointing": false +} diff --git a/evaluation/source/experiments/published/configs/run_05b_kernel_strict_v3.json b/evaluation/source/experiments/published/configs/run_05b_kernel_strict_v3.json new file mode 100644 index 0000000000000000000000000000000000000000..83ce28ec33a757db1b65b24899b603338f5d19e8 --- /dev/null +++ b/evaluation/source/experiments/published/configs/run_05b_kernel_strict_v3.json @@ -0,0 +1,74 @@ +{ + "d_model": 512, + "n_layers": 12, + "d_ff": 1376, + "fp_rank": 4, + "n_heads": 8, + "head_dim": 64, + "window_size": 512, + "pfnet_hidden": 0, + "batch_per_gpu": 8, + "gradient_accumulation_steps": 3, + "lr": 0.0003, + "min_lr": 3e-05, + "warmup_steps": 2240, + "total_steps": 44802, + "weight_decay_bitlinear": 0.1, + "weight_decay_fpresidual": 0.0, + "weight_decay_heads": 0.01, + "bitlinear_lr_scale": 2.0, + "grad_clip": 1.0, + "seed": 42, + "training_signal": "ce_only", + "temperature": 4.0, + "alpha_kl": 0.9, + "alpha_ce": 0.1, + "dataset_repo": "HuggingFaceFW/fineweb", + "seq_len": 5000, + "patch_size": 4, + "use_local_decoder": true, + "local_decoder_dim": 128, + "local_decoder_heads": 4, + "local_decoder_ff_ratio": 4.0, + "local_decoder_fp16": false, + "checkpoint_repo": "Cukinator/cpu1-ablation-checkpoints-v3", + "save_every_steps": 2240, + "checkpoint_fraction": 0.05, + "log_every_steps": 500, + "chinchilla": true, + "chinchilla_tokens_per_param": 150, + "warmup_ratio": 0.05, + "target_elimination": 0.4, + "mlgru_use_wo": false, + "mlgru_state_expansion": 1, + "delete_gate_hard": true, + "delete_gate_gumbel": true, + "delete_gate_merge": true, + "delete_gate_bimodal_lambda": 0.05, + "bolmo_cross_attn_heads": 2, + "bolmo_cross_patch_window": 3, + "bolmo_causal_boundary": false, + "bolmo_causal_cross_patch": false, + "use_real_gather": false, + "phase2_budget_fraction": 0.5, + "use_ternary": true, + "use_boundary_predictor": false, + "use_delete_gate": false, + "use_embedding_alignment": false, + "name": "mlgru_kernel_strict", + "token_mixer": "mlgru", + "tokenization": "byte", + "quantization": "ternary", + "fp_residual": true, + "mlgru_per_channel_decay": false, + "state_reset_period": 0, + "mlgru_parallel_scan": true, + "description": "Kernel-strict MLGRU β€” run_05 minus W_o, matching the layout the production C++ kernel can run. Measures the cost of dropping the paper's 4th matrix to fit OMP scheduling.", + "cites": [ + "MatMul-free LM (Zhu et al., 2024)", + "BitNet b1.58 (Wang et al., 2024)", + "Slender-Mamba (Yu et al., 2025)" + ], + "_current_phase": 1, + "use_gradient_checkpointing": false +} diff --git a/evaluation/source/experiments/published/configs/run_06.json b/evaluation/source/experiments/published/configs/run_06.json new file mode 100644 index 0000000000000000000000000000000000000000..562c396e8b6f74070f1b4461b4548bd0977d185f --- /dev/null +++ b/evaluation/source/experiments/published/configs/run_06.json @@ -0,0 +1,69 @@ +{ + "d_model": 512, + "n_layers": 12, + "d_ff": 1376, + "fp_rank": 4, + "n_heads": 8, + "head_dim": 64, + "window_size": 512, + "pfnet_hidden": 0, + "batch_per_gpu": 8, + "gradient_accumulation_steps": 3, + "lr": 0.0003, + "min_lr": 3e-05, + "warmup_steps": 50, + "total_steps": 649, + "weight_decay_bitlinear": 0.1, + "weight_decay_fpresidual": 0.0, + "weight_decay_heads": 0.01, + "grad_clip": 1.0, + "seed": 42, + "training_signal": "ce_only", + "temperature": 4.0, + "alpha_kl": 0.9, + "alpha_ce": 0.1, + "dataset_repo": "HuggingFaceFW/fineweb", + "seq_len": 5000, + "patch_size": 4, + "use_local_decoder": true, + "local_decoder_dim": 128, + "local_decoder_heads": 4, + "local_decoder_ff_ratio": 4.0, + "local_decoder_fp16": false, + "checkpoint_repo": "Cukinator/cpu1-ablation-checkpoints", + "save_every_steps": 32, + "checkpoint_fraction": 0.05, + "log_every_steps": 500, + "chinchilla": true, + "chinchilla_tokens_per_param": 2, + "warmup_ratio": 0.05, + "target_elimination": 0.4, + "mlgru_use_wo": true, + "mlgru_state_expansion": 1, + "delete_gate_hard": true, + "delete_gate_gumbel": true, + "delete_gate_merge": true, + "delete_gate_bimodal_lambda": 0.05, + "bolmo_cross_attn_heads": 2, + "bolmo_cross_patch_window": 3, + "bolmo_causal_boundary": false, + "bolmo_causal_cross_patch": false, + "use_real_gather": false, + "phase2_budget_fraction": 0.5, + "use_ternary": true, + "use_boundary_predictor": false, + "use_delete_gate": false, + "use_embedding_alignment": false, + "name": "mlgru_byte_ternary_fpres_bolmo", + "token_mixer": "mlgru", + "tokenization": "byte_dynamic", + "quantization": "ternary", + "fp_residual": true, + "use_bolmo_gating": true, + "description": "+Bolmo β€” boundary-aware patch embedding via cross-attention (BolmoPatchEmbedding). CPU-1 core + integrated boundary signal.", + "cites": [ + "BLT (Pagnoni et al., 2024)" + ], + "_current_phase": 1, + "use_gradient_checkpointing": false +} diff --git a/evaluation/source/experiments/published/configs/run_06_v3.json b/evaluation/source/experiments/published/configs/run_06_v3.json new file mode 100644 index 0000000000000000000000000000000000000000..e4f7351c56a72975abfe9500b2c56bf7cc0f6a73 --- /dev/null +++ b/evaluation/source/experiments/published/configs/run_06_v3.json @@ -0,0 +1,70 @@ +{ + "d_model": 512, + "n_layers": 12, + "d_ff": 1376, + "fp_rank": 4, + "n_heads": 8, + "head_dim": 64, + "window_size": 512, + "pfnet_hidden": 0, + "batch_per_gpu": 8, + "gradient_accumulation_steps": 3, + "lr": 0.0003, + "min_lr": 3e-05, + "warmup_steps": 2437, + "total_steps": 48742, + "weight_decay_bitlinear": 0.1, + "weight_decay_fpresidual": 0.0, + "weight_decay_heads": 0.01, + "bitlinear_lr_scale": 2.0, + "grad_clip": 1.0, + "seed": 42, + "training_signal": "ce_only", + "temperature": 4.0, + "alpha_kl": 0.9, + "alpha_ce": 0.1, + "dataset_repo": "HuggingFaceFW/fineweb", + "seq_len": 5000, + "patch_size": 4, + "use_local_decoder": true, + "local_decoder_dim": 128, + "local_decoder_heads": 4, + "local_decoder_ff_ratio": 4.0, + "local_decoder_fp16": false, + "checkpoint_repo": "Cukinator/cpu1-ablation-checkpoints-v3", + "save_every_steps": 2437, + "checkpoint_fraction": 0.05, + "log_every_steps": 500, + "chinchilla": true, + "chinchilla_tokens_per_param": 150, + "warmup_ratio": 0.05, + "target_elimination": 0.4, + "mlgru_use_wo": true, + "mlgru_state_expansion": 1, + "delete_gate_hard": true, + "delete_gate_gumbel": true, + "delete_gate_merge": true, + "delete_gate_bimodal_lambda": 0.05, + "bolmo_cross_attn_heads": 2, + "bolmo_cross_patch_window": 3, + "bolmo_causal_boundary": false, + "bolmo_causal_cross_patch": false, + "use_real_gather": false, + "phase2_budget_fraction": 0.5, + "use_ternary": true, + "use_boundary_predictor": false, + "use_delete_gate": false, + "use_embedding_alignment": false, + "name": "mlgru_byte_ternary_fpres_bolmo", + "token_mixer": "mlgru", + "tokenization": "byte_dynamic", + "quantization": "ternary", + "fp_residual": true, + "use_bolmo_gating": true, + "description": "+Bolmo β€” boundary-aware patch embedding via cross-attention (BolmoPatchEmbedding). CPU-1 core + integrated boundary signal.", + "cites": [ + "BLT (Pagnoni et al., 2024)" + ], + "_current_phase": 1, + "use_gradient_checkpointing": false +} diff --git a/evaluation/source/experiments/published/configs/run_07.json b/evaluation/source/experiments/published/configs/run_07.json new file mode 100644 index 0000000000000000000000000000000000000000..fcb65bc4f73233e1792e1d9c0f7436b3670fec6f --- /dev/null +++ b/evaluation/source/experiments/published/configs/run_07.json @@ -0,0 +1,74 @@ +{ + "d_model": 512, + "n_layers": 12, + "d_ff": 1376, + "fp_rank": 4, + "n_heads": 8, + "head_dim": 64, + "window_size": 512, + "pfnet_hidden": 0, + "batch_per_gpu": 8, + "gradient_accumulation_steps": 3, + "lr": 0.0003, + "min_lr": 3e-05, + "warmup_steps": 50, + "total_steps": 650, + "weight_decay_bitlinear": 0.1, + "weight_decay_fpresidual": 0.0, + "weight_decay_heads": 0.01, + "grad_clip": 1.0, + "seed": 42, + "training_signal": "ce_only", + "temperature": 4.0, + "alpha_kl": 0.9, + "alpha_ce": 0.1, + "dataset_repo": "HuggingFaceFW/fineweb", + "seq_len": 5000, + "patch_size": 4, + "use_local_decoder": true, + "local_decoder_dim": 128, + "local_decoder_heads": 4, + "local_decoder_ff_ratio": 4.0, + "local_decoder_fp16": false, + "checkpoint_repo": "Cukinator/cpu1-ablation-checkpoints", + "save_every_steps": 32, + "checkpoint_fraction": 0.05, + "log_every_steps": 500, + "chinchilla": true, + "chinchilla_tokens_per_param": 2, + "warmup_ratio": 0.05, + "target_elimination": 0.4, + "mlgru_use_wo": true, + "mlgru_state_expansion": 1, + "delete_gate_hard": true, + "delete_gate_gumbel": true, + "delete_gate_merge": true, + "delete_gate_bimodal_lambda": 0.05, + "bolmo_cross_attn_heads": 2, + "bolmo_cross_patch_window": 3, + "bolmo_causal_boundary": false, + "bolmo_causal_cross_patch": false, + "use_real_gather": true, + "phase2_budget_fraction": 0.5, + "use_ternary": true, + "use_boundary_predictor": false, + "use_delete_gate": true, + "use_embedding_alignment": false, + "name": "cpu1_complete", + "token_mixer": "mlgru", + "tokenization": "byte_dynamic", + "quantization": "ternary", + "fp_residual": true, + "use_bolmo_gating": true, + "description": "+DeleteGate (real gather) β€” MrT5-style state elimination at midpoint (~40%). Layered on run_06 Bolmo. Full proposed CPU-1 stack so far ⭐", + "cites": [ + "MatMul-free LM (Zhu et al., 2024)", + "BitNet b1.58 (Wang et al., 2024)", + "BLT (Pagnoni et al., 2024)", + "MrT5 (Pagliardini et al., 2024)", + "Slender-Mamba (Yu et al., 2025)" + ], + "is_proposed": true, + "_current_phase": 1, + "use_gradient_checkpointing": false +} diff --git a/evaluation/source/experiments/published/configs/run_07_r2.json b/evaluation/source/experiments/published/configs/run_07_r2.json new file mode 100644 index 0000000000000000000000000000000000000000..2808c410e8e24c5d61de673c55f20003a79ec5bb --- /dev/null +++ b/evaluation/source/experiments/published/configs/run_07_r2.json @@ -0,0 +1,67 @@ +{ + "d_model": 512, + "n_layers": 12, + "d_ff": 1376, + "fp_rank": 4, + "n_heads": 8, + "head_dim": 64, + "window_size": 512, + "pfnet_hidden": 0, + "batch_per_gpu": 8, + "gradient_accumulation_steps": 3, + "lr": 0.0003, + "min_lr": 3e-05, + "warmup_steps": 243, + "total_steps": 4878, + "weight_decay_bitlinear": 0.1, + "weight_decay_fpresidual": 0.0, + "weight_decay_heads": 0.01, + "grad_clip": 1.0, + "seed": 42, + "training_signal": "ce_only", + "temperature": 4.0, + "alpha_kl": 0.9, + "alpha_ce": 0.1, + "dataset_repo": "HuggingFaceFW/fineweb", + "seq_len": 5000, + "patch_size": 4, + "use_local_decoder": true, + "local_decoder_dim": 128, + "local_decoder_heads": 4, + "local_decoder_ff_ratio": 4.0, + "local_decoder_fp16": false, + "checkpoint_repo": "Cukinator/cpu1-ablation-checkpoints", + "save_every_steps": 243, + "checkpoint_fraction": 0.05, + "log_every_steps": 500, + "chinchilla": true, + "chinchilla_tokens_per_param": 15, + "warmup_ratio": 0.05, + "target_elimination": 0.4, + "mlgru_use_wo": true, + "mlgru_state_expansion": 1, + "delete_gate_hard": true, + "delete_gate_gumbel": true, + "delete_gate_merge": true, + "delete_gate_bimodal_lambda": 0.05, + "bolmo_cross_attn_heads": 2, + "bolmo_cross_patch_window": 3, + "bolmo_causal_boundary": false, + "bolmo_causal_cross_patch": false, + "use_real_gather": true, + "phase2_budget_fraction": 0.5, + "use_ternary": true, + "use_boundary_predictor": false, + "use_delete_gate": true, + "use_embedding_alignment": false, + "name": "cpu1_complete_15t", + "token_mixer": "mlgru", + "tokenization": "byte_dynamic", + "quantization": "ternary", + "fp_residual": true, + "use_bolmo_gating": true, + "description": "run_07 at 15 tok/param β€” CPU-1 complete stack with real budget.", + "is_proposed": true, + "_current_phase": 1, + "use_gradient_checkpointing": false +} diff --git a/evaluation/source/experiments/published/configs/run_08.json b/evaluation/source/experiments/published/configs/run_08.json new file mode 100644 index 0000000000000000000000000000000000000000..7c7b2edfa658d25b48a76e7c624cbc85a7446b5c --- /dev/null +++ b/evaluation/source/experiments/published/configs/run_08.json @@ -0,0 +1,69 @@ +{ + "d_model": 512, + "n_layers": 12, + "d_ff": 1376, + "fp_rank": 0, + "n_heads": 8, + "head_dim": 64, + "window_size": 128, + "pfnet_hidden": 0, + "batch_per_gpu": 8, + "gradient_accumulation_steps": 3, + "lr": 0.0003, + "min_lr": 3e-05, + "warmup_steps": 50, + "total_steps": 647, + "weight_decay_bitlinear": 0.1, + "weight_decay_fpresidual": 0.0, + "weight_decay_heads": 0.01, + "grad_clip": 1.0, + "seed": 42, + "training_signal": "ce_only", + "temperature": 4.0, + "alpha_kl": 0.9, + "alpha_ce": 0.1, + "dataset_repo": "HuggingFaceFW/fineweb", + "seq_len": 5000, + "patch_size": 4, + "use_local_decoder": true, + "local_decoder_dim": 128, + "local_decoder_heads": 4, + "local_decoder_ff_ratio": 4.0, + "local_decoder_fp16": false, + "checkpoint_repo": "Cukinator/cpu1-ablation-checkpoints", + "save_every_steps": 32, + "checkpoint_fraction": 0.05, + "log_every_steps": 500, + "chinchilla": true, + "chinchilla_tokens_per_param": 2, + "warmup_ratio": 0.05, + "target_elimination": 0.4, + "mlgru_use_wo": true, + "mlgru_state_expansion": 1, + "delete_gate_hard": true, + "delete_gate_gumbel": true, + "delete_gate_merge": true, + "delete_gate_bimodal_lambda": 0.05, + "bolmo_cross_attn_heads": 2, + "bolmo_cross_patch_window": 3, + "bolmo_causal_boundary": false, + "bolmo_causal_cross_patch": false, + "use_real_gather": false, + "phase2_budget_fraction": 0.5, + "use_ternary": true, + "use_boundary_predictor": false, + "use_delete_gate": false, + "use_embedding_alignment": false, + "name": "folded_transformer_byte_ternary", + "token_mixer": "transformer", + "tokenization": "byte", + "quantization": "ternary", + "fp_residual": false, + "description": "Folded Transformer β€” ternary sliding-window attention over byte patches. O(NΒ·128) vs O(NΒ²). Alternative to MLGRU; sibling of run_05 (no Bolmo / DG / decay layered on top).", + "cites": [ + "Longformer (Beltagy et al., 2020)", + "BitNet b1.58 (Wang et al., 2024)" + ], + "_current_phase": 1, + "use_gradient_checkpointing": false +} diff --git a/evaluation/source/experiments/published/configs/run_08_v3.json b/evaluation/source/experiments/published/configs/run_08_v3.json new file mode 100644 index 0000000000000000000000000000000000000000..6c0116f08c4dde3e3dfec50f03fbf5d55cfeec0b --- /dev/null +++ b/evaluation/source/experiments/published/configs/run_08_v3.json @@ -0,0 +1,70 @@ +{ + "d_model": 512, + "n_layers": 12, + "d_ff": 1376, + "fp_rank": 0, + "n_heads": 8, + "head_dim": 64, + "window_size": 128, + "pfnet_hidden": 0, + "batch_per_gpu": 8, + "gradient_accumulation_steps": 3, + "lr": 0.0003, + "min_lr": 3e-05, + "warmup_steps": 2428, + "total_steps": 48567, + "weight_decay_bitlinear": 0.1, + "weight_decay_fpresidual": 0.0, + "weight_decay_heads": 0.01, + "bitlinear_lr_scale": 2.0, + "grad_clip": 1.0, + "seed": 42, + "training_signal": "ce_only", + "temperature": 4.0, + "alpha_kl": 0.9, + "alpha_ce": 0.1, + "dataset_repo": "HuggingFaceFW/fineweb", + "seq_len": 5000, + "patch_size": 4, + "use_local_decoder": true, + "local_decoder_dim": 128, + "local_decoder_heads": 4, + "local_decoder_ff_ratio": 4.0, + "local_decoder_fp16": false, + "checkpoint_repo": "Cukinator/cpu1-ablation-checkpoints-v3", + "save_every_steps": 2428, + "checkpoint_fraction": 0.05, + "log_every_steps": 500, + "chinchilla": true, + "chinchilla_tokens_per_param": 150, + "warmup_ratio": 0.05, + "target_elimination": 0.4, + "mlgru_use_wo": true, + "mlgru_state_expansion": 1, + "delete_gate_hard": true, + "delete_gate_gumbel": true, + "delete_gate_merge": true, + "delete_gate_bimodal_lambda": 0.05, + "bolmo_cross_attn_heads": 2, + "bolmo_cross_patch_window": 3, + "bolmo_causal_boundary": false, + "bolmo_causal_cross_patch": false, + "use_real_gather": false, + "phase2_budget_fraction": 0.5, + "use_ternary": true, + "use_boundary_predictor": false, + "use_delete_gate": false, + "use_embedding_alignment": false, + "name": "folded_transformer_byte_ternary", + "token_mixer": "transformer", + "tokenization": "byte", + "quantization": "ternary", + "fp_residual": false, + "description": "Folded Transformer β€” ternary sliding-window attention over byte patches. O(NΒ·128) vs O(NΒ²). Alternative to MLGRU; sibling of run_05 (no Bolmo / DG / decay layered on top).", + "cites": [ + "Longformer (Beltagy et al., 2020)", + "BitNet b1.58 (Wang et al., 2024)" + ], + "_current_phase": 1, + "use_gradient_checkpointing": false +} diff --git a/evaluation/source/experiments/published/configs/run_09.json b/evaluation/source/experiments/published/configs/run_09.json new file mode 100644 index 0000000000000000000000000000000000000000..fd25600f44e4488e7f3f3918f5c4eb60075c706a --- /dev/null +++ b/evaluation/source/experiments/published/configs/run_09.json @@ -0,0 +1,73 @@ +{ + "d_model": 512, + "n_layers": 12, + "d_ff": 1376, + "fp_rank": 4, + "n_heads": 8, + "head_dim": 64, + "window_size": 512, + "pfnet_hidden": 32, + "batch_per_gpu": 8, + "gradient_accumulation_steps": 3, + "lr": 0.0003, + "min_lr": 3e-05, + "warmup_steps": 50, + "total_steps": 657, + "weight_decay_bitlinear": 0.1, + "weight_decay_fpresidual": 0.0, + "weight_decay_heads": 0.01, + "grad_clip": 1.0, + "seed": 42, + "training_signal": "ce_only", + "temperature": 4.0, + "alpha_kl": 0.9, + "alpha_ce": 0.1, + "dataset_repo": "HuggingFaceFW/fineweb", + "seq_len": 5000, + "patch_size": 4, + "use_local_decoder": true, + "local_decoder_dim": 128, + "local_decoder_heads": 4, + "local_decoder_ff_ratio": 4.0, + "local_decoder_fp16": false, + "checkpoint_repo": "Cukinator/cpu1-ablation-checkpoints", + "save_every_steps": 32, + "checkpoint_fraction": 0.05, + "log_every_steps": 500, + "chinchilla": true, + "chinchilla_tokens_per_param": 2, + "warmup_ratio": 0.05, + "target_elimination": 0.4, + "mlgru_use_wo": true, + "mlgru_state_expansion": 1, + "delete_gate_hard": true, + "delete_gate_gumbel": true, + "delete_gate_merge": true, + "delete_gate_bimodal_lambda": 0.05, + "bolmo_cross_attn_heads": 2, + "bolmo_cross_patch_window": 3, + "bolmo_causal_boundary": false, + "bolmo_causal_cross_patch": false, + "use_real_gather": true, + "phase2_budget_fraction": 0.5, + "use_ternary": true, + "use_boundary_predictor": false, + "use_delete_gate": true, + "use_embedding_alignment": false, + "name": "cpu1_pfnet", + "token_mixer": "mlgru", + "tokenization": "byte_dynamic", + "quantization": "ternary", + "fp_residual": true, + "use_bolmo_gating": true, + "description": "run_07 + PFNet (pfnet_hidden=32). Cache-resident nonlinear residual added per block β€” quality gain at zero RAM overhead.", + "cites": [ + "MatMul-free LM (Zhu et al., 2024)", + "BitNet b1.58 (Wang et al., 2024)", + "BLT (Pagnoni et al., 2024)", + "MrT5 (Pagliardini et al., 2024)", + "Slender-Mamba (Yu et al., 2025)" + ], + "_current_phase": 1, + "use_gradient_checkpointing": false +} diff --git a/evaluation/source/experiments/published/configs/run_10.json b/evaluation/source/experiments/published/configs/run_10.json new file mode 100644 index 0000000000000000000000000000000000000000..9eb5aa5b739f925441b095181581c16c873a623c --- /dev/null +++ b/evaluation/source/experiments/published/configs/run_10.json @@ -0,0 +1,75 @@ +{ + "d_model": 512, + "n_layers": 12, + "d_ff": 1376, + "fp_rank": 4, + "n_heads": 8, + "head_dim": 64, + "window_size": 512, + "pfnet_hidden": 32, + "batch_per_gpu": 8, + "gradient_accumulation_steps": 3, + "lr": 0.0003, + "min_lr": 3e-05, + "warmup_steps": 50, + "total_steps": 657, + "weight_decay_bitlinear": 0.1, + "weight_decay_fpresidual": 0.0, + "weight_decay_heads": 0.01, + "grad_clip": 1.0, + "seed": 42, + "training_signal": "ce_only", + "temperature": 4.0, + "alpha_kl": 0.9, + "alpha_ce": 0.1, + "dataset_repo": "HuggingFaceFW/fineweb", + "seq_len": 5000, + "patch_size": 4, + "use_local_decoder": true, + "local_decoder_dim": 128, + "local_decoder_heads": 4, + "local_decoder_ff_ratio": 4.0, + "local_decoder_fp16": false, + "checkpoint_repo": "Cukinator/cpu1-ablation-checkpoints", + "save_every_steps": 32, + "checkpoint_fraction": 0.05, + "log_every_steps": 500, + "chinchilla": true, + "chinchilla_tokens_per_param": 2, + "warmup_ratio": 0.05, + "target_elimination": 0.4, + "mlgru_use_wo": true, + "mlgru_state_expansion": 1, + "delete_gate_hard": true, + "delete_gate_gumbel": true, + "delete_gate_merge": true, + "delete_gate_bimodal_lambda": 0.05, + "bolmo_cross_attn_heads": 2, + "bolmo_cross_patch_window": 3, + "bolmo_causal_boundary": false, + "bolmo_causal_cross_patch": false, + "use_real_gather": true, + "phase2_budget_fraction": 0.5, + "use_ternary": true, + "use_boundary_predictor": false, + "use_delete_gate": true, + "use_embedding_alignment": false, + "name": "cpu1_decay_learned", + "token_mixer": "mlgru", + "tokenization": "byte_dynamic", + "quantization": "ternary", + "fp_residual": true, + "use_bolmo_gating": true, + "mlgru_per_channel_decay": true, + "description": "run_09 + per-channel learnable decay in MLGRU (RWKV/HGRN2-style). Each hidden dim has its own decay rate β€” d_model Γ— n_layers scalars total. State expansion stays at 1; isolated effect of decay alone.", + "cites": [ + "MatMul-free LM (Zhu et al., 2024)", + "BitNet b1.58 (Wang et al., 2024)", + "BLT (Pagnoni et al., 2024)", + "MrT5 (Pagliardini et al., 2024)", + "RWKV (Peng et al., 2023)", + "HGRN2 (Qin et al., 2024)" + ], + "_current_phase": 1, + "use_gradient_checkpointing": false +} diff --git a/evaluation/source/experiments/published/configs/run_13.json b/evaluation/source/experiments/published/configs/run_13.json new file mode 100644 index 0000000000000000000000000000000000000000..a8d5f83bf11ca11a51a6b9ee6883f666b23a9cf7 --- /dev/null +++ b/evaluation/source/experiments/published/configs/run_13.json @@ -0,0 +1,71 @@ +{ + "d_model": 320, + "n_layers": 8, + "d_ff": 853, + "fp_rank": 4, + "n_heads": 8, + "head_dim": 40, + "window_size": 256, + "pfnet_hidden": 0, + "batch_per_gpu": 8, + "gradient_accumulation_steps": 3, + "lr": 0.0003, + "min_lr": 3e-05, + "warmup_steps": 50, + "total_steps": 600, + "weight_decay_bitlinear": 0.1, + "weight_decay_fpresidual": 0.0, + "weight_decay_heads": 0.01, + "grad_clip": 1.0, + "seed": 42, + "training_signal": "distillation", + "temperature": 4.0, + "alpha_kl": 0.9, + "alpha_ce": 0.1, + "dataset_repo": "Cukinator/cpu1-ablation-dataset", + "seq_len": 5000, + "patch_size": 4, + "use_local_decoder": true, + "local_decoder_dim": 128, + "local_decoder_heads": 4, + "local_decoder_ff_ratio": 4.0, + "local_decoder_fp16": false, + "checkpoint_repo": "Cukinator/cpu1-ablation-checkpoints", + "save_every_steps": 30, + "checkpoint_fraction": 0.05, + "log_every_steps": 50, + "chinchilla": true, + "chinchilla_tokens_per_param": 2, + "warmup_ratio": 0.05, + "target_elimination": 0.4, + "mlgru_use_wo": true, + "mlgru_state_expansion": 1, + "delete_gate_hard": true, + "delete_gate_gumbel": true, + "delete_gate_merge": true, + "delete_gate_bimodal_lambda": 0.05, + "bolmo_cross_attn_heads": 2, + "bolmo_cross_patch_window": 3, + "bolmo_causal_boundary": false, + "bolmo_causal_cross_patch": false, + "use_real_gather": true, + "phase2_budget_fraction": 0.5, + "use_ternary": true, + "use_boundary_predictor": false, + "use_delete_gate": true, + "use_embedding_alignment": false, + "name": "small_cpu1_bpe", + "token_mixer": "mlgru", + "tokenization": "bpe", + "quantization": "ternary", + "fp_residual": true, + "bpe_vocab_size": 4096, + "description": "CPU-1 COMPLETE @ 10M, compact BPE (4K vocab) from scratch. Does BPE tokenization outperform byte-level at 10M?", + "cites": [ + "MatMul-free LM", + "Slender-Mamba", + "MrT5" + ], + "_current_phase": 1, + "use_gradient_checkpointing": false +} diff --git a/evaluation/source/experiments/published/configs/run_13_r2.json b/evaluation/source/experiments/published/configs/run_13_r2.json new file mode 100644 index 0000000000000000000000000000000000000000..7267730792561809f797c1118039b85559090e98 --- /dev/null +++ b/evaluation/source/experiments/published/configs/run_13_r2.json @@ -0,0 +1,66 @@ +{ + "d_model": 320, + "n_layers": 8, + "d_ff": 853, + "fp_rank": 4, + "n_heads": 8, + "head_dim": 40, + "window_size": 256, + "pfnet_hidden": 0, + "batch_per_gpu": 8, + "gradient_accumulation_steps": 3, + "lr": 0.0003, + "min_lr": 3e-05, + "warmup_steps": 78, + "total_steps": 1568, + "weight_decay_bitlinear": 0.1, + "weight_decay_fpresidual": 0.0, + "weight_decay_heads": 0.01, + "grad_clip": 1.0, + "seed": 42, + "training_signal": "distillation", + "temperature": 4.0, + "alpha_kl": 0.9, + "alpha_ce": 0.1, + "dataset_repo": "Cukinator/cpu1-ablation-dataset", + "seq_len": 5000, + "patch_size": 4, + "use_local_decoder": true, + "local_decoder_dim": 128, + "local_decoder_heads": 4, + "local_decoder_ff_ratio": 4.0, + "local_decoder_fp16": false, + "checkpoint_repo": "Cukinator/cpu1-ablation-checkpoints", + "save_every_steps": 78, + "checkpoint_fraction": 0.05, + "log_every_steps": 50, + "chinchilla": true, + "chinchilla_tokens_per_param": 15, + "warmup_ratio": 0.05, + "target_elimination": 0.4, + "mlgru_use_wo": true, + "mlgru_state_expansion": 1, + "delete_gate_hard": true, + "delete_gate_gumbel": true, + "delete_gate_merge": true, + "delete_gate_bimodal_lambda": 0.05, + "bolmo_cross_attn_heads": 2, + "bolmo_cross_patch_window": 3, + "bolmo_causal_boundary": false, + "bolmo_causal_cross_patch": false, + "use_real_gather": true, + "phase2_budget_fraction": 0.5, + "use_ternary": true, + "use_boundary_predictor": false, + "use_delete_gate": true, + "use_embedding_alignment": false, + "name": "small_cpu1_bpe_15t", + "token_mixer": "mlgru", + "tokenization": "bpe", + "quantization": "ternary", + "fp_residual": true, + "bpe_vocab_size": 4096, + "description": "run_13 at 15 tok/param β€” small BPE+ternary with real budget. Does BPE outperform byte-level at 10M with sufficient training?", + "_current_phase": 1, + "use_gradient_checkpointing": false +} diff --git a/evaluation/source/experiments/published/configs/run_13_v3.json b/evaluation/source/experiments/published/configs/run_13_v3.json new file mode 100644 index 0000000000000000000000000000000000000000..5cb918b9eaf36f2d78e96e871af86b583d137171 --- /dev/null +++ b/evaluation/source/experiments/published/configs/run_13_v3.json @@ -0,0 +1,72 @@ +{ + "d_model": 320, + "n_layers": 8, + "d_ff": 853, + "fp_rank": 4, + "n_heads": 8, + "head_dim": 40, + "window_size": 256, + "pfnet_hidden": 0, + "batch_per_gpu": 8, + "gradient_accumulation_steps": 3, + "lr": 0.0003, + "min_lr": 3e-05, + "warmup_steps": 784, + "total_steps": 15684, + "weight_decay_bitlinear": 0.1, + "weight_decay_fpresidual": 0.0, + "weight_decay_heads": 0.01, + "bitlinear_lr_scale": 2.0, + "grad_clip": 1.0, + "seed": 42, + "training_signal": "distillation", + "temperature": 4.0, + "alpha_kl": 0.9, + "alpha_ce": 0.1, + "dataset_repo": "Cukinator/cpu1-ablation-dataset", + "seq_len": 5000, + "patch_size": 4, + "use_local_decoder": true, + "local_decoder_dim": 128, + "local_decoder_heads": 4, + "local_decoder_ff_ratio": 4.0, + "local_decoder_fp16": false, + "checkpoint_repo": "Cukinator/cpu1-ablation-checkpoints-v3", + "save_every_steps": 784, + "checkpoint_fraction": 0.05, + "log_every_steps": 50, + "chinchilla": true, + "chinchilla_tokens_per_param": 150, + "warmup_ratio": 0.05, + "target_elimination": 0.4, + "mlgru_use_wo": true, + "mlgru_state_expansion": 1, + "delete_gate_hard": true, + "delete_gate_gumbel": true, + "delete_gate_merge": true, + "delete_gate_bimodal_lambda": 0.05, + "bolmo_cross_attn_heads": 2, + "bolmo_cross_patch_window": 3, + "bolmo_causal_boundary": false, + "bolmo_causal_cross_patch": false, + "use_real_gather": true, + "phase2_budget_fraction": 0.5, + "use_ternary": true, + "use_boundary_predictor": false, + "use_delete_gate": true, + "use_embedding_alignment": false, + "name": "small_cpu1_bpe", + "token_mixer": "mlgru", + "tokenization": "bpe", + "quantization": "ternary", + "fp_residual": true, + "bpe_vocab_size": 4096, + "description": "CPU-1 COMPLETE @ 10M, compact BPE (4K vocab) from scratch. Does BPE tokenization outperform byte-level at 10M?", + "cites": [ + "MatMul-free LM", + "Slender-Mamba", + "MrT5" + ], + "_current_phase": 1, + "use_gradient_checkpointing": false +} diff --git a/evaluation/source/experiments/published/configs/run_14.json b/evaluation/source/experiments/published/configs/run_14.json new file mode 100644 index 0000000000000000000000000000000000000000..97f6e2c1771dc50651608045dc391f667ca83d78 --- /dev/null +++ b/evaluation/source/experiments/published/configs/run_14.json @@ -0,0 +1,73 @@ +{ + "d_model": 320, + "n_layers": 8, + "d_ff": 853, + "fp_rank": 4, + "n_heads": 8, + "head_dim": 40, + "window_size": 256, + "pfnet_hidden": 0, + "batch_per_gpu": 8, + "gradient_accumulation_steps": 3, + "lr": 0.0003, + "min_lr": 3e-05, + "warmup_steps": 50, + "total_steps": 600, + "weight_decay_bitlinear": 0.1, + "weight_decay_fpresidual": 0.0, + "weight_decay_heads": 0.01, + "grad_clip": 1.0, + "seed": 42, + "training_signal": "distillation", + "temperature": 4.0, + "alpha_kl": 0.9, + "alpha_ce": 0.1, + "dataset_repo": "Cukinator/cpu1-ablation-dataset", + "seq_len": 5000, + "patch_size": 4, + "use_local_decoder": true, + "local_decoder_dim": 128, + "local_decoder_heads": 4, + "local_decoder_ff_ratio": 4.0, + "local_decoder_fp16": false, + "checkpoint_repo": "Cukinator/cpu1-ablation-checkpoints", + "save_every_steps": 30, + "checkpoint_fraction": 0.05, + "log_every_steps": 50, + "chinchilla": true, + "chinchilla_tokens_per_param": 2, + "warmup_ratio": 0.05, + "target_elimination": 0.4, + "mlgru_use_wo": true, + "mlgru_state_expansion": 1, + "delete_gate_hard": true, + "delete_gate_gumbel": true, + "delete_gate_merge": true, + "delete_gate_bimodal_lambda": 0.05, + "bolmo_cross_attn_heads": 2, + "bolmo_cross_patch_window": 3, + "bolmo_causal_boundary": false, + "bolmo_causal_cross_patch": false, + "use_real_gather": true, + "phase2_budget_fraction": 0.5, + "use_ternary": true, + "use_boundary_predictor": false, + "use_delete_gate": true, + "use_embedding_alignment": false, + "name": "small_cpu1_byte", + "token_mixer": "mlgru", + "tokenization": "byte_dynamic", + "quantization": "ternary", + "fp_residual": true, + "use_bolmo_gating": true, + "description": "CPU-1 COMPLETE @ 10M, byte-level from scratch. Pure byte baseline for complement comparison.", + "cites": [ + "MatMul-free LM", + "Slender-Mamba", + "Bolmo", + "MrT5" + ], + "is_proposed": true, + "_current_phase": 1, + "use_gradient_checkpointing": false +} diff --git a/evaluation/source/experiments/published/configs/run_14_r2.json b/evaluation/source/experiments/published/configs/run_14_r2.json new file mode 100644 index 0000000000000000000000000000000000000000..4e379cbc7c4e85346da3664f7aec60d1ea09ef5f --- /dev/null +++ b/evaluation/source/experiments/published/configs/run_14_r2.json @@ -0,0 +1,67 @@ +{ + "d_model": 320, + "n_layers": 8, + "d_ff": 853, + "fp_rank": 4, + "n_heads": 8, + "head_dim": 40, + "window_size": 256, + "pfnet_hidden": 0, + "batch_per_gpu": 8, + "gradient_accumulation_steps": 3, + "lr": 0.0003, + "min_lr": 3e-05, + "warmup_steps": 66, + "total_steps": 1336, + "weight_decay_bitlinear": 0.1, + "weight_decay_fpresidual": 0.0, + "weight_decay_heads": 0.01, + "grad_clip": 1.0, + "seed": 42, + "training_signal": "distillation", + "temperature": 4.0, + "alpha_kl": 0.9, + "alpha_ce": 0.1, + "dataset_repo": "Cukinator/cpu1-ablation-dataset", + "seq_len": 5000, + "patch_size": 4, + "use_local_decoder": true, + "local_decoder_dim": 128, + "local_decoder_heads": 4, + "local_decoder_ff_ratio": 4.0, + "local_decoder_fp16": false, + "checkpoint_repo": "Cukinator/cpu1-ablation-checkpoints", + "save_every_steps": 66, + "checkpoint_fraction": 0.05, + "log_every_steps": 50, + "chinchilla": true, + "chinchilla_tokens_per_param": 15, + "warmup_ratio": 0.05, + "target_elimination": 0.4, + "mlgru_use_wo": true, + "mlgru_state_expansion": 1, + "delete_gate_hard": true, + "delete_gate_gumbel": true, + "delete_gate_merge": true, + "delete_gate_bimodal_lambda": 0.05, + "bolmo_cross_attn_heads": 2, + "bolmo_cross_patch_window": 3, + "bolmo_causal_boundary": false, + "bolmo_causal_cross_patch": false, + "use_real_gather": true, + "phase2_budget_fraction": 0.5, + "use_ternary": true, + "use_boundary_predictor": false, + "use_delete_gate": true, + "use_embedding_alignment": false, + "name": "small_cpu1_byte_15t", + "token_mixer": "mlgru", + "tokenization": "byte_dynamic", + "quantization": "ternary", + "fp_residual": true, + "use_bolmo_gating": true, + "description": "run_14 at 15 tok/param β€” small byte baseline with real budget.", + "is_proposed": true, + "_current_phase": 1, + "use_gradient_checkpointing": false +} diff --git a/evaluation/source/experiments/published/configs/run_14_v3.json b/evaluation/source/experiments/published/configs/run_14_v3.json new file mode 100644 index 0000000000000000000000000000000000000000..9d179d7daa8103dba4aa993009dcc7210b96bd6d --- /dev/null +++ b/evaluation/source/experiments/published/configs/run_14_v3.json @@ -0,0 +1,74 @@ +{ + "d_model": 320, + "n_layers": 8, + "d_ff": 853, + "fp_rank": 4, + "n_heads": 8, + "head_dim": 40, + "window_size": 256, + "pfnet_hidden": 0, + "batch_per_gpu": 8, + "gradient_accumulation_steps": 3, + "lr": 0.0003, + "min_lr": 3e-05, + "warmup_steps": 668, + "total_steps": 13364, + "weight_decay_bitlinear": 0.1, + "weight_decay_fpresidual": 0.0, + "weight_decay_heads": 0.01, + "bitlinear_lr_scale": 2.0, + "grad_clip": 1.0, + "seed": 42, + "training_signal": "distillation", + "temperature": 4.0, + "alpha_kl": 0.9, + "alpha_ce": 0.1, + "dataset_repo": "Cukinator/cpu1-ablation-dataset", + "seq_len": 5000, + "patch_size": 4, + "use_local_decoder": true, + "local_decoder_dim": 128, + "local_decoder_heads": 4, + "local_decoder_ff_ratio": 4.0, + "local_decoder_fp16": false, + "checkpoint_repo": "Cukinator/cpu1-ablation-checkpoints-v3", + "save_every_steps": 668, + "checkpoint_fraction": 0.05, + "log_every_steps": 50, + "chinchilla": true, + "chinchilla_tokens_per_param": 150, + "warmup_ratio": 0.05, + "target_elimination": 0.4, + "mlgru_use_wo": true, + "mlgru_state_expansion": 1, + "delete_gate_hard": true, + "delete_gate_gumbel": true, + "delete_gate_merge": true, + "delete_gate_bimodal_lambda": 0.05, + "bolmo_cross_attn_heads": 2, + "bolmo_cross_patch_window": 3, + "bolmo_causal_boundary": false, + "bolmo_causal_cross_patch": false, + "use_real_gather": true, + "phase2_budget_fraction": 0.5, + "use_ternary": true, + "use_boundary_predictor": false, + "use_delete_gate": true, + "use_embedding_alignment": false, + "name": "small_cpu1_byte", + "token_mixer": "mlgru", + "tokenization": "byte_dynamic", + "quantization": "ternary", + "fp_residual": true, + "use_bolmo_gating": true, + "description": "CPU-1 COMPLETE @ 10M, byte-level from scratch. Pure byte baseline for complement comparison.", + "cites": [ + "MatMul-free LM", + "Slender-Mamba", + "Bolmo", + "MrT5" + ], + "is_proposed": true, + "_current_phase": 1, + "use_gradient_checkpointing": false +} diff --git a/evaluation/source/experiments/published/configs/run_15.json b/evaluation/source/experiments/published/configs/run_15.json new file mode 100644 index 0000000000000000000000000000000000000000..2ccfc17c23d4c937ef46dac1d98091702345f724 --- /dev/null +++ b/evaluation/source/experiments/published/configs/run_15.json @@ -0,0 +1,72 @@ +{ + "d_model": 320, + "n_layers": 8, + "d_ff": 853, + "fp_rank": 4, + "n_heads": 8, + "head_dim": 40, + "window_size": 256, + "pfnet_hidden": 0, + "batch_per_gpu": 8, + "gradient_accumulation_steps": 3, + "lr": 0.0003, + "min_lr": 3e-05, + "warmup_steps": 50, + "total_steps": 600, + "weight_decay_bitlinear": 0.1, + "weight_decay_fpresidual": 0.0, + "weight_decay_heads": 0.01, + "grad_clip": 1.0, + "seed": 42, + "training_signal": "distillation", + "temperature": 4.0, + "alpha_kl": 0.9, + "alpha_ce": 0.1, + "dataset_repo": "Cukinator/cpu1-ablation-dataset", + "seq_len": 5000, + "patch_size": 4, + "use_local_decoder": true, + "local_decoder_dim": 128, + "local_decoder_heads": 4, + "local_decoder_ff_ratio": 4.0, + "local_decoder_fp16": false, + "checkpoint_repo": "Cukinator/cpu1-ablation-checkpoints", + "save_every_steps": 30, + "checkpoint_fraction": 0.05, + "log_every_steps": 50, + "chinchilla": true, + "chinchilla_tokens_per_param": 2, + "warmup_ratio": 0.05, + "target_elimination": 0.4, + "mlgru_use_wo": true, + "mlgru_state_expansion": 1, + "delete_gate_hard": true, + "delete_gate_gumbel": true, + "delete_gate_merge": true, + "delete_gate_bimodal_lambda": 0.05, + "bolmo_cross_attn_heads": 2, + "bolmo_cross_patch_window": 3, + "bolmo_causal_boundary": false, + "bolmo_causal_cross_patch": false, + "use_real_gather": true, + "phase2_budget_fraction": 0.5, + "use_ternary": true, + "use_boundary_predictor": false, + "use_delete_gate": true, + "use_embedding_alignment": true, + "name": "small_cpu1_byte_hidden", + "token_mixer": "mlgru", + "tokenization": "byte_dynamic", + "quantization": "ternary", + "fp_residual": true, + "use_bolmo_gating": true, + "description": "CPU-1 COMPLETE @ 10M, byte-level. Same as run_14 but WITH hidden states distillation (EmbeddingAligner). Does embedding alignment actually help over just logprobs?", + "cites": [ + "MatMul-free LM", + "Slender-Mamba", + "Bolmo", + "MrT5" + ], + "_current_phase": 1, + "use_gradient_checkpointing": false +} diff --git a/evaluation/source/experiments/published/configs/run_15_r2.json b/evaluation/source/experiments/published/configs/run_15_r2.json new file mode 100644 index 0000000000000000000000000000000000000000..644ef8f7232ed91cf94225b3e7db3f000a62a8b8 --- /dev/null +++ b/evaluation/source/experiments/published/configs/run_15_r2.json @@ -0,0 +1,66 @@ +{ + "d_model": 320, + "n_layers": 8, + "d_ff": 853, + "fp_rank": 4, + "n_heads": 8, + "head_dim": 40, + "window_size": 256, + "pfnet_hidden": 0, + "batch_per_gpu": 8, + "gradient_accumulation_steps": 3, + "lr": 0.0003, + "min_lr": 3e-05, + "warmup_steps": 67, + "total_steps": 1341, + "weight_decay_bitlinear": 0.1, + "weight_decay_fpresidual": 0.0, + "weight_decay_heads": 0.01, + "grad_clip": 1.0, + "seed": 42, + "training_signal": "distillation", + "temperature": 4.0, + "alpha_kl": 0.9, + "alpha_ce": 0.1, + "dataset_repo": "Cukinator/cpu1-ablation-dataset", + "seq_len": 5000, + "patch_size": 4, + "use_local_decoder": true, + "local_decoder_dim": 128, + "local_decoder_heads": 4, + "local_decoder_ff_ratio": 4.0, + "local_decoder_fp16": false, + "checkpoint_repo": "Cukinator/cpu1-ablation-checkpoints", + "save_every_steps": 67, + "checkpoint_fraction": 0.05, + "log_every_steps": 50, + "chinchilla": true, + "chinchilla_tokens_per_param": 15, + "warmup_ratio": 0.05, + "target_elimination": 0.4, + "mlgru_use_wo": true, + "mlgru_state_expansion": 1, + "delete_gate_hard": true, + "delete_gate_gumbel": true, + "delete_gate_merge": true, + "delete_gate_bimodal_lambda": 0.05, + "bolmo_cross_attn_heads": 2, + "bolmo_cross_patch_window": 3, + "bolmo_causal_boundary": false, + "bolmo_causal_cross_patch": false, + "use_real_gather": true, + "phase2_budget_fraction": 0.5, + "use_ternary": true, + "use_boundary_predictor": false, + "use_delete_gate": true, + "use_embedding_alignment": true, + "name": "small_cpu1_byte_hidden_15t", + "token_mixer": "mlgru", + "tokenization": "byte_dynamic", + "quantization": "ternary", + "fp_residual": true, + "use_bolmo_gating": true, + "description": "run_15 at 15 tok/param β€” small byte + hidden distillation with real budget.", + "_current_phase": 1, + "use_gradient_checkpointing": false +} diff --git a/evaluation/source/experiments/published/configs/run_15_v3.json b/evaluation/source/experiments/published/configs/run_15_v3.json new file mode 100644 index 0000000000000000000000000000000000000000..3a454b2d8fd4f02c01f178d908a7a7257eec1a31 --- /dev/null +++ b/evaluation/source/experiments/published/configs/run_15_v3.json @@ -0,0 +1,73 @@ +{ + "d_model": 320, + "n_layers": 8, + "d_ff": 853, + "fp_rank": 4, + "n_heads": 8, + "head_dim": 40, + "window_size": 256, + "pfnet_hidden": 0, + "batch_per_gpu": 8, + "gradient_accumulation_steps": 3, + "lr": 0.0003, + "min_lr": 3e-05, + "warmup_steps": 670, + "total_steps": 13415, + "weight_decay_bitlinear": 0.1, + "weight_decay_fpresidual": 0.0, + "weight_decay_heads": 0.01, + "bitlinear_lr_scale": 2.0, + "grad_clip": 1.0, + "seed": 42, + "training_signal": "distillation", + "temperature": 4.0, + "alpha_kl": 0.9, + "alpha_ce": 0.1, + "dataset_repo": "Cukinator/cpu1-ablation-dataset", + "seq_len": 5000, + "patch_size": 4, + "use_local_decoder": true, + "local_decoder_dim": 128, + "local_decoder_heads": 4, + "local_decoder_ff_ratio": 4.0, + "local_decoder_fp16": false, + "checkpoint_repo": "Cukinator/cpu1-ablation-checkpoints-v3", + "save_every_steps": 670, + "checkpoint_fraction": 0.05, + "log_every_steps": 50, + "chinchilla": true, + "chinchilla_tokens_per_param": 150, + "warmup_ratio": 0.05, + "target_elimination": 0.4, + "mlgru_use_wo": true, + "mlgru_state_expansion": 1, + "delete_gate_hard": true, + "delete_gate_gumbel": true, + "delete_gate_merge": true, + "delete_gate_bimodal_lambda": 0.05, + "bolmo_cross_attn_heads": 2, + "bolmo_cross_patch_window": 3, + "bolmo_causal_boundary": false, + "bolmo_causal_cross_patch": false, + "use_real_gather": true, + "phase2_budget_fraction": 0.5, + "use_ternary": true, + "use_boundary_predictor": false, + "use_delete_gate": true, + "use_embedding_alignment": true, + "name": "small_cpu1_byte_hidden", + "token_mixer": "mlgru", + "tokenization": "byte_dynamic", + "quantization": "ternary", + "fp_residual": true, + "use_bolmo_gating": true, + "description": "CPU-1 COMPLETE @ 10M, byte-level. Same as run_14 but WITH hidden states distillation (EmbeddingAligner). Does embedding alignment actually help over just logprobs?", + "cites": [ + "MatMul-free LM", + "Slender-Mamba", + "Bolmo", + "MrT5" + ], + "_current_phase": 1, + "use_gradient_checkpointing": false +} diff --git a/evaluation/source/experiments/published/configs/run_16.json b/evaluation/source/experiments/published/configs/run_16.json new file mode 100644 index 0000000000000000000000000000000000000000..a2af7a88f5cdae4f94ea47c96ba52a7562f2dbb8 --- /dev/null +++ b/evaluation/source/experiments/published/configs/run_16.json @@ -0,0 +1,72 @@ +{ + "d_model": 320, + "n_layers": 8, + "d_ff": 853, + "fp_rank": 4, + "n_heads": 8, + "head_dim": 40, + "window_size": 256, + "pfnet_hidden": 0, + "batch_per_gpu": 8, + "gradient_accumulation_steps": 3, + "lr": 0.0003, + "min_lr": 3e-05, + "warmup_steps": 50, + "total_steps": 600, + "weight_decay_bitlinear": 0.1, + "weight_decay_fpresidual": 0.0, + "weight_decay_heads": 0.01, + "grad_clip": 1.0, + "seed": 42, + "training_signal": "ce_only", + "temperature": 4.0, + "alpha_kl": 0.9, + "alpha_ce": 0.1, + "dataset_repo": "HuggingFaceFW/fineweb", + "seq_len": 5000, + "patch_size": 4, + "use_local_decoder": true, + "local_decoder_dim": 128, + "local_decoder_heads": 4, + "local_decoder_ff_ratio": 4.0, + "local_decoder_fp16": false, + "checkpoint_repo": "Cukinator/cpu1-ablation-checkpoints", + "save_every_steps": 30, + "checkpoint_fraction": 0.05, + "log_every_steps": 50, + "chinchilla": true, + "chinchilla_tokens_per_param": 2, + "warmup_ratio": 0.05, + "target_elimination": 0.4, + "mlgru_use_wo": true, + "mlgru_state_expansion": 1, + "delete_gate_hard": true, + "delete_gate_gumbel": true, + "delete_gate_merge": true, + "delete_gate_bimodal_lambda": 0.05, + "bolmo_cross_attn_heads": 2, + "bolmo_cross_patch_window": 3, + "bolmo_causal_boundary": false, + "bolmo_causal_cross_patch": false, + "use_real_gather": true, + "phase2_budget_fraction": 0.5, + "use_ternary": true, + "use_boundary_predictor": false, + "use_delete_gate": true, + "use_embedding_alignment": false, + "name": "small_cpu1_raw_bytes", + "token_mixer": "mlgru", + "tokenization": "byte_dynamic", + "quantization": "ternary", + "fp_residual": true, + "use_bolmo_gating": true, + "description": "CPU-1 COMPLETE @ 10M, raw bytes from scratch, zero teacher. Do Qwen logprobs in run_14 actually help vs pure CE?", + "cites": [ + "MatMul-free LM", + "Slender-Mamba", + "Bolmo", + "MrT5" + ], + "_current_phase": 1, + "use_gradient_checkpointing": false +} diff --git a/evaluation/source/experiments/published/configs/run_16_r2.json b/evaluation/source/experiments/published/configs/run_16_r2.json new file mode 100644 index 0000000000000000000000000000000000000000..18c5737251889ab3165b61d722a0ec1baae7f6ba --- /dev/null +++ b/evaluation/source/experiments/published/configs/run_16_r2.json @@ -0,0 +1,66 @@ +{ + "d_model": 320, + "n_layers": 8, + "d_ff": 853, + "fp_rank": 4, + "n_heads": 8, + "head_dim": 40, + "window_size": 256, + "pfnet_hidden": 0, + "batch_per_gpu": 8, + "gradient_accumulation_steps": 3, + "lr": 0.0003, + "min_lr": 3e-05, + "warmup_steps": 66, + "total_steps": 1336, + "weight_decay_bitlinear": 0.1, + "weight_decay_fpresidual": 0.0, + "weight_decay_heads": 0.01, + "grad_clip": 1.0, + "seed": 42, + "training_signal": "ce_only", + "temperature": 4.0, + "alpha_kl": 0.9, + "alpha_ce": 0.1, + "dataset_repo": "HuggingFaceFW/fineweb", + "seq_len": 5000, + "patch_size": 4, + "use_local_decoder": true, + "local_decoder_dim": 128, + "local_decoder_heads": 4, + "local_decoder_ff_ratio": 4.0, + "local_decoder_fp16": false, + "checkpoint_repo": "Cukinator/cpu1-ablation-checkpoints", + "save_every_steps": 66, + "checkpoint_fraction": 0.05, + "log_every_steps": 50, + "chinchilla": true, + "chinchilla_tokens_per_param": 15, + "warmup_ratio": 0.05, + "target_elimination": 0.4, + "mlgru_use_wo": true, + "mlgru_state_expansion": 1, + "delete_gate_hard": true, + "delete_gate_gumbel": true, + "delete_gate_merge": true, + "delete_gate_bimodal_lambda": 0.05, + "bolmo_cross_attn_heads": 2, + "bolmo_cross_patch_window": 3, + "bolmo_causal_boundary": false, + "bolmo_causal_cross_patch": false, + "use_real_gather": true, + "phase2_budget_fraction": 0.5, + "use_ternary": true, + "use_boundary_predictor": false, + "use_delete_gate": true, + "use_embedding_alignment": false, + "name": "small_cpu1_raw_bytes_15t", + "token_mixer": "mlgru", + "tokenization": "byte_dynamic", + "quantization": "ternary", + "fp_residual": true, + "use_bolmo_gating": true, + "description": "run_16 at 15 tok/param β€” small raw bytes no teacher with real budget.", + "_current_phase": 1, + "use_gradient_checkpointing": false +} diff --git a/evaluation/source/experiments/published/manifest.json b/evaluation/source/experiments/published/manifest.json new file mode 100644 index 0000000000000000000000000000000000000000..897c87676b5fbf24b196064b97baff06cffaa89c --- /dev/null +++ b/evaluation/source/experiments/published/manifest.json @@ -0,0 +1,447 @@ +{ + "scope": "34 published FP32 exports; configurations are audit records, not proof of the exact source commit used for training", + "experiments": [ + { + "run": "run_01", + "config": "configs/run_01.json", + "config_sha256": "e2f98fd9fdc8cdfabd7e2f72f2b3b04d4268a2b870e0d4ba2e4c4e2098d6f629", + "checkpoint_repo": "Cukinator/cpu1-ablations-final", + "checkpoint_revision": "65951289352c1a036b12ba6d888af037e7c90b13", + "checkpoint_file": "run_01/model.pt", + "checkpoint_sha256": "afd881decfab7c40f06e675f727561f9ad81ec3c82fd39eaaf33bf2cbf09fb28", + "saved_step": 912, + "audit_result_url": "https://huggingface.co/Cukinator/cpu1-ablations-final/blob/d38678e7c5d18577f36edade64495237c72a44b5/evaluation/run_01.json", + "configuration_source": "configuration recorded in the pinned audit; use_gradient_checkpointing was disabled by the evaluation loader", + "parameters": 54735360 + }, + { + "run": "run_01_v3", + "config": "configs/run_01_v3.json", + "config_sha256": "0f4c9db036b8b264c5ad5580c86afeeebe4a29e036206e60a433b0b5ab4dda0c", + "checkpoint_repo": "Cukinator/cpu1-ablations-final", + "checkpoint_revision": "65951289352c1a036b12ba6d888af037e7c90b13", + "checkpoint_file": "run_01_v3/model.pt", + "checkpoint_sha256": "dc8f256255308d36217f51d6c91c0f99a569315efc040bb4a8a6fcdb51049e36", + "saved_step": 12173, + "audit_result_url": "https://huggingface.co/Cukinator/cpu1-ablations-final/blob/d38678e7c5d18577f36edade64495237c72a44b5/evaluation/run_01_v3.json", + "configuration_source": "configuration recorded in the pinned audit; use_gradient_checkpointing was disabled by the evaluation loader", + "parameters": 54735360 + }, + { + "run": "run_02", + "config": "configs/run_02.json", + "config_sha256": "e908d470890f410d9dc15583946a9b51a3532b75f111c9a542dca11a3edbe0d6", + "checkpoint_repo": "Cukinator/cpu1-ablations-final", + "checkpoint_revision": "65951289352c1a036b12ba6d888af037e7c90b13", + "checkpoint_file": "run_02/model.pt", + "checkpoint_sha256": "9da358889c0d72fa04b155b720dc726b3dca050574e9e5a40564a24d38d3eb5e", + "saved_step": 647, + "audit_result_url": "https://huggingface.co/Cukinator/cpu1-ablations-final/blob/d38678e7c5d18577f36edade64495237c72a44b5/evaluation/run_02.json", + "configuration_source": "configuration recorded in the pinned audit; use_gradient_checkpointing was disabled by the evaluation loader", + "parameters": 38829569 + }, + { + "run": "run_02_v3", + "config": "configs/run_02_v3.json", + "config_sha256": "7c4954e3131a65f7e582c4a09b630fa9eaf1dc1c7885e2dadc05a47fa1313b14", + "checkpoint_repo": "Cukinator/cpu1-ablations-final", + "checkpoint_revision": "65951289352c1a036b12ba6d888af037e7c90b13", + "checkpoint_file": "run_02_v3/model.pt", + "checkpoint_sha256": "bc635a9fe2730240543705bda2f0bfbc6dd5d9d2759f7d1369ecb464e021c46a", + "saved_step": 10963, + "audit_result_url": "https://huggingface.co/Cukinator/cpu1-ablations-final/blob/d38678e7c5d18577f36edade64495237c72a44b5/evaluation/run_02_v3.json", + "configuration_source": "configuration recorded in the pinned audit; use_gradient_checkpointing was disabled by the evaluation loader", + "parameters": 38829569 + }, + { + "run": "run_02a_byte_only_heads", + "config": "configs/run_02a_byte_only_heads.json", + "config_sha256": "7d46728d4bc47eca5f4466cf629d5bacb3ba7439408fc925df54606f43c1ee04", + "checkpoint_repo": "Cukinator/cpu1-ablations-final", + "checkpoint_revision": "65951289352c1a036b12ba6d888af037e7c90b13", + "checkpoint_file": "run_02a_byte_only_heads/model.pt", + "checkpoint_sha256": "a97ca68d1d8882da2f288309aee1d10c9b623ef84694d3d4ed0e0988c6cf242a", + "saved_step": 641, + "audit_result_url": "https://huggingface.co/Cukinator/cpu1-ablations-final/blob/d38678e7c5d18577f36edade64495237c72a44b5/evaluation/run_02a_byte_only_heads.json", + "configuration_source": "configuration recorded in the pinned audit; use_gradient_checkpointing was disabled by the evaluation loader", + "parameters": 38500868 + }, + { + "run": "run_02a_byte_only_heads_v3", + "config": "configs/run_02a_byte_only_heads_v3.json", + "config_sha256": "3afc68d32cbde4be5bc7ee586d2f058a6c5c1137e53bfefc0617228c1b67d6b5", + "checkpoint_repo": "Cukinator/cpu1-ablations-final", + "checkpoint_revision": "65951289352c1a036b12ba6d888af037e7c90b13", + "checkpoint_file": "run_02a_byte_only_heads_v3/model.pt", + "checkpoint_sha256": "77e31f9ff202162d745b020eb9cfe8d5a748dd614ba114f712acca2c1507d5e3", + "saved_step": 16327, + "audit_result_url": "https://huggingface.co/Cukinator/cpu1-ablations-final/blob/d38678e7c5d18577f36edade64495237c72a44b5/evaluation/run_02a_byte_only_heads_v3.json", + "configuration_source": "configuration recorded in the pinned audit; use_gradient_checkpointing was disabled by the evaluation loader", + "parameters": 38500868 + }, + { + "run": "run_03", + "config": "configs/run_03.json", + "config_sha256": "9bc89e9a5bddad995155773ea045f70f72fc98ecabf89c821c0ef0b0ceba9ac1", + "checkpoint_repo": "Cukinator/cpu1-ablations-final", + "checkpoint_revision": "65951289352c1a036b12ba6d888af037e7c90b13", + "checkpoint_file": "run_03/model.pt", + "checkpoint_sha256": "9ceb9c3aa2d98d45cf102f1a7f39c596dd4c5fcba698eb581fdf5a890fb72498", + "saved_step": 647, + "audit_result_url": "https://huggingface.co/Cukinator/cpu1-ablations-final/blob/d38678e7c5d18577f36edade64495237c72a44b5/evaluation/run_03.json", + "configuration_source": "configuration recorded in the pinned audit; use_gradient_checkpointing was disabled by the evaluation loader", + "parameters": 38829569 + }, + { + "run": "run_03_v3", + "config": "configs/run_03_v3.json", + "config_sha256": "6ab5bedcd96448e00f65e47cf809aa482c72cb8d713e34389bb844655d1170df", + "checkpoint_repo": "Cukinator/cpu1-ablations-final", + "checkpoint_revision": "65951289352c1a036b12ba6d888af037e7c90b13", + "checkpoint_file": "run_03_v3/model.pt", + "checkpoint_sha256": "ea871efa66b8a301883e743f045ed8dc4e52949ed35c37809d41d7461626c044", + "saved_step": 6187, + "audit_result_url": "https://huggingface.co/Cukinator/cpu1-ablations-final/blob/d38678e7c5d18577f36edade64495237c72a44b5/evaluation/run_03_v3.json", + "configuration_source": "configuration recorded in the pinned audit; use_gradient_checkpointing was disabled by the evaluation loader", + "parameters": 38829569 + }, + { + "run": "run_04", + "config": "configs/run_04.json", + "config_sha256": "6f25943422b4da024a608e0a0f577623d2e611686ac8357da7923514c4804b49", + "checkpoint_repo": "Cukinator/cpu1-ablations-final", + "checkpoint_revision": "65951289352c1a036b12ba6d888af037e7c90b13", + "checkpoint_file": "run_04/model.pt", + "checkpoint_sha256": "3af6570f55ecdf604adacce6f67a319aaa7823b7177a4023143401d7fe145f5e", + "saved_step": 647, + "audit_result_url": "https://huggingface.co/Cukinator/cpu1-ablations-final/blob/d38678e7c5d18577f36edade64495237c72a44b5/evaluation/run_04.json", + "configuration_source": "configuration recorded in the pinned audit; use_gradient_checkpointing was disabled by the evaluation loader", + "parameters": 38854145 + }, + { + "run": "run_04_r2", + "config": "configs/run_04_r2.json", + "config_sha256": "187928a4b35b4983653f13d2e3adfd0040f5c51736338cd93afb92e1b58eafe8", + "checkpoint_repo": "Cukinator/cpu1-ablations-final", + "checkpoint_revision": "65951289352c1a036b12ba6d888af037e7c90b13", + "checkpoint_file": "run_04_r2/model.pt", + "checkpoint_sha256": "6e8f1fff076f0482c4970f01c7aa944315d06bae748dad9552345ea36285bf26", + "saved_step": 4840, + "audit_result_url": "https://huggingface.co/Cukinator/cpu1-ablations-final/blob/d38678e7c5d18577f36edade64495237c72a44b5/evaluation/run_04_r2.json", + "configuration_source": "configuration recorded in the pinned audit; use_gradient_checkpointing was disabled by the evaluation loader", + "parameters": 38854145 + }, + { + "run": "run_04_v3", + "config": "configs/run_04_v3.json", + "config_sha256": "fbf755ddaf8bfb4123b1df6cbeaad0b65e4b14e0065a7b936ad2edbd6d06ea4a", + "checkpoint_repo": "Cukinator/cpu1-ablations-final", + "checkpoint_revision": "65951289352c1a036b12ba6d888af037e7c90b13", + "checkpoint_file": "run_04_v3/model.pt", + "checkpoint_sha256": "32c79b76fa76eca39c8d733c08c6e8acd16d23fefe9dd6f0684a53a018042c09", + "saved_step": 6074, + "audit_result_url": "https://huggingface.co/Cukinator/cpu1-ablations-final/blob/d38678e7c5d18577f36edade64495237c72a44b5/evaluation/run_04_v3.json", + "configuration_source": "configuration recorded in the pinned audit; use_gradient_checkpointing was disabled by the evaluation loader", + "parameters": 38854145 + }, + { + "run": "run_05", + "config": "configs/run_05.json", + "config_sha256": "4e04b8cca73a9f299034a429a5bf711f3e419909b2ebd91c9d7865e318efae8b", + "checkpoint_repo": "Cukinator/cpu1-ablations-final", + "checkpoint_revision": "65951289352c1a036b12ba6d888af037e7c90b13", + "checkpoint_file": "run_05/model.pt", + "checkpoint_sha256": "38009430f02aa997948340acb7e9ea80956fc777c0fcb61ab878dd7bd346ced2", + "saved_step": 649, + "audit_result_url": "https://huggingface.co/Cukinator/cpu1-ablations-final/blob/d38678e7c5d18577f36edade64495237c72a44b5/evaluation/run_05.json", + "configuration_source": "configuration recorded in the pinned audit; use_gradient_checkpointing was disabled by the evaluation loader", + "parameters": 38993921 + }, + { + "run": "run_05_v3", + "config": "configs/run_05_v3.json", + "config_sha256": "36e28f0ccd488ac8c9b3a3b8695a3c9c854524b97bf7d25d0f05bdd5743a97e4", + "checkpoint_repo": "Cukinator/cpu1-ablations-final", + "checkpoint_revision": "65951289352c1a036b12ba6d888af037e7c90b13", + "checkpoint_file": "run_05_v3/model.pt", + "checkpoint_sha256": "bca43e31e0822c8ae008d5b930113b5cb9346a4623e896093375c4c0b5113296", + "saved_step": 4390, + "audit_result_url": "https://huggingface.co/Cukinator/cpu1-ablations-final/blob/d38678e7c5d18577f36edade64495237c72a44b5/evaluation/run_05_v3.json", + "configuration_source": "configuration recorded in the pinned audit; use_gradient_checkpointing was disabled by the evaluation loader", + "parameters": 38993921 + }, + { + "run": "run_05b_kernel_strict", + "config": "configs/run_05b_kernel_strict.json", + "config_sha256": "3d43c99ac50d3a57a75139fa2ceccd5c3ed63b826d21a8fa8a8b932bbc5f5924", + "checkpoint_repo": "Cukinator/cpu1-ablations-final", + "checkpoint_revision": "65951289352c1a036b12ba6d888af037e7c90b13", + "checkpoint_file": "run_05b_kernel_strict/model.pt", + "checkpoint_sha256": "68619093de4f4a914c7ddc50ca4aaf0774b82ec21b98dae892491489b0bddaf0", + "saved_step": 600, + "audit_result_url": "https://huggingface.co/Cukinator/cpu1-ablations-final/blob/d38678e7c5d18577f36edade64495237c72a44b5/evaluation/run_05b_kernel_strict.json", + "configuration_source": "configuration recorded in the pinned audit; use_gradient_checkpointing was disabled by the evaluation loader", + "parameters": 35842049 + }, + { + "run": "run_05b_kernel_strict_v3", + "config": "configs/run_05b_kernel_strict_v3.json", + "config_sha256": "8d9d6d41140985130c78f9dec9bb84ddb5f031eebe3d89d1237755a8027481e7", + "checkpoint_repo": "Cukinator/cpu1-ablations-final", + "checkpoint_revision": "65951289352c1a036b12ba6d888af037e7c90b13", + "checkpoint_file": "run_05b_kernel_strict_v3/model.pt", + "checkpoint_sha256": "7330a3759f2bcbe03952132b56e11110a2d754c0ccbca896deef7cdaaf729f2f", + "saved_step": 2573, + "audit_result_url": "https://huggingface.co/Cukinator/cpu1-ablations-final/blob/d38678e7c5d18577f36edade64495237c72a44b5/evaluation/run_05b_kernel_strict_v3.json", + "configuration_source": "configuration recorded in the pinned audit; use_gradient_checkpointing was disabled by the evaluation loader", + "parameters": 35842049 + }, + { + "run": "run_06", + "config": "configs/run_06.json", + "config_sha256": "d0698be1854b8a50f7d0b504d86719de59a88caa28be41e04bf57349bc8951b8", + "checkpoint_repo": "Cukinator/cpu1-ablations-final", + "checkpoint_revision": "65951289352c1a036b12ba6d888af037e7c90b13", + "checkpoint_file": "run_06/model.pt", + "checkpoint_sha256": "08359c613616f9a6aad28c3c192d362902e7a6b9f966cad78da3c029315c6e27", + "saved_step": 649, + "audit_result_url": "https://huggingface.co/Cukinator/cpu1-ablations-final/blob/d38678e7c5d18577f36edade64495237c72a44b5/evaluation/run_06.json", + "configuration_source": "configuration recorded in the pinned audit; use_gradient_checkpointing was disabled by the evaluation loader", + "parameters": 38994146 + }, + { + "run": "run_06_v3", + "config": "configs/run_06_v3.json", + "config_sha256": "44c0f88735708a071d351f967746b909ef77b23f6724015ee43c84781b6d32b2", + "checkpoint_repo": "Cukinator/cpu1-ablations-final", + "checkpoint_revision": "65951289352c1a036b12ba6d888af037e7c90b13", + "checkpoint_file": "run_06_v3/model.pt", + "checkpoint_sha256": "d2c08a75f3f35e64ac89975e2124d2de2917bc11f599f2965558e869cd376fe8", + "saved_step": 4237, + "audit_result_url": "https://huggingface.co/Cukinator/cpu1-ablations-final/blob/d38678e7c5d18577f36edade64495237c72a44b5/evaluation/run_06_v3.json", + "configuration_source": "configuration recorded in the pinned audit; use_gradient_checkpointing was disabled by the evaluation loader", + "parameters": 38994146 + }, + { + "run": "run_07", + "config": "configs/run_07.json", + "config_sha256": "347a3f9ca8ca26decfcfcb720be554eac62251a793ce708d755ce0283b73cb9b", + "checkpoint_repo": "Cukinator/cpu1-ablations-final", + "checkpoint_revision": "65951289352c1a036b12ba6d888af037e7c90b13", + "checkpoint_file": "run_07/model.pt", + "checkpoint_sha256": "769a775926b401bef367195e9060afb0d1fe04e93cb3d347fb35c50f2bbafba7", + "saved_step": 650, + "audit_result_url": "https://huggingface.co/Cukinator/cpu1-ablations-final/blob/d38678e7c5d18577f36edade64495237c72a44b5/evaluation/run_07.json", + "configuration_source": "configuration recorded in the pinned audit; use_gradient_checkpointing was disabled by the evaluation loader", + "parameters": 39028579 + }, + { + "run": "run_07_r2", + "config": "configs/run_07_r2.json", + "config_sha256": "b92329e2e123104c8282afaf736cda831f5b08d2abfd9b843b8159e3f13194d3", + "checkpoint_repo": "Cukinator/cpu1-ablations-final", + "checkpoint_revision": "65951289352c1a036b12ba6d888af037e7c90b13", + "checkpoint_file": "run_07_r2/model.pt", + "checkpoint_sha256": "1117741fa49dda11a3157950dfbd4a802354f055fb70436de2146c3cc6c278d8", + "saved_step": 4860, + "audit_result_url": "https://huggingface.co/Cukinator/cpu1-ablations-final/blob/d38678e7c5d18577f36edade64495237c72a44b5/evaluation/run_07_r2.json", + "configuration_source": "configuration recorded in the pinned audit; use_gradient_checkpointing was disabled by the evaluation loader", + "parameters": 39028579 + }, + { + "run": "run_08", + "config": "configs/run_08.json", + "config_sha256": "f93ed9c4057564dc019d3ace1f2d8010f1b56c79d3c89d581e55b2921f78474f", + "checkpoint_repo": "Cukinator/cpu1-ablations-final", + "checkpoint_revision": "65951289352c1a036b12ba6d888af037e7c90b13", + "checkpoint_file": "run_08/model.pt", + "checkpoint_sha256": "c847ce660f4556040787baf247b5390cc66b5758236e7b64bb687145e2b660e9", + "saved_step": 647, + "audit_result_url": "https://huggingface.co/Cukinator/cpu1-ablations-final/blob/d38678e7c5d18577f36edade64495237c72a44b5/evaluation/run_08.json", + "configuration_source": "configuration recorded in the pinned audit; use_gradient_checkpointing was disabled by the evaluation loader", + "parameters": 38854145 + }, + { + "run": "run_08_v3", + "config": "configs/run_08_v3.json", + "config_sha256": "b3f464f363095fe8fce71b8c7f9d409563c675187ea5ba0b96d6fb46110877d3", + "checkpoint_repo": "Cukinator/cpu1-ablations-final", + "checkpoint_revision": "65951289352c1a036b12ba6d888af037e7c90b13", + "checkpoint_file": "run_08_v3/model.pt", + "checkpoint_sha256": "d9b67685ec976e175b9481eef24258e3dff2ef53674c598e3b3a3fa5e0026471", + "saved_step": 3858, + "audit_result_url": "https://huggingface.co/Cukinator/cpu1-ablations-final/blob/d38678e7c5d18577f36edade64495237c72a44b5/evaluation/run_08_v3.json", + "configuration_source": "configuration recorded in the pinned audit; use_gradient_checkpointing was disabled by the evaluation loader", + "parameters": 38854145 + }, + { + "run": "run_09", + "config": "configs/run_09.json", + "config_sha256": "da8577c7a668e8bfce7553074a835ba5bc88683d228e5dcbfb1705c87428c0b5", + "checkpoint_repo": "Cukinator/cpu1-ablations-final", + "checkpoint_revision": "65951289352c1a036b12ba6d888af037e7c90b13", + "checkpoint_file": "run_09/model.pt", + "checkpoint_sha256": "857bb84ec29709140ebae70dcb1779591d730f1183ae2526e1379e634b6ad106", + "saved_step": 657, + "audit_result_url": "https://huggingface.co/Cukinator/cpu1-ablations-final/blob/d38678e7c5d18577f36edade64495237c72a44b5/evaluation/run_09.json", + "configuration_source": "configuration recorded in the pinned audit; use_gradient_checkpointing was disabled by the evaluation loader", + "parameters": 39427939 + }, + { + "run": "run_10", + "config": "configs/run_10.json", + "config_sha256": "4b036ebc04ed65e2bc469e7a51c2daf2777c6b58875db280c240d9677c7c6571", + "checkpoint_repo": "Cukinator/cpu1-ablations-final", + "checkpoint_revision": "65951289352c1a036b12ba6d888af037e7c90b13", + "checkpoint_file": "run_10/model.pt", + "checkpoint_sha256": "0419cfbeda000493465f3d275352a76a59511232d553275bfcbe0aa45cd84d16", + "saved_step": 657, + "audit_result_url": "https://huggingface.co/Cukinator/cpu1-ablations-final/blob/d38678e7c5d18577f36edade64495237c72a44b5/evaluation/run_10.json", + "configuration_source": "configuration recorded in the pinned audit; use_gradient_checkpointing was disabled by the evaluation loader", + "parameters": 39434083 + }, + { + "run": "run_13", + "config": "configs/run_13.json", + "config_sha256": "dfaba6de44e6bb36d768b08dfdfe9e555eb6c53ea354f7c6391aa34d66710aff", + "checkpoint_repo": "Cukinator/cpu1-ablations-final", + "checkpoint_revision": "65951289352c1a036b12ba6d888af037e7c90b13", + "checkpoint_file": "run_13/model.pt", + "checkpoint_sha256": "21d30529f1f7ce72670c8d9b470165b662a8a41702842a23d8d90de0aa37a1c4", + "saved_step": 600, + "audit_result_url": "https://huggingface.co/Cukinator/cpu1-ablations-final/blob/d38678e7c5d18577f36edade64495237c72a44b5/evaluation/run_13.json", + "configuration_source": "configuration recorded in the pinned audit; use_gradient_checkpointing was disabled by the evaluation loader", + "parameters": 12547785 + }, + { + "run": "run_13_r2", + "config": "configs/run_13_r2.json", + "config_sha256": "cdd1de12b675d1cc65e519ea169f5fcb6cad34d6cb98c46425da01db3a358ac8", + "checkpoint_repo": "Cukinator/cpu1-ablations-final", + "checkpoint_revision": "65951289352c1a036b12ba6d888af037e7c90b13", + "checkpoint_file": "run_13_r2/model.pt", + "checkpoint_sha256": "ad0aa7ce787677f5bbf8b11962720a203b3880218d4a1f1a0eaa178258162a4c", + "saved_step": 1568, + "audit_result_url": "https://huggingface.co/Cukinator/cpu1-ablations-final/blob/d38678e7c5d18577f36edade64495237c72a44b5/evaluation/run_13_r2.json", + "configuration_source": "configuration recorded in the pinned audit; use_gradient_checkpointing was disabled by the evaluation loader", + "parameters": 12547785 + }, + { + "run": "run_13_v3", + "config": "configs/run_13_v3.json", + "config_sha256": "843976af95d0bb2dd2345e57d2cf3d12855367774ad8a25b6187a9dca4e5f39a", + "checkpoint_repo": "Cukinator/cpu1-ablations-final", + "checkpoint_revision": "65951289352c1a036b12ba6d888af037e7c90b13", + "checkpoint_file": "run_13_v3/model.pt", + "checkpoint_sha256": "0b53b891bfd8017d2027a266fdaca617ec11a2049b3987204bc0d67038db4453", + "saved_step": 9290, + "audit_result_url": "https://huggingface.co/Cukinator/cpu1-ablations-final/blob/d38678e7c5d18577f36edade64495237c72a44b5/evaluation/run_13_v3.json", + "configuration_source": "configuration recorded in the pinned audit; use_gradient_checkpointing was disabled by the evaluation loader", + "parameters": 12547785 + }, + { + "run": "run_14", + "config": "configs/run_14.json", + "config_sha256": "498592c3dcd1bcb5b078b6446c05f00e3713305577eb73735c60d09a385c2e8e", + "checkpoint_repo": "Cukinator/cpu1-ablations-final", + "checkpoint_revision": "65951289352c1a036b12ba6d888af037e7c90b13", + "checkpoint_file": "run_14/model.pt", + "checkpoint_sha256": "21cb3c94a5742d587934710f662bb4104a77634025fc0de43b517a88088af6e1", + "saved_step": 600, + "audit_result_url": "https://huggingface.co/Cukinator/cpu1-ablations-final/blob/d38678e7c5d18577f36edade64495237c72a44b5/evaluation/run_14.json", + "configuration_source": "configuration recorded in the pinned audit; use_gradient_checkpointing was disabled by the evaluation loader", + "parameters": 10691371 + }, + { + "run": "run_14_r2", + "config": "configs/run_14_r2.json", + "config_sha256": "6747d092b87090f9d34e29ce0d68be88d1c732961a89967acbcd45b5a96091fd", + "checkpoint_repo": "Cukinator/cpu1-ablations-final", + "checkpoint_revision": "65951289352c1a036b12ba6d888af037e7c90b13", + "checkpoint_file": "run_14_r2/model.pt", + "checkpoint_sha256": "9acfcd5c043fe11f0997fee0919fa93ee80eed55816557638706661680c0666e", + "saved_step": 1336, + "audit_result_url": "https://huggingface.co/Cukinator/cpu1-ablations-final/blob/d38678e7c5d18577f36edade64495237c72a44b5/evaluation/run_14_r2.json", + "configuration_source": "configuration recorded in the pinned audit; use_gradient_checkpointing was disabled by the evaluation loader", + "parameters": 10691371 + }, + { + "run": "run_14_v3", + "config": "configs/run_14_v3.json", + "config_sha256": "dcca5697cdb6901d2def389f5d3574828d9f09bd1ffe4c07c70e86860d54e905", + "checkpoint_repo": "Cukinator/cpu1-ablations-final", + "checkpoint_revision": "65951289352c1a036b12ba6d888af037e7c90b13", + "checkpoint_file": "run_14_v3/model.pt", + "checkpoint_sha256": "553f07ea4e4857e6099b224cf7ba099135450e78a94f6adb9ad894b199d1c3c4", + "saved_step": 9775, + "audit_result_url": "https://huggingface.co/Cukinator/cpu1-ablations-final/blob/d38678e7c5d18577f36edade64495237c72a44b5/evaluation/run_14_v3.json", + "configuration_source": "configuration recorded in the pinned audit; use_gradient_checkpointing was disabled by the evaluation loader", + "parameters": 10691371 + }, + { + "run": "run_15", + "config": "configs/run_15.json", + "config_sha256": "c7592ef602f1443e1c3e1f72d29e149b3977b4fb49db0308dc3d8603317b5048", + "checkpoint_repo": "Cukinator/cpu1-ablations-final", + "checkpoint_revision": "65951289352c1a036b12ba6d888af037e7c90b13", + "checkpoint_file": "run_15/model.pt", + "checkpoint_sha256": "9a78524371ab688b9801f2b754afa9a44cbd2db06a0f5cf5e9bb366a80497158", + "saved_step": 600, + "audit_result_url": "https://huggingface.co/Cukinator/cpu1-ablations-final/blob/d38678e7c5d18577f36edade64495237c72a44b5/evaluation/run_15.json", + "configuration_source": "configuration recorded in the pinned audit; use_gradient_checkpointing was disabled by the evaluation loader", + "parameters": 10732331 + }, + { + "run": "run_15_r2", + "config": "configs/run_15_r2.json", + "config_sha256": "58b95f087f3c3659940cc5168fcbc7b65422bb8bdaecb478477fa97e45859eb7", + "checkpoint_repo": "Cukinator/cpu1-ablations-final", + "checkpoint_revision": "65951289352c1a036b12ba6d888af037e7c90b13", + "checkpoint_file": "run_15_r2/model.pt", + "checkpoint_sha256": "5acf8861484fe31c49b59b50d816f0e7fee896da030773d8fab4428e06c19d7d", + "saved_step": 1341, + "audit_result_url": "https://huggingface.co/Cukinator/cpu1-ablations-final/blob/d38678e7c5d18577f36edade64495237c72a44b5/evaluation/run_15_r2.json", + "configuration_source": "configuration recorded in the pinned audit; use_gradient_checkpointing was disabled by the evaluation loader", + "parameters": 10732331 + }, + { + "run": "run_15_v3", + "config": "configs/run_15_v3.json", + "config_sha256": "8e5ed148279277102b3d9b1646f69299d6dedfe5a84ebf101c046a9c3b5005e4", + "checkpoint_repo": "Cukinator/cpu1-ablations-final", + "checkpoint_revision": "65951289352c1a036b12ba6d888af037e7c90b13", + "checkpoint_file": "run_15_v3/model.pt", + "checkpoint_sha256": "4d192808ecde2c4d097448869e40641044477f7661bacc500971af8e4008682c", + "saved_step": 2350, + "audit_result_url": "https://huggingface.co/Cukinator/cpu1-ablations-final/blob/d38678e7c5d18577f36edade64495237c72a44b5/evaluation/run_15_v3.json", + "configuration_source": "configuration recorded in the pinned audit; use_gradient_checkpointing was disabled by the evaluation loader", + "parameters": 10732331 + }, + { + "run": "run_16", + "config": "configs/run_16.json", + "config_sha256": "035e01bdf4b072c76178b66a139a0eb66d0903a62601677a61fd49b1becd43ba", + "checkpoint_repo": "Cukinator/cpu1-ablations-final", + "checkpoint_revision": "65951289352c1a036b12ba6d888af037e7c90b13", + "checkpoint_file": "run_16/model.pt", + "checkpoint_sha256": "b5d819e4f8a8f311b4f828461ab3d3f4888e6083ef8e41ddba775136a1217462", + "saved_step": 600, + "audit_result_url": "https://huggingface.co/Cukinator/cpu1-ablations-final/blob/d38678e7c5d18577f36edade64495237c72a44b5/evaluation/run_16.json", + "configuration_source": "configuration recorded in the pinned audit; use_gradient_checkpointing was disabled by the evaluation loader", + "parameters": 10691371 + }, + { + "run": "run_16_r2", + "config": "configs/run_16_r2.json", + "config_sha256": "644b2e47deca224a25fd0ef6fab0d99d27caeb24277f9779616241c7b7dd4c4a", + "checkpoint_repo": "Cukinator/cpu1-ablations-final", + "checkpoint_revision": "65951289352c1a036b12ba6d888af037e7c90b13", + "checkpoint_file": "run_16_r2/model.pt", + "checkpoint_sha256": "de69bc54a1eba051f8714a3fbfb792643da7f96c6c53626857f6b9043dd8c5df", + "saved_step": 1336, + "audit_result_url": "https://huggingface.co/Cukinator/cpu1-ablations-final/blob/d38678e7c5d18577f36edade64495237c72a44b5/evaluation/run_16_r2.json", + "configuration_source": "configuration recorded in the pinned audit; use_gradient_checkpointing was disabled by the evaluation loader", + "parameters": 10691371 + } + ] +} diff --git a/evaluation/source/inference/benchmark.c b/evaluation/source/inference/benchmark.c new file mode 100644 index 0000000000000000000000000000000000000000..1eb0f46a7283e0122aaa094811ce5cf8b4e4c864 --- /dev/null +++ b/evaluation/source/inference/benchmark.c @@ -0,0 +1,585 @@ +/* + * benchmark.c β€” Standalone C benchmark for CPU-1 170M inference + * + * Compile (Windows): + * g++ -O3 -mavx2 -mfma -fopenmp -falign-loops=32 -funroll-loops -ffast-math + * -x c++ -o benchmark.exe benchmark.c kernels.cpp -lm + * + * Compile (Linux/WSL): + * g++ -O3 -mavx2 -mfma -fopenmp -falign-loops=32 -funroll-loops -ffast-math + * -x c++ -o benchmark benchmark.c kernels.cpp -lm + * + * Run: + * ./benchmark --patches 200 --warmup 20 --mode 0 + */ +#include +#include +#include +#include +#include +#include + +#ifdef _WIN32 +#include +static double get_time_sec(void) { + LARGE_INTEGER freq, cnt; + QueryPerformanceFrequency(&freq); + QueryPerformanceCounter(&cnt); + return (double)cnt.QuadPart / (double)freq.QuadPart; +} +#else +#include +#include +static double get_time_sec(void) { + struct timespec ts; + clock_gettime(CLOCK_MONOTONIC, &ts); + return ts.tv_sec + ts.tv_nsec * 1e-9; +} +#endif + +/* ── Struct must match kernels.cpp LayerDataMAD exactly ─────────────── */ +struct LayerDataMAD { + const float* norm1_w; const float* norm2_w; float norm_eps; + const uint8_t* W_forget; float s_forget; + const uint8_t* W_cand; float s_cand; + const uint8_t* W_out; float s_out; + const uint8_t* W_gate; float s_gate; + const uint8_t* W_up; float s_up; + const uint8_t* W_down; float s_down; + const float* fp_A_mix; const float* fp_B_mix; + const float* fp_A_down; const float* fp_B_down; + const float* pfnet_norm_w; + const uint8_t* pfnet_w1; float pfnet_s1; + const uint8_t* pfnet_w2; float pfnet_s2; +}; + +/* ── Extern declarations from kernels.cpp ───────────────────────────── */ +#ifdef __cplusplus +extern "C" { +#endif + +void pack_ternary_to_2bit_mad(const int8_t* W, uint8_t* packed, int d_out, int d_in); + +void forward_full_mad( + const float* x_in, float* x_out, float* h_all, + const struct LayerDataMAD* layers, + int n_layers, int d_model, int d_ff, int fp_rank, int pfnet_hidden); + +void forward_full_mad_st( + const float* x_in, float* x_out, float* h_all, + const struct LayerDataMAD* layers, + int n_layers, int d_model, int d_ff, int fp_rank, int pfnet_hidden); + +void forward_full_mad_batch( + const float* const* x_in_array, + float* const* x_out_array, + float* const* h_all_array, + const struct LayerDataMAD* layers, + int n_layers, int d_model, int d_ff, int fp_rank, int pfnet_hidden, + int n_patches, int n_threads); + +void forward_full_mad_pipeline( + const float* const* x_in_array, + float* const* x_out_array, + float* h_all, + const struct LayerDataMAD* layers, + int n_layers, int d_model, int d_ff, int fp_rank, int pfnet_hidden, + int n_patches, int pin_threads, + int n_stages, int do_calibrate); + +void decode_layer_fused_2bit_mad( + const float* x_in, float* x_out, float* h, + const float* norm1_w, const float* norm2_w, float norm_eps, + const uint8_t* W_forget, float s_forget, + const uint8_t* W_cand, float s_cand, + const uint8_t* W_out, float s_out, + const uint8_t* W_gate, float s_gate, + const uint8_t* W_up, float s_up, + const uint8_t* W_down, float s_down, + int d_model, int d_ff); + +void local_decode_step( + const float* h, const uint8_t* W_hproj, float s_hproj, + const float* byte_emb_table, const float* pos_emb, + const int32_t* generated, int k, + int d_model, int d_local, int n_heads, int d_ff_local, int patch_size, + const float* norm1_w, + const uint8_t* W_q, float s_q, + const uint8_t* W_k, float s_k, + const uint8_t* W_v, float s_v, + const float* o_norm_w, + const uint8_t* W_o, float s_o, + const float* norm2_w, + const uint8_t* W_gate, float s_gate, + const uint8_t* W_up, float s_up, + const float* ffn_down_norm_w, + const uint8_t* W_down, float s_down, + const float* out_norm_w, + const uint8_t* W_out, float s_out, + float norm_eps, + float* logits_out); + +#ifdef __cplusplus +} +#endif + +/* ── Memory helpers ─────────────────────────────────────────────────── */ + +static void* alloc_aligned(size_t align, size_t size) { +#ifdef _WIN32 + void* p = _aligned_malloc(size, align); +#else + void* p = aligned_alloc(align, ((size + align - 1) / align) * align); +#endif + if (!p) { fprintf(stderr, "OOM %zu bytes\n", size); exit(1); } + memset(p, 0, size); + return p; +} + +static void* alloc_aligned_hugepages(size_t size) { +#ifdef _WIN32 + void* p = VirtualAlloc(NULL, size, MEM_COMMIT | MEM_LARGE_PAGES, PAGE_READWRITE); + if (!p) p = _aligned_malloc(size, 64); + if (!p) { fprintf(stderr, "OOM %zu bytes\n", size); exit(1); } + memset(p, 0, size); +#else + void* p; + if (posix_memalign(&p, 64, size) != 0) { + fprintf(stderr, "OOM %zu bytes\n", size); exit(1); + } + memset(p, 0, size); + madvise(p, size, MADV_HUGEPAGE); +#endif + return p; +} + +static void free_aligned(void* p) { +#ifdef _WIN32 + _aligned_free(p); +#else + free(p); +#endif +} + +static void free_aligned_hugepages(void* p) { +#ifdef _WIN32 + if (!VirtualFree(p, 0, MEM_RELEASE)) _aligned_free(p); +#else + free(p); +#endif +} + +static float* alloc_f32(int n) { return (float*) alloc_aligned(64, n * sizeof(float)); } +static int8_t* alloc_i8(int n) { return (int8_t*) alloc_aligned(64, n); } +static uint8_t* alloc_u8(int n) { return (uint8_t*)alloc_aligned(64, n); } +static float* alloc_f32_hp(int n) { return (float*) alloc_aligned_hugepages(n * sizeof(float)); } +static uint8_t* alloc_u8_hp(int n) { return (uint8_t*)alloc_aligned_hugepages(n); } + +/* ── Weight creation ───────────────────────────────────────────────── */ + +static uint8_t* make_random_mad_weight(int d_out, int d_in) { + size_t raw_size = (size_t)d_out * d_in; + int8_t* raw = (int8_t*)alloc_aligned(64, raw_size); + for (size_t i = 0; i < raw_size; i++) + raw[i] = (int8_t)((rand() % 3) - 1); /* {-1, 0, 1} */ + int ncb = (d_in + 31) / 32; + int mad_size = ((d_out + 3) / 4) * ncb * 32; + uint8_t* packed = alloc_u8_hp(mad_size); + pack_ternary_to_2bit_mad(raw, packed, d_out, d_in); + free_aligned(raw); + return packed; +} + +static float* make_random_f32(int n, float scale) { + float* v = alloc_f32(n); + for (int i = 0; i < n; i++) + v[i] = ((float)(rand() % 1000) / 500.0f - 1.0f) * scale; + return v; +} + +static float* make_random_f32_hp(int n, float scale) { + float* v = alloc_f32_hp(n); + for (int i = 0; i < n; i++) + v[i] = ((float)(rand() % 1000) / 500.0f - 1.0f) * scale; + return v; +} + +/* ── Sorting ───────────────────────────────────────────────────────── */ + +static int cmp_double(const void* a, const void* b) { + double da = *(const double*)a, db = *(const double*)b; + return (da > db) - (da < db); +} + +/* ── MegaByte LocalByteDecoder weight bundle ─────────────────────── */ +struct LocalDecW { + const uint8_t *W_hproj; + const uint8_t *W_q, *W_k, *W_v, *W_o; + const uint8_t *W_gate, *W_up, *W_down, *W_out; + const float *byte_emb, *pos_emb; + const float *norm1_w, *norm2_w; + /* Fused-BitLinear inner norms (nullable β€” identity fallback). */ + const float *o_norm_w, *ffn_down_norm_w, *out_norm_w; + int d_local, d_ff_local, n_heads, patch_size; +}; + +/* Run all 4 local_decode_step calls (autoregressive byte generation + * inside one patch). x_out is the global model output [d_model]. */ +static inline void run_local_patch( + const float* x_out, int d_model, const struct LocalDecW* L +) { + int32_t generated[4] = {0}; + float logits[256]; + const float scale = 0.01f; + for (int kb = 0; kb < L->patch_size; kb++) { + local_decode_step( + x_out, + L->W_hproj, scale, + L->byte_emb, L->pos_emb, + generated, kb, + d_model, L->d_local, L->n_heads, L->d_ff_local, L->patch_size, + L->norm1_w, + L->W_q, scale, L->W_k, scale, L->W_v, scale, + L->o_norm_w, L->W_o, scale, + L->norm2_w, + L->W_gate, scale, L->W_up, scale, + L->ffn_down_norm_w, L->W_down, scale, + L->out_norm_w, L->W_out, scale, + 1e-6f, logits); + /* emulate argmax of the freshly-generated logits */ + generated[kb] = (kb * 17) % 256; + } +} + +/* ── Main ──────────────────────────────────────────────────────────── */ + +int main(int argc, char** argv) { + int d_model = 1024, n_layers = 14, d_ff = 2688; + int fp_rank = 8, pfnet_hidden = 64; + int n_patches = 200, n_warmup = 20; + /* 0=forward_full_mad (OMP), 1=per-layer, 2=ST single-threaded, + 3=batch, 4=local_decode (global+4 local steps) */ + int mode = 0; + int n_threads = 0; + int batch_size = 1; + int pipe_chunk = 128; + int pipe_pin = 1; + int pipe_stages = 6; /* default: use all 6 physical cores on i7-8750H */ + int pipe_calibrate= 1; /* default: calibrate per-layer cost + DP split */ + int local_decode = 1; /* default: run 4 local_decode_step per patch */ + + for (int i = 1; i < argc; i++) { + if (!strcmp(argv[i], "--patches") && i+1 < argc) n_patches = atoi(argv[++i]); + else if (!strcmp(argv[i], "--warmup") && i+1 < argc) n_warmup = atoi(argv[++i]); + else if (!strcmp(argv[i], "--d_model") && i+1 < argc) d_model = atoi(argv[++i]); + else if (!strcmp(argv[i], "--d_ff") && i+1 < argc) d_ff = atoi(argv[++i]); + else if (!strcmp(argv[i], "--n_layers") && i+1 < argc) n_layers = atoi(argv[++i]); + else if (!strcmp(argv[i], "--fp_rank") && i+1 < argc) fp_rank = atoi(argv[++i]); + else if (!strcmp(argv[i], "--pfnet") && i+1 < argc) pfnet_hidden = atoi(argv[++i]); + else if (!strcmp(argv[i], "--mode") && i+1 < argc) mode = atoi(argv[++i]); + else if (!strcmp(argv[i], "--threads") && i+1 < argc) n_threads = atoi(argv[++i]); + else if (!strcmp(argv[i], "--batch") && i+1 < argc) batch_size = atoi(argv[++i]); + else if (!strcmp(argv[i], "--chunk") && i+1 < argc) pipe_chunk = atoi(argv[++i]); + else if (!strcmp(argv[i], "--pin") && i+1 < argc) pipe_pin = atoi(argv[++i]); + else if (!strcmp(argv[i], "--stages") && i+1 < argc) pipe_stages = atoi(argv[++i]); + else if (!strcmp(argv[i], "--calibrate")&& i+1 < argc) pipe_calibrate=atoi(argv[++i]); + else if (!strcmp(argv[i], "--local") && i+1 < argc) local_decode = atoi(argv[++i]); + } + + /* ── Thread configuration ───────────────────────────────────── */ + if (n_threads <= 0) { + n_threads = omp_get_num_procs(); + /* On HT systems, halve the count (heuristic) */ + if (n_threads > 4) n_threads = n_threads / 2; + if (n_threads < 1) n_threads = 1; + } + omp_set_num_threads(n_threads); + + srand(42); + printf("=================================================================\n"); + printf("CPU-1 Benchmark (C) v3 β€” d_model=%d n_layers=%d d_ff=%d\n", d_model, n_layers, d_ff); + printf("OMP threads: %d (of %d logical procs)\n", n_threads, omp_get_num_procs()); + printf("=================================================================\n"); + + /* ── Allocate model weights ──────────────────────────────────── */ + struct LayerDataMAD* layers = (struct LayerDataMAD*)calloc(n_layers, sizeof(struct LayerDataMAD)); + size_t total_bytes = 0; + + for (int L = 0; L < n_layers; L++) { + struct LayerDataMAD* ld = &layers[L]; + ld->norm1_w = make_random_f32_hp(d_model, 1.0f); + ld->norm2_w = make_random_f32_hp(d_model, 1.0f); + ld->norm_eps = 1e-6f; + ld->W_forget = make_random_mad_weight(d_model, d_model); ld->s_forget = 0.01f; + ld->W_cand = make_random_mad_weight(d_model, d_model); ld->s_cand = 0.01f; + ld->W_out = make_random_mad_weight(d_model, d_model); ld->s_out = 0.01f; + ld->W_gate = make_random_mad_weight(d_ff, d_model); ld->s_gate = 0.01f; + ld->W_up = make_random_mad_weight(d_ff, d_model); ld->s_up = 0.01f; + ld->W_down = make_random_mad_weight(d_model, d_ff); ld->s_down = 0.01f; + ld->fp_A_mix = make_random_f32_hp(d_model * fp_rank, 0.01f); + ld->fp_B_mix = make_random_f32_hp(fp_rank * d_model, 0.01f); + ld->fp_A_down = NULL; ld->fp_B_down = NULL; + ld->pfnet_norm_w = make_random_f32_hp(d_model, 1.0f); + ld->pfnet_w1 = make_random_mad_weight(pfnet_hidden, d_model); ld->pfnet_s1 = 0.01f; + ld->pfnet_w2 = make_random_mad_weight(d_model, pfnet_hidden); ld->pfnet_s2 = 0.01f; + + int ncb_m = (d_model+31)/32, ncb_ff = (d_ff+31)/32, ncb_pf = (pfnet_hidden+31)/32; + total_bytes += 3*(size_t)((d_model+3)/4)*ncb_m*32; + total_bytes += 2*(size_t)((d_ff+3)/4)*ncb_m*32; + total_bytes += (size_t)((d_model+3)/4)*ncb_ff*32; + total_bytes += (size_t)((pfnet_hidden+3)/4)*ncb_m*32; + total_bytes += (size_t)((d_model+3)/4)*ncb_pf*32; + } + printf("Weights: %.1f MB (%d layers)\n", total_bytes / 1e6, n_layers); + + /* ── I/O buffers ─────────────────────────────────────────────── */ + float* x_in = make_random_f32(d_model, 1.0f); + float* x_out = alloc_f32(d_model); + float* h_all = alloc_f32(n_layers * d_model); + + /* ── MegaByte LocalByteDecoder weights (always allocated) ────── */ + /* Per-patch full inference = 1 global pass + 4 local_decode_step. */ + /* These weights are SHARED across all modes and persist always. */ + const int LD_DLOCAL = 128; + const int LD_DFF = 512; + const int LD_NHEADS = 4; + const int LD_PATCHSIZE = 4; + uint8_t* ld_W_hproj = make_random_mad_weight(LD_PATCHSIZE * LD_DLOCAL, d_model); + uint8_t* ld_W_q = make_random_mad_weight(LD_DLOCAL, LD_DLOCAL); + uint8_t* ld_W_k = make_random_mad_weight(LD_DLOCAL, LD_DLOCAL); + uint8_t* ld_W_v = make_random_mad_weight(LD_DLOCAL, LD_DLOCAL); + uint8_t* ld_W_o = make_random_mad_weight(LD_DLOCAL, LD_DLOCAL); + uint8_t* ld_W_gate = make_random_mad_weight(LD_DFF, LD_DLOCAL); + uint8_t* ld_W_up = make_random_mad_weight(LD_DFF, LD_DLOCAL); + uint8_t* ld_W_down = make_random_mad_weight(LD_DLOCAL, LD_DFF); + uint8_t* ld_W_out = make_random_mad_weight(256, LD_DLOCAL); + float* ld_byte_emb = make_random_f32(256 * LD_DLOCAL, 0.01f); + float* ld_pos_emb = make_random_f32(LD_PATCHSIZE * LD_DLOCAL, 0.01f); + float* ld_norm1_w = make_random_f32(LD_DLOCAL, 1.0f); + float* ld_norm2_w = make_random_f32(LD_DLOCAL, 1.0f); + /* Fused-BitLinear inner norms (PyTorch parity) β€” small, included by + * default so the benchmark exercises the same code path as inference. */ + float* ld_o_norm_w = make_random_f32(LD_DLOCAL, 1.0f); + float* ld_ffn_down_norm_w = make_random_f32(LD_DFF, 1.0f); + float* ld_out_norm_w = make_random_f32(LD_DLOCAL, 1.0f); + /* Local decoder weights total ~= 1 MB (negligible vs 40 MB global) */ + + struct LocalDecW LDW = { + ld_W_hproj, ld_W_q, ld_W_k, ld_W_v, ld_W_o, + ld_W_gate, ld_W_up, ld_W_down, ld_W_out, + ld_byte_emb, ld_pos_emb, ld_norm1_w, ld_norm2_w, + ld_o_norm_w, ld_ffn_down_norm_w, ld_out_norm_w, + LD_DLOCAL, LD_DFF, LD_NHEADS, LD_PATCHSIZE + }; + + /* ── Allocate batch arrays for mode 3 ────────────────────────── */ + float** x_in_array = NULL, **x_out_array = NULL, **h_all_array = NULL; + if (mode == 3) { + x_in_array = (float**)malloc(batch_size * sizeof(float*)); + x_out_array = (float**)malloc(batch_size * sizeof(float*)); + h_all_array = (float**)malloc(batch_size * sizeof(float*)); + for (int b = 0; b < batch_size; b++) { + x_in_array[b] = alloc_f32(d_model); + x_out_array[b] = alloc_f32(d_model); + h_all_array[b] = alloc_f32(n_layers * d_model); + memcpy(x_in_array[b], x_in, d_model * sizeof(float)); + } + } + + /* ── Allocate single-stream arrays for mode 4 (pipeline) ─────── */ + /* Pipeline reuses ONE persistent h_all (single recurrent stream) */ + /* and processes a batch of n_patches sequentially through 4 */ + /* layer-pipeline stages. */ + float** mode4_x_in = NULL; + float** mode4_x_out = NULL; + float* mode4_h_all = NULL; + int mode4_pin = pipe_pin; /* pin threads to logical CPUs 0,2,4,6 */ + if (mode == 4) { + mode4_x_in = (float**)malloc(pipe_chunk * sizeof(float*)); + mode4_x_out = (float**)malloc(pipe_chunk * sizeof(float*)); + for (int p = 0; p < pipe_chunk; p++) { + mode4_x_in[p] = alloc_f32(d_model); + mode4_x_out[p] = alloc_f32(d_model); + memcpy(mode4_x_in[p], x_in, d_model * sizeof(float)); + } + mode4_h_all = alloc_f32(n_layers * d_model); + printf("Mode 4 pipeline: stages=%d chunk=%d pin=%d calibrate=%d\n", + pipe_stages, pipe_chunk, mode4_pin, pipe_calibrate); + } + + /* ── Warmup ──────────────────────────────────────────────────── */ + printf("Warmup %d patches...", n_warmup); fflush(stdout); + for (int w = 0; w < n_warmup; w++) { + if (mode == 0) { + memset(h_all, 0, n_layers * d_model * sizeof(float)); + forward_full_mad(x_in, x_out, h_all, layers, + n_layers, d_model, d_ff, fp_rank, pfnet_hidden); + } else if (mode == 1) { + memset(h_all, 0, n_layers * d_model * sizeof(float)); + float *cur = x_in, *nxt = x_out; + for (int L = 0; L < n_layers; L++) { + struct LayerDataMAD* ld = &layers[L]; + decode_layer_fused_2bit_mad( + cur, nxt, h_all + L*d_model, + ld->norm1_w, ld->norm2_w, ld->norm_eps, + ld->W_forget, ld->s_forget, ld->W_cand, ld->s_cand, + ld->W_out, ld->s_out, ld->W_gate, ld->s_gate, + ld->W_up, ld->s_up, ld->W_down, ld->s_down, + d_model, d_ff); + float* tmp = cur; cur = nxt; nxt = tmp; + } + } else if (mode == 2) { + memset(h_all, 0, n_layers * d_model * sizeof(float)); + forward_full_mad_st(x_in, x_out, h_all, layers, + n_layers, d_model, d_ff, fp_rank, pfnet_hidden); + if (local_decode) run_local_patch(x_out, d_model, &LDW); + } else if (mode == 3) { + for (int b = 0; b < batch_size; b++) + memset(h_all_array[b], 0, n_layers * d_model * sizeof(float)); + forward_full_mad_batch((const float* const*)x_in_array, + x_out_array, h_all_array, layers, + n_layers, d_model, d_ff, fp_rank, pfnet_hidden, + batch_size, n_threads); + if (local_decode) + for (int b = 0; b < batch_size; b++) + run_local_patch(x_out_array[b], d_model, &LDW); + } else if (mode == 4) { + memset(mode4_h_all, 0, n_layers * d_model * sizeof(float)); + /* Calibrate only on the very first warmup iteration. */ + int do_cal = (w == 0) ? pipe_calibrate : 0; + forward_full_mad_pipeline((const float* const*)mode4_x_in, + mode4_x_out, mode4_h_all, layers, + n_layers, d_model, d_ff, fp_rank, pfnet_hidden, + pipe_chunk, mode4_pin, + pipe_stages, do_cal); + if (local_decode) + for (int p = 0; p < pipe_chunk; p++) + run_local_patch(mode4_x_out[p], d_model, &LDW); + } + } + printf(" OK\n"); + + /* ── Timed run ───────────────────────────────────────────────── */ + double* times = (double*)malloc(n_patches * sizeof(double)); + for (int p = 0; p < n_patches; p++) { + double t0 = get_time_sec(); + if (mode == 0) { + memset(h_all, 0, n_layers * d_model * sizeof(float)); + forward_full_mad(x_in, x_out, h_all, layers, + n_layers, d_model, d_ff, fp_rank, pfnet_hidden); + } else if (mode == 1) { + memset(h_all, 0, n_layers * d_model * sizeof(float)); + float *cur = x_in, *nxt = x_out; + for (int L = 0; L < n_layers; L++) { + struct LayerDataMAD* ld = &layers[L]; + decode_layer_fused_2bit_mad( + cur, nxt, h_all + L*d_model, + ld->norm1_w, ld->norm2_w, ld->norm_eps, + ld->W_forget, ld->s_forget, ld->W_cand, ld->s_cand, + ld->W_out, ld->s_out, ld->W_gate, ld->s_gate, + ld->W_up, ld->s_up, ld->W_down, ld->s_down, + d_model, d_ff); + float* tmp = cur; cur = nxt; nxt = tmp; + } + } else if (mode == 2) { + memset(h_all, 0, n_layers * d_model * sizeof(float)); + forward_full_mad_st(x_in, x_out, h_all, layers, + n_layers, d_model, d_ff, fp_rank, pfnet_hidden); + if (local_decode) run_local_patch(x_out, d_model, &LDW); + } else if (mode == 3) { + for (int b = 0; b < batch_size; b++) + memset(h_all_array[b], 0, n_layers * d_model * sizeof(float)); + forward_full_mad_batch((const float* const*)x_in_array, + x_out_array, h_all_array, layers, + n_layers, d_model, d_ff, fp_rank, pfnet_hidden, + batch_size, n_threads); + if (local_decode) + for (int b = 0; b < batch_size; b++) + run_local_patch(x_out_array[b], d_model, &LDW); + } else if (mode == 4) { + /* Layer-pipeline single-stream: process pipe_chunk patches */ + /* through pipe_stages worker threads. Split was already */ + /* calibrated during warmup; here we always pass do_cal=0 */ + /* so the partition is recomputed cheaply (even split fall- */ + /* back) β€” the dominant cost is per-patch compute. */ + forward_full_mad_pipeline((const float* const*)mode4_x_in, + mode4_x_out, mode4_h_all, layers, + n_layers, d_model, d_ff, fp_rank, pfnet_hidden, + pipe_chunk, mode4_pin, + pipe_stages, 0); + if (local_decode) { + /* Local decode is autoregressive within a patch but */ + /* embarrassingly parallel across patches. Use OMP. */ + #pragma omp parallel for schedule(static) num_threads(pipe_stages) + for (int p2 = 0; p2 < pipe_chunk; p2++) + run_local_patch(mode4_x_out[p2], d_model, &LDW); + } + } + times[p] = get_time_sec() - t0; + } + + /* ── Stats ───────────────────────────────────────────────────── */ + qsort(times, n_patches, sizeof(double), cmp_double); + double total = 0; + for (int i = 0; i < n_patches; i++) total += times[i]; + double p50 = times[n_patches / 2]; + double p95 = times[(int)(n_patches * 0.95)]; + + // Real patches/sec: + // mode 3: each iteration processes batch_size patches in parallel + // mode 4: each iteration processes pipe_chunk patches through pipeline + double actual_patches; + if (mode == 3) actual_patches = (double)(n_patches * batch_size); + else if (mode == 4) actual_patches = (double)(n_patches * pipe_chunk); + else actual_patches = (double)n_patches; + double pps = actual_patches / total; + double bw = (total_bytes / 1e6) * pps; + + printf("\n=================================================================\n"); + const char* mode_names[] = { + "forward_full_mad (OMP)", "per-layer", + "forward_full_mad_st (ST)", "batch (4 streams)", + "pipeline (4-stage layer pipeline, 1 stream)" }; + printf("Mode: %s\n", mode_names[mode]); + if (mode == 3) { + printf("Iterations: %d (batch_size=%d, total patches: %d) Warmup: %d\n", + n_patches, batch_size, (int)actual_patches, n_warmup); + } else if (mode == 4) { + printf("Iterations: %d (pipe_chunk=%d, total patches: %d) Warmup: %d\n", + n_patches, pipe_chunk, (int)actual_patches, n_warmup); + } else { + printf("Patches: %d Warmup: %d\n", n_patches, n_warmup); + } + printf("-----------------------------------------------------------------\n"); + printf("Throughput: %.1f patches/sec (%.1f bytes/sec)\n", pps, pps*4); + printf("Latency: p50=%.2f ms p95=%.2f ms\n", p50*1000, p95*1000); + printf("Bandwidth: %.0f MB/s (%.1f%% of ~30 GB/s)\n", bw, bw/30000*100); + printf("Weight size: %.1f MB\n", total_bytes / 1e6); + printf("=================================================================\n"); + + free(times); + + if (mode == 3) { + for (int b = 0; b < batch_size; b++) { + free_aligned(x_in_array[b]); + free_aligned(x_out_array[b]); + free_aligned(h_all_array[b]); + } + free(x_in_array); + free(x_out_array); + free(h_all_array); + } + + if (mode == 4) { + for (int p = 0; p < pipe_chunk; p++) { + free_aligned(mode4_x_in[p]); + free_aligned(mode4_x_out[p]); + } + free(mode4_x_in); + free(mode4_x_out); + free_aligned(mode4_h_all); + } + + free_aligned(x_in); free_aligned(x_out); free_aligned(h_all); + return 0; +} diff --git a/evaluation/source/inference/kernels.cpp b/evaluation/source/inference/kernels.cpp new file mode 100644 index 0000000000000000000000000000000000000000..7255f8a785c743d76f6c46d71fe32e88ccb04a4e --- /dev/null +++ b/evaluation/source/inference/kernels.cpp @@ -0,0 +1,3002 @@ +/* + * Super-kernel CPU optimizado β€” Multi-arquitectura. v2.1 + * + * NUEVAS OPTIMIZACIONES para 150 batches/seg: + * + * ternary_i8_fused_gemv_avx2_omp β€” INT8 GEMV paralelo OMP + * Paraleliza sobre d_out filas. Threshold: d_out >= 2048 (macroblock). + * Para d_out < 2048 es mas rapido single-thread (overhead OMP > ganancia). + * + * decode_layer_fused β€” 1 llamada C por capa completa + * Hace norm1β†’[forget|cand|out GEMV en 1 OMP parallel]β†’MLGRUβ†’norm2β†’ + * [gate|up GEMV en 1 OMP parallel]β†’SiLUβ†’down GEMVβ†’residual en 1 call. + * + * Estrategia OMP: JITADO, un solo #pragma omp parallel por grupo de GEMVs. + * Dentro del parallel: cada thread toma su rango de filas de los 3 GEMVs + * concatenados (range [0, 3*d_model) para mixer, [0, 2*d_ff) para ffn). + * Esto elimina los 6 fork/join de teams separados y los 6 ctypes dispatches. + * + * quantize_x_avx2 β€” cuantiza float32β†’int8 reutilizable entre GEMVs + * llamado UNA vez por grupo de proyecciones que comparten el mismo x. + * + * Estrategias anteriores conservadas sin cambios: + * ternary_lut_matmul_omp, fp32_gemv_avx2, mlgru_scan_fusion, + * fused_mlgru_gates_avx2, rms_norm_f32, silu_f32, elem_add_f32, + * ternary_i8_gemv_avx2, benchmark_lut_matmul. + */ +#define USE_GATHER 0 + +#include +#include +#include +#include +#include +#include +#include +#include + +#ifdef _WIN32 + #define EXPORT __declspec(dllexport) +#else + #define EXPORT +#endif + +#define TILE_G 16 +#define MAX_D_MODEL 2048 +#define MAX_D_FF 5120 // d_ff hasta 5120 + +extern "C" { + +// --------------------------------------------------------------------------- +// Utilidades SIMD +// --------------------------------------------------------------------------- +static inline float _hsum256_ps(__m256 v) { + __m128 lo = _mm256_castps256_ps128(v); + __m128 hi = _mm256_extractf128_ps(v, 1); + lo = _mm_add_ps(lo, hi); + lo = _mm_hadd_ps(lo, lo); + lo = _mm_hadd_ps(lo, lo); + return _mm_cvtss_f32(lo); +} + +static inline float _hmax256_ps(__m256 v) { + __m128 lo = _mm256_castps256_ps128(v); + __m128 hi = _mm256_extractf128_ps(v, 1); + lo = _mm_max_ps(lo, hi); + lo = _mm_max_ps(lo, _mm_movehl_ps(lo, lo)); + lo = _mm_max_ps(lo, _mm_shuffle_ps(lo, lo, 1)); + return _mm_cvtss_f32(lo); +} + +static inline float ternary_lut_phase2_scalar( + const float* tile_luts, + const uint8_t* w_row, + int g_base, + int tile_size +) { + float sum = 0.0f; + for (int g_local = 0; g_local < tile_size; g_local++) { + sum += tile_luts[g_local * 256 + w_row[g_base + g_local]]; + } + return sum; +} + +// --------------------------------------------------------------------------- +// NUEVO: quantize_x_avx2 +// Cuantizar float32 β†’ int8, retorna x_scale = x_max/127. +// Reutilizable para multiples GEMVs con el mismo input x. +// --------------------------------------------------------------------------- +#ifdef __GNUC__ +__attribute__((target("avx2,fma"))) +#endif +static float quantize_x_avx2(const float* x, int8_t* out, int d_in) { + const __m256 vabsmask = _mm256_castsi256_ps(_mm256_set1_epi32(0x7FFFFFFF)); + __m256 vmax = _mm256_setzero_ps(); + int i = 0; + for (; i <= d_in - 8; i += 8) + vmax = _mm256_max_ps(vmax, _mm256_and_ps(_mm256_loadu_ps(x+i), vabsmask)); + float x_max = _hmax256_ps(vmax); + for (; i < d_in; i++) { float a = fabsf(x[i]); if (a > x_max) x_max = a; } + + const float inv_s = 127.0f / (x_max + 1e-8f); + const __m256 vinv = _mm256_set1_ps(inv_s); + const __m256 vh = _mm256_set1_ps(0.5f); + const __m256i vlo = _mm256_set1_epi32(-128); + const __m256i vhi = _mm256_set1_epi32(127); + + int ii = 0; + for (; ii <= d_in - 8; ii += 8) { + __m256i vi = _mm256_cvtps_epi32(_mm256_fmadd_ps(_mm256_loadu_ps(x+ii), vinv, vh)); + vi = _mm256_min_epi32(_mm256_max_epi32(vi, vlo), vhi); + __m128i r = _mm_packs_epi32(_mm256_castsi256_si128(vi), _mm256_extracti128_si256(vi,1)); + r = _mm_packs_epi16(r, r); + _mm_storel_epi64((__m128i*)(out+ii), r); + } + for (; ii < d_in; ii++) { + float v = x[ii]*inv_s + 0.5f; + v = v > 127.f ? 127.f : (v < -128.f ? -128.f : v); + out[ii] = (int8_t)(int)v; + } + return x_max / (127.0f + 1e-8f); +} + +// --------------------------------------------------------------------------- +// NUEVO: gemv_i8_row β€” 1 fila del GEMV ternario, retorna suma entera +// Usada dentro de loops OMP (inline-able, sin overhead de llamada). +// --------------------------------------------------------------------------- +#ifdef __GNUC__ +__attribute__((target("avx2,fma"))) +#endif +static inline int32_t gemv_i8_row(const int8_t* x_i8, const int8_t* wj, int d_in) { + const __m256i vones16 = _mm256_set1_epi16(1); + __m256i vacc = _mm256_setzero_si256(); + int ii = 0; + for (; ii <= d_in - 32; ii += 32) { + __m256i vact = _mm256_loadu_si256((const __m256i*)(x_i8+ii)); + __m256i vw = _mm256_loadu_si256((const __m256i*)(wj +ii)); + __m256i vprod = _mm256_sign_epi8(vact, vw); + __m256i p16lo = _mm256_cvtepi8_epi16(_mm256_castsi256_si128(vprod)); + __m256i p16hi = _mm256_cvtepi8_epi16(_mm256_extracti128_si256(vprod,1)); + vacc = _mm256_add_epi32(vacc, _mm256_madd_epi16(p16lo, vones16)); + vacc = _mm256_add_epi32(vacc, _mm256_madd_epi16(p16hi, vones16)); + } + __m128i lo = _mm256_castsi256_si128(vacc); + __m128i hi = _mm256_extracti128_si256(vacc,1); + __m128i s = _mm_add_epi32(lo, hi); + s = _mm_hadd_epi32(s, s); + s = _mm_hadd_epi32(s, s); + int32_t sum = _mm_cvtsi128_si32(s); + for (; ii < d_in; ii++) sum += (int32_t)x_i8[ii] * (int32_t)wj[ii]; + return sum; +} + +// --------------------------------------------------------------------------- +// NUEVO: gemv_i8_block β€” GEMV de j_start a j_end (sin alloc, sin OMP interno) +// --------------------------------------------------------------------------- +#ifdef __GNUC__ +__attribute__((target("avx2,fma"))) +#endif +static void gemv_i8_block( + const int8_t* x_i8, const int8_t* W, float* out, + int d_in, int j_start, int j_end, float cs +) { + for (int j = j_start; j < j_end; j++) + out[j] = (float)gemv_i8_row(x_i8, W + (ptrdiff_t)j*d_in, d_in) * cs; +} + +// =========================================================================== +// NUEVO: ternary_2bit_gemv_avx2 +// +// Kernel GEMV ternario con pesos empaquetados a 2 bits. +// +// Encoding: 2 bits por peso, 4 pesos por byte, d_in pesos por fila. +// 00 = 0 +// 01 = +1 +// 10 = -1 +// 11 = (no usado β€” el rango es ternario) +// +// Tamano de fila: d_in/4 bytes (vs d_in bytes en INT8) β†’ 4x menos lectura. +// +// Para d_model=1536, d_out=1536: +// INT8: 1536*1536 = 2.36MB por matriz +// 2-bit: 1536*384 = 590KB por matriz β†’ cabe en L2 (tipicamente 256-512KB per core) +// Resultado: 2-4x speedup por cache bandwidth +// +// Algoritmo: +// Para cada fila j y cada chunk de 16 elementos d_in: +// 1. Leer 4 bytes (16 pesos de 2 bits cada uno) +// 2. Extraer bits con shift+AND +// 3. Convertir 00β†’0, 01β†’+1, 10β†’-1 +// 4. Multiplicar por x_i8 y acumular +// +// Firma compatible con la API existente de ternary_i8_fused_gemv_avx2. +// x se cuantiza internamente (igual que ternary_i8_fused_gemv_avx2). +// w_2bit: [d_out, (d_in+3)/4] uint8 β€” pesos 2-bit packed, row-major. +// =========================================================================== + +// =========================================================================== +// gemv_2bit_tiled_avx2 +// +// STRIP-MINING: procesa TILE filas de salida simultΓ‘neamente. +// +// Por quΓ© esto importa (gap de 16Γ— entre teΓ³rico y actual): +// - gemv_2bit_row procesa 1 fila a la vez β†’ 1024 streams de cache simultΓ‘neos +// - Hardware prefetcher tolera ~20 streams β†’ cache miss latency domina +// - Con TILE=8: activaciones cargadas 1 vez, reusadas para 8 filas +// β†’ 8Γ— mejor intensidad aritmΓ©tica β†’ prefetcher puede seguir +// +// TΓ©cnica de T-MAC / bitnet.cpp: +// inner loop: 1 carga de activaciones Γ— TILE lecturas de pesos +// β†’ activaciΓ³n vive en registro, TILE streams de pesos (manejable por HW) +// +// Layout: W_2bit[d_out, bpr] row-major, bpr=(d_in+3)/4 bytes por fila +// =========================================================================== + +#define TILE_J 8 // filas procesadas simultΓ‘neamente β€” mΓΊltiplo de 8 + +#ifdef __GNUC__ +__attribute__((target("avx2,fma"))) +#endif +static void gemv_2bit_tiled_avx2( + const int8_t* x_i8, // [d_in] activaciones cuantizadas + const uint8_t* W_2bit, // [d_out, bpr] pesos 2-bit row-major + int32_t* acc, // [d_out] acumuladores (caller inicializa a 0) + int d_in, int d_out +) { + const int bpr = (d_in + 3) / 4; + + // LUT shuffle: convierte nibble (4 bits = 2 pesos) a par de int8 {-1,0,+1} + // lut_lo: peso del bit[1:0] de cada nibble + // lut_hi: pero del bit[3:2] de cada nibble + const __m128i lut_lo = _mm_set_epi8( + (int8_t)0,(int8_t)1,(int8_t)-1,(int8_t)0, + (int8_t)0,(int8_t)1,(int8_t)-1,(int8_t)0, + (int8_t)0,(int8_t)1,(int8_t)-1,(int8_t)0, + (int8_t)0,(int8_t)1,(int8_t)-1,(int8_t)0 + ); + const __m128i lut_hi = _mm_set_epi8( + (int8_t)-1,(int8_t)-1,(int8_t)-1,(int8_t)-1, + (int8_t)1, (int8_t)1, (int8_t)1, (int8_t)1, + (int8_t)0, (int8_t)0, (int8_t)0, (int8_t)0, + (int8_t)0, (int8_t)0, (int8_t)0, (int8_t)0 + ); + const __m128i mask_nibble = _mm_set1_epi8(0x0F); + + // ── Loop TILED: TILE_J filas a la vez ──────────────────────────────── + int j0 = 0; + for (; j0 <= d_out - TILE_J; j0 += TILE_J) { + // Punteros a las TILE_J filas de pesos + const uint8_t* wrow[TILE_J]; + for (int t = 0; t < TILE_J; t++) + wrow[t] = W_2bit + (ptrdiff_t)(j0+t) * bpr; + + // Prefetch primera lΓ­nea de cada fila + for (int t = 0; t < TILE_J; t++) + __builtin_prefetch(wrow[t], 0, 1); + + // Acumuladores int32 por fila (TILE_J Γ— 8 = 64 valores en registros) + __m256i vacc0 = _mm256_setzero_si256(); + __m256i vacc1 = _mm256_setzero_si256(); + __m256i vacc2 = _mm256_setzero_si256(); + __m256i vacc3 = _mm256_setzero_si256(); + __m256i vacc4 = _mm256_setzero_si256(); + __m256i vacc5 = _mm256_setzero_si256(); + __m256i vacc6 = _mm256_setzero_si256(); + __m256i vacc7 = _mm256_setzero_si256(); + + // Bucle interno: avanza 16 pesos (4 bytes) por iteraciΓ³n + int i = 0; + for (; i <= d_in - 16; i += 16) { + // Prefetch a +128 bytes adelante (da tiempo al HW prefetcher) + for (int t = 0; t < TILE_J; t++) + __builtin_prefetch(wrow[t] + (i/4) + 32, 0, 1); + + // Cargar 16 activaciones int8 ONCE β†’ reusar para las 8 filas + __m128i vx8 = _mm_loadu_si128((const __m128i*)(x_i8 + i)); + __m256i vact = _mm256_cvtepi8_epi16(vx8); // 16 Γ— int16 + + // Macro inline: decoder 4 bytes de pesos β†’ 16 int16 weights, luego madd + #define DECODE_AND_MADD(t, vacc_t) \ + { \ + __m128i r4 = _mm_cvtsi32_si128(*(const uint32_t*)(wrow[t] + i/4)); \ + __m128i lo = _mm_and_si128(r4, mask_nibble); \ + __m128i hi = _mm_and_si128(_mm_srli_epi16(r4, 4), mask_nibble); \ + __m128i iv = _mm_unpacklo_epi8(lo, hi); \ + __m128i wlo = _mm_shuffle_epi8(lut_lo, iv); \ + __m128i whi = _mm_shuffle_epi8(lut_hi, iv); \ + __m128i wt_lo = _mm_unpacklo_epi8(wlo, whi); \ + __m128i wt_hi = _mm_unpackhi_epi8(wlo, whi); \ + __m256i vw = _mm256_set_m128i(wt_hi, wt_lo); \ + __m256i vw16 = _mm256_cvtepi8_epi16(_mm256_castsi256_si128(vw)); \ + vacc_t = _mm256_add_epi32(vacc_t, \ + _mm256_madd_epi16(vact, vw16)); \ + } + + DECODE_AND_MADD(0, vacc0) + DECODE_AND_MADD(1, vacc1) + DECODE_AND_MADD(2, vacc2) + DECODE_AND_MADD(3, vacc3) + DECODE_AND_MADD(4, vacc4) + DECODE_AND_MADD(5, vacc5) + DECODE_AND_MADD(6, vacc6) + DECODE_AND_MADD(7, vacc7) + #undef DECODE_AND_MADD + } + + // ReducciΓ³n horizontal: 256-bit acc β†’ scalar int32 + #define HREDUCE(vacc_t, idx) \ + { \ + __m128i lo128 = _mm256_castsi256_si128(vacc_t); \ + __m128i hi128 = _mm256_extracti128_si256(vacc_t, 1); \ + __m128i s = _mm_add_epi32(lo128, hi128); \ + s = _mm_hadd_epi32(s, s); s = _mm_hadd_epi32(s, s); \ + acc[j0 + idx] += _mm_cvtsi128_si32(s); \ + } + HREDUCE(vacc0,0) HREDUCE(vacc1,1) HREDUCE(vacc2,2) HREDUCE(vacc3,3) + HREDUCE(vacc4,4) HREDUCE(vacc5,5) HREDUCE(vacc6,6) HREDUCE(vacc7,7) + #undef HREDUCE + + // Tail escalar para elementos sobrantes (si d_in % 16 != 0) + for (int t = 0; t < TILE_J; t++) { + for (int ii = i; ii < d_in; ii++) { + int byte_b = ii / 4, shift = (ii & 3) * 2; + uint8_t code = (wrow[t][byte_b] >> shift) & 3; + acc[j0+t] += (int32_t)x_i8[ii] * ((code==1)?1:(code==2)?-1:0); + } + } + } + + // ── Loop ESCALAR para filas restantes (j0 .. d_out-1) ──────────────── + for (; j0 < d_out; j0++) { + const uint8_t* wj = W_2bit + (ptrdiff_t)j0 * bpr; + int32_t s = 0; + for (int i = 0; i < d_in; i++) { + int byte_b = i / 4; + uint8_t code = (wj[byte_b] >> ((i & 3)*2)) & 3; + s += (int32_t)x_i8[i] * ((code==1)?1:(code==2)?-1:0); + } + acc[j0] += s; + } +} + +// Wrapper con OMP paralelo sobre filas (para GEMVs grandes como d_ff) +#ifdef __GNUC__ +__attribute__((target("avx2,fma"))) +#endif +static void gemv_2bit_omp( + const int8_t* x_i8, + const uint8_t* W_2bit, + float* output, + int d_in, int d_out, float cs +) { + // Cada thread procesa un bloque de filas alineado a TILE_J + int nt = omp_get_max_threads(); + int chunk = ((d_out / nt + TILE_J - 1) / TILE_J) * TILE_J; + + #pragma omp parallel + { + int tid = omp_get_thread_num(); + int j_start = tid * chunk; + int j_end = j_start + chunk < d_out ? j_start + chunk : d_out; + if (j_start >= d_out) goto done; + + { + // Acumulador local + static thread_local int32_t _acc_buf[MAX_D_MODEL > MAX_D_FF ? MAX_D_MODEL : MAX_D_FF]; + int rows = j_end - j_start; + memset(_acc_buf, 0, rows * sizeof(int32_t)); + gemv_2bit_tiled_avx2(x_i8, W_2bit + (ptrdiff_t)j_start * ((d_in+3)/4), + _acc_buf, d_in, rows); + for (int j = 0; j < rows; j++) + output[j_start + j] = (float)_acc_buf[j] * cs; + } + done:; + } +} + + +// =========================================================================== +// gemv_2bit_row β€” AVX2 con shuffle-LUT (sin stack alloc en el inner loop) +// +// Decodifica 2-bit pesos {00β†’0, 01β†’+1, 10β†’-1} a int8 y multiplica con x_i8. +// +// TΓ©cnica: usar _mm256_shuffle_epi8 como LUT de 16 entradas para convertir +// nibbles de 4 bits (2 pesos cada uno) a pares de int8 directamente. +// Procesa 16 pesos por iteraciΓ³n (4 bytes de w_2bit = 8 nibbles Γ— 2 pesos). +// Cero allocaciones en stack, cero branches dentro del loop. +// =========================================================================== +#ifdef __GNUC__ +__attribute__((target("avx2,fma"))) +#endif +static inline int32_t gemv_2bit_row( + const int8_t* x_i8, // [d_in] cuantizado int8 + const uint8_t* wj_2b, // [(d_in+3)/4] pesos 2-bit packed + int d_in +) { + // Tabla LUT para 16 nibbles posibles (4 bits = 2 pesos de 2 bits cada uno) + // nibble = bits[3:2] | bits[1:0] β†’ {peso1, peso0} + // peso = 00β†’0, 01β†’+1, 10β†’-1, 11β†’0 + // LUT[nibble] = (int8_t){peso0, peso1} como int16 little-endian + // Para shuffle: Γ­ndice 0..15, resultado 2 bytes (lo=peso0, hi=peso1) + // LUT entradas (lo byte = peso del bit[1:0], hi byte = peso del bit[3:2]): + // 0b0000=0 β†’ (0, 0)=0x0000 + // 0b0001=1 β†’ (+1,0)=0x0001 + // 0b0010=2 β†’ (-1,0)=0x00FF + // 0b0011=3 β†’ (0, 0)=0x0000 [invΓ‘lido, tratado como 0] + // 0b0100=4 β†’ (0,+1)=0x0100 + // 0b0101=5 β†’ (+1,+1)=0x0101 + // 0b0110=6 β†’ (-1,+1)=0x01FF + // 0b0111=7 β†’ (0,+1)=0x0100 [invΓ‘lido lo, sΓ³lo hi] + // 0b1000=8 β†’ (0,-1)=0xFF00 + // 0b1001=9 β†’ (+1,-1)=0xFF01 + // 0b1010=10β†’ (-1,-1)=0xFFFF + // 0b1011=11β†’ (0,-1)=0xFF00 + // 0b1100=12β†’ (0, 0)=0x0000 [invΓ‘lido] + // ... etc. + // Nota: int8_t -1 = 0xFF en complemento a 2 + // Tabla de 32 bytes (lo de cada par, luego hi de cada par) para shuffle_epi8: + const __m128i lut_lo = _mm_set_epi8( + // Γ­ndices 8..15 (hi nibble) + (int8_t)0, (int8_t)1, (int8_t)-1, (int8_t)0, + (int8_t)0, (int8_t)1, (int8_t)-1, (int8_t)0, + // Γ­ndices 0..7 (lo nibble) + (int8_t)0, (int8_t)1, (int8_t)-1, (int8_t)0, + (int8_t)0, (int8_t)1, (int8_t)-1, (int8_t)0 + ); + const __m128i lut_hi = _mm_set_epi8( + (int8_t)-1, (int8_t)-1, (int8_t)-1, (int8_t)-1, + (int8_t)1, (int8_t)1, (int8_t)1, (int8_t)1, + (int8_t)0, (int8_t)0, (int8_t)0, (int8_t)0, + (int8_t)0, (int8_t)0, (int8_t)0, (int8_t)0 + ); + const __m128i mask_lo_nibble = _mm_set1_epi8(0x0F); + const __m256i vones16 = _mm256_set1_epi16(1); + __m256i vacc = _mm256_setzero_si256(); + + int i = 0; + // Procesar 16 pesos por iteraciΓ³n (4 bytes = 8 nibbles Γ— 2 pesos) + for (; i <= d_in - 16; i += 16, wj_2b += 4) { + // 4 bytes de pesos β†’ 8 nibbles (un nibble = 2 pesos de 2 bits) + __m128i raw4 = _mm_cvtsi32_si128(*(const uint32_t*)wj_2b); + + // Separar nibble bajo (bits[3:0]) y nibble alto (bits[7:4]) de cada byte + __m128i lo_nibble = _mm_and_si128(raw4, mask_lo_nibble); // 4 nibbles bajos + __m128i hi_nibble = _mm_and_si128(_mm_srli_epi16(raw4, 4), mask_lo_nibble); // 4 nibbles altos + + // Intercalar: [lo0, hi0, lo1, hi1, lo2, hi2, lo3, hi3] + __m128i interleaved = _mm_unpacklo_epi8(lo_nibble, hi_nibble); // 8 nibbles ordenados + + // LUT lookup usando shuffle: convierte cada nibble al peso del bit bajo (pos 0 del par) + __m128i w_lo = _mm_shuffle_epi8(lut_lo, interleaved); // peso de bits[1:0] de cada nibble + // LUT lookup para el bit alto (pos 1 del par) + __m128i w_hi = _mm_shuffle_epi8(lut_hi, interleaved); // peso de bits[3:2] de cada nibble + + // Intercalar para obtener [w0,w1,w2,...,w15] en orden + __m128i weights_lo = _mm_unpacklo_epi8(w_lo, w_hi); // pesos 0..7 + __m128i weights_hi = _mm_unpackhi_epi8(w_lo, w_hi); // pesos 8..15 + + // Unir en un __m256i: 16 pesos int8 ordenados + __m256i vw = _mm256_set_m128i(weights_hi, weights_lo); + + // Cargar 16 activaciones int8 + __m256i vact = _mm256_cvtepi8_epi16(_mm_loadu_si128((const __m128i*)(x_i8+i))); + + // Multiplicar: vact (int16) * vw (int16) β†’ acum int32 + // Convertir vw de int8 a int16 para madd + __m256i vw16 = _mm256_cvtepi8_epi16(_mm256_castsi256_si128(vw)); + vacc = _mm256_add_epi32(vacc, _mm256_madd_epi16(vact, vw16)); + } + + // Reducir + __m128i lo128 = _mm256_castsi256_si128(vacc); + __m128i hi128 = _mm256_extracti128_si256(vacc, 1); + __m128i s4 = _mm_add_epi32(lo128, hi128); + s4 = _mm_hadd_epi32(s4, s4); + s4 = _mm_hadd_epi32(s4, s4); + int32_t sum = _mm_cvtsi128_si32(s4); + + // Tail escalar + for (; i < d_in; i++) { + int byte_i = i >> 2; + int shift = (i & 3) << 1; + uint8_t code = (wj_2b[byte_i - (d_in/16*4)] >> shift) & 3; + sum += (int32_t)x_i8[i] * ((code==1) ? 1 : (code==2) ? -1 : 0); + } + return sum; +} + + +#ifdef __GNUC__ +__attribute__((target("avx2,fma"))) +#endif +EXPORT void ternary_2bit_fused_gemv_avx2( + const float* x, // [d_in] float32 + const uint8_t* w_2bit, // [d_out, (d_in+3)/4] pesos 2-bit packed + float* output, // [d_out] + int d_in, + int d_out, + float w_scale +) { + static thread_local int8_t _xi[MAX_D_FF]; + float xs = quantize_x_avx2(x, _xi, d_in); + float cs = xs * w_scale; + int bytes_per_row = (d_in + 3) / 4; + + for (int j = 0; j < d_out; j++) { + const uint8_t* wj = w_2bit + (ptrdiff_t)j * bytes_per_row; + output[j] = (float)gemv_2bit_row(_xi, wj, d_in) * cs; + } +} + +// pack_ternary_to_2bit: convertir int8 ternario [-1,0,1] a 2-bit packed +// Input: W [d_out, d_in] int8 (valores -1, 0, 1) +// Output: packed [d_out, (d_in+3)/4] uint8 +// Llamar desde Python OFFLINE, antes de usar ternary_2bit_fused_gemv_avx2. +EXPORT void pack_ternary_to_2bit( + const int8_t* W, // [d_out, d_in] int8 ternario + uint8_t* packed, // [d_out, (d_in+3)/4] output β€” pre-asignado por caller + int d_in, + int d_out +) { + int bytes_per_row = (d_in + 3) / 4; + for (int j = 0; j < d_out; j++) { + const int8_t* wj = W + (ptrdiff_t)j * d_in; + uint8_t* pj = packed + (ptrdiff_t)j * bytes_per_row; + memset(pj, 0, bytes_per_row); + for (int i = 0; i < d_in; i++) { + int8_t v = wj[i]; + uint8_t code = (v == 1) ? 1 : (v == -1) ? 2 : 0; + pj[i >> 2] |= (code << ((i & 3) * 2)); + } + } +} + + + +// --------------------------------------------------------------------------- +// Fast exp/sigmoid/silu AVX2 +// --------------------------------------------------------------------------- +static inline __m256 _avx2_exp_ps(__m256 x) { + const __m256 vln2 = _mm256_set1_ps(0.6931471806f); + const __m256 vilg = _mm256_set1_ps(1.4426950408f); + x = _mm256_min_ps(x, _mm256_set1_ps(88.f)); + x = _mm256_max_ps(x, _mm256_set1_ps(-88.f)); + __m256 z = _mm256_fmadd_ps(x, vilg, _mm256_set1_ps(0.5f)); + __m256i ni = _mm256_cvttps_epi32(z); + __m256 fn = _mm256_cvtepi32_ps(ni); + __m256 r = _mm256_fnmadd_ps(fn, vln2, x); + __m256 p = _mm256_fmadd_ps(_mm256_set1_ps(1.f/120), r, _mm256_set1_ps(1.f/24)); + p = _mm256_fmadd_ps(p, r, _mm256_set1_ps(1.f/6)); + p = _mm256_fmadd_ps(p, r, _mm256_set1_ps(.5f)); + p = _mm256_fmadd_ps(p, r, _mm256_set1_ps(1.f)); + p = _mm256_fmadd_ps(p, r, _mm256_set1_ps(1.f)); + __m256 pw2 = _mm256_castsi256_ps(_mm256_slli_epi32(_mm256_add_epi32(ni,_mm256_set1_epi32(127)),23)); + return _mm256_mul_ps(p, pw2); +} +static inline __m256 _avx2_sigmoid_ps(__m256 x) { + return _mm256_div_ps(_mm256_set1_ps(1.f), + _mm256_add_ps(_mm256_set1_ps(1.f), _avx2_exp_ps(_mm256_sub_ps(_mm256_setzero_ps(), x)))); +} +static inline __m256 _avx2_silu_ps(__m256 x) { + return _mm256_mul_ps(x, _avx2_sigmoid_ps(x)); +} + +// --------------------------------------------------------------------------- +// NUEVO: rms_norm_inline β€” RMSNorm interna (sin llamada de funcion) +// --------------------------------------------------------------------------- +#ifdef __GNUC__ +__attribute__((target("avx2,fma"))) +#endif +static void rms_norm_inline(const float* x, const float* w, float* out, int D, float eps) { + __m256 vss = _mm256_setzero_ps(); + int i = 0; + for (; i <= D-8; i+=8) { __m256 v = _mm256_loadu_ps(x+i); vss = _mm256_fmadd_ps(v,v,vss); } + __m128 ss4 = _mm_add_ps(_mm256_castps256_ps128(vss), _mm256_extractf128_ps(vss,1)); + ss4 = _mm_hadd_ps(ss4, ss4); ss4 = _mm_hadd_ps(ss4, ss4); + float ss = _mm_cvtss_f32(ss4); + for (; i < D; i++) ss += x[i]*x[i]; + float sc = 1.0f / sqrtf(ss/(float)D + eps); + __m256 vsc = _mm256_set1_ps(sc); + i = 0; + for (; i <= D-8; i+=8) + _mm256_storeu_ps(out+i, _mm256_mul_ps(_mm256_mul_ps(_mm256_loadu_ps(x+i),vsc),_mm256_loadu_ps(w+i))); + for (; i < D; i++) out[i] = x[i]*sc*w[i]; +} + +// =========================================================================== +// NUEVO: decode_layer_fused v2 +// +// 1 llamada C por capa completa. Estrategia OMP: +// - UN solo omp parallel region por grupo de GEMVs (no sections/tasks) +// - Thread i toma filas [chunk*i, chunk*(i+1)) de los GEMVs concatenados +// - Para mixer: range [0, 3*d_model) β†’ forget[j], cand[j], out[j] +// - Para ffn: range [0, 2*d_ff) β†’ gate[j], up[j] +// - Para down: range [0, d_model) β†’ single parallel for +// +// Esto elimina completamente el overhead de fork/join OMP entre operaciones. +// +// No maneja fp_residual ni pfnet (los hace Python aparte, son rapidos FP). +// =========================================================================== +#ifdef __GNUC__ +__attribute__((target("avx2,fma"))) +#endif +EXPORT void decode_layer_fused( + const float* x_in, // [d_model] + float* x_out, // [d_model] output + float* h, // [d_model] hidden MLGRU (in/out) + const float* norm1_w, // [d_model] + const float* norm2_w, // [d_model] + float norm_eps, + const int8_t* W_forget, float s_forget, + const int8_t* W_cand, float s_cand, + const int8_t* W_out, float s_out, + const int8_t* W_gate, float s_gate, + const int8_t* W_up, float s_up, + const int8_t* W_down, float s_down, + int d_model, + int d_ff +) { + // Buffers thread_local (0 malloc/call) + static thread_local float _xn1[MAX_D_MODEL]; // x after norm1 + static thread_local int8_t _xi1[MAX_D_MODEL]; // x_i8 for mixer GEMVs + static thread_local float _fraw[MAX_D_MODEL]; + static thread_local float _craw[MAX_D_MODEL]; + static thread_local float _graw[MAX_D_MODEL]; + static thread_local float _mout[MAX_D_MODEL]; // mixer output + static thread_local float _xmid[MAX_D_MODEL]; // x + mout (residual 1) + static thread_local float _xn2[MAX_D_MODEL]; // x after norm2 + static thread_local int8_t _xi2[MAX_D_MODEL]; // x_i8 for ffn GEMVs + static thread_local float _gater[MAX_D_FF]; + static thread_local float _upr[MAX_D_FF]; + static thread_local float _hid[MAX_D_FF]; // ffn hidden after silu*up + static thread_local int8_t _hi8[MAX_D_FF]; + static thread_local float _ffno[MAX_D_MODEL]; // ffn output + + // PASO 1: RMSNorm1 + rms_norm_inline(x_in, norm1_w, _xn1, d_model, norm_eps); + + // PASO 2: Cuantizar una vez para forget/cand/out (todos toman _xn1) + float xs1 = quantize_x_avx2(_xn1, _xi1, d_model); + float cs_f = xs1 * s_forget; + float cs_c = xs1 * s_cand; + float cs_o = xs1 * s_out; + + // PASO 3-5: GEMVs mixer en 1 omp parallel, dividir 3*d_model filas + // Esquema: thread t procesa filas [t*chunk, (t+1)*chunk) de [0, 3*d_model) + // j < d_model β†’ forget, d_model <= j < 2*d_model β†’ cand, >= 2*d_model β†’ out + #pragma omp parallel + { + int nthreads = omp_get_num_threads(); + int tid = omp_get_thread_num(); + int total3 = 3 * d_model; + int chunk = (total3 + nthreads - 1) / nthreads; + int jS = tid * chunk; + int jE = jS + chunk < total3 ? jS + chunk : total3; + + for (int j = jS; j < jE; j++) { + if (j < d_model) { + _fraw[j] = (float)gemv_i8_row(_xi1, W_forget+(ptrdiff_t)j*d_model, d_model) * cs_f; + } else if (j < 2*d_model) { + int jj = j - d_model; + _craw[jj] = (float)gemv_i8_row(_xi1, W_cand+(ptrdiff_t)jj*d_model, d_model) * cs_c; + } else { + int jj = j - 2*d_model; + _graw[jj] = (float)gemv_i8_row(_xi1, W_out+(ptrdiff_t)jj*d_model, d_model) * cs_o; + } + } + } // barrier aqui + + // PASO 6: fused_mlgru_gates + residual + { + int i = 0; + for (; i <= d_model-8; i+=8) { + __m256 vf_r = _mm256_loadu_ps(_fraw+i); + __m256 vc_r = _mm256_loadu_ps(_craw+i); + __m256 vg_r = _mm256_loadu_ps(_graw+i); + __m256 vh = _mm256_loadu_ps(h+i); + __m256 vx = _mm256_loadu_ps(x_in+i); + + __m256 vf = _avx2_sigmoid_ps(vf_r); + __m256 vc = _avx2_silu_ps(vc_r); + __m256 vg = _avx2_sigmoid_ps(vg_r); + __m256 vhn = _mm256_fmadd_ps(vf, _mm256_sub_ps(vh, vc), vc); + __m256 vm = _mm256_mul_ps(vg, vhn); + + _mm256_storeu_ps(h+i, vhn); + _mm256_storeu_ps(_mout+i, vm); + _mm256_storeu_ps(_xmid+i, _mm256_add_ps(vx, vm)); + } + for (; i < d_model; i++) { + float f = 1.f/(1.f+expf(-_fraw[i])); + float c = _craw[i]/(1.f+expf(-_craw[i])); + float g = 1.f/(1.f+expf(-_graw[i])); + float hn = c + f*(h[i]-c); + h[i] = hn; + _mout[i] = g*hn; + _xmid[i] = x_in[i] + _mout[i]; + } + } + + // PASO 7: RMSNorm2 + rms_norm_inline(_xmid, norm2_w, _xn2, d_model, norm_eps); + + // PASO 8: Cuantizar una vez para gate/up + float xs2 = quantize_x_avx2(_xn2, _xi2, d_model); + float cs_gate = xs2 * s_gate; + float cs_up = xs2 * s_up; + + // PASO 9-10: GEMVs ffn gate+up en 1 omp parallel, dividir 2*d_ff filas + #pragma omp parallel + { + int nthreads = omp_get_num_threads(); + int tid = omp_get_thread_num(); + int total2 = 2 * d_ff; + int chunk = (total2 + nthreads - 1) / nthreads; + int jS = tid * chunk; + int jE = jS + chunk < total2 ? jS + chunk : total2; + + for (int j = jS; j < jE; j++) { + if (j < d_ff) { + _gater[j] = (float)gemv_i8_row(_xi2, W_gate+(ptrdiff_t)j*d_model, d_model) * cs_gate; + } else { + int jj = j - d_ff; + _upr[jj] = (float)gemv_i8_row(_xi2, W_up+(ptrdiff_t)jj*d_model, d_model) * cs_up; + } + } + } // barrier + + // PASO 11: silu(gate)*up β†’ hidden, luego cuantizar + { + int i = 0; + for (; i <= d_ff-8; i+=8) { + __m256 vg = _mm256_loadu_ps(_gater+i); + __m256 vu = _mm256_loadu_ps(_upr+i); + _mm256_storeu_ps(_hid+i, _mm256_mul_ps(_avx2_silu_ps(vg), vu)); + } + for (; i < d_ff; i++) _hid[i] = _gater[i]/(1.f+expf(-_gater[i])) * _upr[i]; + } + float hs = quantize_x_avx2(_hid, _hi8, d_ff); + + // PASO 12: down GEMV paralelo + float cs_down = hs * s_down; + #pragma omp parallel for schedule(static) + for (int j = 0; j < d_model; j++) + _ffno[j] = (float)gemv_i8_row(_hi8, W_down+(ptrdiff_t)j*d_ff, d_ff) * cs_down; + + // PASO 13: x_out = x_mid + ffn_out + { + int i = 0; + for (; i <= d_model-8; i+=8) + _mm256_storeu_ps(x_out+i, + _mm256_add_ps(_mm256_loadu_ps(_xmid+i), _mm256_loadu_ps(_ffno+i))); + for (; i < d_model; i++) x_out[i] = _xmid[i] + _ffno[i]; + } +} + + +// =========================================================================== +// NUEVO: ternary_i8_fused_gemv_avx2_omp (con x_i8 precomputado opcional) +// =========================================================================== +#ifdef __GNUC__ +__attribute__((target("avx2,fma"))) +#endif +EXPORT void ternary_i8_fused_gemv_avx2_omp( + const float* x, + const int8_t* w, + float* output, + int d_in, + int d_out, + float w_scale, + const int8_t* x_i8_pre, // NULL = cuantizar internamente + float x_scale_pre +) { + static thread_local int8_t _xi[MAX_D_FF]; + + const int8_t* x_i8; + float xs; + if (x_i8_pre) { x_i8 = x_i8_pre; xs = x_scale_pre; } + else { xs = quantize_x_avx2(x, _xi, d_in); x_i8 = _xi; } + + float cs = xs * w_scale; + + // Paralelo solo si d_out es grande (>= 1024 para amortizar overhead OMP) + if (d_out >= 1024) { + #pragma omp parallel for schedule(static) + for (int j = 0; j < d_out; j++) + output[j] = (float)gemv_i8_row(x_i8, w+(ptrdiff_t)j*d_in, d_in) * cs; + } else { + gemv_i8_block(x_i8, w, output, d_in, 0, d_out, cs); + } +} + + +// =========================================================================== +// ternary_lut_matmul_omp (sin cambios del original) +// =========================================================================== +#ifdef __GNUC__ +__attribute__((target("avx2,fma"))) +#endif +EXPORT void ternary_lut_matmul_omp( + const float* x, + const uint8_t* w_packed, + float w_scale, + const float* decode_table, + float* output, + int M, int d_in, int d_out, int group_size +) { + int n_groups = d_in / group_size; + + if (M == 1) { + const float* xm = x; + float* outm = output; + memset(outm, 0, d_out * sizeof(float)); + + float decode_T_shared[8 * 128]; + if (group_size == 4) { + for (int i = 0; i < 4; i++) + for (int c = 0; c < 128; c++) + decode_T_shared[i * 128 + c] = decode_table[c * 4 + i]; + } + + static float tile_luts_shared[TILE_G * 256] __attribute__((aligned(64))); + + #pragma omp parallel + { + for (int g_base = 0; g_base < n_groups; g_base += TILE_G) { + int g_end = g_base + TILE_G < n_groups ? g_base + TILE_G : n_groups; + int tile_size = g_end - g_base; + + #pragma omp single + { + for (int g_local = 0; g_local < tile_size; g_local++) { + int g = g_base + g_local; + const float* x_grp = xm + g * group_size; + float* lut_g = tile_luts_shared + g_local * 256; + if (group_size == 4) { + memset(lut_g, 0, 128 * sizeof(float)); + for (int i = 0; i < 4; i++) { + __m256 vxi = _mm256_broadcast_ss(x_grp + i); + const float* col = decode_T_shared + i * 128; + for (int c = 0; c < 128; c += 8) { + _mm256_storeu_ps(lut_g + c, + _mm256_fmadd_ps(vxi, _mm256_loadu_ps(col+c), + _mm256_loadu_ps(lut_g+c))); + } + } + const __m256 vneg = _mm256_set1_ps(-1.0f); + for (int c = 0; c < 128; c += 8) + _mm256_storeu_ps(lut_g+128+c, + _mm256_mul_ps(vneg, _mm256_loadu_ps(lut_g+c))); + } + } + } + + #pragma omp for schedule(static) nowait + for (int j = 0; j < d_out; j++) + outm[j] += ternary_lut_phase2_scalar(tile_luts_shared, w_packed+j*n_groups, g_base, tile_size); + } + #pragma omp for schedule(static) nowait + for (int j = 0; j < d_out; j++) outm[j] *= w_scale; + } + return; + } + + for (int m = 0; m < M; m++) { + const float* xm = x + m * d_in; + float* outm = output + m * d_out; + memset(outm, 0, d_out * sizeof(float)); + #pragma omp parallel if(d_out >= 512) + { + static thread_local float tile_luts[TILE_G * 256]; + static thread_local float decode_T[8 * 128]; + if (group_size == 4) { + for (int i = 0; i < 4; i++) + for (int c = 0; c < 128; c++) + decode_T[i*128+c] = decode_table[c*4+i]; + } else { + int gs = group_size < 8 ? group_size : 8; + for (int i = 0; i < gs; i++) + for (int c = 0; c < 128; c++) + decode_T[i*128+c] = decode_table[c*group_size+i]; + } + for (int g_base = 0; g_base < n_groups; g_base += TILE_G) { + int g_end = g_base+TILE_G < n_groups ? g_base+TILE_G : n_groups; + int tile_size = g_end - g_base; + for (int g_local = 0; g_local < tile_size; g_local++) { + int g = g_base+g_local; + const float* x_grp = xm + g*group_size; + float* lut_g = tile_luts + g_local*256; + if (group_size == 4) { + memset(lut_g, 0, 128*sizeof(float)); + for (int i = 0; i < 4; i++) { + __m256 vxi = _mm256_broadcast_ss(x_grp+i); + const float* col = decode_T + i*128; + for (int c = 0; c < 128; c += 8) + _mm256_storeu_ps(lut_g+c, + _mm256_fmadd_ps(vxi,_mm256_loadu_ps(col+c),_mm256_loadu_ps(lut_g+c))); + } + const __m256 vneg = _mm256_set1_ps(-1.f); + for (int c = 0; c < 128; c += 8) + _mm256_storeu_ps(lut_g+128+c, _mm256_mul_ps(vneg,_mm256_loadu_ps(lut_g+c))); + } + } + #pragma omp for schedule(static) + for (int j = 0; j < d_out-1; j += 2) { + outm[j ] += ternary_lut_phase2_scalar(tile_luts, w_packed+j*n_groups, g_base, tile_size); + outm[j+1] += ternary_lut_phase2_scalar(tile_luts, w_packed+(j+1)*n_groups, g_base, tile_size); + } + #pragma omp single nowait + if (d_out&1) outm[d_out-1] += ternary_lut_phase2_scalar(tile_luts, w_packed+(d_out-1)*n_groups, g_base, tile_size); + } + #pragma omp for schedule(static) nowait + for (int j = 0; j < d_out; j++) outm[j] *= w_scale; + } + } +} + + +// --------------------------------------------------------------------------- +// fp32_gemv_avx2 (sin cambios) +// --------------------------------------------------------------------------- +EXPORT void fp32_gemv_avx2( + const float* x, const float* W, float* output, + int M, int d_in, int d_out +) { + for (int m = 0; m < M; m++) { + const float* xm = x + m*d_in; + float* outm = output + m*d_out; + for (int j = 0; j < d_out-7; j += 8) { + const float* w0=W+j*d_in, *w1=w0+d_in, *w2=w1+d_in, *w3=w2+d_in; + const float* w4=w3+d_in, *w5=w4+d_in, *w6=w5+d_in, *w7=w6+d_in; + __m256 vs0=_mm256_setzero_ps(), vs1=vs0, vs2=vs0, vs3=vs0; + __m256 vs4=_mm256_setzero_ps(), vs5=vs4, vs6=vs4, vs7=vs4; + for (int i=0; i<=d_in-8; i+=8) { + __m256 vx=_mm256_loadu_ps(xm+i); + vs0=_mm256_fmadd_ps(vx,_mm256_loadu_ps(w0+i),vs0); + vs1=_mm256_fmadd_ps(vx,_mm256_loadu_ps(w1+i),vs1); + vs2=_mm256_fmadd_ps(vx,_mm256_loadu_ps(w2+i),vs2); + vs3=_mm256_fmadd_ps(vx,_mm256_loadu_ps(w3+i),vs3); + vs4=_mm256_fmadd_ps(vx,_mm256_loadu_ps(w4+i),vs4); + vs5=_mm256_fmadd_ps(vx,_mm256_loadu_ps(w5+i),vs5); + vs6=_mm256_fmadd_ps(vx,_mm256_loadu_ps(w6+i),vs6); + vs7=_mm256_fmadd_ps(vx,_mm256_loadu_ps(w7+i),vs7); + } + outm[j]=_hsum256_ps(vs0); outm[j+1]=_hsum256_ps(vs1); + outm[j+2]=_hsum256_ps(vs2); outm[j+3]=_hsum256_ps(vs3); + outm[j+4]=_hsum256_ps(vs4); outm[j+5]=_hsum256_ps(vs5); + outm[j+6]=_hsum256_ps(vs6); outm[j+7]=_hsum256_ps(vs7); + } + int jt=(d_out/8)*8; + for (int j=jt;j0.0?(double)n_tokens/el:0.; + free(x);free(w_packed);free(decode_table);free(output); + return tps; +} + + +// =========================================================================== +// decode_layer_fused_2bit +// +// Identico a decode_layer_fused pero con pesos empaquetados a 2 bits. +// +// Reduccion de bandwidth por capa: +// INT8: 6 matrices Γ— ~1024Β² B = ~6 MB de pesos por capa a leer +// 2-bit: 6 matrices Γ— ~256 KB = ~1.5MB por capa β†’ 4Γ— menor bandwidth +// +// Para 14 capas de 170M: +// INT8: 14 Γ— 11.6 MB = 163 MB total a leer por patch β†’ 38/163 = 233 patch/s teΓ³rico +// 2-bit: 14 Γ— 2.9 MB = 40.6 MB total β†’ 38/40.6 = 936 patch/s teΓ³rico +// +// Firma compatible con decode_layer_fused excepto que W_* son uint8* 2-bit. +// w_*_rows = (d_in+3)/4 bytes por fila. +// +// FPResidual y PFNet se manejan en Python igualmente (son FP32, triviales). + +// Helper: gemv_2bit_block β€” GEMV 2-bit para un rango de filas +#ifdef __GNUC__ +__attribute__((target("avx2,fma"))) +#endif +EXPORT void decode_layer_fused_2bit( + const float* x_in, + float* x_out, + float* h, + const float* norm1_w, + const float* norm2_w, + float norm_eps, + const uint8_t* W_forget, float s_forget, + const uint8_t* W_cand, float s_cand, + const uint8_t* W_out, float s_out, + const uint8_t* W_gate, float s_gate, + const uint8_t* W_up, float s_up, + const uint8_t* W_down, float s_down, + int d_model, + int d_ff +) { + // Buffers compartidos (thread 0 escribe, todos leen despuΓ©s de barriers) + static thread_local float _xn1[MAX_D_MODEL]; + static thread_local int8_t _xi1[MAX_D_MODEL]; + static thread_local float _fraw[MAX_D_MODEL]; + static thread_local float _craw[MAX_D_MODEL]; + static thread_local float _graw[MAX_D_MODEL]; + static thread_local float _xmid[MAX_D_MODEL]; + static thread_local float _xn2[MAX_D_MODEL]; + static thread_local int8_t _xi2[MAX_D_MODEL]; + static thread_local float _gater[MAX_D_FF]; + static thread_local float _upr[MAX_D_FF]; + static thread_local float _hid[MAX_D_FF]; + static thread_local int8_t _hi8[MAX_D_FF]; + static thread_local float _ffno[MAX_D_MODEL]; + + // Escales compartidos entre threads (necesitan ser visibles tras omp single) + static thread_local float _cs[6]; // [cs_f, cs_c, cs_o, cs_gate, cs_up, cs_down] + static thread_local float _hs_down; // para cs_down + + const int bpr_m = (d_model + 3) / 4; + const int bpr_ff = (d_ff + 3) / 4; + + // ── ÚNICA REGIΓ“N OMP: 1 fork-join por capa en lugar de 5 ──────────────── + #pragma omp parallel + { + // Calcular particiΓ³n de este thread (alineada a TILE_J) + int nt = omp_get_num_threads(); + int tid = omp_get_thread_num(); + + // Chunk de filas para las GEMVs de d_model salidas + int chunk_m = ((d_model / nt + TILE_J - 1) / TILE_J) * TILE_J; + int jm_s = tid * chunk_m; + int jm_e = jm_s + chunk_m < d_model ? jm_s + chunk_m : d_model; + + // Chunk de filas para las GEMVs de d_ff salidas + int chunk_ff = ((d_ff / nt + TILE_J - 1) / TILE_J) * TILE_J; + int jf_s = tid * chunk_ff; + int jf_e = jf_s + chunk_ff < d_ff ? jf_s + chunk_ff : d_ff; + + // Acumulador local para este thread + static thread_local int32_t _acc_tl[MAX_D_FF]; + + // ── PASO 1-2: RMSNorm + cuantizar (serial, thread 0) ──────────────── + #pragma omp single + { + rms_norm_inline(x_in, norm1_w, _xn1, d_model, norm_eps); + float xs1 = quantize_x_avx2(_xn1, _xi1, d_model); + _cs[0] = xs1 * s_forget; + _cs[1] = xs1 * s_cand; + _cs[2] = xs1 * s_out; + } + // implicit barrier after omp single + + // ── PASO 3-5: forget + cand + out (fused en paralelo por filas) ──────── + // Cada thread calcula su chunk de filas para LAS 3 MATRICES a la vez. + // Igual que decode_layer_fused int8 pero con kernel tiled 2-bit. + // Neto: d_model/nt filas Γ— 3 matrices simultΓ‘neamente por thread. + if (jm_s < d_model) { + int rows = jm_e - jm_s; + // forget + memset(_acc_tl, 0, rows * sizeof(int32_t)); + gemv_2bit_tiled_avx2(_xi1, W_forget + (ptrdiff_t)jm_s * bpr_m, _acc_tl, d_model, rows); + for (int j = 0; j < rows; j++) _fraw[jm_s+j] = (float)_acc_tl[j] * _cs[0]; + // cand + memset(_acc_tl, 0, rows * sizeof(int32_t)); + gemv_2bit_tiled_avx2(_xi1, W_cand + (ptrdiff_t)jm_s * bpr_m, _acc_tl, d_model, rows); + for (int j = 0; j < rows; j++) _craw[jm_s+j] = (float)_acc_tl[j] * _cs[1]; + // out + memset(_acc_tl, 0, rows * sizeof(int32_t)); + gemv_2bit_tiled_avx2(_xi1, W_out + (ptrdiff_t)jm_s * bpr_m, _acc_tl, d_model, rows); + for (int j = 0; j < rows; j++) _graw[jm_s+j] = (float)_acc_tl[j] * _cs[2]; + } + + #pragma omp barrier + + // ── PASO 6: MLGRU gates + residual (serial) ────────────────────────── + #pragma omp single + { + int i = 0; + for (; i <= d_model-8; i+=8) { + __m256 vf = _avx2_sigmoid_ps(_mm256_loadu_ps(_fraw+i)); + __m256 vc = _avx2_silu_ps(_mm256_loadu_ps(_craw+i)); + __m256 vg = _avx2_sigmoid_ps(_mm256_loadu_ps(_graw+i)); + __m256 vh = _mm256_loadu_ps(h+i); + __m256 vhn= _mm256_fmadd_ps(vf, _mm256_sub_ps(vh, vc), vc); + __m256 vm = _mm256_mul_ps(vg, vhn); + _mm256_storeu_ps(h+i, vhn); + _mm256_storeu_ps(_xmid+i, _mm256_add_ps(_mm256_loadu_ps(x_in+i), vm)); + } + for (; i < d_model; i++) { + float f = 1.f/(1.f+expf(-_fraw[i])); + float c = _craw[i]/(1.f+expf(-_craw[i])); + float g = 1.f/(1.f+expf(-_graw[i])); + float hn = c + f*(h[i]-c); + h[i] = hn; + _xmid[i] = x_in[i] + g*hn; + } + rms_norm_inline(_xmid, norm2_w, _xn2, d_model, norm_eps); + float xs2 = quantize_x_avx2(_xn2, _xi2, d_model); + _cs[3] = xs2 * s_gate; + _cs[4] = xs2 * s_up; + } + // implicit barrier after omp single + + // ── PASO 9-10: gate + up (fused en paralelo por filas) ─────────────── + if (jf_s < d_ff) { + int rows = jf_e - jf_s; + memset(_acc_tl, 0, rows * sizeof(int32_t)); + gemv_2bit_tiled_avx2(_xi2, W_gate + (ptrdiff_t)jf_s * bpr_m, _acc_tl, d_model, rows); + for (int j = 0; j < rows; j++) _gater[jf_s+j] = (float)_acc_tl[j] * _cs[3]; + memset(_acc_tl, 0, rows * sizeof(int32_t)); + gemv_2bit_tiled_avx2(_xi2, W_up + (ptrdiff_t)jf_s * bpr_m, _acc_tl, d_model, rows); + for (int j = 0; j < rows; j++) _upr[jf_s+j] = (float)_acc_tl[j] * _cs[4]; + } + + #pragma omp barrier + + // ── PASO 11: silu + cuantizar (serial) ─────────────────────────────── + #pragma omp single + { + int i = 0; + for (; i <= d_ff-8; i+=8) { + __m256 vg = _mm256_loadu_ps(_gater+i); + __m256 vu = _mm256_loadu_ps(_upr+i); + _mm256_storeu_ps(_hid+i, _mm256_mul_ps(_avx2_silu_ps(vg), vu)); + } + for (; i < d_ff; i++) + _hid[i] = _gater[i]/(1.f+expf(-_gater[i])) * _upr[i]; + float hs = quantize_x_avx2(_hid, _hi8, d_ff); + _cs[5] = hs * s_down; + } + // implicit barrier + + // ── PASO 12: down_proj GEMV ────────────────────────────────────────── + if (jm_s < d_model) { + int rows = jm_e - jm_s; + memset(_acc_tl, 0, rows * sizeof(int32_t)); + gemv_2bit_tiled_avx2(_hi8, W_down + (ptrdiff_t)jm_s * bpr_ff, _acc_tl, d_ff, rows); + for (int j = 0; j < rows; j++) + _ffno[jm_s+j] = (float)_acc_tl[j] * _cs[5]; + } + + #pragma omp barrier + + // ── PASO 13: x_out = xmid + ffno (paralelo) ───────────────────────── + #pragma omp for schedule(static) nowait + for (int i = 0; i <= d_model-8; i+=8) + _mm256_storeu_ps(x_out+i, + _mm256_add_ps(_mm256_loadu_ps(_xmid+i), _mm256_loadu_ps(_ffno+i))); + } // end single OMP region +} + + + +// =========================================================================== +// BitNet MAD β€” column-interleaved 2-bit layout +// +// Layout W_mad: [ceil(d_out/4), ceil(d_in/32), 32] bytes +// byte[k]: bit[7:6]=row0, bit[5:4]=row1, bit[3:2]=row2, bit[1:0]=row3 +// Encoding: 01=+1, 10=-1, 00=0 +// +// 1 activation load covers 4 output rows simultaneously β†’ 4Γ— IPC vs row-major. +// OMP: single #pragma omp parallel per layer (3 GEMV groups inside), no fork/join. +// =========================================================================== + +EXPORT void pack_ternary_to_2bit_mad( + const int8_t* w_int8, + uint8_t* w_mad, + int d_out, int d_in +) { + auto enc = [](int8_t v) -> uint8_t { + return (v > 0) ? 1u : (v < 0) ? 2u : 0u; + }; + int nrg = (d_out + 3) / 4; + int ncb = (d_in + 31) / 32; + for (int rg = 0; rg < nrg; rg++) { + int r0=rg*4, r1=rg*4+1, r2=rg*4+2, r3=rg*4+3; + for (int cb = 0; cb < ncb; cb++) { + for (int k = 0; k < 32; k++) { + int col = cb*32 + k; + uint8_t b = 0; + if (col < d_in) { + uint8_t q0 = (r0>4)&0xF β†’ bits[7:4] β†’ row0 code=hi4[3:2], row1 code=hi4[1:0] +// lo4 = byte&0xF β†’ bits[3:0] β†’ row2 code=lo4[3:2], row3 code=lo4[1:0] +// +// OPTIMIZATIONS v3: +// 1. i16 accumulation via maddubs_epi16(ones, signed_product): +// Replaces cvtepi8_epi16 + madd_epi16 + add_epi32 (6 inst β†’ 2 inst/row). +// Safe for d_in ≀ 5120: max i16 = (5120/32)*254 = 40640 < 32767? NO! +// For d_in > 4096 we must flush i16β†’i32 periodically. +// We flush every 128 iterations (128*254 = 32512 < 32767). +// 2. Shuffle-based horizontal reduction (no hadd_epi32). +// 3. Prefetch next row-group weights during current row-group. +// +#define MAD_I16_FLUSH_INTERVAL 128 // max iters before i16 overflow + +#ifdef __GNUC__ +__attribute__((target("avx2"))) +#endif +static void gemv_2bit_mad_chunk( + const int8_t* x_i8, + const uint8_t* W_mad, + int32_t* acc, // local [(rg_end-rg_start)*4], zeroed by caller + int d_in, int d_out, + int rg_start, int rg_end +) { + const __m128i lut_hi_h = _mm_set_epi8(0,0,0,0,-1,-1,-1,-1,1,1,1,1,0,0,0,0); + const __m128i lut_lo_h = _mm_set_epi8(0,-1,1,0,0,-1,1,0,0,-1,1,0,0,-1,1,0); + const __m256i lut_hi = _mm256_broadcastsi128_si256(lut_hi_h); + const __m256i lut_lo = _mm256_broadcastsi128_si256(lut_lo_h); + const __m256i m0f = _mm256_set1_epi8(0x0F); + const __m256i ones_u8 = _mm256_set1_epi8(1); + const __m256i one16 = _mm256_set1_epi16(1); + const int ncb = (d_in + 31) / 32; + const int stride_rg = ncb * 32; + // Number of 32-element iterations + const int n_iters = d_in / 32; + + for (int rg = rg_start; rg < rg_end; rg++) { + const uint8_t* Wg = W_mad + (ptrdiff_t)rg * stride_rg; + int local = (rg - rg_start) * 4; + + // Prefetch next row-group weights + if (rg + 1 < rg_end) { + const uint8_t* Wg_next = Wg + stride_rg; + for (int p = 0; p < stride_rg && p < 512; p += 64) + _mm_prefetch((const char*)(Wg_next + p), _MM_HINT_T1); + } + + // i32 accumulators (final) + __m256i vacc32_0=_mm256_setzero_si256(), vacc32_1=_mm256_setzero_si256(); + __m256i vacc32_2=_mm256_setzero_si256(), vacc32_3=_mm256_setzero_si256(); + // i16 accumulators (flushed periodically to i32) + __m256i vacc16_0=_mm256_setzero_si256(), vacc16_1=_mm256_setzero_si256(); + __m256i vacc16_2=_mm256_setzero_si256(), vacc16_3=_mm256_setzero_si256(); + + int col = 0; + int iter_count = 0; + for (; col <= d_in-32; col += 32, iter_count++) { + // Flush i16β†’i32 before overflow (every 128 iters, max i16 val = 128*254 = 32512) + if (iter_count == MAD_I16_FLUSH_INTERVAL) { + vacc32_0 = _mm256_add_epi32(vacc32_0, _mm256_madd_epi16(vacc16_0, one16)); + vacc32_1 = _mm256_add_epi32(vacc32_1, _mm256_madd_epi16(vacc16_1, one16)); + vacc32_2 = _mm256_add_epi32(vacc32_2, _mm256_madd_epi16(vacc16_2, one16)); + vacc32_3 = _mm256_add_epi32(vacc32_3, _mm256_madd_epi16(vacc16_3, one16)); + vacc16_0 = vacc16_1 = vacc16_2 = vacc16_3 = _mm256_setzero_si256(); + iter_count = 0; + } + + __m256i yq8 = _mm256_loadu_si256((const __m256i*)(x_i8+col)); + __m256i xb = _mm256_loadu_si256((const __m256i*)(Wg+col)); + __m256i hi4 = _mm256_and_si256(_mm256_srli_epi16(xb,4), m0f); + __m256i lo4 = _mm256_and_si256(xb, m0f); + __m256i ws0 = _mm256_shuffle_epi8(lut_hi, hi4); + __m256i ws1 = _mm256_shuffle_epi8(lut_lo, hi4); + __m256i ws2 = _mm256_shuffle_epi8(lut_hi, lo4); + __m256i ws3 = _mm256_shuffle_epi8(lut_lo, lo4); + __m256i p0=_mm256_sign_epi8(yq8,ws0), p1=_mm256_sign_epi8(yq8,ws1); + __m256i p2=_mm256_sign_epi8(yq8,ws2), p3=_mm256_sign_epi8(yq8,ws3); + + // maddubs(1, signed) β†’ pairwise sum of i8 β†’ i16 (2 inst vs 6) + vacc16_0 = _mm256_add_epi16(vacc16_0, _mm256_maddubs_epi16(ones_u8, p0)); + vacc16_1 = _mm256_add_epi16(vacc16_1, _mm256_maddubs_epi16(ones_u8, p1)); + vacc16_2 = _mm256_add_epi16(vacc16_2, _mm256_maddubs_epi16(ones_u8, p2)); + vacc16_3 = _mm256_add_epi16(vacc16_3, _mm256_maddubs_epi16(ones_u8, p3)); + } + + // Final flush i16 β†’ i32 + vacc32_0 = _mm256_add_epi32(vacc32_0, _mm256_madd_epi16(vacc16_0, one16)); + vacc32_1 = _mm256_add_epi32(vacc32_1, _mm256_madd_epi16(vacc16_1, one16)); + vacc32_2 = _mm256_add_epi32(vacc32_2, _mm256_madd_epi16(vacc16_2, one16)); + vacc32_3 = _mm256_add_epi32(vacc32_3, _mm256_madd_epi16(vacc16_3, one16)); + + // Shuffle-based horizontal reduction (no hadd β€” better throughput) + #define MAD_HRED_V3(v) ({ \ + __m128i _lo = _mm256_castsi256_si128(v); \ + __m128i _hi = _mm256_extracti128_si256(v, 1); \ + __m128i _s = _mm_add_epi32(_lo, _hi); \ + _s = _mm_add_epi32(_s, _mm_shuffle_epi32(_s, 0x4E)); \ + _s = _mm_add_epi32(_s, _mm_shuffle_epi32(_s, 0xB1)); \ + _mm_cvtsi128_si32(_s); \ + }) + if (rg*4+0int{ return (b==1)?1:(b==2)?-1:0; }; + for (; col < d_in; col++) { + int8_t xi=x_i8[col]; uint8_t b=Wg[col]; + if (rg*4+0>6)&3); + if (rg*4+1>4)&3); + if (rg*4+2>2)&3); + if (rg*4+3>0)&3); + } + } +} + +EXPORT void gemv_2bit_mad_omp( + const int8_t* x_i8, + const uint8_t* W_mad, + float* output, + int d_in, int d_out, float cs +) { + const int nrg = (d_out + 3) / 4; + #pragma omp parallel + { + static thread_local int32_t _acc_tl[MAX_D_FF]; + int nt=omp_get_num_threads(), tid=omp_get_thread_num(); + int rg_per=(nrg+nt-1)/nt, rg_s=tid*rg_per; + int rg_e=(rg_s+rg_per silu -> @ B. Output ADDED to out[]. +// A=[d_in,rank] row-major, B=[rank,d_out] row-major, FP32. +// =========================================================================== +#ifdef __GNUC__ +__attribute__((target("avx2,fma"))) +#endif +static void fp_residual_inline( + const float* x, const float* A, const float* B, + float* out, int d_in, int d_out, int rank +) { + float hidden[32]; + for (int r = 0; r < rank; r++) { + float s = 0.0f; + for (int i = 0; i < d_in; i++) s += x[i] * A[i*rank + r]; + float sig = 1.0f / (1.0f + expf(-s)); + hidden[r] = s * sig; + } + for (int j = 0; j < d_out; j++) { + float s = 0.0f; + for (int r = 0; r < rank; r++) s += hidden[r] * B[r*d_out + j]; + out[j] += s; + } +} + +// =========================================================================== +// PFNet inline: norm -> quant -> MAD GEMV -> silu -> quant -> MAD GEMV +// Output ADDED to out[]. +// =========================================================================== +#ifdef __GNUC__ +__attribute__((target("avx2,fma"))) +#endif +static void pfnet_inline( + const float* x, float* out, + const float* norm_w, float norm_eps, + const uint8_t* W1_mad, float s1, + const uint8_t* W2_mad, float s2, + int d_model, int pfnet_hidden +) { + static thread_local float _pf_n[MAX_D_MODEL]; + static thread_local int8_t _pf_xi[MAX_D_MODEL]; + static thread_local float _pf_h[256]; + static thread_local int8_t _pf_h8[256]; + + rms_norm_inline(x, norm_w, _pf_n, d_model, norm_eps); + float xs1 = quantize_x_avx2(_pf_n, _pf_xi, d_model); + { + int nrg = (pfnet_hidden+3)/4; + int32_t acc[256]; + memset(acc,0,nrg*4*sizeof(int32_t)); + gemv_2bit_mad_chunk(_pf_xi, W1_mad, acc, d_model, pfnet_hidden, 0, nrg); + for(int j=0;j x_max) x_max = a; + } + + // Pass 2: Quantize to int8 using stored values + const float inv_s = 127.0f / (x_max + 1e-8f); + const __m256 vinv = _mm256_set1_ps(inv_s); + const __m256 vh = _mm256_set1_ps(0.5f); + const __m256i vlo = _mm256_set1_epi32(-128); + const __m256i vhi = _mm256_set1_epi32(127); + + i = 0; + for (; i <= D-8; i += 8) { + __m256 vr = _mm256_loadu_ps(temp_buf+i); + __m256i vi = _mm256_cvtps_epi32(_mm256_fmadd_ps(vr, vinv, vh)); + vi = _mm256_min_epi32(_mm256_max_epi32(vi, vlo), vhi); + __m128i r = _mm_packs_epi32(_mm256_castsi256_si128(vi), _mm256_extracti128_si256(vi,1)); + r = _mm_packs_epi16(r, r); + _mm_storel_epi64((__m128i*)(out_i8+i), r); + } + for (; i < D; i++) { + float v = temp_buf[i]*inv_s + 0.5f; + v = v > 127.f ? 127.f : (v < -128.f ? -128.f : v); + out_i8[i] = (int8_t)(int)v; + } + + return inv_s; +} + +// Optimized: RMSNorm + Quantize + Scale computation in single pass +#ifdef __GNUC__ +__attribute__((target("avx2,fma"))) +#endif +static float rms_norm_quantize_fused_opt( + const float* x, const float* w, float* normed, int8_t* xi8, + int D, float eps +) { + // Pass 1: sum of squares + __m256 vss = _mm256_setzero_ps(); + int i = 0; + for (; i <= D-8; i+=8) { __m256 v = _mm256_loadu_ps(x+i); vss = _mm256_fmadd_ps(v,v,vss); } + __m128 ss4 = _mm_add_ps(_mm256_castps256_ps128(vss), _mm256_extractf128_ps(vss,1)); + ss4 = _mm_hadd_ps(ss4, ss4); ss4 = _mm_hadd_ps(ss4, ss4); + float ss = _mm_cvtss_f32(ss4); + for (; i < D; i++) ss += x[i]*x[i]; + float norm_sc = 1.0f / sqrtf(ss/(float)D + eps); + + // Pass 2: normalize, find abs max, and write normed + const __m256 vnsc = _mm256_set1_ps(norm_sc); + const __m256 vabsmask = _mm256_castsi256_ps(_mm256_set1_epi32(0x7FFFFFFF)); + __m256 vmax = _mm256_setzero_ps(); + i = 0; + for (; i <= D-8; i+=8) { + __m256 vn = _mm256_mul_ps(_mm256_mul_ps(_mm256_loadu_ps(x+i), vnsc), _mm256_loadu_ps(w+i)); + _mm256_storeu_ps(normed+i, vn); + vmax = _mm256_max_ps(vmax, _mm256_and_ps(vn, vabsmask)); + } + float x_max = _hmax256_ps(vmax); + for (; i < D; i++) { normed[i] = x[i]*norm_sc*w[i]; float a=fabsf(normed[i]); if(a>x_max) x_max=a; } + + // Pass 3: quantize to int8 + const float inv_s = 127.0f / (x_max + 1e-8f); + const __m256 vinv = _mm256_set1_ps(inv_s); + const __m256 vh = _mm256_set1_ps(0.5f); + const __m256i vlo = _mm256_set1_epi32(-128); + const __m256i vhi = _mm256_set1_epi32(127); + i = 0; + for (; i <= D-8; i+=8) { + __m256i vi = _mm256_cvtps_epi32(_mm256_fmadd_ps(_mm256_loadu_ps(normed+i), vinv, vh)); + vi = _mm256_min_epi32(_mm256_max_epi32(vi, vlo), vhi); + __m128i r = _mm_packs_epi32(_mm256_castsi256_si128(vi), _mm256_extracti128_si256(vi,1)); + r = _mm_packs_epi16(r, r); + _mm_storel_epi64((__m128i*)(xi8+i), r); + } + for (; i < D; i++) { + float v = normed[i]*inv_s + 0.5f; + v = v > 127.f ? 127.f : (v < -128.f ? -128.f : v); + xi8[i] = (int8_t)(int)v; + } + return inv_s; // Return scale factor directly +} + +// =========================================================================== +// forward_full_mad_st: Single-threaded fast path (no OMP overhead) +// =========================================================================== +EXPORT void forward_full_mad_st( + const float* x_in, float* x_out, float* h_all, + const LayerDataMAD* layers, + int n_layers, int d_model, int d_ff, int fp_rank, int pfnet_hidden +) { + // Thread-local buffers + static float _x_a[MAX_D_MODEL] __attribute__((aligned(64))); + static float _x_b[MAX_D_MODEL] __attribute__((aligned(64))); + static float _xn1[MAX_D_MODEL] __attribute__((aligned(64))); + static float _xn2[MAX_D_MODEL] __attribute__((aligned(64))); + static int8_t _xi1[MAX_D_MODEL] __attribute__((aligned(64))); + static int8_t _xi2[MAX_D_MODEL] __attribute__((aligned(64))); + static float _fraw[MAX_D_MODEL] __attribute__((aligned(64))); + static float _craw[MAX_D_MODEL] __attribute__((aligned(64))); + static float _graw[MAX_D_MODEL] __attribute__((aligned(64))); + static float _xmid[MAX_D_MODEL] __attribute__((aligned(64))); + static float _gater[MAX_D_FF] __attribute__((aligned(64))); + static float _upr[MAX_D_FF] __attribute__((aligned(64))); + static float _hid[MAX_D_FF] __attribute__((aligned(64))); + static int8_t _hi8[MAX_D_FF] __attribute__((aligned(64))); + static float _ffno[MAX_D_MODEL] __attribute__((aligned(64))); + static int32_t _acc[MAX_D_FF]; + + memcpy(_x_a, x_in, d_model * sizeof(float)); + + for (int L = 0; L < n_layers; L++) { + const LayerDataMAD& ld = layers[L]; + float* h = h_all + L * d_model; + float* cur = (L & 1) ? _x_b : _x_a; + float* nxt = (L & 1) ? _x_a : _x_b; + + // Prefetch next layer's W_forget (most accessed weight matrix) to hide memory latency + if (L + 1 < n_layers) { + const LayerDataMAD& ld_next = layers[L + 1]; + const int nrg = (d_model + 3) / 4; + const int weight_size = nrg * 4 * d_model; + for (int i = 0; i < weight_size; i += 128) + _mm_prefetch((const char*)ld_next.W_forget + i, _MM_HINT_T1); + } + + // Phase 1: RMSNorm1 + Quantize (optimized with embedded scale computation) + float xs1 = rms_norm_quantize_fused_opt(cur, ld.norm1_w, _xn1, _xi1, d_model, ld.norm_eps); + + // Phase 2: 3 Mixer GEMVs (forget, cand, out) + gemv_2bit_mad_chunk_st(_xi1, ld.W_forget, _acc, d_model, d_model); + for (int j = 0; j < d_model; j++) _fraw[j] = (float)_acc[j] * xs1 * ld.s_forget; + + gemv_2bit_mad_chunk_st(_xi1, ld.W_cand, _acc, d_model, d_model); + for (int j = 0; j < d_model; j++) _craw[j] = (float)_acc[j] * xs1 * ld.s_cand; + + gemv_2bit_mad_chunk_st(_xi1, ld.W_out, _acc, d_model, d_model); + for (int j = 0; j < d_model; j++) _graw[j] = (float)_acc[j] * xs1 * ld.s_out; + + // Phase 3: MLGRU gates (vectorized) + for (int i = 0; i <= d_model-8; i += 8) { + __m256 vf = _avx2_sigmoid_ps(_mm256_loadu_ps(_fraw+i)); + __m256 vc = _avx2_silu_ps(_mm256_loadu_ps(_craw+i)); + __m256 vg = _avx2_sigmoid_ps(_mm256_loadu_ps(_graw+i)); + __m256 vh = _mm256_loadu_ps(h+i); + __m256 vhn= _mm256_fmadd_ps(vf, _mm256_sub_ps(vh, vc), vc); + __m256 vm = _mm256_mul_ps(vg, vhn); + _mm256_storeu_ps(h+i, vhn); + _mm256_storeu_ps(_xmid+i, _mm256_add_ps(_mm256_loadu_ps(cur+i), vm)); + } + for (int i = (d_model/8)*8; i < d_model; i++) { + float f = 1.f/(1.f+expf(-_fraw[i])); + float c = _craw[i]/(1.f+expf(-_craw[i])); + float g = 1.f/(1.f+expf(-_graw[i])); + float hn = c + f*(h[i]-c); + h[i] = hn; + _xmid[i] = cur[i] + g*hn; + } + + // Phase 4: RMSNorm2 + Quantize (optimized with embedded scale computation) + float xs2 = rms_norm_quantize_fused_opt(_xmid, ld.norm2_w, _xn2, _xi2, d_model, ld.norm_eps); + + // Phase 5: 2 FFN GEMVs (gate, up) + gemv_2bit_mad_chunk_st(_xi2, ld.W_gate, _acc, d_model, d_ff); + for (int j = 0; j < d_ff; j++) _gater[j] = (float)_acc[j] * xs2 * ld.s_gate; + + gemv_2bit_mad_chunk_st(_xi2, ld.W_up, _acc, d_model, d_ff); + for (int j = 0; j < d_ff; j++) _upr[j] = (float)_acc[j] * xs2 * ld.s_up; + + // Phase 6: SiLU(gate) Γ— up + quantize (fused two-pass: compute then quantize) + float xs3 = silu_mul_quantize_fused(_gater, _upr, _hi8, d_ff, _hid); + + // Phase 7: Down GEMV + residual add + gemv_2bit_mad_chunk_st(_hi8, ld.W_down, _acc, d_ff, d_model); + for (int j = 0; j < d_model; j++) + nxt[j] = _xmid[j] + (float)_acc[j] * xs3 * ld.s_down; + + // Phase 8: FPResidual + PFNet + if (ld.fp_A_mix && ld.fp_B_mix) + fp_residual_inline(cur, ld.fp_A_mix, ld.fp_B_mix, nxt, d_model, d_model, fp_rank); + + if (ld.pfnet_w1 && ld.pfnet_w2 && ld.pfnet_norm_w) + pfnet_inline(nxt, nxt, ld.pfnet_norm_w, ld.norm_eps, + ld.pfnet_w1, ld.pfnet_s1, + ld.pfnet_w2, ld.pfnet_s2, + d_model, pfnet_hidden); + } + + float* result = (n_layers & 1) ? _x_b : _x_a; + memcpy(x_out, result, d_model * sizeof(float)); +} + +// =========================================================================== +// forward_full_mad v3 β€” OPTIMIZED full N-layer forward +// +// OPTIMIZATIONS vs v2: +// 1. PERSISTENT OMP POOL: Single #pragma omp parallel for ALL layers. +// Eliminates 13 fork/join overheads (~10-50ΞΌs each). +// 2. PARALLEL MLGRU GATES: sigmoid/silu/scan split across threads. +// Was serial in omp single β†’ now all threads contribute. +// 3. PARALLEL SiLUΓ—up + FUSED QUANTIZE: element-wise ops parallelized. +// 4. FUSED FPResidual + PFNet: inside OMP region, done by thread 0 +// while other threads prefetch next layer's weights. +// 5. INTER-LAYER PREFETCH: idle threads prefetch next layer weights. +// 6. FUSED NORM+QUANTIZE: single pass for norm scale, one pass for apply+quantize. +// 7. FUSED RESIDUAL: x_out = xmid + ffno written directly in down GEMV. +// +// Barriers per layer: 3 (was 6 with implicit omp single barriers) +// B1: after mixer GEMVs (needed: gates read all f/c/g) +// B2: after gates+norm2+quantize (needed: FFN GEMVs read xi2) +// B3: after FFN GEMVs (needed: silu reads all gate/up) +// Total: 3 Γ— n_layers (was 6 Γ— n_layers) +// =========================================================================== + +// Helper: fused RMSNorm + quantize in 2 passes (was 4 passes) +// Pass 1: compute sum-of-squares (parallel reduction) +// Pass 2: apply norm*weight and quantize to int8 simultaneously +#ifdef __GNUC__ +__attribute__((target("avx2,fma"))) +#endif +static void rms_norm_quantize_fused( + const float* x, const float* w, float* normed, int8_t* xi8, + int D, float eps, float* out_xs +) { + // Pass 1: sum of squares + __m256 vss = _mm256_setzero_ps(); + int i = 0; + for (; i <= D-8; i+=8) { __m256 v = _mm256_loadu_ps(x+i); vss = _mm256_fmadd_ps(v,v,vss); } + __m128 ss4 = _mm_add_ps(_mm256_castps256_ps128(vss), _mm256_extractf128_ps(vss,1)); + ss4 = _mm_hadd_ps(ss4, ss4); ss4 = _mm_hadd_ps(ss4, ss4); + float ss = _mm_cvtss_f32(ss4); + for (; i < D; i++) ss += x[i]*x[i]; + float norm_sc = 1.0f / sqrtf(ss/(float)D + eps); + + // Pass 2: normalize, find abs max, and write normed + const __m256 vnsc = _mm256_set1_ps(norm_sc); + const __m256 vabsmask = _mm256_castsi256_ps(_mm256_set1_epi32(0x7FFFFFFF)); + __m256 vmax = _mm256_setzero_ps(); + i = 0; + for (; i <= D-8; i+=8) { + __m256 vn = _mm256_mul_ps(_mm256_mul_ps(_mm256_loadu_ps(x+i), vnsc), _mm256_loadu_ps(w+i)); + _mm256_storeu_ps(normed+i, vn); + vmax = _mm256_max_ps(vmax, _mm256_and_ps(vn, vabsmask)); + } + float x_max = _hmax256_ps(vmax); + for (; i < D; i++) { normed[i] = x[i]*norm_sc*w[i]; float a=fabsf(normed[i]); if(a>x_max) x_max=a; } + + // Pass 3: quantize to int8 + const float inv_s = 127.0f / (x_max + 1e-8f); + const __m256 vinv = _mm256_set1_ps(inv_s); + const __m256 vh = _mm256_set1_ps(0.5f); + const __m256i vlo = _mm256_set1_epi32(-128); + const __m256i vhi = _mm256_set1_epi32(127); + i = 0; + for (; i <= D-8; i+=8) { + __m256i vi = _mm256_cvtps_epi32(_mm256_fmadd_ps(_mm256_loadu_ps(normed+i), vinv, vh)); + vi = _mm256_min_epi32(_mm256_max_epi32(vi, vlo), vhi); + __m128i r = _mm_packs_epi32(_mm256_castsi256_si128(vi), _mm256_extracti128_si256(vi,1)); + r = _mm_packs_epi16(r, r); + _mm_storel_epi64((__m128i*)(xi8+i), r); + } + for (; i < D; i++) { + float v = normed[i]*inv_s + 0.5f; + v = v > 127.f ? 127.f : (v < -128.f ? -128.f : v); + xi8[i] = (int8_t)(int)v; + } + if (out_xs) *out_xs = x_max / (127.0f + 1e-8f); +} + +#ifdef __GNUC__ +__attribute__((target("avx2,fma"))) +#endif +EXPORT void forward_full_mad( + const float* x_in, float* x_out, float* h_all, + const LayerDataMAD* layers, + int n_layers, int d_model, int d_ff, int fp_rank, int pfnet_hidden +) { + // Shared buffers (only accessed inside OMP region with proper sync) + static float _x_a[MAX_D_MODEL] __attribute__((aligned(64))); + static float _x_b[MAX_D_MODEL] __attribute__((aligned(64))); + static float _xn1[MAX_D_MODEL] __attribute__((aligned(64))); + static float _xn2[MAX_D_MODEL] __attribute__((aligned(64))); + static int8_t _xi1[MAX_D_MODEL] __attribute__((aligned(64))); + static int8_t _xi2[MAX_D_MODEL] __attribute__((aligned(64))); + static float _fraw[MAX_D_MODEL] __attribute__((aligned(64))); + static float _craw[MAX_D_MODEL] __attribute__((aligned(64))); + static float _graw[MAX_D_MODEL] __attribute__((aligned(64))); + static float _xmid[MAX_D_MODEL] __attribute__((aligned(64))); + static float _gater[MAX_D_FF] __attribute__((aligned(64))); + static float _upr[MAX_D_FF] __attribute__((aligned(64))); + static float _hid[MAX_D_FF] __attribute__((aligned(64))); + static int8_t _hi8[MAX_D_FF] __attribute__((aligned(64))); + static float _ffno[MAX_D_MODEL] __attribute__((aligned(64))); + static float _cs[6]; // scale factors shared between threads + + memcpy(_x_a, x_in, d_model * sizeof(float)); + + const int nrg_m = (d_model+3)/4; + const int nrg_ff = (d_ff +3)/4; + + // ════════════════════════════════════════════════════════════════════════ + // SINGLE OMP PARALLEL REGION FOR ALL LAYERS (eliminates 13 fork/join) + // ════════════════════════════════════════════════════════════════════════ + #pragma omp parallel + { + // Thread-local accumulator for GEMVs + static thread_local int32_t _acc_tl[MAX_D_FF]; + int nt = omp_get_num_threads(); + int tid = omp_get_thread_num(); + + // Pre-compute row-group partitions (same for all layers) + int rg_per_m=(nrg_m+nt-1)/nt, rg_ms=tid*rg_per_m; + int rg_me=(rg_ms+rg_per_m 0) { + const uint8_t* Wc = ld.W_cand + (ptrdiff_t)rg_ms*((d_model+31)/32)*32; + for (int p = 0; p < 256 && p < lrg*((d_model+31)/32)*32; p += 64) + _mm_prefetch((const char*)(Wc + p), _MM_HINT_T1); + } + + memset(_acc_tl,0,lrg*4*sizeof(int32_t)); + gemv_2bit_mad_chunk(_xi1,ld.W_forget,_acc_tl,d_model,d_model,rg_ms,rg_me); + for(int j=jm_s;j= 3) region_size = (d_model+31)/32 * 32 * ((d_ff+3)/4); + int per_thread = (region_size + nt - 2) / (nt - 1); + int pf_start = (tid-1) * per_thread; + int pf_end = pf_start + per_thread; + if (pf_end > region_size) pf_end = region_size; + for (int p = pf_start; p < pf_end; p += 64) + _mm_prefetch((const char*)(ptrs[w] + p), _MM_HINT_T2); + } + } + } + + // Barrier before next layer (ensures FPResidual+PFNet done + prefetch done) + #pragma omp barrier + // No swap needed β€” cur/nxt computed from layer index + + } // end layer loop + } // end omp parallel + + // After all layers: result is in the buffer for n_layers (evenβ†’_x_a, oddβ†’_x_b) + float* result = (n_layers & 1) ? _x_b : _x_a; + memcpy(x_out, result, d_model * sizeof(float)); +} + +// =========================================================================== +// forward_full_mad_batch: Process multiple patches concurrently on different cores +// +// Strategy: spawn N threads, each processes patches[i] with forward_full_mad_st. +// This avoids inter-layer synchronization overhead and is better for small models. +// +// Measured baseline (1 thread): ~214 pps +// Expected (4 threads): ~4 Γ— 214 = 856 pps (if 1:1 scaling) +// More realistic (4 threads): ~750 pps (accounting for memory contention) +// +// Expected throughput gain: 3.5Γ— β‰ˆ 750 pps βœ“ (exceeds 400 pps target) +// =========================================================================== + +struct BatchPatchData { + const float* x_in; + float* x_out; + float* h_all; + const LayerDataMAD* layers; + int n_layers, d_model, d_ff, fp_rank, pfnet_hidden; +}; + +#ifdef __GNUC__ +__attribute__((target("default"))) +#endif +static void batch_worker_thread(const BatchPatchData* patches, int n_patches) { + // Each thread processes its patches sequentially (no contention within thread) + for (int i = 0; i < n_patches; i++) { + const BatchPatchData& p = patches[i]; + forward_full_mad_st(p.x_in, p.x_out, p.h_all, p.layers, + p.n_layers, p.d_model, p.d_ff, p.fp_rank, p.pfnet_hidden); + } +} + +EXPORT void forward_full_mad_batch( + const float* const* x_in_array, // [n_patches] pointers + float* const* x_out_array, // [n_patches] pointers + float* const* h_all_array, // [n_patches] pointers + const LayerDataMAD* layers, + int n_layers, int d_model, int d_ff, int fp_rank, int pfnet_hidden, + int n_patches, int n_threads +) { + if (n_threads <= 0) n_threads = omp_get_num_procs(); + if (n_threads < 1) n_threads = 1; + + // Allocate batch data + BatchPatchData* batch_data = (BatchPatchData*)malloc(n_patches * sizeof(BatchPatchData)); + for (int i = 0; i < n_patches; i++) { + batch_data[i] = { + x_in_array[i], x_out_array[i], h_all_array[i], + layers, n_layers, d_model, d_ff, fp_rank, pfnet_hidden + }; + } + + // Dispatch to threads + #pragma omp parallel num_threads(n_threads) + { + int tid = omp_get_thread_num(); + int nt = omp_get_num_threads(); + + // Each thread processes patches[tid::nt] + for (int i = tid; i < n_patches; i += nt) { + const BatchPatchData& p = batch_data[i]; + forward_full_mad_st(p.x_in, p.x_out, p.h_all, p.layers, + p.n_layers, p.d_model, p.d_ff, p.fp_rank, p.pfnet_hidden); + } + } + + free(batch_data); +} + +} // extern "C" (closes the block that contains forward_full_mad_batch) + +// =========================================================================== +// PIPELINE PARALLEL (mode 4) β€” 4-thread layer-pipeline single-stream inference +// +// Strategy: +// Stage 0: layers [0..L1) +// Stage 1: layers [L1..L2) +// Stage 2: layers [L2..L3) +// Stage 3: layers [L3..n_layers) +// +// Each stage runs in its own std::thread and processes patches sequentially +// (the recurrent state h_all[L*d_model] for layers it owns is its private +// slice). Inter-stage handoff is a small ring buffer of activation vectors +// plus a single producer-side atomic counter polled by the consumer. +// +// Synchronization is busy-spin on std::atomic with acquire/release. +// Buffers are 64-byte aligned to avoid false sharing on the activation +// handoff lines and on the atomic counters themselves. +// =========================================================================== + +#include +#include +#include + +#ifdef _WIN32 +#include +#endif + +// One activation vector slot, padded to its own cache line group. +struct alignas(64) PipeSlot { + float data[MAX_D_MODEL]; +}; + +// Per-stage scratch buffers (one set per worker thread). +// Identical to the static buffers used by forward_full_mad_st, but +// per-thread to avoid the silent cross-thread aliasing that plagues +// the OMP path when the same function is reused from multiple threads. +struct alignas(64) PipeScratch { + alignas(64) float xa[MAX_D_MODEL]; + alignas(64) float xb[MAX_D_MODEL]; + alignas(64) float xn1[MAX_D_MODEL]; + alignas(64) float xn2[MAX_D_MODEL]; + alignas(64) int8_t xi1[MAX_D_MODEL]; + alignas(64) int8_t xi2[MAX_D_MODEL]; + alignas(64) float fraw[MAX_D_MODEL]; + alignas(64) float craw[MAX_D_MODEL]; + alignas(64) float graw[MAX_D_MODEL]; + alignas(64) float xmid[MAX_D_MODEL]; + alignas(64) float gater[MAX_D_FF]; + alignas(64) float upr[MAX_D_FF]; + alignas(64) float hid[MAX_D_FF]; + alignas(64) int8_t hi8[MAX_D_FF]; + alignas(64) float ffno[MAX_D_MODEL]; + alignas(64) int32_t acc[MAX_D_FF]; +}; + +// Ring buffer between two stages β€” capacity is a power of two +#define PIPE_RING_BITS 2u +#define PIPE_RING_CAP (1u << PIPE_RING_BITS) +#define PIPE_RING_MASK (PIPE_RING_CAP - 1u) + +struct alignas(64) PipeRing { + PipeSlot slots[PIPE_RING_CAP]; + // Padded counters on their own cache lines: + alignas(64) std::atomic produced{0}; + char _pad0[64 - sizeof(std::atomic)]; + alignas(64) std::atomic consumed{0}; + char _pad1[64 - sizeof(std::atomic)]; +}; + +#ifdef __GNUC__ +__attribute__((target("avx2,fma"))) +#endif +static void pipe_process_one_layer( + const LayerDataMAD& ld, float* h, + float* cur, float* nxt, + int d_model, int d_ff, int fp_rank, int pfnet_hidden, + PipeScratch& s +) { + // Phase 1: RMSNorm1 + Quantize + float xs1 = rms_norm_quantize_fused_opt(cur, ld.norm1_w, s.xn1, s.xi1, d_model, ld.norm_eps); + + // Phase 2: 3 Mixer GEMVs + gemv_2bit_mad_chunk_st(s.xi1, ld.W_forget, s.acc, d_model, d_model); + for (int j = 0; j < d_model; j++) s.fraw[j] = (float)s.acc[j] * xs1 * ld.s_forget; + gemv_2bit_mad_chunk_st(s.xi1, ld.W_cand, s.acc, d_model, d_model); + for (int j = 0; j < d_model; j++) s.craw[j] = (float)s.acc[j] * xs1 * ld.s_cand; + gemv_2bit_mad_chunk_st(s.xi1, ld.W_out, s.acc, d_model, d_model); + for (int j = 0; j < d_model; j++) s.graw[j] = (float)s.acc[j] * xs1 * ld.s_out; + + // Phase 3: MLGRU gates (vectorized) + xmid + int i = 0; + for (; i <= d_model-8; i += 8) { + __m256 vf = _avx2_sigmoid_ps(_mm256_loadu_ps(s.fraw+i)); + __m256 vc = _avx2_silu_ps (_mm256_loadu_ps(s.craw+i)); + __m256 vg = _avx2_sigmoid_ps(_mm256_loadu_ps(s.graw+i)); + __m256 vh = _mm256_loadu_ps(h+i); + __m256 vhn= _mm256_fmadd_ps(vf, _mm256_sub_ps(vh, vc), vc); + __m256 vm = _mm256_mul_ps(vg, vhn); + _mm256_storeu_ps(h+i, vhn); + _mm256_storeu_ps(s.xmid+i, _mm256_add_ps(_mm256_loadu_ps(cur+i), vm)); + } + for (; i < d_model; i++) { + float f = 1.f/(1.f+expf(-s.fraw[i])); + float c = s.craw[i]/(1.f+expf(-s.craw[i])); + float g = 1.f/(1.f+expf(-s.graw[i])); + float hn = c + f*(h[i]-c); + h[i] = hn; + s.xmid[i] = cur[i] + g*hn; + } + + // Phase 4: RMSNorm2 + Quantize + float xs2 = rms_norm_quantize_fused_opt(s.xmid, ld.norm2_w, s.xn2, s.xi2, d_model, ld.norm_eps); + + // Phase 5: 2 FFN GEMVs + gemv_2bit_mad_chunk_st(s.xi2, ld.W_gate, s.acc, d_model, d_ff); + for (int j = 0; j < d_ff; j++) s.gater[j] = (float)s.acc[j] * xs2 * ld.s_gate; + gemv_2bit_mad_chunk_st(s.xi2, ld.W_up, s.acc, d_model, d_ff); + for (int j = 0; j < d_ff; j++) s.upr[j] = (float)s.acc[j] * xs2 * ld.s_up; + + // Phase 6: SiLU(gate)*up + quantize + float xs3 = silu_mul_quantize_fused(s.gater, s.upr, s.hi8, d_ff, s.hid); + + // Phase 7: Down GEMV + residual + gemv_2bit_mad_chunk_st(s.hi8, ld.W_down, s.acc, d_ff, d_model); + for (int j = 0; j < d_model; j++) + nxt[j] = s.xmid[j] + (float)s.acc[j] * xs3 * ld.s_down; + + // Phase 8: FPResidual + PFNet + if (ld.fp_A_mix && ld.fp_B_mix) + fp_residual_inline(cur, ld.fp_A_mix, ld.fp_B_mix, nxt, d_model, d_model, fp_rank); + if (ld.pfnet_w1 && ld.pfnet_w2 && ld.pfnet_norm_w) + pfnet_inline(nxt, nxt, ld.pfnet_norm_w, ld.norm_eps, + ld.pfnet_w1, ld.pfnet_s1, + ld.pfnet_w2, ld.pfnet_s2, + d_model, pfnet_hidden); +} + +#ifdef _WIN32 +static void pipe_pin_thread(int logical_cpu) { + DWORD_PTR mask = (DWORD_PTR)1 << logical_cpu; + SetThreadAffinityMask(GetCurrentThread(), mask); +} +#else +static void pipe_pin_thread(int /*logical_cpu*/) { /* no-op */ } +#endif + +// Helper: portable 64-byte aligned alloc +static void* aligned_alloc_compat(size_t bytes) { +#ifdef _WIN32 + return _aligned_malloc(bytes, 64); +#else + size_t sz = ((bytes + 63) / 64) * 64; + return aligned_alloc(64, sz); +#endif +} + +static void aligned_free_compat(void* p) { +#ifdef _WIN32 + _aligned_free(p); +#else + free(p); +#endif +} + +// --------------------------------------------------------------------------- +// Cost calibration: measure per-layer wall-time on a single thread (warm). +// Used by pipe_dp_partition to compute a load-balanced layer split. +// --------------------------------------------------------------------------- +static void pipe_calibrate_costs( + const LayerDataMAD* layers, int n_layers, + int d_model, int d_ff, int fp_rank, int pfnet_hidden, + double* costs_out +) { + PipeScratch* s = (PipeScratch*)aligned_alloc_compat(sizeof(PipeScratch)); + memset(s, 0, sizeof(PipeScratch)); + + float* h_buf = (float*)aligned_alloc_compat(d_model * sizeof(float)); + float* in_buf = (float*)aligned_alloc_compat(d_model * sizeof(float)); + for (int i = 0; i < d_model; i++) in_buf[i] = ((i % 7) - 3) * 0.05f; + + const int N_WARMUP = 5; + const int N_ITERS = 50; + + for (int L = 0; L < n_layers; L++) { + const LayerDataMAD& ld = layers[L]; + // Warm cache for this layer + for (int it = 0; it < N_WARMUP; it++) { + memset(h_buf, 0, d_model * sizeof(float)); + memcpy(s->xa, in_buf, d_model * sizeof(float)); + pipe_process_one_layer(ld, h_buf, s->xa, s->xb, + d_model, d_ff, fp_rank, pfnet_hidden, *s); + } + // Time β€” repeat with growing iter count if first run is too short + // for the wallclock resolution. Reject runs <2ms (likely noise). + int iters = N_ITERS; + double dt = 0.0; + for (int trial = 0; trial < 3; trial++) { + double t0 = omp_get_wtime(); + for (int it = 0; it < iters; it++) { + memcpy(s->xa, in_buf, d_model * sizeof(float)); + pipe_process_one_layer(ld, h_buf, s->xa, s->xb, + d_model, d_ff, fp_rank, pfnet_hidden, *s); + } + dt = omp_get_wtime() - t0; + if (dt > 0.002) break; // β‰₯2ms is reliable + iters *= 4; // otherwise quadruple + } + costs_out[L] = dt / (double)iters; + } + + aligned_free_compat(h_buf); + aligned_free_compat(in_buf); + aligned_free_compat(s); +} + +// --------------------------------------------------------------------------- +// DP partition: split layers [0..n) into k contiguous stages such that the +// maximum stage cost is minimized. Returns L_split[0..k] with L_split[0]=0 +// and L_split[k]=n. +// --------------------------------------------------------------------------- +static void pipe_dp_partition( + const double* costs, int n, int k, int* L_split +) { + if (k <= 1) { L_split[0] = 0; L_split[1] = n; return; } + if (k >= n) { + // One layer per stage, then empty stages collapse β€” clamp k = n + for (int i = 0; i <= k; i++) L_split[i] = (i < n) ? i : n; + return; + } + + // Prefix sums + std::vector psum(n + 1, 0.0); + for (int i = 0; i < n; i++) psum[i + 1] = psum[i] + costs[i]; + + // f[i][s] = min over j> f(n + 1, std::vector(k + 1, 1e18)); + std::vector> back(n + 1, std::vector(k + 1, 0)); + f[0][0] = 0.0; + for (int s = 1; s <= k; s++) { + for (int i = s; i <= n; i++) { + for (int j = s - 1; j < i; j++) { + double stage_cost = psum[i] - psum[j]; + double m = (f[j][s-1] > stage_cost) ? f[j][s-1] : stage_cost; + if (m < f[i][s]) { + f[i][s] = m; + back[i][s] = j; + } + } + } + } + + // Reconstruct + L_split[k] = n; + int cur = n; + for (int s = k; s >= 1; s--) { + cur = back[cur][s]; + L_split[s - 1] = cur; + } + L_split[0] = 0; +} + +// Default even split when no calibration available. +static void pipe_even_split(int n_layers, int n_stages, int* L_split) { + L_split[0] = 0; + for (int k = 1; k < n_stages; k++) + L_split[k] = (n_layers * k) / n_stages; + L_split[n_stages] = n_layers; +} + +extern "C" { + +// Process n_patches sequentially through an N-stage layer pipeline. +// Single-stream throughput: each input patch produces one output patch. +// h_all is recurrent state, modified in place; each stage owns a disjoint +// slice of layers, so its h-rows are not touched by any other thread. +// +// Parameters: +// n_stages : number of pipeline stages (1..n_layers). If <=0 β†’ 4. +// pin_threads : if non-zero, pin each worker to logical CPU 2*k (i.e. +// physical cores on Intel HT layout). +// do_calibrate : if non-zero, run a single-threaded warm calibration of +// per-layer cost and use DP to compute an optimal split. +EXPORT void forward_full_mad_pipeline( + const float* const* x_in_array, // [n_patches] + float* const* x_out_array, // [n_patches] + float* h_all, // [n_layers * d_model] persistent + const LayerDataMAD* layers, + int n_layers, int d_model, int d_ff, int fp_rank, int pfnet_hidden, + int n_patches, int pin_threads, + int n_stages, int do_calibrate +) { + if (n_stages <= 0) n_stages = 4; + if (n_stages > n_layers) n_stages = n_layers; + + // -------- Layer split: cached calibrated split, recomputed only ---- + // when do_calibrate=1 OR when (n_stages, n_layers) tuple changes. + // Cache is process-wide; fine since all calls share the same model. + static int cached_n_stages = 0; + static int cached_n_layers = 0; + static int cached_split[64] = {0}; + static bool have_calibrated = false; + + std::vector L_split(n_stages + 1); + bool need_recompute = (cached_n_stages != n_stages) || + (cached_n_layers != n_layers) || + (do_calibrate && !have_calibrated); + if (need_recompute) { + if (do_calibrate) { + std::vector costs(n_layers, 0.0); + pipe_calibrate_costs(layers, n_layers, d_model, d_ff, + fp_rank, pfnet_hidden, costs.data()); + pipe_dp_partition(costs.data(), n_layers, n_stages, L_split.data()); + have_calibrated = true; + // Print the split for visibility (only on calibration). + fprintf(stderr, "[pipeline] calibrated split (stages=%d, layers=%d):", + n_stages, n_layers); + for (int k = 0; k <= n_stages; k++) fprintf(stderr, " %d", L_split[k]); + fprintf(stderr, " costs:"); + for (int L = 0; L < n_layers; L++) + fprintf(stderr, " %.0fus", costs[L]*1e6); + fprintf(stderr, "\n"); + } else { + pipe_even_split(n_layers, n_stages, L_split.data()); + } + cached_n_stages = n_stages; + cached_n_layers = n_layers; + for (int k = 0; k <= n_stages; k++) cached_split[k] = L_split[k]; + } else { + for (int k = 0; k <= n_stages; k++) L_split[k] = cached_split[k]; + } + + // -------- Process-wide affinity (saves & restores on Win) -------- +#ifdef _WIN32 + DWORD_PTR prev_proc_mask = 0, prev_sys_mask = 0; + DWORD_PTR proc_mask = 0; + if (pin_threads) { + for (int k = 0; k < n_stages; k++) proc_mask |= ((DWORD_PTR)1 << (k * 2)); + GetProcessAffinityMask(GetCurrentProcess(), &prev_proc_mask, &prev_sys_mask); + SetProcessAffinityMask(GetCurrentProcess(), proc_mask); + } +#endif + + // -------- Allocate per-stage scratch and rings ------------------- + std::vector scratch(n_stages); + for (int k = 0; k < n_stages; k++) { +#ifdef _WIN32 + scratch[k] = (PipeScratch*)_aligned_malloc(sizeof(PipeScratch), 64); +#else + scratch[k] = (PipeScratch*)aligned_alloc(64, + ((sizeof(PipeScratch)+63)/64)*64); +#endif + memset(scratch[k], 0, sizeof(PipeScratch)); + } + + std::vector rings(n_stages > 1 ? n_stages - 1 : 0); + for (int k = 0; k + 1 < n_stages; k++) { +#ifdef _WIN32 + rings[k] = (PipeRing*)_aligned_malloc(sizeof(PipeRing), 64); +#else + rings[k] = (PipeRing*)aligned_alloc(64, + ((sizeof(PipeRing)+63)/64)*64); +#endif + new (rings[k]) PipeRing(); + } + + auto stage_fn = [&](int k) { + if (pin_threads) { + // i7-8750H Intel HT: logical (k*2) = physical core k. + pipe_pin_thread(k * 2); + } + + const int L0 = L_split[k]; + const int L1 = L_split[k + 1]; + const int n_local = L1 - L0; + + PipeScratch& s = *scratch[k]; + PipeRing* in_ring = (k == 0) ? nullptr : rings[k - 1]; + PipeRing* out_ring = (k == n_stages - 1) ? nullptr : rings[k]; + + for (int p = 0; p < n_patches; p++) { + // -------- 1) Acquire input activation for patch p ---------- + const float* in_ptr; + if (in_ring == nullptr) { + in_ptr = x_in_array[p]; + } else { + while (in_ring->produced.load(std::memory_order_acquire) <= (uint64_t)p) { + _mm_pause(); + } + in_ptr = in_ring->slots[p & PIPE_RING_MASK].data; + } + + // -------- 2) Acquire output slot ------------------------ + float* out_ptr; + if (out_ring == nullptr) { + out_ptr = x_out_array[p]; + } else { + while ((uint64_t)p - out_ring->consumed.load(std::memory_order_acquire) + >= (uint64_t)PIPE_RING_CAP) { + _mm_pause(); + } + out_ptr = out_ring->slots[p & PIPE_RING_MASK].data; + } + + // -------- 3) Process this stage's layer range ---------- + memcpy(s.xa, in_ptr, d_model * sizeof(float)); + for (int Li = 0; Li < n_local; Li++) { + int L = L0 + Li; + const LayerDataMAD& ld = layers[L]; + float* h = h_all + L * d_model; + float* cur = (Li & 1) ? s.xb : s.xa; + float* nxt = (Li & 1) ? s.xa : s.xb; + + // Prefetch INSIDE-stage: next layer's W_forget + if (Li + 1 < n_local) { + const LayerDataMAD& ldn = layers[L + 1]; + const int nrg = (d_model + 3) / 4; + const int wsz = nrg * 4 * d_model; + for (int i = 0; i < wsz; i += 128) + _mm_prefetch((const char*)ldn.W_forget + i, _MM_HINT_T1); + } + + // Cross-patch prefetch: while on the LAST layer of this + // stage for patch p, prefetch this stage's FIRST layer's + // W_forget into L2/L3 to warm cache for patch p+1. + if (Li == n_local - 1 && p + 1 < n_patches && n_local > 1) { + const LayerDataMAD& ld_first = layers[L0]; + const int nrg = (d_model + 3) / 4; + const int wsz = nrg * 4 * d_model; + // Sparser prefetch (256B step) to avoid thrashing TLB + for (int i = 0; i < wsz; i += 256) + _mm_prefetch((const char*)ld_first.W_forget + i, _MM_HINT_T2); + } + + pipe_process_one_layer(ld, h, cur, nxt, + d_model, d_ff, fp_rank, pfnet_hidden, s); + } + float* result = (n_local & 1) ? s.xb : s.xa; + memcpy(out_ptr, result, d_model * sizeof(float)); + + // -------- 4) Publish (out_ring) and consume (in_ring) ---- + if (out_ring) { + out_ring->produced.store((uint64_t)p + 1, std::memory_order_release); + } + if (in_ring) { + in_ring->consumed.store((uint64_t)p + 1, std::memory_order_release); + } + } + }; + + std::vector workers; + workers.reserve(n_stages); + for (int k = 0; k < n_stages; k++) + workers.emplace_back(stage_fn, k); + for (auto& t : workers) t.join(); + + // Cleanup + for (int k = 0; k < n_stages; k++) { +#ifdef _WIN32 + _aligned_free(scratch[k]); +#else + free(scratch[k]); +#endif + } + for (int k = 0; k + 1 < n_stages; k++) { + rings[k]->~PipeRing(); +#ifdef _WIN32 + _aligned_free(rings[k]); +#else + free(rings[k]); +#endif + } + +#ifdef _WIN32 + if (pin_threads && prev_proc_mask) { + SetProcessAffinityMask(GetCurrentProcess(), prev_proc_mask); + } +#endif +} + +} // extern "C" (closes pipeline block) + +// =========================================================================== +// local_decode_step β€” MegaByte LocalByteDecoder, 1 byte step +// +// One autoregressive step of the intra-patch local model (matches model.py). +// Architecture: +// h_proj [d_model β†’ P*d_local] β†’ causal attn+FFN over L=k+1 tokens β†’ out_proj [256] +// All weights 2-bit MAD. L ≀ 4, so attention is scalar (no SIMD needed). +// Called 4Γ— per patch from the inference generate loop. +// +// Fused-BitLinear RMSNorms (o_norm_w, ffn_down_norm_w, out_norm_w) feed +// every BitLinear in the local decoder with normalized activations, matching +// the PyTorch LocalByteDecoder. Each is OPTIONAL: pass NULL to skip (identity +// fallback) for back-compat with weight bundles built before these norms +// existed. Cost: 3 Γ— O(d_local) plus 1 Γ— O(d_ff_local) extra ops per byte +// step β€” negligible vs the 4 GEMVs that dominate. +// =========================================================================== + +extern "C" { + +EXPORT void local_decode_step( + const float* h, // [d_model] global post-norm hidden state + const uint8_t* W_hproj, float s_hproj, // [P*d_local, d_model] 2-bit MAD + const float* byte_emb_table, // [256, d_local] FP32 + const float* pos_emb, // [P, d_local] FP32 + const int32_t* generated, // [k] already-generated bytes + int k, // current byte index (0..P-1) + int d_model, + int d_local, // 128 + int n_heads, // 4 + int d_ff_local, // 512 + int patch_size, // 4 + const float* norm1_w, + const uint8_t* W_q, float s_q, + const uint8_t* W_k, float s_k, + const uint8_t* W_v, float s_v, + const float* o_norm_w, // [d_local] nullable β€” Fused-BitLinear pre-W_o + const uint8_t* W_o, float s_o, + const float* norm2_w, + const uint8_t* W_gate, float s_gate, + const uint8_t* W_up, float s_up, + const float* ffn_down_norm_w, // [d_ff_local] nullable β€” pre-W_down + const uint8_t* W_down, float s_down, + const float* out_norm_w, // [d_local] nullable β€” pre-W_out + const uint8_t* W_out, float s_out, + float norm_eps, + float* logits_out // [256] +) { + const int L = k + 1; + const int hd = d_local / n_heads; + static thread_local float _g[4 * 256]; + static thread_local float _x[4 * 256]; + static thread_local float _xn[4 * 256]; + static thread_local float _q[4 * 256], _kk[4 * 256], _v[4 * 256], _attn[256]; + static thread_local float _xn2[256], _hid[1024], _hidn[1024]; + static thread_local int8_t _xi[2048], _hi8[1024]; + + // 1. h_proj β†’ g[0..k] + { + float xs = quantize_x_avx2(h, _xi, d_model); + float cs = xs * s_hproj; + int nrg = (L * d_local + 3) / 4; + int32_t acc[4 * 256] = {}; + gemv_2bit_mad_chunk(_xi, W_hproj, acc, d_model, L * d_local, 0, nrg); + for (int j = 0; j < L * d_local; j++) _g[j] = (float)acc[j] * cs; + } + + // 2. x[t] = g[t] + byte_emb[t] + pos_emb[t] + for (int t = 0; t < d_local; t++) _x[t] = _g[t] + pos_emb[t]; // pos 0: zero byte emb + for (int t = 1; t < L; t++) { + int bv = (int)generated[t - 1]; + const float *bpe = byte_emb_table + bv * d_local; + const float *pet = pos_emb + t * d_local; + const float *gt = _g + t * d_local; + float *xt = _x + t * d_local; + for (int i = 0; i < d_local; i++) xt[i] = gt[i] + bpe[i] + pet[i]; + } + + // 3. RMSNorm + Q/K/V projections for all L tokens + for (int t = 0; t < L; t++) { + rms_norm_inline(_x + t*d_local, norm1_w, _xn + t*d_local, d_local, norm_eps); + float xs = quantize_x_avx2(_xn + t*d_local, _xi, d_local); + int nrg = (d_local + 3) / 4; + int32_t aq[256]={}, ak[256]={}, av[256]={}; + gemv_2bit_mad_chunk(_xi, W_q, aq, d_local, d_local, 0, nrg); + gemv_2bit_mad_chunk(_xi, W_k, ak, d_local, d_local, 0, nrg); + gemv_2bit_mad_chunk(_xi, W_v, av, d_local, d_local, 0, nrg); + float cq = xs*s_q, ck = xs*s_k, cv = xs*s_v; + for (int i = 0; i < d_local; i++) { + _q[t*d_local+i] = (float)aq[i]*cq; + _kk[t*d_local+i] = (float)ak[i]*ck; + _v[t*d_local+i] = (float)av[i]*cv; + } + } + + // 4. Causal attention for last position β†’ _attn[d_local] + float scale_qk = 1.0f / sqrtf((float)hd); + memset(_attn, 0, d_local * sizeof(float)); + for (int h = 0; h < n_heads; h++) { + int ho = h * hd; + float aw[4]; float maxw = -1e30f; + for (int t = 0; t < L; t++) { + float dot = 0.0f; + for (int i = 0; i < hd; i++) dot += _q[(L-1)*d_local+ho+i] * _kk[t*d_local+ho+i]; + aw[t] = dot * scale_qk; + if (aw[t] > maxw) maxw = aw[t]; + } + float se = 0.0f; + for (int t = 0; t < L; t++) { aw[t] = expf(aw[t]-maxw); se += aw[t]; } + for (int t = 0; t < L; t++) aw[t] /= se; + for (int i = 0; i < hd; i++) { + float acc = 0.0f; + for (int t = 0; t < L; t++) acc += aw[t] * _v[t*d_local+ho+i]; + _attn[ho+i] = acc; + } + } + // o_proj + residual. Fused-BitLinear: RMSNorm pre-quantization when + // o_norm_w is provided. _xn2 is unused here (SwiGLU's norm2 output + // hasn't been written yet) so we reuse it as the norm-output scratch. + { + const float* o_in = _attn; + if (o_norm_w) { + rms_norm_inline(_attn, o_norm_w, _xn2, d_local, norm_eps); + o_in = _xn2; + } + float xs = quantize_x_avx2(o_in, _xi, d_local); + int nrg = (d_local+3)/4; + int32_t ao[256]={}; + gemv_2bit_mad_chunk(_xi, W_o, ao, d_local, d_local, 0, nrg); + float co = xs * s_o; + for (int i = 0; i < d_local; i++) _x[(L-1)*d_local+i] += (float)ao[i]*co; + } + + // 5. SwiGLU FFN on last token + rms_norm_inline(_x+(L-1)*d_local, norm2_w, _xn2, d_local, norm_eps); + { + float xs = quantize_x_avx2(_xn2, _xi, d_local); + int nrg = (d_ff_local+3)/4; + int32_t ag[1024]={}, au[1024]={}; + gemv_2bit_mad_chunk(_xi, W_gate, ag, d_local, d_ff_local, 0, nrg); + gemv_2bit_mad_chunk(_xi, W_up, au, d_local, d_ff_local, 0, nrg); + float cg = xs*s_gate, cu = xs*s_up; + for (int i = 0; i < d_ff_local; i++) { + float g = (float)ag[i]*cg, u = (float)au[i]*cu; + _hid[i] = g / (1.0f + expf(-g)) * u; + } + // Fused-BitLinear: RMSNorm on _hid (silu(g)*u, arbitrary magnitudes) + // before W_down quantization. Falls back to identity when null. + const float* down_in = _hid; + if (ffn_down_norm_w) { + rms_norm_inline(_hid, ffn_down_norm_w, _hidn, d_ff_local, norm_eps); + down_in = _hidn; + } + float hs = quantize_x_avx2(down_in, _hi8, d_ff_local); + int nrd = (d_local+3)/4; + int32_t ad[256]={}; + gemv_2bit_mad_chunk(_hi8, W_down, ad, d_ff_local, d_local, 0, nrd); + float cd = hs*s_down; + for (int i = 0; i < d_local; i++) _x[(L-1)*d_local+i] += (float)ad[i]*cd; + } + + // 6. out_proj [d_local β†’ 256]. Fused-BitLinear: RMSNorm the residual + // stream pre-W_out so the head sees normalized activations. _xn2 is + // free again (SwiGLU done) so we reuse it. + { + const float* out_in = _x + (L-1)*d_local; + if (out_norm_w) { + rms_norm_inline(out_in, out_norm_w, _xn2, d_local, norm_eps); + out_in = _xn2; + } + float xs = quantize_x_avx2(out_in, _xi, d_local); + int nrg = (256+3)/4; + int32_t ao[256]={}; + gemv_2bit_mad_chunk(_xi, W_out, ao, d_local, 256, 0, nrg); + float co = xs * s_out; + for (int j = 0; j < 256; j++) logits_out[j] = (float)ao[j]*co; + } +} + +} // local_decode_step extern "C" + diff --git a/evaluation/source/inference/links.md b/evaluation/source/inference/links.md new file mode 100644 index 0000000000000000000000000000000000000000..70da6491123a90a27dcf09679ed91c4ba82600a2 --- /dev/null +++ b/evaluation/source/inference/links.md @@ -0,0 +1,62 @@ +# CPU-1 Inference β€” Links & References + +## Core Papers +- [The Era of 1-bit LLMs (BitNet b1.58)](https://arxiv.org/abs/2402.17764) β€” Ternary weight quantization +- [T-MAC: CPU-Based LUT-Based Inference](https://arxiv.org/abs/2407.00088) β€” LUT approach for ternary GEMV +- [minLSTM / MLGRU](https://arxiv.org/abs/2410.01201) β€” Minimal recurrent architecture used in CPU-1 +- [MegaByte (Yu et al., 2023)](https://arxiv.org/abs/2305.07185) β€” Two-tier byte-level architecture used by `local_decode_step` + +## Implementation References +- [T-MAC GitHub](https://github.com/microsoft/T-MAC) β€” LUT kernel reference implementation +- [llama.cpp](https://github.com/ggerganov/llama.cpp) β€” GGML quantized inference reference +- [BitNet.cpp](https://github.com/microsoft/BitNet) β€” Microsoft's official BitNet inference + +## Source files in this folder + +- `kernels.cpp` β€” All AVX2 + FMA inference kernels (GEMV, RMSNorm, SiLU, MLGRU, + PFNet, FPResidual, the `forward_full_mad_*` family, and `local_decode_step`). + Compiled inline via `g++ -x c++` from the benchmark. +- `benchmark.c` β€” Standalone driver. Allocates random ternary weights and times + the global pass + MegaByte LocalByteDecoder per patch across modes 0–4. +- `links.md` β€” this file. + +Build artifacts (`benchmark.exe`, `*.dll`, `*.o`) are gitignored. + +## Build & run + +```bash +# Compile (Windows MSYS / Linux / WSL): +g++ -O3 -mavx2 -mfma -fopenmp -falign-loops=32 -funroll-loops -ffast-math \ + -std=c++11 -x c++ -o benchmark.exe \ + inference/benchmark.c inference/kernels.cpp -lm + +# Defaults: CPU-1 170M (d_model=1024, n_layers=14, d_ff=2688), full patch +# (1 global pass + 4 LocalByteDecoder steps per patch). + +# Single-stream pipeline (mode 4, recommended for 1 active user): +./benchmark.exe --mode 4 --patches 80 --warmup 30 \ + --chunk 128 --pin 1 --stages 6 --calibrate 1 --local 1 + +# Multi-stream batch (mode 3, max aggregate throughput): +./benchmark.exe --mode 3 --batch 6 --threads 6 --patches 100 --warmup 30 --local 1 + +# 400M kernel-optimal config (24 layers, perfect 4-per-stage split): +./benchmark.exe --d_model 1280 --n_layers 24 --d_ff 3328 --fp_rank 8 \ + --mode 4 --patches 30 --warmup 10 \ + --chunk 64 --pin 1 --stages 6 --calibrate 1 --local 1 +``` + +See the main `README.md` (`CPU-1 170M Performance β€” Current C Benchmark Status`) +for full mode descriptions and benchmark tables. + +## Optional: build as a shared library + +If you want to call the kernels from Python via `ctypes`: + +```bash +g++ -O3 -shared -fPIC -mavx2 -mfma -fopenmp -ffast-math \ + -o kernels.dll inference/kernels.cpp +``` + +Currently no Python code in this repo loads the DLL; the C benchmark is the +authoritative consumer. diff --git a/evaluation/source/runners/__init__.py b/evaluation/source/runners/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..34897bcf4a69f94cce984b45d26aa44a2b7b1b2b --- /dev/null +++ b/evaluation/source/runners/__init__.py @@ -0,0 +1 @@ +"""Execution recipes for the experiment platforms.""" diff --git a/evaluation/source/runners/common.py b/evaluation/source/runners/common.py new file mode 100644 index 0000000000000000000000000000000000000000..2cd080281d45d940fd9055cd31d90b780c083b44 --- /dev/null +++ b/evaluation/source/runners/common.py @@ -0,0 +1,69 @@ +"""Explicit plans for historical platform recipes using the current packages.""" +import argparse +import json +import os +from pathlib import Path +import subprocess +import sys + +ROOT = Path(__file__).resolve().parents[1] + + +def main(platform: str) -> None: + parser = argparse.ArgumentParser(description=f"CPU-1 {platform} experiment recipe") + parser.add_argument("task", choices=("dataset", "ablation")) + parser.add_argument("--execute", action="store_true", help="Run the plan; otherwise print it") + parser.add_argument("--n-docs", type=int, default=850_000) + parser.add_argument("--chunk-size", type=int, default=500 if platform == "kaggle" else 3000) + parser.add_argument("--shard-offset", type=int, default=0) + parser.add_argument("--local-only", action="store_true") + parser.add_argument("--output-dir", type=Path, default=Path("shared_dataset")) + parser.add_argument("--run") + parser.add_argument("--config", type=Path) + parser.add_argument("--backend", choices=("cuda", "amd"), default="cuda") + parser.add_argument("--resume-ckpt", type=Path) + parser.add_argument("--phase", type=int, choices=(1, 2)) + parser.add_argument("--phase1-ckpt", type=Path) + args = parser.parse_args() + if args.n_docs <= 0 or args.chunk_size <= 0 or args.shard_offset < 0: + parser.error("Document/chunk counts must be positive; shard offset must be nonnegative") + if args.task == "dataset": + plan = {"platform": platform, "task": args.task, "source": "data_pipeline.prepare", + "n_docs": args.n_docs, "chunk_size": args.chunk_size, + "shard_offset": args.shard_offset, "stream_to_hub": not args.local_only, + "output_dir": str(args.output_dir), + "provenance": "Recovered launcher settings; not an observed document count"} + else: + if not args.run: + parser.error("ablation requires --run") + module = "training.ablation_amd" if args.backend == "amd" else "training.ablation" + command = [sys.executable, "-m", module, "--run", args.run, "--skip-install"] + if args.config: + command += ["--config", str(args.config.resolve())] + if args.resume_ckpt: + command += ["--resume_ckpt", str(args.resume_ckpt.resolve())] + if args.phase: + command += ["--phase", str(args.phase)] + if args.phase1_ckpt: + command += ["--phase1_ckpt", str(args.phase1_ckpt.resolve())] + plan = {"platform": platform, "task": args.task, "command": command} + print(json.dumps(plan, indent=2)) + if not args.execute: + return + if platform == "kaggle" and not os.environ.get("HF_TOKEN"): + try: + from kaggle_secrets import UserSecretsClient + os.environ["HF_TOKEN"] = UserSecretsClient().get_secret("HF_TOKEN") + except ImportError: + if args.task == "dataset" and not args.local_only: + raise RuntimeError("Configure HF_TOKEN through Kaggle Secrets or the environment") from None + if args.task == "ablation": + subprocess.run(plan["command"], check=True, cwd=ROOT) + return + if not args.local_only and not os.environ.get("HF_TOKEN"): + raise RuntimeError("HF_TOKEN is required for dataset uploads") + from data_pipeline import prepare + prepare.OUTPUT_DIR = args.output_dir + prepare.build_full_dataset(n_docs=args.n_docs, chunk_size=args.chunk_size, + shard_offset=args.shard_offset, + stream_to_hub=not args.local_only) diff --git a/evaluation/source/runners/kaggle.py b/evaluation/source/runners/kaggle.py new file mode 100644 index 0000000000000000000000000000000000000000..b6dc5268afe4718f43a7519e16ffbaa557813d71 --- /dev/null +++ b/evaluation/source/runners/kaggle.py @@ -0,0 +1,5 @@ +"""Recovered kaggle recipe; print a plan unless --execute is supplied.""" +from runners.common import main + +if __name__ == "__main__": + main("kaggle") diff --git a/evaluation/source/runners/lightning.py b/evaluation/source/runners/lightning.py new file mode 100644 index 0000000000000000000000000000000000000000..01edd53893bebaa64b0e4494ac8dbe7b81872849 --- /dev/null +++ b/evaluation/source/runners/lightning.py @@ -0,0 +1,5 @@ +"""Recovered lightning recipe; print a plan unless --execute is supplied.""" +from runners.common import main + +if __name__ == "__main__": + main("lightning") diff --git a/evaluation/source/tests/test_provenance.py b/evaluation/source/tests/test_provenance.py new file mode 100644 index 0000000000000000000000000000000000000000..aabe32ea9fa7a6ea647b0f43542c680db5e06621 --- /dev/null +++ b/evaluation/source/tests/test_provenance.py @@ -0,0 +1,115 @@ +"""Offline checks for recovered configuration selection and credential handling.""" +import contextlib +import hashlib +import io +import json +from pathlib import Path +import subprocess +import sys +import tempfile +import unittest +from unittest.mock import patch + +import torch +from training.configuration import load_config +from training import ablation, ablation_amd +from cpu1 import hub_storage +from runners import common + +ROOT = Path(__file__).resolve().parents[1] + + +class ConfigurationTests(unittest.TestCase): + def test_all_published_configs_build_recorded_architectures(self): + manifest = json.loads((ROOT/"experiments/published/manifest.json").read_text()) + self.assertEqual(len(manifest["experiments"]), 34) + for record in manifest["experiments"]: + with self.subTest(run=record["run"]): + path = ROOT/"experiments/published"/record["config"] + self.assertEqual(hashlib.sha256(path.read_bytes()).hexdigest(), record["config_sha256"]) + config = load_config(path) + with torch.device("meta"), contextlib.redirect_stdout(io.StringIO()): + model = ablation.build_ablation_model(config) + self.assertEqual(sum(p.numel() for p in model.parameters()), record["parameters"]) + del model + + def test_v3_cli_uses_record_in_both_backends(self): + path = ROOT/"experiments/published/configs/run_04_v3.json" + for module in (ablation, ablation_amd): + with self.subTest(backend=module.__name__), patch.object(sys, "argv", [ + "trainer", "--run", "run_04_v3", "--config", str(path), "--skip-install"]): + args = module.parse_args() + self.assertEqual(args.run, "run_04_v3") + self.assertEqual(args.config, path) + self.assertEqual(args.phase, 1) + self.assertEqual(load_config(args.config)["chinchilla_tokens_per_param"], 150) + + def test_unknown_preset_does_not_silently_select_defaults(self): + for module in (ablation, ablation_amd): + with patch.object(sys, "argv", ["trainer", "--run", "run_04_v3"]), contextlib.redirect_stderr(io.StringIO()): + with self.assertRaises(SystemExit) as exc: + module.parse_args() + self.assertEqual(exc.exception.code, 2) + + def test_config_rejects_missing_and_nonpositive_dimensions(self): + storage = Path("D:/cpu1-readme-audit/test-checkpoints") + storage.mkdir(parents=True, exist_ok=True) + base = load_config(ROOT/"experiments/published/configs/run_04.json") + for change in ({"d_model": 0}, {"seq_len": True}, {"tokenization": "unknown"}): + with tempfile.TemporaryDirectory(dir=storage) as directory: + path = Path(directory)/"config.json" + path.write_text(json.dumps({**base, **change})) + with self.assertRaises(ValueError): + load_config(path) + + +class StorageTests(unittest.TestCase): + def test_mount_credentials_use_child_environment(self): + storage = Path("D:/cpu1-readme-audit/test-checkpoints") + storage.mkdir(parents=True, exist_ok=True) + with tempfile.TemporaryDirectory(dir=storage) as directory: + with patch.object(hub_storage.sys, "platform", "linux"), patch.object( + hub_storage.shutil, "which", return_value="/usr/bin/hf-mount"), patch.object( + hub_storage.subprocess, "run", return_value=subprocess.CompletedProcess([], 0)) as run, patch.dict( + hub_storage.os.environ, {"HF_TOKEN": "parent-placeholder"}), contextlib.redirect_stdout(io.StringIO()): + hub_storage.mount_repo("datasets/Cukinator/cpu1-ablation-dataset", directory, + token="child-placeholder") + args, kwargs = run.call_args + self.assertEqual(args[0][1:4], ["start", "repo", "datasets/Cukinator/cpu1-ablation-dataset"]) + self.assertNotIn("child-placeholder", args[0]) + self.assertEqual(kwargs["env"]["HF_TOKEN"], "child-placeholder") + self.assertEqual(hub_storage.os.environ["HF_TOKEN"], "parent-placeholder") + + def test_mount_error_does_not_repeat_process_output(self): + with patch.object(hub_storage.sys, "platform", "linux"), patch.object( + hub_storage.shutil, "which", return_value="/usr/bin/hf-mount"), patch.object( + hub_storage.subprocess, "run", return_value=subprocess.CompletedProcess([], 3, stderr="private-placeholder")): + with self.assertRaisesRegex(RuntimeError, "exit code 3") as exc: + hub_storage.mount_repo("datasets/example/data", "D:/cpu1-readme-audit/test-checkpoints") + self.assertNotIn("private-placeholder", str(exc.exception)) + + +class RecipeTests(unittest.TestCase): + def test_historical_dataset_recipes_are_plans_until_execute(self): + for platform, chunk in (("kaggle", 500), ("lightning", 3000)): + with patch.object(sys, "argv", ["recipe", "dataset"]), patch.object( + common.subprocess, "run") as run, contextlib.redirect_stdout(io.StringIO()) as output: + common.main(platform) + plan = json.loads(output.getvalue()) + self.assertEqual((plan["n_docs"], plan["chunk_size"]), (850000, chunk)) + run.assert_not_called() + + def test_amd_recipe_passes_config_as_separate_argument(self): + with patch.object(sys, "argv", ["recipe", "ablation", "--run", "run_04_v3", + "--backend", "amd", "--config", "experiments/published/configs/run_04_v3.json"]), patch.object( + common.subprocess, "run") as run, contextlib.redirect_stdout(io.StringIO()) as output: + common.main("lightning") + command = json.loads(output.getvalue())["command"] + self.assertIn("training.ablation_amd", command) + self.assertEqual(command[command.index("--config")+1], + str((ROOT/"experiments/published/configs/run_04_v3.json").resolve())) + run.assert_not_called() + + +if __name__ == "__main__": + unittest.main() diff --git a/evaluation/source/training/ablation.py b/evaluation/source/training/ablation.py index fb25285cd9aad058248844802cf5bff9e12e01bd..e886c7da1bd512904e62c4b466fed2f8aec0c28d 100644 --- a/evaluation/source/training/ablation.py +++ b/evaluation/source/training/ablation.py @@ -1216,9 +1216,11 @@ def train_run(run_name: str, dry_run: bool = False, phase: int = 1, phase1_ckpt: str | None = None, use_hf_mount: bool = False, - resume_ckpt: str | None = None) -> dict: + resume_ckpt: str | None = None, + config_path: str | Path | None = None) -> dict: """Train one ablation run end-to-end. Returns final validation metrics.""" - config = get_run_config(run_name) + from training.configuration import load_config + config = load_config(config_path) if config_path is not None else get_run_config(run_name) config['_current_phase'] = phase if total_steps_override is not None: @@ -1370,8 +1372,8 @@ def train_run(run_name: str, dry_run: bool = False, mount_path = None if use_hf_mount and not dry_run: try: - from hf_mount import mount_bucket - mount_path = mount_bucket(config['dataset_repo']) + from cpu1.hub_storage import mount_repo + mount_path = mount_repo('datasets/' + config['dataset_repo']) except Exception as e: print(f"[hf-mount] Mount failed, falling back to download: {e}") @@ -1720,7 +1722,7 @@ def train_run(run_name: str, dry_run: bool = False, print(f"\n[Done] Metrics saved to {metrics_path}") if mount_path is not None: - from hf_mount import unmount + from cpu1.hub_storage import unmount unmount(mount_path) return val_metrics @@ -2307,13 +2309,14 @@ def parse_args() -> argparse.Namespace: # Single-run mode p.add_argument('--run', default=None, - choices=list(ALL_RUN_CONFIGS.keys()), - help="Train this single run (single-process mode).") + help="Preset name, or experiment name when using --config.") + p.add_argument('--config', type=Path, default=None, + help="Use this recorded JSON configuration without merging current presets.") p.add_argument('--dry_run', action='store_true', help="Use random data on CPU (smoke test)") p.add_argument('--total_steps', type=int, default=None, help="Override total training steps") - p.add_argument('--phase', type=int, default=1, choices=[1, 2], + p.add_argument('--phase', type=int, default=None, choices=[1, 2], help="Training phase (1=distillation, 2=delete gate)") p.add_argument('--phase1_ckpt', type=str, default=None, help="Path to Phase 1 checkpoint (required for --phase 2)") @@ -2338,7 +2341,24 @@ def parse_args() -> argparse.Namespace: help="Cap concurrent runs (default: # GPUs)") p.add_argument('--log-dir', type=str, default='run_logs') - return p.parse_args() + args = p.parse_args() + if args.config is not None: + from training.configuration import load_config + import re + if args.orchestrate or args.run is None: + p.error("--config requires a single --run") + if not re.fullmatch(r"[A-Za-z0-9_]+", args.run): + p.error("Invalid experiment run name") + config = load_config(args.config) + if args.phase is None: + args.phase = int(config.get("_current_phase", 1)) + if args.phase not in (1, 2): + p.error("Invalid recorded training phase") + elif args.run is not None and args.run not in ALL_RUN_CONFIGS: + p.error("Unknown preset; use --config for a recorded published experiment") + if args.phase is None: + args.phase = 1 + return args if __name__ == "__main__": @@ -2389,7 +2409,7 @@ if __name__ == "__main__": # single CLI invocation trains the full pipeline. The orchestrator path # already handles this for multi-GPU; this mirrors the behaviour for # single-GPU resumable training. - is_two_phase = args.run in TWO_PHASE_RUNS and not args.dry_run + is_two_phase = args.config is None and args.run in TWO_PHASE_RUNS and not args.dry_run explicit_phase = args.phase == 2 or args.phase1_ckpt is not None if args.phase == 2 and not args.phase1_ckpt: @@ -2437,7 +2457,7 @@ if __name__ == "__main__": total_steps_override=args.total_steps, phase=1, phase1_ckpt=None, use_hf_mount=args.hf_mount, - resume_ckpt=args.resume_ckpt) + resume_ckpt=args.resume_ckpt, config_path=args.config) else: print(f"[Auto-chain] Phase 1 already done; " f"jumping to Phase 2 (phase2_step ckpts: {len(phase2_steps)}).") @@ -2448,13 +2468,13 @@ if __name__ == "__main__": phase=2, phase1_ckpt=str(final_path), use_hf_mount=args.hf_mount, - resume_ckpt=None) + resume_ckpt=None, config_path=args.config) else: metrics = train_run(args.run, dry_run=args.dry_run, total_steps_override=args.total_steps, phase=args.phase, phase1_ckpt=args.phase1_ckpt, use_hf_mount=args.hf_mount, - resume_ckpt=args.resume_ckpt) + resume_ckpt=args.resume_ckpt, config_path=args.config) print(f"\nFinished: {args.run}") print(json.dumps(metrics, indent=2)) diff --git a/evaluation/source/training/ablation_amd.py b/evaluation/source/training/ablation_amd.py index dd3fce32b611cbf17df50ee0c7879c71950edd3d..3a1eaf8cc5a9c89a2182c46fcc878005f928c2b3 100644 --- a/evaluation/source/training/ablation_amd.py +++ b/evaluation/source/training/ablation_amd.py @@ -1254,9 +1254,11 @@ def train_run(run_name: str, dry_run: bool = False, phase: int = 1, phase1_ckpt: str | None = None, use_hf_mount: bool = False, - resume_ckpt: str | None = None) -> dict: + resume_ckpt: str | None = None, + config_path: str | Path | None = None) -> dict: """Train one ablation run end-to-end. Returns final validation metrics.""" - config = get_run_config(run_name) + from training.configuration import load_config + config = load_config(config_path) if config_path is not None else get_run_config(run_name) config['_current_phase'] = phase if total_steps_override is not None: @@ -1415,8 +1417,8 @@ def train_run(run_name: str, dry_run: bool = False, mount_path = None if use_hf_mount and not dry_run: try: - from hf_mount import mount_bucket - mount_path = mount_bucket(config['dataset_repo']) + from cpu1.hub_storage import mount_repo + mount_path = mount_repo('datasets/' + config['dataset_repo']) except Exception as e: print(f"[hf-mount] Mount failed, falling back to download: {e}") @@ -1810,7 +1812,7 @@ def train_run(run_name: str, dry_run: bool = False, print(f"\n[Done] Metrics saved to {metrics_path}") if mount_path is not None: - from hf_mount import unmount + from cpu1.hub_storage import unmount unmount(mount_path) return val_metrics @@ -2414,13 +2416,14 @@ def parse_args() -> argparse.Namespace: # Single-run mode p.add_argument('--run', default=None, - choices=list(ALL_RUN_CONFIGS.keys()), - help="Train this single run (single-process mode).") + help="Preset name, or experiment name when using --config.") + p.add_argument('--config', type=Path, default=None, + help="Use this recorded JSON configuration without merging current presets.") p.add_argument('--dry_run', action='store_true', help="Use random data on CPU (smoke test)") p.add_argument('--total_steps', type=int, default=None, help="Override total training steps") - p.add_argument('--phase', type=int, default=1, choices=[1, 2], + p.add_argument('--phase', type=int, default=None, choices=[1, 2], help="Training phase (1=distillation, 2=delete gate)") p.add_argument('--phase1_ckpt', type=str, default=None, help="Path to Phase 1 checkpoint (required for --phase 2)") @@ -2445,7 +2448,24 @@ def parse_args() -> argparse.Namespace: help="Cap concurrent runs (default: # GPUs)") p.add_argument('--log-dir', type=str, default='run_logs') - return p.parse_args() + args = p.parse_args() + if args.config is not None: + from training.configuration import load_config + import re + if args.orchestrate or args.run is None: + p.error("--config requires a single --run") + if not re.fullmatch(r"[A-Za-z0-9_]+", args.run): + p.error("Invalid experiment run name") + config = load_config(args.config) + if args.phase is None: + args.phase = int(config.get("_current_phase", 1)) + if args.phase not in (1, 2): + p.error("Invalid recorded training phase") + elif args.run is not None and args.run not in ALL_RUN_CONFIGS: + p.error("Unknown preset; use --config for a recorded published experiment") + if args.phase is None: + args.phase = 1 + return args if __name__ == "__main__": @@ -2496,7 +2516,7 @@ if __name__ == "__main__": # single CLI invocation trains the full pipeline. The orchestrator path # already handles this for multi-GPU; this mirrors the behaviour for # single-GPU resumable training. - is_two_phase = args.run in TWO_PHASE_RUNS and not args.dry_run + is_two_phase = args.config is None and args.run in TWO_PHASE_RUNS and not args.dry_run explicit_phase = args.phase == 2 or args.phase1_ckpt is not None if args.phase == 2 and not args.phase1_ckpt: @@ -2544,7 +2564,7 @@ if __name__ == "__main__": total_steps_override=args.total_steps, phase=1, phase1_ckpt=None, use_hf_mount=args.hf_mount, - resume_ckpt=args.resume_ckpt) + resume_ckpt=args.resume_ckpt, config_path=args.config) else: print(f"[Auto-chain] Phase 1 already done; " f"jumping to Phase 2 (phase2_step ckpts: {len(phase2_steps)}).") @@ -2555,13 +2575,13 @@ if __name__ == "__main__": phase=2, phase1_ckpt=str(final_path), use_hf_mount=args.hf_mount, - resume_ckpt=None) + resume_ckpt=None, config_path=args.config) else: metrics = train_run(args.run, dry_run=args.dry_run, total_steps_override=args.total_steps, phase=args.phase, phase1_ckpt=args.phase1_ckpt, use_hf_mount=args.hf_mount, - resume_ckpt=args.resume_ckpt) + resume_ckpt=args.resume_ckpt, config_path=args.config) print(f"\nFinished: {args.run}") print(json.dumps(metrics, indent=2)) diff --git a/evaluation/source/training/configuration.py b/evaluation/source/training/configuration.py new file mode 100644 index 0000000000000000000000000000000000000000..f2e6992d2101543973ca065fbd23b779bbd6f5da --- /dev/null +++ b/evaluation/source/training/configuration.py @@ -0,0 +1,23 @@ +"""Read explicit experiment configuration records without merging modern presets.""" +import json +from pathlib import Path + + +def load_config(path: str | Path) -> dict: + config = json.loads(Path(path).read_text(encoding="utf-8")) + if not isinstance(config, dict): + raise ValueError("Experiment configuration must be a JSON object") + required = ("d_model", "n_layers", "d_ff", "patch_size", "seq_len", "seed", + "batch_per_gpu", "gradient_accumulation_steps", "total_steps", + "tokenization", "quantization", "token_mixer", "training_signal", + "dataset_repo", "description") + missing = [key for key in required if key not in config] + if missing: + raise ValueError(f"Incomplete experiment configuration: {missing}") + for key in ("d_model", "n_layers", "d_ff", "patch_size", "seq_len", + "batch_per_gpu", "gradient_accumulation_steps", "total_steps"): + if not isinstance(config[key], int) or isinstance(config[key], bool) or config[key] <= 0: + raise ValueError(f"{key} must be a positive integer") + if config["tokenization"] not in ("byte", "byte_dynamic", "bpe"): + raise ValueError("Unsupported tokenization") + return config