AIForum.

How to Monitor GPU, VRAM, and CPU Usage During Local AI Requests

On this page

THE SHORT ANSWER

Monitoring local AI requests means separating three layers: host-side process metrics, GPU device metrics, and runtime or server metrics. Tools such as NVIDIA's Local Resource Monitor, nvidia-smi, and rocm-smi expose those layers, but you need to read them together to diagnose VRAM pressure, CPU bottlenecks, and PCIe stalls.
Quick facts

When a local model feels slow, stalls mid-generation, or crashes with an out-of-memory error, the cause is usually visible in resource metrics — if you are collecting the right ones. Monitoring local AI requests means watching three layers at once: host-side process usage, GPU device usage, and the runtime’s own request-level metrics. This guide explains what each layer measures, which tools expose it, and how to read the numbers when something goes wrong.

It is written for technically curious beginners and intermediate practitioners running local inference on a workstation or single server. The emphasis is on open, reproducible observation rather than vendor dashboards.

What each resource layer actually measures

A local AI request consumes memory and compute in more places than one. Confusing those places is the most common reason people misdiagnose performance problems.

Host-side per-process metrics

These attribute usage to specific operating-system processes by PID. NVIDIA’s Local Resource Monitor (dynamo_local_resource_monitor.py) is an example: it runs on the host machine, not inside a container, and attributes GPU, CPU, and I/O usage to individual Dynamo processes. It samples per-process VRAM, GPU utilization, PCIe bandwidth, CPU, disk I/O, and network I/O, labeled by GPU, PID, and process name, and always exposes Prometheus metrics at /metrics. When dashboard dependencies are installed, the same endpoint also serves a WebSocket dashboard at /. NVIDIA documents that this tool is local-only and is not part of a Kubernetes deployment.

That process-level attribution is what lets you answer “which worker is holding VRAM?” rather than just “is the GPU busy?”

GPU device metrics

Device metrics describe the card itself: total and used VRAM, utilization percentage, temperature, and PCIe throughput. NVIDIA cards expose these through nvidia-smi, which can report name, total memory, temperature, power draw, and used memory in a single query. AMD cards use rocm-smi, which reports product name, VRAM, GTT memory, and temperature; the LM-Studio-Bench hardware monitoring guide notes that VRAM and GTT are reported in bytes and that GTT represents system RAM used as VRAM — for example, 2 GB VRAM plus 46 GB GTT gives roughly 48 GB of effective capacity on that setup.

Device metrics are necessary but not sufficient. A GPU can show 100% utilization while the actual bottleneck is the CPU feeding it, or show low utilization while VRAM is pinned and requests are queuing.

Runtime and server metrics

Runtime metrics describe requests: tokens per second, time to first token, queue depth, batch size, and per-request memory. These are usually exposed by the inference server itself rather than by the operating system. They are the layer that tells you whether a slow response is a hardware limit or a scheduling and batching choice.

Choosing monitoring tools

The right tool depends on the question. A practical default stack for a single Linux workstation looks like this:

  • Device-level snapshot: nvidia-smi for NVIDIA GPUs, rocm-smi for AMD GPUs.
  • Continuous per-process sampling: NVIDIA’s Local Resource Monitor for Dynamo deployments, or a general process monitor such as psutil-based scripts for other runtimes.
  • Request-level view: the metrics endpoint of whichever inference server you run.

The Local Resource Monitor installs with psutil, nvidia-ml-py, and prometheus-client. NVIDIA documents the following invocation on the host:

pip install psutil nvidia-ml-py prometheus-client
python3 dev/observability/dynamo_local_resource_monitor.py --host 0.0.0.0 --port 8051

All of its metrics use the dynamo_ prefix. Unlike the runtime’s dynamo_component_* families, these are host-side gauges labeled by physical GPU and OS process. The GPU families include dynamo_gpu_memory_used_gib (labeled by gpu, pid, and process_name), dynamo_gpu_memory_total_gib, dynamo_gpu_utilization_percent, dynamo_gpu_temperature_celsius, dynamo_gpu_pcie_tx_gbps, and dynamo_gpu_pcie_rx_gbps. CPU families include dynamo_cpu_utilization_percent and dynamo_cpu_process_percent.

Note the scope limit: this monitor is designed for host-side engine-startup profiling and is documented as local-only. It is a diagnostic tool, not a production Kubernetes observability layer.

A practical monitoring workflow

The goal is to capture a baseline while things are healthy, then compare against it when a request misbehaves. The following sequence works on a single machine.

  1. Record idle state. Before loading a model, note total VRAM, current used VRAM, and CPU utilization. This establishes how much headroom you actually have.
  2. Start the monitor before the model loads. Launch the resource monitor first so you capture the load phase, not just steady-state inference. Model loading is often the moment VRAM peaks.
  3. Send a representative request. Use a prompt and context length close to your real workload. A short test prompt will not reproduce memory pressure from long context.
  4. Sample during generation, not only at the end. Watch VRAM and GPU utilization over time. A single reading after completion can miss transient spikes.
  5. Cross-check with the runtime’s own metrics. Compare tokens per second and time to first token against the hardware readings. If the GPU is idle but latency is high, look at the CPU and at batching.
  6. Repeat with a longer context or larger batch. This is how you find the point where VRAM stops being sufficient.

A successful result is a small set of numbers you can reproduce: peak VRAM during load, steady-state VRAM during generation, GPU utilization range, and CPU utilization range. Without a baseline, any single reading is ambiguous.

Reading the numbers: common patterns

VRAM near the total with rising latency

If used VRAM approaches total VRAM and latency grows, you are likely hitting memory pressure, causing the runtime to evict or reallocate. Remember that weight size is not total memory use: context and KV cache plus runtime overhead add to the footprint, and that overhead grows with context length. This is why a model that fits at 4K context may not fit at 32K.

High GPU utilization, low throughput

High utilization with poor tokens per second can indicate inefficient batching or a compute-bound configuration rather than a memory problem. It can also indicate that many small requests are each doing little work. Runtime-level metrics are needed to distinguish these.

Low GPU utilization, high CPU

If the GPU is mostly idle while CPU utilization is high, the host is likely the bottleneck — tokenization, prompt processing on CPU, data loading, or Python overhead. This pattern is common when running on integrated or shared graphics, where GTT memory usage matters more than dedicated VRAM.

PCIe throughput spikes

PCIe transmit and receive gauges become interesting when a model or its cache is being moved between host and device memory. Sustained PCIe traffic during generation suggests data is crossing the bus repeatedly rather than staying resident, which is a strong signal to reduce offloading or adjust memory placement.

Limitations and tradeoffs

Monitoring itself has costs. Frequent sampling of per-process GPU memory adds overhead, and a Prometheus endpoint plus dashboard is more infrastructure than a single nvidia-smi loop. For quick checks, a periodic device query is enough; for diagnosing intermittent stalls, continuous per-process sampling is worth the overhead.

Coverage is also uneven. NVIDIA’s Local Resource Monitor is documented as host-side and local-only, so it does not cover containerized or Kubernetes deployments. AMD monitoring depends on rocm-smi being installed and on the device being visible through it; the LM-Studio-Bench guide notes search paths including /usr/bin, /usr/local/bin, and /opt/rocm-*/bin/, and uses lspci -d 1002:{device_id} for device identification. Intel GPUs are handled differently again, with intel-gpu-top used where available.

Finally, no single metric proves a cause. Treat each reading as a hypothesis and confirm it by changing one variable — context length, batch size, offloading — and re-measuring.

What to do next

Start by capturing a baseline on your own hardware: run your normal model at your normal context length, record peak and steady-state VRAM, GPU utilization, and CPU utilization, and save those numbers. Then, the next time a request is slow or fails, compare against the baseline instead of guessing. If you are running Dynamo, the Local Resource Monitor gives you per-process attribution out of the box; if you are not, a device query plus your inference server’s metrics endpoint covers most of the same ground.

If you have a monitoring setup that caught a specific failure mode, or you are stuck interpreting a pattern, share your hardware, runtime, model, context length, and the metric values you observed in the community discussion.

FAQ

Do I need a full monitoring stack to diagnose a slow local request?

No. A periodic nvidia-smi or rocm-smi query plus your inference server's own metrics endpoint covers most single-machine cases. Continuous per-process sampling is more useful for intermittent stalls and for attributing memory to a specific process.

Why does my model fit in VRAM at short context but fail at long context?

Model weight size is not total memory use. Context and KV cache plus runtime overhead add to the footprint, and those grow with context length, so a configuration that fits at a small context can exceed available VRAM at a larger one.

Can I use NVIDIA's Local Resource Monitor inside a container or Kubernetes pod?

NVIDIA documents it as a host-side, local-only tool that runs on the host machine rather than inside a container, and states it is not part of a Kubernetes deployment.

What does high GPU utilization with low tokens per second mean?

It usually points to inefficient batching or a compute-bound configuration rather than a memory shortage, but runtime-level metrics are needed to confirm which. Check batch size and request concurrency before assuming a hardware limit.

References

  1. https://docs.nvidia.com/dynamo/v1.4.1/reference/observability/local-resource-monitor-local
  2. https://github.com/Ajimaru/LM-Studio-Bench/blob/main/docs/HARDWARE_MONITORING_GUIDE.md

Related terms

VRAM
Dedicated memory on a discrete GPU. Local model weights, KV cache, and runtime buffers all consume it.
GTT
Graphics Translation Table memory on AMD systems: system RAM used as VRAM, reported separately by rocm-smi and additive to effective capacity.
KV cache
Memory used to store attention keys and values during generation. It grows with context length and adds to the model weight footprint.
PCIe throughput
Data transfer rate across the PCIe bus between host and GPU. Sustained traffic during generation can indicate repeated memory movement.
Prometheus gauge
A metric type representing a value that can rise or fall, such as current VRAM usage, typically scraped from an HTTP endpoint.

Leave a Reply

Your email address will not be published. Required fields are marked *