google /
gemma-4-31B-it
Google DeepMind's 31B open model that reads text and images, reasons, writes code, and calls tools.
- 4.2k likes
- 8.4M downloads a month
- 31B parameters
- Some experience
- Vision & language
Gemma 4 31B-it is a 30.7B-parameter dense model with 60 layers and a context window of up to 256K tokens. It accepts text and images (including video handled as a sequence of frames) and writes text back. The card says it is built for reasoning, coding, multimodal understanding and agent-style work, and it supports a native system role and function calling. It is trained on more than 140 languages, with out-of-the-box support for 35+.
Compared with the smaller Gemma 4 models, it is the strongest in the card's benchmark table: for example 85.2% on MMLU Pro and 80.0% on LiveCodeBench v6, against 67.6% and 29.1% for Gemma 3 27B. The limits are practical. At 31B parameters it needs a serious GPU, and the card does not give hardware requirements. It does not handle audio (only E2B, E4B and 12B do). Video is limited to 60 seconds at one frame per second. Training data stops at January 2025, and benchmark scores are the authors' own numbers, so test it on your own task.
What you need to run it
31B parameters. The weights take about 63 GB at full 16-bit precision (fits a 128 GB Mac or a GPU with 128 GB), or about 19 GB as a 4-bit download, which runs on a 24 GB Mac or a GPU with 24 GB. Long inputs and images need more memory on top.
What it does well
Strong benchmark results for the family
In the card's table, 31B tops the Gemma 4 sizes on most tests, such as 89.2% on AIME 2026 (no tools), 84.3% on GPQA Diamond and a Codeforces ELO of 2150.
Thinking mode you can switch on or off
The model can reason step by step before answering. In the Transformers example you set enable_thinking=True to turn it on; the card's example sets it to False.
Long context
It supports up to 256K tokens of context, using a mix of local sliding-window attention (1024 tokens) and global attention to keep memory use down.
Images, documents and tools
It handles OCR, document and PDF parsing, charts, UI screenshots and handwriting, with a choice of image token budgets (70 to 1120) to trade detail for speed. It also supports native function calling.
Permissive licence and standard tooling
It is Apache 2.0 and works with the Hugging Face Transformers library.
What you could build
- Build a document reader that extracts text and answers questions from scanned pages, charts or screenshots.
- Make a coding helper that writes, completes and fixes code, with thinking mode on for harder problems.
- Create a tool-using agent that calls your own functions through native function calling.
- Summarise or search a very long document or codebase that fits within the 256K-token context.
- Write a short-clip describer that feeds video frames (up to 60 seconds) to the model and asks what happens.
Get started
Install the libraries, then load the model with AutoProcessor and AutoModelForMultimodalLM using the model ID google/gemma-4-31B-it, as in the card's Python example. Build a messages list, run apply_chat_template, and call model.generate. The card suggests temperature=1.0, top_p=0.95 and top_k=64.
pip install -U transformers torch acceleratepip install -U transformers torch torchvision accelerateCommands are copied from the model card. Read it on Hugging Face for the full setup.