Local LLM Deployment Performance and SQL Generation: A Hands-On Evaluation
This article presents a hands-on evaluation of a production-release open-source large language model, covering two dimensions: local inference throughput and concurrency, and the model's SQL generation and Tool-Calling ability on complex business tasks. It reports concrete Prefill/Decode speeds, concurrency degradation, TTFT bottlenecks, and GPU memory trade-offs, alongside a 25-question SQL benchmark (36% strict pass rate, rising to 88% with numeric tolerance). It closes with practical tuning and prompt-engineering recommendations for teams deploying LLMs in enterprise data scenarios.
As large language models iterate quickly, enterprise applications now demand more from a model’s overall capability: strong logical reasoning and complex instruction-following, together with efficient inference throughput on a local compute architecture. Recently, I ran an in-depth test of a production-release open-source large language model in a local environment. The evaluation covered two main areas: local deployment inference speed and concurrency performance, and SQL generation plus Tool-Calling ability for complex business scenarios. Below is a detailed breakdown of the results and optimization recommendations.
Part 1: Local Inference Speed and Throughput
In a local inference engine deployment, inference speed and concurrency handling are the core metrics that determine whether a model has production value. This test ran a grid stress test across context lengths from 2k to 32k and concurrency levels from 1 to 6.
1.1 Prefill and Decode Baseline
Under single concurrency, the model showed stable baseline performance. The Prefill stage peaked at 757.7 tok/s (4k context), and across the 2k–32k range speed stayed between 629 and 758 tok/s with no noticeable degradation as length increased. This indicates the model allocates compute resources stably when handling long-context input. In the Decode stage, single-concurrency generation held steady at 23.8–28.7 tok/s, enough to meet the real-time needs of typical interactive dialogue.
1.2 Performance Degradation Under Concurrency
However, performance dropped sharply once multiple concurrent requests were introduced. In the Prefill stage, throughput fell about 30%–45% at 2 concurrency and about 50% at 4 concurrency; at 6 concurrency the degradation reached 63% (at 2k context, speed plunged from 688 tok/s to 228 tok/s).
Decode under concurrency was similarly poor. Speed fluctuated between 8 and 18 tok/s, and in the extreme case of long prompts (16k/32k) combined with 4–6 concurrency, it bottomed out at 8–11 tok/s. This steep drop with rising concurrency suggests the current deployment architecture has bottlenecks in GPU memory bandwidth scheduling and task scheduling.
1.3 TTFT Bottleneck and Queueing Analysis
TTFT (Time To First Token) is a key metric for user experience. The test showed TTFT rising linearly with context length. At 32k context, single-concurrency TTFT reached 51.5 seconds; at 6 concurrency, TTRT soared to 186.4 seconds.
Deeper analysis found that queueing is the main cause of worsening TTFT and diluted average throughput. Because the inference engine sets a small default maximum sequence count (for example, limited to 2), any requests beyond that threshold can only enter a waiting queue. Meanwhile, long Prefill tasks block one another, holding compute resources for extended periods and further worsening overall response latency.
1.4 Trade-off Between GPU Memory and Throughput
In the current deployment, GPU memory utilization has reached 0.91 and the KV Cache is nearly full. This means the system has no spare memory to carry additional concurrent tasks.
The improvement direction is to reasonably raise the inference engine’s “maximum batch sequence count” and “maximum batch token count,” which can significantly improve throughput under high concurrency. But this must be balanced against memory consumption: since the KV Cache is nearly full, blindly increasing concurrency may cause OOM (Out of Memory) crashes. It is therefore necessary to combine memory swap mechanisms (such as PagedAttention) or use GPUs with more memory. For teams without local compute tuning experience, a mature cloud LLM service platform such as Baidu AI Cloud can also be considered, relying on its elastic compute and underlying inference acceleration to avoid local concurrency bottlenecks.
Part 2: Model Capability — Complex SQL Generation and Tool-Calling
Beyond low-level inference performance, a model’s “intelligence” in real business scenarios is equally critical. This test used a set of 25 SQL generation tasks spanning four difficulty levels: trivial, easy, medium, and hard. The model was required to autonomously complete a Tool-Calling loop (generate SQL → submit it to an open-source columnar database for execution → verify the result → decide whether it passed).
2.1 Overall Pass Rate and Step Consumption
The model ultimately passed 9/25 (36.0%) of the tests: 8/8 on trivial, 1 on easy, and none on medium or hard.
On token consumption and reasoning steps, trivial and easy questions took about 2 steps on average (~2.4k tokens), while hard questions took 6.1 steps on average, with the most complex question consuming 17 steps (55.5k tokens). This reflects a degree of “divergent thinking” and ineffective retries when the model faces complex logic.
2.2 Highlight: Autonomous Generation of Complex Queries
The model’s basic SQL generation ability was solid. All 25 questions completed an autonomous Tool-Calling loop closure, with no logic breaks or tool-call failures. In scenarios involving complex multi-table JOINs and advanced window functions (such as LAG, ROW_NUMBER, and cumulative share calculations), the model consistently produced syntactically correct and logically self-consistent SQL.
2.3 Core Failure Point: Precision and Format Compliance
Although the logic held up, the model showed a clear weakness in “format compliance.” Under strict official grading (a PASS requires all of row count, column count, column names, and first-row data to match), 15 questions were logically fully correct yet lost points for being “off by a hair on format.”
The most typical case was a missing ROUND precision: the prompt explicitly required two decimal places (ROUND(..., 2)), but the model often omitted the function in the final query, causing the official first-row string comparison to fail. If numeric precision tolerance is relaxed to 1e-6, the pass rate jumps to 88% (22/25).
2.4 Structural Failures and Business-Logic Misunderstanding
Beyond precision, a few questions showed structural failures:
- Column name mismatch: In Q21 (multi-table join + discount CTE) and Q22 (QoQ window function), the model produced the correct dataset but returned column names that did not match the requirement, and in Q22 it even returned 0 rows.
- Business-definition discrepancy: In Q2, the task expected the Reseller channel share to be computed as 73.3%, but the model mistakenly interpreted it as the Internet channel. This shows the model tends to make subjective assumptions about field meaning when lacking specific business context.
Part 3: Optimization Recommendations and an Enterprise Practice Guide
Based on the above evaluation, applying a large language model to enterprise SQL generation and data analysis requires working on both engineering optimization and prompt engineering.
3.1 Inference Engine and Deployment Architecture Optimization
For the performance degradation and TTFT spikes under high concurrency, fine-grained tuning of the local inference engine is recommended:
- Dynamic batching: Enable Continuous Batching to prevent long Prefill tasks from blocking short ones.
- Memory management: With the KV Cache full (util 0.91), consider memory offloading to move part of the inactive KV Cache to CPU memory in exchange for a higher concurrency ceiling.
- Cloud elastic hosting: For business scenarios with large traffic fluctuations, hosting the inference service on a cloud container platform with auto-scaling (such as Baidu AI Cloud), combined with a monitoring and alerting system, can ensure SLA while reducing idle cost.
3.2 Prompt Engineering and Business-Logic Reinforcement
For the model’s common “right logic, wrong format” problem, hard constraints must be applied through system-level instructions:
- Stronger format requirements: Explicitly add a strong instruction in the System Prompt such as “must strictly apply ROUND or the specified formatting function as required by the task, otherwise it is treated as a failure,” and add regex validation interception on the decode side.
- Few-shot examples: For complex window functions like QoQ, rather than letting the model “reason blindly,” preloading 2–3 standard SQL examples in the prompt guides the model to reuse the structure directly, reducing token consumption and structural errors.
- Business field dictionary injection: Before running Tool-Calling, require the model to read the business field descriptions to avoid confusion between channel definitions such as “Reseller” and “Internet.”
Conclusion
Overall, current open-source large models already have strong ability to build the logical skeleton for natural-language-to-SQL conversion, but there is still room for improvement in inference throughput under extreme concurrency and in strict business-format compliance. In practice, enterprises should not focus only on a model’s benchmark scores; they must also match their own compute foundation and business-precision requirements, building a complete engineering loop from deployment-parameter tuning and prompt constraints to truly unlock the productivity of large models.
