Can I run Llama 3.1 8B on the GeForce RTX 4070?

Runs greatQ4_K_M fits in VRAM with 4.8 GB to spare: Runs great, est. 58.9 tok/s (51.8–65.9, calibrated estimate ±12%).

12 GB VRAM · 504.0 GB/s · FP16 29.1 TFLOPS. Assumes 32 GB of DDR5-5600 system RAM, Windows with this GPU driving the display, 8k context and an f16 KV cache. The GeForce RTX 4070 Super has the same memory setup (12 GB, 504.0 GB/s), so its generation-speed estimate is the same; only prompt processing differs. Prompt processing: about 4,074 tok/s (2,444–5,704, rough estimate ±40%) here vs about 4,970 tok/s (2,982–6,958, rough estimate ±40%) on the GeForce RTX 4070 Super.

Every quant of Llama 3.1 8B on the GeForce RTX 4070

4 tracked GGUF files, smallest first, at 8k context
QuantFile sizeVerdictSpeedMemoryRuns asNotes
Q2_K3.18 GBRuns great
est. 82.9 tok/s73.0–92.9calibrated estimate ±12%
5.4 / 12.0 GBFull GPU—
IQ4_XS4.45 GBRuns great
est. 63.9 tok/s56.2–71.5calibrated estimate ±12%
6.7 / 12.0 GBFull GPU—
Q4_K_Mbaseline4.92 GBRuns great
est. 58.9 tok/s51.8–65.9calibrated estimate ±12%
7.2 / 12.0 GBFull GPU—
Q8_08.54 GBRuns great
est. 36.7 tok/s32.3–41.1calibrated estimate ±12%
10.8 / 12.0 GBFull GPU—

Where the memory goes at Q4_K_M

Weights, KV cache and compute buffer are the model; the OS reservation is the display driver.
GPU memory
Weights
4.9 GB
KV cache
1.1 GB
Compute buffer
0.6 GB
OS reserve
0.6 GB
Free
4.8 GB

Context length vs. KV cache

KV cache

Memory needed and verdict at Q4_K_M for each context length and KV cache type, with estimated tokens per second.
ContextKV f16KV q8_0KV q4_0
4k
6.0 GBRuns great
est. 64.7 tok/s56.9–72.4calibrated estimate ±12%
5.7 GBRuns great
est. 67.8 tok/s59.6–75.9calibrated estimate ±12%
5.6 GBRuns great
est. 69.5 tok/s61.2–77.9calibrated estimate ±12%
8k
6.6 GBRuns great
est. 58.9 tok/s51.8–65.9calibrated estimate ±12%
6.1 GBRuns great
est. 64.2 tok/s56.5–71.9calibrated estimate ±12%
5.8 GBRuns great
est. 67.5 tok/s59.4–75.6calibrated estimate ±12%
16k
7.7 GBRuns great
est. 49.9 tok/s43.9–55.9calibrated estimate ±12%
6.7 GBRuns great
est. 58.1 tok/s51.2–65.1calibrated estimate ±12%
6.2 GBRuns great
est. 63.8 tok/s56.1–71.4calibrated estimate ±12%
32k
10.0 GBRuns great
est. 38.3 tok/s33.7–42.9calibrated estimate ±12%
8.0 GBRuns great
est. 48.9 tok/s43.0–54.7calibrated estimate ±12%
6.9 GBRuns great
est. 57.4 tok/s50.5–64.3calibrated estimate ±12%
64k
14.6 GBRuns slowly
est. 4.8 tok/s3.8–5.7calibrated estimate ±20%
10.6 GBRuns great
est. 37.1 tok/s32.6–41.5calibrated estimate ±12%
8.5 GBRuns great
est. 47.9 tok/s42.1–53.6calibrated estimate ±12%
128k
22.1 GBRuns slowly
est. 2.0 tok/s1.6–2.4calibrated estimate ±20%
15.8 GBRuns slowly
est. 3.5 tok/s2.8–4.2calibrated estimate ±20%
11.5 GBRuns well
est. 30.9 tok/s24.7–37.1calibrated estimate ±20%

S = Runs great · A = Runs well · B = Runs slowly · F = Won't run

At Q4_K_M the verdict stays Runs great up to 32k context with an f16 KV cache, and up to 64k with q8_0.

Estimated speed

Generation
est. 58.9 tok/s (51.8–65.9, calibrated estimate ±12%)
Prompt processing
about 4,074 tok/s (2,444–5,704, rough estimate ±40%)

Measured on this exact combination

No public measurement for this exact combination yet; the numbers above are estimates.

If this is not enough

How to run it

Commands for the Q4_K_M file. Both tools download from Hugging Face on first run.

File: Meta-Llama-3.1-8B-Instruct-Q4_K_M.gguf (4.92 GB) from bartowski/Meta-Llama-3.1-8B-Instruct-GGUF.

llama.cpp
llama-server -hf bartowski/Meta-Llama-3.1-8B-Instruct-GGUF:Q4_K_M -c 8192 -ngl all -fa on
  • -ngl all loads every layer on the GPU.
  • -fa on enables flash attention (needed for KV cache quantization).
  • --cache-type-k q8_0 --cache-type-v q8_0 shrinks the KV cache to 0.57 GB at 8k context.
Ollama

PowerShell (quit the Ollama tray app first):

$env:OLLAMA_CONTEXT_LENGTH="8192"; ollama serve
ollama run hf.co/bartowski/Meta-Llama-3.1-8B-Instruct-GGUF:Q4_K_M
  • Ollama defaults to 4k context on GPUs under 24 GB. Set OLLAMA_CONTEXT_LENGTH when starting the server, or /set parameter num_ctx inside the chat.
  • /set parameter num_ctx 8192

Related pages

Frequently asked questions

Can I run Llama 3.1 8B on the GeForce RTX 4070?

Q4_K_M fits in VRAM with 4.8 GB to spare: Runs great, est. 58.9 tok/s (51.8–65.9, calibrated estimate ±12%). Q4_K_M needs 6.6 GB at 8k context; this setup has 11.4 GB of usable memory and 28.0 GB of free system RAM.

How much context can Llama 3.1 8B use on the GeForce RTX 4070?

At Q4_K_M the verdict stays Runs great up to 32k context with an f16 KV cache (4.3 GB of KV) and up to 64k with a q8_0 KV cache (4.6 GB). The model supports up to 128k.

Which quant should I use, and how fast is it?

Q4_K_M (4.92 GB) is the recommended balance: Runs great, est. 58.9 tok/s (51.8–65.9, calibrated estimate ±12%). The largest tracked file that still gets Runs great is Q8_0 (8.54 GB), est. 36.7 tok/s (32.3–41.1, calibrated estimate ±12%).

Speeds are estimates from memory bandwidth, calibrated against public benchmarks, and each one comes with an error band and a confidence label. Real results vary with drivers, backend, context length and thermals.