BlinkDL/ChatRWKV
Local chat and Python inference with the RWKV recurrent language model
Automated SPDX check for reference only — not legal advice. Disclaimer
GitHub Star History
Full-history star trajectory from GitHub official history. Switch ranges or hover any point for exact counts.
Evidence-Backed Technical Brief
AI Deep ReviewArchitecture & Core Mechanics
ChatRWKV is a Python local chat application and inference reference built around the RWKV recurrent language model. Its root chat.py uses src/model_run.py; v2/chat.py provides the strategy-oriented CLI path. Text is tokenized before inference, and generation advances token by token by updating recurrent state rather than appending a Transformer KV cache for every decoded token.
The runtime stack is Python and PyTorch. The supplied requirements.txt lists tokenizers>=0.13.2 and prompt_toolkit but does not pin a PyTorch build. API_DEMO.py, API_DEMO_CHAT.py, and API_DEMO_WORLD.py are Python integration examples, not a documented HTTP protocol or plugin system. Training and fine-tuning are handled in the separate RWKV-LM project.
Key Capabilities & Differentiators
The v2 runtime provides stream and split strategies and INT8 inference. v2/convert_model.py prepares a checkpoint for a selected strategy ahead of time to reduce loading work and CPU memory pressure. RWKV_CUDA_ON enables a locally built CUDA kernel, and RWKV_v6_demo_cuda_bf16.py gives a separate example of a v6 CUDA BF16 path. These are options to validate against the chosen checkpoint and machine, not guarantees that every configuration will fit.
API_DEMO_WORLD.py and v2/benchmark_more.py cover World and Raven Q&A respectively. Standalone v5 and v6 demos make the inference code easier to inspect; RWKV-7 code, preview weights, and GGUF builds are linked externally. A link to a weight format is not evidence that the bundled CLI can load it directly or that checkpoints and tokenizers are interchangeable.
Trade-offs & Limitations
Compared with hosted ChatGPT, ChatRWKV lets you run inference on hardware you control, choose the checkpoint, and modify generation code without a hosted model endpoint. In return, you own dependency setup, hardware sizing, and any service layer. Recurrent decoding avoids a growing KV cache, but weights and temporary buffers still need memory; concurrent sessions add state. Long-context answer quality and end-to-end latency should be measured on the intended workload, not inferred from the state representation.
Use the Python CLI when code visibility matters; evaluate a separate runtime such as rwkv.cpp when packaging or quantized CPU deployment is the stronger constraint. Apache-2.0 applies to the repository code. Review checkpoint terms independently, especially if you intend to bundle or redistribute the weights.
Hardware & Deployment Guide
For a local setup, choose a checkpoint and matching tokenizer, install the Python dependencies and a suitable PyTorch build, and start with v2/chat.py. The separately published rwkv package is another integration path. Once the dependencies and weights are in place, the local CLI does not need a hosted model endpoint. No container recipe or ready-to-run HTTP service is supplied here; use the Python demos as an integration starting point or evaluate the separate Vulkan server.
For the optional CUDA kernel, install Ninja. The Linux setup exposes the CUDA bin and lib64 directories through PATH and LD_LIBRARY_PATH. The Windows recipe uses VS2022 Desktop C++ build tools, CUDA 11.7 with VC++ extensions, and the x64 native tools prompt; treat it as a specific build recipe, not a general compatibility matrix. There is no listed GitHub release, and RWKV-7 preview artifacts are linked separately rather than shipped as a ChatRWKV release.
Running RWKV chat locally, inspecting recurrent inference, or prototyping Python integrations with control over weights and device placement.
You need a turnkey hosted chat product, a ready-to-operate HTTP service, or a deployment path that avoids managing checkpoints and runtime compatibility.
Quick Start & Installation
os.environ["RWKV_JIT_ON"] = '1' os.environ["RWKV_CUDA_ON"] = '0' # if '1' then use CUDA kernel for seq mode (much faster) from rwkv.model import RWKV # pip install rwkv model = RWKV(model='/fsx/BlinkDL/HF-MODEL/rwkv-4-pile-1b5/RWKV-4-Pile-1B5-20220903-8040', strategy='cuda fp16') out, state = model.forward([187, 510, 1563, 310, 247], None) # use 20B_tokenizer.json print(out.detach().cpu().numpy()) # get logits out, state = model.forward([187, 510], None) out, state = model.forward([1563], state) # RNN has state (use deepcopy if you want to clone it) out, state = model.forward([310, 247], state) print(out.detach().cpu().numpy()) # same result as above
Comparison vs. Top Chat UI & AI Apps Alternatives
Full comparison →| Repository | Stars | 7d Trend | Stack | License | Core Positioning |
|---|---|---|---|---|---|
| ChatRWKV ★ | 9.5k | +2 | Python | Apache-2.0 | Local chat and Python inference with the RWKV recurrent language model |
| chatbox | 42.6k | +74 | TypeScript | GPL-3.0 | Electron chat client for switching between cloud APIs and local Ollama models |
| LibreChat | 47.7k | +222 | TypeScript | MIT | A self-hosted AI chat workspace for multiple model providers and MCP tools |
| jan | 46.3k | +226 | Rust | — | Tauri desktop chat with local LLM inference and an OpenAI-compatible API |
AI Context Briefing (for Claude / Cursor / Windsurf)
Standardized architecture summary & quickstart commands ready to paste into coding agents.
curl -sL https://repoforai.com/repo/BlinkDL/ChatRWKV.md
Active README embeds unlock Hot-Tier 6h Telemetry Refresh automatically (zero pay-to-rank).
Frequently Asked Questions about ChatRWKV
How do I embed ChatRWKV in an application, and does it ship an HTTP API?
How much RAM or VRAM do I need, and is CUDA mandatory?
Can I self-host ChatRWKV for commercial use?
When is ChatRWKV a better fit than hosted ChatGPT?
Upstream README & Documentation
This profile focuses on independent engineering analysis and live telemetry. Read the full upstream README, changelog, and examples directly on GitHub.
Top 10 Breakout Open-Source AI Repos, Every Thursday
Signal-only digest of fast-growing AI repos, SPDX license alerts, and architecture picks. Zero spam.
Zero spam · 1-click unsubscribe · Privacy Policy