N-gram Speculation Pushes Qwen3-14B on a Home RTX 5070 Ti from 78 to 129 Tokens per Second
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.
AI-processed from Habr AI; edited by Hamidun News
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.
- Dec 2, 2026Vidu S2 streams AI video in real time: 720p, 25–42 fps, and on-the-fly outfit swaps
- Dec 2, 2026AI-Written Rust Driver for NVIDIA Boosts Tesla V100 Memory by 26.8%
- Dec 2, 2026The ncnn Author Ran MiniMax-H3 Without CUDA: a Step on an RTX 3060 Is 3.7x Faster
- Dec 2, 2026SpaceX and NVIDIA Built a 72-GPU Orbital Rack Weighing 500 kg Instead of 1.3 Tonnes
Key Questions Answered
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.
What are the key details on 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.
What are the key details on 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.
Test Frontier LLMs & Autonomous Agents in One Workspace
Run Claude Opus 5.5, GPT-6, Gemini 3.1, and DeepSeek side-by-side in Nomad AI (nomadnet.ai) — unified model routing, deep research, and multimodal workflows under one subscription.
Daily 60-sec AI Voice Brief + Weekly Production AI Agent Playbook
Listen to a 60-second AI news brief every morning and get a weekly hands-on playbook for shipping AI agents to production — tools, MCP servers and patterns that work. Curated by Jemal Hamidun, Head of AI at Alpina Digital.
