| ggml_rwkv_wkv6 | R Documentation |
The weighted key-value recurrence of RWKV-6: a linear-attention-style scan
whose decay is per-token (td) on top of a per-channel bonus
(tf). Runs in O(n_tokens) rather than the O(n_tokens^2) of ordinary
attention, which is what makes RWKV a recurrent model at inference time.
ggml_rwkv_wkv6(ctx, k, v, r, tf, td, state)
ctx |
GGML context |
k |
Keys, |
v |
Values, |
r |
Receptance, |
tf |
Per-channel decay bonus, |
td |
Per-token decay, |
state |
Initial state, |
A tensor [S * H, n_tokens + S * n_seqs]
With head size S, H heads, n_tokens tokens and
n_seqs sequences: k, v, r and td are
[S, H, n_tokens], tf is [S, H], and state holds
S * S * H * n_seqs elements (typically [S * S * H, n_seqs]).
All must be contiguous.
n_tokens counts the tokens of all sequences together, so it
must be a multiple of n_seqs: the kernel derives the per-sequence
length as n_tokens / n_seqs and restarts the state at each boundary.
The result is [S * H, n_tokens + S * n_seqs]: the per-token outputs
occupy the first n_tokens columns and the final state the remaining
S * n_seqs. ggml_rwkv_output and
ggml_rwkv_state view either half.
GGML_OP_RWKV_WKV6 has no backward pass in ggml.
ggml_rwkv_wkv7, ggml_rwkv_output
Other state-space:
ggml_gated_linear_attn(),
ggml_gated_linear_attn_back(),
ggml_rwkv_output(),
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.