Skip to main content
Associate
Oct 17, 2026 1:07 PM UTC
Question

STM32N6570-DK Neural-ART: transformer encoder output is wrong (planner aliases a Concat onto its input) and encode is slow

Setup
- Board: STM32N6570-DK, Neural-ART NPU, dev boot.
- Tool: ST Edge AI Core 4.0.1 (target stm32n6), ll_aton 1.1.3.275 / NetworkRuntime1201_CM55_GCC.a.
- Model: ViT-style autoencoder encoder. Input 1×3×256×256 RGB, output INT8 [128,12] → 128 LE-uint16 tokens (256 B). Weights in xSPI2 NOR @ 0x70380000.
Problem 1 — wrong latent (NPU)
The board latent doesn't match ONNX Runtime on the compiled graph (0/128 tokens). Epoch tracing shows input, weights and the first conv are correct, but the first Concat output is placed by the planner on top of one of its inputs:
input1  [1,256,512] @0x34310000
output  [1,257,512] @0x34310000   (starts where input1 starts)
LL_ATON_LIB_Concat copies inputs in order with forward memcpy, so it corrupts the tensor (every row becomes the class token). I added an overlap-safe copy as a local patch; that fixes the Concat, but a second fault remains in epochs 8..72 (first LayerNorm / start of the first attention block) → latent still wrong.
Problem 2 — speed
One encode is ~36 s on Neural-ART (942 epochs, 548 pure software on the M55), and minutes on a CPU-only variant.

2 replies

Julian E.
ST Technical Moderator
Oct 21, 2026 2:21 AM UTC

Hi ​@Adevil9504,

 

The current NPU is mainly made to compute convolutions.

Today, the support of Transformer is not that good, it depends a lot on what is being done.

 

Could you please share a model for us to look at this issue?

(you need to put it in a .zip to attach it to community)

 

Have a good day,

Julian

​In order to give better visibility on the answered topics, please click on 'Accept as Solution' on the reply which solved your issue or answered your question.
Associate
Oct 26, 2026 6:41 AM UTC

Hi Julian,

Thank you for your response.

I am looking for an ONNX model that can encode/compress an input image into a 128-byte representation using the STM32N6570-DK board and its NPU.

My goal is to use STM32 AI tools to analyze and generate the corresponding network.c and related files so that I can integrate the model into my firmware and perform image encoding on the board.

Could you please suggest a suitable ONNX model or guide me on how to develop a custom model that can achieve this? I would also appreciate your recommendations regarding NPU-supported operations and the best approach for deploying this solution on the STM32N6.

I can share my current model and project files in a ZIP archive if needed.

Thank you for your support.

Best regards,
Aditya Chauhan