Skip to navigation

Model Profiles and Selection

View as MarkdownOpen in Claude

A model profile is a pre-validated inference configuration that NIM LLM and VLM selects at container startup.

Every model-specific NIM container ships with a model manifest — a catalog of one or more profiles. Each profile is defined by tags for the backend engine, model precision, tensor parallelism size (TP), pipeline parallelism size (PP), and LoRA support.

For model-free NIM, the model manifest is generated at runtime with generic profiles that can deploy the NIM across a wide range of system configurations.

At container startup, NIM selects exactly one profile from the manifest. The selected profile determines which model files are downloaded and how the inference backend is launched.

Profile Naming Convention

Profile descriptions are generated from the tags in the container’s model manifest. A common base form is:

<backend>-<precision>-tp<N>-pp<M>

Where:

  • <backend> is the inference engine in the container image (vllm or sglang). Each image ships only its own engine’s profiles: the SGLang image lists and loads sglang-* profiles, and the vLLM image lists and loads vllm-* profiles.
  • <precision> is the quantization format (bf16, fp8, mxfp4, or nvfp4)
  • tp<N> is the tensor parallelism degree (number of GPUs)
  • pp<M> is the pipeline parallelism degree (pp1 means one stage)
  • Additional tags can indicate LoRA support, GPU type, or tuning

For example, the base form vllm-bf16-tp4-pp1 describes BF16 precision with TP4 and PP1 on vLLM, while vllm-fp8-tp8-pp2 describes FP8 with TP8 and PP2. The equivalent SGLang descriptions start with sglang-.

Descriptions can include additional tag values, such as a GPU name, a performance variant (throughput or latency), or a minimum-memory value. The base form above is not a template for reconstructing an exact selector.

Copy the complete description printed by list-model-profiles for the image version you plan to deploy, or use the full profile ID. The optimized-profile tables in the Support Matrix for NIMs provide full IDs where available. For model-free runtime manifests, list the profiles with NIM_MODEL_PATH set to the intended checkpoint. Use the ID to distinguish profiles that share precision and parallelism.

List Available Profiles

Before pulling a model-specific NIM image, use the NIM Metadata API to inspect published profiles for a container tag over HTTP. The Choose a Profile for Your Hardware guide explains how to compare GPU targeting, memory requirements, precision, and parallelism, then record a profile ID for deployment with NIM_MODEL_PROFILE. Metadata coverage varies by NIM and tag, and missing fields represent unknown requirements. If metadata is unavailable, use the Support Matrix for NIMs and the following list-model-profiles command to inspect the container on your system.

To list the profiles that a container can run, complete the following steps:

Run the list-model-profiles command:

export NIM_LLM_IMAGE=nvcr.io/nim/meta/llama-3.1-8b-instruct:2.1.6
docker run --rm --gpus=all \
${NIM_LLM_IMAGE} \
list-model-profiles

Example output (illustrative only):

MODEL PROFILES
- Compatible with system and runnable:
- dcec66a50892315842bdc46d5b2d8648fed3fe3d3382437f0a811c56eff8c39c (vllm-bf16-tp1-pp1) [requires >=18 GB/gpu]
- With LoRA support:
- d66193b819d2bc2ae40aefcec0da5997b5f9187dd79b8155ec111b16999d18e0 (vllm-bf16-tp1-pp1-feat_lora) [requires >=22 GB/gpu]
- Compatible with system but low memory:
- a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4e5f6a1b2 (vllm-bf16-tp1-pp1) [requires >=45 GB/gpu, try --max-model-len=4096 to reduce to >=30 GB/gpu]
- Incompatible with system:
- 27af459c9caa0f9b34d5e07e5962960df6b0120df2039d06148e0e63595195e5 (vllm-bf16-tp2-pp1)
- 30d16624c8100d40e6cde3af7f4e4ff6028f776e92efdcf09fcb515ae65662c0 (vllm-bf16-tp4-pp1)
- 6f888502f35dc189f8c67f3e11174028a4ce42e92868e6a0ca10ef1d84953874 (vllm-bf16-tp8-pp1)

The example above shows output from a vLLM container image. The SGLang container image emits profiles with sglang-* descriptions instead (for example, sglang-bf16-tp1-pp1).

Each profile has:

  • Profile ID: A unique 64-character profile ID.
  • Profile description: A human-readable string constructed by joining tag values with hyphens (for example, vllm-bf16-tp1-pp1 on a vLLM image or sglang-bf16-tp1-pp1 on an SGLang image).
  • Memory annotation: An estimated VRAM requirement per GPU, shown in brackets (for example, [requires >=18 GB/gpu]).

Memory-Based Profile Classification

NIM estimates the GPU VRAM required by each profile and classifies it into one of three categories based on the available memory on the system:

CategoryMeaningAction
CompatibleEstimated VRAM fits within available GPU memoryProfile is eligible for automatic selection. Backend startup still validates the configuration.
Low memoryThe estimated allocation fits only with a shorter context lengthNIM can attempt startup with a warning. Explicitly reduce context or choose another profile if needed.
IncompatibleThe estimated allocation exceeds available GPU memory even with a shorter context lengthMemory estimates remain advisory. Consider higher tensor parallelism or a quantized precision.

If a profile is classified as low memory, the listing output includes a suggestion. For example:

[requires >=45 GB/gpu, try --max-model-len=4096 to reduce to >=30 GB/gpu]

To apply the suggestion, pass the --max-model-len argument:

docker run --rm -it --gpus=all \
-p 8000:8000 \
${NIM_LLM_IMAGE} \
--max-model-len 4096

Reducing --max-model-len limits the maximum sequence length (input + output tokens) per request. Choose a value that fits your use case.

For single-node vLLM and SGLang GPU deployments using tensor and pipeline parallelism, NIM checks the selected profile before downloading model weights. For automatic selection, NIM_MODEL_PROFILE=default, and explicit profile selection, predicted memory shortfalls and unavailable or stale estimates produce warnings, not startup rejections. NIM attempts to download and start the selected profile without automatically reducing context length. Hardware, precision, topology, feature, and configuration validation still apply, as do download failures and backend startup errors.

A declared minimum remains a lower bound when the profile’s memory settings are unchanged. LoRA rank and pool limits do not invalidate that minimum when LoRA is disabled. NIM attempts a fresh estimate when active memory settings change. For vLLM, NIM also checks modeled managed-memory use against the resolved --gpu-memory-utilization budget. When the profile, runtime file, or user fixes utilization, NIM also compares its initial reservation against reported free memory. An explicit --kv-cache-memory-bytes allocation is checked against the estimated context requirement and available physical memory instead of utilization-based cache sizing; the initial reservation check still applies. These checks use estimates; they do not measure every allocation during backend startup. An unresolved estimate does not establish that the backend cannot run the profile. Multi-node deployments and additional data or expert parallelism topologies retain their existing memory checks.

How Profile Selection Works

NIM uses a priority-ordered selection chain to decide which profile to use. The chain is evaluated top-to-bottom; the first selector that produces a match wins.

PrioritySelectorTriggerDescription
1 (highest)Default profile selectorNIM_MODEL_PROFILE="default"Uses backend priority, with a memory-aware compatible fallback if nimlib finds no fitting default. Memory estimates remain advisory.
2Environment-based profile selectorNIM_MODEL_PROFILE=<id-or-name>Matches an explicit profile by checksum or description.
3Memory-aware profile selector(automatic)Prefers profiles estimated to fit available GPU memory, with a compatible fallback when none fit or estimates are unavailable. Prefers non-LoRA profiles unless LoRA is enabled.
4 (lowest)Manifest profile selector(no env var set)Uses profile_selection_criteria from the manifest to pick a profile automatically based on hardware compatibility (GPU device, VRAM) and parallelism settings.

The memory-aware selector estimates GPU memory requirements from model weights, KV cache, activations, and overhead. Estimates guide preference but do not exclude an otherwise compatible fallback. Hardware, feature, and parallelism constraints still determine which profiles are eligible.

Within each memory category, optimized profiles rank ahead of generic ones, so automatic selection prefers a configuration NVIDIA measured on the model. For a model-free NIM, optimized profiles are present only when the model matches an optimized configuration in the image. For how that match is made and what to do when it does not happen, refer to Optimized Profiles in Model-Free NIM.

Select a Profile

The method you use to select a profile depends on your requirements and environment. You can allow NIM to pick a compatible profile automatically, or you can specify the exact profile by ID or by description.

Automatic Selection (Default)

If you do not set NIM_MODEL_PROFILE, NIM automatically selects the best compatible profile from the manifest based on your hardware (GPU device, available VRAM, estimated memory requirements, and parallelism constraints).

To start the container with automatic profile selection, run the container without NIM_MODEL_PROFILE:

docker run --rm -it --gpus=all \
-p 8000:8000 \
${NIM_LLM_IMAGE}

Intelligent Default Selection

Setting NIM_MODEL_PROFILE to "default" triggers intelligent default selection. NIM picks the best compatible profile based on the following criteria:

  1. Hardware compatibility (GPU device and parallelism)
  2. Backend priority
  3. LoRA configuration

If nimlib finds no fitting default, NIM retries memory-aware selection with a compatible fallback. Memory estimates guide preference but do not reject that fallback.

To use intelligent default selection, set NIM_MODEL_PROFILE to "default" and start the container:

docker run --rm -it --gpus=all \
-e NIM_MODEL_PROFILE="default" \
-p 8000:8000 \
${NIM_LLM_IMAGE}

Explicit Selection by Profile ID

Specify the full 64-character profile ID from the manifest of the image you plan to deploy. This selects that exact profile without reconstructing its description. Check the ID again when changing image versions: a profile change can produce a different ID.

To select a profile by ID, set NIM_MODEL_PROFILE to the 64-character profile ID:

docker run --rm -it --gpus=all \
-e NIM_MODEL_PROFILE="70edb8bb9f8511ce2ea195e3caebcc3c7191dc27fea0c8d4acf9c0d9a69e43cd" \
-p 8000:8000 \
${NIM_LLM_IMAGE}

Explicit Selection by Profile Description (Friendly Name)

If the value of NIM_MODEL_PROFILE is not a valid Profile ID, NIM tries to match it against the profile description — a human-readable string constructed from ordered profile tags.

To select a profile by description, set NIM_MODEL_PROFILE to the profile description:

docker run --rm -it --gpus=all \
-e NIM_MODEL_PROFILE=vllm-bf16-tp1-pp1 \
-p 8000:8000 \
${NIM_LLM_IMAGE}

On an SGLang container image, use the matching sglang- profile description (or its hash) instead, for example sglang-bf16-tp1-pp1.

Use list-model-profiles to discover the exact profile IDs and descriptions available in your container.

Configuration Precedence

NIM_MODEL_PROFILE selects a model profile. The following sources override its settings, from highest to lowest priority: direct container arguments, NIM_PASSTHROUGH_ARGS, NIM environment variables that map to backend arguments, and runtime_config.json. For the complete order, refer to Advanced Configuration.

This precedence applies to optimized profiles as well. A higher-priority source overrides the corresponding setting, not the entire profile. Use this to change individual parameters in a selected optimized profile. For a model-free deployment, first identify an optimized profile in the generated manifest. If the model does not match a built-in recipe, you cannot select that recipe’s absent profiles with NIM_MODEL_PROFILE. Instead, reuse selected recipe settings on a generic profile.

For example, if a profile specifies tp=2 but the user also sets tensor parallelism to 4 (NIM_TENSOR_PARALLEL_SIZE=4, or the canonical flag --tensor-parallel-size 4), the backend launches with TP=4.

When backend arguments override profile settings, the overridden values are resolved before model download. NIM selects and downloads the profile that matches the final resolved configuration, so the downloaded model files always match the launch configuration.

Pass Backend CLI Arguments

Use NIM environment variables or canonical CLI flags for settings shared by both inference engines. NIM translates these flags into the engine’s arguments. For example, set tensor parallelism to 2 with the environment variable:

docker run --rm -it --gpus=all \
-e NIM_TENSOR_PARALLEL_SIZE=2 \
-p 8000:8000 \
${NIM_LLM_IMAGE}

Passing the canonical flag as a container argument is equivalent:

docker run --rm -it --gpus=all \
-p 8000:8000 \
${NIM_LLM_IMAGE} \
--tensor-parallel-size 2

The following settings work with both vLLM and SGLang:

SettingNIM Environment VariableCanonical Flag
Tensor parallelismNIM_TENSOR_PARALLEL_SIZE--tensor-parallel-size
Pipeline parallelismNIM_PIPELINE_PARALLEL_SIZE--pipeline-parallel-size

For LoRA configuration and profile selection, refer to Fine-Tuning with LoRA. Engine-specific arguments must match the backend in your container image.

For a Kubernetes workload, pass the arguments through the container args field. For a NIM Operator deployment that does not set spec.multiNode, use spec.args. Do not use spec.args for a multi-node NIMService; the current LeaderWorkerSet path does not propagate it to the leader or worker NIM containers. The direct-argument interfaces preserve any NIM_PASSTHROUGH_ARGS value provided by the image. For details, refer to Advanced Configuration.

Optimized Profiles in Model-Free NIM

Some model-free images include built-in tuned recipes, each defining model-matching criteria and optimized profiles. When a recipe matches the checkpoint, NIM adds its profiles to the generated manifest alongside the generic profiles. The following sections explain the matching rules, how to identify and select these profiles, and how to diagnose an unexpected mismatch.

How NIM Recognizes a Model

NIM identifies the model from the config.json file in the model source. The model name plays no part in the match: the value of NIM_MODEL_PATH, the Hugging Face repository or bucket name, and NIM_SERVED_MODEL_NAME are never compared. NIM does not read the model weights.

The checkpoint must match every field constrained by the built-in recipe. architectures is always compared.

FieldMatching Rule
architecturesThe complete list must match, including its order.
quantization_configConstrained subfields must match; quant_method is case-insensitive. An unquantized checkpoint matches only an unquantized recipe.
dtype (or torch_dtype)Model weight precision must match.
max_position_embeddingsContext length must match.
Additional fieldsAny further constraints, such as num_hidden_layers or hidden_size, must match.

Values compare as text after normalization, so quoting numeric values does not affect matching. Missing required values prevent a match. NIM resolves nested fields such as text_config and aliases defined by the model’s configuration class.

Identify Optimized and Generic Profiles

Profile names do not include the reserved nim_optimized tag. To distinguish optimized profiles from generic profiles, inspect the generated manifest rather than guessing from a name:

  1. Run list-model-profiles with your model source and credentials. The following example sets an explicit manifest path and keeps the stopped container so you can copy the file. Use an unused container name and destination filename, and include any mounts or source-specific credentials your deployment requires.

    docker run --name nim-profile-inspect --gpus=all \
    -e NIM_MODEL_PATH=hf://meta-llama/Llama-3.1-8B-Instruct \
    -e HF_TOKEN="<yourtoken>" \
    -e NIM_MANIFEST_PATH=/tmp/nim-profile-manifest.yaml \
    ${NIM_LLM_IMAGE} \
    list-model-profiles
  2. After the command succeeds, copy the generated manifest and remove the inspection container:

    docker cp nim-profile-inspect:/tmp/nim-profile-manifest.yaml ./nim-profile-manifest.yaml
    docker rm nim-profile-inspect
  3. Open nim-profile-manifest.yaml and inspect the entries under profiles. An optimized profile has tags.nim_optimized set to the string "true". Generated generic profiles do not have this tag. Match each entry’s id to the list-model-profiles output to check hardware compatibility and memory annotations. Inspect tags.nim_json_args for engine settings and tags.nim_description for a note, when present.

Pin a Matching Optimized Profile

After identifying an optimized profile that is compatible with your system, set NIM_MODEL_PROFILE to its full ID or name (the description printed by list-model-profiles). NIM tries an exact ID match first, then an exact, case-insensitive name match. If multiple profiles share a name, selection fails; use the full ID to select the intended profile. Keep the same image version and NIM_MODEL_PATH used for inspection. To pin a generic profile instead, choose an entry without the optimized marker. For the launch command, refer to NIM_MODEL_PROFILE Environment Variable.

Confirm the Selected Profile

Append --dry-run to your launch command, keeping the same image, model source, GPU allocation, mounts, and configuration overrides. In the report, compare the ID on the Selected profile: line with the entry you inspected in the generated manifest. The report also shows the resolved configuration and backend arguments, so you can check which settings an override changes. A dry run performs profile selection and model download, but does not start the inference server.

For a running container, query its metadata after the readiness endpoint returns HTTP 200:

curl -f http://localhost:8000/v1/health/ready
curl -fsS http://localhost:8000/v1/metadata

Compare the returned profile_id with the manifest entry to confirm whether the selected profile is optimized or generic. The profile_name field provides its description, not the optimized marker.

Troubleshoot Recipe Matching

When an image includes built-in recipes, NIM reports matching results at startup. Set NIM_LOG_LEVEL=INFO to include successful matches. The following log examples are illustrative; model identities and recipe paths depend on the image and checkpoint. When the model matches, NIM logs the detected identity and the recipe whose profiles it adds to the manifest:

Detected LlamaForCausalLM+bfloat16+ctx131072; applying tuned recipe /opt/nim/etc/tuned/vllm/llama-3.1-8b-instruct.yaml

When the image ships optimized configurations but none match, NIM names the closest one and the fields that differ, then serves the generic profiles:

Detected LlamaForCausalLM+float16+ctx131072; no tuned recipe baked for it under /opt/nim/etc/tuned. Closest is /opt/nim/etc/tuned/vllm/llama-3.1-8b-instruct.yaml (dtype: recipe='bfloat16' checkpoint='float16'). Serving untuned

When NIM cannot read the model’s config.json, such as when the model source is unreachable, it serves the generic profiles:

Tuned recipes are baked under /opt/nim/etc/tuned but the model at hf://my-org/my-model could not be identified; serving untuned

If the image has no built-in recipes, NIM uses generic profiles and emits no recipe-matching message at the default log level. To confirm this case, set NIM_LOG_LEVEL=DEBUG and look for:

No tuned recipes baked under /opt/nim/etc/tuned; serving untuned

A matching recipe makes optimized profiles available; it does not confirm which profile NIM selects for serving. Use the profile inspection steps above to identify optimized profiles and confirm the selected profile.

Changes from NIM LLM 1.x

The following profile selection mechanisms from NIM LLM version 1.x are no longer supported:

Removed Feature1.x Example
Custom profile selectors-e NIM_CUSTOM_SELECTOR_CLASSES="inference:MyCustomSelector"
LLM-based profile selector (backend priority chain)Automatic backend priority: TensorRT-LLM > vLLM > SGLang
Tag-based profile selector-e NIM_TAGS_SELECTOR="llm_engine=vllm,tp=1"

Use NIM_MODEL_PROFILE with a profile ID or description as a replacement for these deprecated mechanisms. For further guidance, refer to the 1.x Migration Guide.

Do not carry NIM_CUSTOM_SELECTOR_CLASSES or NIM_CUSTOM_NIM_SELECTION_CRITERIA_PROVIDER_CLASS over from a 1.x deployment. The container’s own profile selector is active without either variable. When a value is set, nimlib still validates it against the classes in the container’s inference module and never imports a module the value names. A value that is malformed, such as the dotted my_selector.MyCustomSelector form, or that names a class the module does not define stops the container from starting.

Next Steps

After you select a profile, download model artifacts and start serving: