SuperAPIAI Directory

RWKV-LM

github.com · AI developer platforms

RWKV-LM is the official open-source repository for the RWKV series of language models, currently at version RWKV-7 "Goose". RWKV is a parallelizable-training RNN architecture with Transformer-level large language model performance, while maintaining linear time, constant space (no KV cache), fast training, infinite context length, and free sentence embeddings. The project is supported by the Linux Foundation AI, is completely free, and provides reference implementations and tools for training, inference, and fine-tuning.

Open website Alternatives
PricingOpen source开源项目(可免费自部署)
PlatformsLinux

About this tool

RWKV-LM is the official codebase for the RWKV language model, hosted on GitHub. RWKV (pronounced RwaKuv) is an RNN with Transformer-level LLM performance that can also be trained directly in parallel like a GPT Transformer. The current version is RWKV-7 "Goose", a linear-time, constant-space (no KV cache), attention-free 100% RNN architecture suitable for large language models and multimodal applications.

Purpose: RWKV-LM is mainly used for training, fine-tuning, and inference of the RWKV series of models, supporting training from scratch, continued pre-training, supervised fine-tuning (SFT), state-tuning, etc.

Main capabilities:

  • Combines the advantages of RNN and Transformer: high performance, fast inference, memory savings, fast training, infinite context length, free sentence embeddings (using the final hidden state).
  • RWKV-7 has an extremely small state size, suitable for large-batch inference.
  • Provides multiple inference modes: GPT mode, RNN mode, and the fastest mode combining both.
  • Provides CUDA kernel optimization, supporting efficient training and inference.
  • Supports extensions such as PEFT (LoRA, etc.) and RLHF.
  • Provides a mobile inference library, WebGPU demo, Gradio demo, etc.
  • Provides data preparation tools (jsonl to binidx), tokenizer tools, training scripts, etc.

Usage:

  • Training: Refer to the reference implementation in RWKV-v7/train_temp; the default configuration only needs a single GPU with 7G of VRAM to test. Before training, prepare data (you can use make_data.py to convert jsonl to binidx) and set the relevant parameters (such as --my_exit_tokens, --magic_prime).
  • Inference: You can use the rwkv pip package, the Albatross efficient inference library, the RWKV-Runner GUI, Ai00 Server, etc.
  • Fine-tuning: Supports SFT, state-tuning, etc.; you need to prepare data in jsonl format and use the corresponding scripts and parameters.
  • Demos: Provides multiple Gradio Demos, WebGPU Demos, and example code in ChatRWKV.

Applicable scenarios:

  • For applications requiring long context, low VRAM usage, and fast inference, LLM applications.
  • Multimodal applications (such as Vision-RWKV, Diffusion-RWKV).
  • Mobile/edge device inference (rwkv-mobile).
  • Academic research and model architecture exploration.

Limitations:

  • The RWKV-7 reference implementation contains a large number of carefully tuned hyperparameters such as initialization, weight decay, and learning rate; there is no simple "RWKV-7 layer" that can be reused directly, so you need to study the train_temp code and adapt it.
  • FLA RWKV-7 has not yet been aligned with the reference implementation and performs poorly.
  • Training requires some GPU resources, although the minimum configuration requirement is low.
  • Some links and tools may depend on community maintenance, and stability must be assessed on your own.
  • Some content in the official documentation (such as the wiki) was written by AI and may contain errors.
Up/Down to navigate · Enter to open · ESC to closeBrowse all tools