Best local LLMs for long context
Run open models featuring a context window of at least 128K tokens to handle large documents and full codebases easily. We rank them using the llmrun Composite Score, highlighting our top recommendation for every memory capacity.
Alibaba · Q4_K_M · 17.9 GB · up to 256K context · on RTX 5090Alibaba · Q4_K_M · 17.9 GB · on RTX 5090
- 66.9 t/s
- S
- Context
- up to 256K context
Also worth a look
IQ3_M · 17 GB · 74.2 t/s · 128K ctx
Q4_K_M · 17.9 GB · 66.9 t/s · 256K ctx
Also worth a look
IQ3_M · 17 GB · 74.2 t/s · 128K ctx
Best long-context model by memory
Highest llmrun Composite Score that fits each size with at least 128K context and 10 t/s, at a Q3 or better quant. Speed is decode tokens per second on that size's reference GPU. The last row has no memory limit: the best model whatever it needs, on the GPU plan shown. Full ranking
8 GB · RTX 5060
Gemma 4 E4B IT58.0 t/s · 128K ctx
Q4_K_S · 5.3 GB
Runner-up: Ling 3.0 Tiny
12 GB · RTX 5070
Qwen3.5 9B68.7 t/s · 128K ctx
Q4_K_M · 6.6 GB
Runner-up: GPT OSS 20B
16 GB · RTX 5080
Gemma 4 26B A4B IT207.5 t/s · 128K ctx
IQ3_S · 12 GB
Runner-up: Qwen3.5 9B
24 GB · RTX 4090
Qwen3.8 27B40.0 t/s · 128K ctx
Q4_K_S · 16.8 GB
Runner-up: Gemma 4 26B A4B IT
32 GB · RTX 5090
Qwen3.8 27B66.9 t/s · 256K ctx
Q4_K_M · 17.9 GB
Runner-up: Gemma 4 31B IT
48 GB+ · no limit · about 7× H100 SXM 80 GB
DeepSeek V4.1 Flash 10171M ctx
Q4_K_M · needs 458 GB
Runner-up: MiMo V2.6 Pro RL
Long-context models that run on 32 GB96
Ranked by Composite Score, models without one after. Best quant that fits with a 16K context; speed is decode tokens per second on the reference GPU.
96 models · 86 run great · 10 run well
Score: llmrun Score, 100 = average model. Fit: how well it runs on this hardware, S best to F won't fit. Ordered by Score, recency and Fit. How ranking works
Showing compatibility for NVIDIA GeForce RTX 5090
| Model | Quant | VRAM | Speed | Context | Score | Fit |
|---|---|---|---|---|---|---|
Mistral Nemo Instruct 2407ChatFunctions < 128K context fits | Q4_K_M | 11.0 GB | 144.3 t/s | 131K | S96, Runs great | |
Llama 3.1 8B InstructChatFunctions | Q4_K_M | 7.9 GB | 219.8 t/s | 131K | S100, Runs great | |
Muse Glimmer 30BVision | Q4_K_M | 19.6 GB | 63.5 t/s | 131K | A84, Runs well | |
NVIDIA Nemotron 3.5 Lightning 30B A3B BF16ChatFunctions | Q4_K_M | 19.3 GB | 243.8 t/s | 262K | S100, Runs great | |
GLM 4.7 FlashChatFunctions | Q4_K_M | 19.9 GB | 196.2 t/s | 203K | S100, Runs great | |
MiniCPM V 4.7 35B A3BVisionFunctions | Q4_K_M | 22.1 GB | 232.5 t/s | 262K | S100, Runs great | |
LFM2.5 24B A2BChatFunctions | Q4_K_M | 15.0 GB | 285.3 t/s | 131K | S100, Runs great | |
Ornith 1.5 35B A3BChatFunctions | Q4_K_M | 22.0 GB | 213.3 t/s | 262K | S100, Runs great | |
FlintChatFunctions | Q4_K_M | 25.0 GB | 249.7 t/s | 262K | S100, Runs great | |
Ornith 1.0 35BChatFunctions | Q4_K_M | 21.5 GB | 235.5 t/s | 262K | S100, Runs great | |
Ling 3.0 TinyChatFunctions | Q4_K_M | 5.5 GB | 471.1 t/s | 131K | S100, Runs great | |
MiniCPM5 2BChatFunctions | Q4_K_M | 2.5 GB | 613.1 t/s | 131K | S100, Runs great | |
Hy Memory 30B A3BChatFunctions | Q4_K_M | 19.1 GB | 237.0 t/s | 262K | S100, Runs great | |
Gemma 4 12B ITChatFunctions | Q4_K_M | 9.0 GB | 141.5 t/s | 262K | S96, Runs great | |
Qwen3.5 4BVisionFunctions | Q4_K_M | 3.4 GB | 357.3 t/s | 262K | S100, Runs great |
How much memory do you need for long context?
On 8 GB the best long-context model is Gemma 4 E4B IT. At 12 GB it is Qwen3.5 9B (score 99). At 16 GB it is Gemma 4 26B A4B IT (score 106). From 24 to 32 GB it is Qwen3.8 27B (score 122). With no memory limit, the best is DeepSeek V4.1 Flash 1017 (score 133). Weights cover just part of the cost. As tokens fill the cache in your window, a complete 128K prompt may require several gigabytes beyond the model itself. The listed sizes allow space for up to a 16K context.
Frequently Asked Questions
What is the best local LLM for long context?
On 24 GB, Qwen3.8 27B is the top pick with a score of 122, running at about 40 t/s on RTX 4090. It fits up to 128K tokens of context there. On 8 GB, the best fit is Gemma 4 E4B IT. With no memory limit, the best is DeepSeek V4.1 Flash 1017. Open a model to see which GPUs and Macs run it.
Does a long context window use more memory?
The key-value cache scales linearly as token count rises, reaching sizes that can match the model's weights around 128K tokens. Techniques like cache quantization or using grouped-query attention can shrink this footprint.
Is a bigger context window always better?
Quality for info buried deep in a long prompt often slips, plus handling a lengthy request eats up time. Stick to the length you actually need instead of maxing it out.