An attention-free RNN language model architecture that trains like a transformer, with its reference code
open sourceApache-2.0free
RWKV is a language model architecture that is a pure RNN, attention-free and with no KV cache, so it runs in linear time and constant memory, yet trains in parallel like a GPT transformer. RWKV-LM is its Apache-2.0 reference implementation by BlinkDL, with training code and CUDA kernels for the current RWKV-7 "Goose" generation and earlier versions, and the README links pretrained weights from 0.1B to 7.2B parameters on Hugging Face, GGUF conversions and separate inference and mobile runtimes. RWKV is a Linux Foundation AI & Data project.
Problems it solves
- train a language model whose memory use doesn't grow with context length
- an alternative to transformer attention for long-context LLMs
- run a small language model with constant-speed decoding on a GPU
Features
- RWKV-7 reference training code that runs on one GPU with 7 GB of VRAM
- fast CUDA kernels for training and inference
- constant memory per token with no KV cache
- links to pretrained weights and GGUF conversions
Alternatives
The same job
These do what RWKV does.
- Mamba PyTorch library for Mamba selective state space models (Mamba, Mamba-2, Mamba-3), with hardware-aware kernels and pretrained checkpoints
