Gemma
Free
Gemma is an open source lightweight
Gemma — Google’s open source lightweight large language model series
Core parameters and statistics
| Parameters | Details |
|---|---|
| Latest version | Gemma 2 (2B/9B/27B) |
| Release date | 2024-06-27 |
| License | Apache 2.0 (fully open for commercial use, no monthly activity limit) |
| Context Window | 8192 Token (Gemma 2) |
| Technology source | Based on Gemini research results, using knowledge distillation technology |
| Release channels | HuggingFace, Kaggle, Google Cloud Vertex AI |
| Variant model | CodeGemma (code), PaliGemma (visual language), RecurrentGemma |
| Quantization support | GGUF, GPTQ, AWQ and other mainstream quantization formats |
| Inference framework | HuggingFace Transformers, llama.cpp, Ollama, vLLM |
| Google Colab support | Free Colab notebook, run Gemma directly in the browser |
The key difference between Gemma and Llama is the license: Gemma uses Apache 2.0 (no user size limit, truly completely open source), while Llama 3’s Meta Llama License requires special licenses after it exceeds 700 million monthly active users. For growing commercial applications, Gemma's Apache 2.0 license provides even more worry-free legal protection.
User and market recognition
Since its release in February 2024, Gemma has continued to grow in downloads on HuggingFace, becoming the second most popular open source LLM family after the Llama series. Google's powerful developer ecosystem (Kaggle, Colab, Google Cloud) provides Gemma with a unique distribution channel. A large number of data scientists and Kaggle competition participants have access to Gemma through a familiar platform, forming a rapidly growing user base.
Gemma 2 27B reached a level close to GPT-4 Turbo in the blind test ranking of LMSys Chatbot Arena. This benchmark result attracted widespread attention in the open source community and proved that parameter-efficient small models can achieve performance levels far exceeding the expected number of parameters through knowledge distillation. The launch of professional variants such as CodeGemma and PaliGemma further expands the application scenario coverage of the Gemma ecosystem.
Cost advantage
| Method | Price | Main applicable scenarios | Features |
|---|---|---|---|
| Local deployment | Hardware cost (one-time) | Privacy applications, development experiments | Apache 2.0, no commercial restrictions |
| Google Cloud Vertex AI | Billing by Token (Gemini pricing system) | Enterprise API integration | Deep integration with Google Cloud |
| HuggingFace Inference | Free (limited) or PRO plan | Lightweight app testing | Fastest to get started, no local GPU required |
| Kaggle Notebooks | Free (GPU included) | Data Science Experiments | Zero-cost access for Kaggle users |
The quantized version of Gemma 2 2B can barely run on the CPU and runs smoothly on a MacBook (M chip) or RTX 3060. It is one of the most powerful options among "AI models that can be run on a laptop." The hardware requirements of the Gemma 2B/9B result in significantly lower development costs compared to larger scale models requiring an A100.
Main functions
- Gemma 2 multi-scale pre-training model (Base): Provides a basic pre-training model without instruction fine-tuning, suitable for researchers to conduct secondary fine-tuning in specific tasks or fields. The three scales of 2B/9B/27B cover different computing power scenarios from terminal-side deployment to high-performance servers.
- Gemma 2 Instruction fine-tuned version (Instruct): A conversational version trained with instruction following and safe alignment. It can be used in chat assistants and Q&A applications out of the box. It can obtain high-quality natural language interaction capabilities without additional fine-tuning.
- Ultra-high parameter efficiency of knowledge distillation optimization: Gemma 2 achieves significantly leading benchmark test results in the same parameter scale by obtaining parameter efficiency from larger-scale Gemini models (27B distilled from Gemini, 9B/2B distilled from 27B). This "distillation chain" strategy is the core technological innovation of the Gemma series.
- CodeGemma (code-specific variant): A Gemma variant specifically optimized for code completion, code generation and mathematical reasoning. It provides two specifications: 2B (code filling) and 7B (instruction version). The performance of code tasks is better than the general Gemma model of the same scale.
- PaliGemma (visual language multi-modal version): A multi-modal Gemma variant that supports image understanding. It can handle mixed input of images and text, perform image description, visual question answering and document understanding tasks. It is a representative of Google's lightweight multi-modal open source model.
- Apache 2.0 Unrestricted Commercial License: All Gemma models follow the Apache 2.0 license and can be freely used, modified and distributed in commercial products of any size, with no restrictions on the number of users or income. It is one of the most liberal open source LLM commercial licenses.
- Google Colab zero-configuration experience: Google provides an official Colab notebook for Gemma. Users can run Gemma directly in the browser without a local GPU. It is the lowest entry point for AI learners and data scientists to experience Gemma.
- Kaggle Ecological Deep Integration: Gemma is deeply integrated into the Kaggle platform and supports participation in Kaggle competitions and
Direct calls in notebooks and a unique distribution channel for the data science community form a unique niche that differentiates Gemma from other open source LLMs.
Model and version evolution
| Version | Release Date | Description |
|---|---|---|
| Gemma 1.0 (2B/7B) | 2024-02-21 | Google’s first Gemma release, basic version + command version, Apache 2.0 license |
| CodeGemma (2B/7B) | 2024-04-09 | Code-specific variants, code filling and generation optimization |
| Gemma 1.1 (2B/7B updated version) | 2024-04-05 | Commands follow quality improvements, fix dialogue issues in version 1.0 |
| RecurrentGemma (2B/9B) | 2024-04 | Efficient inference variant based on linear recursive architecture, suitable for edge devices |
| PaliGemma (3B multi-modal) | 2024-05 | Visual language model to support image understanding tasks |
| Gemma 2 (2B/9B/27B) | 2024-06-27 | Second generation, knowledge distillation optimization, greatly improved performance, 27B is close to GPT-4 Turbo |
| Gemma 2 JetBrains/Ollama | 2024-08 | Mainstream IDEs and local inference tools support Gemma 2, and the ecosystem continues to expand |
Technical advantages
Ultra-high parameter efficiency brought by the knowledge distillation chain: The technical core of Gemma 2 is multi-level knowledge distillation - 27B is distilled from the larger Gemini, and 9B and 2B are distilled from 27B. This distillation chain enables each size of Gemma 2 model to achieve a performance level far beyond its parameter size. It is the technical reason why Gemma 2 9B surpassed Llama 3 70B on the HuggingFace Open LLM Leaderboard, and reflects Google DeepMind's leading research results in the field of model compression and knowledge transfer.
Apache 2.0's loosest commercial license: Compared with Llama's Meta Llama License (special authorization is required for over 700M MAU), Gemma's Apache 2.0 license has no restrictions on any commercial use. Developers and enterprises can integrate Gemma into commercial products of any scale without worrying about triggering license restrictions as business grows, reducing the legal compliance risks of enterprises using open source LLM.
Tight integration with Google infrastructure: Gemma is a native support model for Google Cloud, Vertex AI, Colab, and Kaggle, with optimal access and tool support on these platforms. For enterprises that have adopted Google Cloud for their cloud infrastructure, using Gemma provides the deepest integration with the Google ecosystem, including Vertex AI's managed fine-tuned Model Registry and security monitoring capabilities.
Small-scale high-performance end-side deployment value: Gemma 2 2B is one of the best-performing 2B parameter-scale open source models currently. It can run locally on a medium-configuration Android phone (with the Google AI Edge framework) and provides practical local LLM capabilities for end-side AI applications (offline voice assistant, privacy protection device-side processing, etc.). It is an important differentiating advantage of Gemma compared to Llama (minimum 8B).
How to use
| Entrance | Description |
|---|---|
| HuggingFace | Visit https://huggingface.co/google/gemma-2-9b to request access and download the model |
| Kaggle | Use Gemma for free in Kaggle notebooks, including GPU acceleration |
| Google Colab | Use Google's official Colab notebook to run without a local GPU |
| Ollama (local) | ollama run gemma2:9b One-click local deployment |
| Vertex AI | Access Gemma API service via Google Cloud Vertex AI |
Typical usage steps (HuggingFace connected to Gemma 2):
- Visit https://huggingface.co/google/gemma-2-9b, log in to your HuggingFace account and accept the usage agreement (Apache 2.0, no additional restrictions).
- Install dependencies:
pip install transformers accelerate. - Use HuggingFace Transformers to load the model:
from transformers import AutoTokenizer, AutoModelForCausalLM. - Load the Tokenizer and model (requires at least 20GB of video memory to run 9B model, 2B is about 6GB), or use the quantized version to reduce video memory requirements.
- Write inference code and use
model.generate()to generate text. The Gemma command version follows the<start_of_turn>user ... <end_of_turn>conversation format. - If fine-tuning is required, it is recommended to use HuggingFace TRL + LoRA for efficient fine-tuning of parameters.
Product Pricing
Gemma model weights are completely free, and the cost of using each platform is different:
- Model weight download: completely free, Apache 2.0 license, no commercial restrictions, can be downloaded directly from HuggingFace or Kaggle, no special application required.
- Local Deployment: Only hardware cost, Gemma 2 2B runs smoothly on RTX 3060 (12GB), 9B requires RTX 3090 (24GB) or multi-card deployment.
- Kaggle Notebooks: Kaggle free account provides limited GPU quota (about 30 hours/week T4 GPU), which can run Gemma experiments and get started at zero cost.
- Google Colab: The free version provides limited GPU usage, and Colab Pro (approximately $10/month) provides more GPU resources and is suitable for medium-scale experiments.
- Google Cloud Vertex AI: Commercial API services are billed by Token. For specific prices, please refer to the Google Cloud official price page. It provides managed inference services for enterprise-level applications.
Application scenarios
-
Mobile and edge device AI functions: Gemma 2 2B’s compact design is optimized for end-side deployment. It can run locally on mid-to-high-end Android devices through the Google AI Edge framework. It supports offline intelligent assistants, real-time text processing and privacy-protecting device-side NLP functions. It is the preferred open source solution for mobile applications that require offline AI capabilities.
-
AI deployment with limited resources: AI applications in embedded systems, edge servers, and low-computing cloud instances use the Gemma 2B/9B quantized model to provide practical text generation and question-answering capabilities within limited GPU memory (8-16GB). It is an ideal choice to maximize AI capabilities when hardware conditions are limited.
-
AI Learning Experiment for Students and Researchers: Accessing Gemma through Kaggle notebooks (free GPU), data science students can experience the complete LLM fine-tuning, evaluation and deployment process at zero cost. The Apache 2.0 license ensures that academic research results can be freely published and commercialized, making it one of the most barrier-free open source LLMs for AI education.
-
AI integration for Google Cloud enterprises: Enterprises that have adopted Google Cloud use Gemma on Vertex AI to enjoy the deepest integration with Google infrastructure, managed fine-tuning service Model Registry version management and enterprise-grade security compliance capabilities, combining the cost advantages of open source models with the engineering reliability of Google Cloud.
-
Code-assisted tool development: Use CodeGemma 7B to build privatized code completion and code review tools, deploy them locally or on the intranet, and avoid code transmission through cloud services such as GitHub Copilot. The Apache 2.0 license ensures that code tools can be commercialized freely, which is suitable for software companies with intellectual property protection needs.
Applicable people
- Data Scientists and Kaggle Competition Participants: The Kaggle platform’s deep integration and free GPU access make Gemma a natural choice for this group, fitting seamlessly into existing workflows.
- Mobile and client-side AI developers: For Android developers who need to run LLM on the device, the combination of Gemma 2B and Google AI Edge is currently the most mature client-side LLM development solution.
- Enterprises requiring an Apache 2.0 license: For enterprises that have legal concerns about Llama's Meta Llama License and require a more relaxed open source license, Gemma for Apache 2.0 provides worry-free commercial use guarantees.
- Google Cloud Users: Teams that have deployed Google Cloud infrastructure can use Gemma on Vertex AI to get the best integration experience and enterprise-grade support.
- Unsuitable Scenarios: Applications that require ultra-long context processing (>8K Token) (Gemma 2 context window is relatively small, Llama 3.1's 128K is more suitable); production-level applications that require the highest performance (Gemma 27B is stronger than competing products of the same scale, but there is still a gap compared to Llama 3.1 405B or GPT-4); teams that already have a stable Llama technology stack and have no motivation to migrate.
Summary and Outlook
The Gemma series represents Google's strategic layout in the field of open source AI - by releasing Gemini's top research results to the developer community in the form of an open license, it not only promotes the popularity of AI, but also attracts a large number of developers to the Google ecosystem (Cloud, Colab, Kaggle). The ultra-high parameter efficiency brought by the knowledge distillation chain is Gemma's most important technical differentiation point, enabling small-scale models to have performance that exceeds the expected performance of parameter scale.
The choice of the Apache 2.0 license reflects Google's sincere commitment to the open source community. It is more open than Meta's Llama License, forming a unique advantage in the enterprise market that is sensitive to legal compliance.
Follow-up focus: The parameter scale expansion and multi-modal capability enhancement (visual, audio) of the Gemma 3 series, the functional evolution of the PaliGemma visual language model, the perfection of Google AI Edge’s device-side deployment ecosystem, and its differentiated positioning with Gemini Nano (device-side Gemini) will determine Gemma’s long-term position in the open source LLM competition landscape.
Related tools: hugging-face, replicate
Version Info
- Gemma 2(2B/9B/27B) :Gemma 2 is officially released, with three parameter sizes of 2B, 9B and 27B. It uses knowledge distillation technology to compress large model capabilities into small models. In mainstream benchmark tests such as LMSys Chatbot Arena, Gemma 2 27B is close to the GPT-4 Turbo level, and the 9B version surpasses all open source models of the same scale. All versions follow the Apache 2.0 license and are free for commercial use; at the same time, in HuggingFace, Kaggle and Google Cloud The three major channels are released simultaneously, which greatly reduces the access threshold.
- Gemma 1.1 (2B/7B updated version) :The updated version of Gemma 1.1 was released. Special improvements were made to address the instruction following quality issues reported by users in Gemma 1.0, and the dialogue capabilities of the instruction version (Instruct) were greatly improved. At the same time, CodeGemma (2B/7B code-specific version) and RecurrentGemma (high-efficiency reasoning variant) were officially launched, extending the Gemma model family to professional scenarios such as code generation.
- :Google released the Gemma open source model series for the first time, launching pre-training version (Base) and instruction fine-tuning version (Instruct) in two sizes: 2B and 7B. Based on the distillation of Gemini model research results, it achieved leading results in open source model benchmark tests of the same parameter scale. It provides three access channels: HuggingFace, Kaggle and Google Colab, and releases a responsible AI usage toolkit.
User Reviews