---
title: "Introducing RWKV - An RNN with the advantages of a transformer"
description: "RWKV is an attention-free language model architecture, derived from Apple's Attention Free Transformer, that trains in parallel like a GPT-style transformer but runs inference as an RNN."
url: "https://swe.quest/articles/introducing-rwkv-an-rnn-with-the-advantages-of-a-transformer-61894d925597865d"
canonical: "https://huggingface.co/blog/rwkv"
source: "Hugging Face"
published: "2023-05-15"
difficulty: "easy"
kind: "Announcement"
reading_minutes: 10
tags: ["llms","machine-learning","inference"]
---

# Introducing RWKV - An RNN with the advantages of a transformer

A post on [Hugging Face](https://swe.quest/sources/hugging-face.md), published 2023-05-15, 10 min read, Announcement. Original: [https://huggingface.co/blog/rwkv](https://huggingface.co/blog/rwkv)

## Summary

RWKV is an attention-free language model architecture, derived from Apple's Attention Free Transformer, that trains in parallel like a GPT-style transformer but runs inference as an RNN. Each step needs only matrix-vector operations, memory stays constant as context grows, and ctx8192 models run as fast as ctx1024 ones with the same RAM. RWKV-4 checkpoints from ~170M to 14B parameters were trained on the Pile, alongside Raven chat fine-tunes. The architecture is now integrated into Hugging Face transformers, with pipeline and generate examples and a script for converting raw RWKV weights to HF format.

Written by swe.quest, not by the author.

**Difficulty:** Easy: no special background needed; explains what something is and why it matters

## Topics

- [LLMs](https://swe.quest/tags/llms.md) (AI & ML)
- [Machine learning](https://swe.quest/tags/machine-learning.md) (AI & ML)
- [Inference & serving](https://swe.quest/tags/inference.md) (AI & ML)

## Prerequisites

- transformer self-attention
- recurrent neural networks ([easy posts on Machine learning](https://swe.quest/tags/machine-learning.md?difficulty=easy))

## Keywords

RWKV, Hugging Face Transformers, RWKV-4 Raven, Attention Free Transformer, The Pile, rwkv.cpp

## Related posts

- [Optimizing your LLM in production](https://swe.quest/articles/optimizing-your-llm-in-production-aa5bbb901928fa57.md): Hugging Face · 2023-09-15 · Medium · 31 min read · Inference & serving, LLMs, Performance engineering, Python
  Serving billion-parameter LLMs efficiently comes down to three levers: lower precision, Flash Attention, and inference-friendly architectures such as ALiBi, rotary embeddings, Multi-Query Attention and Grouped-Query Attention.
- [Productizing Large Language Models](https://swe.quest/articles/productizing-large-language-models-5be0923873af50a1.md): Replit · 2022-09-21 · Medium · 6 min read · Inference & serving, LLMs, AI for coding, Evaluation, Kubernetes
  Replit runs transformer models from ~100M parameters (search, spam) through 1-10B (GhostWriter code autocomplete) to 100B+ in production, and shares lessons on making them usable.
- [KV Cache from scratch in nanoVLM](https://swe.quest/articles/kv-cache-from-scratch-in-nanovlm-f1d92b90631a1366.md): Hugging Face · 2025-06-04 · Medium · 9 min read · Inference & serving, LLMs, Performance engineering, Python
  KV caching avoids recomputing keys and values for earlier tokens during autoregressive generation, and implementing it from scratch in the pure-PyTorch nanoVLM codebase gave a 38% speedup in generation.
- [Transformers now runs llama.cpp quants](https://swe.quest/articles/transformers-now-runs-llama-cpp-quants-cff2353854049dc6.md): Hugging Face · 2026-09-22 · Medium · 11 min read · Inference & serving, LLMs, Python, Performance engineering
  Hugging Face transformers can now load GGUF (llama.cpp) quantized checkpoints via \`from\_pretrained(..., gguf\_file=...)\` and serve them through \`transformers serve\` with an OpenAI-compatible API.
- [Perceiver IO: a scalable, fully-attentional model that works on any modality](https://swe.quest/articles/perceiver-io-a-scalable-fully-attentional-model-that-works-on-any-modality-f8a43e7ae2c87797.md): Hugging Face · 2021-12-15 · Hard · 21 min read · Machine learning, LLMs, Computer vision, Python
  Perceiver IO avoids the quadratic cost of self-attention by running attention over a small fixed set of latent variables (e.g. 256×1280).

Browse: [Latest posts](https://swe.quest/index.md) · [Topics](https://swe.quest/tags.md) · [Sources](https://swe.quest/sources.md) · [Topic map](https://swe.quest/map.md) · [Site guide (llms.txt)](https://swe.quest/llms.txt)
