All models

rwkv

An attention-free RNN that trains like a GPT and runs with constant memory per token.

Language · 12,115 operations Checked

100%

Showing the top corner; full diagram not loaded yetShowing a small copy; full diagram not loaded yetLarge diagram, not loaded yet

Open SVG

This diagram has 12,115 operations (2.8 MB) and is drawn when you ask.

Open in a new tab

Click or tap a spot to read it up close. Scroll or drag inside the diagram to move through it. Zoom with + and − or Ctrl and scroll. Press 0 for the whole graph. Swipe inside the diagram to move through it. Use + and − to zoom.

At a glance

Parameters
169.3M
Operations
12,115
Framework
PyTorch
Recurrent
Yes
Published
Findings of EMNLP 2023
Cited by
367 (as of 9 October 2026)
Authors
Bo Peng, Eric Alcaide, Quentin G. Anthony and others
License
Apache-2.0
Checked
Passed: the trace was replayed operation by operation and matched the model's own output for this input.

Files

The diagram is a drawing of a TorchLens trace of the source code. It contains no code or weights.

Details
Stable ID
m8987
Graph hash
ffe1732e44dacf051aae30e65fbc863e3443cea6fc07b84f7a51284cf0cfbce4
Skeleton hash
0b7612050ee705bdba570f61b6b30324517795eda645d882384bbb3a8ace904b
Architecture hash
463c1f82900fb1dbf77c3e1870eede033545b14dd423bf4ce202d1dde9256eb3
Diagram SHA-256
d83df554aaeaf23972151f89a2f03aa662b6ff3231eebdc787a576d7d5b88c57
TorchLens version
2.36.0
Renderer
graphviz 2.43.0+pyvips 3.2.0+libvips 8.18.7+render-opts@06c1f0d3
Check
Forward pass replayed in PyTorch

What it is

About this model's family

RWKV, short for Receptance Weighted Key Value, is a language model that trains in parallel like a Transformer but runs like a recurrent network. The motivation is the usual trade: Transformers scale quadratically in memory and compute with sequence length, while RNNs scale linearly but have lagged in performance and parallelism. RWKV uses a linear attention mechanism that can be written either as a Transformer or as an RNN, so training is parallel and inference keeps constant compute and memory per token. The paper scales it to 14 billion parameters, which it calls by far the largest dense RNN ever trained, and finds it on par with similarly sized Transformers.

The name comes from the four elements inside every block: Receptance, Weight, Key and Value. The model is a stack of residual blocks, each with a time-mixing sub-block and a channel-mixing sub-block. A small quirk is the token shift: the projections for R, K and V are formed by linear interpolation between the current and previous timestep inputs. The design was inspired by the Attention Free Transformer, with the interaction weights changed so the whole thing can be transformed into an RNN. Each weight is a channelwise time decay multiplied by relative position and traced backward from the current time.

The README puts it plainly: RWKV is an RNN with Transformer-level LLM performance that can be trained like a GPT, and it is 100% attention-free. Parallel training works because the time-decay of each channel is data-independent and trainable. The traced members are the RWKV-4 causal language model from the transformers library at two small configurations. The repository says the name is pronounced RwaKuv.

Key idea. RWKV reformulates attention as a linear, channelwise time-decay recurrence so one model can be trained in parallel like a Transformer and run as an RNN with constant per-token cost, scaling to 14 billion parameters.

  • RWKV
  • RWKV-4
  • Receptance Weighted Key Value
  • RwkvForCausalLM
  • RWKV-LM
  • BlinkDL
  • linear attention RNN
  • attention-free language model
  • Pile

AI-written summary, based on the paper and checked automatically against it; not reviewed by a person. Corrections welcome.

Cite the paper

@misc{peng2023rwkvreinventingrnnstransformer,
      title={RWKV: Reinventing RNNs for the Transformer Era}, 
      author={Bo Peng and Eric Alcaide and Quentin Anthony and Alon Albalak and Samuel Arcadinho and Stella Biderman and Huanqi Cao and Xin Cheng and Michael Chung and Matteo Grella and Kranthi Kiran GV and Xuzheng He and Haowen Hou and Jiaju Lin and Przemyslaw Kazienko and Jan Kocon and Jiaming Kong and Bartlomiej Koptyra and Hayden Lau and Krishna Sri Ipsit Mantri and Ferdinand Mom and Atsushi Saito and Guangyu Song and Xiangru Tang and Bolun Wang and Johan S. Wind and Stanislaw Wozniak and Ruichong Zhang and Zhenyuan Zhang and Qihang Zhao and Peng Zhou and Qinghua Zhou and Jian Zhu and Rui-Jie Zhu},
      year={2023},
      eprint={2305.13048},
      archivePrefix={arXiv},
      primaryClass={cs.CL},
      url={https://arxiv.org/abs/2305.13048}, 
}