Instructions to use Akkermansia/cellgemma-e4b-gguf with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- llama.cpp
How to use Akkermansia/cellgemma-e4b-gguf with llama.cpp:
Install (macOS, Linux)
curl -LsSf https://llama.app/install.sh | sh # Start a local OpenAI-compatible server with a web UI: llama serve -hf Akkermansia/cellgemma-e4b-gguf:Q4_K_M # Run inference directly in the terminal: llama cli -hf Akkermansia/cellgemma-e4b-gguf:Q4_K_M
Install from WinGet (Windows)
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama serve -hf Akkermansia/cellgemma-e4b-gguf:Q4_K_M # Run inference directly in the terminal: llama cli -hf Akkermansia/cellgemma-e4b-gguf:Q4_K_M
Build from source code
git clone https://github.com/ggml-org/llama.cpp.git cd llama.cpp cmake -B build cmake --build build -j --target llama-app # Start a local OpenAI-compatible server with a web UI: ./build/bin/llama serve -hf Akkermansia/cellgemma-e4b-gguf:Q4_K_M # Run inference directly in the terminal: ./build/bin/llama cli -hf Akkermansia/cellgemma-e4b-gguf:Q4_K_M
Use Docker
docker model run hf.co/Akkermansia/cellgemma-e4b-gguf:Q4_K_M
- Llama new
- LM Studio
- Jan
- Ollama
How to use Akkermansia/cellgemma-e4b-gguf with Ollama:
ollama run hf.co/Akkermansia/cellgemma-e4b-gguf:Q4_K_M
- Unsloth Desktop
- Docker Model Runner
How to use Akkermansia/cellgemma-e4b-gguf with Docker Model Runner:
docker model run hf.co/Akkermansia/cellgemma-e4b-gguf:Q4_K_M
- Lemonade
How to use Akkermansia/cellgemma-e4b-gguf with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull Akkermansia/cellgemma-e4b-gguf:Q4_K_M
Run and chat with the model
lemonade run user.cellgemma-e4b-gguf-Q4_K_M
List all available models
lemonade list
- Atomic Chat
Install from WinGet (Windows)
winget install llama.cpp
# Start a local OpenAI-compatible server with a web UI:
llama serve -hf Akkermansia/cellgemma-e4b-gguf:# Run inference directly in the terminal:
llama cli -hf Akkermansia/cellgemma-e4b-gguf:Build from source code
git clone https://github.com/ggml-org/llama.cpp.git
cd llama.cpp
cmake -B build
cmake --build build -j --target llama-app# Start a local OpenAI-compatible server with a web UI:
./build/bin/llama serve -hf Akkermansia/cellgemma-e4b-gguf:# Run inference directly in the terminal:
./build/bin/llama cli -hf Akkermansia/cellgemma-e4b-gguf:Use Docker
docker model run hf.co/Akkermansia/cellgemma-e4b-gguf:
CellGemma E4B — GGUF (google/cellgemma-e4b)
GGUF conversions and quantizations of Google DeepMind's google/cellgemma-e4b for llama.cpp.
Note: CellGemma is a non-conversational model that takes a structured baseline gene-expression prompt and outputs ranked residual differentially expressed genes (
+GENE/-GENE). For continuous expression and log-fold change (LFC) reconstruction, pair these GGUFs with the dataset-specificExpressionDecodercheckpoints and helper assets (decoders/,controls_sample.json,kg_sentences.json) fromgoogle/cellgemma-e4b.
Available Files
| File | Quantization | File Size | Notes |
|---|---|---|---|
cellgemma-e4b-bf16.gguf |
BF16 |
14.4 GB | Exact lossless unscaled bf16 conversion. Recommended GGUF |
cellgemma-e4b-scaled-q8_0.gguf |
Q8_0 |
7.7 GB | Highest fidelity among quantized variants. |
cellgemma-e4b-scaled-q4_k_m.gguf |
Q4_K_M |
5.1 GB | Smallest variant; suitable for rapid coarse screening or constrained hardware. |
Important Fixes Included in These GGUFs
Gene-Native Tokenizer Fix (
token_type = USER_DEFINED):google/cellgemma-e4bextends the Gemma 4 vocabulary with 20,256 human protein-coding gene symbols. Standardconvert_hf_to_gguf.pyexports these added tokens withtoken_type = NORMAL(1) andscore = -1000.0, causingllama.cppto split gene symbols into subword pieces. In all GGUFs here, the 20,256 added gene tokens have been patched totoken_type = USER_DEFINED(4), achieving exact token-for-token parity with Hugging FaceAutoTokenizeron plain text prompts.RMSNorm-Absorbed Power-of-2 Rescaling (for
Q8_0/Q4_K_M): Early Gemma 4 MLP and Per-Layer Embedding (PLE) projections produce large intermediate activations (peaking >100M in layer 1 MLP) before normalization, which causesfp16overflow (NaN→<pad>token0) in quantizedggml-cudakernels on Turing (sm_75) and similar GPUs. Because Gemma 4 places scale-invariant RMSNorms (post_ffw_norm,post_norm) immediately after these projections, the quantized GGUFs were produced from a power-of-2 rescaledbf16intermediate (ffn_up,ffn_down, andprojweights across the high-magnitude layers). As shown below, this rescaling is virtually lossless (0.992Residual r,1.00 / 1.00Top-20 DEG overlap vs. unscaledbf16) while eliminating<pad>/ NaN overflows completely.
Quantization Fidelity Evaluation
Evaluated across 10 diverse perturbations (5 small-molecule drugs across 5 tahoe control cells: Panobinostat, Vorinostat, Trametinib, Sirolimus, Dexamethasone; plus 4 single and 1 dual combinatorial CRISPR knockdowns across 5 k562 control cells: MYC, TP53, EGFR, BCL2, CEBPE+KLF1), using greedy decoding (temperature=0.0, repeat_penalty=1.0, 512 generated tokens per prompt = up to 256 DEGs/prompt) and Stage 2 ExpressionDecoder reconstruction.
Metric note: Because
Total LFCincludes the dataset mean-shift baseline (mean_delta_global), Residual r (Pearson correlation ofpredicted_expr - baselineagainst the unscaledbf16GGUF reference, where a collapsed model scores0.00) and Top-20 Up/Down DEG overlap are the primary measures of quantization fidelity.
| Variant | File Size | <pad> / NaN Tokens (across 10 prompts) |
Residual r (mean ± std) | Total LFC r | Top-20 Up / Down Overlap | All-256 DEG Jaccard Up / Down |
|---|---|---|---|---|---|---|
bf16 (unscaled reference) |
14.4 GB | 0 | 1.0000 ± 0.000 |
1.0000 |
1.00 / 1.00 |
1.00 / 1.00 |
bf16_scaled (rescaling verification) |
14.4 GB | 0 | 0.9919 ± 0.022 |
0.9979 |
1.00 / 1.00 |
0.97 / 0.97 |
cellgemma-e4b-scaled-q8_0.gguf |
7.7 GB | 0 | 0.7701 ± 0.168 |
0.9371 |
0.89 / 0.83 |
0.58 / 0.70 |
cellgemma-e4b-scaled-q4_k_m.gguf |
5.1 GB | 0 | 0.6632 ± 0.258 |
0.9203 |
0.71 / 0.69 |
0.51 / 0.58 |
Usage with llama.cpp
Critical setting: Always pass
repeat_penalty = 1.0(--repeat-penalty 1.0in CLI or"repeat_penalty": 1.0in/completion).llama.cpp's default1.1penalizes the repeated+,-, and space tokens that separate every predicted gene.
Start llama-server
llama-server \
-m cellgemma-e4b-scaled-q8_0.gguf \
-c 8192 \
-ngl 99 \
--flash-attn on \
--port 8080
(Optional: to keep the 282K-vocab Per-Layer Embeddings table in host RAM and save GPU memory, add -ot "per_layer_token_embd.*=CPU".)
Query /completion (Python)
import json, urllib.request
# Build `prompt` using the exact template from google/cellgemma-e4b
formatted = f"<|turn>user\n{prompt}<turn|>\n<|turn>model\n"
payload = json.dumps({
"prompt": formatted,
"n_predict": 1024, # Official eval uses up to 8192
"temperature": 0.7, # Official eval uses 0.7 (or 0.0 for greedy)
"repeat_penalty": 1.0, # Required! Do not leave at 1.1
"stop": ["<turn|>", "<eos>"],
}).encode("utf-8")
req = urllib.request.Request(
"http://127.0.0.1:8080/completion",
data=payload,
headers={"Content-Type": "application/json"},
)
res = json.loads(urllib.request.urlopen(req).read())
print(res["content"])
License & Attribution
Original model by Google DeepMind (google/cellgemma-e4b), released under the Apache 2.0 license. Intended strictly for research use; not for clinical diagnosis or medical decision-making.
- Downloads last month
- 1,808
4-bit
8-bit
16-bit
Install (macOS, Linux)
# Start a local OpenAI-compatible server with a web UI: llama serve -hf Akkermansia/cellgemma-e4b-gguf:# Run inference directly in the terminal: llama cli -hf Akkermansia/cellgemma-e4b-gguf: