Evaluating Latency and Stability for Large Language Models During Gray Testing
This article breaks down the vague feeling of "slowness" during LLM gray testing into measurable components—TTFT, output throughput, cache hit ratio, reasoning time, tool rounds, and tail latency. It explains how to set up a reproducible measurement workflow, diagnose issues like "small-step" tool-call behavior and benchmark-driven trade-offs, and build a practical evaluation checklist with routing and fallback strategies for stable production deployment.
1. Background: What Does “Slow” Actually Mean During Gray Testing?
When a new model enters a gray release or preview phase, the most common complaint from developers is that it feels “slow.” But “slow” is a mixed perception. Without breaking it down, you cannot locate the bottleneck or tell whether the issue lies with the model, service scheduling, or usage patterns. Once decomposed, it contains at least five independent quantities:
- Time to First Token (TTFT): The time from sending a request to receiving the first visible output. This drives the anxiety of “I clicked and nothing happened.”
- Output Throughput (TPS): The number of tokens generated per unit of time. This determines how long you wait for long answers.
- Cache Hit Ratio: The reuse ratio for identical prefix portions. This directly affects the cost and latency of multi-turn conversations and repeated contexts.
- Reasoning Time and Tool Rounds: The internal reasoning time and number of external actions before the model produces a final answer. This determines the “wall-clock time” to complete a task.
- Service Stability: The variance of the above metrics over time, especially tail latency (P95/P99).
A common misjudgment is looking only at TPS. In interactive coding scenarios, total task completion time is closer to:
Total time ≈ TTFT + reasoning time + Σ(per-round tool-call round-trip latency + output tokens in that round / TPS)
When a model tends to split a single modification into many tiny steps, the number of rounds in the summation grows sharply. Even if TPS per round is not low, the overall experience still feels slow. This explains why “throughput looks fine, but it never feels fast enough.”
2. Metric Definitions: Measure Correctly Before Optimizing
The biggest risk during gray testing is being misled by a single experience. It is recommended to fix a minimal reproducible measurement process:
- Fix the inputs: Prepare a task set stratified by length and difficulty (e.g., small single-file edits, cross-file refactoring, bug fixes requiring retrieval and localization). Avoid repeatedly testing with the same prompt.
- Use percentile statistics, not averages: Record at least P50/P95. Long tails are the real experience killers. Phenomena like “P95 reaching tens of seconds” in reports are completely masked by averages.
- Separate cold start from warm state: When a new model first goes live, the instance pool is not yet warmed up. Samples from the first few hours should not be used directly for conclusions.
- Record cache hits: In multi-turn sessions, if prefix reuse fails, every round must reprocess the long context, naturally raising TTFT.
- Record action sequences: Log the tool-call sequence (retrieval, file reading, execution, validation) to analyze “round inflation.”
Example collection logic:
record = {"task_id": task_id,"ttft_ms": first_token_time - request_time,"tps": output_tokens / (end_time - first_token_time),"cache_hit_ratio": cached_prompt_tokens / prompt_tokens,"think_ms": reasoning_end - first_token_time,"tool_rounds": len(tool_calls),"wall_clock_ms": end_time - request_time,}
With this table, you can attribute “slowness” to a specific stage rather than vaguely switching models.
3. Issue One: “Small-Step” Tool Calls and Overfitting to Minimalist Execution Frameworks
Another frequent phenomenon in gray testing is that the model prefers command-line methods for retrieval and text processing instead of calling structured file-reading or content-search tools, and it splits a single modification into many consecutive small operations.
From an engineering perspective, this is usually not “the model getting dumber,” but a mismatch between the training distribution and the execution framework. When a model is heavily reinforced on a minimalist execution framework (exposing only a single generic command-execution entry point), it develops a “everything is a command” path dependency. Once switched to a tool-richer framework, it sticks to the old habit, leading to:
- Reduced observability: Structured tools usually include parameter validation and logging, while the command approach hides semantics inside strings.
- Slow context growth but exploding rounds: Moving only one small step at a time accumulates many low-information round-trips in history.
- Higher error recovery cost: When command concatenation fails, the model often sends another command to patch it, further amplifying rounds.
There are three viable mitigation approaches. First, prompt-level constraints explicitly requiring “locate first, then modify in one shot.” Second, framework-level aggregation that converges high-frequency read-only operations into batch interfaces to reduce round-trips. Third, policy-level budgets that set caps on rounds and duration, forcing convergence once exceeded.
Constraint example:- Use one retrieval to locate candidate positions, then submit modifications in one shot;- Merge read-only operations into a single batch request; prohibit line-by-line exploration;- Set a tool-round limit N per task; after exceeding it, a conclusion or a list of remaining risks must be provided.
4. Issue Two: “Trading Speed for Benchmark Scores” and a Rational Response
Benchmark scores and real interactive experience are not the same objective function. Benchmarks favor automatically judgeable pass rates, and pass rates can often be bought with longer reasoning and more attempt rounds—at the cost of higher latency and cost. Hence the common phenomenon: a new model is stronger on the leaderboard but slower in hand.
The rational response is not to deny benchmarks but to establish tiered selection:
- For latency-insensitive tasks like offline batch processing and large-scale refactoring, prioritize pass rate and cost per task.
- For interactive development and debugging, prioritize TTFT, round efficiency, and stability variance.
- For high-risk changes, prioritize verifiability (whether tests can run automatically, whether reviewable diffs are output) rather than single-point cleverness.
At the same time, treat “stability” as a first-class metric. Large fluctuations in the early days of a new model launch are normal; typically an observation window is needed for the server side to complete scaling and scheduling convergence. During this period, binding critical pipelines to a single new model is a high-risk decision. A safer approach is to implement capability routing and fallback at the gateway layer, retaining a fallback option with stable latency performance.
Routing strategy example:if task.type == "interactive": select low-TTFT, low-round modelelif task.type == "batch": select high-pass-rate modelif p95_latency > threshold or error_rate > threshold: automatically fall back to the fallback model
5. An Actionable Evaluation Checklist
- Do you report P50/P95 for TTFT and TPS separately, rather than giving a single average “speed”?
- Do you track cache hit ratio and evaluate it separately in multi-turn scenarios?
- Do you record tool rounds and command ratio to identify “small-step” tendencies?
- Do you separate cold-start samples from stable-period samples?
- Do you set round/duration budgets and automatic convergence mechanisms?
- Do you prepare a fallback model and fallback thresholds to avoid single-point dependency?
- Do you factor “verifiability” (tests passing, reviewable diffs) into selection weights?
6. Conclusion
The core methodology of gray testing is one sentence: turn the vague “slow” and “unstable” into measurable, attributable, and regression-testable metrics. When TTFT, throughput, cache, reasoning time, tool rounds, and tail latency are measured separately, model selection shifts from camp preference to engineering decision. In model service practices on platforms like Baidu AI Cloud, it is likewise recommended to use a unified gateway to handle multi-model capabilities, establish baselines with logging services and monitoring alerts, and use gray release and fallback mechanisms to absorb the early volatility of new model launches—thereby balancing capability evolution with business continuity.
