Hitesh Sahu
Hitesh SahuHitesh Sahu
  1. Home
  2. โ€บ
  3. posts
  4. โ€บ
  5. โ€ฆ

  6. โ€บ
  7. 2 7 Triton

Loading โณ
Fetching content, this wonโ€™t take longโ€ฆ


๐Ÿ’ก Did you know?

๐ŸŒ Bananas are berries, but strawberries are not.

๐Ÿช This website uses cookies

No personal data is stored on our servers however third party tools Google Analytics cookies to measure traffic and improve your website experience. Learn more

Loading โณ
Fetching content, this wonโ€™t take longโ€ฆ


๐Ÿ’ก Did you know?

๐Ÿคฏ Your stomach gets a new lining every 3โ€“4 days.
AI-Infrastructure

    AI-AgenticAI

    AI-DeepLearning

    AI-GenAI

    AI-Infrastructure
    • NVIDIA AI Infrastructure and Operations Fundamentals


    • AI Infra Computing : GPU, DPU, Virtualization, DGX Systems


    • AI Programming Model


    • Pinned Memory (Page-Locked Memory) in CUDA and GPU Computing


    • RAPIDS and GPU Accelerated Data Science: cuDF, cuML, CUDA, NCCL and Distributed AI Pipelines


    • NVIDIA DCGM: GPU Health, Diagnostics, and Prometheus Metrics


    • NVIDIA Base Command Manager: Provisioning and Operating GPU Clusters


    • Slurm: The HPC Workload Manager Behind AI Training Clusters


    • TensorRT and High-Performance AI Inference: CUDA, ONNX, TensorRT-LLM and GPU Optimization


    • NCCL and Distributed GPU Communication: CUDA, AllReduce, Multi-GPU and AI Cluster Networking


    • ONNX (Open Neural Network Exchange): Portable AI Models, TensorRT and Cross-Framework Inference


    • LangChain and AI Agent Orchestration: RAG, LLM Workflows, Vector Databases and Tool Calling


    • NVIDIA NeMo and Enterprise AI Platforms: Distributed LLM Training, RAG and TensorRT-LLM


    • Megatron-LM and Distributed LLM Training: Tensor Parallelism, NCCL and Trillion-Scale AI Models


    • NVIDIA Triton Inference Server: TensorRT-LLM, GPU Serving and Production AI Inference


    • NVIDIA Riva: Real-Time Conversational AI with ASR, NLP and Text-to-Speech


    • NVIDIA NGC Catalog: GPU Optimized Containers, AI Models and Enterprise AI Infrastructure


    • AI Infra Networking: GPU Clusters, InfiniBand, RoCE, and DPU Integration


    • AI Infra Storage: NVMe, Parallel File Systems, Object Storage, and GPUDirect Storage


    • AI/ML Operations


    • AI-Infrastructure Index


    AI-Machine-Learning

    AI-Math

    AWS

    Azure

    kubernetes

    Management

    Programming

    Terraform

    Z_Appendix

Cover Image for NVIDIA Triton Inference Server: TensorRT-LLM, GPU Serving and Production AI Inference
AI-Infrastructure

NVIDIA Triton Inference Server: TensorRT-LLM, GPU Serving and Production AI Inference

NVIDIA Triton Inference Server and vLLM compared โ€” PagedAttention and continuous batching mechanics, TensorRT-LLM vs vLLM vs Triton tradeoff table, when to use each for production LLM serving, and Kubernetes deployment patterns for both.

NVIDIA
Triton
Triton Inference Server
TensorRT
TensorRT-LLM
CUDA
โ† Previous

Megatron-LM and Distributed LLM Training: Tensor Parallelism, NCCL and Trillion-Scale AI Models

Next โ†’

NVIDIA Riva: Real-Time Conversational AI with ASR, NLP and Text-to-Speech

NVIDIA Triton Inference Server ๐Ÿณ

Triton Inference Server is a high-performance model serving platform for deploying AI models in production.

It is designed for:

  • scalable inference
  • multi-model serving
  • GPU acceleration
  • low-latency AI APIs
  • enterprise AI deployment

Triton can serve:

  • LLMs
  • computer vision models
  • speech models
  • recommendation systems
  • ensemble pipelines

Why Triton Exists

Running AI models in production is difficult because of:

  • batching
  • GPU scheduling
  • concurrency
  • scaling
  • memory management
  • multi-model orchestration

Triton handles these automatically.

Myths about Triton

  1. Triton provides GPUs or hardware
  • Triton is software only. It runs on hardware you already have (CPUs/GPUs).
  1. Triton is a model framework (like PyTorch)
  • Triton does not train models. It only serves models for inference.
  1. Triton replaces TensorRT
  • Triton can use TensorRT models, but it is a serving layer, not an optimizer.
  1. Triton works only with TensorRT models
  • Triton supports TensorRT, ONNX, PyTorch, TensorFlow, and more.
  1. Triton automatically optimizes models
  • Not exactly. Triton executes models efficiently, but model optimization must be done beforehand (e.g., with TensorRT).

Why Triton Matters

Modern AI systems need:

  • high throughput
  • low latency
  • GPU efficiency
  • scalable serving
  • production observability

Triton provides all of these in a production-grade inference platform.

What Triton Does

Triton acts like:

Production web server for AI models

Instead of serving HTML pages:

  • it serves model inference requests.

# Step 1: Create the example model repository
git clone -b r26.04 https://github.com/triton-inference-server/server.git
cd server/docs/examples
./fetch_models.sh

# Step 2: Launch triton from the NGC Triton container
docker run --gpus=1 --rm --net=host -v ${PWD}/model_repository:/models nvcr.io/nvidia/tritonserver:26.04-py3 tritonserver --model-repository=/models --model-control-mode explicit --load-model densenet_onnx

# Step 3: Sending an Inference Request
# In a separate console, launch the image_client example from the NGC Triton SDK container
docker run -it --rm --net=host nvcr.io/nvidia/tritonserver:26.04-py3-sdk /workspace/install/bin/image_client -m densenet_onnx -c 3 -s INCEPTION /workspace/images/mug.jpg

# Inference should return the following
Image '/workspace/images/mug.jpg':
    15.346230 (504) = COFFEE MUG
    13.224326 (968) = CUP
    10.422965 (505) = COFFEEPOT

High-Level Triton Workflow

flowchart TD

    A["Client Requests"]--> B["Triton Inference Server ๐Ÿณ"]

    B --> C["TensorRT ๐Ÿ–ฒ / PyTorch / ONNX"]

    C --> D["NVIDIA GPUs ๐Ÿงฎ"]

    D --> E["Inference Response ๐Ÿ’ฌ"]

Example: Triton + TensorRT-LLM

Modern LLM stack:

  • TensorRT: Optimizes a model
  • Triton: Serves optimized models at scale
flowchart TD

    A["Client Requests ๐Ÿ™๐Ÿปโ€โ™‚๏ธ"]--> B["Triton Server ๐Ÿณ"]

    B --> C["TensorRT-LLM ๐Ÿ–ฒ"]
    
    C --> D["NVIDIA GPUs ๐Ÿงฎ"]
    
    D --> E["Generated Tokens ๐Ÿ’ฌ"]

Triton APIs

Triton supports:

  • HTTP
  • gRPC
  • streaming inference

Example:

import tritonclient.http as httpclient

Supported Backends

Triton supports many runtimes.

BackendPurpose
TensorRTOptimized NVIDIA inference
PyTorchTorchScript inference
ONNX RuntimeCross-platform inference
TensorFlowTensorFlow serving
Python backendCustom Python logic
vLLMOptimized LLM serving
TensorRT-LLMHigh-performance LLM inference

Triton vs Traditional APIs

FeatureTraditional API ServerTriton
GPU-awareNOYES
Dynamic batchingNOYES
Multi-model servingLimitedExcellent
TensorRT integrationNONative
AI inference optimizationLimitedExcellent

Triton Architecture

Triton Ecosystem

ComponentRole
CUDAGPU compute
NCCLMulti-GPU communication
TensorRTOptimized inference
TensorRT-LLMLLM optimization
TritonProduction serving
KubernetesOrchestration
flowchart TD

    A["HTTP / gRPC Requests"]--> B["Triton Server ๐Ÿณ"]
    B --> C["Scheduler ๐Ÿ•˜"]
    C --> D["Model Backend"]
    D --> E["CUDA Runtime ๐Ÿ“Ÿ"]
    E --> F["NVIDIA GPUs ๐Ÿงฎ"]

Diagram of Triton Inference Server internal architecture and request flow

โฑ๏ธ Triton Scheduling

Triton optimizes:

  • batching
  • queueing
  • GPU assignment
  • parallel execution
  • memory reuse

This helps maximize:

  • throughput
  • GPU utilization
  • latency efficiency

๐Ÿ—‚๏ธ Dynamic Batching

One of Tritonโ€™s biggest features.

Instead of processing requests individually:

Request 1
Request 2
Request 3

Triton automatically combines them:

Single GPU batch

Benefits:

  • higher GPU utilization
  • better throughput
  • lower cost

Dynamic Batching Example

flowchart LR

    A["Request 1 ๐Ÿ“’"]
    B["Request 2 ๐Ÿ“˜"]
    C["Request 3 ๐Ÿ“•"]

    A --> D["Triton Dynamic Batch ๐Ÿ—‚๏ธ"]
    B --> D
    C --> D

    D --> E["Single GPU Inference"]

๐Ÿ—ƒ๏ธ Model Repository

Triton loads models from a structured repository.

Example:

models/
 โ”œโ”€โ”€ llama/
 โ”‚    โ”œโ”€โ”€ 1/
 โ”‚    โ””โ”€โ”€ config.pbtxt
 โ”œโ”€โ”€ reranker/
 โ””โ”€โ”€ embedding_model/

๐Ÿ“ฆ Concurrent Model Execution

Triton can run simultaneously:

  • ๐Ÿ”ข Multiple models
  • ๐Ÿท๏ธ Multiple versions
  • ๐Ÿงฎ Multiple GPUs

Example:

  • recommendation model
  • embedding model
  • reranker
  • LLM

all served together.

๐Ÿ”— Ensemble Models

Triton can chain multiple models into pipelines.

Example:

flowchart TD

    A["Input Text"]--> B["Embedding Model"]
    B --> C["Retriever"]
    C --> D["LLM"]
    D --> E["Final Response"]

This is useful for:

  • RAG systems
  • multimodal AI
  • AI agents

๐Ÿ“Š Triton + Monitoring

Triton exposes:

  • Prometheus metrics
  • GPU metrics
  • Latency metrics
  • Throughput metrics

Important for:

  • Observability
  • Autoscaling
  • Production reliability

Common Triton Use Cases

  • LLM serving
  • Chatbots
  • RAG systems
  • Recommendation engines
  • Computer vision APIs
  • Speech AI
  • Real-time inference systems

Typical Production Stack

flowchart TD
    A["PyTorch / NeMo Model"]--> B["ONNX ๐Ÿ“ฆ"]
    B --> C["TensorRT-LLM  ๐Ÿ–ฒ"]
    C --> D["Triton Inference Server  ๐Ÿณ"]
    D --> E["Production APIs"]

Triton + Kubernetes

Triton is commonly deployed on:

  • Kubernetes
  • GPU clusters
  • cloud AI platforms

Example stack:

flowchart TD

    A["Kubernetes โ˜ธ๏ธ"]--> B["Triton Pods ๐Ÿณ"]
    B --> C["TensorRT-LLM  ๐Ÿ–ฒ"]
    C --> D["GPU Nodes ๐Ÿงฎ"]

vLLM: The Open-Source Alternative

vLLM (UC Berkeley Sky Lab, 2023) is the dominant open-source LLM inference engine. It is Triton's primary alternative for LLM serving and the benchmark every production team compares against TRT-LLM.

Why vLLM Matters

Before vLLM, LLM inference had two problems:

  1. KV cache fragmentation โ€” each sequence reserved a contiguous VRAM block for its full max-length KV cache, even if the actual sequence was short. 60โ€“80% of VRAM was wasted on pre-allocation.
  2. Static batching โ€” the server waited to fill a batch before processing. Short sequences held up the batch waiting for long ones to finish.

vLLM solved both with PagedAttention and continuous batching.

PagedAttention โ€” How it Works

PagedAttention borrows the OS virtual memory concept: instead of allocating one contiguous KV cache block per sequence, VRAM is divided into fixed-size pages (~16 tokens each). Pages are allocated on demand as tokens are generated and freed immediately when a sequence finishes.

Traditional KV cache (pre-vLLM):
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚ Seq A  [โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘] โ”‚  โ†’ 512-token slot, seq only 200 tokens โ†’ 60% wasted
โ”‚ Seq B  [โ–ˆโ–ˆโ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘] โ”‚  โ†’ 512-token slot, seq only 80 tokens โ†’ 84% wasted
โ”‚ (fragmented, non-shareable)   โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

PagedAttention (vLLM):
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚ Page 0 โ”‚ Page 1 โ”‚ Page 2 โ”‚ Page 3 โ”‚ ... โ”‚
โ”‚ Seq A  โ”‚ Seq A  โ”‚ Seq B  โ”‚ Seq C  โ”‚     โ”‚
โ”‚ (pages allocated as tokens generated)   โ”‚
โ”‚ (freed immediately on sequence end)     โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

Result: ~55% more sequences can run concurrently in the same VRAM budget. For shared prefix prompts (e.g., a system prompt used by all users), pages are copy-on-write shared โ€” one physical page serves thousands of requests.

Continuous Batching

vLLM uses iteration-level scheduling: instead of waiting for all sequences in a batch to finish (static batching), the scheduler runs one decode step at a time and inserts new requests as soon as a slot opens.

Static batching:          Continuous batching (vLLM):
t=0: [A, B, C, D]        t=0: [A, B, C, D]
t=1: [A, B, C, D]        t=1: [A, B, C, E]  โ† E inserted as D finishes
t=2: [A, B, C, D]        t=2: [A, B, F, E]  โ† F inserted as C finishes
t=3: [A, B, C, D]        ...GPU never idles waiting for stragglers
t=4: done โ†’ next batch

GPU stays at maximum utilization. Throughput improves 2โ€“10ร— for mixed-length workloads.

vLLM Key Features

FeatureDetail
PagedAttentionOS-style paged KV cache; ~55% VRAM savings; copy-on-write prefix sharing
Continuous batchingIteration-level scheduling; no static batch wait
OpenAI-compatible APIDrop-in replacement โ€” same /v1/completions, /v1/chat/completions endpoints
QuantizationAWQ, GPTQ, INT4, INT8, FP8 โ€” load quantized HuggingFace checkpoints directly
Speculative decodingDraft model generates tokens; target model verifies in parallel
Multi-GPUTensor parallelism via --tensor-parallel-size N
HardwareNVIDIA (CUDA), AMD (ROCm), Google TPU, CPU (slow)
Model supportAny HuggingFace model โ€” Llama, Mistral, Qwen, Gemma, Phi, Falcon, Mixtral MoE
Structured outputJSON schema enforcement, guided decoding

Running vLLM

# Install
pip install vllm

# Serve Llama 3.1 8B on 1 GPU โ€” OpenAI-compatible API on :8000
python -m vllm.entrypoints.openai.api_server \
  --model meta-llama/Meta-Llama-3.1-8B-Instruct \
  --tensor-parallel-size 1 \
  --max-model-len 8192 \
  --gpu-memory-utilization 0.90

# Client โ€” identical to OpenAI SDK
from openai import OpenAI
client = OpenAI(base_url="http://localhost:8000/v1", api_key="none")
response = client.chat.completions.create(
    model="meta-llama/Meta-Llama-3.1-8B-Instruct",
    messages=[{"role": "user", "content": "Explain PagedAttention"}]
)
# Multi-GPU โ€” 70B model across 4 GPUs (tensor parallel)
python -m vllm.entrypoints.openai.api_server \
  --model meta-llama/Meta-Llama-3.1-70B-Instruct \
  --tensor-parallel-size 4 \
  --dtype bfloat16

vLLM on Kubernetes

apiVersion: apps/v1
kind: Deployment
metadata:
  name: vllm-llama3
  namespace: inference
spec:
  replicas: 2
  selector:
    matchLabels:
      app: vllm-llama3
  template:
    spec:
      containers:
        - name: vllm
          image: vllm/vllm-openai:latest
          args:
            - --model=meta-llama/Meta-Llama-3.1-8B-Instruct
            - --tensor-parallel-size=1
            - --gpu-memory-utilization=0.90
          ports:
            - containerPort: 8000
          resources:
            limits:
              nvidia.com/gpu: "1"
          env:
            - name: HF_TOKEN
              valueFrom:
                secretKeyRef:
                  name: hf-token
                  key: token

vLLM vs TensorRT-LLM vs Triton

These three are at different layers and are often combined, not mutually exclusive:

vLLMTensorRT-LLMTriton Inference Server
What it isLLM inference engineNVIDIA LLM compiler + runtimeMulti-model serving platform
LayerInference engineCompiler + inference kernelServing frontend
Created byUC Berkeley / vLLM ProjectNVIDIANVIDIA
HardwareNVIDIA, AMD, CPU, TPUNVIDIA onlyAny (via backends)
Setup complexityLow โ€” pip install vllmHigh โ€” compile engine per GPU/configMedium โ€” model repo + config.pbtxt
LatencyGood (Flash Attention 2, CUDA graphs)Best โ€” highest NVIDIA hardware utilizationDepends on backend
ThroughputExcellent (PagedAttention + continuous batching)Excellent (FP8, WGMMA, TMA)Excellent (dynamic batching)
Model loadingAny HuggingFace checkpoint directlyRequires offline compilation stepPre-compiled TRT engine or HF weights
QuantizationAWQ, GPTQ, INT8, FP8 (load-time)FP8, INT8, INT4 (compile-time)Via backend
KV cachePagedAttention (paged, no fragmentation)Manual chunked KVVia backend
Multi-GPUTensor parallel via CLI flagTensor + pipeline parallelVia backend
OpenAI APIBuilt-in (/v1/chat/completions)No โ€” raw C++ / Python bindingVia HTTP/gRPC endpoint
BatchingContinuous (iteration-level)Continuous (in-flight batching)Dynamic batching
Speculative decodingYesYesVia backend
MoE models (Mixtral)Yes (expert parallelism)YesVia backend
Production maturityHigh (Anyscale, Mistral, Cursor)High (NVIDIA NIM, DGX Cloud)High (NVIDIA enterprise)
NIM uses it?No (NIM = TRT-LLM + Triton)Yes โ€” core NIM backendYes โ€” NIM serving layer
Best forOpen-source deployment, multi-cloud, dev velocityMaximum performance on NVIDIA fleetMulti-model serving, RAG pipelines, enterprise

How They Combine

flowchart TD
    Client["Client Request"] --> Triton["Triton Inference Server\n(serving + batching + routing)"]
    Triton --> TRTLLM["TensorRT-LLM backend\n(NVIDIA-compiled, highest perf)"]
    Triton --> vLLMB["vLLM backend\n(easier model loading)"]
    TRTLLM --> GPU["NVIDIA GPU"]
    vLLMB --> GPU

    Client2["Client Request"] --> vLLM["vLLM\n(self-contained โ€” engine + API server)"]
    vLLM --> GPU2["NVIDIA / AMD GPU"]

NIM = Triton + TRT-LLM backend, pre-packaged with optimized profiles per GPU type.

When to Use Which

SituationRecommendation
You want the highest tokens/sec on H100 and can accept compilation timeTensorRT-LLM (or NIM which wraps it)
You need to serve 10+ different models from one serverTriton (multi-model serving)
You want fastest path to production with a HuggingFace modelvLLM โ€” pip install vllm, done
You're on AMD/ROCm or need hardware flexibilityvLLM
You need RAG pipeline (embedding + reranker + LLM) as one endpointTriton ensemble
You're building DGX Cloud production workloadsNIM (TRT-LLM + Triton)
You want OpenAI-compatible API with zero configvLLM
Your org uses NVIDIA enterprise supportTriton + TRT-LLM or NIM

Related Posts

  • NVIDIA NIM: Optimized Inference Microservices โ€” NIM uses Triton as its backend; NIM profiles pre-select the TRT-LLM Triton backend for each GPU type
  • TensorRT and High-Performance AI Inference โ€” the TensorRT-LLM backend that Triton loads for LLM inference; explains the compilation pipeline
  • Flash Attention: Fast Memory-Efficient Attention โ€” PagedAttention (vLLM) and Flash Attention (SRAM tiling) solve different problems; both are needed for production LLM serving
  • Fine-Tuning LLMs: LoRA, QLoRA, PEFT โ€” fine-tuned checkpoints are loaded into vLLM or TRT-LLM for serving
  • Optimizing AI Inference at Scale โ€” continuous batching, KV cache, and tensor parallelism in the context of Triton and vLLM at production scale
  • GPU Autoscaling: KEDA, HPA, Cluster Autoscaler โ€” scaling Triton/vLLM-backed deployments based on GPU utilization and request queue depth
Hitesh Sahu
Written by Hitesh Sahu, a passionate developer and blogger.

Tue May 19 2026

Share This on

โ† Previous

Megatron-LM and Distributed LLM Training: Tensor Parallelism, NCCL and Trillion-Scale AI Models

Next โ†’

NVIDIA Riva: Real-Time Conversational AI with ASR, NLP and Text-to-Speech

AI-Infrastructure/2-7-Triton
Let's work together
hiteshkrsahu@gmail.com
Munich ๐Ÿฅจ, Germany ๐Ÿ‡ฉ๐Ÿ‡ช, EU
Playstore
Hitesh Sahu's apps on Google Play Store
Need Help?
Let's Connect
Navigation
ย  Home/About
ย  Skills
ย  Work/Projects
ย  Lab/Experiments
ย  Contribution
ย  Awards
ย  Art/Sketches
ย  Thoughts
ย  Contact
Links
ย  Sitemap
ย  Legal Notice
ย  Privacy Policy

Made with

NextJS logo

NextJS by

hitesh Sahu

| ยฉ 2026 All rights reserved.