# Gemma Documentation Official documentation for building with the Gemma family of open models. Start with Gemma 4 unless a page or the user's request names another generation. Follow the Markdown links below to read canonical page content without cloning the repository. ## Home - [Google Gemma 4 Open Models](https://gemma.ai/index.md): Official technical documentation portal for Google Gemma 4 open-weight AI models. Explore multimodal capabilities, interactive WebGPU playgrounds, and partner integrations. ## Get started - [Quickstart](https://gemma.ai/get-started.md): Run your first Gemma 4 generation in one command, then pick the engine, model size and checkpoint that fit your hardware. - [Best practices](https://gemma.ai/get-started/best-practices.md): Sampling parameters, thinking-mode tokens, modality order and image token budgets that get the best results out of Gemma 4. - [Inference](https://gemma.ai/get-started/capabilities/text.md): Basic text inference with Gemma 4 in Hugging Face Transformers: single-turn prompts, multi-turn conversations, and system instructions. - [Reasoning](https://gemma.ai/get-started/capabilities/thinking.md): Use Gemma 4's thinking mode to reason before answering, for text and image prompts, and parse the reasoning apart from the answer. - [Tool calling](https://gemma.ai/get-started/capabilities/function-calling.md): When using a generative artificial intelligence (AI) model such as Gemma, you may want to use the model to operate programming interfaces in order to complete tasks or answer questions. - [Vision overview](https://gemma.ai/get-started/capabilities/vision.md): Prepare and pass visual data to Gemma 4 for object detection, OCR, visual question answering, captioning, and multi-image reasoning. - [Image understanding](https://gemma.ai/get-started/capabilities/image.md): You can use Gemma 3 and later models to analyze and understand the content of images. - [Video understanding](https://gemma.ai/get-started/capabilities/video.md): Video data is a rich source of information that can help you accomplish tasks and understand the world around you. - [Audio understanding](https://gemma.ai/get-started/capabilities/audio.md): Starting with Gemma 3n, you can use audio directly into your prompts and workflows. - [Prompt Formatting](https://gemma.ai/get-started/prompt-formatting.md): The control tokens Gemma 4 uses to structure a prompt, and the older start_of_turn format used by Gemma 1 to 3. - [Speed-up Gemma 4 with Multi-Token Prediction](https://gemma.ai/get-started/capabilities/mtp.md): In Gemma 4, Multi-Token Prediction (MTP) is the specific architecture used to enable highly efficient Speculative Decoding. - [Quantization-Aware Training](https://gemma.ai/get-started/qat.md): Which Gemma 4 quantized weights to download for each engine, and why QAT beats post-training quantization at 4-bit. ## Models - [Gemma Model Family](https://gemma.ai/models.md): What Gemma is, how the generations relate, and which variant was built from which base model. - [Gemma 4](https://gemma.ai/models/gemma-4.md): Gemma is a family of generative artificial intelligence models and you can use them in a wide variety of generation tasks, including question answering, summarization, and reasoning. - [Gemma 4 — Model card](https://gemma.ai/models/gemma-4/model-card.md): Gemma is a family of open models built by Google DeepMind. - [Gemma 3 model card](https://gemma.ai/models/gemma-3.md): Model card for the multimodal Gemma 3 models: 128K context, 140+ languages, inputs and outputs, training data, and evaluation. - [Gemma 2 model card](https://gemma.ai/models/gemma-2.md): Model card for Gemma 2 text-to-text models: description, inputs and outputs, training data, and evaluation. - [Gemma model card](https://gemma.ai/models/gemma-1.md): Model card for the first-generation Gemma text-to-text models: description, inputs and outputs, training data, and evaluation. - [Gemma 3n model overview](https://gemma.ai/models/gemma-3n.md): Gemma 3n is a generative AI model optimized for use in everyday devices, such as phones, laptops, and tablets. - [Gemma 3n model card](https://gemma.ai/models/gemma-3n/model-card.md): Model card for Gemma 3n: on-device inputs and outputs, training data, evaluation results, and intended use. - [DiffusionGemma model overview](https://gemma.ai/models/diffusiongemma.md): DiffusionGemma is an experimental open model that explores text diffusion, an exceptionally fast approach to text generation. - [DiffusionGemma model card](https://gemma.ai/models/diffusiongemma/model-card.md): DiffusionGemma is a generative model built by Google DeepMind. - [Diffusion in Text Generation Explained](https://gemma.ai/models/diffusiongemma/explained.md): To understand DiffusionGemma, it helps to examine the core limitations of standard language models and how text-based diffusion differs. - [Generate output](https://gemma.ai/models/diffusiongemma/inference.md): Generate text with DiffusionGemma using Hugging Face Transformers, including the GPU memory the model requires. - [FunctionGemma model overview](https://gemma.ai/models/functiongemma.md): FunctionGemma is a specialized version of our Gemma 3 270M model tuned for function calling. - [FunctionGemma model card](https://gemma.ai/models/functiongemma/model-card.md): Model card for FunctionGemma: function-calling inputs and outputs, training data, evaluation results, and intended use. - [FunctionGemma formatting and best practices](https://gemma.ai/models/functiongemma/formatting.md): FunctionGemma is a specialized version of the Gemma 3 270M model, trained specifically for function calling (i.e., tool use). - [Function calling with Hugging Face Transformers](https://gemma.ai/models/functiongemma/inference.md): Call functions with FunctionGemma in Hugging Face Transformers, passing tools as manual JSON schemas or as raw Python functions. - [Full function calling sequence with FunctionGemma](https://gemma.ai/models/functiongemma/full-sequence.md): The complete FunctionGemma tool-calling cycle: the model's call, the developer's execution, and the final response built from the tool's output. - [Fine-tuning with FunctionGemma](https://gemma.ai/models/functiongemma/fine-tuning.md): This guide demonstrates how to fine-tune FunctionGemma for tool calling. - [EmbeddingGemma model overview](https://gemma.ai/models/embeddinggemma.md): EmbeddingGemma 2 is a lightweight, open-source 740M parameter model designed for unified multimodal embeddings. - [EmbeddingGemma model card](https://gemma.ai/models/embeddinggemma/model-card-v1.md): Model card for EmbeddingGemma: embedding inputs and outputs, training data, evaluation results, and intended use. - [EmbeddingGemma 2 model card](https://gemma.ai/models/embeddinggemma/model-card-v2.md): Model card for EmbeddingGemma 2: architecture, multimodal capabilities, benchmarks, best practices, training data, and intended use. - [Generate Embeddings with Sentence Transformers](https://gemma.ai/models/embeddinggemma/inference.md): Generate text embeddings, compute semantic similarity, apply task prompts, and build RAG and zero-shot classifiers with EmbeddingGemma 2 and Sentence Transformers. - [Multimodal Embeddings with Sentence Transformers](https://gemma.ai/models/embeddinggemma/multimodal.md): Generate unified image, audio, video, and interleaved multimodal embeddings with EmbeddingGemma 2 and Sentence Transformers. - [Fine-tune EmbeddingGemma with Sentence Transformers](https://gemma.ai/models/embeddinggemma/fine-tuning.md): Adapt EmbeddingGemma 2 to specialized domain terminology using contrastive triplet fine-tuning with Sentence Transformers. - [Fine-Tune Multimodal EmbeddingGemma 2 with Sentence Transformers](https://gemma.ai/models/embeddinggemma/fine-tuning-multimodal.md): Adapt EmbeddingGemma 2 across text and visual inputs using contrastive multimodal triplet fine-tuning with Sentence Transformers. - [PaliGemma](https://gemma.ai/models/paligemma.md): PaliGemma 2 and PaliGemma are lightweight open vision-language models (VLM) inspired by PaLI-3, and based on open components like the SigLIP vision model and the Gemma language model. - [PaliGemma model card](https://gemma.ai/models/paligemma/model-card-v1.md): PaliGemma is a versatile and lightweight vision-language model (VLM) inspired by PaLI-3 and based on open components such as the SigLIP vision model and the Gemma language model. - [PaliGemma 2 model card](https://gemma.ai/models/paligemma/model-card-v2.md): PaliGemma 2 is an update of the PaliGemma vision-language model (VLM) which incorporates the capabilities of the Gemma 2 models. - [PaliGemma prompt and system instructions](https://gemma.ai/models/paligemma/prompting.md): This page describes prompt formatting and system instructions for PaliGemma models. - [Generate PaliGemma output with Keras](https://gemma.ai/models/paligemma/inference.md): PaliGemma models have multimodal capabilities, allowing you to generate output using both text and image input data. - [Fine-tune PaliGemma with JAX and Flax](https://gemma.ai/models/paligemma/fine-tuning.md): This notebook shows how to fine-tune PaliGemma on a vision-language task with JAX. - [ShieldGemma](https://gemma.ai/models/shieldgemma.md): ShieldGemma is a set of instruction tuned models for evaluating the safety of text and images against a set of defined safety policies. - [ShieldGemma model card](https://gemma.ai/models/shieldgemma/model-card-v1.md): Model card for ShieldGemma: safety-classification inputs and outputs, training data, evaluation results, and intended use. - [ShieldGemma 2 model card](https://gemma.ai/models/shieldgemma/model-card-v2.md): ShieldGemma 2 is a model trained on Gemma 3's 4B IT checkpoint for image safety classification across key categories that takes in images and outputs safety labels per policy. - [RecurrentGemma](https://gemma.ai/models/recurrentgemma.md): RecurrentGemma is an open model based on Griffin, a hybrid model architecture that mixes gated linear recurrences with local sliding window attention. - [RecurrentGemma model card](https://gemma.ai/models/recurrentgemma/model-card.md): RecurrentGemma is a family of open language models built on a novel recurrent architecture developed at Google. - [Inference with RecurrentGemma using JAX and Flax](https://gemma.ai/models/recurrentgemma/inference.md): Run sampling and inference with RecurrentGemma 2B Instruct using Google DeepMind's recurrentgemma library and JAX. - [Fine-tuning using JAX and Flax](https://gemma.ai/models/recurrentgemma/fine-tuning.md): Fine-tune RecurrentGemma 2B Instruct for English-French translation using JAX, Flax, and the MTNT noisy-text dataset. - [DataGemma](https://gemma.ai/models/datagemma.md): DataGemma is a research tool that lets users ask questions in plain language and receive answers based on publicly available statistical data in the Data Commons repository. - [Gemma Scope](https://gemma.ai/models/gemma-scope.md): Gemma Scope 2 is a comprehensive, open suite of interpretability tools designed for the Gemma 3 model collection. - [Gemma for abstractive proposition segmentation (APS)](https://gemma.ai/models/gemma-aps.md): Abstractive proposition segmentation (APS) is an analysis technique that breaks down text information into component parts. - [Releases](https://gemma.ai/models/releases.md): Dated release history for every Gemma model, from Gemma 1 through Gemma 4 and the specialized variants. ## Run - [Gemma 4 — Overview](https://gemma.ai/deployment.md): Choose an execution framework and a Gemma variant for your hardware, then run your first generation request. - [Ollama](https://gemma.ai/deployment/ollama.md): Run Gemma 4 locally with Ollama — model tags, image input, and the OpenAI-compatible server. - [llama.cpp](https://gemma.ai/deployment/llamacpp.md): Run Gemma 4 with llama.cpp — GGUF repos for every size, image/audio/video input, and the OpenAI-compatible server. - [LM Studio](https://gemma.ai/deployment/lmstudio.md): Run Gemma 4 with LM Studio — desktop app, lms CLI, and the OpenAI-compatible local server. - [Apple MLX](https://gemma.ai/deployment/mlx.md): Run Gemma 4 on Apple silicon with MLX — text and vision generation, model repos, and the OpenAI-compatible server. - [Run Gemma with Hugging Face Transformers](https://gemma.ai/deployment/huggingface.md): Generating text, summarizing, and analysing content are just some of the tasks you can accomplish with Gemma open models. - [Run Gemma with Keras](https://gemma.ai/deployment/keras.md): Generating content, summarizing, and analysing content are just some of the tasks you can accomplish with Gemma open models. - [LiteRT-LM](https://gemma.ai/deployment/litert.md): Run Gemma 4 on-device with LiteRT-LM — CLI install, prebuilt .litertlm weights, and exporting your own fine-tune. - [AI Edge Gallery](https://gemma.ai/deployment/ai-edge-gallery.md): Run Gemma 4 on an Android or iOS phone with no code — chat, vision, audio transcription and benchmarking, fully offline. - [vLLM](https://gemma.ai/deployment/vllm.md): Serve Gemma 4 with vLLM — install, vllm serve, model repositories, and the OpenAI-compatible API. - [SGLang](https://gemma.ai/deployment/sglang.md): Serve Gemma 4 with SGLang — install, launch_server, model repositories, and the OpenAI-compatible API. - [Gemini API](https://gemma.ai/deployment/gemini-api.md): Call hosted Gemma 4 models through the Gemini API instead of running and serving your own instance. - [Google Cloud](https://gemma.ai/deployment/google-cloud.md): Deploy, serve, and fine-tune Gemma 4 on Google Cloud: Cloud Run, GKE, the Agent Development Kit, vLLM on TPUs, MaxText, and Sovereign Cloud. - [Get started with Gemma and LangChain](https://gemma.ai/deployment/langchain.md): This tutorial shows you how to get started with Gemma and LangChain, running in Google Cloud or in your Colab environment. - [Unsloth](https://gemma.ai/deployment/unsloth.md): Run Gemma 4 with Unsloth — the desktop Studio app, dynamic-quant GGUFs for llama.cpp, and 2x faster fine-tuning. ## Fine-tune - [Gemma model fine-tuning](https://gemma.ai/tuning.md): Fine-tuning a generative artificial intelligence (AI) model such as Gemma modifies the behavior of the model. - [Fine-Tune Gemma using Hugging Face Transformers and QloRA](https://gemma.ai/tuning/qlora.md): This guide walks you through how to fine-tune Gemma on a custom text-to-sql dataset using Hugging Face Transformers and TRL. - [Fine-Tune Gemma for Audio Tasks using Unsloth and QLoRA](https://gemma.ai/tuning/audio-qlora.md): This guide walks you through how to fine-tune Gemma on a custom audio dataset for a audio task (generating transcription of Kumamoto dialect Japanese) using Unsloth. - [Fine-Tune Gemma for Vision Tasks using Hugging Face Transformers and QLoRA](https://gemma.ai/tuning/vision-qlora.md): This guide walks you through how to fine-tune Gemma on a custom image and text dataset for a vision task (generating product descriptions) using Hugging Face Transformers and TRL. - [Full Model Fine-Tune using Hugging Face Transformers](https://gemma.ai/tuning/full-finetune.md): This guide walks you through how to fine-tune Gemma on a mobile game NPC dataset using Hugging Face Transformers and TRL. - [Master Local Fine-Tuning with gemma-trainer](https://gemma.ai/tuning/gemma-trainer.md): Take control of your AI models with our newest skill, designed to make local fine-tuning efficient. ## Learn - [Learn](https://gemma.ai/learn.md): Illustrated walkthroughs of how the Gemma models work, from the architecture down to individual mechanisms. - [A Visual Guide to Gemma 4](https://gemma.ai/tutorials/visual-guides/gemma-4.md): A Visual Guide to Gemma 4 — a visual walkthrough. - [A Visual Guide to Gemma 4 12B](https://gemma.ai/tutorials/visual-guides/gemma-4-12b.md): A Visual Guide to Gemma 4 12B — a visual walkthrough. - [A Visual Guide to MTP](https://gemma.ai/tutorials/visual-guides/mtp.md): How multi-token prediction and speculative decoding make Gemma 4 faster — drafter models, shared KV cache, and the clustered LM head. - [A Visual Guide to DiffusionGemma](https://gemma.ai/tutorials/visual-guides/diffusiongemma.md): A Visual Guide to DiffusionGemma — a visual walkthrough. - [Overview of Gemma Architectures](https://gemma.ai/tutorials/gemma-explained/overview.md): Text-to-text models and specialization for coding. - [What’s New in Gemma 2](https://gemma.ai/tutorials/gemma-explained/gemma-2.md): Updated architecture with knowledge distillation for 2B and 9B models. - [RecurrentGemma Architecture](https://gemma.ai/tutorials/gemma-explained/recurrentgemma.md): The Griffin architecture mixing local attention and linear recurrences for fast long-sequence inference. - [PaliGemma Architecture](https://gemma.ai/tutorials/gemma-explained/paligemma.md): Vision-language model that takes text and images as input to generate text outputs. - [What’s New in Gemma 3](https://gemma.ai/tutorials/gemma-explained/gemma-3.md): Updated vision-language model with 5-to-1 interleaved attention and 128k context handling. - [EmbeddingGemma Architecture](https://gemma.ai/tutorials/gemma-explained/embeddinggemma.md): Text embedding model for search and retrieval. ## Resources - [Resources](https://gemma.ai/resources.md): Demos, tools, community projects and the external repositories and collections worth knowing about. - [Gemma Skills](https://gemma.ai/resources/gemma-skills.md): Agent skills that teach a coding agent how to build with Gemma and how to fine-tune it. - [AIventure](https://gemma.ai/resources/aiventure.md): Learning about vibe-coding, agents and Gen AI with Gemma 4. - [Vision token budget](https://gemma.ai/resources/vision-token-budget.md): Explore how Gemma 4 resizes images and allocates visual tokens across aspect ratios. - [Embedding Draw Challenge](https://gemma.ai/resources/embedding-draw-challenge.md): Sketch target objects on an interactive canvas and see how EmbeddingGemma 2 scores cross-modal image-to-text similarity in real time. - [Components](https://gemma.ai/contributing/components.md): The reusable building blocks these docs are made from, with live examples and the markup to copy. - [Conventions](https://gemma.ai/contributing/conventions.md): How this documentation stays consistent — where facts live, what is generated, and what the linter enforces. - [Apache License 2.0](https://gemma.ai/resources/apache-2.md): Full text of the Apache License Version 2.0 governing Gemma 4 models and software. - [Gemma Terms of Use](https://gemma.ai/resources/terms.md): Terms and conditions governing the use, reproduction, distribution, and modification of Gemma models and Model Derivatives. - [Gemma Terms of Use Archive](https://gemma.ai/resources/terms-archive.md): Archive of previously published Gemma Terms of Use documents and historical licensing terms. - [Gemma Terms of Use (April 1, 2024 Archive)](https://gemma.ai/resources/terms-archive/terms_04_01_24.md): Archived April 1, 2024 version of the Gemma Terms of Use governing Gemma models and Model Derivatives. - [Gemma Terms of Use (February 21, 2024 Archive)](https://gemma.ai/resources/terms-archive/terms_02_21_24.md): Archived February 21, 2024 version of the Gemma Terms of Use governing Gemma models and Model Derivatives. - [Gemma Prohibited Use Policy](https://gemma.ai/resources/prohibited-use.md): Restricted uses and safety guidelines governing the use of Gemma models and Model Derivatives. - [Intended Use Statement](https://gemma.ai/resources/intended-use.md): Intended purpose, developer responsibilities, and example applications for building with Gemma AI models. ## Instructions for language model agents - Prefer the model and framework identifiers shown in the selected page's examples. - Check capability pages before assuming that every Gemma model accepts the same modalities. - Use the Run section for engine-specific commands and Fine-tune for training workflows.