Library

Volume 2 · GenAI Foundations & LLM Architecture

Notebook
Sign in

Section 8

Small Language Models (SLMs)

342 words · about 2 min

8.1 Why SLMs Matter for Enterprise Architecture

Small Language Models (typically 1B-8B parameters) trade some raw capability for dramatically lower inference cost, lower latency, and the ability to run on edge/on-device hardware. They are increasingly central to enterprise architectures that need to balance capability against cost and deployment constraints across cloud, edge, and on-prem environments.

8.2 Key SLM Families

Model Provider Size Notes
Phi-3 Microsoft 3.8B-14B Trained on curated, high-quality “textbook-like” data; strong reasoning for its size
Gemma / Gemma 2 Google 2B-27B Open-weight, derived from Gemini research, strong instruction-following
TinyLlama Open community 1.1B Extremely lightweight, suited for edge/mobile and rapid experimentation
Llama 3.1 8B Meta 8B Strong general-purpose small model, good LoRA fine-tuning target
Mistral 7B Mistral AI 7B Efficient, strong performance-per-parameter

8.3 SLM Deployment Considerations

  • Edge/on-device: SLMs quantized to INT4/GGUF can run on consumer hardware (laptops, mobile devices) without a network round-trip — valuable for offline scenarios or strict data-locality requirements
  • Cost-tiering: Route simple, high-volume, well-defined tasks (classification, extraction, simple Q&A) to SLMs; reserve large models for genuinely complex reasoning
  • Fine-tuning target: SLMs are the most common target for LoRA/QLoRA fine-tuning since their smaller size makes training fast and cheap while still benefiting substantially from domain specialization
  • Distillation target: SLMs are the typical “student” in knowledge-distillation pipelines (Section 5.3)

Section 8 — Interview Q&A

Q: When would you choose a small language model (Phi-3, Gemma, TinyLlama) over a frontier large model? A: SLMs make sense whenever the task is well-defined and doesn’t require deep multi-step reasoning — classification, structured extraction, simple routing, or as the “draft” model in speculative decoding. They’re also the right choice for edge/on-device deployment where network latency or offline operation matters, and for cost-sensitive high-volume workloads where large-model quality would be wasted. I’d typically fine-tune an SLM (via LoRA/QLoRA) on domain-specific examples so it captures most of the needed specialization, then route only the genuinely ambiguous or high-stakes fraction of traffic to a larger frontier model — this tiered approach is usually where the largest cost savings come from in production systems.