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 repositories, every harvested function with whether it ran, its licence and the call to fetch it.

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

For agents, Syntology's MCP tool lists every function and class Syntology harvested from this paper and whether it ran (how to connect): get_harvested_code_for_paper(arxiv_id="2305.13048")

Code

Syntology Ran 6 of 11 code samples harvested from 3 repositories linked to this paper; 5 have no recorded run. Of those that ran: 1 ran · honoured contract; 2 ran · our draft was wrong; 3 ran with no contract checked.

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

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

BlinkDL/RWKV-LM officialmentioned in papermentioned on GitHubpytorch report
blinkdl/chatrwkv officialmentioned in papermentioned on GitHubpytorch report
Westlake-AI/openmixup mentioned on GitHubpytorch report
asuller/rwkv-musicgenerator mentioned on GitHubpytorch report
dc-dc-dc/mlx-rwkv mentioned on GitHubpytorch report
hannibal046/nanorwkv mentioned on GitHubpytorch report
khhaliil/avatario mentioned on GitHubpytorch report
rwkv/rwkv-lm mentioned on GitHubpytorch report
rwkv/rwkv.cpp mentioned on GitHubpytorchMIT report
sustcsonglin/flash-linear-attention mentioned on GitHubpytorchMIT report
tomer9080/stock-prediction-using-rwkv mentioned on GitHubpytorch report
typoverflow/decision-rwkv mentioned on GitHubpytorch 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.

Code Syntology ran Syntology

11 samples harvested; 6 ran; 1 honoured the contract we drafted; 5 have no recorded run. Read from Syntology's graph 2026-09-25; that is when this build read the record, 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; each sample names its own and says which. “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. “Honoured” and “violated” refer to a contract Syntology drafted from the code itself; “our draft was wrong” and “fixture could not drive it” are failures of Syntology's instrument, not of the code.

Each sample ends with its code_sha256, Syntology's identity for that exact code. An agent fetches the stored sample with Syntology's MCP tool get_code(code_sha256="…") (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 from a repository marked official are listed first. 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 four 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; or the licence is outside the permissive list Syntology serves text under (MIT, Apache-2.0, BSD and similar). 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.

batch BlinkDL/RWKV-LM/RWKV-v7/train_temp/rwkv7_train_simplified.py official repository ran · honoured contract Apache-2.0 (permissive) · 7e9cf65e078afda5 · report
sample_logits blinkdl/chatrwkv/RWKV_in_150_lines.py official repository ran · our draft was wrong Apache-2.0 (permissive) · 35e590faf9de67ca · report
time_mixing__ BlinkDL/RWKV-LM/RWKV-v7/rwkv_v7_demo_rnn.py official repository ran · our draft was wrong Apache-2.0 (permissive) · 07a576b3352ec5ac · report
RUN_CUDA_RWKV7g BlinkDL/RWKV-LM/RWKV-v7/train_temp/rwkv7_train_simplified.py official repository unverified Apache-2.0 (permissive) · 4ba3321ca44d1608 · report
channel_mixing__ BlinkDL/RWKV-LM/RWKV-v7/rwkv_v7_demo_rnn.py official repository unverified Apache-2.0 (permissive) · a43aabdbc73f2f29 · report
load_all_stat blinkdl/chatrwkv/chat.py official repository unverified Apache-2.0 (permissive) · 5256b8e5b92e6c98 · report
mm8 blinkdl/chatrwkv/rwkv_pip_package/src/rwkv/model.py official repository unverified Apache-2.0 (permissive) · 104b35c3b39791a5 · report
format_loss rwkv/rwkv.cpp/python/measure_pexplexity.py community (archive-listed) ran MIT (permissive) · 922e0a890b2fbbab · report
format_loss_with_perplexity rwkv/rwkv.cpp/python/measure_pexplexity.py community (archive-listed) ran MIT (permissive) · c64ea6a80f61aeac · report
get_layer_count rwkv/rwkv.cpp/python/convert_pytorch_to_ggml.py community (archive-listed) ran MIT (permissive) · 4dbb2fe483ceceed · report
split_last_end_of_line rwkv/rwkv.cpp/python/chat_with_bot.py community (archive-listed) 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