Papers › RWKV: Reinventing RNNs for the Transformer Era

RWKV: Reinventing RNNs for the Transformer Era

22 May 2023arXiv:2305.13048archive 2025-07-28

Bo Peng, Eric Alcaide, Quentin Anthony, Alon Albalak, Samuel Arcadinho, Stella Biderman, Huanqi Cao, Xin Cheng, Michael Chung, Matteo Grella, Kranthi Kiran GV, Xuzheng He, Haowen Hou, Jiaju Lin, Przemyslaw Kazienko, Jan Kocon, Jiaming Kong, Bartlomiej Koptyra, Hayden Lau, Krishna Sri Ipsit Mantri, Ferdinand Mom, Atsushi Saito, Guangyu Song, Xiangru Tang, Bolun Wang, Johan S. Wind, Stanislaw Wozniak, Ruichong Zhang, Zhenyuan Zhang, Qihang Zhao, Peng Zhou, Qinghua Zhou, Jian Zhu, Rui-Jie Zhu

Transformers have revolutionized almost all natural language processing (NLP) tasks but suffer from memory and computational complexity that scales quadratically with sequence length. In contrast, recurrent neural networks (RNNs) exhibit linear scaling in memory and computational requirements but struggle to match the same performance as Transformers due to limitations in parallelization and scalability. We propose a novel model architecture, Receptance Weighted Key Value (RWKV), that combines the efficient parallelizable training of transformers with the efficient inference of RNNs. Our approach leverages a linear attention mechanism and allows us to formulate the model as either a Transformer or an RNN, thus parallelizing computations during training and maintains constant computational and memory complexity during inference. We scale our models as large as 14 billion parameters, by far the largest dense RNN ever trained, and find RWKV performs on par with similarly sized Transformers, suggesting future work can leverage this architecture to create more efficient models. This work presents a significant step towards reconciling trade-offs between computational efficiency and model performance in sequence processing tasks.

PaperPDFCodeCode Syntology ran

In Syntology View this paper on Syntology, its page in Syntology's graph. That page adds which of its functions are also present in other papers' code Syntology holds, with dates, and its dated run record as JSON and a README badge. It also lists the repositories linked to the paper, the abstract and the calls for agents.

Open this paper in Syntology's Atlas, the map of the papers in Syntology's graph and their citations.

For agents, on Syntology's MCP service (how to connect):

Code

Syntology 11 code samples harvested from 3 repositories linked to this paper: 6 ran (of which 0 constructed an object rather than computing a result; 4 with no instrument failure: 1 honoured, 0 violated, 3 with no contract checked; 2 where Syntology's instrument failed) · 5 unverified. Where Syntology's instrument failed: 2 where our contract draft was wrong; failures of Syntology's instrument, not of the code.

By repository: official repository: 7 samples from 2 repositories, 3 ran (1 with no instrument failure; 2 where Syntology's instrument failed); community (archive-listed): 4 samples from 1 repository, 3 ran (3 with no instrument failure; 0 where Syntology's instrument failed). The run record, sample by sample. “Ran” means executed on a synthesized input, not that the code is correct or reproduces the paper.

No sample is linked to this paper from 5 of its repositories that Syntology harvested for other papers:

Levels written between 2026-09-22 and 2026-09-25 (UTC): the dates Syntology's graph wrote each sample's verification level, not when the code executed.

14 repositories listed; official and paper-mentioned ones first.

BlinkDL/RWKV-LM officialmentioned in papermentioned on GitHubpytorchSyntology: 4 samples, 2 ran (1 instrument-failed) · 2 unverified report
blinkdl/chatrwkv officialmentioned in papermentioned on GitHubpytorchSyntology: 3 samples, 1 ran (1 instrument-failed) · 2 unverified report
Westlake-AI/openmixup mentioned on GitHubpytorchSyntology: no sample linked to this paper (harvested for another paper). Syntology's graph links these samples to mixup: Beyond Empirical Risk Minimization (arXiv:1710.09412; that paper's own run record: 36 ran (of which 5 constructed an object rather than computing a result; 14 with no instrument failure: 0 honoured, 0 violated, 14 with no contract checked; 22 where Syntology's instrument failed) · 11 unverified), Visualizing the Loss Landscape of Neural Nets (arXiv:1712.09913; that paper's own run record: 3 ran (of which 1 constructed an object rather than computing a result; 2 with no instrument failure: 0 honoured, 0 violated, 2 with no contract checked; 1 where Syntology's instrument failed) · 5 unverified), CutMix: Regularization Strategy to Train Strong Classifiers with Localizable Features (arXiv:1905.04899; that paper's own run record: 17 ran (of which 6 constructed an object rather than computing a result; 10 with no instrument failure: 2 honoured, 0 violated, 8 with no contract checked; 7 where Syntology's instrument failed) · 7 unverified) and 1 more (every one in this page's JSON twin); nothing checks that they implement this paper's method. report
asuller/rwkv-musicgenerator mentioned on GitHubpytorchSyntology: not harvested report
dc-dc-dc/mlx-rwkv mentioned on GitHubpytorchSyntology: not harvested report
hannibal046/nanorwkv mentioned on GitHubpytorchSyntology: no sample linked to this paper (harvested for another paper). Syntology's graph links these samples to Attention Is All You Need (arXiv:1706.03762; that paper's own run record: 610 ran (of which 293 constructed an object rather than computing a result; 529 with no instrument failure: 45 honoured, 15 violated, 469 with no contract checked; 81 where Syntology's instrument failed) · 336 unverified); nothing checks that they implement this paper's method. report
khhaliil/avatario mentioned on GitHubpytorchSyntology: not harvested report
rwkv/rwkv-lm mentioned on GitHubpytorchSyntology: no sample linked to this paper (harvested for another paper). Syntology's graph links these samples to RWKV-7 "Goose" with Expressive Dynamic State Evolution (arXiv:2503.14456; that paper's own run record: 2 ran (of which 0 constructed an object rather than computing a result; 0 with no instrument failure: 0 honoured, 0 violated, 0 with no contract checked; 2 where Syntology's instrument failed) · 1 unverified); nothing checks that they implement this paper's method. report
rwkv/rwkv.cpp mentioned on GitHubpytorchMITSyntology: 4 samples, 3 ran (0 instrument-failed) · 1 unverified report
sustcsonglin/flash-linear-attention mentioned on GitHubpytorchMITSyntology: no sample linked to this paper (harvested for another paper). Syntology's graph links these samples to PaTH Attention: Position Encoding via Accumulating Householder Transformations (arXiv:2505.16381; that paper's own run record: 2 ran (of which 0 constructed an object rather than computing a result; 2 with no instrument failure: 2 honoured, 0 violated, 0 with no contract checked; 0 where Syntology's instrument failed) · 0 unverified); nothing checks that they implement this paper's method. report
tomer9080/stock-prediction-using-rwkv mentioned on GitHubpytorchSyntology: not harvested report
typoverflow/decision-rwkv mentioned on GitHubpytorchSyntology: not harvested report
seung7361/RWKV-Pytorch pytorchSyntology: not harvested report
yangyucheng000/University mindsporeSyntology: no sample linked to this paper (harvested for another paper). Syntology's graph links these samples to Qwen2-VL: Enhancing Vision-Language Model's Perception of the World at Any Resolution (arXiv:2409.12191; that paper's own run record: 12 ran (of which 1 constructed an object rather than computing a result; 10 with no instrument failure: 4 honoured, 1 violated, 5 with no contract checked; 2 where Syntology's instrument failed) · 0 unverified); nothing checks that they implement this paper's method. report

Repository list and official/mentioned flags are the archive's, frozen 2025-07-28. Reachability, where shown, is from one Syntology probe window (2026-09-16 to 2026-09-18); repositories not probed show nothing. GitHub stars are not tracked.

A paper named beside a repository with no sample linked to this paper is shown with that paper's own run record, not this paper's: “ran” means executed on a synthesized input, not that the code is correct, and “where Syntology's instrument failed” counts failures of Syntology's instrument, not of the code. Papers are listed in arXiv-id order, at most three per repository.

Code Syntology ran Syntology

11 samples harvested: 6 ran (of which 0 constructed an object rather than computing a result; 4 with no instrument failure: 1 honoured, 0 violated, 3 with no contract checked; 2 where Syntology's instrument failed) · 5 unverified. “Where Syntology's instrument failed” counts failures of Syntology's instrument, not of the code. Syntology's record for this page has not changed since , the first build that kept a record date for it; when this build read Syntology's graph is in the build record. That date is not when the samples ran.

1ran · honoured contract
2ran · our draft was wrong
3ran
5unverified

Licence: 0 of the 11 samples are pointer only, meaning Syntology does not serve that copy's text. This page shows no code text for any sample; each one links to its file in the repository.

Harvested from 3 repositories linked to this paper, official or community; the list below is grouped by repository, each group headed by its name and what it is to the paper. “Ran” means the sample executed on a synthesized input. It does not mean the output is correct, and nothing here reproduces the paper's results. A line beginning “fixture:” under a sample that ran gives the arguments Syntology's fixture called the sample with, each as name:type/rank/element kind (? where none was recorded), and the type of what the fixture's run returned, exactly as the harness recorded them; the arguments and the returned type were recorded by two separate runs of the same fixture. No output value is shown, and a returned type says nothing about whether the output was right. “Level recorded” gives the UTC date when Syntology's graph wrote the sample's verification level, not when the code executed; where the level was written before Syntology's graph kept that date, the row says “level recorded, date not recorded”. “Honoured” and “violated” refer to a contract Syntology drafted from the code itself. “Our draft was wrong” and “the contract check could not run” are failures of Syntology's instrument, not of the code: the sample ran on Syntology's synthesized input, and then the drafted contract did not describe it, or the check itself raised an error (RAISES), lacked a dependency (DEP_MISSING) or ran out of time (TIMEOUT); hover the label for which. A metamorphic tier, where shown, is evidence of the output's shape, not that the sample implements the method.

Each sample ends with its code_sha256. A sample's code_sha256 is Syntology's identity for that exact code. It is printed in full (16 hexadecimal characters for every sample in this build), and get_code(code_sha256="…") takes it exactly as printed. An agent calls it on Syntology's MCP service (how to connect); click an identity to copy that call.

Repository labels, per sample. official repository: The archive marks this repository official for the paper. named in the paper: The archive records that the paper mentions this repository; it is not marked official. community (archive-listed): In the archive's code links for this paper, not marked official and not recorded as mentioned in the paper. found in paper text by Syntology: Syntology found this repository in the paper's own text; whether it is the authors' implementation is not asserted. community: Not in the archive's code links for this paper; a community repository Syntology harvested. Samples are grouped by repository: a repository marked official first, then by how directly the repository is tied to the paper, then in the archive's order; never by how many ran. Licence labels name the repository's licence as recorded at harvest. “Pointer only” means Syntology does not serve that copy's text, for one of six reasons: no licence file was found; the licence was not identified; the licence is recorded as permissive but that copy's record is not marked cleared; the licence is outside the permissive list Syntology serves text under (MIT, Apache-2.0, BSD and similar); this paper's copy was not located, so its licence is not recorded; or this paper's copy is cleared, but the stored copy of the same code that Syntology serves is not. Some licences outside that list permit redistribution, such as WTFPL, and GPL-3.0 under its conditions; they are simply not on the list. Hover a licence label for the reason. File links open the file on GitHub at the default branch, which may have changed since the harvest.

A function or class name links to its page when the name occurs in the harvested code of at least 5 papers; the name is a string, not an identity.

BlinkDL/RWKV-LM official repository 4 samples, 2 ran (1 instrument-failed) · 2 unverified
batch in 31 papers RWKV-v7/train_temp/rwkv7_train_simplified.py ran · honoured contract Apache-2.0 (permissive) · 7e9cf65e078afda5 · report fixture: signature B:int/0/int, T:int/0/int, device:str/0/str · returned Tensor · level recorded 2026-09-22
time_mixing__ RWKV-v7/rwkv_v7_demo_rnn.py ran · our draft was wrong Apache-2.0 (permissive) · 07a576b3352ec5ac · report fixture: signature layer_id:int/0/int, H:int/0/int, N:int/0/int, x:Tensor/1/float, x_prev:Tensor/1/float, v_first:Tensor/1/float, state:Tensor/3/float, x_r:Tensor/1/float, x_w:Tensor/1/float, x_k:Tensor/1/float, x_v:Tensor/1/float, x_a:Tensor/1/float, x_g:Tensor/1/float, w0:Tensor/1/float, w1:Tensor/2/float, w2:Tensor/2/float, a0:Tensor/1/float, a1:Tensor/2/float, a2:Tensor/2/float, v0:Tensor/1/float, v1:Tensor/2/float, v2:Tensor/2/float, g1:Tensor/2/float, g2:Tensor/2/float, k_k:Tensor/1/float, k_a:Tensor/1/float, r_k:Tensor/1/float, kw:Tensor/2/float, vw:Tensor/2/float, rw:Tensor/2/float, ow:Tensor/2/float, ln_w:Tensor/1/float, ln_b:Tensor/1/float · returned tuple · level recorded 2026-09-22
RUN_CUDA_RWKV7g RWKV-v7/train_temp/rwkv7_train_simplified.py unverified Apache-2.0 (permissive) · 4ba3321ca44d1608 · report
channel_mixing__ RWKV-v7/rwkv_v7_demo_rnn.py unverified Apache-2.0 (permissive) · a43aabdbc73f2f29 · report
blinkdl/chatrwkv official repository 3 samples, 1 ran (1 instrument-failed) · 2 unverified
sample_logits in 16 papers RWKV_in_150_lines.py ran · our draft was wrong Apache-2.0 (permissive) · 35e590faf9de67ca · report fixture: signature out:Tensor/1/float, temperature:float/0/float, top_p:float/0/float · returned int · level recorded 2026-09-22
load_all_stat chat.py unverified Apache-2.0 (permissive) · 5256b8e5b92e6c98 · report
mm8 rwkv_pip_package/src/rwkv/model.py unverified Apache-2.0 (permissive) · 104b35c3b39791a5 · report
rwkv/rwkv.cpp community (archive-listed) 4 samples, 3 ran (0 instrument-failed) · 1 unverified
format_loss python/measure_pexplexity.py ran MIT (permissive) · 922e0a890b2fbbab · report fixture: signature loss:Tensor/1/float · returned str · level recorded 2026-09-24
format_loss_with_perplexity python/measure_pexplexity.py ran MIT (permissive) · c64ea6a80f61aeac · report fixture: signature loss:Tensor/1/float · returned str · level recorded 2026-09-24
get_layer_count python/convert_pytorch_to_ggml.py ran MIT (permissive) · 4dbb2fe483ceceed · report fixture: signature state_dict:dict/0/? · returned int · level recorded 2026-09-25
split_last_end_of_line python/chat_with_bot.py unverified MIT (permissive) · ecd9b52290cb9d64 · report

Tasks

Computational EfficiencyNatural Language Inference

Results from the paper archive 2025-07-28

TaskDatasetModelMetricValueRank at snapshotLeaderboardReport
Natural Language Inference WNLI RWKV-4-Raven-14B Accuracy 49.3 #22 of 23 Archive leaderboard report

Ranks are positions in the archive's leaderboards as they stood at the 2025-07-28 snapshot. Results published since then are not among these rows, so a rank here is not a current standing.

Methods

Absolute Position EncodingsAdamAttentionBPEDense ConnectionsDropoutLabel SmoothingLayer NormalizationLinear LayerMulti-Head AttentionPosition-Wise Feed-Forward LayerResidual ConnectionSoftmaxTransformer

Report a problem or propose a change · a person checks every report against the paper or source before anything changes; decisions are listed on /corrections