The RTX 4070’s 12 GB of VRAM is a hard ceiling: plenty to run 7–8B models at speed, but no room for slop. This comparison pits Llama 3.1 8B, Mistral 7B v0.3, and Phi-3 Medium against that ceiling—what fits, how fast it runs, and where quality holds up.

The Hardware Baseline

Benchmarks use a single RTX 4070 12 GB running llama.cpp b3516, CUDA acceleration, flash attention, and no offloading to system RAM unless otherwise noted. Test prompt: 300-token context, 256 new tokens generated, batch size 512. Windows 11, driver 560.70. Quantization formats follow standard GGUF K-quants and fp16 where VRAM allows.

Memory pressure is the real bottleneck. Typical idle VRAM overhead is ~0.8 GB, leaving roughly 11.2 GB for weights, KV cache, and working buffers. An fp16 8B model consumes about 16 GB and will spill, so the practical fight is between 4-bit, 5-bit, and aggressive 6-bit quants. Q8_0 nearly fits but demands a short context.

Models and Quantizations Tested

Three base models, each from official sources:

  • Llama 3.1 8B (Meta, 128k native context) in Q4_K_M, IQ4_XS, Q5_K_M, Q6_K, and Q8_0.
  • Mistral 7B v0.3 (Mistral AI, 32k sliding window) in the same quant ranges, plus fp16.
  • Phi-3 Medium (Microsoft, 14B parameters but 4-bit native training) in Q4_0, Q4_K_M converted, and Q6_K.

Mistral’s smaller parameter count (7.24B) gives it a VRAM advantage. Llama 3.1’s larger vocabulary and grouped-query attention shift the compute-per-byte trade-off. Phi-3 Medium is the wildcard: a dense 14B that claims to run like a 7B in 4-bit, but with the memory footprint of its full parameter count.

Raw Throughput: Tokens Per Second

Sustained generation throughput (tokens/s) under the 300-token prompt. Prompt processing time adds 0.3–0.8 seconds depending on quant but varies less.

Model Quant Tokens/s (256 gen) VRAM Use (GB) Notes
Llama 3.1 8B Q4_K_M 78.2 5.8 Default choice
Llama 3.1 8B IQ4_XS 80.1 5.5 Slightly smaller, marginally faster
Llama 3.1 8B Q5_K_M 72.4 6.5 Quality bump
Llama 3.1 8B Q6_K 65.7 7.4 VRAM-hungry but good
Llama 3.1 8B Q8_0 56.9 8.8 Near-fp16 quality, tight fit
Mistral 7B v0.3 Q4_K_M 86.3 5.2 Fastest 4-bit
Mistral 7B v0.3 Q5_K_M 79.8 5.9 Sweet spot
Mistral 7B v0.3 Q6_K 73.1 6.8
Mistral 7B v0.3 Q8_0 64.2 8.1
Mistral 7B v0.3 fp16 48.7 13.8 Spills to shared memory—avoid
Phi-3 Medium (4-bit native) Q4_0 44.5 8.1 Slower, larger memory
Phi-3 Medium Q4_K_M (converted) 43.8 8.4 Nearly identical
Phi-3 Medium Q6_K 35.2 11.1 Only fits with trimmed context

Llama 3.1’s tokenizer produces more tokens per unit of English text than Mistral, so raw tokens/s slightly understates its true throughput. For short generations, Mistral’s higher raw speed usually yields comparable word-level throughput.

VRAM Consumption at Each Quantization

VRAM at rest (model loaded + 512-token context) highlights remaining headroom for longer contexts or larger batch sizes.

Quant Llama 3.1 8B Mistral 7B v0.3 Phi-3 Medium
Q4_K_M 5.8 GB 5.2 GB 8.4 GB
IQ4_XS 5.5 GB 5.0 GB
Q5_K_M 6.5 GB 5.9 GB
Q6_K 7.4 GB 6.8 GB 11.1 GB
Q8_0 8.8 GB 8.1 GB

Phi-3 Medium’s 4-bit quant already eats 8+ GB because the parameter count is double. It runs, but any large system prompt or RAG context will strain the card. Mistral Q4_K_M leaves nearly 7 GB free—plenty for 32k context and then some. The 12 GB capacity, not bandwidth, is the primary limit.

Quality Trade-offs: What the Numbers Don’t Show

Observations from synthetic benchmarks—Python code generation, product description rewrites, multi-turn reasoning with math—focused on coherence, repetition, and factual sticking.

  • Llama 3.1 8B Q4_K_M: Surprising instruction following at 4-bit. Within 8k context it’s hard to distinguish from 6-bit; past 16k it occasionally loses the thread. IQ4_XS introduces slight word repetition in long output, but it’s tolerable for chat.
  • Mistral 7B Q4_K_M: A hair less coherent than Llama 3.1 at 4-bit, with more formatting drift in code. Q5_K_M closes that gap completely. For creative prose, Q4 is still excellent; for structured output, bump to Q5.
  • Phi-3 Medium 4-bit: Holds up remarkably for a 14B model at 4-bit. Reasoning and factual recall far exceed the 7B models. It’s the only one here that can handle a 20-step logical deduction without hallucinating midway. The trade-off: slower, higher memory use, and a chatty tokenizer that produces more tokens to say the same thing.
  • fp16 Mistral: Reference quality, but the 4070 can’t hold it all; once offloading kicks in (8–12 tok/s), it’s worse than Q8_0.

For the RTX 4070, treat Q5_K_M as the ceiling for 8B models unless you’re running a 4k context or willing to offload. That gives the closest to reference quality without dramatic performance cliffs.

When Each Model Earns Its Keep

Pick Llama 3.1 8B Q4_K_M if: you need the Meta ecosystem (tool calling, JSON mode), multilingual output, or the longest native context window. The extra training translates to better steerability.

Pick Mistral 7B Q5_K_M if: speed is king and your use case is English-dominant code generation, summarization, or drafting. You’ll hit near-80 tok/s with quality indistinguishable from unquantized for most tasks.

Pick Phi-3 Medium 4-bit if: reasoning depth matters more than throughput, and you can accept 35–45 tok/s. It’s the only model here that will genuinely surprise with logical leaps. Keep context under 4k tokens for acceptable speed.

Conclusion

The RTX 4070’s 12 GB forces honesty: fp16 8B models don’t fit without pain, and a 14B dense model in 4-bit costs both speed and capacity. Llama 3.1 Q4_K_M is the practical default—it balances speed, quality, and ecosystem support. Mistral 7B Q5_K_M pulls ahead on raw throughput and leaves plenty of VRAM for context. Phi-3 Medium is the specialist’s tool: when a task needs actual thinking, not just reacting, it’s the only choice that delivers. In every case, check your VRAM headroom first, then decide how many bits matter.