Local LLM Deployment and Evaluation: A Practical Guide to Performance Tuning and Scoring

    This guide walks through a real-world local deployment and evaluation of a full-weight, trillion-parameter-scale model, showing why a model that loads and generates output can still fall short under real concurrency. It covers the two distinct inference phases (prefill and decode), a stress-test matrix spanning context length and concurrency, typical throughput and time-to-first-token degradation patterns, and a queue-first, memory-second, kernel-last bottleneck isolation workflow with concrete engine scheduling parameters. It also explains why tool-calling evaluations can score near zero despite correct logic, and recommends dual-track scoring (strict versus tolerance-based) plus prompt-level format constraints. The intended takeaway is a reproducible, observable evaluation pipeline built on a two-dimensional load-test matrix, dual-metric bottleneck diagnosis, categorized scoring, and upfront format rules.

    1. The Problem: “It Runs” Does Not Mean “It Is Usable”

    When teams deploy ultra-large models locally (trillion-parameter scale, full weights), they often hit a gap: the model loads successfully and produces reasonable output, yet the experience under real concurrency is far from expectations. The cause is usually not the model itself, but three things: the scheduling configuration of the inference service, the GPU memory budget allocation, and the criteria used to judge evaluation results. This article uses one typical exercise, a full-model local stress test and capability evaluation, as a thread to extract a reusable methodology.

    Two foundational concepts need to be clear first. The prefill phase processes the input prompt all at once; it is compute-intensive and highly parallel, and it determines time to first token (TTFT). The decode phase generates output autoregressively token by token; it is memory-access-intensive and has low parallelism, and it determines output speed. The two phases place different demands on hardware, so service performance cannot be summarized by a single metric.

    2. Performance Profile: From Single-Stream Peak to Concurrency Decay

    A proper stress test should cover at least the following dimensions, none of which can be skipped:

    • Single-stream prefill peak throughput (usually measured at a 4k context), with observations across the 2k–32k range to check for length decay;
    • The prefill throughput decay curve as concurrency increases;
    • The single-stream decode rate range;
    • The decode rate low point under high concurrency and long prompts;
    • How TTFT changes with context length and concurrency.

    Typical observations show a clear pattern: single-stream prefill can reach several hundred tokens/s and stays roughly flat across the 2k–32k range, indicating that long context itself brings no obvious compute penalty. But when concurrency rises to 2 streams, throughput drops by roughly 30–40%; at 4 streams it drops by about half; at 6 streams it can fall to less than 40% of the single-stream figure. On the decode side, a single stream holds steady at just over twenty tokens/s, but with long prompts combined with 4–6 concurrent streams it drops into single digits.

    TTFT degradation is the most striking: at a 32k context, a single stream takes roughly fifty-plus seconds, while at 6 concurrent streams it approaches or exceeds three minutes. It must be emphasized here that queuing is the main cause, not insufficient compute. When the server’s maximum number of concurrent sequences is capped at 2, requests beyond that enter a waiting queue; long-prompt prefill tasks block one another, throughput is forcibly shared out, and latency amplifies non-linearly.

    An illustrative configuration snippet (pseudocode, showing only the direction of tuning):

    1. # Key scheduling parameters of the inference engine (illustrative)
    2. engine_cfg = {
    3. "max_num_seqs": 2, # Max concurrent sequences; too low causes queuing
    4. "max_num_batched_tokens": 8192, # Per-batch token budget; affects prefill batching
    5. "gpu_memory_utilization": 0.91, # GPU memory usage cap; already near saturation
    6. "kv_cache_dtype": "auto", # KV cache precision; trades memory for quality
    7. }

    3. Bottleneck Isolation and Tuning Path

    The recommended approach is to rule out queuing first, then memory, and look at kernels last:

    1. Check queue metrics: if throughput drops as concurrency rises while GPU memory is not maxed out, it is basically safe to conclude that queuing caused by the scheduling cap is responsible.
    2. Check memory headroom: when memory utilization is already above 0.9 and the KV cache is nearly full, raising the concurrency cap will directly trigger preemption or swapping, making jitter worse.
    3. Tuning order: first moderately raise the maximum number of concurrent sequences and the per-batch token budget so that multiple short requests can be merged into a batch; if memory is tight, free up space by lowering KV cache precision, shortening the maximum context, and enabling more aggressive memory reclamation.
    4. Stress-test discipline: fix the random seed, fix the prompt set, record the concurrency and context length for every data point, and remove obvious noise points before drawing conclusions; the occasional “throughput rebound” under long context is usually scheduling noise and should not be used as a basis for optimization.

    Keep in mind that any tuning is a trade-off rather than a one-way improvement: raising the concurrency cap squeezes KV cache space, and enlarging the batch budget raises per-batch latency. The two must be weighed against whether the business prioritizes throughput or first-token latency.

    4. Capability Evaluation: Why a Correct Answer Can Still Score Zero

    In tool-calling evaluations (generate a query, execute it against an embedded analytical database, validate the result set), a common pattern is that the model completes the full call loop on its own, with correct multi-table joins, window functions, and cumulative-ratio expressions, yet the pass rate under strict scoring is extremely low.

    Take a 25-question evaluation as an example: 9 questions passed overall, with almost all easy questions correct, 1 medium question passed, and 0 hard questions passed. Deeper attribution found that about 60% of the questions were “logically correct, off by one point on format”: the prompt required keeping two decimal places, the model omitted the rounding function, and the judge required the first row of the result set to match as a strict string, so all of them were marked wrong. Relaxing numeric comparison to a tolerance of 1e-6 pushes the pass rate above 80%.

    Genuine structural failures are a small minority, typically of three kinds:

    • When multi-table joins are combined with common table expressions, the returned column names do not match expectations;
    • Nested window function queries return an empty result set with mismatched column names;
    • Misunderstanding of the business definition, such as computing the channel dimension incorrectly, leading to a completely different ratio conclusion.

    Token consumption is also worth recording: easy questions take two steps and just over two thousand tokens on average; hard questions take six or more steps, with individual questions iterating a dozen-plus steps and consuming over fifty thousand tokens. Step count and consumption can serve as indicators of whether the model is stuck in repeated trial and error.

    5. Dual Corrections: Evaluation Criteria and Prompt Engineering

    Engineering practice should measure “capability” and “format compliance” separately, or the conclusions will be badly distorted. It is advisable to output two sets of scores at the same time: a strict criterion (row count, column count, column names, and first row all matching) and a tolerance criterion (numeric differences within 1e-6 treated as equal), along with a categorized breakdown of lost points.

    Prompt-side improvements can include: explicitly stating in the system prompt that the rounding and output format requirements in the question must be followed strictly; providing a few examples for error-prone patterns such as window functions and cumulative ratios; and asking the model to self-check column names and row counts before returning. These measures are low-cost with direct payoff, and usually recover a significant amount of “format-related lost points.”

    6. Conclusions and Deployment Recommendations

    For local deployment of full-scale ultra-large models, performance bottlenecks are mostly concentrated in scheduling and GPU memory rather than in model capability; low evaluation scores mostly stem from judging criteria and format compliance rather than defects in reasoning logic. Four points are recommended in practice: build a two-dimensional stress-test matrix covering length and concurrency; isolate bottlenecks using the dual metrics of queue and memory; adopt dual-criterion scoring with categorized attribution; and move format constraints upfront into the system prompt. If elastic scaling or unified operations are needed, an observable and reproducible evaluation pipeline can be built on common cloud capabilities such as container platforms, object storage, log services, and monitoring and alerting.