一个拥有2890万参数的语言模型在售价约8美元的ESP32-S3微控制器上完全本地运行,以每秒约9.5个token的速度生成简单故事。

Stars

1,132

7 天增长

暂无数据

Fork 数

119

开放 Issue

6

开源协议

MIT

最近更新

2026-07-26

为什么值得关注

通过将大部分模型参数存储在闪存而非RAM中,并利用Google的逐层嵌入技术,它比之前的微控制器语言模型参数规模大了100倍。

适合谁使用

  • 嵌入式系统开发者
  • 研究高效推理的AI研究人员
  • 制作微型AI小工具的爱好者
  • 从事边缘AI隐私解决方案的工程师

典型使用场景

  • 无需联网的本地故事生成
  • 用于教育或原型制作的低成本AI演示
  • 数据无需离开设备的隐私保护文本生成

项目优势

  • 语言模型极低的硬件成本(8美元芯片)
  • 完全本地推理,无需服务器依赖
  • 创新的内存层次结构,利用闪存查找表大幅降低RAM需求

使用前须知

  • 模型只能生成简单故事,无法回答问题或遵循指令
  • 由于SRAM中‘思考核心’较小,推理能力有限
  • 复现需要自定义固件和接线知识

README 快速开始

Running a 28.9M parameter LLM on an $8 microcontroller

Open to Work  ·  𝕏 slvDev  ·  LinkedIn

This is a 28.9 million parameter language model that generates text on an ESP32-S3, a microcontroller that costs about $8. It runs on the chip itself, with nothing sent to a server, and it writes each word to a small screen wired to the chip at roughly 9 tokens per second. The last language model people ran on a chip like this had 260 thousand parameters, so this one holds about a hundred times more. It fits because most of the model lives in flash instead of RAM, using an idea from Google's Gemma models called Per-Layer Embeddings.

The numbers

Parameters28.9M stored (25M of them in a flash lookup table)
ChipESP32-S3, about $8, with 512KB SRAM, 8MB PSRAM and 16MB flash
Speedabout 9.5 tok/s end to end (9.7 tok/s of pure compute)
Connectivitynone, everything runs on the device
Model size14.9MB at 4-bit

Why it is hard, and how it fits anyway

A microcontroller has very little fast memory. The ESP32-S3 gives you 512KB of SRAM. Normally the whole model has to be reachable from there, which keeps you stuck with tiny models, and that is why the previous model on a chip like this had only 260 thousand parameters.

The way around it is to stop putting the model in fast memory at all. Most of a language model's parameters sit in an embedding table, which the model reads from rather than computes on. So you can leave that 25 million row table in slow flash and pull only the few rows each token needs, about 450 bytes, while the small part that does the actual work stays in fast memory. The large model then costs almost nothing to run, because you never load most of it. It just sits in flash and gets sampled a little at a time.

That idea is Google's Per-Layer Embeddings, from Gemma 3n and Gemma 4. Here it runs on the memory layout of a microcontroller instead of a phone or a GPU. As far as I can tell, nobody had tried it on a chip this small.

  SRAM  (fast, tiny)   the "thinking" core, used on every token
  PSRAM (medium)       t

相关仓库与替代方案

根据分类、Topic 和编程语言匹配的相似项目。

jamesob
精选
jamesob GitHub avatar

local-llm

A comprehensive guide for building and configuring a high-end local machine to run state-of-the-art LLMs, with detailed hardware choices, BIOS tuning, and Docker-based model serving.

AI 与机器学习大语言模型
1,520
xai-org
精选
xai-org GitHub avatar

grok-build

Grok Build is SpaceXAI's terminal-based AI coding agent that runs as a full-screen TUI, understands codebases, edits files, executes commands, searches the web, and manages tasks interactively or headlessly.

AI 与机器学习AI 智能体
20,399
Blaizzy
精选
Blaizzy GitHub avatar

nativ

Nativ is a native macOS app that lets you run AI models locally on Apple silicon, offering chat, model management, performance analytics, and an OpenAI/Anthropic-compatible API server.

AI 与机器学习AI 智能体
890