πŸ“š Lesson: Comparing LLMs β€” Which Model to Use and When?

Β 


πŸ“š 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

  1. Try pulling 3 models and testing them:

ollama pull mistral
ollama pull codellama
ollama pull orca-mini
  1. 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