GPU bottleneck identification
PyTorch narrowly leads NVIDIA Nsight Visual Studio Edition for identifying GPU bottlenecks.
It depends
For high inference latency, NVIDIA is the usual answer.
Brands AI mentions
Its answer recommends Nsight tools for GPU-level bottleneck analysis.
Its answer recommends Triton metrics for latency issues tied to serving architecture.
Also mentioned rarely: ONNX Runtime, vLLM, Prometheus, Grafana, TensorRT-LLM, NVIDIA, NVIDIA DCGM Exporter, Py-Spy, NVIDIA Model Analyzer, Intel VTune Profiler, NVIDIA Nsight Deep Learning Designer, TensorFlow, NVIDIA GenAI-Perf, Datadog, New Relic, OpenTelemetry, SGLang, AI Perf, Apache TVM, perf_analyzer, cuBLAS, perf (Linux), Neural Network Compression Framework, Intel, FlashAttention, Scalene, cProfile, Perfetto, Chrome Industries, Hugging Face Text Generation Inference, Datadog Database Monitoring, LLMPerf, Anyscale, MLPerf, Netdata Cloud, CUPTI, TensorRT trtexec, TensorRT Benchmark Tool, Mlcommons, NVIDIA AIPerf, Hugging Face Trainer API, Kineto, NVIDIA System Management Interface, Netron, cuDNN
- NVIDIA Nsight Visual Studio EditionChatGPTChatGPT 92%Google AI ModeGoogle AI Mode 100%
- PyTorchChatGPTChatGPT 96%Google AI ModeGoogle AI Mode 92%
- NVIDIA TensorRTChatGPTChatGPT 50%Google AI ModeGoogle AI Mode 38%
- NVIDIA Triton Inference ServerChatGPTChatGPT 15%Google AI ModeGoogle AI Mode 54%
- TensorBoardChatGPTChatGPT 15%Google AI ModeGoogle AI Mode 50%
Questions and answers
Google AI ModeNov 21, 2026
The "best" profiling tool depends entirely on your framework, hardware (CPU vs. GPU), and where the bottleneck lives (Python overhead, kernel execution, or data preprocessing).
Top Inference Profiling Tools by Stack
- PyTorch Models (GPU/CPU):
torch.profiler- Best for: Deep PyTorch introspection, operator-level timings, memory allocations, and tracing CPU-to-GPU kernel launches.
- Why use it: It integrates cleanly into Python code via
torch.profiler.profile()and exports chrome-style traces (.json) that you can inspect visually in Perfetto or Chrome'schrome://tracing.
- NVIDIA GPUs (TensorRT, CUDA, ONNX): NVIDIA Nsight Suite (
Nsight Systems&Nsight Compute)- Best for: Fine-grained GPU hardware analysis, memory bandwidth saturation, kernel occupancy, and multi-stream execution.
- Ecosystem alternative: If you are working specifically with ONNX models running on TensorRT, check out NVIDIA Nsight Deep Learning Designer to map TensorRT layers back to original ONNX operators.
- ONNX Runtime / Cross-Platform Inference: ONNX Runtime Profiler & Netron
- Best for: Lightweight, cross-platform runtime tracking without heavy vendor SDKs.
- Why use it: ONNX Runtime has a built-in profiling flag (
options.enable_profiling = True) that outputs a detailed JSON trace of every operator's execution time. Pair it with Netron to visually inspect graph topology and check for unintended type casts or slow operators.
- Production / Server-Level Latency: Triton Inference Server Profiler or Prometheus + Grafana
- Best for: End-to-end service latency (queuing delays, network overhead, dynamic batching efficiency, and model execution breakdown).
- Why use it: If your model runs inside a serving engine like Triton Inference Server , its built-in performance analyzer (
perf_analyzer) stress-tests concurrency limits and breaks down queue time vs. compute time.
- Quick Python-Level Bottlenecks:
cProfileorpy-spy- Best for: Catching non-model Python slowdowns (tokenization, PIL image transforms, NumPy serialization, or data loading) wrapped around the model.
- Why use it:
py-spysamples running Python processes with zero code modification and immediately reveals if your "model latency" is actually just slow pre/post-processing glue code.
Recommended 4-Step Diagnosis Workflow
- Isolate the wrapper: Run
py-spyor a simple time wrapper around just the model.forward()/run()call versus the entire request lifecycle to see if Python glue code is the culprit. - Profile the operators: Enable your framework's native profiler (
torch.profileror ONNX profiler) to see which specific layers or operators are eating up 80% of the runtime. - Check hardware saturation: Drop into Perfetto or NVIDIA Nsight Systems to check if your GPU is sitting idle waiting on CPU data transfers (host-to-device bottlenecks) or if it's truly compute-bound.
- Test compilation/backends: Try exporting/compiling to
torch.compile(), ONNX Runtime, or TensorRT to see if graph optimization strips away redundant overhead.
To narrow this down, could you share:
- What framework and hardware (e.g., PyTorch on an NVIDIA T4, ONNX on CPU) are you running?
- Is the latency spike happening on single-sample inference or under high-concurrency load?
Pages cited in this answer 1
ChatGPTNov 21, 2026
The best performance profiling tool for machine learning inference is generally PyTorch Profiler, particularly if you're using PyTorch.
However, if your inference latency is significantly high, I'd recommend choosing the profiler based on where the bottleneck occurs: model computation, GPU execution, memory transfer, or model serving.
My recommendation: Start with PyTorch Profiler, then use NVIDIA Nsight Systems if you're running inference on NVIDIA GPUs and need deeper hardware-level analysis.
Best profiling tools by use case
Tool Best for My assessment PyTorch Profiler Operator-level CPU/GPU profiling Best starting point NVIDIA Nsight Systems GPU utilization, CUDA kernels, CPU/GPU synchronization, memory transfers Best for deep GPU diagnosis NVIDIA Nsight Compute Individual CUDA kernel optimization Best for kernel-level bottlenecks TensorRT Profiler Per-layer inference latency Best for TensorRT deployments NVIDIA Triton Model Analyzer Serving configuration, batching, GPU memory and throughput Best for production serving optimization Sources:
1. PyTorch Profiler — best starting point
It helps identify:
- Which model operators consume the most execution time.
- CPU versus GPU execution time.
- Expensive tensor operations.
- Memory consumption.
- GPU kernel activity.
- Unexpected synchronization and execution overhead.
Example:
pythonimport torch from torch.profiler import profile, ProfilerActivity model.eval() with profile( activities=[ ProfilerActivity.CPU, ProfilerActivity.CUDA ], record_shapes=True, profile_memory=True ) as prof: with torch.no_grad(): for _ in range(20): model(inputs) print( prof.key_averages().table( sort_by="cuda_time_total", row_limit=20 ) )This gives you a breakdown of the most expensive operations. You can also export execution traces for visualization.
Documentation: PyTorch Profiler official documentation.
2. NVIDIA Nsight Systems — best for GPU bottlenecks
If your model runs on NVIDIA GPUs, this is particularly valuable.
It helps identify:
- GPU underutilization.
- CPU bottlenecks.
- CUDA kernel launch overhead.
- CPU-to-GPU data transfer delays.
- GPU synchronization.
- Gaps between kernel executions.
Run it using:
bashnsys profile -o inference_profile python inference.pyIt is especially useful when PyTorch Profiler tells you which operation is slow, but you need to understand why.
Documentation: NVIDIA TensorRT performance and profiling guide.
3. If your problem is production inference latency
If you're running models behind an inference API, I would also consider NVIDIA Triton.
Its tools help measure:
- Average inference latency.
- P50, P90, P95 and P99 latency.
- Requests per second.
- GPU memory consumption.
- Batch-size impact.
- Concurrent request performance.
For LLMs, consider GenAI-Perf, which additionally measures time to first token (TTFT), inter-token latency, and token throughput.
Documentation: Triton Model Analyzer.
My recommended profiling workflow
I'd approach your latency problem in this order:
-
Measure baseline latency
Record average, P50, P95 and P99 inference latency under realistic workloads.
-
Run PyTorch Profiler
Identify expensive operators and CPU/GPU execution breakdowns.
-
Run NVIDIA Nsight Systems
Investigate GPU utilization, memory transfers, synchronization and kernel launch overhead.
-
Optimize the bottleneck
Explore batching, FP16/BF16, quantization, operator fusion, CUDA Graphs and optimized kernels where appropriate.
-
Benchmark again
Compare latency and throughput under identical hardware, input shapes and concurrency.
A few questions to narrow down the best tool
The best choice depends heavily on your inference environment.
1. Which ML framework are you using?
PyTorch
TensorFlow
ONNX Runtime
Other
2. What hardware are you running on?
NVIDIA GPU
AMD GPU
CPU only
Cloud inference accelerator
3. What kind of model?
LLM / Transformer
Computer vision
Recommendation model
Other deep learning model
4. Where is the latency problem?
Individual inference requests are slow
Latency increases under concurrent load
GPU utilization is low
LLM time to first token is high
End-to-end API response is slow
[Get my profiling recommendation]
With these details, I can recommend the most appropriate profiler and a practical debugging strategy rather than just suggesting a generic profiling tool.
Pages cited in this answer 7
- docs.pytorch.orgtorch.profiler — PyTorch 2.15 documentation
- docs.nvidia.comPerformance Benchmarking — NVIDIA TensorRT
- docs.nvidia.comPerformance Benchmarking — NVIDIA TensorRT
- docs.nvidia.comModel Analyzer — NVIDIA Triton Inference Server
- docs.nvidia.comLoader Evaluator Tool — NVIDIA DALI
- docs.nvidia.comModel Analyzer Metrics — NVIDIA Triton Inference Server
- docs.nvidia.comGenAI-Perf — NVIDIA Triton Inference Server
- PyTorch Models (GPU/CPU):
ChatGPTNov 21, 2026
To identify GPU bottlenecks and optimize an LLM inference serving pipeline, I recommend combining GPU-level profiling, inference-engine metrics, request-level latency tracking, and distributed tracing.
The key is to measure performance at three levels:
- GPU execution: Is the GPU actually being utilized efficiently?
- Inference engine: Are batching, KV cache, memory, and scheduling efficient?
- End-to-end serving: How long do users wait, and where is that time spent?
A particularly important distinction is between time-to-first-token (TTFT) and time-per-output-token (TPOT). TTFT measures responsiveness; TPOT measures generation speed after the first token.
1. Metrics you should track
Here is a practical metrics checklist.
A. Request latency and throughput
Metric What it tells you TTFT (p50/p95/p99) Time until first generated token TPOT (p50/p95/p99) Average time between output tokens End-to-end latency Total request completion time Inter-token latency (ITL) Token generation consistency Request throughput Requests per second Output token throughput Generated tokens per second Queueing time Time requests wait before execution Prefill latency Time spent processing input tokens Decode latency Time spent generating output tokens Important: Track TTFT and TPOT separately. High TTFT with healthy TPOT often indicates queueing, scheduling, or prefill bottlenecks. High TPOT often points toward decode performance, memory bandwidth, or insufficient batching.
B. GPU utilization and hardware metrics
Metric What it identifies SM utilization Compute utilization Tensor Core utilization Matrix multiplication efficiency GPU memory utilization Memory capacity pressure Memory bandwidth HBM bandwidth saturation GPU power draw Whether GPU is operating near expected power levels GPU clocks Frequency throttling PCIe/NVLink throughput Data transfer bottlenecks GPU temperature Thermal throttling Kernel execution time Expensive GPU operations Don't rely on GPU utilization alone. A GPU can report high utilization while delivering poor token throughput because of inefficient kernels or memory-bound decoding.
C. KV cache and memory metrics
These are particularly important for LLM serving.
Metric What it tells you KV cache utilization Fraction of cache capacity occupied KV cache hit rate Reuse of cached prefixes, where applicable KV cache hit tokens Number of tokens reused KV cache evictions Cache pressure and lost reuse opportunities KV cache allocation failures Requests unable to obtain cache capacity Preemption count Requests interrupted due to memory pressure GPU memory fragmentation Inefficient memory allocation Active KV blocks Number of occupied cache blocks Free KV blocks Remaining cache capacity Note that prefix-cache hit rate and KV-cache occupancy are different metrics. High occupancy does not necessarily mean effective cache reuse.
2. Recommended tools and what each does
I would use the following stack for a production inference pipeline.
1. NVIDIA Nsight Systems
(GPU bottleneck diagnosis)
- CUDA kernel execution timelines
- CPU/GPU synchronization gaps
- GPU idle periods
- Data transfer overhead
- Kernel launch overhead
Best for understanding where GPU execution time goes.
2. NVIDIA DCGM Exporter
(Continuous GPU monitoring)
- GPU utilization and memory usage
- SM and Tensor Core activity
- Memory bandwidth
- PCIe/NVLink activity
- Power and temperature
Best for monitoring GPU health and utilization across multiple machines.
3. vLLM Prometheus metrics
(LLM serving observability)
- TTFT and TPOT
- KV cache utilization
- Prefix cache hits
- Running and waiting requests
- Prefill and decode latency
- Token throughput
Best if you're using vLLM as your inference engine.
4. Prometheus + Grafana
(Metrics and dashboards)
- Time-series metrics collection
- Latency percentiles
- GPU and cache dashboards
- Alerting on performance regressions
- Multi-GPU and multi-node comparisons
Best for continuous production monitoring.
5. NVIDIA GenAI-Perf / AIPerf
(Inference benchmarking)
- TTFT and inter-token latency
- Request latency percentiles
- Output tokens per second
- Concurrency and load testing
- Performance comparisons between configurations
Best for testing whether serving changes actually improve user-facing performance.
6. OpenTelemetry
(End-to-end tracing)
- Request queueing
- Tokenization
- Prefill and decode stages
- Network and API overhead
- Per-request latency breakdown
Best for identifying bottlenecks outside the GPU itself.
My recommendation: Start with DCGM Exporter + Prometheus + Grafana + vLLM metrics. Add Nsight Systems when you need to investigate a specific GPU performance problem, and AIPerf for repeatable load testing.
3. How to interpret the metrics to identify bottlenecks
This is where the monitoring becomes useful. You want to correlate multiple metrics rather than look at isolated numbers.
Observed symptoms Likely bottleneck What to investigate High TTFT, low TPOT Queueing or prefill Scheduler, prompt length, batching High TTFT, high queue depth Serving capacity Concurrency, replicas, admission control Low GPU utilization, high latency CPU or scheduling bottleneck Tokenization, Python overhead, synchronization High GPU utilization, low token throughput Kernel or compute inefficiency Nsight Systems, kernel profiling High HBM bandwidth, slow decoding Memory-bound inference KV access, attention kernels, batching KV cache near capacity Memory pressure Cache allocation, block size, concurrency High cache occupancy, low cache hit rate Poor cache reuse Prefix similarity and workload patterns High PCIe/NVLink traffic Communication overhead Tensor parallelism, model placement High p99 but healthy p50 Tail latency Queueing, long prompts, noisy neighbors One particularly useful distinction:
- Prefill-bound: Long prompts cause high TTFT. Investigate prompt processing, prefill batching, and chunked prefill.
- Decode-bound: Slow token generation causes high TPOT. Investigate memory bandwidth, attention kernels, KV cache access, and decode scheduling.
For cache utilization, don't optimize just to maximize occupancy. A cache at 95% utilization can be healthy if throughput is high and evictions are controlled. Conversely, a cache at 50% utilization with very poor prefix reuse might indicate a workload or caching strategy problem.
4. Build a unified inference monitoring dashboard
I would organize Grafana into four dashboards.
Dashboard 1 — Serving performance
TTFT
p50 / p95 / p99
First-token latency
TPOT
p50 / p95 / p99
Generation speed
Throughput
Tokens/sec
Input and output separately
Concurrency
Requests
Running / waiting
Dashboard 2 — GPU performance
-
SM utilization
-
Tensor Core activity
-
HBM bandwidth
-
GPU memory allocated
-
GPU power and clocks
-
GPU idle time
Dashboard 3 — KV cache performance
-
KV cache utilization
-
Prefix cache hit rate
-
Cache eviction rate
-
Free KV blocks
-
Cache allocation failures
-
Preemption count
Dashboard 4 — Request lifecycle
-
Request arrival
-
Queue duration
-
Tokenization
-
Prefill
-
Decode
-
Streaming and completion
For consistent instrumentation, consider adopting OpenTelemetry's GenAI semantic conventions, including
gen_ai.server.time_to_first_token, rather than inventing unrelated metric names across services.5. Example Prometheus metrics to collect
If you're using vLLM, start by collecting these:
promql# TTFT p95 histogram_quantile( 0.95, sum by (le) ( rate(vllm:time_to_first_token_seconds_bucket[5m]) ) ) # TPOT p95 histogram_quantile( 0.95, sum by (le) ( rate(vllm:request_time_per_output_token_seconds_bucket[5m]) ) ) # KV cache utilization vllm:kv_cache_usage_perc # Running requests vllm:num_requests_running # Waiting requests vllm:num_requests_waiting # Prefix cache hit rate sum(rate(vllm:prefix_cache_hits[5m])) / clamp_min(sum(rate(vllm:prefix_cache_queries[5m])), 1)Metric names can differ between vLLM versions, so validate them against your actual
/metricsendpoint.6. Suggested implementation architecture
A practical architecture looks like this:
Inference workload
Requests · Prompts · Streaming tokens
Inference server
vLLM / Triton / TensorRT-LLM
DCGM Exporter
GPU metrics
vLLM Metrics
LLM metrics
Prometheus + OpenTelemetry
Collection · Aggregation · Tracing
Grafana
Dashboards · Alerts · Performance analysis
7. My suggested rollout priorities
Priority Implementation Goal 1 TTFT, TPOT, throughput Establish baseline 2 GPU utilization and HBM bandwidth Identify hardware bottlenecks 3 KV cache utilization and hit rate Understand memory efficiency 4 Queue depth and prefill/decode metrics Diagnose scheduling 5 Nsight Systems profiling Find kernel-level inefficiencies 6 AIPerf load testing Validate optimizations One additional recommendation: Benchmark at multiple concurrency levels and prompt/output lengths. A serving system that performs well with one request can behave very differently with 32, 64, or 128 concurrent requests.
8. A few questions to make the recommendations more precise
The optimal monitoring setup depends considerably on your inference stack.
1. Which inference engine are you using?
2. What GPU hardware?
3. Where is inference deployed?
4. What's your primary optimization goal?
[Build my monitoring stack]
I can use these details to put together a concrete implementation with Prometheus metric definitions, Grafana dashboard panels, alert thresholds, and a GPU profiling workflow.
Pages cited in this answer 13
- developer.nvidia.comNsight Systems | NVIDIA Developer
- docs.nvidia.comDCGM Exporter Documentation
- docs.nvidia.comProfiling — NVIDIA DCGM Documentation
- docs.vllm.aiMetrics - vLLM
- github.comopentelemetry-semantic-conventions/docs/gen-ai/gen-ai-metrics.md at main · microsoft/opentelemetry-semantic-conventions · GitHub
- github.comsemantic-conventions-genai/docs/gen-ai/gen-ai-metrics.md at main · open-telemetry/semantic-conventions-genai · GitHub
- docs.vllm.aiMetrics - vLLM
- prometheus.ioOverview | Prometheus
- grafana.comTechnical documentation | Grafana Labs
- docs.nvidia.comWelcome to AIPerf Documentation | NVIDIA AIPerf Documentation
- docs.nvidia.comServer Metrics Collection | NVIDIA AIPerf Documentation
- docs.nvidia.comGenAI-Perf — NVIDIA Triton Inference Server
- opentelemetry.ioDocumentation | OpenTelemetry
Google AI ModeNov 21, 2026
Diagnosing an LLM inference pipeline requires looking beyond traditional single-number GPU metrics (like
a flat "95% utilization" gauge), because prefill and decode phases stress your hardware differently: prefill is compute/bandwidth-heavy (parallel matrix math), while decode is memory-bandwidth bound (moving KV-cache data and weights step-by-step).Key Performance Metrics to Track
1. Latency & Timing Metrics
- Time-to-First-Token (TTFT): Measures prefill + queue wait time. Spike here means long prompts, heavy prefill batching congestion, or CPU tokenization/pre-processing delays.
- Inter-Token Latency (ITL) / Time-Per-Output-Token (TPOT): Measures generation speed during the decode phase. If this degrades as concurrency rises, you are hitting a memory bandwidth ceiling on your GPUs.
- End-to-End (E2E) Request Latency: Total lifecycle time from request arrival to the final token.
- Queue Waiting Time / Time in Queue: Tracks how long requests sit in the scheduler before execution starts.
2. Memory & KV-Cache Metrics
- KV-Cache Hit Rate / Prefix Caching Efficiency: Tracks how often automated prefix caching or block-based sharing (e.g., vLLM/SGLang block managers) reuses computed KV blocks. High hit rates drastically slash TTFT.
- KV-Cache Usage / Allocation %: The percentage of GPU memory currently committed to active token sequences versus free blocks. High fragmentation or 100% capacity triggers request stalling or thrashing.
- Memory Bandwidth Utilization: Measured via hardware counters; tells you if you are saturating HBM (High Bandwidth Memory) during the decode phase.
3. Concurrency & Throughput Metrics
- Running vs. Waiting Requests: The live balance of requests actively computing versus queued.
- Output Tokens per Second (tokens/sec) per GPU: The true throughput metric that matters for cost-per-token economics.
Essential Tools for Identification & Profiling
Engine-Level Metrics (Prometheus / Grafana)
Modern serving engines natively expose rich Prometheus telemetry endpoints out-of-the-box:
- vLLM Production Metrics: Exposes histograms for
vllm:time_to_first_token_seconds,vllm:inter_token_latency_seconds, KV-cache usage gauges, and request queues. - SGLang / TensorRT-LLM Metrics: Similar native Prometheus exporters tracking scheduler batch sizes, prefill vs. decode time splits, and cache hit/miss counters.
- Grafana Dashboards: Pair these endpoints with pre-built community or engine-provided dashboards to visualize p50, p99, and tail latencies.
Low-Level GPU Hardware Profilers
When software metrics show a wall and you need to see what the silicon is actually doing:
- NVIDIA Nsight Systems (
nsys): Best for tracing the end-to-end timeline across CPU, CUDA kernels, and communication (NCCL if multi-GPU). Use it to spot host-side bottlenecks like slow tokenizers or Python overhead. - NVIDIA Nsight Compute (
ncu): Deep-dive kernel profiler to check memory-bound vs. compute-bound execution per CUDA kernel (e.g., checking if FlashAttention or PagedAttention kernels are saturating tensor cores or memory bandwidth). nvidia-smi/dcgm-exporter(Data Center GPU Manager): Good for real-time baseline tracking of HBM temperature, power draw, and overall SM (Streaming Multiprocessor) active percentages—though remember that a high SM active rate during decode can still mean poor token throughput if memory is bottlenecked.
If you'd like to narrow this down, tell me:
- What serving engine are you running (e.g., vLLM, SGLang, TensorRT-LLM, Ollama)?
- Which specific symptom are you troubleshooting right now (e.g., high TTFT, dropping tokens/sec under load, or OOM crashes)?
Top head-to-head comparisons
Since Jun 21Data through Nov 30, 2026Based on 52 AI answers
For agents: this page as Markdown, https://parse.gl/topics/gpu-bottleneck-identification.md. JSON, MCP · free for the last 90 days, checks from $0.01
This page
Read and search
Connect
npx -y parse-gl check <domain>Copy the CLI commandAn agent can save work before signup: POST https://agent.parse.gl/v1/workspaces
What it costs
Prices: https://parse.gl/pricing.md
Map of the site: https://parse.gl/llms.txt