{
  "schema_version": 1,
  "run_date": "2026-10-24",
  "torch_version": "2.14.1+cu130",
  "verification_device": "cpu",
  "verification_dtype": "float32",
  "verification_seed": 7,
  "cpu_threads": 1,
  "notes": [
    "Original scripts are copied unchanged. single_attention.py selects CUDA if available; other originals use CPU.",
    "Additional verification functions use CPU. All attention maps except explicitly trained examples are untrained.",
    "Encoder uses Post-LN/ReLU/learned absolute positions. TinyDecoder uses Pre-LN/GELU/learned absolute positions.",
    "The teacher-forcing experiment performs one optimizer step, not a successfully trained language model.",
    "An all-masked row produces NaN with these educational implementations; no all-PAD input is claimed supported.",
    "Weight row sums are checked with dropout disabled. Post-dropout attention weights need not sum to one."
  ],
  "source_sha256": {
    "single_attention.py": "781e570d7d5576c52b716b9adf097e18e76d9673095ba90f5b9b3deb0983d8e8",
    "multi_head_attention.py": "e26b4f7cd3fb10a132f1510ccf6c86c2eda498a8f2267b34a77d72ad02d43f3a",
    "positional_encoding_experiment.py": "f8d87c8fe7d49a836e1bcaf41e46195ff21c79f7ba16e9bee21cbb355041375f",
    "transformer_encoder.py": "332bfe7c0b90288bf11222b645ee55a2c4268639c6f1048d92c2dae23863b6e8",
    "cross_attention.py": "b4e26b44fb34b64479af3cf25b8cc9d5fe50bf33653fed454a27106916e53486",
    "teacher_forcing_loss.py": "91804aa1068011998f6a95408c321b47bb660d6995762df29b4930e5c82d851e",
    "decoder_kv_cache.py": "2eb9f29f9ffde4814900497aef24354c6e6301b9e7975a4653492fbf1f4fac8c",
    "train_attention.py": "7ae1d7e0e0ae86b9ac1260d4ad578643ca58a89520d80c963c113be6288dc800",
    "attention_ablation.py": "47f4d9ee7dbf72b2d1a683c028e7c2d27c9dc57bbbd446b1f2ce7f0a6889f4ec"
  },
  "original_script_runs": {
    "single_attention.py": {
      "completed": true,
      "device": "cuda"
    },
    "multi_head_attention.py": {
      "completed": true
    },
    "positional_encoding_experiment.py": {
      "completed": true
    },
    "transformer_encoder.py": {
      "completed": true
    },
    "cross_attention.py": {
      "completed": true
    },
    "teacher_forcing_loss.py": {
      "completed": true
    },
    "decoder_kv_cache.py": {
      "completed": true
    },
    "train_attention.py": {
      "completed": true,
      "initial_loss": 0.6854668259620667,
      "final_loss": 0.0,
      "predictions": [
        [
          1,
          0,
          1,
          0,
          1
        ],
        [
          0,
          1,
          0,
          1,
          0
        ]
      ],
      "targets": [
        [
          1,
          0,
          1,
          0,
          1
        ],
        [
          0,
          1,
          0,
          1,
          0
        ]
      ],
      "q_weight_max_change": 0.1798643320798874,
      "head_0_weights_before": [
        [
          1.0,
          0.0,
          0.0,
          0.0,
          0.0
        ],
        [
          0.48957496881484985,
          0.5104250311851501,
          0.0,
          0.0,
          0.0
        ],
        [
          0.3084551990032196,
          0.38246074318885803,
          0.3090840280056,
          0.0,
          0.0
        ],
        [
          0.24724194407463074,
          0.255414217710495,
          0.24397911131381989,
          0.2533647418022156,
          0.0
        ],
        [
          0.18294765055179596,
          0.22544556856155396,
          0.18333689868450165,
          0.22350357472896576,
          0.1847662627696991
        ]
      ],
      "head_0_weights_after": [
        [
          1.0,
          0.0,
          0.0,
          0.0,
          0.0
        ],
        [
          1.0603768885175668e-07,
          0.9999998807907104,
          0.0,
          0.0,
          0.0
        ],
        [
          0.4551413655281067,
          1.7889739467591426e-07,
          0.5448583960533142,
          0.0,
          0.0
        ],
        [
          7.82672273658136e-08,
          0.5274312496185303,
          8.106721338663192e-08,
          0.4725686013698578,
          0.0
        ],
        [
          0.29245176911354065,
          7.196771889539377e-08,
          0.3526836335659027,
          7.644240440640715e-08,
          0.3548644781112671
        ]
      ],
      "first_step_projection_gradient_norms": {
        "Q": 0.0593109056353569,
        "K": 0.07417615503072739,
        "V": 0.13933216035366058
      }
    },
    "attention_ablation.py": {
      "completed": true,
      "reported_results": {
        "Without Attention": {
          "test_loss_rounded": 0.6733,
          "accuracy_by_position": [
            1.0,
            0.49853515625,
            0.497314453125,
            0.49609375,
            0.504150390625
          ]
        },
        "With Attention": {
          "test_loss_rounded": 0.0,
          "accuracy_by_position": [
            1.0,
            1.0,
            1.0,
            1.0,
            1.0
          ]
        }
      }
    }
  },
  "additional_checks": {
    "attention": {
      "q": [
        [
          1.0,
          0.0
        ],
        [
          0.0,
          1.0
        ],
        [
          1.0,
          1.0
        ]
      ],
      "k": [
        [
          1.0,
          0.0
        ],
        [
          0.0,
          1.0
        ],
        [
          1.0,
          1.0
        ]
      ],
      "v": [
        [
          1.0,
          10.0
        ],
        [
          2.0,
          20.0
        ],
        [
          4.0,
          40.0
        ]
      ],
      "scores": [
        [
          0.7071067690849304,
          0.0,
          0.7071067690849304
        ],
        [
          0.0,
          0.7071067690849304,
          0.7071067690849304
        ],
        [
          0.7071067690849304,
          0.7071067690849304,
          1.4142135381698608
        ]
      ],
      "weights": [
        [
          0.40111207962036133,
          0.19777581095695496,
          0.40111207962036133
        ],
        [
          0.19777581095695496,
          0.40111207962036133,
          0.40111207962036133
        ],
        [
          0.24825508892536163,
          0.24825508892536163,
          0.5034898519515991
        ]
      ],
      "output": [
        [
          2.4011120796203613,
          24.011119842529297
        ],
        [
          2.6044483184814453,
          26.044483184814453
        ],
        [
          2.7587246894836426,
          27.587247848510742
        ]
      ],
      "row_sums": [
        1.0,
        1.0,
        1.0
      ],
      "v_plus_one_output_max_change": 1.0
    },
    "multihead": {
      "input_shape": [
        1,
        3,
        4
      ],
      "weights_shape": [
        1,
        2,
        3,
        3
      ],
      "output_shape": [
        1,
        3,
        4
      ],
      "head_0_full": [
        [
          0.3314804136753082,
          0.33265256881713867,
          0.3358669877052307
        ],
        [
          0.31016960740089417,
          0.354436457157135,
          0.33539390563964844
        ],
        [
          0.2632974684238434,
          0.39790982007980347,
          0.3387927711009979
        ]
      ],
      "head_1_full": [
        [
          0.30859827995300293,
          0.3516518473625183,
          0.33974984288215637
        ],
        [
          0.2952811121940613,
          0.3627937138080597,
          0.34192511439323425
        ],
        [
          0.28075623512268066,
          0.36859002709388733,
          0.35065367817878723
        ]
      ],
      "head_0_causal": [
        [
          1.0,
          0.0,
          0.0
        ],
        [
          0.46669694781303406,
          0.5333030819892883,
          0.0
        ],
        [
          0.2632974684238434,
          0.39790982007980347,
          0.3387927711009979
        ]
      ],
      "head_1_causal": [
        [
          1.0,
          0.0,
          0.0
        ],
        [
          0.44870448112487793,
          0.5512955784797668,
          0.0
        ],
        [
          0.28075623512268066,
          0.36859002709388733,
          0.35065367817878723
        ]
      ],
      "last_query_causal_full_max_difference": 0.0,
      "untrained_head_max_difference": 0.029319792985916138,
      "causal_first_output": [
        0.3573276400566101,
        0.20534062385559082,
        -0.010263025760650635,
        -0.1837303191423416
      ]
    },
    "positions": {
      "positional_encoding": [
        [
          0.0,
          1.0,
          0.0,
          1.0
        ],
        [
          0.8414709568023682,
          0.5403023362159729,
          0.009999833069741726,
          0.9999499917030334
        ],
        [
          0.9092974066734314,
          -0.416146844625473,
          0.019998665899038315,
          0.9998000264167786
        ]
      ],
      "weights_without_position": [
        [
          0.3333333432674408,
          0.3333333432674408,
          0.3333333432674408
        ],
        [
          0.3333333432674408,
          0.3333333432674408,
          0.3333333432674408
        ],
        [
          0.3333333432674408,
          0.3333333432674408,
          0.3333333432674408
        ]
      ],
      "weights_with_position": [
        [
          0.3333090841770172,
          0.4054233431816101,
          0.2612675130367279
        ],
        [
          0.22134816646575928,
          0.42638641595840454,
          0.3522654175758362
        ],
        [
          0.14923939108848572,
          0.3685537874698639,
          0.482206791639328
        ]
      ],
      "weights_max_change": 0.18409395217895508,
      "identity_qkv_projections": true
    },
    "encoder": {
      "token_ids": [
        [
          11,
          25,
          70,
          0,
          0
        ],
        [
          9,
          3,
          2,
          4,
          1
        ]
      ],
      "padding_mask": [
        [
          false,
          false,
          false,
          true,
          true
        ],
        [
          false,
          false,
          false,
          false,
          false
        ]
      ],
      "output_shape": [
        2,
        5,
        16
      ],
      "hidden_states_count": 7,
      "blocks_count": 6,
      "first_query_unmasked": [
        0.14314934611320496,
        0.18969827890396118,
        0.2472987174987793,
        0.20904605090618134,
        0.210807666182518
      ],
      "first_query_masked": [
        0.2467469573020935,
        0.3269835114479065,
        0.4262695610523224,
        0.0,
        0.0
      ],
      "first_head_masked": [
        [
          0.2467469573020935,
          0.3269835114479065,
          0.4262695610523224,
          0.0,
          0.0
        ],
        [
          0.7860537171363831,
          0.09452193975448608,
          0.11942435055971146,
          0.0,
          0.0
        ],
        [
          0.09122319519519806,
          0.4653812646865845,
          0.4433955252170563,
          0.0,
          0.0
        ],
        [
          0.3036438822746277,
          0.304544061422348,
          0.3918120861053467,
          0.0,
          0.0
        ],
        [
          0.30119550228118896,
          0.3038405776023865,
          0.39496392011642456,
          0.0,
          0.0
        ]
      ],
      "per_layer_pad_key_max_weight": [
        0.0,
        0.0,
        0.0,
        0.0,
        0.0,
        0.0
      ],
      "pad_query_output_max_absolute_value": 1.8988972902297974,
      "output_finite_for_mixed_valid_and_pad": true,
      "all_pad_produces_nan_in_this_implementation": true,
      "tracked_position": 2,
      "tracked_token_id": 70,
      "untrained_hidden_states": [
        {
          "block": 0,
          "first_four_features": [
            -0.925269365310669,
            2.5838236808776855,
            -0.28383901715278625,
            0.09097591042518616
          ],
          "distance_from_input": 0.0,
          "cosine_to_input": 1.0
        },
        {
          "block": 1,
          "first_four_features": [
            -0.9471696615219116,
            2.0966858863830566,
            0.0628737062215805,
            0.030115991830825806
          ],
          "distance_from_input": 1.194916009902954,
          "cosine_to_input": 0.9741931557655334
        },
        {
          "block": 2,
          "first_four_features": [
            -1.2892853021621704,
            1.8386051654815674,
            0.030833469703793526,
            0.06449507176876068
          ],
          "distance_from_input": 1.5985110998153687,
          "cosine_to_input": 0.9440773129463196
        },
        {
          "block": 3,
          "first_four_features": [
            -1.096848964691162,
            2.0473170280456543,
            0.09690865874290466,
            0.2595599293708801
          ],
          "distance_from_input": 2.0421926975250244,
          "cosine_to_input": 0.900928258895874
        },
        {
          "block": 4,
          "first_four_features": [
            -0.5925323367118835,
            1.8913390636444092,
            0.022749871015548706,
            0.35416606068611145
          ],
          "distance_from_input": 2.4321813583374023,
          "cosine_to_input": 0.854316234588623
        },
        {
          "block": 5,
          "first_four_features": [
            -0.20787940919399261,
            1.9180610179901123,
            0.30081501603126526,
            0.09297166019678116
          ],
          "distance_from_input": 2.755208730697632,
          "cosine_to_input": 0.8095549941062927
        },
        {
          "block": 6,
          "first_four_features": [
            -0.330964595079422,
            0.9763333797454834,
            -0.28984153270721436,
            0.20480374991893768
          ],
          "distance_from_input": 3.8345565795898438,
          "cosine_to_input": 0.6195586919784546
        }
      ]
    },
    "cross_attention": {
      "encoder_shape": [
        2,
        5,
        16
      ],
      "decoder_shape": [
        2,
        3,
        16
      ],
      "weights_shape": [
        2,
        4,
        3,
        5
      ],
      "output_shape": [
        2,
        3,
        16
      ],
      "first_head_weights": [
        [
          0.26223140954971313,
          0.11479955911636353,
          0.11862515658140182,
          0.36914610862731934,
          0.13519781827926636
        ],
        [
          0.17772628366947174,
          0.28111132979393005,
          0.1982612907886505,
          0.15680652856826782,
          0.18609458208084106
        ],
        [
          0.28614214062690735,
          0.10048775374889374,
          0.11789587140083313,
          0.35804054141044617,
          0.13743366301059723
        ]
      ]
    },
    "teacher_forcing": {
      "model": "TinyDecoder: decoder-only, Pre-LN, GELU, no Cross-Attention",
      "decoder_input": [
        [
          1,
          2,
          3,
          4
        ],
        [
          1,
          3,
          2,
          4
        ]
      ],
      "targets": [
        [
          2,
          3,
          4,
          5
        ],
        [
          3,
          2,
          4,
          5
        ]
      ],
      "logits_shape": [
        2,
        4,
        6
      ],
      "loss_before_step": 2.0719728469848633,
      "lm_head_gradient_norm": 1.578478217124939,
      "lm_head_weight_max_change": 0.0010000020265579224,
      "loss_after_one_step": 2.0108301639556885,
      "all_parameter_gradients_present_and_finite": true,
      "parameter_tensors_changed": 38,
      "parameter_tensors_total": 38,
      "future_token_check": {
        "changed_input_position": 3,
        "earlier_logits_max_change": 0.0,
        "final_position_logits_max_change": 1.5270764827728271
      }
    }
  }
}
