Advanced Configuration
NIM LLM uses a layered configuration system that resolves values from multiple sources — CLI arguments, environment variables, runtime config files, and model profile tags — with well-defined priorities and provenance tracking. This page describes how the configuration system works and how to use it for advanced deployment scenarios.
For basic configuration such as model path, cache, and logging, refer to Environment Variables. For vLLM-specific CLI arguments, refer to the vLLM CLI documentation.
Configuration Priority
Configuration values are resolved from multiple sources with the following priority (highest to lowest):
Higher-priority sources overwrite lower-priority sources. If the same parameter is set in multiple sources, the highest-priority value wins.
The exception is JSON-object values, which compose across sources instead of replacing each other. When two sources set the same argument to a JSON object — for example, --compilation-config in runtime_config.json and on the command line — NIM unpacks both objects and merges them recursively. The higher-priority source wins for any key that both objects set; keys that only one source sets always survive. In strict mode, a key set to differing values by both sources is a fatal conflict, while disjoint composition is allowed.
Configuration Sources
NIM resolves configuration values from the following sources.
CLI Arguments
Command line arguments passed to the container after nim-serve use the vLLM CLI argument format:
vLLM uses Python’s argparse.BooleanOptionalAction for boolean flags:
--enable-prefix-cachingsets the value toTrue--no-enable-prefix-cachingsets the value toFalse
If both NIM_PASSTHROUGH_ARGS and direct CLI arguments set the same parameter, the direct CLI argument takes precedence. If there are duplicate or contradictory CLI arguments (e.g., --enable-xyz followed by --no-enable-xyz), the last one wins.
Passthrough Arguments (NIM_PASSTHROUGH_ARGS)
For environments where direct CLI arguments are not available, such as container orchestrators like Kubernetes, use NIM_PASSTHROUGH_ARGS to pass CLI-style arguments through an environment variable:
Passthrough arguments support all vLLM CLI arguments, boolean flags, and shell-style quoting using shlex.split().
For example, in Kubernetes:
To pass JSON values through NIM_PASSTHROUGH_ARGS, use a command such as the following:
NIM Environment Variables
NIM defines a small set of environment variables that map to vLLM arguments. These provide a stable, NIM-specific interface for the most commonly used parameters:
For any vLLM argument that does not have a dedicated NIM environment variable, use NIM_PASSTHROUGH_ARGS.
When the SGLang backend is in use, the same NIM environment variables map to SGLang’s CLI flags:
Runtime Config
You can place a runtime_config.json file in the model workspace directory. NIM reads it automatically if it is present:
Unknown keys are passed through to vLLM as-is.
Embedded Passthrough Arguments
The file also accepts a reserved NIM_PASSTHROUGH_ARGS key that holds a full
CLI-style string. The string is parsed with the same rules as the
NIM_PASSTHROUGH_ARGS environment variable: known arguments receive their
registered types, boolean flags accept the --flag and --no-flag forms, and
denied arguments are dropped with a warning.
The embedded string and the flat keys resolve at the same runtime-config priority. Two rules govern how the two in-file forms interact:
- Explicit keys win. If the same file sets a parameter both inside the embedded string and as a flat key, the flat key takes precedence.
- Strictness differs by form. When strict passthrough parsing is active (NIM can build the backend’s known-argument list), an unrecognized flag inside the embedded string is a fatal error, matching how the backend treats its own command line. If known-argument parsing is unavailable — the backend is not installed, or its parser cannot be constructed in the environment — unrecognized flags are instead retained leniently for passthrough. An unknown flat key is always retained and passed through to the backend.
To negate a boolean argument with a flat key, set "flag": false or use the
equivalent "no-flag": true form. For arguments the backend registers with
negative spellings (vLLM), both resolve to the --no-flag command-line form.
SGLang has no --no-* spellings, so a false value for an argument outside
the NIM parameter registry results in the flag being omitted.
Profile Tags
Model profiles include metadata tags that configure parallelism. These values are extracted automatically when a profile is selected:
For example, a profile named vllm-fp8-tp2-pp1 sets tensor_parallel_size=2 and pipeline_parallel_size=1 at profile priority.
NIM Defaults
The following default values are applied only if no other source sets the field:
Override Warnings and Strict Mode
NIM reports configuration overrides with warnings, and strict mode changes that behavior.
Override Detection
When a higher-priority source overwrites a value from a lower-priority source, NIM logs a warning:
Strict Mode
Set NIM_STRICT_ARG_PROCESSING=true to treat override warnings as errors:
In strict mode, the container exits with an error if any configuration override is detected between non-default sources. This setting is useful in the following cases:
- CI/CD pipelines, where you want to catch configuration conflicts.
- Production deployments, where configuration should be deterministic.
Example:
Result:
Dry Run
Use --dry-run with nim-serve to print the fully resolved configuration and the resulting vLLM arguments without starting the server:
This prints the resolved configuration with provenance for each parameter, showing which source provided each value.
Denied Arguments
Certain vLLM CLI arguments are blocked in NIM containers because the nginx proxy or other system components manage them. If you pass a denied argument, NIM logs a warning and ignores it.
Validation and Error Handling
NIM validates configuration at multiple stages and handles errors differently depending on where validation occurs.
Where Validation Occurs
Invalid Parameter Handling
- Invalid NIM parameters: Logged as warnings; the container continues with the remaining valid values.
- Unknown parameters: Passed through to vLLM as-is. vLLM handles its own validation.
- Invalid vLLM parameters: vLLM validates and reports errors at startup.
Example Error Messages
The following examples show representative error messages:
Provenance Tracking
NIM tracks the source of every configuration parameter. At startup, a structured config_resolved JSON event is emitted showing the provenance of each resolved value:
When a value is overridden, the previous value and source are also recorded:
Use nim-serve --dry-run to inspect the full provenance report without starting the server.
GPU Memory Management
NIM includes automatic GPU memory management to prevent out-of-memory (OOM) failures on constrained hardware. This process uses two mechanisms: automatic clamping of gpu_memory_utilization and a post-selection memory warning.
Automatic GPU Memory Clamping
On certain hardware configurations, NIM automatically reduces the gpu_memory_utilization parameter, which controls what fraction of GPU memory vLLM can use, to prevent OOM errors:
The clamped value is applied at a low internal priority, so any explicit setting from environment variables, CLI arguments, or --gpu-memory-utilization takes precedence automatically. The minimum floor is 0.10 (NIM never sets GPU memory utilization below 10%).
Post-Selection Memory Warning
After selecting a profile and resolving all configuration, NIM estimates the total VRAM required for the model (weights, KV cache, activations, and overhead) and compares it to available GPU memory. If the estimate exceeds available memory, NIM logs an advisory warning:
This warning is advisory only. NIM proceeds with startup regardless. The suggested --max-model-len value, if provided, indicates a context length that would fit within available memory.
To apply the suggestion, pass --max-model-len as a CLI argument:
SSL/TLS Configuration
NIM terminates TLS at the nginx proxy layer. Native vLLM SSL arguments such as --ssl-keyfile and --ssl-certfile are denied. Use the NIM SSL variables instead. Refer to Architecture for more information about the proxy layer.
Use one of the following NIM_SSL_MODE values to enable SSL:
- TLS mode: Server presents a certificate; client certificate is not required. To activate, set
NIM_SSL_MODE=TLS. RequiresNIM_SSL_CERTS_PATHandNIM_SSL_KEY_PATH. - Mutual TLS mode: Both server and client present certificates. To activate, set
NIM_SSL_MODE=MTLS. RequiresNIM_SSL_CERTS_PATH,NIM_SSL_KEY_PATH, andNIM_SSL_CA_CERTS_PATH.
The following example configures NIM to use TLS mode:
CORS Configuration
CORS is handled by the nginx proxy. The following variables control CORS headers:
vLLM’s --allowed-origins, --allowed-methods, and --allowed-headers arguments are denied in NIM because CORS is managed at the nginx layer. Use the NIM_CORS_* environment variables instead.
Examples
The following examples show how configuration precedence, override warnings, and passthrough arguments work in practice.
CLI Overrides an Environment Variable
The following example shows how a direct CLI argument overrides an environment variable:
This resolves tensor_parallel_size to 4, because the CLI value overrides the environment variable value.
NIM logs the following warning:
Full Priority Chain
The following example shows how tensor_parallel_size resolves when every source sets a value:
The resolved values are:
tensor_parallel_size = 4(CLI overrides passthrough overrides env overrides runtime)enable_prefix_caching = False(CLI--no-overrides runtimetrue)
Kubernetes with Passthrough Args
The following Kubernetes example passes vLLM arguments through NIM_PASSTHROUGH_ARGS:
Enabling TLS
The following example enables TLS for a container deployment:
After the container starts, you can validate the TLS configuration with a command such as the following: