Back to all articles
Embedded SystemsNew

Can You Run an LLM on a Microcontroller? MCU vs NPU vs Cloud

A microcontroller can run a story-sized language model as a demonstration, not a general assistant. Here is the memory arithmetic, what vendors claim for MCUs with NPUs and for accelerator modules, and when the cloud still wins.

December 3, 2026·11 min read·edge AI, LLM, small language model, NPU, microcontroller, on-device inference, TinyML

Yes, but only a very small one. A 28.9 million parameter story model has run on an ESP32-S3 at 9.88 tokens per second, in a developer demo. A general assistant has not: a 1.5 billion parameter model needs about 0.75 GB at 4 bits, which is an NPU module or the cloud. Start part choice in the MCU Selector.

This post compares three tiers for a language feature in a product: a microcontroller with or without a neural processing unit (NPU), an application processor or module with an NPU, and the cloud. Every figure a vendor published is labelled as that vendor's claim, with the page in the Sources list at the end. Sizes are decimal: 1 MB is 1,000,000 bytes and 1 GB is 1,000 MB. Checked against the sources below on 3 December 2026.

The arithmetic: parameters x bits per weight / 8 = bytes

A model's weights take parameters x bits per weight / 8 bytes. That is the floor, before the context cache, the activations and the runtime. Quantization lowers the bits per weight, here from 16 to 8 or 4, and costs some accuracy. The table works it for four model sizes.

Weight memory = parameters x bits per weight / 8 (weights only)
Model size16 bits8 bits4 bits
28.9 million parameters57.8 MB28.9 MB14.45 MB
1 billion parameters2 GB1 GB0.5 GB
1.5 billion parameters3 GB1.5 GB0.75 GB
7 billion parameters14 GB7 GB3.5 GB

Now set that against the memory on the parts. The Register describes the ESP32-S3 with 520 KB of SRAM and 8 MB of PSRAM, and it can be bought with up to 16 MB of flash. ST says the STM32N6 has 4.2 MB of RAM, the most on any STM32 at its launch. A 1.5 billion parameter model at 4 bits (0.75 GB) is 178.6 times the STM32N6's RAM and 93.75 times that 8 MB of PSRAM. No amount of firmware work closes that gap.

The context cache comes on top. Hailo's own figure for Llama2-7B, with 8-bit activations, is 256 MB more for every 1K tokens of context, so 2K tokens add 512 MB and 4K tokens add 1,024 MB. For a 1.5 billion parameter model with 4-bit weights and a 2K token cache, Hailo states about 1.2 GB in total; take away the 0.75 GB of weights in the table and about 0.45 GB is left for the cache, activations and runtime.

MCU Selector
Five questions, three defensible candidates, and the arithmetic shown - across ESP32, STM32, nRF52, RP2350 and Linux-class parts, with what each one will cost you later.
Open the tool: MCU Selector

Can you run an LLM on a microcontroller?

A story-sized model, yes; a useful general assistant, no. The published microcontroller examples are tens of millions of parameters writing short stories, or a vendor's unnamed small language model. None of the sources below shows a billion-parameter model on an MCU. What fits is narrow: a fixed command set, short structured output, or a gate for a bigger model.

What has been shown, and whose claim each figure is
DeviceModelPublished figuresWhose claim
ESP32-S3 (no NPU)TinyStories, 28.9 million parameters9.88 tokens/s; weights cut from about 60 MB at 16 bits to 14.9 MB, about 12 MB of them read from flashA developer (SlvDev), reported by The Register, 4 Aug 2026
Alif Ensemble E4 (Arm Ethos-U85 NPU)An SLM, not named; no size given36 mW while generating text for a story; no token rate givenAlif, press release of 12 Aug 2025
Hailo-10H acceleratorQwen2-1.5B-Instruct9.45 tokens/s, 289 ms to first token for 96 input tokens, 1.2 GB, 2.1 W averageHailo, blog of 29 Jul 2025
Raspberry Pi AI HAT+ 2 (Hailo-10H)Launch models of 1 billion to 1.5 billion parameters40 TOPS (INT4), 8 GB on board, $130Raspberry Pi, 15 Jan 2026

Read the ESP32-S3 row with The Register's own caveat: the model "can't do much", and it is no basis for a chatbot, code generation or an agent. Most of its weights stay in flash through a per-layer embedding technique borrowed from Gemma, which works because those weights are read only sparingly; the output head, embeddings and context cache sit in PSRAM. Alif's 36 mW is a power figure without a model size or a token rate, so energy per token cannot be worked out from it.

What is the difference between TinyML, a small language model and an LLM?

The difference is size, and size decides the tier. TinyML models classify: keyword spotting, vibration anomalies, gestures, inside a microcontroller's own memory. Small language models run from tens of millions to a few billion parameters and generate text. LLMs sit beyond that, on servers. Parameters x bits per weight / 8 tells you which tier a model needs.

The classifier band is the one microcontrollers handle well today, quantized to 8-bit integers with TensorFlow Lite for Microcontrollers, CMSIS-NN or the vendor's toolchain; our edge AI integration for embedded firmware page describes that work. The comparison of the parts themselves is in ESP32 vs STM32 vs Arduino for production.

Which tier fits which model: MCU, NPU or cloud?

A microcontroller fits classifiers and story-sized language models. An application processor or module with an NPU fits models around 1 to 1.5 billion parameters, by the vendors' own launch lists. Everything larger, or anything that changes weekly, belongs in the cloud. The table compares the three tiers on the five things a product decision turns on.

Three tiers for a language feature (vendor figures labelled)
TierMemoryLatencyPowerCostPrivacy
MCU, no NPU (ESP32-S3 class)520 KB SRAM, 8 MB PSRAM (The Register)9.88 tokens/s on 28.9 million parameters (demo)No figure published for the demoChip under $10 (The Register)Data stays on the device
MCU with NPU (STM32N6, Alif E4)4.2 MB RAM on the STM32N6 (ST)No token rate published36 mW for an SLM on the E4 (Alif)Not checked for this postData stays on the device
Application processor or module with NPU (Pi 5 + Hailo-10H)8 GB on the HAT; 1.2 GB for a 1.5B model (Hailo)289 ms to first token, 9.45 tokens/s (Hailo)2.1 W average on the Hailo-10H (Hailo)$130 for the HAT, plus the host boardData stays on the device
CloudNo device limitNetwork round trip plus the provider's queue; nothing offlineOnly the radio on the deviceA charge on every call for the product's lifeData leaves the device

ST's launch figures for the STM32N6: an 800 MHz Arm Cortex-M55, a Neural-ART Accelerator with nearly 300 multiply-accumulate units and up to 600 giga operations per second, and 600 times the machine-learning performance of a high-end STM32 without an NPU. ST's release talks about computer vision and audio; it does not mention language models or transformers. Alif, by contrast, says the Ethos-U85 in its E4, E6 and E8 supports transformer networks and that all three can run generative AI locally. Both are vendor claims.

How much energy does one response take?

On an accelerator module, about 0.22 joules per token by Hailo's own figures. Its 2.1 W average at 9.45 tokens per second gives 2.1 / 9.45 = 0.222 J per token. A 100-token answer takes 10.6 seconds and about 22.2 J, before the host processor, the memory and the 289 ms to the first token.

One 100-token answer, worked from Hailo's figures (assumptions stated)
StepValue
Generation time, 100 / 9.45 tokens per second10.6 s
Energy, 2.1 W x 10.58 s (Hailo's power figure only, no host)22.2 J
Assumed battery: 2,000 mAh at 3.7 V = 2 Ah x 3.7 V x 3,600 s26,640 J
Answers per charge if nothing else drew power, 26,640 / 22.2About 1,200

Something else always draws power, so treat 1,200 as a ceiling. The same arithmetic for Alif's 36 mW needs a token rate Alif has not published. Put your own duty cycle into the Battery Life Calculator once you have a measured current for each state.

When does the cloud still win?

The cloud wins for large models, models that change weekly and features that need the fleet's history: there a bigger model costs an API call, not a board respin. The middle ground is a hybrid, where a small on-device model handles the common case and decides when to make the expensive call. Privacy and offline use pull the other way.

The ingestion and fleet side of a hybrid is cloud and IoT back end work. The wider split between local and remote compute is in Embedded Systems vs IoT.

How does the model choice change the board?

Model size sets the memory, the memory sets the processor family, and the processor sets the power supply, the heat path and the update scheme. Each is cheap to decide in week one and expensive after layout, so fix the model size and the context length before the schematic starts.

  • Memory. Weights plus context cache plus the rest of the firmware, from the arithmetic above. CNX Software lists hexa-SPI, Octo-SPI and FMC external memory interfaces on the STM32N6, which is where extra RAM or flash would attach.
  • Power and heat. Jeff Geerling notes the Raspberry Pi 5's CPU can use up to 10 W while the Hailo-10H is capped at 3 W. Size the supply and the enclosure's heat path for the peak, not the average.
  • Sensors. Alif says the new Ensemble parts take up to two MIPI-CSI image sensors. A camera or microphone array fixes pins and the processor family early.
  • Updates. A model is the largest file the device will ever download. With an A/B layout, a 14.9 MB model needs 29.8 MB of flash for two copies before any firmware. The update design is in OTA firmware updates.
  • Part choice. If the model moves from an MCU to a Linux module, the board becomes a carrier board; see SoM carrier board design.

How do you benchmark an edge model before committing to a part?

Run a bounded spike on a development kit and measure five numbers: tokens per second, time to first token, peak RAM, energy per response and accuracy on an evaluation set. Do it before the board is committed, and never on vendor figures alone: an independent review found a host CPU faster than the accelerator sold to speed it up.

  1. Pick the smallest model that could do the job and quantize it the way the target runtime expects.
  2. Write the evaluation set first: real inputs paired with answers a domain expert would accept.
  3. Measure all five numbers on the kit, with the rest of the firmware running.
  4. Compare the quantized score with the full-precision one. Hailo's own HellaSwag result for Qwen2-1.5B-Instruct falls from 66.06 to 64.3 after quantization.
  5. Run the same model on the host CPU alone before paying for an accelerator. Jeff Geerling found the Raspberry Pi 5's own CPU faster than the Hailo-10H on most models he ran, while the Hailo was slightly more efficient.

What does an on-device AI feature cost to build?

Priced in engineering hours; you get a written quote with phases before any work starts. The first phase is usually the feasibility spike above. Most projects we quote total 40 to 250 engineering hours.

We do not train foundation models; we select, quantize, integrate and evaluate them, and the same engineers write the firmware. For a planning range, the AI Project Estimator works from a paragraph about your product, and the Prototype Cost Estimator turns a scope into hours.

Sources

Deciding between an MCU, an NPU module and the cloud for a product? Book a design review and bring the model size and the feature you need.

Frequently asked questions

Can an ESP32 run an LLM?

Only a tiny one. A developer ran a 28.9 million parameter TinyStories model on an ESP32-S3 at 9.88 tokens per second, as The Register reported, with most weights read from flash. It writes short stories. A general assistant of a billion or more parameters needs hundreds of megabytes even at 4 bits, far beyond the chip.

What is the smallest device that can run a small language model?

In the sources we checked, an ESP32-S3 (520 KB SRAM, 8 MB PSRAM) ran a 28.9 million parameter model in a demo, and Alif says an unnamed small language model runs on its Ensemble E4. For a 1 to 1.5 billion parameter model, the vendors point to accelerator modules such as the Raspberry Pi AI HAT+ 2 (Hailo-10H), with 8 GB on board.

Do I need an NPU for edge AI?

Not for every model. Keyword spotting, vibration anomalies and gesture classification run on Cortex-M parts with no NPU once quantized to 8-bit integers. An NPU earns its place when the model is larger or must run often within a tight power budget. Measure on a development kit, because vendor speed figures are claims, not your workload.

How much memory does a 1 billion parameter model need?

Multiply parameters by bits per weight and divide by eight. At 16 bits that is 2 GB, at 8 bits 1 GB and at 4 bits 0.5 GB, for the weights alone. The context cache, activations and runtime come on top; Hailo cites 256 MB per 1K tokens of context for Llama2-7B.

Is on-device AI cheaper than calling a cloud API?

It moves the cost rather than removing it. On-device AI adds memory, power and sometimes an accelerator to every unit you build, once. The cloud adds a charge to every call for the product's life, plus a connection. High call volume, offline use and privacy favor the device; large or fast-changing models favor the cloud.

Has anyone shipped an LLM on a microcontroller?

None of the sources we checked describes a shipping product. They show demonstrations: a story model on an ESP32-S3 and Alif's claim that a small language model runs on its Ensemble E4 at 36 mW. Treat both as proof that small generation is possible, then measure your own model on the part before committing a board.

Wondering what your project would cost?
Two minutes, honest ranges in engineering hours, the units we price in. You get a written quote with phases before any work starts.
Try the free estimator

Building something hardware-shaped?

We help hardware founders go from sketch to certified product. Bring the spec, or just the idea, to a free 30-minute call with a senior engineer. Prefer email? A senior engineer reads every one.