继我们发布博客中的公告之后,我们正式发布 Gemma 4 12B,这是一个采用统一、无编码器架构的密集多模态模型。
Gemma 4 12B 为本地 AI 带来了多项里程碑式突破:
- 多模态无编码器架构:完全绕过繁重的多阶段视觉和音频编码器,多模态数据直接输入大语言模型主干,从而降低多模态延迟。
- 我们首款支持音频输入的中等规模模型:在 Gemma 系列中,此前音频输入仅限于小型、轻量级的边缘架构(例如 E4B)。Gemma 4 12B 是首款能够原生接收音频的中等规模模型。
- 对开发者友好的尺寸:模型足够小,可在配备 16GB VRAM 或统一内存的专用 GPU 笔记本电脑上本地运行。为最大化本地推理速度,我们还额外发布了一款专用的多 token 预测(MTP)模型。
- 全新的 MacOS 桌面体验:我们首次发布可下载的 macOS 桌面应用程序,让开发者能够在消费级设备上直接体验完全本地的语音和视觉交互。
架构
传统多模态模型依赖冻结的、独立的视觉编码器(例如,Gemma 4 在边缘尺寸模型中使用 1.5 亿参数的视觉模型,在中等尺寸模型中使用 5.5 亿参数)和音频编码器(Gemma 4 E2B 和 E4B 使用 3 亿参数)。在将多模态输入送入大语言模型之前,使用多个独立编码器进行处理,会导致延迟增加和内存占用碎片化。
Gemma 4 12B 通过采用一个仅解码器的 Transformer 来解决这些问题,该 Transformer 包含与 Gemma 4 31B 密集模型相同的先进解码器结构。
- 视觉嵌入器(3500 万参数):取代了其他中等尺寸 Gemma 4 模型中的 27 层视觉 Transformer。原始的 48x48 像素块通过单次矩阵乘法(matmul)被投影到大语言模型的隐藏维度。一个分解的坐标查找(X 和 Y 矩阵)将空间位置信息直接附加到输入上。
- 音频波形投影:消除了独立的音频编码器(跳过了 Gemma 4 E2B 和 E4B 中使用的 12 层 Conformer 层)。原始的 16 kHz 音频信号被切片为 40 毫秒的帧(每帧 640 个浮点数),并线性投影到大语言模型的输入空间。
- 统一微调优势:由于视觉、音频和文本输入共享完全相同的权重,你不再需要协同调整多个独立的冻结编码器。下游适配器(例如 LoRA)或全量微调能够自然地通过单次传递(借助 Hugging Face 或 Unsloth)更新整个多模态 token 循环。
如需更深入地了解这种免编码器架构的工作原理,请参阅《Gemma 4 12B 可视化指南》。
能力
Gemma 4 12B 实现了卓越的性能,具备自动语音识别、智能体推理、说话人分离、视频理解、编程等多种能力。
请参阅以下示例,了解该模型的智能体与多模态能力演示:
示例 1:Gemma 4 12B 创建一个使用 Gemma 4 12B 的本地图像处理应用
凭借其智能体与多模态理解能力,Gemma 4 12B 可以轻松与 OpenCode 等现有智能体框架配合使用。在此示例中,我们使用 llama.cpp 通过 gemma-skills 在本地部署该模型,编写了一个帮助用户处理图像的 Gradio 应用。这个应用正是由构建它的同一个 Gemma 4 12B 模型驱动的!
示例 2:以 1 FPS 处理带音频的 5 分钟视频
我们使用 Gemma 4 12B 分析了 5 月 19 日 Google IO 主题演讲中的一个片段,具体是 00:15:32 到 00:20:45 之间的 5 分钟内容。为此,我们提取了该片段的所有帧(以 1 FPS 速率),以及提示词和视频中的音频:
提示词:
- 313 帧(以 1FPS 速率,图像大小调整为视觉 token 预算 70)
- “当那个男人自拍时发生了什么?”
- 视频的音频 + 下方的提示词
在这些演示视频中,当男子拍摄“自拍照”或展示自己手持智能手机放在脸前时,这是一种巧妙的方式,用视觉手段来表现AI模型如何利用现有媒体(如个人照片或视频片段)并对其进行“重新构想”。在这些特定片段中,模型会获取一张自拍照,并将其作为基础来生成各种场景(例如一个人身处空间站,或正在森林中行走)。本质上,这名男子并非真的在拍自拍,而是**在演绎一个视觉隐喻,用以表现AI的能力——即接收一个特定输入(一张“自拍照”),并基于它生成一整个全新的内容世界。** 这是Gemini Omni模型“替换”和“构建世界”演示的一部分,展示了其执行复杂多模态推理和创意生成的能力。
设备端与桌面端服务:由LiteRT-LM驱动
随着Gemma 4 12B的发布,我们正式推出了由LiteRT-LM驱动的强大设备端开发者集成功能,将零延迟的本地AI执行能力原生带入标准桌面环境:
1. 原生macOS应用:移动端的Google AI Edge Gallery正式扩展到桌面平台,可在Apple Silicon GPU上离线原生运行Gemma 4 12B。它附带一个安全的沙盒化Python执行循环,能够在聊天气泡内编写、执行代码并绘制科学图表。与此同时,Mac上的Google AI Edge Eloquent应用也新增了对Gemma 12B的支持,为语音编辑对话输入提供动力。
2. 即插即用的本地API服务器(litert-lm serve):使用新的`litert-lm serve` CLI命令,将Gemma 4 12B作为兼容OpenAI的本地API服务器运行。无缝连接标准集成(例如Continue、Aider、OpenClaw、Hermes或OpenCode),利用内存中的无状态前缀缓存来匹配上下文历史记录,从而立即绕过预填充延迟。
litert-lm import --from-huggingface-repo=litert-community/gemma-4-12B-it-litert-lm gemma-4-12B-it.litertlm gemma4-12b
# Start the OpenAI-compatible server
litert-lm serve 请访问Google AI Edge Gallery博客,深入了解相关内容。
即刻开始
准备好使用Gemma系列首个无编码器架构来构建本地多模态智能体了吗?以下是你今天就可以开始的方法。
- 亲自试试:在 LM Studio、Ollama、Google AI Edge Gallery App、Google AI Edge Eloquent 应用以及 LiteRT-LM CLI 中,只需点击几下即可体验。
- 下载权重:直接从 Hugging Face 和 Kaggle 下载预训练和指令微调的检查点。
- 集成与学习:查阅开发者文档和快速入门笔记本。
- 使用你喜爱的开发工具:通过 Hugging Face Transformers、llama.cpp、MLX、SGLang 和 vLLM 实现本地推理管线,或使用 Unsloth 高效微调。
- 借助 Gemma Skills 开启智能体开发:为支持开发者利用最新的 Gemma 进展构建智能体,我们正式发布了官方 Skills Repository。这是一个专门为让智能体能够使用 Gemma 模型进行构建而设计的技能库。
- 按需部署:使用 Google Cloud 在生产环境中启动端点。通过 Gemini Enterprise Agent Platform Model Garden、Cloud Run 和 GKE 按需部署。
- AI
- 公告
- 探索
- 多模态
- Gemma
- AI
Following the announcement in our launch blog, we are releasing Gemma 4 12B, a dense multimodal model with a unified, encoder-free architecture.
Gemma 4 12B introduces several milestones for local AI:
- A multimodal encoder-free architecture: Bypassing heavy multi-stage vision and audio encoders entirely, multimodal data is fed straight into the LLM backbone, reducing multimodal latency.
- Our first medium-sized model with audio input: In the Gemma family, audio inputs were restricted to small, lightweight edge architectures (e.g. E4B). Gemma 4 12B is the first medium-sized model capable of natively ingesting audio.
- Developer-friendly size: Small enough to run locally on dedicated GPU laptops with 16GB VRAM or unified memory. To maximize local inference speeds, we are additionally releasing a dedicated multi-token prediction (MTP) model.
- New MacOS desktop experience: For the first time, we are releasing downloadable macOS desktop applications, letting developers experience fully local spoken and visual interaction directly on consumer-grade devices.
The Architecture
Traditional multimodal models rely on frozen, separate vision encoders (e.g., Gemma 4 uses a 150M parameter vision model for edge sizes and 550M for medium-sized models) and audio encoders (300M parameters for Gemma 4 E2B and E4B). Processing multimodal inputs with multiple separate encoders before feeding them to the LLM leads to increased latency and fragmented memory footprints.
Gemma 4 12B solves these issues by utilizing a single decoder-only transformer containing the same advanced decoder structure as the Gemma 4 31B Dense model.
- Vision embedder (35M parameters): Replaces the 27 vision transformer layers of the other medium-sized Gemma 4 models. Raw 48x48 pixel patches are projected to the LLM hidden dimension with a single matmul. A factorized coordinate lookup (X and Y matrices) attaches spatial location information directly to the input.
- Audio wave projection: Eliminates the separate audio encoder (skipping the 12 conformer layers used in Gemma 4 E2B and E4B). Raw 16 kHz audio signals are sliced into 40ms frames (640 floats each) and projected linearly to the LLM input space.
- Unified fine-tuning advantage: Because vision, audio, and text inputs share the exact same weights, you no longer have to co-tune separate frozen encoders. Downstream adapter (e.g. LoRA) or full tuning naturally update the entire multimodal token loop in a single pass (via Hugging Face or Unsloth).
For a more in-depth overview of how this encoder-free architecture works, check out A Visual Guide to Gemma 4 12B.
Capabilities
Gemma 4 12B achieves outstanding performance, with capabilities such as automatic speech recognition, agentic reasoning, diarization, video understanding, coding, and more.
See below examples for a demonstration of the model's agentic and multimodal capabilities:
Example 1: Gemma 4 12B creates a local image processing app that uses Gemma 4 12B
Thanks to its agentic and multimodal understanding capabilities, Gemma 4 12B can be easily used with existing agent harnesses like OpenCode. In this example, we served it locally using llama.cpp using the gemma-skills to code a Gradio app that helped the user process images. This app was powered by the same Gemma 4 12B model that built it!
Example 2: Processing 5 minutes of Video at 1 FPS with audio
We used Gemma 4 12B to analyse a part from the Google IO Keynote moment from May 19, specifically the 5 minutes between 00:15:32 and 00:20:45. To do that, we extracted all the frames of that segment (at 1 FPS), plus the prompt and the audio from the video:
Prompt:
- 313 frames (at 1FPS, images resized to visual token budget 70)
"what happens when the man takes a selfie?"- the Video's audio + the prompt below
When the man takes a "selfie" or is shown holding a smartphone in front of his face in these demonstration videos, it is a clever way to visually represent how the AI models can take existing media—like a personal photo or a video clip—and "reimagine" it. In these specific clips, the model is taking a selfie and using it as a base to generate various scenarios (like a person in a space station, or walking through a forest).
Essentially, the man is not actually taking a selfie; rather, he is **acting out a visual metaphor for the AI's capability to take one specific input (a "selfie") and generate a whole world of new content based on it.** This is part of the "Swap" and "Build worlds" demonstrations of the Gemini Omni model, showing its ability to perform complex, multi-modal reasoning and creative generation.
On-Device & Desktop Serving: Powered by LiteRT-LM
In tandem with the Gemma 4 12B launch, we are officially introducing powerful on-device developer integrations powered by LiteRT-LM, bringing zero-latency local AI execution natively to standard desktop environments:
1.Native MacOS Apps: The mobile Google AI Edge Gallery is officially expanding to desktop platforms, running Gemma 4 12B offline, natively on Apple Silicon GPUs. It comes with a secure sandboxed Python execution loop to write, execute, and plot scientific charts inside the chat bubble. In parallel, the Google AI Edge Eloquent app on Mac launches support for Gemma 12B to power Voice Edit conversational inputs.
2. Drop-in Local API Servers (litert-lm serve): Run Gemma 4 12B as a local, OpenAI-compatible API server using the new litert-lm serve CLI command. Seamlessly connect standard integrations (e.g., Continue, Aider, OpenClaw, Hermes or OpenCode), leveraging stateless prefix caching in memory to match context history and instantly bypass prefill latency.
litert-lm import --from-huggingface-repo=litert-community/gemma-4-12B-it-litert-lm gemma-4-12B-it.litertlm gemma4-12b
# Start the OpenAI-compatible server
litert-lm serve Find a deep dive about it on the Google AI Edge Gallery blog.
Getting Started Today
Ready to build local multimodal agents with the first encoder-free architecture of the Gemma family? Here is how you can jump in today
- Try it yourself: Experiment with a couple of clicks in LM Studio, Ollama, Google AI Edge Gallery App, the Google AI Edge Eloquent app and the LiteRT-LM CLI
- Download the weights: Download the pre-trained and instruction-tuned checkpoints directly from Hugging Face and Kaggle.
- Integrate & learn: Review the developer documentation and the quick start notebook.
- Use your favorite development tools: Implement local inference pipelines with Hugging Face Transformers, llama.cpp, MLX, SGLang, and vLLM, or fine-tune with efficiency using Unsloth.
- Unlock Agentic Development with Gemma Skills: To support agents to build with the latest Gemma advancements, we are releasing our official Skills Repository. This is a library of skills designed specifically to enable agents to build with Gemma models.
- Deploy your way: Spin up endpoints in production using Google Cloud. Deploy your way through Gemini Enterprise Agent Platform Model Garden, Cloud Run and GKE.