{
  "scope": "Hand-set one-query Q/K/V and fixed decoder-logit lookup only; no encoder, learned parameters, corpus, training, translation benchmark, or claim of trained output.",
  "environment": {
    "python": "3.10.12",
    "torch": "2.3.1+cu118",
    "device": "cpu",
    "dtype": "torch.float64"
  },
  "attention": {
    "shapes": {
      "queries": [
        1,
        1,
        1
      ],
      "keys": [
        1,
        4,
        1
      ],
      "values": [
        1,
        4,
        2
      ],
      "scores": [
        1,
        1,
        4
      ],
      "weights": [
        1,
        1,
        4
      ],
      "context": [
        1,
        1,
        2
      ]
    },
    "query": [
      1.0
    ],
    "keys_including_pad": [
      1.0,
      0.0,
      1.0,
      2.0
    ],
    "values_including_pad": [
      [
        1.0,
        0.0
      ],
      [
        0.0,
        2.0
      ],
      [
        2.0,
        1.0
      ],
      [
        100.0,
        100.0
      ]
    ],
    "valid_key_count": 3,
    "scores_scaled_dot_product": [
      1.0,
      0.0,
      1.0,
      2.0
    ],
    "weights_after_valid_key_mask": [
      0.422318798252,
      0.155362403497,
      0.422318798252,
      0.0
    ],
    "weight_sum": 1.0,
    "weighted_context": [
      1.266956394755,
      0.733043605245
    ],
    "pad_value_excluded": true,
    "independent_python_scalar_reference": {
      "valid_weights": [
        0.422318798252,
        0.155362403497,
        0.422318798252
      ],
      "context": [
        1.266956394755,
        0.733043605245
      ],
      "max_torch_difference_lt_1e-14": true
    }
  },
  "empty_key_boundary": {
    "valid_len_zero": "rejected",
    "error": "each query must have at least one valid key; empty key sets are rejected",
    "finite_minus_1e6_all_masked_counterexample": [
      0.333333333333,
      0.333333333333,
      0.333333333333
    ],
    "counterexample_note": "D2L's finite sentinel makes every all-masked logit equal; softmax is uniform, not a valid empty-key attention distribution. This prototype explicitly rejects the row."
  },
  "teacher_forcing_vs_autoregressive": {
    "gold_target_including_eos": [
      "ils",
      "regardent",
      "<eos>"
    ],
    "teacher_forcing_input_shift": [
      "<bos>",
      "ils",
      "regardent"
    ],
    "vocabulary_order": [
      "ils",
      "nous",
      "regardent",
      "sommes",
      "<eos>"
    ],
    "fixed_logits_by_previous_token": {
      "<bos>": [
        0.2,
        1.0,
        -1.0,
        -2.0,
        -3.0
      ],
      "ils": [
        -2.0,
        -1.0,
        1.2,
        0.0,
        -3.0
      ],
      "regardent": [
        -3.0,
        -3.0,
        -2.0,
        -2.0,
        1.3
      ],
      "nous": [
        -3.0,
        -2.0,
        -3.0,
        1.1,
        -1.0
      ],
      "sommes": [
        -3.0,
        -3.0,
        -3.0,
        -2.0,
        1.2
      ]
    },
    "teacher_forced_steps": [
      {
        "step": 0,
        "decoder_input_from_gold_prefix": "<bos>",
        "target_label": "ils",
        "argmax_from_fixed_logits": "nous"
      },
      {
        "step": 1,
        "decoder_input_from_gold_prefix": "ils",
        "target_label": "regardent",
        "argmax_from_fixed_logits": "regardent"
      },
      {
        "step": 2,
        "decoder_input_from_gold_prefix": "regardent",
        "target_label": "<eos>",
        "argmax_from_fixed_logits": "<eos>"
      }
    ],
    "autoregressive_steps": [
      {
        "step": 0,
        "decoder_input_from_previous_prediction": "<bos>",
        "argmax_from_fixed_logits": "nous"
      },
      {
        "step": 1,
        "decoder_input_from_previous_prediction": "nous",
        "argmax_from_fixed_logits": "sommes"
      },
      {
        "step": 2,
        "decoder_input_from_previous_prediction": "sommes",
        "argmax_from_fixed_logits": "<eos>"
      }
    ],
    "autoregressive_stopped_on_eos": true,
    "max_steps_guard": 6,
    "note": "Logits are hand-written solely to demonstrate shifted gold-prefix inputs versus previous-prediction inputs. They are not from a trained Seq2Seq model. EOS ends this toy loop; PAD masking of target loss is outside this prototype."
  },
  "checks": "PASS: scaled QK scores, mask excludes PAD key, valid weights sum to one, weighted context matches independent scalar calculation, empty valid-key row rejected, fixed-logit autoregressive loop terminates at EOS."
}
