Bidirectional WKV Kernel (Bi-WKV)
- Bidirectional WKV Kernel (Bi-WKV) is a RWKV-derived operator that fuses forward and backward recurrences to achieve symmetric context aggregation without quadratic self-attention.
- It is implemented through various formulations such as symmetric decay, dual scans with averaging, and gated fusion, each combined with local receptive-field mechanisms.
- Bi-WKV maintains linear time complexity while improving performance in tasks like signal denoising, image restoration, and audio pattern recognition.
Bidirectional WKV Kernel (Bi-WKV) denotes a family of RWKV-derived sequence-mixing operators that extend the original causal WKV kernel so that each position incorporates information from both earlier and later positions. In recent work, the term is used in at least three closely related but non-identical ways: as a symmetric distance-decayed global aggregation in SATEM denoising, as the combination of forward and backward WKV scans in image restoration, and as a gated fusion of two causal RWKV7 streams in audio pattern recognition (Wang et al., 28 Mar 2025, Du et al., 2024, Xiong et al., 2 Sep 2025). The common objective is to recover bidirectional context without reverting to quadratic self-attention.
1. Origins in the RWKV WKV kernel
Bi-WKV is derived from the original unidirectional WKV mechanism in RWKV. In the DREMnet formulation, a sequence is projected, after token shift, into , and the unidirectional output at position is a normalized exponentially decayed sum over the prefix together with a learned current-token reward (Wang et al., 28 Mar 2025): The same paper gives an implementation through running numerators and denominators,
so the operator acts as a normalized exponentially weighted accumulator.
RWKV-IR describes the same underlying idea from the perspective of replacing dot-product attention by two recurrences with exponential decay. There the forward scan maintains
with an analogous backward scan, followed by gating with receptance 0 (Du et al., 2024). AudioRWKV presents a RWKV7 version in which the recurrent state consists of two channel-wise running sums 1 and 2,
3
where 4 is a per-channel decay or forget gate (Xiong et al., 2 Sep 2025).
These formulations differ in parameterization, but they share the same structural principle: WKV computes an attention-like weighted value aggregation through recurrently updated state rather than a full pairwise attention matrix. This suggests that Bi-WKV is best understood as a bidirectionalization of a recurrent normalized weighting operator rather than as a single canonical kernel.
2. Principal bidirectional formulations
The literature does not define a unique Bi-WKV equation. Instead, bidirectionality is introduced by different constructions that all permit future-to-past information flow.
| Work | Bidirectional construction | Merge or control |
|---|---|---|
| DREMnet | Full sum over all 5 with symmetric distance decay 6 | learned 7 |
| RWKV-IR | Forward and backward WKV scans | merge, e.g. average |
| AudioRWKV | Causal WKV on original and reversed sequence | learned gate 8 |
In DREMnet, unidirectional decay is replaced by a symmetric relative-distance decay
9
yielding
0
Here 1 is a learned decay vector and 2 is a learned self-reward; the defining change is the substitution of 3 for the one-sided temporal offset, so each position receives context from both directions (Wang et al., 28 Mar 2025).
RWKV-IR defines “Bi-WKV” as exactly the combination of forward and backward WKV scans. The forward and backward recurrent outputs 4 and 5 are merged, for example by
6
and the result is then gated through 7 (Du et al., 2024). AudioRWKV uses the same directional duplication idea on RWKV7, but replaces fixed averaging by a learned elementwise gate,
8
where 9 is the causal WKV on the original sequence and 0 is the corresponding output on the reversed sequence mapped back to the original indexing (Xiong et al., 2 Sep 2025).
A common misconception is that “Bi-WKV” names a single standardized kernel. The published formulations instead show a design space whose members share bidirectional context aggregation and RWKV-style linear recurrences, but differ in whether bidirectionality is encoded by an explicit symmetric kernel, by scan averaging, or by gated directional fusion.
3. Coupling with local receptive-field mechanisms
Across the cited systems, Bi-WKV is not used in isolation. Each architecture couples global bidirectional aggregation with an explicitly local mechanism intended to preserve short-range structure.
In DREMnet, locality is supplied by Covering Embedding. For a raw one-dimensional signal 1, each token is formed from an overlapping window,
2
with zero-padding at the end, and stacking all such tokens yields 3. The stated purpose is to retain strong local receptive fields akin to CNNs, so that each token contains its own sample together with its next 4 neighbors (Wang et al., 28 Mar 2025).
RWKV-IR similarly replaces Vision-RWKV’s original Q-Shift with a depth-wise convolution shift, DC-Shift: 5 The reported motivation is to capture all 6 neighbors rather than the restricted directional substitution used by Q-Shift (Du et al., 2024). AudioRWKV adopts an analogous strategy for spectrogram inputs by replacing the original 1D token-shift with a 2D depthwise-separable convolution, denoted ConvShift, applied on Mel-spectrogram patches; a local residual 7 is then injected into the parameter-generating pathways through
8
The stated effect is to combine a local spectro-temporal bias with global Bi-WKV attention (Xiong et al., 2 Sep 2025).
A plausible implication is that published Bi-WKV systems treat bidirectional recurrent aggregation as a global mixer whose performance depends materially on an auxiliary local inductive bias. The local operator differs by modality—overlapping windows for one-dimensional SATEM signals, depth-wise convolutional shift for images, and depthwise-separable spectro-temporal convolution for audio—but the architectural pattern is consistent.
4. Role inside full network architectures
In DREMnet, Bi-WKV is embedded in an interpretable decoupled representation learning framework for semi-airborne transient electromagnetic signal denoising. The encoder disentangles the input signal 9 into
0
where 1 are “content” factors corresponding to the underlying clean EM response and 2 are “context” factors corresponding to task-irrelevant or nuisance information. Disentanglement is enforced by minimizing a mutual-information upper bound (CLUB) between 3 and 4, and for a clean reference 5, forcing 6 via a KL–Gaussian prior. After Covering Embedding on both factors, the streams are fused and passed through DR-blocks in which Bi-WKV performs signal mixing and a channel-mixing sublayer performs per-token MLP-style transformation (Wang et al., 28 Mar 2025).
RWKV-IR places Bi-WKV inside a transformer-like restoration layer. The layer applies LayerNorm, DC-Shift, linear projections to 7, 8, and 9, then either a single Bi-WKV scan or the Cross-Bi-WKV extension, in which one Bi-WKV pass operates on row-major flattening and another on column-major flattening. Their outputs, 0 and 1, are fused as
2
The output is then gated by 3, projected by 4, and combined with residual and ChannelMix sublayers (Du et al., 2024).
AudioRWKV uses Bi-WKV in a sequence model built on RWKV7 for audio pattern recognition. Spectrograms are patch-embedded into a sequence, locally transformed by ConvShift, and then processed by bidirectional RWKV recurrences whose forward and backward outputs are fused by the learned gate 5. The paper explicitly positions this as a way to maintain the stable and efficient recurrent formulation of RWKV7 while adapting the original causal WKV kernel to global bidirectional context over the full audio sequence (Xiong et al., 2 Sep 2025).
These uses show that Bi-WKV functions less as an isolated primitive than as the sequence-mixing core of broader hybrid architectures: in DREMnet it operates inside disentangled denoising blocks, in RWKV-IR inside restoration-oriented transformer layers, and in AudioRWKV inside a spectrogram sequence model built around RWKV7 recurrence.
5. Computational complexity and implementation regimes
The central computational claim attached to Bi-WKV is that bidirectionality need not require quadratic self-attention. However, the implementation pathway matters.
For the original unidirectional WKV, DREMnet states 6 time and 7 extra memory by carrying forward two 8-vectors. Its Bi-WKV, written naively as a full all-to-all sum for each 9, has 0 time and 1 memory for storing 2 and 3, but the same source notes that because the decay depends only on 4, the two sums can be computed by two streaming passes—forward and backward—each in 5, yielding an optimized complexity of 6 (Wang et al., 28 Mar 2025).
RWKV-IR states the comparison in image-restoration notation with 7 and 8: standard dot-product attention has time 9 and memory 0, Vision-RWKV with Bi-WKV on one flattening has time 1 and memory 2, and Cross-Bi-WKV has time 3 and memory 4. The paper further notes that Cross-Bi-WKV is approximately 5 the cost of single-direction WKV while remaining linear in 6 (Du et al., 2024).
AudioRWKV gives the same asymptotic conclusion in sequence length 7 and channel dimension 8: Transformer self-attention requires 9, causal WKV requires 0, and bidirectional WKV requires two recurrences plus a fusion gate, still 1. Its pseudocode is described as a minimal-cost implementation with 2 time and 3 extra memory beyond storing inputs and outputs (Xiong et al., 2 Sep 2025).
Taken together, these reports clarify two points often conflated. First, the bidirectional operator can be expressed in a quadratic-looking form yet implemented in linear time when the decay structure permits streaming passes. Second, “linear complexity” does not imply identical constants, buffering strategy, or memory accounting across implementations; the papers separately count recurrent state, stored 4 tensors, directional buffers, and full input-output storage.
6. Empirical effects, stability, and interpretive considerations
The reported empirical role of Bi-WKV is task-dependent but consistent in one respect: bidirectional context is presented as improving discrimination between signal and nuisance structure.
In DREMnet, the rationale is explicit. SATEM denoising requires each sample to depend on both past and future measurements, and Bi-WKV is said to improve the model’s ability to distinguish transient EM signal features from non-stationary noise. The learnable decay 5 and self-reward 6 are described as gates controlling how rapidly influence falls off with distance and how strongly the token admits its own information. The paper attributes improved denoising to bidirectional context, adaptive correlation-length control, and global attention applied to disentangled content and context streams, yielding higher SNR and lower MSE in both synthetic and real-field tests; it also states that processed field data more accurately reflects the theoretical signal and improves identification of subsurface electrical structures (Wang et al., 28 Mar 2025).
In RWKV-IR, an ablation on Urban100 7 at 10K iterations reports PSNR values of 8 for Vision-RWKV with Q-Shift, 9 for 0Q-Shift without offset shift, 1 for 2DC-Shift with single Bi-WKV, and 3 for 4Cross-Bi-WKV. Under Urban100 5, 100K iterations, DF2K training, MambaIR reports 6 PSNR and 7 SSIM, whereas RWKV-IR reports 8 PSNR and 9 SSIM. The paper summarizes these as consistent PSNR/SSIM gains of 00–01 dB at linear complexity (Du et al., 2024).
In AudioRWKV, the ablation on AudioSet-2M reports 02 mAP for causal RWKV7, 03 mAP after adding bidirectional scan with average fusion, 04 mAP after replacing average fusion by a learned gate, and 05 mAP for the final system with ConvShift and full integration. The same source states that A-RWKV-S (06M) achieves performance parity with AuM-B (07M) under the same linear-model regime, and that for long-form audio of approximately 08 minutes 09 seconds, WKV7 achieves up to a 10 speedup in processing; the throughput remains nearly flat while Transformer latency grows proportionally to 11, with OOM around 12 for AST(flash) (Xiong et al., 2 Sep 2025).
AudioRWKV also attaches a specific stability argument to Bi-WKV. Because RWKV7 constrains the per-channel decay 13 to 14, the sums 15 and 16 remain bounded, the spectral radius of the per-channel decay matrix satisfies 17, and Bi-WKV inherits the same numerical stability because it consists of the same bounded forward and backward recurrences followed by a convex fusion of two bounded streams. The paper reports stable convergence for models up to 18M parameters, without the gradient explosions or collapses seen in large SSMs under similar regimes (Xiong et al., 2 Sep 2025).
A useful interpretive caution follows from these results. The gains reported for “Bi-WKV” are not attributable solely to bidirectional recurrence in isolation: DREMnet combines it with disentangled content/context modeling and Covering Embedding, RWKV-IR combines it with DC-Shift and, in one variant, Cross-Bi-WKV, and AudioRWKV combines it with ConvShift and learned directional gating. The published evidence therefore supports Bi-WKV as a central component of several successful RWKV-derived systems, but not as a modality-independent drop-in explanation for the entirety of their performance.