llmrun

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.

Best for long context on

Qwen3.8 27B

Alibaba · Q4_K_S · 16.8 GB · up to 128K context · on RTX 4090

40.0 t/s
A

All 187 long-context models for 24 GB ↓

Also worth a look

Gemma 4 26B A4B IT

Q4_K_M · 16.5 GB · 171.1 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

Long-context models that run on 24 GB187

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.

187 models · 146 run great · 22 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 4090

LLM models compatible with NVIDIA GeForce RTX 4090 — ranked by Score, recency and Fit
ModelVRAMScoreFit
Gemma 3 27B IT
< 128K context fits
Q4_K_M·36.2 t/s
21.7 GBB58, Decent
< 128K context fits
Q4_K_M·43.3 t/s
18.1 GBA77, Runs well
Mistral Nemo Instruct 2407
< 128K context fits
Q4_K_M·81.2 t/s
11.0 GBS88, Runs great
Llama 3.1 8B Instruct
< 128K context fits
Q4_K_M·123.6 t/s
7.9 GBS95, Runs great
Q4_K_M·197.4 t/s
19.3 GBS99, Runs great
Muse Glimmer 30B
< 128K context fits
Q4_K_M·35.7 t/s
19.6 GBA71, Runs well
GLM 4.7 Flash
Q4_K_M·141.8 t/s
19.9 GBS92, Runs great
LFM2.5 24B A2B
Q4_K_M·221.2 t/s
15.0 GBS100, Runs great
Ling 3.0 Tiny
Q4_K_M·364.1 t/s
5.5 GBS100, Runs great
MiniCPM5 2B
Q4_K_M·344.8 t/s
2.5 GBS100, Runs great
MiniCPM V 4.7 35B A3B
Q4_K_M·168.5 t/s
22.1 GBA81, Runs well
Hy Memory 30B A3B
Q4_K_M·183.5 t/s
19.1 GBS99, Runs great
Qwen3.5 4B
Q4_K_M·201.0 t/s
3.4 GBS100, Runs great
Ornith 1.5 35B A3B
Q4_K_M·151.0 t/s
22.0 GBA79, Runs well
Gemma 4 12B IT
Q4_K_M·79.6 t/s
9.0 GBS88, 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.