Local LLM Deployment Benchmark: Inference Performance and Complex SQL Generation
This benchmark evaluates a mainstream open-source large language model in a local deployment environment. It examines Prefill and Decode throughput, concurrency-related latency bottlenecks, TTFT behavior, GPU memory and KV Cache constraints, as well as the model’s ability to generate and iteratively refine complex SQL. The results highlight practical optimization strategies for local inference and production-grade AI applications.
As open-source large language models continue to mature, more enterprises and developers are deploying models locally to protect data privacy and reduce long-term inference costs. In practice, however, real-world inference performance and complex business-code generation often differ from the theoretical results published by model providers.
This article presents a multidimensional benchmark of a mainstream open-source model deployed locally. It analyzes throughput, latency bottlenecks under different concurrency levels, and SQL generation quality in complex database scenarios. It also provides optimization recommendations for developers.
1. Inference Performance Benchmark Results
Inference performance is a core indicator of whether a large language model is suitable for production. Using standardized benchmarking tools, we measured the model’s Prefill and Decode stages in detail.
1.1 Throughput and Concurrency Degradation
With a single concurrent request, Prefill throughput reached a peak of 757.7 tokens per second at a 4K context length. Across the 2K–32K range, throughput remained relatively stable at 629–758 tokens per second, with no obvious performance degradation as the input length increased. Decode throughput was also stable under single concurrency, ranging from 23.8 to 28.7 tokens per second.
Once multiple concurrent requests were introduced, performance degraded sharply:
- Prefill: Throughput decreased by approximately 30%–45% at two concurrent requests and by about 50% at four. At six concurrent requests, the decline reached 63%. For example, at a 2K context length, throughput dropped from 688 tokens per second to 228 tokens per second.
- Decode: Under concurrent workloads, decoding speed fell to 8–18 tokens per second. With long prompts of 16K or 32K tokens and four to six concurrent requests, throughput dropped as low as 8–11 tokens per second.
- This steep degradation indicates serious compute and memory-access scheduling bottlenecks when the model processes long inputs at high concurrency on the available local hardware.
1.2 Latency Analysis: Time to First Token
Time to First Token (TTFT) directly affects user experience. The benchmark showed that TTFT increased approximately linearly with input length. At a 32K context length, TTFT reached 51.5 seconds with one concurrent request and rose to 186.4 seconds with six concurrent requests.
Further analysis showed that queueing delays were the primary cause of the worsening TTFT.
2. Performance Bottlenecks and Optimization Paths
The performance results require a closer examination of the underlying hardware and software scheduling mechanisms to identify practical optimization strategies.
2.1 Concurrency Queue Blocking
The local deployment used a mainstream open-source inference framework whose default max-num-seqs value was relatively small, such as 2. When the number of concurrent requests exceeded this limit, additional requests entered a queue.
Long-context Prefill is compute-intensive and occupies the computational cores for an extended period. Concurrent requests can therefore block one another, preventing queued requests from being processed promptly. This directly increases TTFT and causes aggregate Prefill throughput to be divided across requests.
2.2 GPU Memory Limits and KV Cache Constraints
When compute resources are limited, GPU memory is often the primary constraint on concurrency. During testing, GPU memory utilization reached 0.91, while the KV Cache was close to capacity.
KV Cache size is proportional to the model’s number of layers, number of attention heads, head dimension, sequence length, and batch size. When GPU memory is nearly exhausted, increasing max-num-seqs without further analysis can easily trigger an OOM (Out of Memory) error.
2.3 Optimization Recommendations and Elastic Cloud Scaling
Developers can tune the inference framework’s max-num-batched-tokens parameter to improve throughput under high concurrency. However, this must be balanced carefully against available GPU memory and the target concurrency level.
When an application experiences sudden traffic spikes, local hardware alone may not be sufficient to maintain low latency. A hybrid cloud-native deployment can provide additional capacity. For example, cloud GPU instances or a container platform can be used to scale inference nodes dynamically during peak periods. Load balancing can then distribute requests to cloud-based nodes, reducing pressure on local GPU memory and mitigating queue blocking.
3. Evaluation of Complex SQL Generation
Inference speed is only one aspect of model quality. Logical reasoning and code generation capabilities are equally important to developers. This evaluation used 25 SQL-generation tasks covering multiple difficulty levels.
3.1 Overall Pass Rate and the Tool-Calling Loop
The model achieved an overall pass rate of 9 out of 25, or 36.0%. It passed all 8 easy tasks, 1 of 2 medium-difficulty tasks, and none of the 13 hard tasks. Overall performance was relatively modest, and some results were even weaker than those of a lightweight model with the same architecture.
Despite the low pass rate, the model showed strong autonomy. It successfully completed the tool-calling loop for all 25 tasks:
- Generate a SQL statement.
- Execute it through the local database engine.
- Validate the result.
- Revise the SQL based on any errors.
For complex multi-table JOIN queries and tasks involving window functions such as LAG and ROW_NUMBER, including cumulative-share calculations, the model generally produced logically correct SQL. Structural errors appeared primarily in Q21 and Q22.
3.2 Main Sources of Failure: Precision and Formatting
A detailed analysis showed that many failures were not caused by fundamental logical errors, but by insufficiently strict formatting. Among the 20 tasks that did not fully pass, 15 were cases where the logic was correct but the output format was slightly wrong.
- Missing
ROUNDprecision: The model frequently omitted the explicitly requiredROUND(..., 2)function. Because the official evaluator required an exact match for the first-row string, these results were marked incorrect. - Structural errors: In Q21, which involved multiple table relationships and a discount-related CTE, the returned column names did not match the expected names. In Q22, which required a quarter-over-quarter window-function calculation, the column names were incorrect and the query returned zero rows.
- Business-definition mismatch: In Q2, the task expected the share of the Reseller channel to be calculated as 73.3%. The model instead calculated the share of the Internet channel, indicating a misunderstanding of the business terminology.
3.3 Token Usage and Iteration Cost
The benchmark showed that the cost of trial and error increased with task difficulty. Easy tasks required an average of only two steps and approximately 2.4K tokens. Hard tasks required an average of 6.1 steps.
Q10 required the most iterations: 17 in total, consuming 55.5K tokens. Q25 required 14 iterations and consumed approximately 55K tokens. These frequent tool calls and self-correction cycles consumed substantial compute resources and increased execution time.
4. Practical Optimization Recommendations
The following engineering measures can help address the weaknesses identified during the SQL-generation evaluation.
- Use stronger system-prompt constraints: Explicitly state requirements such as “Always use the required
ROUNDfunction and preserve the specified number of decimal places” and “Returned column names must exactly match the names required by the task.” For complex window-function scenarios such as Q22, a one-shot SQL example can guide the model toward a more reliable query structure. - Adapt evaluation and post-processing to business needs: Strict evaluation based on row count, column count, column names, and exact first-row matching is useful for standardized benchmarking. However, if floating-point tolerance is relaxed to
1e-6, the pass rate in this benchmark would increase to 88%. This suggests that the model’s core logical understanding is largely sufficient. In production, developers can add a post-processing script to automatically insert missingROUNDfunctions or rename columns, compensating for weaknesses in format adherence.
5. Conclusion
Local deployment subjects large language models to two simultaneous challenges: inference performance and business-task capability.
This benchmark shows that the evaluated model delivers strong throughput under single concurrency, but performance degrades substantially for long inputs at high concurrency because of GPU memory limits and scheduling constraints. For complex SQL generation, the model has a reliable tool-calling and self-correction loop, yet still needs improvement in strict format adherence and deeper interpretation of business definitions.
In practical deployments, developers should combine prompt engineering, output post-processing, and elastic cloud capacity where necessary to build stable and efficient AI applications.
