Skip to content
AgenticAIWiki
  1. Learn
  2. Part 5
  3. 28. Open-weight models
  4. 28.6

Lesson 28.6 · 6 of 7 · 6 min read · Reviewed 24 Nov 2026

Small language models and when to use them

By the end, you can

  • Decide whether a small language model fits a task, or is the wrong choice.
  • Explain how distillation and quantisation make small models useful.
  • Design a route that tries a small model first and escalates to a large one.

Lessons 28.2 and 28.5 showed that open families come in many sizes. This lesson is about the bottom of that range: small language models (SLMs), and the jobs where they beat a large model, not just match it.

What counts as small

There is no official line. In practice, “small” means roughly a few billion parameters or fewer: the 0.5B to 4B sizes that most open families now ship, and sometimes models up to about 8B. The useful test is where it runs:

Size Memory at 16-bit Memory at 4-bit Runs on
1B about 2 GB about 0.5 GB Phones, browsers, small edge boxes
3B about 6 GB about 1.5 GB Laptops, recent phones
8B about 16 GB about 4 GB One consumer GPU, a well-equipped laptop

The rule behind the table: memory for the weights is parameters x bytes per weight. Add some headroom for the context and runtime.

How small models get good

Two techniques do most of the work.

  • Distillation (31.4). A large teacher model labels or answers many examples, and the small student is trained to match it. The student inherits much of the teacher’s skillSkill: A folder of instructions, scripts and resources that an agent loads when relevant to a task. on that kind of task. As lesson 5.6 noted, small models are also often trained on far more tokensToken: The unit a model reads and writes: a word, part of a word, a space or a symbol, mapped to an integer id. per parameter than the compute-optimal rule suggests, which packs more into each weight.
  • Quantisation (30.2). Weights are stored in 8 or 4 bits instead of 16. Memory drops by two to four times and generation speeds up, usually for a small quality loss. Check that loss on your own evalEval: A repeatable test that measures how well an AI system performs on a set of cases with defined success criteria., because it varies by task.

Where SLMs fit

  1. Narrow, repeated tasks with clear right answers: classify, tag, extract fields, redactRedaction: Removing or masking sensitive data, such as PII or secrets, before it is stored, logged or sent., rewrite to a template.
  2. On-device and edge: offline features, low latencyLatency: The time from sending a request until you get the response, or until the first token arrives when streaming. with no network hop, and data that never leaves the device (chapter 30).
  3. High volume: at millions of calls, a model several times cheaper per call changes the economics.
  4. First stop in a route: the small model answers when it is confident; the rest goes to a large model.

Small first, then large

A cascadeModel routing: Sending each request to the cheapest model that can handle it well, often using a classifier. sends every request to the small model first and escalatesEscalation: Handing a case from an agent to a person, with the context needed to continue. only when needed:

answer, confidence = small_model(request)
if confidence >= threshold and passes_checks(answer):
    return answer                     # cheap path
return large_model(request)           # escalate

A worked example with illustrative numbers: the small model costs 1 credit per call, the large one 10. If 80% of requests stay small, the average is 0.8 x 1 + 0.2 x (1 + 10) = 3 credits, about a third of sending everything large. Choose the threshold on a labelled set: lower it and you save more but let through more wrong answers. Log every route so you can see when the mix drifts. Lesson 28.4 covers the related split by data sensitivity.

When an SLM is the wrong choice

  • Open-ended reasoning or planning, such as debugging an unfamiliar system or writing a strategy.
  • Long, multi-step agentAgent: A system where a model decides its own next steps, calling tools in a loop until the task is done. work with many tools, where small errors compound.
  • Broad knowledge questions, because fewer parameters store fewer facts. Add retrieval, or use a large model.
  • Low volume. If you make a hundred calls a day, the savings rarely justify the work of tuning, hosting and evaluating a model.

Common mistakes

  • Trusting a small model’s confidence untested. Calibrate the threshold on real, labelled examples.
  • Comparing on a general benchmark. Small models vary widely by task; test on yours (28.3).
  • Forgetting the large path. Without a fallback, the hard cases simply fail.

Key points

  • A small language model (SLM) has roughly a few billion parameters or fewer, small enough for one modest GPU, a laptop or a phone.
  • Distillation teaches a small model from a large one; quantisation stores its weights in fewer bits. Together they make SLMs fast and cheap to run.
  • SLMs shine on narrow, repeated tasks with clear right answers, on devices and offline, and as the first stop in a small-then-large route.
  • They are the wrong choice for open-ended reasoning, long multi-step agent work and broad knowledge questions.
Hands-on labRuns in the Playground

Tune a small-then-large routing threshold

Route requests to a simulated small model first, escalate low-confidence answers to a simulated large one, and pick the threshold from a labelled set.

You will have: A script that prints accuracy, average credits and escalations for several thresholds, and the cheapest threshold that meets the accuracy target.

Steps

  1. Run the starter: accuracy stays at 70% whatever the threshold, because nothing escalates.
  2. In run(), send requests below the threshold to large_model() and add its cost.
  3. Compare the thresholds with sending everything to the large model.
  4. Search thresholds from 0.00 to 0.99 for the cheapest one that reaches 100% on the labelled set.
  5. Note why a threshold of 0.95 costs as much as large-only, and what that says about over-escalating.

Done when

  • Threshold 0.85 reaches 100% accuracy at 6.0 credits per request, against 10.0 for large only.
  • The search finds 0.81 as the cheapest threshold for 100%, at 5.0 credits.
  • You can explain why the threshold must be re-checked when traffic changes.

Open in the Playground No API key needed.

Starter code (Python)
# Simulated models and a labelled set. Costs are in credits, illustrative.
SMALL_COST, LARGE_COST = 1, 10

# (request id, right answer, small model's answer, small model's confidence)
LABELLED = [
    (1, "billing", "billing", 0.97), (2, "refund", "refund", 0.93), (3, "bug", "bug", 0.91),
    (4, "billing", "billing", 0.88), (5, "refund", "refund", 0.86), (6, "account", "account", 0.84),
    (7, "bug", "account", 0.80), (8, "refund", "refund", 0.78), (9, "billing", "refund", 0.66),
    (10, "account", "bug", 0.55),
]

def small_model(req):
    _, _, answer, conf = req
    return answer, conf

def large_model(req):
    return req[1]          # simulated: always right on this set

def run(threshold):
    correct = cost = escalated = 0
    for req in LABELLED:
        answer, conf = small_model(req)
        cost += SMALL_COST
        # TODO: if conf is below threshold, ask large_model instead,
        # add LARGE_COST and count the escalation
        correct += answer == req[1]
    n = len(LABELLED)
    return correct / n, cost / n, escalated

print(f"large only: accuracy 100%, {LARGE_COST:.1f} credits per request")
for t in [0.0, 0.7, 0.85, 0.95]:
    acc, cost, esc = run(t)
    print(f"threshold {t:.2f}: accuracy {acc:.0%}, {cost:.1f} credits per request, {esc} escalated")

# TODO: try thresholds 0.00 to 0.99 and print the cheapest one that reaches 100% accuracy
Show a solution
# Simulated models and a labelled set. Costs are in credits, illustrative.
SMALL_COST, LARGE_COST = 1, 10

# (request id, right answer, small model's answer, small model's confidence)
LABELLED = [
    (1, "billing", "billing", 0.97), (2, "refund", "refund", 0.93), (3, "bug", "bug", 0.91),
    (4, "billing", "billing", 0.88), (5, "refund", "refund", 0.86), (6, "account", "account", 0.84),
    (7, "bug", "account", 0.80), (8, "refund", "refund", 0.78), (9, "billing", "refund", 0.66),
    (10, "account", "bug", 0.55),
]

def small_model(req):
    _, _, answer, conf = req
    return answer, conf

def large_model(req):
    return req[1]          # simulated: always right on this set

def run(threshold):
    correct = cost = escalated = 0
    for req in LABELLED:
        answer, conf = small_model(req)
        cost += SMALL_COST
        if conf < threshold:
            answer = large_model(req)
            cost += LARGE_COST
            escalated += 1
        correct += answer == req[1]
    n = len(LABELLED)
    return correct / n, cost / n, escalated

print(f"large only: accuracy 100%, {LARGE_COST:.1f} credits per request")
for t in [0.0, 0.7, 0.85, 0.95]:
    acc, cost, esc = run(t)
    print(f"threshold {t:.2f}: accuracy {acc:.0%}, {cost:.1f} credits per request, {esc} escalated")

# Pick the cheapest threshold that reaches the target accuracy.
target = 1.0
best = min((run(t)[1], t) for t in [x / 100 for x in range(0, 100)] if run(t)[0] >= target)
print(f"cheapest threshold for {target:.0%}: {best[1]:.2f} at {best[0]:.1f} credits")
Quick checkA notes app must tag each note with one of 12 topics, offline on users' phones, thousands of times a day. Which plan fits best?
How sure are you?
Pick an answer and how sure you are