How to Choose an LLM for Inference Workloads and Handle Compute Bottlenecks
Choosing a large language model based on subjective "feel" is unreliable for engineering decisions. This article breaks model evaluation into four observable dimensions—logical reasoning, knowledge retrieval, long-context handling, and engineering usability—and explains how to test them with fixed evaluation sets. It covers constraint-retention scoring for reasoning tasks, citation and refusal checks for retrieval-augmented scenarios, shadow evaluation and version pinning for model upgrades, and application-side techniques such as request tiering, semantic caching, context trimming, and backoff queues to mitigate rate limiting. It also shows how to treat evaluation sets as long-term assets for cost attribution.
1. The Starting Problem: Why “Feel” Cannot Be the Only Criterion
In real engineering work, the most common basis for switching the underlying LLM is a subjective impression formed after a few trial rounds: whether answers read smoothly, whether reasoning keeps up, whether retrieval-style questions are handled reliably. That impression does contain genuine experience, but it depends heavily on how questions are phrased, the context length, the service load on a given day, and even default UI parameters. As a result, it is not reproducible, not regression-testable, and unusable for capacity planning.
A more reliable approach is to decompose subjective impressions into observable dimensions and quantify them with a fixed evaluation set. Four categories usually work well:
- Logical reasoning and multi-step computation: derivation under multiple constraints, locating code defects, checking consistency of data definitions;
- Knowledge retrieval and time-sensitive Q&A: cases that need external information, verifiable sources, and traceable answers;
- Long-context processing: cross-document comparison, extracting key points from contracts or logs;
- Engineering usability: time to first token, throughput stability, probability of rate limiting, cost of retrying failures.
Only when “smartness” is translated into these dimensions does model selection become an engineering exercise.
2. Differentiated Evaluation for Two Scenario Types
1. Reasoning Tasks: Focus on Constraint Retention
Failures on logic tasks are usually not arithmetic mistakes but lost constraints midway. Evaluation should use multi-constraint questions with distractors and check whether the output satisfies each constraint one by one. A reusable scoring script skeleton looks like this:
# Illustrative: constraint retention rate evaluation, not tied to any specific product APIcases = load_cases("logic_cases.jsonl") # each entry contains a prompt and a list of constraintsdef evaluate(model_call, cases):total, passed = 0, 0for c in cases:out = model_call(c["prompt"])ok = all(check(c_item, out) for c_item in c["constraints"])total += 1passed += int(ok)return passed / total # constraint retention rate
It also helps to record the “number of self-corrections”: a strong model, once a contradiction is pointed out, quickly locates and fixes the problem instead of repeating the original answer or discarding all of its conclusions.
2. Search-Augmented Tasks: Focus on Traceability and Refusal
For retrieval-heavy scenarios, the core metric is not eloquence but whether citations actually exist, whether they agree with the conclusion, and whether the model can clearly refuse when information is insufficient. In engineering terms, retrieval and generation should be decoupled: the retrieval pipeline first returns candidate passages with source identifiers, then the model is required to answer only from those passages and tag citation numbers; for questions the passages cannot cover, “insufficient information” is an allowed output.
Input: question + candidate passages[1..n]Constraints:1) Use only the passage content, do not introduce external knowledge;2) Tag a citation number after each conclusion;3) When passages conflict, present them side by side and explain the difference;4) Output "insufficient information" when coverage is inadequate.
This set of constraints significantly reduces the share of outputs that “look plausible but cannot be verified,” and it is the key step in turning a subjective “good search feel” into an objective metric.
3. Release Cadence: Treat Experience Fluctuation as a Risk
LLM capabilities evolve quickly. Within the same model family, the gap between a preview release and general availability is often several months, during which defects are fixed and alignment strategies adjusted. This means a version that looked impressive during preview may already have a different behavior distribution in the GA release; conversely, the GA release may have closed the preview’s weak spots.
So selection should not chase only the “strongest right now” but evaluate three engineering properties:
- Behavioral consistency: score drift on the same evaluation set after a version upgrade;
- Version pinning: whether a specific model version can be locked so business metrics do not jitter with upstream updates;
- Rollback cost: whether you can switch back to the previous version within hours when a new version misbehaves.
The practical recommendation is a “shadow evaluation”: run the fixed evaluation set and sampled real requests on the new version in a side path, compare against the live version, then roll out gradually.
4. Compute Bottlenecks and Rate Limiting: From Waiting to Architectural Fixes
When calls are frequently rate limited, the problem is usually not that the model is not smart enough, but capacity and scheduling. Four optimizations can be made on the application side:
- Request tiering: split tasks into interactive online, near-real-time, and offline batch tiers, and run offline jobs off-peak;
- Result caching: apply semantic caching to high-frequency, low-freshness questions and return on a hit, cutting repeated inference cost;
- Context trimming: drop irrelevant history and reduce the number of retrieved passages, trading shorter inputs for higher throughput;
- Backoff and queues: use exponential backoff with jitter, plus a local queue and a concurrency cap, to avoid instantaneous spikes triggering rate limits.
# Illustrative: exponential backoff with jitterimport random, timedef call_with_backoff(fn, max_retry=5):for i in range(max_retry):try:return fn()except RateLimitError:time.sleep(min(2 ** i, 8) + random.random())raise RuntimeError("retries exhausted, move to the offline queue")
In the cloud, these capabilities are typically provided by general-purpose service categories: container platforms handle elastic replicas and rolling upgrades, message queues absorb peaks and decouple work asynchronously, object storage holds evaluation sets and cache snapshots, and logging plus monitoring and alerting are used to observe rate-limit rates, latency percentiles, and the distribution of failure causes. The capabilities Baidu AI Cloud offers in these general categories can serve as one foundation option for building such a pipeline.
5. Cost Control: Treat the Evaluation Set as a Long-Term Asset
An evaluation set is not a one-off script but a long-term asset. Maintain it in layers by scenario: a core regression set (run on every upgrade, small in size, strictly annotated), an extended set (covering the long tail and multiple languages), and an online sampling set (desensitized and fed back to reflect the real distribution). Combined with per-call statistics on input and output length, retry counts, and cache hit rate, “why did this month’s bill go up” turns from guesswork into explainable itemized attribution.
6. Implementation Checklist
- Replace subjective feel with the four-dimension metrics, and fix the evaluation set and scoring scripts first;
- For logic tasks, look at constraint retention rate and self-correction; for retrieval tasks, look at citation authenticity and refusal rate;
- Send new versions through shadow evaluation and gradual rollout, pin the version, and keep a rollback path ready;
- Under rate limiting, apply request tiering, semantic caching, context trimming, and backoff queues;
- Build an observable, elastically scalable call pipeline on general-purpose capabilities such as container platforms, message queues, object storage, logging, and monitoring with alerting.
Following this path, selection decisions shift from “it feels smarter” to “metrics are reproducible, capacity is plannable, and cost is explainable”—which is the prerequisite for LLM capabilities to genuinely become part of a business system.
