How to Run CellGemma Locally: Install and VRAM Needs
Install Google DeepMind's CellGemma on one GPU: setup steps, about 16 GB VRAM use, and sample predictions for panobinostat and a MYC knockdown.
For Engineering and Data & Analytics

How do you run CellGemma locally?
You run CellGemma by installing a few Python packages (transformers, torch, accelerate, safetensors, huggingface_hub), loading the google/cellgemma-e4b model from Hugging Face in bfloat16, and feeding it a text prompt that describes a cell and a perturbation. In one hands-on test on a 48 GB GPU, the loaded model used just under 16 GB of VRAM. The model is released under Apache 2.0. It is built for research, not for diagnosis or treatment.
TL;DR
- CellGemma is a small open model from Google DeepMind, built on Gemma 4 E4B, that predicts how human cells respond to drugs, gene edits, and immune signals.
- Setup is a single pip install plus loading the model from Hugging Face. The model card gives working example code.
- VRAM use was just under 16 GB in one test on a 48 GB card. That fits the 8 billion total parameters stored in bfloat16 (two bytes each).
- The output is a ranked list of genes marked
+GENE(turned up) or-GENE(turned down), not a chat answer. A small second-stage decoder converts that list into numbers. - The test run took about 10 minutes for a drug (panobinostat) and a MYC gene knockdown, and printed the top 10 genes up and down for each.
- This is a research tool. Do not use it for diagnosis or treatment decisions.
What is CellGemma?
CellGemma is a lightweight open model from Google DeepMind. It is built on the Gemma 4 E4B architecture and fine-tuned to predict how a cell's gene activity changes after a "perturbation." A perturbation is anything you do to a cell: add a drug, switch off a gene (a knockdown or CRISPR edit), or expose it to an immune signal such as a cytokine.
It is not a chatbot. The model card describes it as non-conversational. Its vocabulary was extended with about 20,000 human protein-coding gene symbols, so each gene is a single token instead of being split into word fragments.
Google's own framing, as described in coverage of the release, is that researchers can narrow down which experiments are worth running in the lab. The reported example: drugs the model picked were later tested, and they helped CAR T therapy (immune cells trained to hunt cancer) eliminate resistant thyroid cancer cells in a lab dish.
How does CellGemma predict a cell's response?
It works in two stages.
- Stage 1, the language model. You give it the baseline cell as a ranked list of its top 1,000 expressed genes, the perturbation details, and a "mean shift" prediction. The mean shift captures the general response many treatments share. CellGemma only predicts the residual, meaning what is specific to this perturbation. It outputs a ranked list of genes,
+GENEfor up and-GENEfor down. - Stage 2, the ExpressionDecoder. A small dataset-specific network turns that ranked list, plus the baseline, into continuous expression values and log-fold change numbers.
One CellGemma checkpoint covers all datasets and perturbation types. The decoders are separate per dataset. The repository includes pretrained decoders for small-molecule data (tahoe, l1000, emeraldbay, sciplex), CRISPR data (nadig/replogle, vcc, norman), and cytokine and clinical data (parse, dong, tisch).
What do you need to run it?
Key specs from the model card:
| Property | Value |
|---|---|
| Base architecture | Gemma 4 E4B |
| Total parameters | 8B with embeddings |
| Effective parameters | 4.5B |
| Context length | 16K tokens |
| Input and output | Text in, ranked gene list out |
| License | Apache 2.0 |
Hardware: the sources confirm one data point. On a 48 GB VRAM GPU, the model loaded fully and used just under 16 GB, with the full prompt context. Whether a smaller card works was not tested in the sources, so check your own headroom before planning around it. The prompt itself is long, since it contains two lists of up to 1,000 genes each, so leave room beyond the weights.
You also need a Python environment. The tester used a uv environment, but a standard virtual environment works the same way.
How do you install CellGemma step by step?
Step 1. Create a clean environment with uv or venv, then install the dependencies from the model card:
pip install -U transformers torch accelerate safetensors huggingface_hub
Step 2. Load the model in bfloat16 and let accelerate place it on your GPU:
from transformers import AutoModelForCausalLM, AutoTokenizer
import torch
MODEL_ID = "google/cellgemma-e4b"
tokenizer = AutoTokenizer.from_pretrained(MODEL_ID)
model = AutoModelForCausalLM.from_pretrained(
MODEL_ID, device_map="auto", dtype=torch.bfloat16
).eval()
Step 3. Load an ExpressionDecoder. The model card defines an ExpressionDecoder class and a load_decoder(name) helper that downloads the decoder config, weights, and global mean deltas from the same Hugging Face repo. Copy those from the model card rather than rewriting them.
Step 4. Build the prompt. The card's example uses a fixed preamble, the perturbation text, the baseline cell (Source:), the mean-shift list (Mean Global prediction:), and ends with Target: . A sample control cell comes from controls_sample.json in the repo, so you can test without your own data.
Step 5. Generate. The card's example wraps the prompt in the model's turn format and samples at temperature 0.7 with up to 8,192 new tokens. Because it samples, expect some variation between runs.
The simplest path is to start from the model card script and change only the perturbation text.
What did the test results look like?
A creator ran the model card's approach on a sample untreated cell and applied two virtual experiments. The script printed the top 10 genes that went up and down for each, plus GPU memory used. It took about 10 minutes to finish.
Test 1: the drug panobinostat. The model predicted stress-helper genes, including an HSP90-family gene, rising. Genes linked to cell signaling and movement, such as SMAD3, fell.
Test 2: a MYC knockdown. MYC is a powerful growth switch. In the leukemia cell setup, red blood cell genes went up and genes that help build the cell's protein factories went down. The creator read that as the cell slowing its growth and leaning toward a red blood cell identity. That is a lay interpretation, not a validated finding.
Output is gene names with plus and minus signs, relative to the average response. That is why you need the decoder if you want numbers.
How accurate is CellGemma?
The model card reports Pearson Δ scores on 10 perturbation benchmarks across 32 held-out splits, always compared with a mean-shift baseline. It beats the baseline in nearly every split listed, with gaps that vary a lot. For example:
| Dataset and split | CellGemma | Mean shift baseline |
|---|---|---|
| Tahoe, unseen perturbation | 0.56 | 0.26 |
| Norman, both genes seen | 0.74 | 0.53 |
| TISCH, cross-study | 0.28 | 0.05 |
| VCC, unseen perturbation | 0.16 | 0.11 |
So it is clearly better than the baseline in some settings and only slightly better in others. Treat a prediction as a way to prioritize experiments, not as a result.
What does this mean for you?
If you are a computational biologist or a lab scientist, this is a model you can try on a single workstation GPU and ask "which perturbations are worth testing first." Start with a dataset the repo already has a decoder for, and compare against the mean-shift baseline, as the model card does.
If you work in biotech or pharma in a non-research role (operations, strategy, procurement), the point is cost and access. A small open model under Apache 2.0 means a team can run these predictions in-house instead of renting a closed service.
If you are a curious non-expert, you can follow the install, but remember the output is gene lists for specialists. The creator who ran the test was clear that this is for research only, not for everyday people, and that nobody should use such models for diagnosis or treatment. Talk to a qualified physician for health decisions.
Practical advice: log everything. Because sampling varies between runs, note the perturbation text, the decoder, the temperature, and the VRAM you saw.
Could a small internal tool help you track CellGemma runs?
If you run many predictions, a spreadsheet of prompts, decoders, settings, and results gets messy fast. A small internal app can hold that instead: a run log with a form for each experiment, a table of top up and down genes, and a page comparing runs. You can describe that to Remy in plain English and it builds and deploys the full-stack app, with a database and sign-in, so a lab or team shares one place rather than scattered files. Remy builds web apps, so the model itself would still run on your own GPU.
Frequently Asked Questions
How much VRAM does CellGemma need?
In the one test described in the sources, the model used just under 16 GB of VRAM on a 48 GB card, loaded in bfloat16 with the full context. That matches an 8 billion parameter model at two bytes per parameter. Smaller cards were not tested in the sources.
Is CellGemma free to use?
Yes. It is released under the Apache 2.0 license and available on Hugging Face as google/cellgemma-e4b. You supply your own GPU, either a local workstation or a rented one.
Can I chat with CellGemma?
No. The model card calls it non-conversational. It takes a structured prompt (perturbation, baseline cell, mean-shift list) and returns a ranked list of genes marked up or down.
Can CellGemma be used for medical advice?
No. It is a research model. The reviewer in the source material stressed that it should never be used for diagnosis or treatment, and that any health question belongs with a qualified physician.
Why did the test take about 10 minutes?
The sources do not break down the time. The prompt includes two long gene lists and the example allows up to 8,192 new tokens, which likely contributes. Treat 10 minutes as one observed run on one setup, not a benchmark.
How we source, write, and correct our articles. Editorial standards



