Qwen2-VL-2B on RK3588: A Practical Deployment Log9 min read1,707 words

Qwen2-VL-2B on RK3588: A Practical Deployment Log

See how Qwen2-VL-2B’s vision tower was exported to ONNX and RKNN, then measured on an RK3588—with version pitfalls, runtime results, and limits explained.

Qwen2-VL-2B RK3588RKNN deploymentQwen2-VL vision towerONNX model conversionedge AI inference
Qwen2-VL-2B on RK3588: A Practical Deployment Log

Getting Qwen2-VL-2B's Vision Tower Running on an RK3588

Sometimes the export breaks before you even touch the RK3588. In this case, Qwen2-VL-2B's vision tower wouldn't export with the Transformers version used by Rockchip's official multimodal demo. After figuring out the API mismatch and pinning a compatible version, the tower ran on a real RK3588 board: encoding a 392 × 392 image took a median of 4,445.68 ms across three independent processes.

That number is helpful, but it's also easy to read too much into it. It measures the vision tower, not the full vision-language model - and it's based on only three runs. The point of this write-up is the whole chain: what dependency failed, why a quick compatibility shim wasn't the right fix, what the ONNX-to-RKNN conversion produced, and what the on-device measurement actually proves. This is a deployment log, not an end-to-end performance claim.

Why did the official export fail?

The first failure wasn't caused by the RK3588. The export script died before it produced a usable model for the board. The immediate reason was an API mismatch: the script expected a Transformers API that had shifted between library versions.

Rockchip's official RKLLM multimodal demo ships an export script built for an older model layout. It checks for model.visual and passes a rotary_pos_emb argument into each vision block. In practice, those assumptions didn't line up cleanly with the Transformers releases used during testing.

The version mismatch was an API contract problem

With Transformers 5.8.0, the script failed with an AttributeError: the vision component wasn't at model.visual anymore - it had moved under model.model.visual. You could paper over the missing attribute with an alias, but that didn't solve the next issue.

Transformers 4.57.0 failed differently. Its VisionAttention code unconditionally unpacked position_embeddings. When that value ended up as None, the export crashed with a TypeError. The older export path relied on the attention implementation to work out embeddings from rotary_pos_emb, but that fallback behavior wasn't there anymore.

The Transformers version that matched the export script's expectations was Transformers 4.51.3. It kept the self.visual structure and, when position_embeddings was missing, derived what it needed from rotary_pos_emb. That behavior was removed later in 4.54.

Why pinning beat a compatibility shim

A shim can be fine when it adapts a well-understood interface - and when you've tested that it doesn't change behavior. Here, the alias would've addressed the first error only. It wouldn't fix the deeper mismatch in the attention contract. If you patch one failure and leave the model semantics changed underneath, you can end up with "working" artifacts whose outputs aren't what you think you measured.

For an inference benchmark, that's a bad trade. Pinning Transformers 4.51.3 was the smaller change with a clearer justification: use the version whose implementation actually matches what the export script assumes.

There was also a clue that the demo repo had drifted internally. The quantization and embeddings script expected the newer 5.x structure, including model.model.language_model, while the vision export worked with the older 4.x structure. Different parts of the same demo had been written against different library contracts. Running the scripts exposed that mismatch, and reading their assumptions made it make sense.

How did the vision tower get from ONNX to RKNN?

This worked through three stages: export the vision model to ONNX, convert it with RKNN-Toolkit2, then run it on the RK3588. Each stage produces something you can check on its own. That separation matters - if the board run fails, you want to know whether the problem is export, conversion, or execution.

Stage 1: export to ONNX

The vision export used Transformers 4.51.3 and PyTorch 2.6.0. The ONNX output was 53 MB, with a 2.66 GB data file alongside it. The ONNX checker passed, which at least confirms the exported graph is structurally valid and readable.

Passing the checker doesn't mean the numbers match the original model. It just means the export is internally consistent enough to move forward. For a careful deployment, each boundary deserves its own validation, instead of treating a final "it built" result as proof everything before it was correct.

Stage 2: build the RKNN model

RKNN-Toolkit2 converted the ONNX export into a 1.44 GB RKNN model. The build log included 11 lines marked E RKNN, including REGTASK bit-width warnings and two messages about an unknown operation target of 0. Even with that, the build finished with rknn building done.

A noisy build log is a sign to investigate - it's not automatically a verdict. The real follow-up is to run the generated model on the target board and check runtime behavior. In this test, those warnings didn't show up again as runtime errors on the RK3588. That doesn't make the warnings "irrelevant"; it just means they didn't block this particular artifact from running.

Stage 3: run on the board

The board test used an RK3588 with three cores. Input came from demo.jpg, shaped [1, 392, 392, 3] in NHWC order and FP16. The vision tower output was FP16 with shape [196, 1536].

Three independent processes reported encoding times of 4,442.44 ms, 4,445.68 ms, and 4,488.95 ms. The median was 4,445.68 ms. Model load time had a median of about 7.3 seconds. Most importantly for this run: runtime logs showed zero E RKNN lines.

These are concrete deployment facts (input, output, precision, board setup, and measured timings). They're still not a substitute for broader benchmarking with more samples, more input variation, and an actual end-to-end application workload.

What does the 4.45-second result actually mean?

This measurement means the vision tower ran on the RK3588 and encoded one 392 × 392 image in about 4.45 seconds in the stated test setup. Across three processes, the times stayed within roughly 1% of the median. That's enough to treat it as a repeatable initial measurement, not just a one-off.

It does not mean the full Qwen2-VL-2B system can answer a question in 4.45 seconds on this board. The test covers image encoding only. The language-model side - which consumes the visual output and generates the response - was not exported to RKLLM yet. The GPU machine needed for that export went offline mid-download, so there wasn't a full-model artifact available for an end-to-end check.

Why the distinction matters

A vision-language model is a pipeline, not a single operation. When a user asks a question about an image, the vision tower is only the first chunk. The language side still has to turn the visual representation into tokens. Without timing data for that stage, there's no defensible end-to-end latency number - and no basis to claim the whole model is running on-device at a particular speed.

This is where deployment headlines can get ahead of the evidence. Saying the vision tower runs on-device is fair. Saying the whole VLM runs (or that users can get answers in X seconds) needs the missing language-model stage and a complete application-level measurement.

What should the next test include?

The next step is planned as a 24-question run: the demo's 20 MMBench questions plus four additional questions in Chinese. Once the language-model export is available, that test can evaluate the full path instead of just image encoding.

An end-to-end report should spell out the workload and conditions. At minimum: whether timings include model loading, how many prompts were tested, the language and image characteristics, and whether you evaluated correctness as well as speed. Latency alone doesn't tell you whether the model is useful for the task.

For now, the cleanest conclusion is narrower: the vision tower runs on-device, the runtime is repeatable across the three reported processes, and the conversion chain progressed from export failure to a working board test. It's a milestone - but it's only one stage of the overall deployment.

Key takeaways

  • Pin the library version that matches the exporter's assumptions before adding compatibility patches.
  • Validate each conversion stage separately; a successful build doesn't erase warnings or prove model equivalence.
  • Report the exact component measured. Vision-tower latency isn't end-to-end VLM latency.
  • Treat three runs as an initial reproducibility check, not a comprehensive performance benchmark.

Conclusion

The practical takeaway is straightforward: when a vendor demo and a machine-learning library disagree, start by identifying the exact API contract the exporter expects. In this case, pinning to Transformers 4.51.3 got the vision export working. A superficial shim could have cleared one error while leaving another in place - and that would've made later measurements less trustworthy.

The 4.45-second result is a useful fact about the vision tower. It shows that Qwen2-VL-2B's vision tower can run on an RK3588 with repeatable initial timing and no runtime RKNN errors in this test. The language-model stage and a full question-answering benchmark are still needed before calling the complete VLM "deployed."

Frequently Asked Questions

Transformers 4.51.3 worked with the vision export script. It retained the expected self.visual structure and could derive position embeddings from rotary_pos_emb when position_embeddings was None. The behavior needed by the script was removed in version 4.54.
The median was 4,445.68 ms for a 392 × 392 image, measured across three independent processes on an RK3588 using three cores. The individual times were 4,442.44, 4,445.68, and 4,488.95 ms. This is vision-tower time only.
No. The vision tower ran on the board, but the language-model export to RKLLM was still pending. Without that component, the test cannot establish full question-answering performance or end-to-end response time.
Not in this run. The build log contained 11 E RKNN lines, but the model build completed and the board run produced zero E RKNN lines at runtime. The warnings still deserve investigation; successful execution only shows they did not block this tested configuration.

Related articles