Fine-Grained Device Assignment¶
Model implementation support
The configuration described on this page applies to the transformers (optimum) model implementation.
Overview¶
The transformers (optimum) model implementation supports assigning different sets of RBLN NPU devices to model components called submodules, such as a vision encoder or a language model. Using disjoint device sets distributes submodule memory across separate NPUs.
For tensor-level device assignment through torch.device, use the vllm model implementation.
Configure Device Assignment¶
Assign device IDs through additional_config["optimum_overrides"] in Python or --rbln-optimum-overrides on the CLI. Configure the device count and device IDs separately.
Submodule names depend on the model architecture. Use the configuration keys defined by your model's RBLN Optimum API. In the table below, <submodule> stands for one of these keys.
The Python column shows keys within additional_config.
| Setting | Python key |
|---|---|
| Top-level count | ["num_devices_per_local_rank"] |
| Top-level IDs | ["optimum_overrides"]["device"] |
| Submodule count | ["optimum_overrides"]["<submodule>"]["num_devices"] |
| Submodule IDs | ["optimum_overrides"]["<submodule>"]["device"] |
On the CLI, use --rbln-num-devices-per-local-rank for the top-level device count and --rbln-optimum-overrides for the remaining settings, passed as JSON.
- Submodules without an explicit
devicesetting use the top-leveldevicesetting. - To assign different devices to a specific submodule, set
deviceunder that submodule's configuration key. - When compiling a model, the submodule's
num_devicesis automatically set to the number of IDs in its explicitdevicelist, so it does not need to be specified separately.
For a precompiled model, pass the artifact directory as model. Only device entries in optimum_overrides apply, and each device list must match the corresponding submodule's compiled device count.
Note
On Rebel100™, one NPU card corresponds to one device, and each card contains multiple chiplets. Although num_devices_per_local_rank can only be set to 1, the compiler automatically uses the multiple chiplets within that device. See Model Parallelism for the device-count rules.
For model loading or device memory issues, see Troubleshooting Multi-Module Models.
Example¶
Qwen3-VL consists of a vision encoder and a language model. The vision encoder has the configuration key visual. In this model, the top-level device applies to the language model, and visual.device applies to the vision encoder.
The following examples use 16 ATOM™ devices, with the language model on devices 0–7 and the vision encoder on devices 8–15. In this example, num_devices_per_local_rank=8 sets the language model's device count, while visual.num_devices=8 sets the vision encoder's device count. visual.num_devices is specified explicitly here to make the device count clear. Run rbln-smi to check the devices available on your system.
Compiling and Serving a Model¶
The following example specifies a model ID and assigns different device sets to the language model and vision encoder.
The following command starts the OpenAI-compatible server with the same configuration.
Serving a Precompiled Model¶
The following example uses a model compiled and saved separately from the example above. It assumes that both the language model and visual were compiled with num_devices=8, and the artifacts were saved in rbln-Qwen3-VL-2B-Instruct.