Description
Return grouped-query head replication and mapping.
Multihead attention partitions representation coordinates among heads. Grouped-query layouts share key/value heads among query heads, so embedding divisibility and the number of queries per key/value group are separate constraints. A head-index map or dimension check describes supplied layout arithmetic rather than allocating tensors or running a model.
Return grouped-query head replication and mapping.
When to use this tool
Use Grouped Query Head Replication Factor when checking the stated attention coordinate, visibility, angle or head-layout convention.
How to use the tool and how it works
- Enter queryHeads, keyValueHeads. Use the units and conventions below.
- Run the tool. Correct any format, range, or cross-field input error before interpreting the output.
- Read queriesPerKv, mapping. Use the output convention below.
Return grouped-query head replication and mapping. Require whole queryHeads 1..256 and keyValueHeads 1..queryHeads dividing queryHeads; queriesPerKv = query/KV, mapping groups consecutive query-head indexes by that factor.1
Grouped-query attention shares key/value heads among query heads. The contiguous index mapping here is an explicit local layout convention, not a claim about every implementation.2
| Input field | Meaning and units | Accepted input |
|---|---|---|
| queryHeads | Query Heads | Required. Safe integer; minimum 1; maximum 256. |
| keyValueHeads | Key Value Heads | Required. Safe integer; minimum 1. |
| Output field | Interpretation | Returned shape |
|---|---|---|
| queriesPerKv | Queries Per Kv | Required. Safe integer. |
| mapping | Zero-based KV-head assignment for contiguous equal-sized query-head groups; not a universal tensor layout. | Required. Array of safe integer; maximum items 256. |
{
"input": {
"queryHeads": 8,
"keyValueHeads": 2
},
"output": {
"queriesPerKv": 4,
"mapping": [
0,
0,
0,
0,
1,
1,
1,
1
]
}
} Limitations and assumptions
- This is a contiguous grouping convention, not a universal tensor layout or an actual attention operation.
- 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
Similar or alternative tools
- Artificial Intelligence: Attention Head Dimension Check
Check equal attention-head partitioning.
- Attention Head Masked Share Tool
Calculate attention head masked share from explicit caller-supplied inputs.