Skip to content

Main content

Random Attention Matrix Test Case Generator

Generate compatible bounded quantized query/key/value matrices, delegate dimensions, dot products, stable softmax weights, and the existing 12-significant-digit scaled-dot-product attention output; this is single-head unmasked attention, not training, a Transformer benchmark, or an accuracy claim.

Loading tool…

Description

Generate compatible bounded quantized query/key/value matrices, delegate dimensions, dot products, stable softmax weights, and the existing 12-significant-digit scaled-dot-product attention output; this is single-head unmasked attention, not training, a Transformer benchmark, or an accuracy claim.

A matrix construction produces numeric arrays with a target algebraic property. Floating-point residuals check how closely a computed result satisfies that property, while conditioning determines how sensitive it is to numerical error.

Generate compatible bounded quantized query/key/value matrices, delegate dimensions, dot products, stable softmax weights, and the existing 12-significant-digit scaled-dot-product attention output; this is single-head unmasked attention, not training, a Transformer benchmark, or an accuracy claim.

When to use this tool

Use this generator to create reproducible attention matrix test case cases from the supplied model or bank. Inspect the returned evidence before using cases in a test or exercise.

How to use the tool and how it works

  1. Supply minimumValue, maximumValue, valueDivisor, queryCount, keyCount, keyWidth, valueWidth in the field shapes below. Set seed when you need an explicit replay.
  2. Run the tool and correct any input error. For generated controls, distinguish a successful fixture containing an invalid case from failure to generate the fixture.
  3. Read queries, keys, values, weights, attendedValues, dimensions. Use the conventions below. Keep answer-bearing fields separate when presenting an exercise.

Draw shape-compatible query, key, and value matrices. Compute each score as a delegated dot product divided by the square root of keyWidth, apply softmax, and delegate scaled dot-product attention. Return weights, attended values, and matrix dimensions.1

Delegated operations used for this result: scaled dot product attention; dimensions. Their calculation or parsing conventions apply to the corresponding result fields.2, 3

Input fieldMeaning and unitsAccepted input
minimumValueMinimum ValueRequired. Safe integer.
maximumValueMaximum ValueRequired. Safe integer.
valueDivisorValue DivisorRequired. Finite number; strictly above 0.
queryCountQuery CountRequired. Safe integer; minimum 1; maximum 32.
keyCountKey CountRequired. Safe integer; minimum 1; maximum 32.
keyWidthKey WidthRequired. Safe integer; minimum 1; maximum 16.
valueWidthValue WidthRequired. Safe integer; minimum 1; maximum 16.
seedOptional numeric seed; takes precedence over context randomness. Without either, use the fixed tool.io default seed.Optional. Safe integer.
Output fieldInterpretationReturned shape
queriesQueriesRequired. Array of Array of Finite number.; minimum items 1; maximum items 16.; minimum items 1; maximum items 32.
keysKeysRequired. Array of Array of Finite number.; minimum items 1; maximum items 16.; minimum items 1; maximum items 32.
valuesValuesRequired. Array of Array of Finite number.; minimum items 1; maximum items 16.; minimum items 1; maximum items 32.
weightsWeightsRequired. Array of Array of Finite number; minimum 0; maximum 1.; minimum items 1; maximum items 32.; minimum items 1; maximum items 32.
attendedValuesAttended ValuesRequired. Array of Array of Finite number.; minimum items 1; maximum items 16.; minimum items 1; maximum items 32.
dimensionsDimensionsRequired. Object; no unknown keys.
dimensions.queriesQueriesRequired. Object; no unknown keys.
dimensions.queries.rowsRowsRequired. Safe integer; minimum 1; maximum 32.
dimensions.queries.columnsColumnsRequired. Safe integer; minimum 1; maximum 16.
dimensions.keysKeysRequired. Object; no unknown keys.
dimensions.keys.rowsRowsRequired. Safe integer; minimum 1; maximum 32.
dimensions.keys.columnsColumnsRequired. Safe integer; minimum 1; maximum 16.
dimensions.valuesValuesRequired. Object; no unknown keys.
dimensions.values.rowsRowsRequired. Safe integer; minimum 1; maximum 32.
dimensions.values.columnsColumnsRequired. Safe integer; minimum 1; maximum 16.
randomnessReplay source and normalized 32-bit seed, or null seed for an advancing context source.Required. Object; no unknown keys.
randomness.seedOptional safe-integer replay seed; normalization and precedence are explained below.Required. Safe integer. or Null.
randomness.sourceSourceRequired. Text; one of "context", "seed".

An explicit safe-integer seed takes precedence over injected context randomness and is normalized to an unsigned 32-bit integer. With no seed and no context source, replay uses the fixed tool.io default seed. A context source must return finite values from zero inclusive to one exclusive; its advancing state must be retained separately. randomness records the source and normalized seed, or null for context. These generators are not cryptographic random sources.

json
{
  "input": {
    "minimumValue": -2,
    "maximumValue": 2,
    "valueDivisor": 1,
    "queryCount": 2,
    "keyCount": 2,
    "keyWidth": 1,
    "valueWidth": 1,
    "seed": 42
  },
  "output": {
    "queries": [
      [
        1
      ],
      [
        0
      ]
    ],
    "keys": [
      [
        2
      ],
      [
        1
      ]
    ],
    "values": [
      [
        -2
      ],
      [
        0
      ]
    ],
    "weights": [
      [
        0.7310585786300049,
        0.2689414213699951
      ],
      [
        0.5,
        0.5
      ]
    ],
    "attendedValues": [
      [
        -1.46211715726
      ],
      [
        -1
      ]
    ],
    "dimensions": {
      "queries": {
        "rows": 2,
        "columns": 1
      },
      "keys": {
        "rows": 2,
        "columns": 1
      },
      "values": {
        "rows": 2,
        "columns": 1
      }
    },
    "randomness": {
      "seed": 42,
      "source": "seed"
    }
  }
}

Limitations and assumptions

  • This is unmasked single-head attention without positional encoding, dropout, training, or a language model. The auxiliary weights inherit delegated rounding and extreme intermediate values can fail even when shapes agree.
  • A replay requires the same complete input and implementation. The stated sampling convention applies within its eligible space. A finite draw does not exhaust all possible outputs; repeats remain possible unless a distinct-selection rule is explicit.
  • The field tables state structural bounds; cross-field constraints and bounded search or output budgets also apply. Unknown keys are rejected where the object contract disallows them. Input errors are distinct from null fields and deliberate invalid controls in a successful output.

Alternative or Complementary methods

For a supplied example, inspect the returned construction or delegated check directly. To evaluate a consumer, also test cases chosen for its own boundaries; a generated finite corpus does not establish exhaustive coverage.

References

  1. Tool behavior and example: Random Attention Matrix Test Case Generator — tool.io

  2. Calculation or validation: machine-learning/scaled-dot-product-attention — tool.io

  3. Calculation or validation: matrix/dimensions — tool.io

Similar or alternative tools

  • General Linear System Solver

    Use bounded partial-pivot Gauss–Jordan elimination to classify a rectangular real linear system and return a particular solution, coefficient nullspace, and reduced augmented matrix under an explicit zero threshold, without a conditioning guarantee.

  • Random Determinant Sign Transformation Quiz Generator

    Draw a supported row swap or scaling and retain its determinant sign rule, inheriting the delegated determinant core's 12-significant-digit rounding.