Benchmarking Local LLM Inference Performance and SQL Generation: A Practical Evaluation

    This article presents a systematic evaluation of a locally deployed large language model, covering both inference performance (prefill/decode throughput, TTFT, and concurrency behavior) and task capability (SQL generation with tool-calling loops). It details the test methodology, observed bottlenecks, root-cause analysis, improvement directions, and lessons for model selection and deployment. The findings highlight that default scheduling configurations often skew performance conclusions, and that distinguishing format-following errors from reasoning errors is critical when judging model capability.

    Introduction: Why Systematic Model Evaluation Matters

    After a large language model (LLM) is deployed locally, the first question engineering teams often face is: is it actually good enough? A casual impression from a few chat turns cannot support production decisions. What truly matters is a measurable, reproducible evaluation framework. This article walks through a complete local model benchmark, analyzing both inference performance and task capability, and summarizes test methods, bottleneck identification, and optimization strategies for developers currently evaluating and deploying LLMs.

    The evaluation covers two main tracks: (1) inference speed and concurrent load handling in a local deployment environment, and (2) the model’s SQL generation and tool-calling ability in real data analysis tasks.

    Part 1: Inference Performance Testing – Methods and Key Metrics

    1.1 Test Design

    Inference performance testing should cover two core phases: prefill (which determines time-to-first-token, TTFT) and decode (which determines streaming output speed). Two variables must be controlled: input length (recommend covering 2k, 4k, 16k, 32k tokens) and concurrency (start from 1 and gradually increase to 6 or more), to observe both length degradation and concurrency degradation curves.

    1.2 Observed Results

    In the local deployment environment under test, the following phenomena were observed:

    • Prefill throughput: Single-concurrency peak ~757 tok/s at 4k input; across 2k–32k inputs, throughput stayed between 629–758 tok/s. Increasing input length did not significantly degrade throughput, indicating good compute utilization.
    • Prefill concurrency degradation: At 2 concurrent requests, throughput dropped ~30–45%; at 4 concurrency, ~50% drop; at 6 concurrency, degradation reached 63% (from 688 tok/s to 228 tok/s at 2k input).
    • Decode speed: Single-concurrency decode stayed stable at 23.8–28.7 tok/s; under concurrency, it fell to 8–18 tok/s, with long inputs combined with 4–6 concurrency hitting lows of 8–11 tok/s.
    • TTFT: Increased nearly linearly with input length. At 32k input, TTFT worsened from 51.5 seconds (single concurrency) to 186.4 seconds at 6 concurrency; queue waiting was the primary cause.

    1.3 Bottleneck Analysis

    The analysis shows that the bottleneck was not hardware compute power but the scheduling configuration of the inference framework: the current maximum number of concurrent sequences was set to 2. When requests exceeded 2, new requests had to queue, and long-input prefill steps blocked each other, causing TTFT to spike and prefill throughput to be diluted.

    This is a classic deployment pitfall — many teams simply run stress tests with default configuration and conclude “the model is slow,” when in fact the config is too conservative.

    1.4 Optimization Directions

    Possible improvements include:

    1. Raise the concurrent sequence limit and batch token limit, allowing the scheduler to process more requests simultaneously and improve overall throughput under high concurrency.
    2. Balance VRAM budget: Current VRAM utilization reached 0.91, with KV cache near full. Higher concurrency requires more careful memory planning, such as reducing per-request maximum length or adopting more efficient attention implementations.
    3. Differentiate by business scenario: Interactive conversations care more about decode speed and TTFT; batch offline tasks care about overall throughput. These scenarios should use different scheduling parameter combinations.

    Part 2: Model Capability Testing – SQL Generation in a Real-World Setting

    2.1 Task Design

    The capability evaluation used 25 SQL generation questions of increasing difficulty (8 trivial, 2 easy, 2 medium, 13 hard). The model was required to autonomously complete a full tool-calling loop: understand the problem → generate SQL → execute it on an embedded analytical database → verify results → confirm pass. The pass criteria were strict: row count, column count, column names, and first-row content had to match exactly.

    2.2 Overall Results

    Final score: 9/25 passed (36%). Of these, all 8 trivial questions passed, 1 easy question passed, and all medium and hard questions failed. At first glance, the numbers seem disappointing, but a deeper analysis of the failure reasons reveals a much more nuanced picture.

    2.3 Failure Root-Cause Breakdown

    Layer 1: Format-following issues (the largest share). Among the failed questions, roughly 15 fell into the “logic correct, format one step off” category — the model often omitted the explicitly requested rounding to two decimal places, while the verification logic required exact string matching of the first row. This means the model’s core reasoning ability is fine; the weakness lies in adherence to output format instructions.

    Layer 2: Semantic ambiguity in business metrics. For example, one question expected a 73.3% share calculated by dealer channel, but the model used the online channel instead. These errors indicate business semantics misunderstanding, which can be mitigated by providing clearer metric definitions in the prompt.

    Layer 3: Structural failures. A few complex questions (multi-table joins plus discount CTEs, or window functions with period-over-period comparisons) produced wrong column names or empty results — these represent genuine capability boundaries.

    Notably, if numeric precision tolerance were relaxed to 1e-6, the pass rate would rise to 22/25 (88%). This illustrates how the evaluation criteria themselves heavily affect conclusions. Teams should set verification rules according to actual business tolerance.

    2.4 Notable Strengths Observed

    • All 25 questions were completed through the full tool-calling loop, with no crashes or premature stops — the agentic workflow was stable.
    • Complex multi-table JOIN operations and window functions (e.g., LAG, ROW_NUMBER, cumulative share calculations) were written correctly, showing solid SQL fundamentals.
    • Token consumption correlated with difficulty: simple questions averaged 2 steps and ~2.4k tokens; hard questions averaged 6.1 steps; the most complex question took 17 iterations and ~55.5k tokens. This provides a useful baseline for cost estimation.

    Part 3: Improvement Suggestions and Lessons Learned

    3.1 Prompt Engineering Optimization

    Explicitly strengthening the system prompt with “must strictly round and format output as required by the problem statement” can cheaply fix the largest category of format-related failures. For frequently failing window-function patterns, providing example SQL in the prompt can guide the model to reuse correct structures.

    3.2 Performance-Side Optimization

    For production deployment, scheduling parameters should be adjusted according to expected concurrency, and monitoring alerts should be set for TTFT and queue depth. When VRAM is limited, consider quantized versions or reducing the maximum context length instead of aggressively lowering concurrency caps.

    3.3 Evaluation Methodology Takeaways

    This benchmark yields three reusable insights:

    1. Performance conclusions must be accompanied by the exact deployment configuration — stress numbers without config context are meaningless.
    2. Capability evaluations must distinguish “reasoning errors” from “format errors.” Format errors can often be quickly fixed with prompt changes and should not be used to dismiss the model.
    3. Report both strict and tolerance-based pass rates to give a more complete picture of model quality.

    Conclusion

    A good model evaluation does not simply render a “good” or “bad” verdict. It answers three questions: where are the bottlenecks, where are the capability boundaries, and how much room for optimization exists? Using the stress-test methodology and task-oriented evaluation framework described here, teams can build a clear data-driven basis before model selection and go-live. For teams looking to deploy and validate models quickly on the cloud, general cloud products such as elastic compute, logging services, and monitoring/alerts (e.g., those offered by Baidu AI Cloud) can help lower the barrier to setting up evaluation environments and ongoing observation, making model assessment a more integrated part of the development workflow.