Local LLM Inference Performance and SQL Generation Evaluation: Benchmarks, Bottlenecks, and Engineering Takeaways

    This article presents a two-track evaluation of local large language model deployment: inference serving performance under fixed hardware and GPU memory budgets, and structured SQL generation accuracy under strict output contracts. It covers the test methodology, prefill and decode throughput data across 2k–32k inputs and concurrency levels from 1 to 6, time-to-first-token (TTFT) measurements, and a root-cause analysis tracing throughput collapse to the max_num_seqs concurrency cap and KV cache pressure. It also details the 25-task SQL benchmark results (36% strict pass rate, rising to roughly 88% with a 1e-6 numeric tolerance), the failure breakdown, token cost patterns, and concrete tuning and prompt-design recommendations. Readers will find reproducible metrics and a three-layer defense model for shipping these capabilities reliably.

    1. Evaluation Background and Objectives

    As large language models move from “usable” to “deliverable,” a single-dimensional quality judgment is no longer enough to support engineering decisions. Two independent questions need to be answered: first, whether the inference service can meet throughput and latency constraints under a given hardware and GPU memory budget; second, whether the model can reliably produce executable, verifiable structured output under real business semantics. This evaluation is designed around those two tracks. The first focuses on the speedup and concurrency capacity of local deployment; the second focuses on strongly constrained tasks represented by table query generation.

    It is worth emphasizing that a “release” version suffix does not imply improvement across every dimension. A common pattern in engineering practice is that a given version improves long-context stability or the completeness of tool-calling chains while regressing on specific sub-tasks. Conclusions therefore have to rest on reproducible metrics rather than a general impression.

    2. Inference Performance Evaluation: Two-Stage Breakdown and Bottleneck Isolation

    2.1 Test Method

    A unified inference serving framework was used, with tensor parallelism and the GPU memory utilization ceiling held fixed. Input lengths ranged from 2k to 32k, and concurrency was increased from 1 to 6. Prefill throughput, decode throughput, and time to first token (TTFT) were recorded separately. All data points were collected continuously within the same process lifetime to avoid cold-start bias.

    2.2 Key Results

    Metric Observed Behavior Interpretation
    Prefill peak, single concurrency ~757 tok/s (4k input) Held at 629–758 tok/s across 2k–32k with almost no length decay, indicating full compute utilization during prefill
    Prefill concurrency decay ~30%–45% drop at 2 concurrency, ~50% at 4, ~63% at 6 At 2k input, throughput fell from 688 to 228 tok/s, a pronounced decline
    Decode, single concurrency 23.8–28.7 tok/s Decode is bound by GPU memory bandwidth, so absolute values are naturally lower than prefill
    Decode under concurrency 8–18 tok/s; dropped to 8–11 tok/s with long inputs at 4–6 concurrency Recovered to 20–28 tok/s at 32k, judged to be sampling noise
    TTFT Rises roughly linearly with length; ~51.5s at 32k with 1 concurrency, ~186.4s at 6 concurrency Queueing delay, not compute time, is the dominant factor

    2.3 Root Cause Analysis

    Configuring the concurrent sequence limit at 2 is the core reason for the decay. Once the number of concurrent requests exceeds that threshold, new requests enter a waiting queue. At the same time, multiple long prefill tasks block one another and compute resources are spread thin, which shows up as a sharp drop in prefill throughput and a steep deterioration in TTFT. The following illustrative configuration helps explain the mechanism:

    1. # Illustrative configuration, not a specific product interface
    2. max_num_seqs = 2 # concurrent sequence limit; directly determines the queueing inflection point
    3. max_num_batched_tokens = 8192 # per-batch token budget; affects batching of long inputs
    4. gpu_memory_utilization = 0.91 # GPU memory usage is near the ceiling; little headroom left for KV cache

    When memory utilization is already at 0.91 and the KV cache is close to saturation, simply raising the concurrency limit shifts pressure to the memory side and triggers preemption and recomputation. Tuning therefore has to proceed in pairs: first raise the batch token budget moderately to aggregate short requests, then increase the concurrent sequence limit slightly, while assessing in parallel whether the context length ceiling should be lowered or quantization introduced to free cache space.

    2.4 Optimization Paths

    • Raise the concurrent sequence limit and the batch token budget to push the queueing inflection point further out and improve throughput under high concurrency;
    • Apply tiered routing for long-input requests, sending extra-long context requests and short requests to different instances so they do not block each other;
    • Introduce prefix cache reuse, which can significantly cut repeated prefill overhead when a shared system prompt is used;
    • Build a capacity model centered on TTFT and throughput, using load-test curves to back out the concurrency level that can be committed.

    3. Structured Query Generation Evaluation

    3.1 Evaluation Design

    The task set contained 25 questions across four difficulty tiers: trivial, easy, medium, and hard. In a multi-turn tool-calling loop, the model had to complete the full cycle autonomously: generate the query → execute it against an embedded analytical database → self-verify against the returned results → mark whether the result is usable. The pass criteria were strict: the row count, column count, column names, and the first-row string all had to match.

    3.2 Results Overview

    9 of 25 tasks passed, a 36% pass rate: trivial 8/8, easy 1/2, medium 0/2, hard 0/13. On the positive side, every task completed the autonomous tool-calling loop with no broken flows, and complex multi-table joins and window functions (such as lag lookups, row numbering, and cumulative share) were written correctly in most tasks.

    3.3 Failure Structure Analysis

    The main source of lost points was not logic errors but output precision and structural contracts being out of alignment. About 15 tasks fell into the category of “correct logic, one point off on formatting”: the prompt explicitly required two decimal places, the model omitted the rounding function, and strict judging requires a character-by-character match on the first row. Three additional structural failures appeared: the final column name did not match when a multi-table join was combined with a discount intermediate table; a window-function-based group share question returned zero rows with mismatched column names; and a channel-definition misunderstanding caused the expected distribution channel share to be computed as an online channel.

    On token consumption, simple tasks averaged two steps and about 2.4k tokens; hard tasks averaged 6.1 steps, with individual tasks reaching 17 steps and 55.5k tokens. The cost amplification from long multi-turn chains deserves close attention. If numeric judging is relaxed to a 1e-6 tolerance, the pass rate rises to about 88%, which further confirms that the bottleneck is the format contract rather than reasoning ability.

    3.4 Improvement Recommendations

    1. Example system prompt constraints (illustrative):
    2. 1. Strictly reproduce the rounding precision and column aliases required by the task; do not omit them.
    3. 2. Keep the output column order consistent with the task description.
    4. 3. If the result is empty, check the filter conditions and join keys first, then adjust the query.
    5. 4. For group share questions, build the grouping key first, then apply the window function.

    It is also advisable to add standard window function examples to the prompt and to set up an automated pre-check for the “column name contract,” separating format-related failures from model capability issues.

    4. Conclusions and Engineering Implications

    The two evaluations lead to three conclusions. First, the bottleneck in local inference is usually not peak compute but the coupling between concurrency scheduling and GPU memory caching; parameter tuning must advance in pairs and be grounded in load-test curves. Second, failure modes in strongly constrained structured tasks concentrate heavily on the output contract, so engineering should rely on a three-layer defense of “prompt constraints + automated validation + tolerance strategy” rather than chasing model size alone. Third, version iteration needs regression guardrails along fine-grained dimensions so that an overall upgrade does not mask a local regression. If an organization plans to put these capabilities into production, it can host the inference service on a container platform, manage evaluation datasets with object storage, and continuously track TTFT and pass-rate changes through logging and monitoring with alerting, forming a closed-loop quality operations mechanism.