10 Model serving GPU sizing and performance
Write down model family, license, quality requirements, context lengths, expected output lengths, request arrival pattern, concurrency, privacy needs, latency target, and budget.
Outcome: decide whether to use hosted inference or operate a model server, then measure a candidate correctly. Prerequisites: application deployment, observability, and AI evaluation. Environment: a compatible local machine or explicitly budgeted GPU host. Status: specialist procedure; no external GPU allocation or paid inference is provisioned automatically.
Begin with the workload
Write down model family, license, quality requirements, context lengths, expected output lengths, request arrival pattern, concurrency, privacy needs, latency target, and budget. An interactive assistant and an overnight batch summarizer have different priorities. A throughput winner at heavy batching may be a poor low-latency choice.
Hosted inference transfers much infrastructure work to a provider but adds provider policy, availability, pricing, data handling, and rate-limit considerations. Self-hosting offers control but makes you responsible for hardware compatibility, model artifacts, security, capacity, and uptime. Include engineering and idle capacity in the comparison.
Estimate memory before renting hardware
A rough weight-memory estimate is parameter count multiplied by bytes per parameter. Seventy billion parameters at two bytes per parameter require about 140 billion bytes for weights alone. At one byte per parameter the rough weight storage halves. Quantization metadata, runtime workspaces, activations, and cache add overhead.
The KV cache grows with architecture, sequence length, and active requests. Long contexts at high concurrency can exhaust memory even when weights fit. A model that starts successfully may fail under the intended load. Calculate a preliminary budget, then measure peak memory with a representative workload and headroom.
GPU names alone are insufficient. Record VRAM capacity, accelerator count, interconnect, host memory, driver, runtime, engine version, and model format. Tensor parallelism distributes model work across devices and adds communication costs. Do not assume a model fits a single accelerator because a copied command says so.
Choose an engine experimentally
vLLM, SGLang, llama.cpp, and other serving systems target different hardware and workload tradeoffs. Ollama can be useful in local or controlled deployments; suitability depends on the contract rather than a blanket ban. Start with engines supporting your actual model and hardware, then compare measured behavior.
Use a versioned container or reproducible environment. Verify model license and access requirements. Download from a trusted source and record the exact artifact/version. Avoid executing arbitrary model repository code without review. Bind the first test server to loopback or a private interface, and place authenticated application controls in front of any public access.
A serving procedure
- Verify driver/runtime compatibility and available memory.
- Choose a supported small model for the first run and record its source.
- Install or run the selected versioned engine.
- Bind privately, set the model and context/concurrency limits, and start it.
- Verify readiness and one bounded generation request.
- Run a quality baseline and latency test.
- Increase load gradually while observing memory and errors.
- Record the configuration and shut down billable resources when finished.
Use the engine's current flags rather than copying an old universal command. For vLLM, begin with its [serving documentation](https://docs.vllm.ai/en/latest/serving/online_serving/). An API-compatible endpoint does not necessarily implement every feature or error behavior of another provider; test what your client uses.
Measure the right quantities
Time to first token measures the initial wait. Inter-token latency affects the reading experience after generation starts. End-to-end latency includes queueing and full output. Throughput counts completed work per unit time under a stated workload. Error rate, cancellation behavior, and quality belong in the same report.
Record prompt/output distributions, warm versus cold state, concurrency, request rate, sampling parameters, cache settings, and repetitions. A benchmark without these fields cannot support a general “engine A is faster” claim. Use the same model and comparable settings; explain any differences.
Optimization tradeoffs
Continuous batching can improve utilization by scheduling work across requests. Prefix caching can reuse work for shared prefixes, but benefit depends on reuse and eviction. Quantization reduces storage and compute requirements in some settings, with quality and compatibility tradeoffs to measure. Flash-attention implementations and hardware support vary.
Speculative decoding uses proposed tokens and verification to reduce generation cost or latency under suitable conditions. It is not limited in principle to temperature zero. Gains depend on method, acceptance, workload, and hardware; extra work can reduce performance in some regimes. Follow the selected implementation's supported combinations and benchmark them. [vLLM speculative decoding](https://docs.vllm.ai/en/latest/features/speculative_decoding/index.html) explains methods and limitations.
Tune one factor at a time. Retain a quality baseline and rollback configuration. Faster generation that violates the output contract is not an improvement. Avoid changing model, precision, engine, prompt, and concurrency simultaneously if you need to identify the cause of a result.
Cost and operational controls
Estimate monthly cost from provisioned time, utilization, storage, transfer, monitoring, and support effort. For hosted APIs, include both input and output tokens, retries, embeddings, and ancillary requests. Compare cost per successful task at the required quality, not just headline token prices.
Enforce admission limits and per-tenant budgets before accepting expensive work. Handle cancellation so abandoned requests do not consume unbounded compute. Scale-to-zero reduces idle compute but may add model-loading delay and storage/transfer costs. Keep a warm instance only when the latency benefit justifies its cost.
Exit exercise
Produce a benchmark report with exact versions, hardware, workload, quality results, latency percentiles, throughput, failure rate, peak memory, and cost assumptions. Compare two configurations and defend a choice. Demonstrate stopping the service and removing only the resources allocated for the test. This evidence is the qualification for operating a model server, not the act of renting a GPU.