Mistral vs Llama 3.2 vs CodeLlama: Which to Run Locally
Want to go deeper than this article?
Free account unlocks the first chapter of all 25 courses — RAG, agents, MCP, voice AI, MLOps, real GitHub repos.
Go from reading about AI to building with AI 25 structured courses. Hands-on projects. Runs on your machine. Start free.
Published on October 28, 2025 • Updated November 2, 2026 • 12 min read
Llama, Mistral and Code Llama are the three model families most people meet first in Ollama. This comparison sticks to what can be checked: the benchmark scores each vendor published, the file sizes Ollama actually downloads, generation speeds we measured on one real machine, and the licenses. It ends with what to run instead now that all three have newer successors.
Llama vs Mistral vs CodeLlama: Which is Best?
For general tasks, Llama 3.1 8B is best (69.4 MMLU and 72.6 HumanEval in Meta's model card, 128K context, 4.9GB download). For a slightly faster, Apache 2.0 model, Mistral 7B (4.4GB, 32K context). For small machines, Llama 3.2 3B (2.0GB). Code Llama is no longer the coding pick: newer general models beat it on code benchmarks.
Quick Comparison:
| Feature | Llama 3.2 3B | Llama 3.1 8B | Mistral 7B | Code Llama 7B / 13B |
|---|---|---|---|---|
| Released | September 2024 | July 2024 | September 2023 (v0.3: May 2024) | August 2023 |
| Best For | Small machines, quick tasks | General tasks, reasoning | Speed, permissive license | Legacy code workflows |
| Ollama download | 2.0GB (llama3.2:3b) | 4.9GB (llama3.1:8b) | 4.4GB (mistral:7b) | 3.8GB / 7.4GB (codellama:7b / :13b) |
| Context | 128K | 128K | 32K | 16K trained, up to 100K |
| Measured speed (M3 Pro 18GB) | 55.6 tok/s | 27.2 tok/s | 29.0 tok/s | not measured (~39 tok/s ceiling for 7B) |
| Creator | Meta AI | Meta AI | Mistral AI | Meta AI |
| License | Llama 3.2 Community | Llama 3.1 Community | Apache 2.0 | Llama 2 Community |
Winner: Depends on use case
- Most users: Llama 3.1 8B (best all-around)
- Need speed or Apache 2.0: Mistral 7B
- Low memory: Llama 3.2 3B
- Developers: a current coding model — see best local AI models for programming
Reading articles is good. Building is better.
Free account = the first chapter of all 25 courses, with a per-chapter AI tutor. No card.
🎯 Quick Decision Selector: Which Model Should You Choose?
| Your situation | Pick | Command |
|---|---|---|
| 8GB laptop, general chat | Llama 3.2 3B | ollama run llama3.2:3b |
| 8-16GB, best quality of the three | Llama 3.1 8B | ollama run llama3.1:8b |
| Want Apache 2.0 or the fastest 7B | Mistral 7B | ollama run mistral:7b |
| Existing Code Llama prompts or fine-tunes | Code Llama 7B / 13B | ollama run codellama:7b |
| New coding project | Qwen2.5 Coder 7B | ollama run qwen2.5-coder:7b |
Table of Contents
- Model Overview & History
- Technical Specifications
- Performance Benchmarks
- Use Case Comparisons
- Memory & Hardware Requirements
- Installation & Setup Guide
- What to Run in November 2026
- Final Recommendations
Model Overview & History
Llama Family - Meta's Foundation
Development Timeline:
- LLaMA 1 (Feb 2023): Initial release, 7B-65B parameters
- Llama 2 (Jul 2023): Improved training, commercial license
- Code Llama (Aug 2023): Code-specialized variant
- Llama 3 (Apr 2024): Major architecture improvements
- Llama 3.1 (Jul 2024): 128K context, 405B flagship
- Llama 3.2 (Sep 2024): Vision models (11B, 90B) and small text models (1B, 3B)
- Llama 3.3 (Dec 2024): 70B text model
- Llama 4 (Apr 2025): Mixture-of-experts models (Scout, Maverick)
Meta's research on Llama models is documented in the original LLaMA paper and the Llama 2 research paper. Llama 3.2 3B was trained on up to 9 trillion tokens and officially supports eight languages (English, German, French, Italian, Portuguese, Hindi, Spanish and Thai), per Meta's model card.
Mistral Family - European Innovation
Development Timeline:
- Mistral 7B (Sep 2023): Debut model, Apache 2.0
- Mixtral 8x7B (Dec 2023): Mixture-of-experts architecture
- Mistral Large (Feb 2024): API flagship
- Mistral 7B v0.3 (May 2024): Extended vocabulary and function calling — the version Ollama's
mistraltag serves - Mistral NeMo (Jul 2024): 12B, built with NVIDIA
- Mistral Small 3.x, Magistral, Devstral (2025): 24B models for general use, reasoning and agentic coding
Mistral AI publishes model cards for each release in its Hugging Face collection. The Mistral 7B paper reports that it beat Llama 2 13B on every benchmark the authors evaluated.
CodeLlama Family - Programming Specialist
Development Timeline:
- Code Llama 7B, 13B, 34B (Aug 2023): Based on Llama 2, code-focused
- Code Llama - Instruct (Aug 2023): Instruction-tuned variant
- Code Llama - Python (Aug 2023): Python-specialized versions, including the lightweight Code Llama Python 7B
- Code Llama 70B (Jan 2024): The largest and last release; Meta's paper reports up to 67% on HumanEval for the family
The Code Llama paper describes training on 16K-token sequences with stable behaviour on inputs up to 100K tokens.
Run this on your own machine and stop paying every month
Pay once and keep it. No renewal, no per-token bill, and nothing you feed it ever leaves your hardware.
Technical Specifications
Architecture Comparison
| Spec | Llama 3.2 3B | Llama 3.1 8B | Mistral 7B | Code Llama 7B |
|---|---|---|---|---|
| Parameters | 3.2B | 8.0B | 7.2B | 6.7B |
| Base | Llama 3 | Llama 3 | Own architecture | Llama 2 |
| Attention | Grouped-query | Grouped-query | Grouped-query + sliding window (4,096) | Multi-head |
| Layers | 28 | 32 | 32 | 32 |
| Context | 128K | 128K | 32K (v0.3) | 16K trained, up to 100K |
| Vocabulary | 128K tokens | 128K tokens | 32,768 (v0.3) | 32,016 |
Mistral 7B figures from Table 1 of its paper (32 layers, 32 heads, 8 KV heads, 4,096 window); Llama figures from Meta's model cards and configs.
Model Variants & Sizes
| Family | Sizes on Ollama | Default download |
|---|---|---|
| Llama 3.2 | 1B, 3B (text); 11B, 90B (vision, as llama3.2-vision) | llama3.2:3b 2.0GB |
| Llama 3.1 | 8B, 70B, 405B | llama3.1:8b 4.9GB |
| Mistral | 7B | mistral:7b 4.4GB |
| Code Llama | 7B, 13B, 34B, 70B (+ instruct, python, code variants) | codellama:7b 3.8GB; 13B 7.4GB; 34B 19.1GB; 70B 38.9GB |
Sizes from the Ollama registry, November 2, 2026.
Performance Benchmarks
General Language Understanding
From the Mistral 7B paper (Table 2, pretrained models, October 2023):
| Model | MMLU | HellaSwag | ARC-Challenge | TriviaQA | GSM8K |
|---|---|---|---|---|---|
| Llama 2 7B | 44.4 | 77.1 | 43.2 | 63.8 | 16.0 |
| Llama 2 13B | 55.6 | 80.7 | 48.8 | 69.6 | 34.3 |
| Code Llama 7B | 36.9 | 62.9 | 34.5 | 34.9 | 20.8 |
| Mistral 7B | 60.1 | 81.3 | 55.5 | 69.9 | 52.2 |
From Meta's Llama 3.2 model card (instruction-tuned models):
| Model | MMLU | GSM8K (CoT) | MATH (CoT) | ARC-C | IFEval |
|---|---|---|---|---|---|
| Llama 3.2 1B | 49.3 | 44.4 | 30.6 | 59.4 | 59.5 |
| Llama 3.2 3B | 63.4 | 77.7 | 48.0 | 78.6 | 77.4 |
| Llama 3.1 8B | 69.4 | 84.5 | 51.9 | 83.4 | 80.4 |
The two tables use different setups (pretrained vs instruction-tuned, different shots), so compare within a table, not across them. The direction is clear anyway: Mistral 7B was a big step past Llama 2, and the Llama 3 generation moved past Mistral 7B.
Code Generation Benchmarks
| Model | HumanEval | MBPP | Source |
|---|---|---|---|
| Llama 2 7B | 11.6 | 26.1 | Mistral 7B paper |
| Llama 2 13B | 18.9 | 35.4 | Mistral 7B paper |
| Code Llama 7B | 31.1 | 52.5 | Mistral 7B paper |
| Mistral 7B | 30.5 | 47.5 | Mistral 7B paper |
| Llama 3.1 8B Instruct | 72.6 | — | Meta model card |
| Code Llama (best, 70B) | up to 67 | up to 65 | Code Llama paper |
Is Llama 3.2 good for coding? Meta does not publish a HumanEval score for Llama 3.2 3B. For code, Llama 3.1 8B is the better of Meta's small models, and dedicated coders such as Qwen2.5 Coder are stronger still.
Multilingual Performance
Llama 3.1 and 3.2 officially support eight languages: English, German, French, Italian, Portuguese, Hindi, Spanish and Thai. Mistral 7B was not released with an official language list; it handles the major European languages but was trained mainly on English. Code Llama is English and code only.
Inference Speed Comparison
These are the speeds we measured ourselves on our own machine: Apple M3 Pro with 18GB of unified memory (150 GB/s), Ollama 0.40.13, median of 6 runs after a warm-up, 2 November 2026.
| Model (Ollama tag) | Quant | File | Measured tok/s | Ceiling (150 GB/s ÷ file) |
|---|---|---|---|---|
Llama 3.2 3B (llama3.2:3b) | Q4_K_M | 2.0GB | 55.6 | ~74 |
Mistral 7B (mistral:7b) | Q4_K_M | 4.4GB | 29.0 | ~34 |
Llama 3.1 8B (llama3.1:8b) | Q4_K_M | 4.9GB | 27.2 | ~30 |
Code Llama 7B (codellama:7b) | Q4_0 | 3.8GB | not measured | ~39 |
On other hardware, the ceiling scales with memory bandwidth: an RTX 3060 12GB (360 GB/s) has a ~82 tok/s ceiling for Mistral 7B and ~73 for Llama 3.1 8B; an RTX 4090 (1,008 GB/s) ~230 and ~205. Real speed lands below the ceiling. On a rented NVIDIA L4 (24 GB, 300 GB/s) the same three tags measured 103.0 tok/s for Llama 3.2 3B, 53.2 for Mistral 7B and 49.2 for Llama 3.1 8B (Ollama 0.40.13, 3 November 2026; every row is on /benchmarks).
Quality vs Speed Analysis
The measured gap between Mistral 7B and Llama 3.1 8B is about 7% in speed, while Llama 3.1 8B leads clearly on Meta's published benchmarks. Unless you need the Apache 2.0 license, the extra quality usually wins. Llama 3.2 3B is roughly twice as fast as either, at a real cost in knowledge (63.4 vs 69.4 MMLU in Meta's card).
Use Case Comparisons
General Conversation & Q&A
Pick: Llama 3.1 8B. Highest benchmark scores of the group and a 128K context. Llama 3.2 3B is fine for quick questions on a small machine.
Code Generation Tasks
Pick: Llama 3.1 8B over Code Llama 7B, or better, a current coding model. Code Llama still fills in code from a prefix and suffix (fill-in-the-middle) via its codellama:7b-code tags, which some editor setups rely on, but for chat-style coding the newer models are well ahead.
Creative Writing
Pick: Llama 3.1 8B for longer pieces, Mistral 7B for short drafts and brainstorming. For current options, see our guide to the best local AI models for writing.
Technical Documentation
Pick: Llama 3.1 8B. It reads long inputs (raise Ollama's num_ctx) and follows formatting instructions well (80.4 IFEval in Meta's card).
Multilingual Tasks
Pick: Llama 3.1 8B for the eight officially supported languages. For broader language coverage, newer families such as Qwen are trained on far more languages.
Memory & Hardware Requirements
RAM Requirements by Model
| Model | Ollama download (Q4) | Comfortable total memory |
|---|---|---|
| Llama 3.2 3B | 2.0GB | 8GB |
| Code Llama 7B | 3.8GB | 8GB |
| Mistral 7B | 4.4GB | 8GB |
| Llama 3.1 8B | 4.9GB | 8-16GB |
| Code Llama 13B | 7.4GB | 16GB |
| Code Llama 34B | 19.1GB | 24GB GPU or 32GB Mac |
| Code Llama 70B | 38.9GB | 48GB+ |
Add 1-2GB for context at Ollama's default settings, more if you raise num_ctx.
Performance by Hardware Configuration
| Hardware | Bandwidth | Llama 3.2 3B | Mistral 7B | Llama 3.1 8B |
|---|---|---|---|---|
| Apple M3 Pro 18GB | 150 GB/s | 55.6 measured | 29.0 measured | 27.2 measured |
| Apple M2 16GB | 100 GB/s | ~50 ceiling | ~23 ceiling | ~20 ceiling |
| RTX 3060 12GB | 360 GB/s | ~178 ceiling | ~82 ceiling | ~73 ceiling |
| RTX 4090 24GB | 1,008 GB/s | ~499 ceiling | ~231 ceiling | ~205 ceiling |
Ceilings are bandwidth ÷ file size, upper bounds rather than measurements. Small models rarely get close to their ceiling, because fixed per-token overheads matter more.
GPU Acceleration Impact
Ollama uses the GPU automatically when the whole model fits in VRAM, and splits layers between GPU and system RAM when it does not. A split model runs at a speed closer to the system-RAM side, so keep the model plus context inside VRAM. ollama ps shows how much of a loaded model sits on the GPU.
Installation & Setup Guide
Quick Start: All Three Models
# Install Ollama first (macOS/Linux)
curl -fsSL https://ollama.com/install.sh | sh
# Install the "big three" models
ollama pull llama3.1:8b # 4.9GB - general use
ollama pull mistral:7b # 4.4GB - fast, Apache 2.0
ollama pull codellama:7b # 3.8GB - legacy code model
# Test each model
ollama run llama3.1:8b "Explain recursion in two sentences."
ollama run mistral:7b "Draft a polite meeting decline."
ollama run codellama:7b "Write a Python function that reverses a string."
Memory-Optimized Installation (8GB Systems)
# Smallest useful options
ollama pull llama3.2:3b # 2.0GB
ollama pull llama3.2:1b # 1.3GB
# Keep only one model loaded at a time
export OLLAMA_MAX_LOADED_MODELS=1
High-Performance Installation (32GB+ Systems)
ollama pull codellama:34b # 19.1GB
ollama pull mixtral:8x7b # 26GB, Mistral's mixture-of-experts model
ollama pull llama3.3:70b # 42.5GB, needs 48GB+
What to Run in November 2026
All three families have newer successors in the Ollama library. If you are choosing today rather than maintaining an existing setup:
| Need | Current pick | Download | Command |
|---|---|---|---|
| Small Mistral | Ministral 3 8B | 6.0GB | ollama pull ministral-3:8b |
| Mid-size Mistral | Mistral Small 3.2 24B | 15GB | ollama pull mistral-small3.2:24b |
| Mistral reasoning | Magistral 24B | 14GB | ollama pull magistral:24b |
| Mistral coding agent | Devstral 24B | 14GB | ollama pull devstral:24b |
| Large Llama | Llama 3.3 70B | 42.5GB | ollama pull llama3.3:70b |
| Newest Llama | Llama 4 Scout (MoE) | 67GB | ollama pull llama4:scout |
| Coding (replaces Code Llama) | Qwen2.5 Coder 7B | 4.7GB | ollama pull qwen2.5-coder:7b |
For a ranked list across every family, see best Ollama models.
Final Recommendations
Choose Llama 3.1 8B If:
- You want the best quality of these three on 8-16GB of memory
- You need long context (128K)
- You work in one of Meta's eight supported languages
Choose Mistral 7B If:
- You need an Apache 2.0 license with no usage thresholds
- You want the slightly faster 7B and accept lower benchmark scores
Choose Llama 3.2 3B If:
- You are on an 8GB laptop or want the fastest responses
Choose Code Llama If:
- You maintain prompts, fine-tunes or editor integrations built on it; otherwise use a current coding model
Conclusion
Each model had its moment: Mistral 7B showed a 7B could beat Llama 2 13B, Code Llama brought code-specialised models to local machines, and Llama 3.1 8B raised the bar for small general models. In November 2026, Llama 3.1 8B remains the best of the three for general use, Mistral 7B the Apache-licensed alternative, and Code Llama a legacy choice. For new projects, start from the current picks above.
Go from reading about AI to building with AI
25 structured courses. Hands-on projects. Runs on your machine. Start free.
Liked this? 25 full AI courses are waiting.
From fundamentals to RAG, agents, MCP servers, voice AI, and production deployment with real GitHub repos. First chapter free, every course.
Build Real AI on Your Machine
RAG, agents, NLP, vision, and MLOps - chapters across 25 courses that take you from reading about AI to building AI.
Want the structured version?
Hands-on courses on local AI, from $8.99 a month. The first chapter of each is free.
Keep going
Comments (0)
No comments yet. Be the first to share your thoughts!
