Model Profiles#
A NIM Model profile defines two things – what model engines NIM can use and what criteria NIM should use to choose those engines. Unique strings based on a hash of the profile contents identify each profile.
Users may select a profile at deployment time by following the Profile Selection steps. If the user does not manually select a profile at deployment time, NIM will automatically choose a profile according to the rules in Automatic Profile Selection. To understand how profiles and their corresponding engines are created, see How Profiles are Created.
Model profiles are embedded within the NIM container in a Model Manifest file, which is by default placed at /etc/nim/config/model_manifest.yaml
within the container filesystem.
Profile Selection#
To select a profile for deployment, set a specific profile ID with -e NIM_MODEL_PROFILE=<value>
. You can find the valid profile IDs by using the list-model-profiles utility, as shown in the following example:
docker run --rm --runtime=nvidia --gpus=all $IMG_NAME list-model-profiles
MODEL PROFILES
- Compatible with the system and runnable:
- 454ab496734eabc2a40e03076f85a9691a1487a9fd987580a55421aaad2684ce (h100-fp16-tp1-throughput)
To select, you can set -e NIM_MODEL_PROFILE="454ab496734eabc2a40e03076f85a9691a1487a9fd987580a55421aaad2684ce"
to run the H100 TP1 profile.
Automatic Profile Selection#
NIM is designed to automatically select the most suitable profile from the list of compatible profiles based on the detected hardware. Each profile consists of different parameters, which influence the selection process. The sorting logic based on the parameters involved is outlined below:
Compatibility Check: First, NIM filters out the profiles that are not runnable with the detected configuration based on the number and type of GPUs available.
Backend: This can be either TensorRT-LLM or vLLM. The optimized TensorRT-LLM profiles are preferred over vLLM when available.
Precision: Lower precision profiles are preferred when available. For example, NIM will automatically select
FP8
profiles overFP16
. See Quantization for more details.Optimization Profile: Latency-optimized profiles are selected over throughput-optimized profiles by default.
Tensor Parallelism: Profiles with higher tensor parallelism values are preferred. For example, a profile that requires 8 GPUs to run will be selected over one which requires 4 GPUs.
This selection will be logged at startup. For example:
Detected 1 compatible profile(s).
Valid profile: 454ab496734eabc2a40e03076f85a9691a1487a9fd987580a55421aaad2684ce (h100-fp16-tp1-throughput) on GPUs [0]
Selected profile: 454ab496734eabc2a40e03076f85a9691a1487a9fd987580a55421aaad2684ce (h100-fp16-tp1-throughput)
Profile metadata: gpu: H100
Profile metadata: gpu_device: 2331:10de
Profile metadata: pp: 1
Profile metadata: precision: fp16
Profile metadata: profile: throughput
Profile metadata: tp: 1
Preparing model workspace. This step might download additional files to run the model.
...
Model workspace is now ready. It took 294.817 seconds
How Profiles are Created#
NIM microservices have two main categories of profiles: optimized
and generic
. optimized
profiles are created for a subset of GPUs and models and leverage model- and hardware-specific optimizations intended to improve the performance of large language models. Over time, the breadth of models and GPUs for which optimized
engines exist will increase. However, if an optimized engine does not exist for a particular model and GPU configuration combination, a generic
backend is used as a fallback.
Currently, optimized
profiles leverage pre-compiled TensorRT and TensorRT-LLM engines, while generic
profiles utilize vLLM
Note
The generic
profile fallback utilizing vllm is not supported by VILA NIM.
Optimization Targets#
optimized
profiles can have different optimization targets, catered to minimize latency or maximize throughput. These engine profiles are tagged as latency
and throughput
respectively, in the model manifest included with the NIM.
latency
profiles are designed to minimize:
Time to First Token (TTFT): The latency between the initial inference request to the model and the return of the first token.
Inter-Token Latency (ITL): The latency between each token after the first.
throughput
profiles are designed to maximize:
Total Throughput per GPU: The total number of tokens generated per second by the NIM, divided by the number of GPUs used.
While there can be many differences between the throughput and latency variants to meet these criteria, one of the most significant is that throughput variants utilize the minimum number of GPUs required to host a model (typically constrained by memory utilization). Latency variants use additional GPUs to decrease request latency at the cost of decreased total throughput per GPU relative to the throughput variant.
Note
VILA NIM use single throughput
profiles to balance latency and throughput.
Quantization#
NIM for VLM model optimized
profiles enabled quantized tensorrt-llm engines with reduced numerical precision. These can be identified by the numeric format included in the model tag name. For example, trtllm-h100x1-int4-awq-rc4
for model’s LLM decoder that have been quantized to 4-bit integer point values with int4_AWQ qunatization. Meanwhile, VLM model’s vision encodes are reduced precision to fp16 with tag name such as visualenc-h100x1-fp16-rc4
. The actual precision for vision-encoder and LLM-decoder are mixed.
Note
Profile name h100-fp16-tp1-throughput
is a mixed precision with fp16 vision encoder visualenc-h100x1-fp16-rc4
and int4_awq llm decoder trtllm-h100x1-int4-awq-rc4
together. See more model and GPU details in the Support Matrix.