Local LLM — Ollama, LM Studio, llama.cpp

লেসন ৩০ / ৪৬

🏠 Local LLM কেন?

  • Privacy — data কোথাও যায় না
  • No API cost — unlimited use
  • Offline — internet ছাড়া
  • Customization — fine-tune freely
  • No rate limit
  • Compliance — HIPAA, GDPR friendly

🛠️ Tool Compare

Toolবৈশিষ্ট্য
Ollama ⭐Easiest, CLI + API
LM StudioGUI, beginner-friendly
llama.cppLowest level, fastest
vLLMProduction serving
Text Generation WebUIFeature-rich UI
JanOpen ChatGPT-like UI

🚀 Ollama Quick Start

# Install (Mac/Linux/Windows)
curl https://ollama.com/install.sh | sh

# Pull model
ollama pull llama3.3
ollama pull qwen2.5-coder
ollama pull deepseek-r1

# Run
ollama run llama3.3
>>> "Hello!"

# API (OpenAI-compatible)
curl http://localhost:11434/v1/chat/completions \
  -d '{ "model": "llama3.3", "messages": [...] }'

📊 Popular Open Model

ModelSizeUse
Llama 3.3 70B43GBGeneral best
Llama 3.2 3B2GBFast, mobile
Qwen 2.5 CoderVariousCoding
DeepSeek R1VariousReasoning
Mistral 7B4GBEfficient
Phi-49GBMicrosoft, small but smart
Gemma 2VariousGoogle

💻 Hardware Requirement

  • 3B-7B model — 8GB RAM, CPU OK
  • 13B — 16GB RAM, GPU helpful
  • 30B-70B — 32-64GB RAM + GPU (24GB+ VRAM)
  • Mac M-series — unified memory advantage
  • Quantization (4-bit, 5-bit) — half size, slight quality loss

🔧 Quantization

Original: FP16 (16-bit) — full quality, big
Q8_0: 8-bit — minor loss
Q5_K_M: 5-bit — sweet spot
Q4_K_M: 4-bit — small, slight quality drop
Q2_K: 2-bit — tiny, noticeable drop

llama3:70b-instruct-q4_K_M = 40GB

🎨 LM Studio (GUI)

  • Browse Hugging Face models
  • One-click download
  • Chat UI
  • Local API server
  • Performance metric
  • Beginner সবচেয়ে easy

🧪 vLLM (Production)

High-throughput serving — multiple concurrent request।

pip install vllm
python -m vllm.entrypoints.openai.api_server \
  --model meta-llama/Llama-3.3-70B-Instruct
# OpenAI-compatible API on port 8000

🔌 Local + Cloud Hybrid

  • Sensitive data → local
  • Complex query → cloud (GPT-4)
  • Cost-sensitive bulk → local
  • Latency critical → local
  • Best quality needed → cloud

🛠️ IDE Integration

  • Continue.dev (VS Code) → Ollama
  • Cursor → custom local endpoint
  • Aider → any OpenAI-compatible
  • Open WebUI → ChatGPT-like for local

⚠️ Limitation

  • Quality gap vs frontier model
  • Slower than cloud (without GPU)
  • Hardware investment
  • No native vision/audio (some)
  • Maintenance overhead
  • Power consumption

💡 Use Case

  • Code completion (privacy)
  • Document summary (sensitive)
  • Internal RAG (compliance)
  • Bulk classification
  • Offline travel/remote
  • Learning experiment
  • Hobby project (no API bill)