Local LLM Inference Performance and SQL Generation Evaluation: A Breakdown
This article analyzes a local evaluation of a large-parameter model, separating inference performance from structured query capability. It breaks throughput into prefill speed, concurrency decay, and time-to-first-token, showing that slowdowns stem from scheduling and memory limits rather than the model itself. It also examines a 25-task SQL benchmark where the model passed 9/25 under strict matching but reached roughly 22/25 with numeric tolerance, highlighting output contracts as a key failure source. Readers will find measurement methods, bottleneck analysis, tuning directions, and practical recommendations.
1. Background: Why a “Stable” Release Is Not Automatically Better Across the Board
In LLM engineering, the move from preview to a stable release usually reflects convergence in training data mix, alignment strategy, and inference implementation. In practice, however, a higher version number does not guarantee improvements across every dimension. A local test of a large-parameter model showed a typical structural split: some metrics in the core inference path were acceptable, but pass rates on structured query tasks requiring strict formatting were clearly lower than those of a lighter model in the same family.
This is not unusual. Lighter models tend to follow instructions more closely on narrow tasks, while larger models are stronger at complex reasoning but more prone to instruction drift. The first principle of evaluation, therefore, is to assess by dimension and scenario with reproducible results, rather than issuing a vague “better or worse” verdict.
2. Inference Performance: Turning “Speed” into Measurable Metrics
A common mistake in local inference evaluation is reporting only tokens/s. A more rigorous approach breaks this into at least four groups of metrics.
2.1 Prefill: Compute-Bound with Low Sensitivity to Length
In testing, single-concurrency prefill peaked at about 757 tok/s with a 4k context and stayed within 629–758 tok/s from 2k to 32k, with no clear degradation as length increased. Under this deployment configuration, prefill is constrained mainly by compute and batching efficiency rather than the quadratic growth of attention with sequence length (typically aided by paged attention and efficient kernel implementations).
2.2 Concurrency Decay: Throughput Does Not Scale Linearly
As concurrency rose, prefill throughput dropped significantly: about 30%–45% at 2 concurrent requests, about 50% at 4, and at 6 concurrent requests with a 2k context it fell from 688 to 228 tok/s, a drop of roughly 63%. Decode throughput also fell from 23.8–28.7 tok/s at single concurrency to 8–18 tok/s, hitting a low of 8–11 tok/s with long prompts at 4–6 concurrent requests.
Key takeaway: the throughput decay is not the model “slowing down” but the result of scheduling and resource allocation.
2.3 Time to First Token: Queueing Is the Main Cause
Time to first token rose roughly linearly with context length, reaching about 51.5 seconds at single concurrency with a 32k context and 186.4 seconds at 6 concurrent requests. Breaking down the latency shows that queueing accounted for the majority, rather than prefill computation alone.
2.4 Locating Bottlenecks and Tuning Directions
When the maximum number of concurrent sequences in the inference framework is capped at 2, excess requests enter a queue; long prefill tasks block one another, further amplifying latency. Possible adjustments include raising the maximum number of concurrent sequences and the maximum tokens per batch, but memory must be balanced: when GPU memory utilization is already at 0.91 and the key-value cache is nearly full, blindly increasing concurrency triggers swapping or preemption and worsens tail latency.
An illustrative configuration approach is shown below (it expresses parameter relationships only, not a specific product interface):
# Goal: improve high-concurrency throughput while keeping memory usage in checkmax_num_seqs: 2 -> 6max_num_batched_tokens: increase to cover long promptsgpu_memory_utilization: 0.91 -> lower depending on remaining cache headroom
The practical recommendation is to first run a concurrency-step stress test at a fixed context length, then a length-step stress test at fixed concurrency, and finally plot a three-dimensional latency–throughput–memory trade-off curve.
3. Structured Query Capability: Format Is Correctness
3.1 Evaluation Design
The task set contained 25 questions across four difficulty levels: trivial, easy, medium, and hard. The model had to complete a tool-calling loop autonomously: generate a query, execute it in an embedded analytical database, validate the result, and return whether it passed. The criteria were strict: a pass required exact matches on row count, column count, column names, and the first-row string.
The result was 9/25 passing (36%): trivial 8/8, easy 1/2, medium 0/2, hard 0/13.
3.2 Strengths
All 25 questions completed the multi-step tool-calling loop with no interruptions. Complex multi-table joins and window functions (such as lag-based retrieval, ranking, and cumulative share) were written correctly, indicating solid capability at the query-semantics level.
3.3 Main Failure Points: Precision and Column Names
Fifteen questions were “logically correct but failed on format” because the model omitted the two-decimal rounding function required by the prompt. Since the criteria demanded exact string matching on the first row, such deviations caused failures. Another 3 were structural failures: two returned column names that did not match the requirements (one of which returned an empty row set), and one misinterpreted the channel definition, calculating the distribution-channel share as the online channel.
If the numeric tolerance is relaxed to 1e-6, the pass rate rises to about 22/25 (88%). This reveals an important engineering fact: in data tasks, the output contract and business definitions are often more likely to cause failures than reasoning ability.
3.4 Cost Observations
Simple tasks averaged 2 steps and about 2.4k tokens; hard tasks averaged 6.1 steps, with some reaching 14–17 steps and about 55k tokens. Step count and token consumption can serve as proxy metrics for “reasoning efficiency” when assessing the economics of agent-style calls.
4. Recommendations: From Prompts to the Evaluation System
- Explicitly reinforce the output contract in the system prompt: rounding and formatting must strictly follow the prompt, and column names must match verbatim.
- Provide a few examples for window-function tasks to reduce structural errors.
- On the evaluation side, record both the strict pass rate and the tolerance-based pass rate to separate capability issues from contract issues.
- On the inference side, build a concurrency–length–memory stress-test matrix instead of drawing conclusions from a single data point.
- If inference services run on a cloud container platform, use monitoring, alerting, and logging services to observe queueing and cache levels for closed-loop tuning.
