Skip to content
← Blog
Article

How to choose an LLM for production

Frontier or small model, hosted or self-hosted, one vendor or many. Here is how to pick an LLM for production by the axes that decide cost, latency, quality, and risk.

7 min readStallwart

The model is a component, not the decision

Choosing an LLM for production is not picking the highest-scoring model on a public leaderboard. It is finding the cheapest, fastest model that clears the quality bar for your specific task, under your privacy and latency constraints, without locking you to one vendor. The task defines the bar, so the decision starts with the task and not the model.

This matters because the models that top general benchmarks are usually the most expensive and the slowest, and most production tasks are narrower than the benchmark. Classifying a support ticket, extracting fields from an invoice, or drafting a reply from a retrieved context does not need the same capability as open-ended reasoning across a long document. Matching model capability to task difficulty is where most of the cost and latency savings live.

So the useful frame is not "which model is best" but "which model is sufficient here, and what does it cost me on the four axes that actually bind: quality, cost, latency, and risk." The rest of this article is those axes and how to measure them on your own data.

Frontier versus small and open models

Frontier models, the large hosted models from the major labs, buy you capability and convenience. They handle ambiguous instructions, multi-step reasoning, and long context well, and they need less prompt engineering to reach a working result. You pay for that per token, and you accept that the weights and the roadmap belong to someone else.

Small and open-weight models flip the trade. A well-chosen small model, fine-tuned or prompted for a narrow task, can match a frontier model on that task at a fraction of the cost and latency, and you can run it where you want. The cost moves from per-token spend to the engineering and infrastructure needed to host, tune, and maintain it. That cost is real and recurring, which is why small models pay off on high-volume, well-defined tasks and rarely on low-volume, open-ended ones.

In practice most production systems use both. A capable model handles the hard or rare path, a smaller model handles the high-volume common path, and a router decides which one a given request needs. The decision is per task inside a system, not one model for the whole product.

  1. High volume, narrow, well-defined task: favor a small or open model, tuned and measured.
  2. Low volume, open-ended, high-stakes reasoning: favor a frontier model, the per-request cost is small.
  3. Mixed workload: route by difficulty, escalate to the larger model only when the smaller one is not sufficient.

Hosted versus self-hosted

Hosted APIs remove operational burden. You get scaling, availability, and model updates without running GPUs, and you start in an afternoon. The costs are per-token pricing at scale, less control over latency tails and model versions, and the requirement that your data leave your environment to reach the provider.

Self-hosting, whether an open-weight model on your own GPUs or a dedicated deployment in your cloud, gives you control over data residency, latency, versioning, and unit economics at high volume. The price is that you now own capacity planning, GPU supply, autoscaling, and the on-call rotation for an inference service. This is an engineering commitment, not a checkbox, and it only earns out above a volume threshold or when a compliance requirement forces it.

The honest default for most teams is to start hosted, instrument everything, and self-host only the specific workloads where the numbers or the compliance rules justify it. Deciding to self-host the whole stack before you have production traffic usually buys control you are not yet using at a cost you cannot yet amortize.

The axes that actually decide it

Beyond the frontier-versus-small and hosted-versus-self-hosted framings, a production choice comes down to a short list of measurable properties. Score every candidate on each, on your task, not in the abstract.

  1. Quality on your task: measured by an eval on your own data, not a public benchmark.
  2. Cost per request: input plus output tokens at your real prompt sizes and volume, not the headline per-token rate.
  3. Latency: both median and tail latency, because the slow tail is what users and downstream timeouts feel.
  4. Context window: large enough for your longest realistic prompt plus retrieved context, with margin.
  5. Structured output and tool use: native JSON or schema-constrained output and reliable function calling, if your system depends on parsing the response or calling tools.
  6. Privacy and data residency: where inference runs, what the provider retains, and whether that satisfies your regulatory and contractual obligations.
  7. Operational maturity: rate limits, uptime, versioning policy, and how deprecations are communicated.

Prove it with evals, not vibes

The only reliable way to compare candidates is an evaluation set built from your own data. Assemble a few dozen to a few hundred representative inputs with known-good expected outputs, including the awkward edge cases that break demos, then run every candidate model through the same set and score them the same way. This turns model selection from an argument into a measurement.

Score what the task cares about. For extraction or classification, exact-match or field-level accuracy is enough. For generation, use a rubric, and where a human rubric does not scale, an LLM-as-judge scored against a reference can approximate it, as long as you spot-check the judge. Record cost and latency in the same run so quality is never compared without its price attached.

Keep the eval set in version control and rerun it whenever you change a prompt, a model version, or a provider. A model that scored well six months ago may have been quietly updated, and a cheaper model released last week may now clear your bar. The eval is not a one-time gate, it is the instrument you keep pointed at the decision.

Design so the choice stays reversible

The model you pick today will not be the best or cheapest option next quarter, so the goal is a system where swapping models is a configuration change, not a rewrite. Put a thin abstraction layer between your application and the provider so model choice, prompt templates, and routing live in one place behind a stable internal interface. Your application should ask for a capability, not call a named vendor directly.

Guard against the couplings that quietly create lock-in: provider-specific prompt formats baked through the codebase, reliance on one vendor's exact structured-output behavior, and evals that only run against the incumbent. Normalize requests and responses at the boundary, and keep at least one alternative model wired into the eval harness so a switch is always one measured step away.

This is the layer where model selection stops being a one-time decision and becomes an operational capability. It is also the part teams skip under deadline pressure, which is exactly how a proof of concept turns into a system that can only ever run on the vendor it was prototyped against. Building that abstraction, the evals behind it, and the routing on top is the kind of production engineering Stallwart does around a customer's own workflow and constraints, rather than handing over a model recommendation and leaving.

The short version

  • Pick the cheapest, fastest model that clears the quality bar for your specific task, not the top of a general leaderboard.
  • Match model size to task difficulty: small or open models win on high-volume narrow tasks, frontier models on rare open-ended ones.
  • Start hosted and self-host only the specific workloads where volume economics or data-residency rules justify the operational burden.
  • Compare candidates with an eval set built from your own data, scoring quality, cost, and latency together and rerunning it on every change.
  • Put a thin abstraction layer between your application and the provider so switching models is a config change, not a rewrite.
The short answers

Questions this raises

Should I use a frontier model or a smaller open-source model in production?
It depends on the task, and most systems use both. A small or open model, tuned for a narrow high-volume task, can match a frontier model at a fraction of the cost and latency, while frontier models earn their price on rare, open-ended, high-stakes reasoning. The common pattern is a router that sends easy requests to the small model and escalates only when needed.
Is it cheaper to self-host an LLM or use a hosted API?
Hosted APIs are cheaper until you reach high, steady volume, because they carry no capacity, GPU-supply, or on-call cost. Self-hosting earns out above a volume threshold or when data-residency rules require it, but it adds real recurring engineering and infrastructure cost. Start hosted, instrument usage, and self-host only the specific workloads where the numbers or compliance clearly justify it.
How do I actually compare LLMs for my use case?
Build an evaluation set from your own representative inputs with known-good expected outputs, including edge cases, then run every candidate through the same set and score quality, cost, and latency together. Public benchmarks measure general capability, not your task, so they are a starting shortlist at best. Keep the eval in version control and rerun it whenever a model, prompt, or provider changes.
How do I avoid getting locked into one model vendor?
Put a thin abstraction layer between your application and the provider so model choice, prompt templates, and routing live in one place behind a stable interface. Normalize requests and responses at the boundary, avoid depending on one vendor's exact prompt or structured-output quirks, and keep at least one alternative model wired into your eval harness. Then switching is a measured config change rather than a rewrite.
What matters more than benchmark scores when choosing an LLM?
Cost per real request, median and tail latency, a context window large enough for your longest prompt, reliable structured output and tool use if your system depends on them, and privacy and data-residency fit. A model can top a leaderboard and still be the wrong choice because its tail latency, price at your volume, or data-handling policy fails your constraints.

Recognize this in your own operation?

Bring us the version of it happening in your business and we will tell you which part a system can take over.