Solutions

Four workloads, four different bottlenecks.

The same runtime can serve a 3B reranker and a 34B vision model, but they should not share a scaling policy. These are the workload shapes we see most often, with the numbers that drive placement, batching, and region choice.

Workload Steady rate p95 target Typical model Scaling signal
Real-time ranking 2,400 req/s 35 ms 3B cross-encoder queue depth, 20 ms window
Document intelligence 40 pages/s 4 s 8B vision-language tokens in flight
Visual QA on a line 12 frames/s 180 ms 4B vision, quantized per-camera queue age
Voice agents 900 calls/s 240 ms to first token 7B instruct concurrent streams
01 / Real-time ranking

Small model, very short prompts, no room for a queue.

A search or marketplace ranker scores hundreds of candidates per query. Prompts are short, often under 96 tokens, and the model is usually a 3B cross-encoder or a distilled classifier. The hard constraint is tail latency: a 35 ms p95 at 2,400 requests per second leaves almost no budget for admission delay.

Run this workload with a minimum of two replicas per region, batch tokens capped near 2,048, and a queue maximum of 20 ms. Keep the model hot on 24 GB GPUs and route on queue depth rather than GPU utilization. Cross-region fallback is usually a bad trade for ranking: an extra 80 ms of network time costs more than returning a slightly older score.

Sequence profile

96 input tokens, 1 output token, scoring head only. Continuous batching is safe because every request has the same shape.

Placement

Two or three regions close to the application tier. Pin each region to a single 24 GB pool to keep the KV cache predictable.

Failure mode

When the queue exceeds 20 ms, return the cached score for the candidate set and log a degraded-ranking event. Do not let the ranker become the timeout.

pythonbatch scoring
import os
import requests

URL = os.environ["NEURAFLOW_URL"] + "/v1/rerank"
KEY = os.environ["NEURAFLOW_KEY"]

payload = {
    "model": "reranker-3b",
    "query": "insulated travel mug 500 ml",
    "documents": candidate_titles,
    "top_n": 40,
    "max_tokens": 1,
}

r = requests.post(
    URL,
    headers={"Authorization": f"Bearer {KEY}"},
    json=payload,
    timeout=0.12,
)
r.raise_for_status()
scores = r.json()["results"]
02 / Document intelligence

Long inputs, bursty batches, throughput over per-page latency.

Invoices, claims, and contracts arrive in batches. A single page can produce 6,000 to 30,000 input tokens once layout and tables are serialized, so prefill dominates and KV cache pressure is the real constraint. A 4-second p95 per page is acceptable when forty pages run concurrently.

Use tokens-in-flight as the scaling signal, not request count: ten large pages can carry more work than a thousand short ones. Cap the batch at 8,192 tokens, allow a longer admission queue, and prefer 80 GB GPUs when pages routinely exceed 20,000 tokens. Route batches to the region with the most free KV cache rather than the lowest network latency.

03 / Visual QA on a production line

Twelve frames a second, and a missed frame is a stopped line.

Cameras submit frames at fixed intervals. The model checks for missing components, label alignment, and surface defects, then returns a structured verdict. Frames are not retried after the deadline, because a late answer is useless to the actuator. The important number is queue age per camera, not average latency.

Run quantized 4B vision models on 24 GB GPUs at the edge region, with one replica reserved for each group of four cameras. Keep a 180 ms deadline and a queue maximum of one frame per camera. If a replica is unhealthy, the camera controller should fail closed and stop the line rather than accept unverified output.

Input shape

1280×720 JPEG, resized to 896×896, plus a short instruction. Vision encoder prefill is the dominant cost.

Output contract

JSON with a verdict, confidence, and a list of defect regions. Constrain decoding with a schema so the controller never parses free text.

Deadline policy

Requests carry a 180 ms deadline. The runtime returns 504 with the frame ID and a reason code; the actuator treats it as a stop condition.

04 / Voice agents

Streaming changes the definition of latency.

A voice agent is judged on time to first token, not on total completion time. A 7B instruct model on a 24 GB GPU can return the first token in 240 ms when the prompt is short and the KV cache is warm. Turn detection, speech-to-text, and text-to-speech usually sit outside the model endpoint, so the endpoint should stream immediately and let the client assemble the response.

Concurrency is high and sequences are long-lived. Scale on concurrent streams and reserve KV cache for the maximum call duration, not the average. Set a hard per-call token cap so a runaway generation cannot hold a slot for minutes. Put a 15-second idle timeout on streams and emit a completion event with a reason.

  • Stream tokens by default; send usage in the final event.
  • Cap output at 512 tokens per turn unless the agent is reading a document.
  • Keep the first-token path free of retries; retry only before the first token is sent.
jsonstream event
{
  "id": "req_8f31c2",
  "object": "chat.completion.chunk",
  "model": "mistral-7b-instruct",
  "choices": [{
    "index": 0,
    "delta": {"content": "Checking the"},
    "finish_reason": null
  }],
  "neuraflow": {
    "region": "fra-1",
    "queue_ms": 9,
    "ttft_ms": 238
  }
}
Choosing a policy

Start from the deadline, then work backward.

Every workload above can run on the same API. What changes is the endpoint policy: replica floor, queue maximum, batch cap, region set, and whether scale-to-zero is allowed. Those five settings matter more than the model name.

Deadline under 50 ms

Keep replicas warm, cap the queue below 20 ms, and prefer one nearby region. Tail latency dominates; cross-region retries lose.

Deadline 1–5 s

Batch aggressively, allow a deeper queue, and scale on tokens in flight. Throughput per GPU is the metric that controls cost.

Streaming interaction

Optimize the first token, cap total output, and keep connections short. Reserve KV cache for the maximum call, not the mean.

Need a workload shape that is not listed? Send the prompt distribution, rate, and deadline through the contact form and we will map it to a pool policy.

Bring a workload with a real deadline.

We will help size the pool and choose a queue policy before you commit to a monthly floor.