Applied AISLMOllamaLLMsPrivacy

Small language models (SLM): when they beat a giant LLM

Pablo Alcalde García

The conversation about AI usually revolves around huge models in the cloud. But there is a trend that is already practical in production: small language models (SLMs), models with a few billion parameters that run on a laptop, a modest server or even on the device itself. For many tasks they are enough, cheaper and more private.

What an SLM is

There is no official boundary, but SLM usually refers to models between roughly 1 and 14 billion parameters (1B-14B). Examples of families you can run locally: Llama, Gemma, Phi, Qwen or Mistral, in their small versions.

What matters is not the number but what it implies: they fit in consumer memory and respond quickly without depending on an external service.

What tasks they are enough for

Small models shine when the task is well-bounded:

  • Classifying (tickets, emails, sentiment, intent).
  • Extracting structured fields from text (name, date, amount) as JSON.
  • Summarising short texts.
  • Rewriting or normalising text.
  • Answering questions about documents you give them (with RAG).
  • Autocompleting or suggesting code on simple tasks.

What they are NOT the best option for

  • Long, multi-step reasoning on novel problems.
  • High-quality open-ended and creative tasks.
  • When you need broad world knowledge without giving it context.
  • Long, very complex instructions.

In those cases a large model is still better. The key is to choose the minimum sufficient model for each task, an idea we already saw in open source vs cloud AI.

How much memory they need

Models are distributed quantised (with weights in fewer bits) to reduce size. As a rough rule, with 4-bit quantisation a model needs a little over half a gigabyte per billion parameters, plus some headroom for context:

SizeApproximate memory (4-bit)Where it runs
1B-3B2-4 GBLaptop, phone, Raspberry Pi 5
7B-8B5-8 GBLaptop with 16 GB of RAM
13B-14B9-12 GBMid-range GPU or 32 GB of RAM

These are order-of-magnitude figures: they depend on the model, the quantisation and the context length you use.

Running it locally with Ollama

ollama pull llama3.2        # a small general-purpose model
ollama run llama3.2 "Classify this message as complaint, question or praise: 'It arrived late and broken'"

And from Python, asking for JSON output:

import requests, json

r = requests.post(
    "http://localhost:11434/api/generate",
    json={
        "model": "llama3.2",
        "prompt": "Extract name and date as JSON from: 'Meeting with Ana on 3 March'",
        "format": "json",
        "stream": False,
    },
    timeout=60,
)
print(json.loads(r.json()["response"]))

Installation and usage details in the complete Ollama guide.

When an SLM beats a cloud LLM

FactorLocal SLMCloud LLM
PrivacyData doesn’t leave your networkDepends on the provider and the contract
Cost at high volumeFixed (hardware)Per token, grows with usage
LatencyVery low, no networkDepends on network and load
Quality on open-ended tasksLowerHigher
MaintenanceYou manage itThe provider manages it

Practical rule: if the task is repetitive, bounded and involves sensitive data, an SLM is a very good candidate. If it is open-ended and highly demanding, use a large model.

The hybrid pattern that works best

  1. An SLM handles most simple requests.
  2. If it isn’t sure, or the task is complex, escalate to a large model.
  3. Measure how many requests reach the second tier: that is where your savings are.

It is also what I explain in how much it really costs to implement AI.

How to check that your SLM is enough

Don’t assume it, measure it: create 30-50 real examples with the correct answer and compare small and large models. How to do it in LLM evals in production.

Conclusion

Small models are not a worse version of big ones: they are a different tool, ideal for bounded, private, high-volume tasks. Choosing the right size is an engineering decision that saves money and risk.

If you want to evaluate which parts of your processes could be solved with local models, ask me for a call.

Call me now