← Back to blog

Inference Optimization: Cut Latency and Cost in Production

November 28, 2026
Inference Optimization: Cut Latency and Cost in Production

Inference optimization is the work of making a trained model answer faster, serve more requests per accelerator and cost less per response, without losing the quality your product depends on. Google Cloud frames it as a combination of model-level and infrastructure-level techniques. For a CTO or infrastructure lead, the hard part is rarely knowing the techniques. It is deciding which ones fit your workload, measuring them honestly, and buying and deploying hardware that matches the result. That is where a design, sourcing and deployment partner such as Dormedia, which has worked in HPC and AI infrastructure since 2017, earns its place.

Dormedia
Plan Infrastructure Around Inference
Dormedia helps organizations design, source, deploy and scale HPC and AI infrastructure tailored to their technology requirements.
Visit

TL;DR

  • Optimize against a target: a latency limit (for example, time to first token) at a planned peak load. Without that target, every technique looks like a win.
  • Diagnose prefill and decode separately. Prompt processing tends to be compute-bound, token generation tends to be memory-bandwidth-bound, and they need different fixes.
  • A model that fits in GPU memory is not a deployment that works. Size by measured throughput at your latency limit, not by memory alone.
  • Benchmark with your own prompt lengths, concurrency and serving stack. Numbers from other workloads are not comparable.
  • Software tuning and hardware choices interact. The best results come from designing both together, then validating in production.

Table of Contents

What inference optimization actually covers

Training builds a model. Inference is what happens every time someone sends it a request. In production, inference is the part that runs continuously and scales with your users, so its cost and speed show up directly in your product experience and your infrastructure bill.

According to Google Cloud, the problems it addresses are response latency, throughput, memory and accelerator efficiency, and the hardware cost of serving requests at scale. Those four problems pull against each other. Pushing for more throughput usually means batching more requests together, which can make each individual user wait longer. Squeezing a model into less memory with quantization (storing weights in fewer bits) frees capacity but must be checked against output quality.

So inference optimization is not one trick. It is a loop: set a target, measure, change one thing, measure again.

Start with the numbers that matter

You cannot improve what you have not measured, and large language model (LLM) serving has its own vocabulary of measurements. The ones that recur across vendor guidance:

  • Time to first token (TTFT): how long a user waits before the response starts appearing.
  • Inter-token latency: the gap between tokens once streaming begins.
  • Tokens per second and requests per second: how much work the system completes.
  • End-to-end latency, p99: the slowest 1 percent of requests, which is what your unhappiest users experience.
  • Concurrency: how many requests are in flight at once.

NVIDIA's AIPerf metrics reference lists p99 end-to-end latency, TTFT, inter-token latency, request and token throughput, queue time, KV-cache occupancy, preemptions and GPU memory use as useful production signals. The KV cache is the memory a model uses to remember the earlier tokens in a conversation so it does not recompute them. When it fills up, requests queue or get preempted, and latency spikes.

AWS Prescriptive Guidance adds an important warning: benchmark with representative input and output lengths, concurrency, serving backend and quantization, because results from different workload shapes and stacks are not directly comparable. A chatbot with short prompts and a document-analysis tool with 50-page inputs are different problems on the same GPU.

Find the bottleneck: prefill versus decode

An LLM request has two phases. Prefill reads your whole prompt in parallel. Decode then generates the answer one token at a time. Google Cloud explains that prefill is commonly compute-bound while decode is commonly memory-bandwidth-bound, so the phases need separate diagnosis. NVIDIA's technical explanation makes the same point: in decode, moving weights and key/value states from memory often governs latency more than raw arithmetic speed.

This matters for purchasing. If your bottleneck is decode, a GPU with more compute but the same memory bandwidth will disappoint you. If it is prefill with long prompts, the opposite may hold. Splitting the two phases onto separately tuned hardware is a design pattern in its own right, and we cover it in our series on prefill/decode disaggregation for LLM serving.

The main techniques and what they cost you

Most optimization falls into three layers: the model, the serving software and the hardware. A short map:

LayerTechniqueWhat it doesWhat to verify
ModelQuantizationStores weights in fewer bits to save memory and bandwidthAccuracy on your own tasks
ModelPruning, distillationRemoves or compresses parts of the modelQuality after compression
ServingContinuous batchingKeeps the accelerator busy as requests arrive and finishTTFT under load
ServingPagedAttentionStores KV-cache data in non-contiguous blocks to cut fragmentationMemory headroom at peak concurrency
ServingKernel fusion, graph optimizationReduces overhead in how operations runGains on your exact model
HardwareRight-sized accelerators and memoryMatches bandwidth and capacity to the bottleneckCost per request at your latency limit
ArchitecturePrefill/decode disaggregationTunes each phase separatelyNetwork and orchestration complexity

Google Cloud describes PagedAttention and continuous batching as ways to reduce memory fragmentation and keep accelerators occupied. These are features of modern inference engines, which are the software layers that load a model and serve requests.

Choose techniques with a filter, not a list

A 2026 arXiv study, Optimizing AI Inference Across the Deployment Stack, suggests a practical order. First filter candidates by device memory and minimum acceptable accuracy. Then measure latency or energy on the actual hardware. Then choose according to the constraint your application cares about most.

In practice that means you discard any configuration that does not fit or does not meet your quality bar before you spend a single benchmark hour on it. It also means the final ranking depends on your constraint: a customer-facing assistant is bound by TTFT, an overnight batch job by cost per million tokens.

Latency and throughput trade against each other

The most common mistake is optimizing one number in isolation. NVIDIA's benchmarking guidance treats this as a frontier: higher concurrency can raise aggregate throughput through batching while worsening request latency. So capacity decisions should be made inside your service's latency constraint.

The practical method is to run a load test at rising concurrency and plot the curve. Early on, adding load barely changes latency. Then a knee appears where latency climbs fast for small throughput gains. You operate to the left of that knee, at the highest throughput that still meets your latency limit.

Concurrency curve showing latency and throughput knee

Size the deployment from measurements

A model that fits in memory is not necessarily a viable deployment. AWS's sizing guidance makes this its central lesson: memory fit must be checked alongside latency and throughput under representative demand.

NVIDIA's cost guide gives a simple calculation. Divide your planned peak requests per second by the best measured per-instance throughput that satisfies your latency limit to get the minimum number of instances. When instances have different GPU counts, normalize the comparison per GPU.

A worked example with made-up round numbers, for illustration only: suppose your plan calls for 200 requests per second at peak. Your benchmark shows one instance sustains 25 requests per second while keeping TTFT under your limit. You need at least eight instances, before any headroom for failures or growth. If a different configuration sustains 40 requests per second at the same limit, you need five. That difference, multiplied across servers, power, networking and rack space, is the real return on optimization work.

This is also why guessing from spec sheets is expensive. The same card can deliver very different request rates depending on model, prompt length and serving stack.

Size the deployment from measurements

A production routine that keeps gains from eroding

Optimization is not finished at launch. A 2026 review in the Journal of Artificial Intelligence Research, Navigating the Optimization Gap, recommends a routine worth adopting:

  1. Set service-level objectives (SLOs) before deployment: the latency, accuracy and memory limits you commit to.
  2. Numerically validate exported or converted models against the original.
  3. Profile on the target hardware, not a stand-in.
  4. Benchmark the whole path, from request in to response out, not only the model call.
  5. Use automated release gates that block changes causing accuracy, latency or memory regressions.
  6. Pin deployment dependencies so a library update cannot silently change performance.
  7. Alert on p99 latency and keep prediction lineage for audit and rollback.
  8. Revalidate accuracy and robustness after optimization, especially if your input data shifts.

Each item is cheap to add early and painful to retrofit.

Cloud, edge and on-device: placement changes the answer

Where inference runs changes which optimizations matter. A 2026 Scientific Reports study on learning-based orchestration across cloud and edge describes a placement loop that combines benchmark-derived model features with live queue, memory, GPU and network telemetry, filters out devices that cannot serve a request, and routes to a suitable node. The authors also note their results rely on profiling data that represents real workloads and hardware, and they call for more testing under production bursts, failures and geographically distributed deployment.

The lesson for a multi-region or multi-site deployment is that placement policies need your own profiling data. A configuration that looks excellent in a controlled testbed can behave differently across sites with uneven networks, different hardware generations and bursty traffic.

For organizations deploying across borders, there is a further layer that no benchmark covers: getting the right hardware to the right site on time, with duties and tariffs accounted for. Optimization plans that ignore lead times and import costs tend to slip.

Where outside help changes the outcome

Most teams can run a benchmark. Fewer can connect the result to a purchasing decision, a data center design and a delivery schedule at the same time. The questions that decide a project tend to span those areas:

  • Which accelerator and memory configuration meets your latency limit at the lowest cost per request?
  • Can you source it in the quantity and timeframe your launch needs?
  • Does your facility have the power and cooling for it, and does the network support disaggregated serving?
  • What happens to the plan when you scale to a second region?

Our companion guide, AI inference infrastructure: how to design, size and run it, goes deeper on sizing and operating the hardware side once your measurements are in hand.

Perspective

We treat inference optimization as an infrastructure decision first and a tuning exercise second. Software techniques such as quantization, continuous batching and paged KV caches are well documented and worth applying. But the larger swings in cost per request usually come from matching the hardware to the actual bottleneck: memory bandwidth for decode-heavy workloads, compute for long-prompt prefill, and enough interconnect to keep the pieces fed.

That is why our work spans design, sourcing, deployment and support rather than stopping at advice. We have been in the industry since 2011 and deeply engaged in HPC and AI since 2017, and we work with a network of vendors and logistics specialists so that a configuration chosen on paper can be delivered, with tax and tariff questions handled, to the site where it has to run.

Our advice to a CTO planning a deployment is to put the latency target in writing, measure on your own traffic, and let those numbers choose the hardware. We help teams do exactly that, from the first sizing exercise to ongoing support after launch.

Dormedia

Plan your inference build with Dormedia

If you are turning an optimization plan into a real deployment, our team handles it as a project: customized server and component configurations, data center solutions, global shipping, tax and tariff solutions, project management and strategic advisory, with ongoing support after go-live. We work with startups and enterprises, including those running complex deployments across several countries.

Dormedia

If you want to see what hardware is on hand for a build, browse our available hardware inventory.

FAQ

What is the difference between inference optimization and model training optimization?

Training optimization aims to build or fine-tune a model faster, usually in large batch jobs. Inference optimization targets the live serving path, where per-request latency, concurrency and cost per response matter. The hardware profiles differ too, which is why we cover them in separate guides, including LLM training infrastructure.

How do I reduce AI inference costs without hurting quality?

Measure first, then reduce. Find the highest per-instance throughput that meets your latency limit, and divide your peak load by it to get the instance count. Apply quantization or batching changes one at a time and check accuracy on your own tasks after each. Compare configurations per GPU so you are not misled by different instance sizes.

Which metrics should I track in production?

Track TTFT, inter-token latency, tokens and requests per second, p99 end-to-end latency, queue time, KV-cache occupancy and GPU memory use. Alert on p99 latency, since averages hide the slow requests that users notice. Set these against SLOs defined before launch.

Is memory capacity or memory bandwidth more important for LLM inference?

Both matter, for different reasons. Capacity decides whether the model and its KV cache fit at all. Bandwidth often governs how quickly tokens are generated during decode. A configuration should clear the capacity check first and then be judged on measured latency and throughput.

When should I split prefill and decode onto separate hardware?

Consider it when long prompts and long generations compete for the same accelerators and you cannot meet latency targets by tuning alone. It adds orchestration and networking requirements, so it is worth modeling before you commit. Our prefill/decode disaggregation series walks through the design.

Sources