Choosing between a small language model and a large one is usually framed as a cost and quality decision, but it also decides where your model runs, who holds the weights, which credentials exist and how much safety behaviour you can rely on. Small language models (SLMs), roughly the sub-15-billion-parameter class such as Phi-3, Gemma 3 and Apple's on-device foundation model, now run on laptops, phones and modest servers. Large language models (LLMs) are mostly consumed as hosted APIs from frontier providers, or run on substantial GPU clusters. This guide compares the two for security architects, AI platform owners and engineering leads who must approve a model choice. For hardening a self-run inference server see the Self-Hosted LLM Security Guide; this page stays on the size decision and what changes with it.
Key takeaways
- Size is a proxy for deployment, not for safety. Small models make on-device and in-house hosting practical, while large models are usually consumed as hosted APIs, and most of the security difference follows from that deployment shift.
- Do not assume small means safe or unsafe. A 2025 evaluation of 59 small models found that jailbreak resistance tracked training data and method rather than parameter count, and 37.3% of them complied with more than half of directly harmful requests without any jailbreak.
- Small models move risk into the supply chain. Weights, quantised variants, LoRA adapters and format conversions are downloaded artefacts; research has shown a model can look benign at full precision and behave maliciously once quantised.
- Large hosted models move risk into credentials and data flows. The API key is the asset attackers want, prompts leave your boundary, and spend is the blast radius when a key leaks.
- Enforce policy outside the model in both cases. A compact guard model, a gateway or a policy check should sit around whichever model you pick, because neither prompt instructions nor model alignment are a security boundary.
The short answer
Choose a small model when the task is narrow and well defined (classification, extraction, summarising your own documents, routing, guard checks), when data must not leave a device or a jurisdiction, when latency or offline operation matters, or when per-token API spend at volume is the dominant cost. Choose a large model when the task needs broad world knowledge, long multi-step reasoning, strong instruction following across many domains, or when you want the provider to carry the safety tuning, abuse monitoring and serving infrastructure. Many deployments use both, with a router in between. The Model Routers vs Single-Model Deployments guide covers that pattern; the security sections below apply to each leg.
Platform and model names in this guide are examples to make the comparison concrete, listed alphabetically where several appear. They are not recommendations.
Small and large models side by side
| Dimension | Small language model | Large language model |
|---|---|---|
| Typical size | Hundreds of millions to about 15 billion parameters (Gemma 3 ships 270M, 1B, 4B, 12B and 27B; phi-3-mini is 3.8B) | Tens to hundreds of billions of parameters, or undisclosed for frontier hosted models |
| Typical deployment | On-device, workstation runtime, single-GPU server, edge box | Hosted API, or a multi-GPU cluster you operate |
| Where weights live | On hardware you or your users control | With the provider, or in your data centre |
| Where prompts go | Can stay on the device or inside your network | To the provider unless you self-host the large model |
| Main credential | Model registry and hub tokens, device or app signing keys | Provider API key or cloud role with model invocation rights |
| Safety behaviour | Varies widely by family and fine-tune; you own any re-tuning | Provider alignment plus provider-side filters and abuse monitoring |
| Knowledge and reasoning | Narrower; Google's Gemma 3 card warns of incorrect or outdated facts, and Apple says its roughly 3B on-device model is not designed as a world-knowledge chatbot | Broader knowledge and longer reasoning chains |
| Cost shape | Fixed hardware and operations; marginal query cost near zero | Metered per token; spend scales with use and with abuse |
| Update path | You ship new weights (app, OS or model download) | Provider updates centrally, sometimes without notice of behaviour change |
| Regulatory signal | Far below the EU AI Act systemic-risk compute presumption | Frontier models may sit above the 1025 FLOP presumption in Article 51, which brings extra provider obligations |
The EU AI Act point concerns obligations on model providers, not on you as a deployer, and the Commission can amend the threshold by delegated act.
Small language models: threat model and architecture
Architecture in words. A small model is pulled from a model hub or vendor channel, often converted or quantised (for example to GGUF, or to a 4-bit or lower variant), optionally extended with a LoRA adapter, and then loaded by a local runtime: a mobile framework, a desktop runtime such as llama.cpp, LM Studio or Ollama, or a small inference server. The application calls it in-process or over a localhost port. Apple's 2025 on-device model is a useful reference point: roughly 3 billion parameters compressed to 2 bits per weight with quantisation-aware training, exposed to developers through a framework that adds guided generation and built-in guardrails.
Threat model.
- Model file supply chain: OWASP's Top 10 for LLM Applications 2025 notes under LLM03 Supply Chain that on-device LLMs increase the attack surface and supply-chain risk, and lists malicious LoRA adapters and compromised merge or conversion services as distinct risks. MITRE ATLAS tracks this as AML.T0010 Supply Chain Compromise, with AML.T0010.003 Model Repository, and AML.T0018 Manipulate AI Model.
- Quantisation as a hiding place: Egashira and colleagues showed in "Exploiting LLM Quantization" that an attacker can publish a full-precision model that tests as benign while its quantised form generates vulnerable code, injects content or over-refuses. Evaluating only the full-precision weights, then quantising locally, misses this.
- Executable model formats: pickle-based checkpoints can run code when loaded; Hugging Face describes safetensors as a format for storing tensors safely, as opposed to pickle.
- Weaker or uneven refusal behaviour: Wang and colleagues tested 59 small models from 15 families against 12 jailbreak methods. 61.0% had an average attack success rate above 40%, and prompt-level defences were inconsistent across models and attacks. This is ATLAS AML.T0054 LLM Jailbreak. Their finding that training choices, not size, drove the result is the important part: test the specific model you deploy.
- White-box access: once weights are on a device, the attacker has AML.T0044 Full AI Model Access and can search for jailbreaks or extract behaviour offline at no cost.
- Local exposure: local runtimes become network services the moment someone binds them beyond localhost, and the host often holds hub tokens. The On-Device AI Security Guide covers the device side in depth.
Controls that carry the most weight.
- Pin and verify artefacts: pin the exact model revision and file digests, prefer safetensors or GGUF, and verify signatures where the publisher signs. The model signing project (sigstore/model-transparency) provides a
model_signingtool that signs a model directory (Sigstore short-lived certificates, keys, certificates or PKCS #11) and on verify recomputes every file hash. See the Model Signing and OpenSSF Model Signing Guide. - Evaluate the artefact you ship: run safety and task evaluations on the quantised, adapter-merged build that will run in production, not on the upstream full-precision checkpoint.
- Add a guard model: small guard classifiers are cheap enough to run beside the main model. Meta reports Llama Guard 3-1B-INT4 at 440MB, running at 30 or more tokens per second on a commodity Android CPU, with moderation scores comparable to or better than its larger sibling.
- Constrain outputs: use structured or constrained decoding (Apple's guided generation is one example) so the model can only emit fields your code expects.
- Keep secrets and policy off the device: anything consequential, such as an authorisation decision or a payment, is checked server-side.
Large language models: threat model and architecture
Architecture in words. Your application or agent sends prompts, retrieved context and tool results to a provider endpoint, authenticated with an API key or a cloud role. The provider runs the model, applies its own content filters and abuse detection, and returns a completion. In larger estates an AI gateway sits in between to authenticate internal callers, hold the provider credential, log, rate limit and apply data loss prevention.
Threat model.
- Credential theft and cost harvesting: a leaked key gives free inference at your expense, ATLAS AML.T0034 Cost Harvesting. The LLMjacking 2024 to 2026 campaigns obtained keys from stolen cloud credentials, public code repositories and unauthenticated self-hosted endpoints, then resold access through proxies. See the LLMjacking Guide.
- Data leaving your boundary: prompts, retrieved documents and tool outputs travel to and may be retained by the provider under its terms, which matters for residency, privilege and contractual confidentiality.
- Prompt injection at higher capability: AML.T0051 LLM Prompt Injection affects both sizes, but a large model connected to many tools gives an injected instruction more to work with. Capability raises the consequence of a successful injection.
- Silent behaviour change: provider model updates can change refusal behaviour, output format or tool selection without any change on your side.
Controls that carry the most weight.
- Broker the credential: keep provider keys in a secrets manager or behind an AI Gateway and LLM Gateway, never in client apps or repositories, and prefer short-lived cloud roles over static keys where the platform offers them.
- Cap spend per key: set provider-side spend and rate limits, and alert on deviations. See How to set spend limits on LLM API keys.
- Classify what may be sent: define which data classes may go to which provider and region, enforce it at the gateway, and record the provider's retention terms in your supplier register.
- Pin model versions: call dated model versions where offered and run regression evaluations before switching.
- Least-privilege tools: give the model only the tools and scopes each task needs, and require approval for irreversible actions.
Where each one breaks
| Failure mode | More likely with | What it looks like | Control |
|---|---|---|---|
| Poisoned or trojaned weights | Small (downloaded) | Model passes casual testing, misbehaves on a trigger or after quantisation | Pinned digests, signature verification, evaluate the quantised build |
| Malicious adapter | Small | A LoRA adapter from a third party changes outputs of a trusted base model | Treat adapters as code: source allow-list, review, signing |
| Code execution on load | Small (and self-hosted large) | Loading a pickle checkpoint runs a payload on the host | Non-executable formats only; isolated loading zone |
| Jailbreak or harmful compliance | Either; varies by model | Model answers requests it should refuse | Per-model red-team results, guard model, output filtering |
| Leaked API key and runaway spend | Large (hosted) | Unexpected invocation volume, new regions or models enabled | Brokered keys, spend caps, anomaly alerts |
| Sensitive data sent off-boundary | Large (hosted) | Regulated data appears in provider logs or prompts to an unapproved region | Data classification at gateway, approved provider list |
| Unannounced behaviour change | Large (hosted) | Format breaks, refusals rise, tool choice changes | Version pinning, regression suite, canary traffic |
Cost, data residency and on-device trade-offs
- Cost: hosted large models convert spend into a per-token variable cost, which is cheap to start and expensive at sustained high volume; it also means a stolen key has a direct monetary blast radius. Small models move cost into hardware, energy and the engineering time to operate and patch them.
- Data residency: a small model on your own infrastructure can keep prompts inside a jurisdiction and your logging scope, which simplifies some data protection assessments. It does not remove obligations: the outputs, caches and embeddings it creates are new personal data stores.
- On-device: running on the device removes network interception and provider retention, and works offline. It also hands a copy of the model to every user and removes central visibility of prompts and outputs, so abuse detection must be designed in with privacy limits.
- Small versus large organisations: a small team without GPU operations skills is usually safer on a hosted large model with brokered keys and spend caps than running an unmanaged local server. Large organisations with platform teams can run a governed internal model service and get both residency and central control.
Worked scenario: an insurer's claims assistant
An insurer wants an assistant that reads claim documents, extracts structured fields, drafts a summary for the handler and answers handler questions about policy wording. Claim files contain health and financial data, and the regulator expects the insurer to explain where that data is processed.
- Split the task. Field extraction and document classification are narrow and high volume, so they go to a small model hosted in the insurer's own cloud region. Free-form questions about unusual policy wording go to a hosted large model through the AI gateway, with claim documents redacted to the minimum needed.
- Secure the small leg. The platform team pins a specific model revision by digest, downloads safetensors weights only, quantises in a build pipeline, then runs the extraction evaluation and a jailbreak suite on the quantised build. The resulting artefact is signed with the model signing tool and verified at load. The inference service binds to a private subnet behind an authenticating proxy, and its hub token is read-only and scoped to one organisation.
- Secure the large leg. The provider key lives only in the gateway. The gateway authenticates each internal caller with workload identity, applies a redaction policy, enforces a monthly spend cap with alerts at 50% and 80%, and logs prompt metadata (not full content) for audit.
- Wrap both. A compact guard model screens inputs and outputs on both legs, and every field the assistant writes into the claims system passes schema validation. Nothing the model writes changes a payout without a handler's confirmation.
- Result. Most claim data stays in region, the hosted key has a bounded blast radius, and a poisoned upstream model is caught before production.
Where identity fits
Both options create non-human identities that are easy to overlook. The small-model path needs hub and registry tokens for pulling weights, signing identities for artefacts, and service identities for the inference service and its callers. The large-model path concentrates risk in provider API keys and the cloud roles allowed to invoke models. Treat each as a managed credential with an owner, scope, rotation and monitoring. Hugging Face tokens are a recurring example of a quietly powerful credential; the Hugging Face Security Guide covers token scoping, and the Hugging Face API Tokens Exposed 2023 incident shows how many organisations leaked them in public code.
Decision criteria
| Question | Points to small | Points to large |
|---|---|---|
| How broad is the task? | One narrow, testable task | Open-ended questions across domains |
| May data leave the device or region? | No, or only with heavy redaction | Yes, under an approved provider agreement |
| Is offline or low-latency operation required? | Yes | No |
| What is the query volume? | Sustained high volume | Low or bursty |
| Can you operate and patch model infrastructure? | Yes, with a platform team | No, prefer a managed service |
| Who must own safety tuning and evaluation? | You accept ownership | You want the provider to carry most of it |
| How consequential are the actions? | Low, or always confirmed by a human | Either, provided tools are scoped and gated |
How to implement
- Write the task contract. Define inputs, allowed outputs, data classes and the actions the model may trigger. This decides whether a small model is capable enough.
- Shortlist and evaluate. Benchmark candidate small and large models on your own task data, plus a jailbreak and prompt injection suite. Record results per model version.
- Build the supply chain or the broker. For small models: pinned digests, safetensors or GGUF only, quantisation in your pipeline, signing and verify-on-load. For large models: gateway-held keys, spend caps, data classification rules.
- Pilot in shadow mode. Run the model alongside the existing process without letting it act, and compare outputs, refusal rates and cost.
- Roll out in rings. Start with internal users, then a small share of production traffic, with a router or feature flag that can send all traffic to the fallback model or the manual process.
- Plan rollback. Keep the previous signed model artefact and the previous provider model version callable, so a bad update can be reverted in minutes.
Detection and measurement
- Artefact integrity: log every model load with file digest and signature result; alert on any unsigned or unknown digest.
- Invocation telemetry: per-key and per-caller token volume, regions and model IDs; request rates for internal runtimes.
- Guard model verdicts: blocked input and output rates by category, trending over time.
Metrics that show it is working:
- Percentage of production model loads with a verified signature and pinned digest (target 100%).
- Jailbreak attack success rate on the deployed build, measured at each release.
- Share of hosted API keys held only in a gateway or secrets manager.
- Time from anomalous spend alert to key revocation.
- Share of queries routed to the small model without escalation, alongside task accuracy, so cost savings are not bought with quality loss.
Framework mapping
| Concern | NIST CSF 2.0 | NIST SP 800-53 Rev. 5 | MITRE ATLAS / OWASP |
|---|---|---|---|
| Model and adapter provenance | GV.SC-07, ID.AM-02 | SR-3, SR-4, SR-11 | AML.T0010, AML.T0010.003; LLM03 Supply Chain |
| Integrity of weights at load | PR.PS-02 | SI-7, SI-7.15 | AML.T0018 |
| Weights and caches on devices | PR.DS-01 | SC-28 | AML.T0044 |
| Provider as external service | GV.SC-05 | SA-9 | LLM02 Sensitive Information Disclosure |
| API keys and service identities | PR.AA-01, PR.AA-03 | IA-5, AC-6 | AML.T0034; LLM10 Unbounded Consumption |
| Jailbreak and injection resistance | DE.CM-03 | AU-12 | AML.T0054, AML.T0051; LLM01 Prompt Injection |
| Minimal runtime exposure | PR.PS-02 | CM-7 | AML.T0040 |
Common failure patterns
- Testing the upstream model, shipping a different one. Teams evaluate a full-precision checkpoint, then deploy a community quantisation or merged adapter that was never tested, which is exactly the gap the quantisation research exploits.
- Treating "it runs locally" as "it is secure". A workstation runtime bound to all interfaces, or a phone app with guardrails that can be stripped, is not a privacy or safety control by itself.
- Embedding a hosted key to avoid running a model. Mobile and desktop apps that call a large model directly with a provider key ship that key to every user. Route through your own backend instead.
- Assuming the provider's safety tuning covers your use case. Provider filters target general harms, not your business rules, data classes or tools.
- No fallback when the large model changes or fails. A single-provider dependency without version pinning or a tested fallback turns a provider update into an outage.
Practitioner checklist
- Write a task contract that states data classes, outputs and permitted actions before choosing a size.
- Evaluate candidate models on your own data plus a jailbreak and prompt injection suite, per version.
- Pin small-model revisions by digest, accept only safetensors or GGUF, and quantise in your own pipeline.
- Sign the exact artefact you deploy and verify it at every load.
- Hold hosted API keys only in a gateway or secrets manager, with spend caps and alerts.
- Define which data classes may go to which provider and region, and enforce it at the gateway.
- Run a guard model or output filter on both legs, and validate structured outputs against a schema.
- Keep a fallback model or manual path and a rollback artefact ready for every model in production.
- Inventory every model runtime and model credential, with an owner for each.
Standards and references
- OWASP: Top 10 for LLM Applications 2025
- MITRE ATLAS: AI Supply Chain Compromise
- EU AI Act: Article 51, Classification of General-Purpose AI Models with Systemic Risk
- Sigstore: Model Signing (model-transparency)
- Wang et al.: Can Small Language Models Reliably Resist Jailbreak Attacks? A Comprehensive Evaluation
- Egashira et al.: Exploiting LLM Quantization
- Meta: Llama Guard 3-1B-INT4, Compact and Efficient Safeguard for Human-AI Conversations
- Google: Gemma 3 Model Card
Related NHI Mgmt Group resources: Self-Hosted LLM Security Guide, On-Device AI Security Guide, Model Signing vs Model Scanning, Build vs Buy vs Fine-Tune AI Models, AI Supply Chain and AI-BOM Guide.