LLM Deployment in Production: Cost, Latency, and Scaling Guide

Picture a freight-audit software company we will call Ridgeway (an illustrative example, not a client), whose new assistant reads a carrier invoice and tells a support rep why one pallet was billed twice. On a laptop the prototype was right most of the time, yet LLM deployment for Ridgeway meant something harder: 40,000 of those questions a day, a first word on screen in under a second, and a monthly bill below $12,000. If you want to see a gap like that closed on a real project, our LLM inference optimization case study walks through one.
Every Ridgeway number below is illustrative arithmetic you can swap for your own, while every outside figure names its source. Engineering leaders usually need three answers before sign-off: what one request costs, what latency the product can promise, and whether renting tokens or running GPUs suits the next year. Each section works one of those through with Ridgeway's invoice traffic as the test case.
What LLM deployment involves when 40,000 questions a day arrive
A model counts as deployed when it carries four commitments at once: a latency promise, a cost ceiling, an engineer who gets paged, and a safe way to ship changes, none of which Ridgeway's notebook prototype had. The weights stayed identical between that prototype and launch, while almost everything around them was rebuilt. That surrounding layer covers the inference engine (vLLM, SGLang or NVIDIA TensorRT-LLM when Ridgeway hosts its own models), a gateway with rate limits, retrieval of carrier rules, and logs that show finance the spend per route.
The four measurements Ridgeway tracks from day one
Ridgeway instruments four measurements before the first rep logs in, because nearly every later serving decision depends on them. Each is tracked per route as a p95 value, the figure 95 percent of requests beat. Averages would hide the slowest twentieth of answers, which are the ones reps complain about.
Measurement
Time to first token on each invoice question
What it captures for Ridgeway
Gap between a rep pressing Ask and the opening word of the explanation
Why the team watches it
Reps judge speed by this moment, so it carries the sub-second promise
Measurement
Time per output token while a dispute reply streams
What it captures for Ridgeway
Pace at which the rest of a 350-token explanation reaches the rep
Why the team watches it
Sets how long a full invoice answer takes once text has started
Measurement
Throughput across reps and the nightly reconciliation job
What it captures for Ridgeway
Tokens generated each second by every replica Ridgeway runs
Why the team watches it
Decides how many GPUs, or how much provider rate limit, Ridgeway buys
Measurement
Cost per 1,000 invoice questions answered
What it captures for Ridgeway
Dollars Ridgeway spends on a thousand answers, input and output together
Why the team watches it
Gives Ridgeway's finance lead one figure to compare month to month
How one invoice question travels through the serving stack
A production request passes through about 8 stages, and only 2 of them run the model itself. In Ridgeway's stack the other 6 decide whether those 2 are fast and cheap. Here is the path one billing dispute takes.
The gateway confirms the rep's login, applies a per-team rate limit, and tags the invoice question with an ID used in every log line.
A router sends shipment-status lookups to a small model and billing disputes to the larger one.
A response cache returns a stored reply when the same rep asked about the same invoice within the past hour.
Retrieval fetches the carrier's rate rules, and Ridgeway's fixed 2,200-token instructions go first in the prompt so the provider can reuse them.
The scheduler drops the invoice question into Ridgeway's running batch at the next decode step instead of holding it for a new batch.
Prefill reads all 3,000 input tokens in parallel and builds the key-value cache, the model's working memory for this conversation.
Decode writes the dispute explanation one token at a time and streams each fragment to the rep.
An output check confirms every dollar amount matches the invoice, then the trace is logged with token counts and cost.
Why the 3,000-token prefill and the 350-token decode need different fixes
Prefill is compute-heavy because the GPU handles every input token at once, so Ridgeway's 3,000-token prompts mostly delay the first word. Decode is memory-bound, since each new token means reading the weights plus the growing key-value cache, so long replies mostly hurt completion time and throughput. Trimming the 2,200-token instruction block therefore speeds up the first word, while capping explanations at 250 tokens shortens full answers and frees GPU memory for other reps.
Three hosting models compared for a 40,000-question workload
Teams putting a model in front of users choose between a pay-per-token API, a dedicated endpoint a provider runs for them, or open-weight models on GPUs they control. For Ridgeway the deciding factors are client data rules, traffic shape and in-house skills. The table frames each option through those three factors.
Question Ridgeway asks
How Ridgeway pays
Pay-per-token API
Per million tokens, nothing billed on a quiet Sunday
Dedicated managed endpoint
One reservation billed for all 30 days, busy or idle
Self-hosted on Ridgeway's own GPUs
GPU hours plus engineers patching drivers on Sundays too
Question Ridgeway asks
Where invoice text travels
Pay-per-token API
Into provider systems for whatever retention window its terms set
Dedicated managed endpoint
To a provider-run instance in a region Ridgeway picks
Self-hosted on Ridgeway's own GPUs
Stays inside Ridgeway's own cloud account
Question Ridgeway asks
How much latency Ridgeway controls
Pay-per-token API
Prompt length, model choice and region only
Dedicated managed endpoint
GPU type and batch settings, within limits
Self-hosted on Ridgeway's own GPUs
Engine, quantization and scheduling, all of it
Question Ridgeway asks
Time until the first rep uses it
Pay-per-token API
Days, once an API key sits behind Ridgeway's gateway
Dedicated managed endpoint
Weeks of reserved-capacity talks with the provider
Self-hosted on Ridgeway's own GPUs
Weeks to months building serving, scaling and on-call cover
Question Ridgeway asks
Fits Ridgeway when
Pay-per-token API
Volume stays under a few thousand invoice questions a day
Dedicated managed endpoint
A client contract names one fixed cloud region
Self-hosted on Ridgeway's own GPUs
An open model passes Ridgeway's 300-question evaluation set and traffic stays heavy all day
Hybrid setups are common and often the smartest start, with disputes on a frontier API and a small self-hosted model answering the status lookups that make up about 60 percent of Ridgeway's traffic. Contracts can settle the question before cost does, because a shipper moving goods for a defense contractor may forbid invoice text from leaving a named cloud region. Read client contracts first, since careful cost modeling will not rescue an option the legal terms rule out.
Working out LLM inference cost for a 3,000-token prompt

One request costs its input tokens times the input rate plus its output tokens times the output rate, minus caching and batch discounts, so a 3,000-token prompt with a 350-token reply is easy to price before launch. Filling that in early catches most budget surprises. The arithmetic below assumes placeholder rates of $3 per million input tokens and $15 per million output tokens, so swap in your provider's current price list.
Ridgeway's $20,880 monthly bill, line by line
Line item
Live assistant input for 40,000 questions before prompt caching
Volume assumption
40,000 questions a day carrying 3,000 tokens each
Monthly cost
$10,800
Line item
Live assistant output for every rep question
Volume assumption
350-token explanations for those same 40,000 daily questions
Monthly cost
$6,300
Line item
Live assistant input once Ridgeway turns on prompt caching
Volume assumption
2,200 instruction tokens read from cache, 800 invoice tokens at full rate
Monthly cost
About $3,750
Line item
Overnight reconciliation at real-time rates
Volume assumption
12,000 invoices a night at 2,500 input and 200 output tokens
Monthly cost
$3,780
Line item
Overnight reconciliation through a batch endpoint
Volume assumption
The same 12,000 invoices with results due before the morning shift
Monthly cost
$1,890
Without discounts Ridgeway's bill reaches $20,880 a month, and caching plus batch pricing brings it to about $11,940 with identical answers for reps. Caching carries the biggest share because the instruction block is long and the same on every call. On most of its models, Anthropic's pricing documentation bills cache reads at one tenth of the base input rate and a five-minute cache write at 1.25 times base, the multipliers applied here, but a timestamp or rep name placed above the instructions breaks every hit.
The overnight job has no live reader, which suits asynchronous pricing. OpenAI's Batch API FAQ describes a 50 percent discount on bulk work given a 24-hour completion window, and other large providers run comparable programs. After both discounts, output becomes Ridgeway's largest line at $6,300, so trimming the average reply from 350 to 250 tokens with a three-line summary format saves roughly $1,800 a month more.
The point where renting GPUs beats renting tokens
Self-hosting saves money when heavy, steady traffic keeps GPUs busy and an open-weight model clears the quality bar, and it loses money when GPUs idle. At a placeholder $2.50 per GPU-hour, two always-on GPUs (the minimum for surviving one failure) cost about $3,600 a month, which undercuts API spend on Ridgeway's status-lookup route if an 8-billion-parameter-class model passes the evaluation set. If disputes need a model spanning eight GPUs, the same arithmetic gives $14,400 a month, above Ridgeway's entire optimized API bill, unless a distilled model trained on Ridgeway's own dispute transcripts can do the job on two.
Engineering time belongs in that comparison too. Someone has to patch drivers, upgrade the serving engine and answer the 2 a.m. page, and in many companies that work costs more than the GPUs. Teams below a few thousand requests a day rarely recover the overhead, which is an honest reason to stay on an API for the first year.
A 700 ms latency budget you can defend in a planning meeting
A defensible latency target splits each response into time to first token and time to finish, then sets a p95 goal for both. Every pipeline stage gets a slice, and for Ridgeway's first streamed word the slices add up to 700 ms. The figures below are illustrative, and writing them down gives product managers a visible millisecond price for every prompt they want to grow.
Stage in Ridgeway's pipeline
Gateway login check and routing for each rep request
Illustrative p95 slice
40 ms
What usually blows the slice
A login-token check that crosses to a second cloud region on every call
Stage in Ridgeway's pipeline
Retrieval of carrier rate rules and shipment history
Illustrative p95 slice
150 ms
What usually blows the slice
An unindexed lookup when a carrier has thousands of tariff lines
Stage in Ridgeway's pipeline
Queue wait before the scheduler admits the invoice question
Illustrative p95 slice
200 ms
What usually blows the slice
A Monday morning spike arriving faster than autoscaling adds replicas
Stage in Ridgeway's pipeline
Prefill of the 3,000-token invoice prompt
Illustrative p95 slice
300 ms
What usually blows the slice
A prompt that grew by 4,000 tokens after someone pasted the full carrier contract
Stage in Ridgeway's pipeline
First streamed word reaching the rep's screen after 690 ms of slices
Illustrative p95 slice
700 ms in total
What usually blows the slice
Any Ridgeway stage overrunning its slice with no alert attached
Six techniques ranked by the milliseconds they buy back
Streaming comes first because a rep reading the opening line of a dispute explanation feels speed long before the reply ends, at no extra compute. Prompt caching follows, since reusing Ridgeway's 2,200-token prefix skips much of the prefill work as well as cutting price. Routing status lookups to a small model shortens the queue for disputes, quantization to 8-bit or 4-bit weights reduces memory traffic per token (invoice arithmetic needs re-testing afterward), and semantic caching, which matches a new question to a stored one with similar meaning, suits policy questions but not invoice totals that differ by a single digit.
Speculative decoding has a lightweight helper model propose a run of tokens that the main model accepts or rejects in one forward pass, so the output stays the same. In the original Google Research paper by Leviathan, Kalman and Matias (ICML 2023), a T5-XXL model ran 2 to 3 times faster than the standard T5X implementation with identical outputs. Gains depend on how often the helper guesses right, so measure the acceptance rate on Ridgeway-style invoice prompts before counting on the speedup.
LLM scaling for a Monday 9 a.m. peak and near-empty nights

Scaling a model server works best when you size for concurrent sequences held in GPU memory rather than requests per second, batch continuously, and add replicas on queue depth instead of CPU load, which for Ridgeway means planning around 20 sequences at peak. CPU and even GPU utilization mislead because a GPU can look busy with an empty queue, while queue depth and key-value cache occupancy track how long Ridgeway's reps actually wait. Loading 16 GB of weights onto a fresh replica can take from tens of seconds to minutes, so one warm spare ahead of the Monday ramp beats scaling up from zero.
Sizing 20 concurrent sequences with one line of arithmetic
Little's law from queueing theory says the average number of requests in flight equals arrival rate multiplied by time spent in the system, which gives Ridgeway a GPU memory target in two steps. If the busiest hour carries 12 percent of daily traffic, that is 4,800 questions an hour, about 1.3 per second, and at roughly 5 seconds per full answer around 7 sequences run at once. Planning for bursts three times that size sets a target of about 20 concurrent sequences.
Each sequence holds its key-value cache in GPU memory, and the size follows from the model's shape. For a model with 32 layers, 8 key-value heads and a head size of 128 at 16-bit precision, every token needs about 128 KB, so a 3,350-token conversation holds roughly 420 MB. Twenty of them need around 8 GB on top of about 16 GB of weights for an 8-billion-parameter model, which fits on one 80 GB accelerator with room for growth.
Why batching and memory layout decide throughput on one 80 GB GPU
How the serving engine packs Ridgeway's 20 sequences together matters more than raw GPU speed. Static batching waits for every sequence in a batch to finish, so one long dispute explanation can stall a dozen short status answers, while continuous batching admits a waiting request at the next decode step. In Anyscale's 2023 benchmark of OPT-13B on an A100 GPU, vLLM using continuous batching reached up to 23 times the throughput of naive serving.
Memory layout is the other half of the story. The vLLM team's SOSP 2023 paper measured earlier serving systems losing 60 to 80 percent of key-value cache memory to fragmentation, and its PagedAttention design, which stores the cache in small blocks that need not sit side by side, cut that waste below 4 percent and lifted throughput 2 to 4 times over FasterTransformer and Orca. Recovered memory becomes extra concurrent sequences, which for a workload like Ridgeway's can postpone buying a second GPU.
Keeping an LLM in production healthy after the first 30 days
Keeping a live model healthy is a continuing release process in which every prompt edit, model upgrade or retrieval change passes a 300-question evaluation gate, a gradual rollout, and monitoring for slipping quality as well as errors. Imagine a carrier switching its fuel surcharge layout, after which Ridgeway's surcharge answers quietly get worse while error rates sit at zero. Infrastructure dashboards would look healthy, and only a graded sample of real answers would reveal the drop.
Slow quality loss like that surcharge drift is a monitoring problem rather than a serving problem. Dedicated work on AI model monitoring and drift detection sits at that layer, checking whether incoming invoices and outgoing answers still resemble what the model was validated on. Watching quality, input patterns and cost per route side by side tends to expose shifts like this within days rather than quarters.
A release gate for every Ridgeway prompt or model change
Run the change against a fixed evaluation set of 300 anonymized invoice questions with graded reference answers.
Block the release if accuracy on invoice dollar amounts drops, even when the overall score rises.
Mirror a slice of live invoice traffic to the new version in shadow mode and compare answers without showing them to reps.
Move 5 percent of reps to the new version, then 25 percent, then everyone, checking p95 latency and cost per 1,000 requests each time.
Keep the previous prompt and model deployable so one command rolls Ridgeway back.
Wiring those five gates into CI pipelines, version registries and deployment tooling is the heart of LLMOps work. Teams without that tooling often look at MLOps and LLMOps services to get the pipelines built before traffic grows. The aim is a prompt change that feels as routine and reversible as a code change.
Three limits a well-built serving stack will not fix
Good serving infrastructure makes a model faster, cheaper and more dependable, but it cannot make Ridgeway's answers more accurate, hold token prices steady, or keep this year's hardware commitment looking wise. Wrong surcharge figures come from the model and the prompt, so faster decoding only delivers a wrong answer sooner. The 300-question evaluation set and the dollar-amount check stay the main defense.
Agent-style workflows, where the model calls tools and loops several times per task, make per-request cost hard to forecast. One dispute might need two model calls and the next one twelve, so hard caps on steps and tokens per task are the practical guardrail. Pinning a dated model version, where a provider offers one, also stops a silent update from changing answers overnight.
Hardware commitments age quickly while token prices keep falling. Epoch AI's 2025 analysis of API pricing found the cost of reaching a fixed benchmark score dropping between 9 and 900 times per year depending on the task, with a median near 50 times. A three-year GPU reservation signed to beat today's API price can look expensive by its second year, so shorter commitments suit teams still learning their traffic.
A 30-day plan from working prototype to first production traffic
Many teams with a working prototype can reach 5 percent production traffic in about 30 days, and the order of the four weeks matters more than the exact dates. Skipping the measurement week is the costliest shortcut, because teams often learn in month two that real prompts run far longer than the design document assumed. Ridgeway's version of the month looks like this.
Days 1 to 7: log realistic invoice prompts, measure token counts per route, and assemble the 300-question evaluation set before touching infrastructure.
Days 8 to 14: fill in the cost table with current provider rates, pick a hosting model per route, and write the 700 ms latency budget.
Days 15 to 21: build the gateway, router, caching layer and release gate, then load-test at three times the expected peak of 20 concurrent sequences.
Days 22 to 30: send 5 percent of reps down the new path, compare cost per 1,000 requests and p95 latency with the budget, and widen exposure only while both hold.
Getting your first route priced against a $12,000 ceiling
The quickest way to lower launch risk is to fill in the cost table and the 700 ms latency budget with your own measured traffic before choosing hardware. Ridgeway's numbers show how far caching, batch pricing and shorter replies can move a bill, but your token counts will tell their own story. If data rules or steady volume point toward running models inside your own environment, our Private LLM deployment services page explains that path.
FAQs
For Ridgeway, the API call is one of eight stages rather than the whole deployment. Routing, caching, rate limits, the 300-question evaluation gate, monitoring and a rollback path all sit around that call. Without them, a careless prompt edit or a provider outage reaches reps with nothing in place to catch it.
Model size, GPU rates and how evenly Ridgeway-style traffic spreads across the day all move the answer, so no single threshold fits everyone. In Ridgeway's illustrative math, two always-on GPUs cost about $3,600 a month, so self-hosting only pays once API spend on a route clearly exceeds that plus engineering time. Below a few thousand invoice-sized requests a day, an API is usually the cheaper home.
Provider-side prompt caching is designed to reuse the processed 2,200-token instruction prefix, not stored replies, so the model still writes a fresh answer for each invoice. Response caching, which hands Ridgeway's reps a saved reply, is a separate layer and can serve stale invoice totals. Keep the two apart in Ridgeway's design reviews, since they carry very different risks.
A quantized model often comes close on Ridgeway's invoice questions, though not on every task. 8-bit formats tend to hold up well, while 4-bit formats save more memory and are likelier to slip on arithmetic such as surcharge totals. Run the 300-question set on both versions and study the individual answers that changed, not only the average score.
A reasonable starting point is the first streamed words within about one second at p95, with the full reply allowed several more seconds. A rep on a live carrier call tolerates less delay than an analyst preparing a weekly report, so watch real users before fixing the number. Ridgeway's 700 ms first-word budget sits comfortably inside that starting point.
The streamed dispute explanation usually stops, and the rep's screen has to retry on a healthy replica unless Ridgeway's gateway retries on its behalf. Two or more replicas, short health-check intervals and retries that are safe to repeat limit the damage to one interrupted invoice answer. An API fallback route behind the same gateway covers the rarer case of a full regional outage at 2 a.m.
Yes, provided every model call passes through your own gateway in a provider-neutral request format from day one, as Ridgeway's stage-one gateway does. Prompts still need re-testing, because Ridgeway's 2,200-token instructions can behave differently on another model. Budget a short run of the 300-question evaluation set for each switch rather than assuming a drop-in swap.
A named team should own each route end to end, so Ridgeway's dispute assistant has one owner for latency, cost, quality and on-call. Splitting the model to data science and the servers to a platform group tends to leave surcharge-style quality drift with nobody. Shared tooling can sit with the platform group while Ridgeway's route owners keep the pager.
Krushang Mandani is the CTO at KriraAI, driving innovation in AI-powered voice and automation solutions. He shares practical insights on conversational AI, business automation, and scalable tech strategies.