How to Evaluate LLMs Scientifically: A Full Workflow for Benchmarking Local Deployment Performance and Task Capability
This article presents a systematic approach to evaluating large language models along two independent dimensions: serving performance (throughput, latency, concurrency) and task capability (accuracy in target scenarios such as code and SQL generation). Drawing on real local deployment test results, it explains key metrics, how to diagnose bottlenecks, how to build a reproducible SQL generation benchmark, and how to turn evaluation findings into optimization actions and a sustainable evaluation pipeline.
Why Systematic Model Evaluation Matters
When deploying large language models, teams often make two opposite mistakes: choosing a model based solely on officially published benchmark scores, or judging model quality from the subjective feel of a few conversations. The former ignores differences in serving performance under real deployment conditions, while the latter lacks reproducible, quantified evidence.
A rigorous evaluation should cover two independent dimensions:
- Serving performance: When the model runs as an online service, how well does it handle throughput, latency, and concurrent load?
- Task capability: How accurate and stable is the model on your target business scenarios, such as code generation, SQL generation, or document understanding?
These two dimensions frequently diverge—a stronger model may deliver lower throughput than a lighter variant under a particular inference framework configuration. That’s why evaluation must be tied to your actual deployment setup.
Serving Performance Evaluation: Key Metrics and Measurement Methods
Key Metric Definitions
Performance evaluation of LLM inference services typically focuses on the following metrics:
| Metric | Meaning | What to Watch |
|---|---|---|
| Prefill throughput | Speed of processing the input prompt (tok/s) | Whether it degrades as input length grows |
| Decode speed | Per-token generation speed (tok/s) | Determines perceived smoothness of streaming output |
| TTFT (Time to First Token) | Time from sending a request to receiving the first token | The metric users are most sensitive to |
| Concurrency decay curve | How throughput/latency change with concurrency level | Determines service capacity limits |
Analyzing a Typical Benchmark Result
In one local deployment test using a common open-source inference serving framework, the model showed the following results:
- Single-concurrency peak prefill throughput of about 757 tok/s (4k input); the 2k–32k range held steady at 629–758 tok/s with no significant length-based degradation, indicating stable prefill efficiency on the compute side.
- Single-concurrency decode speed of roughly 23.8–28.7 tok/s, which delivers an acceptable streaming experience.
- Noticeable concurrency decay: prefill throughput dropped about 30–45% at 2 concurrent requests, and about 63% at 6 (from 688 down to 228 tok/s at one input length).
- TTFT rises linearly with input length: at 32k input, single-concurrency TTFT was about 51.5s, worsening to 186.4s at 6 concurrent requests.
Locating the Bottleneck: Queuing Is the Main Culprit
Further analysis showed that the deterioration in TTFT was rooted not in the model itself, but in service configuration:
- The inference service limited max concurrent requests per instance to 2; requests beyond that queued.
- Prefill computation for long prompts is time-consuming, so multiple long requests blocked each other.
- Queuing wait time stacked on top of computation time, causing TTFT to degrade non-linearly.
- Prefill throughput was statistically “averaged down” by idle queuing time, appearing as significant decay under concurrency.
Corresponding optimization directions include:
- Increase the max concurrent batch size (parameters like max-num-seqs) and the max tokens per batch so more requests can be scheduled through continuous batching.
- Mind the memory trade-off: KV cache utilization was already at 0.91, near the ceiling—raising concurrency blindly will cause KV eviction or OOM.
- If memory is insufficient, consider quantization, KV cache compression, or shortening the system prompt to free up KV space.
- For very long inputs, consider prefix caching to reuse the KV of shared prefixes and reduce repeated prefill overhead.
Key takeaway: When performance issues arise, check scheduling and configuration first before blaming the model or hardware. Data jitter during the decode phase (e.g., speed spikes at individual length points) also reminds us that single-point measurements are noisy—key conclusions should be based on averaged results across multiple runs.
Task Capability Evaluation: A SQL Generation Case Study
Designing the Evaluation Framework
Text-to-SQL is a typical scenario for testing a model’s logical reasoning and tool-calling abilities. A reproducible evaluation framework usually includes:
- A tiered question bank: Questions graded by difficulty (e.g., trivial / easy / medium / hard), covering single-table queries, multi-table JOINs, aggregation, window functions, and recursive CTEs.
- A closed tool-calling loop: The model generates SQL → executes it against a local database (e.g., an embedded analytical database) → the program verifies the result → on failure, the error message is fed back to the model for a retry, simulating a real agent loop.
- Strict pass criteria: Row count, column count, column names, and the first row of data must all match exactly—avoiding lenient “close enough” judgments that mask real problems.
Interpreting the Results
A 25-question test produced very representative results:
- Overall score 9/25 (36%): near-perfect on easy questions, but all 13 hard questions wrong—accuracy correlated strongly with difficulty.
- The tool-calling loop completed 100% of the time: For every question, the model autonomously completed the “generate → execute → verify → fix” loop; complex multi-table JOINs and window functions (LAG, ROW_NUMBER, cumulative share, etc.) were largely correct at the SQL logic level.
- The biggest source of lost points was format precision: The model frequently omitted
ROUND(…, 2)required by the question, and since judgment required strict first-row string matching, about 15 questions were “logically correct, one notch off on format.” Relaxing numeric precision to 1e-6 would raise the pass rate to roughly 88%. - Genuine structural errors appeared in only a few questions: e.g., mismatched column names, misinterpreting the channel dimension (computing one channel when another was expected), and period-over-period window functions returning 0 rows.
- Token consumption correlated with difficulty: Easy questions averaged 2 steps and about 2.4k tokens; hard questions averaged 6 steps, with the most complex reaching 17 steps and 55k tokens—directly useful for cost estimation and context window planning.
From Evaluation Results to Optimization Actions
The value of evaluation lies in guiding improvement, not just producing a score:
# Example of targeted constraints in the system prompt- All outputs involving amounts, ratios, or means must strictly followthe question's requirements, using ROUND(expr, n) to keep thespecified precision;- Final result column names must exactly match the output columnnames required by the question;- For period-over-period / year-over-year window functions, payattention to partition keys and ordering keys.
Beyond prompt reinforcement, you can also:
- Provide a few-shot examples in the prompt for error-prone patterns like window functions;
- Add a “format retry” channel to the judging script: when logic is correct but only formatting is off, feed back the precise diff so the model self-corrects, avoiding the token waste of a full retry;
- Turn failed cases into a regression question bank for version-over-version comparison.
Building a Sustainable Evaluation System
A single evaluation is only a snapshot. Teams should establish an ongoing evaluation mechanism:
- Pin the baseline environment: Lock in hardware, inference framework version, and service parameters so cross-version comparisons remain valid.
- Baseline your metrics: Record throughput and TTFT baselines for each input length and concurrency level; before a new version goes live, run the same script and compare for regressions.
- Version your capability benchmarks: Put question banks and judging scripts under version control, with pass criteria that clearly separate “logic errors” from “format errors.”
- Include a cost dimension: Factor token consumption and average retry steps into the score to weigh capability against cost.
- Replay real traffic: Supplement synthetic questions with anonymized real business queries, which reflect actual performance better than synthetic ones.
Conclusion
There is no shortcut to LLM evaluation—at its core, it is a discipline of reproducible measurement engineering. For serving performance, examine prefill/decode-separated throughput curves and concurrency decay, and check scheduling and configuration bottlenecks first. For task capability, rely on a tiered question bank plus an automated framework with strict judgment, clearly distinguishing “one notch off on format” from genuine logic errors. Only by turning both dimensions into repeatable pipelines can model selection, parameter tuning, and version upgrades move from gut feeling to data.
