Model reference · open weights

gemma-2

LLMs Efficient-Large-Model Text gen 1 build Open, with conditions 149k dl/mo

gemma-2 is an open-weight language model from Efficient-Large-Model. gemma-2-2b-it (BF16) weighs 10.5 GB; the smallest configuration that runs it is RTX 4060 Ti 16 GB.

  • Gemma 2 is a family of lightweight, open-weight, decoder-only large language models from Google, designed for text generation tasks such as question answering, summarization, and reasoning.
  • The specific 2B variant contains 2.6 billion parameters and is available under the gemma license.
  • It is trained on 2 trillion tokens of English text and code, and its small size allows for deployment on resource-limited environments like laptops or desktops.

Summary of the Efficient-Large-Model/gemma-2-2b-it model card, 2026-10-01

What it is

Released byEfficient-Large-Model
Released2024-12-12
Parameters2.6B
VRAM10.5 GB for the weights

What it runs on

Memory and cards for gemma-2-2b-it (BF16)

10.5 GBweights, file size
53 MBcache per 1K tokens
436 MBwindow cache per request
805 MBruntime overhead, at least
8,192 tokenscontext max
CardRequests at onceContext maxMemory
8K each
RTX 3060 12 GB——11.6 GB
RTX 4060 Ti 16 GB4all 8K15.4 GB
RTX 3090 24 GB13all 8K23.4 GB
RTX 4090 24 GB13all 8K23.4 GB
RTX 5090 32 GB22all 8K31.0 GB
L40S 48 GB37all 8K44.0 GB
A100 80 GB76all 8K78.2 GB
H100 80 GB70all 8K78.1 GB
RTX PRO 6000 Blackwell 96 GB88all 8K93.8 GB
DGX Spark (GB10) 128 GB unified104all 8K107 GB
H200 141 GB139all 8K138 GB
B200 180 GB182all 8K176 GB
2× RTX 3060 12 GB
tensor parallel
12all 8K11.6 GB a card
2× RTX 4060 Ti 16 GB
tensor parallel
21all 8K15.4 GB a card
Memory needed at each load
Requests at once8K tokens each
112.1 GB
515.6 GB
818.2 GB
1625.2 GB
3239.2 GB
6467.1 GB

One card, with vLLM's small-card settings.

From the model card

What Efficient-Large-Model says about gemma-2

Read the model card

Model Page: Gemma

Resources and Technical Documentation:

  • [Responsible Generative AI Toolkit][rai-toolkit]
  • [Gemma on Kaggle][kaggle-gemma]
  • [Gemma on Vertex Model Garden][vertex-mg-gemma2]

Terms of Use: [Terms][terms]

Authors: Google

Model Information

Summary description and brief definition of inputs and outputs.

Description

Gemma is a family of lightweight, state-of-the-art open models from Google, built from the same research and technology used to create the Gemini models. They are text-to-text, decoder-only large language models, available in English, with open weights for both pre-trained variants and instruction-tuned variants. Gemma models are well-suited for a variety of text generation tasks, including question answering, summarization, and reasoning. Their relatively small size makes it possible to deploy them in environments with limited resources such as a laptop, desktop or your own cloud infrastructure, democratizing access to state of the art AI models and helping foster innovation for everyone.

Usage

Below we share some code snippets on how to get quickly started with running the model. First, install the Transformers library with:

pip install -U transformers

Then, copy the snippet from the section that is relevant for your usecase.

Running with the pipeline API
import torch
from transformers import pipeline

pipe = pipeline(
    "text-generation",
    model="google/gemma-2-2b-it",
    model_kwargs={"torch_dtype": torch.bfloat16},
    device="cuda",  # replace with "mps" to run on a Mac device
)

messages = [
    {"role": "user", "content": "Who are you? Please, answer in pirate-speak."},
]

outputs = pipe(messages, max_new_tokens=256)
assistant_response = outputs[0]["generated_text"][-1]["content"].strip()
print(assistant_response)
# Ahoy, matey! I be Gemma, a digital scallywag, a language-slingin' parrot of the digital seas. I be here to help ye with yer wordy woes, answer yer questions, and spin ye yarns of the digital world.  So, what be yer pleasure, eh? 🦜
Running the model on a single / multi GPU
# pip install accelerate
from transformers import AutoTokenizer, AutoModelForCausalLM
import torch

tokenizer = AutoTokenizer.from_pretrained("google/gemma-2-2b-it")
model = AutoModelForCausalLM.from_pretrained(
    "google/gemma-2-2b-it",
    device_map="auto",
    torch_dtype=torch.bfloat16,
)

input_text = "Write me a poem about Machine Learning."
input_ids = tokenizer(input_text, return_tensors="pt").to("cuda")

outputs = model.generate(**input_ids, max_new_tokens=32)
print(tokenizer.decode(outputs[0]))

You can ensure the correct chat template is applied by using tokenizer.apply_chat_template as follows:

messages = [
    {"role": "user", "content": "Write me a poem about Machine Learning."},
]
input_ids = tokenizer.apply_chat_template(messages, return_tensors="pt", return_dict=True).to("cuda")

outputs = model.generate(**input_ids, max_new_tokens=256)
print(tokenizer.decode(outputs[0]))
Running the model on a GPU using different precisions

The native weights of this model were exported in bfloat16 precision.

You can also use float32 if you skip the dtype, but no precision increase will occur (model weights will just be upcasted to float32). See examples below.

  • Upcasting to torch.float32
# pip install accelerate
from transformers import AutoTokenizer, AutoModelForCausalLM

tokenizer = AutoTokenizer.from_pretrained("google/gemma-2-2b-it")
model = AutoModelForCausalLM.from_pretrained(
    "google/gemma-2-2b-it",
    device_map="auto",
)

input_text = "Write me a poem about Machine Learning."
input_ids = tokenizer(input_text, return_tensors="pt").to("cuda")

outputs = model.generate(**input_ids, max_new_tokens=32)
print(tokenizer.decode(outputs[0]))
Running the model through a CLI

The local-gemma repository contains a lightweight wrapper around Transformers for running Gemma 2 through a command line interface, or CLI. Follow the installation instructions for getting started, then launch the CLI through the following command:

local-gemma --model 2b --preset speed
Quantized Versions through bitsandbytes
Using 8-bit precision (int8)
# pip install bitsandbytes accelerate
from transformers import AutoTokenizer, AutoModelForCausalLM, BitsAndBytesConfig

quantization_config = BitsAndBytesConfig(load_in_8bit=True)

tokenizer = AutoTokenizer.from_pretrained("google/gemma-2-2b-it")
model = AutoModelForCausalLM.from_pretrained(
    "google/gemma-2-2b-it",
    quantization_config=quantization_config,
)

input_text = "Write me a poem about Machine Learning."
input_ids = tokenizer(input_text, return_tensors="pt").to("cuda")

outputs = model.generate(**input_ids, max_new_tokens=32)
print(tokenizer.decode(outputs[0]))
Using 4-bit precision
# pip install bitsandbytes accelerate
from transformers import AutoTokenizer, AutoModelForCausalLM, BitsAndBytesConfig

quantization_config = BitsAndBytesConfig(load_in_4bit=True)

tokenizer = AutoTokenizer.from_pretrained("google/gemma-2-2b-it")
model = AutoModelForCausalLM.from_pretrained(
    "google/gemma-2-2b-it",
    quantization_config=quantization_config,
)

input_text = "Write me a poem about Machine Learning."
input_ids = tokenizer(input_text, return_tensors="pt").to("cuda")

outputs = model.generate(**input_ids, max_new_tokens=32)
print(tokenizer.decode(outputs[0]))
Advanced Usage
Torch compile

Torch compile is a method for speeding-up the inference of PyTorch modules. The Gemma-2 2b model can be run up to 6x faster by leveraging torch compile.

Note that two warm-up steps are required before the full in

Quoted from the model card on Hugging Face. The full card is behind the Hugging Face link above.

© 2026 AxForge · EU-hosted AI infrastructure Pricing Docs Trust Privacy Terms