Quick Start¶
The RBLN SDK enables developers to run deep learning models efficiently on the RBLN Neural Processing Unit (NPU). This guide walks you through the complete workflow—from setup to inference—using practical examples with PyTorch and HuggingFace models.
The RBLN SDK is a single SDK for every RBLN NPU product line: Rebel100™ and ATOM™ install the same packages at the same versions, so setup and installation are common to both. Only compilation and inference differ by product line. Follow these steps:
1. Setup & Installation¶
System Requirements¶
- Ubuntu 22.04 LTS (Debian bullseye) or higher
- Python: 3.10–3.14
- A system equipped with an RBLN NPU
- RBLN Driver
This tutorial assumes that the above system requirements have been met. To check the RBLN Driver installation and the presence of the RBLN NPU, use the rbln-smi CLI as follows:
$ rbln-smi
+-------------------------------------------------------------------------------------------------+
| Device Information KMD ver: X.X.XX |
+-----+-----------+---------+---------------+------+---------+------+---------------------+-------+
| NPU | Name | Device | PCI BUS ID | Temp | Power | Perf | Memory(used/total) | Util |
+-----+-----------+---------+---------------+------+---------+------+---------------------+-------+
| 0 | RBLN-CA25 | rbln0 | 0000:05:00.0 | 37C | 54.7W | P14 | 0.0B / 15.7GiB | 0.0 |
| 1 | | rbln1 | 0000:06:00.0 | 34C | | P14 | 0.0B / 15.7GiB | 0.0 |
| 2 | | rbln2 | 0000:07:00.0 | 28C | | P14 | 0.0B / 15.7GiB | 0.0 |
| 3 | | rbln3 | 0000:08:00.0 | 26C | | P14 | 0.0B / 15.7GiB | 0.0 |
+-----+-----------+---------+---------------+------+---------+------+---------------------+-------+
+-------------------------------------------------------------------------------------------------+
| Context Information |
+-----+---------------------+--------------+-----+----------+------+---------------------+--------+
| NPU | Process | PID | CTX | Priority | PTID | Memalloc | Status |
+-----+---------------------+--------------+-----+----------+------+---------------------+--------+
| N/A | N/A | N/A | N/A | N/A | N/A | N/A | N/A |
+-----+---------------------+--------------+-----+----------+------+---------------------+--------+
Install the RBLN SDK¶
The RBLN SDK is distributed as .whl packages. Installing rebel-compiler requires an RBLN Portal account.
Note
The command above installs vllm-rbln and also installs optimum-rbln, so RBLN Optimum is ready to use in the same step.
2. Compilation and Inference¶
The RBLN SDK runs models built with frameworks such as tensorflow, torch, transformers, and diffusers. The available options differ by product line. Choose the tab for your product line, then choose the option that matches your model and follow only its steps. Each option runs from start to finish on its own.
| Option | Model | SDK component |
|---|---|---|
| Option 1: vLLM Model | Large language model served through an OpenAI-compatible API | • RBLN Compiler (rebel-compiler)• RBLN vLLM ( vllm-rbln) |
| Option 2: HuggingFace Model | transformers model | • RBLN Compiler (rebel-compiler)• RBLN Optimum ( optimum-rbln) |
| Option 3: Custom PyTorch / TensorFlow Model | Custom PyTorch or TensorFlow model | • RBLN Compiler (rebel-compiler) |
Option 1: vLLM Model¶
Large language models can be deployed with RBLN vLLM (vllm-rbln), installed in Install the RBLN SDK. To run a model, pass its HuggingFace model ID to vllm serve. RBLN vLLM compiles the model for the RBLN NPU the first time the server starts, then serves it through the vLLM OpenAI-compatible API.
1. Start the Server¶
The example below serves the Mixture-of-Experts (MoE) model openai/gpt-oss-120b on a single Rebel100™ device (RBLN-CR13). --data-parallel-size 1 runs the model on a single RBLN NPU. --model-impl vllm loads the model through the vLLM-native model path:
The values of --data-parallel-size, --quantization, --max-model-len, --block-size, and --max-num-seqs above are fixed in the compiled model and cannot be changed afterward; changing any of them recompiles the model on the next start. RBLN vLLM caches the compiled model, so a later start with the same values reuses it. For more details, refer to Compile Cache. The gpt-oss-120b recipe covers this model's configuration in detail. vLLM Recipes lists recipes for more models.
2. Send a Request¶
Once the server is ready, send requests to the vLLM OpenAI-compatible API. The model field matches the --served-model-name value:
Option 2: HuggingFace Model¶
Models built with HuggingFace libraries like transformers are compiled and run with optimum-rbln, an RBLN-optimized extension of HuggingFace APIs.
1. Compile the Model¶
The example below compiles the meta-llama/Llama-3.2-3B-Instruct model for a single Rebel100™ device using RBLNAutoModelForCausalLM, which adapts HuggingFace causal language models for the RBLN NPU. You do not need to construct or import the model separately. Pass the HuggingFace model ID and export=True to the RBLN Optimum from_pretrained() method, which loads and compiles the model in one step:
2. Run Inference¶
Inference uses the same RBLNAutoModelForCausalLM class. Unlike compilation in the previous step, set export=False and use the local path of the compiled model:
Beyond this example, RBLN Model Zoo provides examples for more models.
Option 3: Custom PyTorch / TensorFlow Model¶
Custom models, such as PyTorch or TensorFlow models, are compiled with rebel-compiler and run with its rebel.Runtime() API.
1. Construct or Import a Model¶
The example below defines a simple PyTorch model:
2. Compile the Model¶
rebel-compiler converts the model into an RBLN NPU-compatible format. For PyTorch models, like the SimpleConvBNRelu in the example below, use the rebel.compile_from_torch() function:
PyTorch models can also be compiled with torch.compile() and the rbln backend. This path needs no .rbln file and no rebel.Runtime() step below. Calling the compiled model compiles it for the RBLN NPU and runs it:
- First call: compiles the model and saves it to
cache_dir. Ifcache_diralready holds a compiled model with the same weights and input shape, the first call loads it instead of compiling.torch.manual_seed(0)keeps the example's random weights the same across runs, so the second run of the script hits the cache. - Later calls: take the warm path. A call with the same input shape runs the compiled model on the RBLN NPU without compiling again.
"mode": "strict" raises an error when the rbln backend fails to compile the graph. Without it, torch.compile() falls back to eager execution on the CPU and only logs a warning. For all options, refer to the torch.compile API.
3. Run Inference¶
Load the compiled model with the rebel.Runtime() API and run it on the RBLN NPU:
| Option | Model | SDK component |
|---|---|---|
| Option 1: vLLM Model | Large language model served through an OpenAI-compatible API | • RBLN Compiler (rebel-compiler)• RBLN vLLM ( vllm-rbln) |
| Option 2: HuggingFace Model | transformers or diffusers model | • RBLN Compiler (rebel-compiler)• RBLN Optimum ( optimum-rbln) |
| Option 3: Custom PyTorch / TensorFlow Model | Custom PyTorch or TensorFlow model | • RBLN Compiler (rebel-compiler) |
Option 1: vLLM Model¶
Large language models can be deployed with RBLN vLLM (vllm-rbln), installed in Install the RBLN SDK. To run a model, pass its HuggingFace model ID to vllm serve. RBLN vLLM compiles the model for the RBLN NPU the first time the server starts, then serves it through the vLLM OpenAI-compatible API.
1. Start the Server¶
The example below serves the dense model Qwen/Qwen3-0.6B on a single ATOM™ device (RBLN-CA22 or RBLN-CA25). --rbln-num-devices-per-local-rank sets how many NPUs the model is partitioned across with tensor parallelism:
On ATOM™, vllm serve runs the model through the transformers (optimum) model implementation, not the vllm implementation. For more details, refer to the transformers (optimum) section of the RBLN vLLM documentation.
The values of --rbln-num-devices-per-local-rank, --max-model-len, --block-size, and --max-num-seqs above are fixed in the compiled model and cannot be changed afterward; changing any of them recompiles the model on the next start. RBLN vLLM caches the compiled model, so a later start with the same values reuses it. For more details, refer to Compile Cache. The Qwen3-0.6B recipe covers this model's configuration in detail. vLLM Recipes lists recipes for more models.
2. Send a Request¶
Once the server is ready, send requests to the vLLM OpenAI-compatible API. The model field matches the --served-model-name value:
Option 2: HuggingFace Model¶
Models built with HuggingFace libraries like transformers or diffusers are compiled and run with optimum-rbln, an RBLN-optimized extension of HuggingFace APIs.
1. Compile the Model¶
The example below compiles the stabilityai/sdxl-turbo model using RBLNAutoPipelineForText2Image, which adapts HuggingFace text-to-image pipelines for the RBLN NPU. You do not need to construct or import the model separately. Pass the HuggingFace model ID and export=True to the RBLN Optimum from_pretrained() method, which loads and compiles the model in one step:
2. Run Inference¶
Inference uses the same RBLNAutoPipelineForText2Image class. Unlike compilation in the previous step, set export=False and use the local path of the compiled model:
Beyond this example, RBLN Model Zoo provides examples for more models.
Option 3: Custom PyTorch / TensorFlow Model¶
Custom models, such as PyTorch or TensorFlow models, are compiled with rebel-compiler and run with its rebel.Runtime() API.
1. Construct or Import a Model¶
The example below defines a simple PyTorch model:
2. Compile the Model¶
rebel-compiler converts the model into an RBLN NPU-compatible format. For PyTorch models, like the SimpleConvBNRelu in the example below, use the rebel.compile_from_torch() function:
PyTorch models can also be compiled with torch.compile() and the rbln backend. This path needs no .rbln file and no rebel.Runtime() step below. Calling the compiled model compiles it for the RBLN NPU and runs it:
- First call: compiles the model and saves it to
cache_dir. Ifcache_diralready holds a compiled model with the same weights and input shape, the first call loads it instead of compiling.torch.manual_seed(0)keeps the example's random weights the same across runs, so the second run of the script hits the cache. - Later calls: take the warm path. A call with the same input shape runs the compiled model on the RBLN NPU without compiling again.
"mode": "strict" raises an error when the rbln backend fails to compile the graph. Without it, torch.compile() falls back to eager execution on the CPU and only logs a warning. For all options, refer to the torch.compile API.
3. Run Inference¶
Load the compiled model with the rebel.Runtime() API and run it on the RBLN NPU:
Model Serving Frameworks¶
The model in Option 1 is already served with RBLN vLLM. To deploy the models compiled in Option 2 and Option 3 in production environments, use one of the following model serving frameworks with the RBLN NPU. Consult the linked documentation for detailed setup and configuration:
- RBLN vLLM – a high-performance inference engine for large language models (refer to RBLN vLLM Documentation)
- NVIDIA Triton Inference Server – a multi-model, multi-framework inference engine (refer to NVIDIA Triton Inference Server Documentation)
- TorchServe – a framework for building, shipping, and running production-ready PyTorch models (refer to TorchServe Documentation)