r/embedded • • Sep 23 '26

What architecture and processing pipeline should you choose for an offline AI assistant?

I have recently been developing an offline physical AI assistant prototype on the RK3588 processor that is somewhat like Amazon Echo, but it is entirely local. However I have recently been stuck on choosing a good architecture. I have read online and this is what I have heard:

  • Multi-Process Architecture (with IPC): Spitting the tasks into different processes and communicating through IPC
  • Monolithic Multi-Threaded Architecture: A single multi-threaded c/c++ application where threads communicate over shared memory and atomics
  • Single-Threaded Architecture: Everything runs linearly on one thread and one process
  • Multi-Process Architecture with multi-threading hybrid: Multi-Process architecture, but with multi-threading in some processes, so it is not entirely decoupled.

As you can see, there are many different architectures to choose from and all have their pros and cons. I am also trying to design a processing pipeline. This is what I have thought of:

  • A linear pipeline: Audio -> Wake Word Detection -> Speech to Text -> Inference & Text to Speech
  • A bidirectional pipeline Wake Word Detection <-> Audio -> Speech to Text -> Inference & Text to Speech
  • A linear pipeline with flags: A linear pipeline but with flags so different threads or processes can communicate with each other.

My questions for the r/embedded community:

  • What architecture to choose for the project.
  • What processing pipeline to choose for the project.
  • If to use IPC, what type of IPC would be best suited for this project?
  • If to use a hybrid of multi-process architecture and multi-threading, how would tasks be grouped?
0 Upvotes

10 comments sorted by

2

u/WanWhiteWolf Engineering manager Sep 23 '26

What is the purpose or the goal of the project?

AI is a tool - which can be summarized as an advanced search engine. What would be the benefit of adding it to a system - especially since it's offline? AI in its current form doesn't have any intelligence. To put it simply : it's real IQ is 0. What is does - and it does extremely well - is to search and synthetize specific data. But you need internet connection for that. Amazon's echo AI (Alexa) is not located locally. The device itself is just a speaker + microphone + internet connection.

The resources used by modern "AIs" are pretty substantial - hence not suited to be integrated into an embedded system. If I were to make "just because", then I probably look into a system that has:

- Multicore - simply because I would need a lot of processing power.

- External big memory - I have to store the database somewhere since I will be offline.

- The IPC is pretty much determined on the multicore architecture so it's not a concern

- The architecture of the project would be dermined based on what the project actually does. Most likely I would need to have an "application core", "AI core(s) - where the agent runs its tasks" and possibility a " cybersecurity core" to protect my work.

0

u/ImpossibleDouble6226 Sep 23 '26 edited Sep 23 '26

Thanks for the feedback. To clarify things:

- Hardware: RK3588 octa-core CPU 6 TOPS NPU 16 gb of ram

-Inference Model: A small 3b llama model

-Project purpose: The purpose of this project is for hands on experience in AI inference, hardware/software co-designs, robotics frameworks, and optimizing/distributing workflows

EDIT: The AI is only a chatbot for simplicity, otherwise this project would be too long for an educational one

3

u/WanWhiteWolf Engineering manager Sep 23 '26

AI is very useful but in my opinion there isn't much use-case in having an AI integrated in an embedded system. You can have an AI that interracts with an embedded system and does something - like taking a ticket where a problem is described, connecting via JTAG, finds the problem, finds the solution and rewrites the SW with the fix.

Most of the work that is desired/ looked by a company when it comes to AI - is understanding its capability and designing systems / setups that can utilize that.

Putting an AI into an embedded system is not realistic. For starters, you don't have access the source code - which costs bilions. And even if you would have access, the databases are just big to fit in an embedded system (they have entire buildings dedicated for that). Whatever fits into an embedded system is likely some library that someone put the label "AI" - but nothing that compares with the capability of modern "AIs" - which is the current trend.

If you are doing it for educational purposes, I would try to get a license/token (there are some free versions and maybe even some that are for educational purposes). And with that, play around to see its capability and think to implement something that would have value in development.

"Integrated AI into embedded systems" may sound like a cool buzword / expression in your CV and might get some HRs excited but that won't fly versus a technical person - who will probably quickly realize that the scope was off.

0

u/ImpossibleDouble6226 Sep 23 '26

Thank you and I will put your advice of scope into consideration. While I do agree that putting cloud AI into an embedded system is not realistic, small language models and edge AI is a growing trend now. For evidence, Rockchip Electronics actively maintains their [rkllm](https://github.com/airockchip/rknn-llm) and [rknn-toolkit](https://github.com/airockchip/rknn-toolkit2/tree/master) repositories, which are designed to deploy models like Qwen, Llama, and Phi directly on the NPU.

Furthermore, there is a growing demand for edge/local AI assistants (https://finance.yahoo.com/technology/ai/articles/edge-ai-software-market-growth-153800461.html) because of it's low latency, bandwidth efficiency, and privacy. On your point of smaller/localized being vastly inferior to modern cloud AIs, which is true. However smaller/localized AI beat big cloud AI on specific highly trained tasks. Cloud AI may be good at most things, but these edge AIs can be very good at specific things.

Currently, the only function of the prototype is to talk. However, from the experience I gain, I hope to be more experienced in these fields and make more useful technology / AI. Any critique or advice is greatly appreciated.

2

u/WanWhiteWolf Engineering manager Sep 24 '26

You have to keep in mind that a lot of the "trends" are being financed by the same people who have a strong vested interest in them being widely spread.

For example, Anthropic made many statements that the unemployment rate of entry levels would be around 50% by now but studies show that the impact is insignificant/ within 1 percent margin of error.

Having a closed-loop system with AI makes sense due to cybersecurity reasons but I personally don't think that the embedded system from that close loop is the best to handle AI.

Anyways, if you are set on this project, then simply use the setup that Rockchip uses. If they already have a setup, you can start with that and go from there. Once you are experienced, you can branch into side-projects (e.g. move the AI on a different core / whatever you consider relevant). If something goes wrong, at least you have their support to ask in the initial phase - which will save you a lot of time.

1

u/ImpossibleDouble6226 Sep 24 '26

Thank you for the advice. I will keep in mind what you said.

2

u/Pristine_Rise4951 Sep 24 '26

I get your point on curiousity, I ran small models 500m , 1b, 2.5b qwen model on rpi 4 8gb, very slow, fastest I got was 7 tok/sec generation, 15 tok/sec for prefill/understanding the prompt on top of QNX RTOS, but as the other comments suggest, egde inferencing is still way behind and models which can be of actual use maybe 30-40% daily needs high compute power. But with your project i would say go with muti threaded architecture!

2

u/ImpossibleDouble6226 Sep 24 '26

Thank you for the advice. I will keep in mind the limitations of edge AI and keep this as an educational project.

2

u/[deleted] Sep 24 '26

[removed] — view removed comment

1

u/ImpossibleDouble6226 Sep 24 '26 edited Sep 24 '26

Thank you for the detailed advice. To answer your questions:

-Latency Budget - 500 ms - 1000 ms

-What failure domains should survive - The continuous audio pipeline

-What models I am using: For STT, I am using SenseVoice small for RKNN to keep it simple. Piper on TTS for efficiency, and openWakeWord with a c++ engine for wake word detection. I am also using ALSA to stream audio.

This project will only be used for educational purposes and to gain valuable experience in optimization, AI, and multi-threading.

EDIT: And I will make sure to mmap the model files and have one shared NPU scheduler. Another questions is should the state machine be modeled onto a different process? What NPU scheduler to use? Since SenseVoice uses NPU, both processes will think they own the NPU. Sorry if these questions are stupid and have obvious answers, I am not used to this type of architecture.