πŸ€– AI/ML

Triton

Triton Inference Server

NVIDIA's high-performance ML model serving platform. With multi-framework and multi-model support, it is the standard for production AI deployment.

πŸ“– Detailed Explanation

Triton Inference Server is an open-source AI model serving platform developed by NVIDIA. It can serve models from many frameworks, such as TensorFlow, PyTorch, ONNX, and TensorRT, simultaneously on a single server, which makes it possible to manage AI inference workloads efficiently in production environments.

Triton began in 2018 as the TensorRT Inference Server and was rebranded as Triton in 2020 to support multiple frameworks. It now supports cloud, data center, edge, and embedded environments, and runs not only on NVIDIA GPUs but also on x86/ARM CPUs and AWS Inferentia.

Its key features include Dynamic Batching (automatically batching requests), Model Ensemble (chaining multiple models), Model Versioning, and Concurrent Model Execution. In particular, Dynamic Batching groups individual requests to maximize GPU utilization and raises throughput several-fold.

In practice, Triton is core infrastructure for large-scale AI services. Global companies such as Grab and PayPal have consolidated their inference infrastructure on Triton to reduce operational complexity, and Triton has demonstrated top-tier performance in the MLPerf Inference benchmarks.

πŸ“Š Performance & Cost

As of January 2025, here are the performance and features of Triton Inference Server.

Item Details
License Open source (free, BSD-3 License)
MLPerf v4.1 (Llama 2 70B) Bare-metal-equivalent performance on 8 H200 GPUs
GPU vs CPU performance ratio T4 GPU is 37x more cost-efficient than CPU (BERT large)
Dynamic Batching effect 2-5x higher throughput
Supported frameworks TensorRT, PyTorch, ONNX, TensorFlow, vLLM, etc.
Protocols HTTP/REST, gRPC, C API

* Triton is free and open source, but GPU infrastructure costs are separate. Enterprise support is available with an NVIDIA AI Enterprise subscription.

πŸ’» Code Example

Triton Inference Server deployment and Python client example.

# 1. Triton μ„œλ²„ μ‹€ν–‰ (Docker)
# docker run --gpus all -p 8000:8000 -p 8001:8001 -p 8002:8002 \
#   -v /path/to/models:/models \
#   nvcr.io/nvidia/tritonserver:24.01-py3 \
#   tritonserver --model-repository=/models

# 2. Python ν΄λΌμ΄μ–ΈνŠΈλ‘œ μΆ”λ‘  μš”μ²­
import tritonclient.http as httpclient
import numpy as np

# Triton μ„œλ²„ μ—°κ²°
client = httpclient.InferenceServerClient(url="localhost:8000")

# μ„œλ²„ μƒνƒœ 확인
if client.is_server_live():
    print("Triton μ„œλ²„ 정상 μž‘λ™ 쀑")

# λͺ¨λΈ 정보 확인
model_name = "bert_onnx"
model_metadata = client.get_model_metadata(model_name)
print(f"λͺ¨λΈ: {model_metadata['name']}, 버전: {model_metadata['versions']}")

# μž…λ ₯ 데이터 μ€€λΉ„
input_ids = np.array([[101, 2023, 2003, 1037, 3231, 102]], dtype=np.int64)
attention_mask = np.array([[1, 1, 1, 1, 1, 1]], dtype=np.int64)

# μΆ”λ‘  μž…λ ₯ μ„€μ •
inputs = [
    httpclient.InferInput("input_ids", input_ids.shape, "INT64"),
    httpclient.InferInput("attention_mask", attention_mask.shape, "INT64")
]
inputs[0].set_data_from_numpy(input_ids)
inputs[1].set_data_from_numpy(attention_mask)

# μΆ”λ‘  좜λ ₯ μ„€μ •
outputs = [httpclient.InferRequestedOutput("output")]

# μΆ”λ‘  μ‹€ν–‰
response = client.infer(model_name, inputs, outputs=outputs)

# κ²°κ³Ό 확인
output_data = response.as_numpy("output")
print(f"μΆ”λ‘  κ²°κ³Ό shape: {output_data.shape}")
print(f"μΆ”λ‘  κ²°κ³Ό: {output_data[:5]}")  # μƒμœ„ 5개 κ°’

# μ„±λŠ₯ 톡계 확인
statistics = client.get_inference_statistics(model_name)
print(f"총 μΆ”λ‘  횟수: {statistics['model_stats'][0]['inference_count']}")
print(f"평균 μΆ”λ‘  μ‹œκ°„: {statistics['model_stats'][0]['inference_stats']['success']['compute_infer']['avg']/1e6:.2f}ms")

πŸ—£οΈ Say It Like This in Practice

πŸ’¬ In a Meeting
"If we consolidate our inference servers on Triton, we can serve PyTorch and ONNX models from a single endpoint. It greatly reduces operational complexity."
πŸ’¬ In an Interview
"Using Triton's Dynamic Batching, we raised GPU utilization to over 90%. Throughput tripled on the same hardware, and cost efficiency improved significantly."
πŸ’¬ In a Technical Discussion
"For LLM serving, the Triton + vLLM backend combination works well. If you optimize the model with TensorRT-LLM, you can cut latency in half."

Take a mock interview on this topic β†’ WIA SOOM AI Interview Β· Start for free

⚠️ Common Mistakes & Cautions

❌

Missing model config.pbtxt configuration

If a model folder has no config.pbtxt, loading fails. Specify the input/output shapes and data types exactly.

❌

Dynamic Batching not configured

By default, batching is disabled, so GPU efficiency is low. Be sure to set max_batch_size and preferred_batch_size.

βœ…

The right way

Use Model Analyzer to find the optimal batch size, Perf Analyzer for performance benchmarks, and set up monitoring with Prometheus/Grafana.

πŸ”— Related Terms

πŸ“š Learn More