Overview

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

This chapter argues that shipping a quantized model requires more than showing a fast benchmark; you also need proof that the right hardware and kernels were used, that deployment settings are safe, and that the system stays healthy after launch. To make that concrete, it presents two production-style builds: a four-bit language model served on a single GPU and a sub-second vision pipeline on device hardware. In both cases, the chapter emphasizes that the number people care about is the end-to-end experience, not an isolated inference-only metric.

For the server side, the chapter walks through a four-bit AWQ language model running on an Ada-class NVIDIA L4 through vLLM, guarded by offline tests and monitored with Prometheus, Grafana, and DCGM. The pre-ship checks catch problems that benchmarks miss, such as mismatched metric names, unsafe ports, unpinned images, and flawed quality or figure-generation code. Once live, the system shows strong scaling with concurrency, better throughput than FP16, lower time-to-first-token, and reduced energy per token, while a greedy canary against a full-precision reference verifies that quality remains acceptably close.

On the device side, the chapter shows an INT8 EfficientNet-Lite0 pipeline on an Apple M3 and reveals that most of the latency budget is spent before inference, especially in JPEG decode and preprocessing rather than in the Core ML forward pass. It also demonstrates that compute placement on Apple silicon must be inspected explicitly, that sustained-load behavior can differ from cold-start timing, and that power readings may be estimated rather than sensor-grade. The chapter concludes by comparing the server and device systems carefully, showing that each benefits from quantization in different ways, while also warning against misleading cross-platform comparisons when the metrics and measurement methods are not directly equivalent.

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.
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.
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.
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.
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.
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.
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.
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 Chapter 12?The chapter shows how to prove a quantized model is truly ready for production by combining offline checks, live observability, and comparison against a full-precision reference.
Why is a benchmark alone not enough to prove fast inference?A benchmark can show a fast forward pass, but it cannot confirm the model loaded on the right hardware, used the intended low-precision kernel, stayed within the real end-to-end latency budget, or kept its output quality after deployment.
What is the purpose of the pre-ship gate in the four-bit LLM deployment?The pre-ship gate runs on a GPU-free machine and checks deployment configuration, metric names, latency units, loopback bindings, pinned images, and unit tests for the canary and figure code before anything is deployed.
Why does the chapter insist on using loopback-only telemetry ports?Binding telemetry services to 127.0.0.1 keeps Prometheus, Grafana, and Pushgateway off the network, preventing unauthorized access or metric tampering while still allowing secure access through SSH port forwarding.
Why must the four-bit model run on Ada-class silicon like the NVIDIA L4?AWQ four-bit serving depends on vLLM’s Marlin INT4 kernels, which require sm80 or newer. On older hardware such as a Turing T4, the model may fall back to FP16 or fail to use the intended four-bit path.
What does the live observability stack measure in the server deployment?The post-ship stack scrapes vLLM request metrics and DCGM GPU sensor data into Prometheus, then visualizes latency, throughput, scheduler state, queue depth, and GPU power in Grafana.
Why does the quality canary use greedy decoding?Greedy decoding makes the output deterministic, so any disagreement with the FP16 golden reference reflects quantization effects or deployment issues rather than sampling randomness.
What was the main performance result for AWQ versus FP16 on the L4 server?AWQ roughly doubled peak throughput, improved time-to-first-token, and reduced energy per token, while maintaining close but not identical output quality compared with FP16.
Why is end-to-end latency more important than forward-pass latency in the vision pipeline?Because the user experiences the full pipeline, including decode, resize, normalization, inference, and post-processing. In the chapter, decode and preprocessing dominated the budget, not the Core ML forward pass.
Why does the chapter avoid directly comparing server power and device power on one axis?The server uses sensor-grade DCGM power from the GPU, while the device uses estimated power from powermetrics. Since they are different measurement classes and different workloads, the book avoids drawing a misleading shared energy comparison.

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


Close
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 Quantization and Fast Inference ebook for free
Close
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 Quantization and Fast Inference ebook for free