LLM Inference Performance Bottlenecks and Compute Scheduling: A Practical Guide

    This article explains why inference compute supply has become a hard constraint on application availability, and how engineering teams can respond. It separates latency into time to first token (TTFT) and output throughput (TPS), shows how to measure both, and explains the trade-off between reasoning depth and response speed. It then covers architecture-side strategies for periods of tight compute supply—request tiering and quota isolation, exact and semantic caching, context trimming, streaming output, batching and asynchronous processing, and multi-level fallback—plus an observability and capacity planning loop to keep service quality stable.

    1. Background: When Compute Supply Becomes a Hard Constraint on Availability

    Recently, several model services in the industry have paused membership subscriptions or closed their purchase entry points. On the surface this looks like a change in commercialization strategy, but the underlying cause usually points to the same fact: inference compute supply is tight.

    For developers on the application side, the direct impact is not simply “I can’t buy a membership.” It is that service quality across the entire request path starts to fluctuate—queue times grow longer, output speed drops, and requests get throttled during peak hours.

    It is worth being clear that compute scarcity is not a problem unique to any one class of model. It is a structural contradiction that the large-model space inevitably faces once deployment moves into large-scale production: training and inference compete for the same pool of accelerator resources, while the inference side is constrained by GPU memory capacity and batching efficiency. There is a hard ceiling on how much concurrency a single card can carry. When the growth curve of business-side call volume is steeper than the compute expansion curve, the server side can only protect the experience of existing users through throttling, degradation, or pausing new subscriptions.

    So the mindset developers really need to build is this: do not bet availability entirely on the supply stability of any single model service. Instead, design at the architecture level so that “model capability” is treated as an external dependency that is replaceable, degradable, and measurable.

    2. Breaking “Slow” Into Measurable Metrics: Latency and Throughput Are Two Different Things

    Many teams complain that the model is “slow,” but when they do a retrospective they cannot locate the bottleneck. The root cause is that they conflate two entirely different classes of performance metrics.

    The first is time to first token, commonly known as TTFT (Time To First Token): the time from when a request is sent to when the first output token is received. It is mainly determined by queue wait time, the prefill computation caused by prompt length, and the server-side scheduling policy. TTFT directly determines whether users “feel” the system is fast, and it has the biggest impact on interactive applications and use cases like intelligent code completion.

    The second is output throughput, usually measured in tokens per second (TPS), which reflects the parallel efficiency of the decoding phase. It is affected by batch size, memory bandwidth, and context length. An experience where the first token arrives quickly but tokens then trickle out slowly will still be judged as “laggy” by users.

    You can use a minimal piece of pseudocode to explicitly record both segments of elapsed time, avoiding optimization decisions based purely on subjective feeling:

    1. import time
    2. def timed_completion(client, messages):
    3. t0 = time.perf_counter()
    4. first_token_at = None
    5. chunks = []
    6. for chunk in client.stream_chat(messages):
    7. if first_token_at is None:
    8. first_token_at = time.perf_counter()
    9. chunks.append(chunk)
    10. t1 = time.perf_counter()
    11. output_tokens = sum(len(c) for c in chunks)
    12. ttft = first_token_at - t0
    13. tps = output_tokens / max(t1 - first_token_at, 1e-6)
    14. return {"ttft": ttft, "tps": tps, "total": t1 - t0}

    The engineering recommendation is to bring both metrics into your monitoring and alerting system, setting thresholds per scenario rather than looking vaguely at “average response time.” Averages hide the long tail, so observe P50/P95/P99 at the same time.

    3. Tiered Reasoning Modes: Trading Controllable Inference Depth for Response Speed

    In the original discussion, it was mentioned that the service provider opened up two tiers of thinking mode, high and low, and the over-thinking problem was somewhat alleviated—but token output speed and TTFT were not fundamentally improved. This observation is very valuable from an engineering standpoint, because it reveals a general rule: there is a hard trade-off between reasoning depth and response speed.

    The so-called thinking mode is essentially the model generating more intermediate reasoning tokens before giving the final answer. As the number of intermediate tokens rises, it pushes up both TTFT and total elapsed time, because it lengthens the path before “the user sees the conclusion.” The point of tiered modes is to hand the decision over this trade-off back to the caller.

    When putting this into practice, the recommendation is to build a mapping table by task type rather than applying one global setting:

    • Low reasoning intensity: intent classification, field extraction, format conversion, simple Q&A, code completion;
    • Medium reasoning intensity: routine business copy generation, single-file code changes, first-pass log root-cause screening;
    • High reasoning intensity: complex algorithm design, cross-module refactoring, root-cause analysis of difficult defects, compliance review of long documents.

    Pair this with a “low first, then high” progressive strategy: first use low intensity to quickly produce a draft, and only escalate and retry when the self-check fails. This can significantly reduce average cost.

    1. def escalate(task, checker, max_level=2):
    2. level = 0
    3. while level <= max_level:
    4. draft = call_model(task, reasoning_level=level)
    5. if checker(draft):
    6. return draft
    7. level += 1
    8. return draft # Return the last result and hand it to human review

    4. Architecture-Side Strategies During Periods of Compute Scarcity

    When external supply is out of your control, the only thing you can control is your own architecture. The following approaches are common industry practices and do not depend on any specific vendor’s capabilities.

    Request tiering and quota isolation. Split traffic into three classes: online interactive, offline batch, and internal tooling. Reserve a dedicated quota for online interactive traffic so that offline jobs do not squeeze the interactive path during peak hours. Quotas can be sliced along three dimensions: per tenant, per API, and per business line.

    Result caching and semantic reuse. Build a two-level cache for high-frequency repeated requests: an exact cache keyed on the normalized prompt; and a semantic cache that matches historical answers by vector similarity, which needs a similarity threshold and a human spot-check mechanism to prevent incorrect reuse. In practice, hit rates tend to be relatively high for scenarios like customer-support Q&A, code comment generation, and structured extraction.

    Context trimming. TTFT is positively correlated with prompt length, so trim proactively: remove duplicated system instructions, retrieve first and then concatenate for long documents, and convert lengthy conversation history into summary-style compression. Every part of the context you cut reduces prefill overhead correspondingly.

    Streaming output and progressive rendering. Even if total elapsed time cannot be compressed, returning the first token immediately and rendering continuously still greatly improves the subjective experience; for structured results, you can return the skeleton first and fill in the details afterward.

    Batching and asynchronous processing. Route offline tasks uniformly through an asynchronous queue, buffered by a message queue, with the consumer side elastically scaled by the container platform to smooth out peaks and fill valleys; combine this with exponential backoff retries and circuit breaking to avoid forming a retry storm during throttling periods.

    Fallback paths. Preset multi-level fallbacks: switch to a backup model when the primary model is unavailable; switch to a smaller, lighter-weight option when the backup is unavailable; and if that is also unavailable, return a templated result or hand off to a human. The key is that degradation must be automatic, observable, and rollback-able.

    5. Closing the Loop on Observability and Capacity Planning

    Optimization cannot rely on guesswork; it needs to form a closed loop. Instrument each call to collect TTFT, token output rate, input and output token counts, retry counts, and degradation flags, and send them uniformly into logging and monitoring/alerting services; aggregate cost and latency dashboards by business dimension; and review the common characteristics of long-tail requests weekly to work backward to whether the cause is an overly long prompt, too high a reasoning tier, or a cache miss.

    For capacity planning, the recommendation is to estimate required throughput as “peak concurrency × average tokens per call ÷ target output rate,” then reserve some headroom to absorb burst traffic. Scaling up and cost reduction should be achieved through elastic resource pools: put steady-state load on fixed resources and let burst load be absorbed by elastic capacity.

    6. Conclusion

    The toggling of subscription entry points is only the surface. What truly determines application experience is the architecture’s ability to absorb uncertainty. Break latency into TTFT and token output rate and govern them separately, match task value with tiered reasoning levels, and combine caching, quota isolation, asynchronous peak shaving, and multi-level fallback, then layer on a complete observability loop. Doing so keeps service quality stable through cycles of tight compute supply. If you need more complete managed inference, elastic resources, and full-path monitoring capabilities, you can assemble them on demand from the general cloud product portfolio offered by Baidu AI Cloud, leaving your energy for the business itself.