| ggml_gated_linear_attn | R Documentation |
Linear attention with a per-token gate (the GLA / RetNet family). Shares the
RWKV recurrence machinery: keys, values and queries drive a running state
that g gates, and scale multiplies the query.
ggml_gated_linear_attn(ctx, k, v, q, g, state, scale)
ctx |
GGML context |
k |
Keys, |
v |
Values, |
q |
Queries, |
g |
Gate, |
state |
Initial state, |
scale |
Scalar applied to the queries (usually |
A tensor [S * H, n_tokens + S * n_seqs]
k, v, q and g are [S, H, n_tokens];
state holds S * S * H * n_seqs elements. The result is
[S * H, n_tokens + S * n_seqs], outputs then final state – see
ggml_rwkv_output.
n_tokens counts the tokens of all sequences together, so it
must be a multiple of n_seqs.
CPU only. Unlike the RWKV and SSM ops, GGML_OP_GATED_LINEAR_ATTN has
no Vulkan shader, so a graph containing it falls back to the CPU for this
node. It has no backward pass either, so it is inference-only.
ggml_rwkv_wkv7, ggml_rwkv_output
Other state-space:
ggml_gated_linear_attn_back(),
ggml_rwkv_output(),
ggml_rwkv_wkv6(),
ggml_rwkv_wkv6_back(),
ggml_rwkv_wkv7(),
ggml_rwkv_wkv7_back(),
ggml_ssm_conv(),
ggml_ssm_conv_back(),
ggml_ssm_scan(),
ggml_ssm_scan_back(),
ggml_ssm_scan_output()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.