Skip to content

Main content

Attention Head Masked Share Tool

Calculate attention head masked share from explicit caller-supplied inputs.

Loading tool…

Description

Return masked share for a selected attention head.

Attention masks mark which query-to-key relationships are visible. Implementations can use opposite Boolean polarities, so true need not always mean allowed. A mask share depends on the chosen row or head and its denominator; an empty selection has no defined share rather than proving that attention is absent.

Return masked share for a selected attention head.

When to use this tool

Use Attention Head Masked Share when checking the stated attention coordinate, visibility, angle or head-layout convention.

How to use the tool and how it works

  1. Enter headIndices, masked, selectedHead. Follow any array-alignment requirements below. Use the units and conventions below.
  2. Run the tool. Correct any format, range, or cross-field input error before interpreting the output.
  3. Read headEntries, maskedEntries, maskedShare, defined. Inspect defined before interpreting the associated values.

Return masked share for a selected attention head. Require aligned head-index/flag arrays, nonnegative whole indexes and selectedHead; count selected entries and masked entries, divide or return zero with defined false when absent.1

Input fieldMeaning and unitsAccepted input
headIndicesHead IndicesRequired. Array of safe integer; minimum 0; maximum items 256.
maskedMaskedRequired. Array of boolean; maximum items 256.
selectedHeadSelected HeadRequired. Safe integer; minimum 0.
Output fieldInterpretationReturned shape
headEntriesHead EntriesRequired. Safe integer.
maskedEntriesMasked EntriesRequired. Safe integer.
maskedShareSelected head’s masked entries divided by its entries, or zero placeholder when defined=false.Required. Finite number.
definedWhether the associated denominator or reporting quantity is defined; inspect before interpreting zero placeholders.Required. Boolean.
json
{
  "input": {
    "headIndices": [
      0,
      0,
      1
    ],
    "masked": [
      true,
      false,
      true
    ],
    "selectedHead": 0
  },
  "output": {
    "headEntries": 2,
    "maskedEntries": 1,
    "maskedShare": 0.5,
    "defined": true
  }
}

Limitations and assumptions

  • Repeated entries contribute separately; no actual mask, tensor layout or attention behavior is verified.
  • Inputs must satisfy both the field types and the cross-field conditions above. Invalid input causes an error; a successful false flag or documented placeholder is a different result.
  • Numeric calculations use binary floating point unless exact decimal-integer arithmetic is explicitly stated. No hidden measurement tolerance or decimal rounding is added; nonfinite or out-of-contract results are rejected. Numeric signed-zero results are exported as zero.

Alternative or Complementary methods

Inspect the complete model configuration and implementation for positional schedules, masking, softmax and actual inference behavior.

References

  1. Calculation and input contract: artificial-intelligence/attention-head-masked-share — tool.io

Similar or alternative tools