★ Reading this for free? Get 25 structured AI courses + per-chapter AI tutor — the first chapter of every course free, no card.Start free in 30 secondsOr own every course: $149 once
Model Comparison

Mistral vs Llama 3.2 vs CodeLlama: Which to Run Locally

October 28, 2025
12 min read
Barsha Mohapatra

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.

📚AI Learning Path

Go from reading about AI to building with AI 25 structured courses. Hands-on projects. Runs on your machine. Start free.

Start free
Or own it for life — Lifetime $149, pay once

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:

FeatureLlama 3.2 3BLlama 3.1 8BMistral 7BCode Llama 7B / 13B
ReleasedSeptember 2024July 2024September 2023 (v0.3: May 2024)August 2023
Best ForSmall machines, quick tasksGeneral tasks, reasoningSpeed, permissive licenseLegacy code workflows
Ollama download2.0GB (llama3.2:3b)4.9GB (llama3.1:8b)4.4GB (mistral:7b)3.8GB / 7.4GB (codellama:7b / :13b)
Context128K128K32K16K trained, up to 100K
Measured speed (M3 Pro 18GB)55.6 tok/s27.2 tok/s29.0 tok/snot measured (~39 tok/s ceiling for 7B)
CreatorMeta AIMeta AIMistral AIMeta AI
LicenseLlama 3.2 CommunityLlama 3.1 CommunityApache 2.0Llama 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 situationPickCommand
8GB laptop, general chatLlama 3.2 3Bollama run llama3.2:3b
8-16GB, best quality of the threeLlama 3.1 8Bollama run llama3.1:8b
Want Apache 2.0 or the fastest 7BMistral 7Bollama run mistral:7b
Existing Code Llama prompts or fine-tunesCode Llama 7B / 13Bollama run codellama:7b
New coding projectQwen2.5 Coder 7Bollama run qwen2.5-coder:7b

Table of Contents

  1. Model Overview & History
  2. Technical Specifications
  3. Performance Benchmarks
  4. Use Case Comparisons
  5. Memory & Hardware Requirements
  6. Installation & Setup Guide
  7. What to Run in November 2026
  8. 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 mistral tag 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.


Own it instead of renting it

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

SpecLlama 3.2 3BLlama 3.1 8BMistral 7BCode Llama 7B
Parameters3.2B8.0B7.2B6.7B
BaseLlama 3Llama 3Own architectureLlama 2
AttentionGrouped-queryGrouped-queryGrouped-query + sliding window (4,096)Multi-head
Layers28323232
Context128K128K32K (v0.3)16K trained, up to 100K
Vocabulary128K tokens128K tokens32,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

FamilySizes on OllamaDefault download
Llama 3.21B, 3B (text); 11B, 90B (vision, as llama3.2-vision)llama3.2:3b 2.0GB
Llama 3.18B, 70B, 405Bllama3.1:8b 4.9GB
Mistral7Bmistral:7b 4.4GB
Code Llama7B, 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):

ModelMMLUHellaSwagARC-ChallengeTriviaQAGSM8K
Llama 2 7B44.477.143.263.816.0
Llama 2 13B55.680.748.869.634.3
Code Llama 7B36.962.934.534.920.8
Mistral 7B60.181.355.569.952.2

From Meta's Llama 3.2 model card (instruction-tuned models):

ModelMMLUGSM8K (CoT)MATH (CoT)ARC-CIFEval
Llama 3.2 1B49.344.430.659.459.5
Llama 3.2 3B63.477.748.078.677.4
Llama 3.1 8B69.484.551.983.480.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

ModelHumanEvalMBPPSource
Llama 2 7B11.626.1Mistral 7B paper
Llama 2 13B18.935.4Mistral 7B paper
Code Llama 7B31.152.5Mistral 7B paper
Mistral 7B30.547.5Mistral 7B paper
Llama 3.1 8B Instruct72.6—Meta model card
Code Llama (best, 70B)up to 67up to 65Code 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)QuantFileMeasured tok/sCeiling (150 GB/s ÷ file)
Llama 3.2 3B (llama3.2:3b)Q4_K_M2.0GB55.6~74
Mistral 7B (mistral:7b)Q4_K_M4.4GB29.0~34
Llama 3.1 8B (llama3.1:8b)Q4_K_M4.9GB27.2~30
Code Llama 7B (codellama:7b)Q4_03.8GBnot 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

ModelOllama download (Q4)Comfortable total memory
Llama 3.2 3B2.0GB8GB
Code Llama 7B3.8GB8GB
Mistral 7B4.4GB8GB
Llama 3.1 8B4.9GB8-16GB
Code Llama 13B7.4GB16GB
Code Llama 34B19.1GB24GB GPU or 32GB Mac
Code Llama 70B38.9GB48GB+

Add 1-2GB for context at Ollama's default settings, more if you raise num_ctx.

Performance by Hardware Configuration

HardwareBandwidthLlama 3.2 3BMistral 7BLlama 3.1 8B
Apple M3 Pro 18GB150 GB/s55.6 measured29.0 measured27.2 measured
Apple M2 16GB100 GB/s~50 ceiling~23 ceiling~20 ceiling
RTX 3060 12GB360 GB/s~178 ceiling~82 ceiling~73 ceiling
RTX 4090 24GB1,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:

NeedCurrent pickDownloadCommand
Small MistralMinistral 3 8B6.0GBollama pull ministral-3:8b
Mid-size MistralMistral Small 3.2 24B15GBollama pull mistral-small3.2:24b
Mistral reasoningMagistral 24B14GBollama pull magistral:24b
Mistral coding agentDevstral 24B14GBollama pull devstral:24b
Large LlamaLlama 3.3 70B42.5GBollama pull llama3.3:70b
Newest LlamaLlama 4 Scout (MoE)67GBollama pull llama4:scout
Coding (replaces Code Llama)Qwen2.5 Coder 7B4.7GBollama 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.

🎯
AI Learning Path

Go from reading about AI to building with AI

25 structured courses. Hands-on projects. Runs on your machine. Start free.

Or own it for life — Lifetime $149 $599, pay once

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.

Reading now
Join the discussion
TagsLlamaMistralCodeLlamaComparisonBenchmarksPerformanceAI Models

Barsha Mohapatra

Local AI Master writes hands-on courses and hardware guides for running AI on machines you own. Content is checked against current releases and corrected when readers tell us it is wrong.

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.

AI Learning Path

Comments (0)

No comments yet. Be the first to share your thoughts!

📅 Published: October 28, 2025🔄 Last Updated: November 2, 2026✓ Manually Reviewed
Barsha Mohapatra

Written by

Barsha Mohapatra

Founder and Editor, Local AI Master · Founder, Little AI Master

Founder of Little AI Master and the editor behind every course and guide on Local AI Master. Years of tutoring students taught her where AI education actually fails.

Was this helpful?

Dive Deeper

📚
Free · no account required

Grab the AI Starter Kit — career roadmap, cheat sheet, setup guide

No spam. Unsubscribe with one click.

🎯
AI Learning Path

Go from reading about AI to building with AI

25 structured courses. Hands-on projects. Runs on your machine. Start free.

Or own it for life — Lifetime $149 $599, pay once
Free Tools & Calculators