Overview

12 Delivering Proven Results with a Four-Bit LLM Server and an On-Device Vision Pipeline

The chapter argues that shipping a quantized model requires more than showing a fast benchmark. A useful deployment has to prove that the artifact loaded on the intended hardware, actually used the low-precision path it was designed for, met the latency the user feels, and preserved acceptable quality compared with a full-precision reference. To make that trustworthy, the chapter pairs offline pre-ship checks with live observability after launch, because tests catch configuration and safety mistakes while runtime monitoring catches drift, throttling, queue buildup, and quality regressions that only appear under real load.

On the server side, the chapter presents a four-bit AWQ language model served through vLLM on an Ada-class NVIDIA L4 GPU, gated by a GPU-free pytest suite and watched with Prometheus, Grafana, and DCGM. The deployment proves that the model only runs as four-bit when the hardware has the right kernel support, that metrics names and units match the running version, that telemetry ports stay on loopback, and that the quality canary based on greedy decoding remains close to the FP16 reference. In the concurrency sweep, AWQ roughly doubles peak throughput, cuts time-to-first-token sharply, and reduces energy per token, while the queue stays empty and memory headroom remains large for the chosen model size.

On the device side, the chapter shows an INT8 EfficientNet-Lite0 pipeline on an Apple M3 that easily meets a sub-second budget, but reveals that the real latency cost is dominated by JPEG decode and preprocessing rather than the forward pass. Because Apple-silicon routing is silent, the chapter uses MLComputePlan to verify where operations are placed, then adds a hand-rolled telemetry path for stage timings, thermal retention, estimated power, and placement data. The final comparison ties the two systems together with a caution: inference-only numbers are diagnostic, but end-to-end latency is what matters, and power figures must not be compared casually when one is sensor-grade and the other is estimated.

The gated serving build: the pre-ship gate (left, diagonal hatch) is a GPU-free pytest suite that asserts the configuration and code are correct before deployment. The serving stack (center) runs the AWQ artifact on an Ada-class L4 and exports metrics over HTTP. The post-ship gate (right, cross-hatch) scrapes those metrics and sensor-grade GPU power into Prometheus, renders the Grafana dashboard, and runs a quality canary that re-sends a fixed prompt set greedily and compares the four-bit output against the full-precision reference.
Illustrative Grafana view of the live vLLM serving dashboard during the concurrency sweep: end-to-end request latency percentiles, prompt and generation token throughput, inter-token latency, and scheduler state. The screenshot shows the post-ship gate running and is not a quantitative source — the numbers in this section come from the metrics scraped into the results file.
Per-image stage breakdown for EfficientNet-Lite0 on the M3, stacked to the per-image mean of 6.95 ms. Decode and resize use diagonal hatching, normalize a cross-hatch and the Core ML forward pass a dotted fill. The dashed horizontal line marks the end-to-end p95 of 9.00 ms. The forward pass is 1.23 ms, 17.7% of the mean, while decode at 4.20 ms is roughly 60%; the stage the accelerator optimizes is the smallest segment, and decode owns the budget.
Illustrative Grafana view of the hand-rolled device dashboard: per-stage latency, end-to-end p95, estimated SoC power, op placement across the ANE, GPU, and CPU, and thermal retention. The panel titles carry the labels the metrics are stored under, including "estimated power (W) — powermetrics, not sensor-grade." The screenshot shows the post-ship view running and is not a quantitative source; the numbers in this section come from the device results file.
Peak generation throughput (left) and best time-to-first-token p95 (right) by format, derived from the sweep in Table 12.1. AWQ roughly doubles peak throughput (1,587 → 2,926 tokens/s) and cuts the best achievable TTFT p95 from 97 ms to 38 ms, a 2.6× reduction.
Equation 12.1
KV-cache occupancy (left) and request-queue depth (right) against offered concurrency on a log-2 axis, FP16 versus AWQ. FP16 is the solid line with circle markers, AWQ the dashed line with square markers. Occupancy stays below 2% and queue depth stays at zero across the entire sweep for both formats — the system never approaches its memory limit at this model size, so the saturation knee the freed memory is meant to push outward does not appear.

Summary

  • A shipped quantized model clears two gates, and they cover different failures. The pre-ship gate is offline, deterministic, and GPU-free, and it fails the build when the artifact or its configuration is wrong before anything deploys. The post-ship gate is the live dashboard, watching for the drift the tests cannot predict. Both ask the same thing, whether the quantized model still behaves like full precision inside its latency, memory, and power budget.
  • The four-bit LLM roughly doubled throughput for about half the energy per token, on the same card. Swapping FP16 for AWQ four-bit on one L4, with nothing else changed, raised peak throughput about 1.8x while GPU power stayed near 72 W, so energy per token fell from roughly 45 to 25 millijoules. The greedy canary put the four-bit endpoint at 89.9% token agreement with the FP16 reference, so the speed is paid for with a small measured quality cost, not a free one.
  • Whether four-bit weights run as four bits is decided by the silicon, not just the artifact. AWQ needs a matching INT4 kernel, and vLLM has one only at compute capability sm80 and newer. The Ada-class L4 clears that floor. The same artifact on a Turing T4 falls back to FP16 and gives back everything quantization bought. Quantizing a model and serving it have different silicon floors.
  • The vision pipeline cleared its sub-second budget with room to spare, and decode owned the budget, not inference. End-to-end p95 was 9 ms against a one-second target. The Core ML forward pass was 17.7% of the per-image cost while JPEG decode alone was about 60%, so the stage the accelerator was quantized to speed up is the smallest movable part of the path. A fast inference-only reading is a diagnostic worth tracking. The end-to-end number is what belongs in the target, on the device and on the server alike.
  • Where the model actually ran is worth checking on both planes, because neither reports it by default. On the server the question is whether vLLM ran the four-bit kernel or upcast to FP16. On the device it is whether the Apple Neural Engine ran the model or the CPU did. Routing on Apple silicon is silent, compute_units=ALL is a permission rather than an instruction, and MLComputePlan is the only window onto the answer. It read 19% of operations on the ANE by count, which looks CPU-heavy, even though the 1.23 ms forward pass says the ANE carried the real arithmetic.
  • The telemetry the server got for free was hand-rolled on the device. vLLM and DCGM publish Prometheus-shaped metrics over HTTP, so the server's dashboard cost a few lines of configuration. Core ML and MLX publish nothing of the sort, so the device pipeline ships its own exporter. Same questions, very different instrumentation cost.
  • The limits you state next to a result are what make it trustworthy. The 3B model left so much KV headroom on a 24 GB card that occupancy stayed below 2% and the queue never filled, so the saturation knee freed memory is meant to push outward is a measured zero, not a missing measurement. It returns with the 7B or 8B model this build usually targets. Server power is sensor-grade and device power is estimated, two different classes of measurement, which is why the cross-plane energy figure was left unbuilt instead of drawn on a misleading shared axis. A result is only as trustworthy as the limits recorded next to it.

FAQ

What is the main goal of this chapter?The chapter shows how to prove that quantized models are not only fast in a benchmark, but actually ready for production. It does this by combining pre-ship tests, live observability, and quality checks for both a four-bit LLM server and an on-device vision pipeline.
Why is benchmarking alone not enough to prove a quantized model is fast?A benchmark may show a fast forward pass, but it does not prove the model loaded on the right hardware, used the intended low-precision kernel, met the end-to-end latency users feel, or kept quality close to the full-precision reference under real traffic.
What two production systems are used as examples in this chapter?The chapter uses two examples: a four-bit Qwen2.5-3B-Instruct LLM served on a single NVIDIA L4 GPU with vLLM, and an INT8 EfficientNet-Lite0 vision pipeline running on an Apple M3 MacBook through Core ML.
What is the purpose of the offline gate before deployment?The offline gate catches configuration and code problems before anything ships. It checks things like metric names, latency units, localhost binding for telemetry ports, pinned container images, and the correctness of the canary and figure-generation code.
Why does the chapter insist on using loopback for observability services?Binding Prometheus, Grafana, and Pushgateway to 127.0.0.1 keeps them off the public network and prevents unauthorized access or metric tampering. Remote access can still be done safely through SSH port forwarding.
Why must the four-bit model run on Ada-class or newer GPU silicon?AWQ four-bit serving depends on vLLM’s Marlin INT4 kernels, which require compute capability sm80 or newer. On older silicon, the model may fall back to full precision, which removes the memory and speed benefits of quantization.
What does the live observability stack monitor after the LLM server goes live?The live stack scrapes vLLM metrics and DCGM GPU sensor data into Prometheus, then visualizes request latency, token throughput, scheduler state, GPU power, and related serving health indicators in Grafana.
How does the quality canary verify the quantized LLM’s output?The canary replays a fixed set of prompts greedily at temperature zero, compares the live four-bit output against a saved FP16 golden reference, and computes token-level agreement to detect quality drift.
What is the most important latency lesson from the vision pipeline?The end-to-end latency is what matters to the user, not the forward-pass-only inference number. In the vision pipeline, decode and preprocessing dominate the 9 ms budget, while the Core ML forward pass is only a small part of the total.
Why does the chapter avoid comparing server and device power on the same axis?The server’s power comes from sensor-grade DCGM readings, while the device’s power comes from estimated powermetrics counters. Since they are different measurement classes and even different units of work, combining them on one energy-per-task axis would be misleading.

pro $24.99 per month

  • access to all Manning books, MEAPs, liveVideos, liveProjects, and audiobooks!
  • choose one free eBook per month to keep
  • exclusive 50% discount on all purchases
  • renews monthly, pause or cancel renewal anytime

lite $19.99 per month

  • access to all Manning books, including MEAPs!

team

5, 10 or 20 seats+ for your team - learn more


choose your plan

team

monthly
annual
$49.99
$499.99
only $41.67 per month
  • five seats for your team
  • access to all Manning books, MEAPs, liveVideos, liveProjects, and audiobooks!
  • choose another free product every time you renew
  • choose twelve free products per year
  • exclusive 50% discount on all purchases
  • renews monthly, pause or cancel renewal anytime
  • renews annually, pause or cancel renewal anytime
  • Quantization and Fast Inference ebook for free
choose your plan

team

monthly
annual
$49.99
$499.99
only $41.67 per month
  • five seats for your team
  • access to all Manning books, MEAPs, liveVideos, liveProjects, and audiobooks!
  • choose another free product every time you renew
  • choose twelve free products per year
  • exclusive 50% discount on all purchases
  • renews monthly, pause or cancel renewal anytime
  • renews annually, pause or cancel renewal anytime
  • Quantization and Fast Inference ebook for free