---
id: 18947
lang: en
title: "N-gram Speculation Pushes Qwen3-14B on a Home RTX 5070 Ti from 78 to 129 Tokens per Second"
published_at: "2026-12-02 10:28:32"
source_name: "Habr AI"
source_url: "https://habr.com/ru/articles/1114952/?utm_campaign=1114952&utm_source=habrahabr&utm_medium=rss"
canonical_url: "https://news.hamidun.com/en/news/18947"
categories: ["llm", "research"]
publisher: "AI News by Jemal Hamidun (news.hamidun.com)"
---

# N-gram Speculation Pushes Qwen3-14B on a Home RTX 5070 Ti from 78 to 129 Tokens per Second

> **Краткая суть (BLUF):** Every token (a chunk of a word) a home GPU produces requires rereading all of the model's weights, so speed is limited by memory bandwidth. The author's Qwen3-14B on an RTX 5070 Ti produced 78 tokens per second, which is 93% of the 83.8 limit. The N-gram method guesses the continuation from the prompt's own text and pushed the model to 129 tokens per second, while EAGLE-3 did not fit in memory. For RAG, where the model quotes retrieved documents, this is a speedup that needs no extra weights.  • The RTX 5070 Ti bandwidth ceiling is 83.8 tokens/s, and the measured result was 77.6–78.2 • CUDA graphs gave only +0.7% speed but took up 0.9 GiB of memory • On tables with repeated content, N-gram reached 214.7 tokens/s

When you run a neural network on a home graphics card, it generates text in chunks called tokens (roughly a syllable or a short word). Speed is measured in tokens per second: the higher the number, the faster the chat or agent responds. The author of a Habr article built a local setup with a Ryzen 9 9950X3D, an RTX 5070 Ti with 16 GB of VRAM, and 64 GB of RAM, and found that Qwen3-14B is limited not by compute but by memory read speed. The N-gram method, which guesses the continuation by looking at the prompt itself, raised its speed from 78 to 129 tokens per second. It required not a single extra gigabyte of weights.

## Why speed is limited by the memory bus

Why bother with local models at all? The author works on projects where data cannot be sent to the cloud: personal data, Russian Federal Law 152 (on personal data), and internal systems such as Jira and CRM. That is why he needs a closed environment and his own RAG, that is, document search with model-generated answers.

The Qwen3-14B model in the compressed NVFP4 format weighs 9.96 GiB on the card and fits entirely. But while there is a single request, the card must read all of these weights once for each new token. The RTX 5070 Ti has a 256-bit bus and GDDR7 memory at 14,001 MHz, which gives about 896 GB/s. Dividing the bandwidth by the weight size gives a theoretical ceiling of 83.8 tokens per second. In vLLM the author measured 77.6–78.2 tokens per second, which is 92–93% of the physical limit.

This explains the modest result from CUDA graphs, which usually speed up the launch of compute operations. Narrow graphs gave +0.7% (12.80 ms per token versus 12.89 ms) and took the same 0.9 GiB of memory. The trade-off is context length: either 16,320 tokens without graphs or 6,080 with them. For RAG, where retrieved documents are placed into the prompt, long context usually matters more.

## EAGLE-3 did not fit, but N-gram worked

Since the bus is the limit, the obvious move is speculative decoding. The idea is simple: a fast "draft" guesses several tokens ahead, and the large model verifies them in a single pass over the weights. The author tried three options.

EAGLE-3 added about 1.1 GiB of weights (from 9.96 to 11.1 GiB). After warm-up, vLLM left no blocks for the KV-cache (the memory that holds the keys and values of already processed text). Six combinations of settings did not help. The author reduced the window to 4096, raised the memory fraction to 0.92, and limited concurrent requests to one. Setting the cache size manually ended in a CUDA out-of-memory error. With a separate small model, Qwen3-0.6B, the same thing happened: the weights loaded (11.07 GiB), but there were again zero cache blocks.

N-gram required no additional weights. It searches for the continuation directly in the prompt text. In RAG, the model constantly quotes fragments of retrieved documents, so these guesses often come true. With K=3, 22% of the draft tokens were accepted, and the average acceptance length was 1.70 tokens per pass. Time per token fell from 12.89 to 8.46 ms, and speed rose from 78 to 128.6 tokens per second. This is above the theoretical ceiling for ordinary generation, because more than one token is produced per pass over the weights.

With K=4, speed reached 214.7 tokens per second on tables with dense copying. On scenarios without repetition, for example Excel sheets without repeated rows, the gain was more modest: about 82–84 tokens per second. Averaged across all scenarios, the result stayed around 130–144. With K=5, the server crashed again due to lack of memory.

## Caveats and what to do in practice

The speedup works exactly where the prompt contains something to quote. The author also references an analysis by the RWB team, where N-gram in vLLM not only slowed generation but also broke JSON in 72% of responses. The author does not dispute those measurements. RWB's conditions were different: a hybrid model with linear attention (Gated DeltaNet), vLLM 0.30, and many parallel users. The author has one card, one model, and one request at a time.

The practical conclusions are these:
- Before choosing an accelerator, divide the bus bandwidth by the weight size. If you are already at about 90% of that ceiling, extra weights for a draft model may not fit.
- Check actual file sizes yourself. A "smart" estimate predicted about 13.5–14 GB for the 27B NVFP4 model, but the shards weighed 18.3 GB against 15.9 GB of available VRAM.
- For RAG on small VRAM, start with N-gram and measure time per token before and after.
- Separately verify the tool-call format. In the author's agent runner, the launch fails with an error if the model returns raw JSON instead of native tool_calls.

---
- **Первоисточник:** [Habr AI](https://habr.com/ru/articles/1114952/?utm_campaign=1114952&utm_source=habrahabr&utm_medium=rss)
- **Каноническая ссылка:** https://news.hamidun.com/en/news/18947
- **Экосистема автора:** [Бесплатный интенсив по вайбкодингу — предзапись в Нике](https://t.me/vibecodeguidebot?start=agent_intensive_news_md) · [Nomad AI](https://nomadnet.ai) · [Telegram @jemal_hamidun](https://t.me/jemal_hamidun)
