Evaluating Local LLM Inference Performance and SQL Capabilities: A Practical Breakdown

    This article presents a local evaluation of a large language model, measuring inference throughput and latency on one side and structured SQL query accuracy on the other. It explains why a full release is not always better than a lighter version, details prefill and decode performance under concurrency, traces slowdowns to scheduling and GPU memory limits, and breaks down query failures caused by strict formatting rules. Readers will find tuning suggestions, prompt-side output contracts, and a quality-cost evaluation approach.

    1. Background: Why a Full Release Is Not Always Better Than a Lighter Version

    In large model engineering, version iteration does not always deliver monotonic improvement. New releases often enhance reasoning depth, instruction following, and long-context handling, but they may also introduce longer chains of thought and more tool-calling rounds. As a result, a model can show “higher quality but lower pass rate” or “stronger capability but higher latency” on a specific evaluation set. Therefore, evaluating a full release model requires more than a single score: inference performance and task completion quality should be observed in the same coordinate system.

    This article uses a typical local evaluation as a sample and abstracts a general methodology: one side measures throughput and latency, the other measures accuracy on structured tasks, followed by an analysis of failure causes and optimization paths.

    2. Performance Evaluation: Throughput, Latency, and Concurrency Decay

    2.1 Key Metric Definitions

    • Prefill throughput: Tokens generated per second while processing the input prompt; it determines time to first token.
    • Decode throughput: Speed of the token-by-token generation stage; it determines the reading experience.
    • TTFT (Time To First Token): Time from request submission to receiving the first token; it is highly sensitive to queuing under long prompts.

    2.2 Typical Observations

    With single-machine local deployment and a context length of around 4k, single-concurrency prefill peaked at roughly 750 tok/s, with little decay from 2k to 32k, indicating fairly efficient compute utilization for long-context prefill. Single-concurrency decode stayed stable at 24 to 29 tok/s.

    The problems concentrated in concurrent scenarios:

    • At 2 concurrency, prefill dropped by about 30% to 40%; at 4 concurrency, by about half; at 6 concurrency, by more than 60% (falling from about 688 to 228 tok/s with 2k input).
    • Decode fluctuated between 8 and 18 tok/s, and with long prompts plus 4 to 6 concurrency it fell to a low of 8 to 11 tok/s.
    • TTFT rose roughly linearly with length; with 32k input it worsened from about 51 seconds at single concurrency to about 186 seconds at 6 concurrency.

    2.3 Root Cause: Batch Limits and GPU Memory Headroom

    The decay above was not the model itself “slowing down,” but queuing at the scheduling layer. When the inference framework’s maximum number of concurrent sequences was set to 2, the excess entered a waiting queue; long prefills blocked each other, throughput was averaged out, and TTFT was dominated by queue time. Meanwhile, GPU memory utilization was already near 0.91 and the KV cache was almost full, so raising the concurrency limit directly would trigger swapping or truncation.

    The improvement direction is to adjust both the maximum number of concurrent sequences and the maximum tokens per batch, together with a memory budget:

    1. # Illustrative configuration (not specific product parameters)
    2. max_num_seqs: 2 -> 8
    3. max_num_batched_tokens: increase to match GPU memory headroom
    4. gpu_memory_utilization: 0.91 -> 0.85 (leave room for fragmentation and bursts)
    5. enable_chunked_prefill: true # split long prefills into chunks to reduce head-of-line blocking

    With chunked prefill enabled, long prompts no longer monopolize the compute window, short requests can cut in and finish, and the long tail of TTFT narrows noticeably. If GPU memory is genuinely insufficient, consider quantizing the KV cache, limiting the maximum context per request, or routing extremely long-context requests to a separate instance to physically isolate long and short requests.

    3. Capability Evaluation: Breaking Down Structured Query Accuracy

    3.1 Evaluation Design

    The task set contained 25 structured query questions across four difficulty levels: trivial, easy, medium, and hard. The model had to complete the tool-calling loop autonomously: generate a query → execute it in an embedded analytical database → validate the result → decide pass or fail. The criteria were strict: a question passed only if row count, column count, column names, and the first-row string all matched.

    Result: 9 questions passed, a 36% pass rate. All trivial questions passed, half of the easy ones passed, and all 13 medium and hard questions failed.

    3.2 Capability Highlights

    The tool-calling chain was complete: the model autonomously went through the “generate–execute–validate” loop on all 25 questions without giving up midway. Complex multi-table joins and window functions (such as lag-based retrieval, ranking, and cumulative share) were largely correct at the syntax level, showing that the model’s relational query abstraction ability is not weak.

    3.3 Main Failures: Precision and Format Constraints

    About 60% of the failed questions were “right logic, one point off on format”: the prompt explicitly required keeping two decimal places, but the model omitted the rounding function, and the strict criteria required an exact match of the first-row string. If numeric comparison were relaxed to a tolerance of 1e-6, the pass rate would rise to about 88%. This reveals a common engineering fact: under strict string comparison, format compliance is equivalent to part of correctness.

    There were also three types of structural failures:

    1. When multi-table joins were combined with intermediate result sets, the final returned column names did not match expectations;
    2. Window-function questions returned 0 rows with mismatched column names, reflecting a misunderstanding of the intended semantics;
    3. Business-definition confusion, such as computing the wrong channel dimension, which shifted the share results overall.

    3.4 Cost Observations

    Simple questions converged in an average of two steps and about 2.4k tokens; hard questions averaged more than six steps, with individual questions reaching 14 to 17 steps and around 55,000 tokens. Steps and token consumption grew superlinearly with difficulty, the main source of long-tail latency and cost.

    4. Optimization Recommendations

    Inference side: Enable chunked prefill, moderately raise the concurrency limit while reserving GPU memory headroom, isolate and apply tiered rate limiting to long and short requests, and bring down the TTFT long tail.

    Prompt side: Write the output contract as hard constraints in the system prompt, for example:

    1. 1. Strictly apply the numeric rounding and column naming required by the question;
    2. 2. Keep output column order and column names exactly consistent with the prompt;
    3. 3. If the result is empty, first check filter conditions and join keys, then rewrite once;
    4. 4. Each output should contain only the final query statement, with no additional explanation.

    Evaluation side: Distinguish two sets of criteria, “semantic correctness” and “strict format,” and report them separately to avoid misjudging format issues as capability defects; also record steps and token consumption to build a two-dimensional quality-cost dashboard. Using general capabilities such as Baidu AI Cloud’s container platform, log service, and monitoring and alerting, stress testing, evaluation, and cost observation can be chained into a closed-loop pipeline for regression comparison across versions.

    5. Conclusion

    The value of a full release must be proven in a measurable way. On the performance side, the bottleneck is usually scheduling and GPU memory rather than the model itself; on the quality side, strict criteria amplify format compliance into a decisive factor. Only by including both in the evaluation system, together with parameter tuning and output-contract constraints, can a truly reliable assessment of a large model version be made.