Β
π Lesson: Comparing LLMs β Which Model to Use and When?
π― Lesson Objective
By the end of this lesson, you’ll be able to:
-
Choose the right local LLM for your task (text, code, chat, etc.)
-
Understand trade-offs between speed, accuracy, and memory usage
-
Decide when to use Mistral, LLaMA3, CodeLLaMA, DeepSeek, etc.
π§ Why Choosing the Right Model Matters
Choosing the right model helps you:
-
β Get faster responses (especially on low-RAM systems)
-
β Save computing resources
-
β Improve the quality of results (e.g., for summarizing vs. coding)
βοΈ Comparison Table of Top Open-Source Models in Ollama
| Model | Type | Strengths | RAM (min) | Speed | Best For |
|---|---|---|---|---|---|
mistral |
General LLM | Fast, balanced, low resource | 8 GB | β‘β‘β‘ | General chat, summarizing, QA |
llama3 |
General LLM | More accurate, deeper reasoning | 16 GB | β‘β‘ | Complex Q&A, deeper text generation |
codellama |
Code-focused | Excellent code completion & explanation | 12β16 GB | β‘β‘ | Programming agents, code review |
deepseek-coder |
Code LLM | Natural + powerful for coding | 12β16 GB | β‘β‘ | Dev assistants, coding chatbots |
orca-mini |
Lightweight | Super light, fast, low-quality tradeoff | 4β8 GB | β‘β‘β‘β‘ | Embedded use, chat with small docs |
gemma |
Google LLM | Fast, multilingual | 8β12 GB | β‘β‘β‘ | Multilingual tasks, summaries |
phi |
Small LLM | Simple reasoning | 6β8 GB | β‘β‘β‘ | Education, lightweight systems |
π Model Selection Guide
| Use Case | Recommended Model | Why |
|---|---|---|
| π§Ύ Document Chat | mistral, llama3 |
Good for long-form comprehension |
| π¬ Conversational Agent | mistral, gemma, phi |
Natural replies, balanced reasoning |
| π» Code Assistant | codellama, deepseek-coder |
Specialized for programming |
| π Multilingual | gemma, llama3 |
Supports non-English well |
| π± Low-resource Devices | orca-mini, phi |
Lightweight and fast |
| π§ Memory-based Agents | llama3, mistral |
Handles long context well |
π‘ Pro Tip: Use Quantized Models (smaller/faster)
Ollama often provides quantized (compressed) versions of models:
ollama pull mistral:quant
They run faster and use less memory β ideal for laptops and small servers.
π§ͺ Practice Activity
-
Try pulling 3 models and testing them:
ollama pull mistral
ollama pull codellama
ollama pull orca-mini
-
Then run:
ollama run mistral
Ask each model:
“Summarize the Industrial Revolution in 3 bullet points.”
Compare:
-
Speed
-
Relevance
-
Detail
π§° Bonus: View All Available Models
Run this in your terminal to list all available models:
ollama list
Or visit: https://ollama.com/library
β Summary
| Task | Model |
|---|---|
| Fast, general Q&A | mistral |
| Complex reasoning | llama3 |
| Coding | codellama, deepseek-coder |
| Multilingual or low RAM | gemma, orca-mini, phi |
By pulling only what you need, you can optimize your AI system for speed, cost, and power.
Β
60
