Run this model with HF Jobs
Run google/cellgemma-e4b on Hugging Face's managed compute, monitor its progress, and retrieve the results when it's done.
Paste one of these prompts into your coding agent:
Fine-tune on my dataset
Use HF Jobs and TRL to fine-tune https://huggingface.co/google/cellgemma-e4b. Ask me which dataset to train on, then push the fine-tuned model to a new model repo. Run `hf jobs --help` first to learn the CLI.
Run batch inference
Use HF Jobs to run batch inference with https://huggingface.co/google/cellgemma-e4b on the inputs in a mounted HF Bucket. Ask me which Bucket to use, then write the outputs back to it and keep each input ID. Run `hf jobs --help` first to learn the CLI.
Evaluate on a benchmark
Use HF Jobs to evaluate https://huggingface.co/google/cellgemma-e4b. Ask me which benchmark to run, then save the scores and the per-example results to a new dataset repo. Run `hf jobs --help` first to learn the CLI.
Quantize for lower memory use
Use HF Jobs to create a 4-bit version of https://huggingface.co/google/cellgemma-e4b. Push it to a new model repo, then reload it from there and report its memory footprint. Run `hf jobs --help` first to learn the CLI.
Instructions to use google/cellgemma-e4b with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use google/cellgemma-e4b with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="google/cellgemma-e4b")# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("google/cellgemma-e4b") model = AutoModelForCausalLM.from_pretrained("google/cellgemma-e4b", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use google/cellgemma-e4b with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "google/cellgemma-e4b" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "google/cellgemma-e4b", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/google/cellgemma-e4b
- SGLang
How to use google/cellgemma-e4b with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "google/cellgemma-e4b" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "google/cellgemma-e4b", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "google/cellgemma-e4b" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "google/cellgemma-e4b", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use google/cellgemma-e4b with Docker Model Runner:
docker model run hf.co/google/cellgemma-e4b
Two silent inference pitfalls (PubChem/EmeraldBay Kekulé SMILES & 8,192-token Stage-2 tail flips) + 772-run benchmark
Sharing three reproducible inference findings across 772 bfloat16 runs at max_new_tokens = 8,192 that may be useful to document in the model card's Best Practices:
- PubChem /
EmeraldBayKekulé SMILES vs. RDKit Aromatic SMILES (p = 0.0078): Passing uppercase Kekulé SMILES (C1=CC=CC=C1— the default in PubChem andtahoebio/EmeraldBay'sdrug_metadata.parquet) instead of RDKit canonical aromatic SMILES (c1ccccc1) silently rotates or collapses Stage-1 predictions for the exact same molecule across 8/8 tested aromatic drugs (mean within-format cosine = +0.726vs.cross-format = +0.276; e.g.,Panobinostat +0.297,NVP-BHG712 +0.239,Sotorasib +0.065,Menadione +0.006). Canonicalizing viaChem.MolToSmiles(Chem.MolFromSmiles(s), isomericSmiles=True, canonical=True)restores expected behavior (lifting matched A549 HederageninGSE186218to#1 / 29against decoys andtahoe_mean_delta_global). 8,192-Token Cap Without EOS & Stage-2 Tail Sign Flips (Norman 2019,n = 131pairs):15.1%(tahoe),21.8%(norman), and29.3%(emeraldbay2-drug combos) reach8,192tokens without<eos>/<turn|>. At ~4,000 emitted genes,ExpressionDecoderextrapolates past its training rank range and assigns positive deltas up to+0.601to downregulated-GENEtokens; enforcing a 1-line sign clamp (+GENE >= 0,-GENE <= 0) lifts Norman 2019 (k = 3,S = 12,441) all-genePearson Δfrom+0.5016to+0.5560(+0.5811when capped at<= 256tokens).- Drug-Pair Prompt Order (
EmeraldBay,n = 20clinical 2-drug regimens): AtT = 0.7, reversing[Drug A, Drug B]to[Drug B, Drug A]drops residual cosine from+0.594to+0.408(p = 2.67e-5, e.g.,Trifluridine + Tipiracil:+0.647vs.+0.166), while post-hoc0.5 * (AB + BA)averaging improves Norman wet-labPearson Δ(+0.5016 -> +0.5325).
All 772 raw outputs and a <1s zero-dependency Python 3 stdlib verifier (Apache-2.0): https://github.com/dsugurtuna/cellgemma-chemistry-bench
Thanks for the 772-run benchmark, and for isolating the format issue so cleanly. The Kekulé versus aromatic SMILES result is the one that stays with us: the same molecule, a within-format cosine of +0.726 against +0.276 cross-format, with canonicalizing restoring the expected behaviour. Silent input-format effects like that are exactly what field reports catch and model cards rarely do. The 8,192-token tail sign flips matter for the same reason, and the sign clamp lifting Norman 2019 Pearson Δ from +0.5016 to +0.5560 gives a concrete check others can rerun. We also noted the drug-pair order effect. Useful data, clearly reported.
Thanks @emailfrom ! Quick v2.1 update (+128 calibration runs, 900 total) narrowing down both mechanisms, with summary figures now in the repo:
- SMILES fragility extends to atom traversal order within valid lowercase aromatic RDKit SMILES (
16 × 16FDA oncology panel, A549 Tahoe):Named (Name + RDKit)↔Blinded RDKit SMILES:16/16Top-1 (AUROC 1.000,cos +0.938)Named↔Name-Only (no SMILES):0/16Top-1 (AUROC 0.556,cos +0.194)Blinded RDKit↔Blinded Kekulé(PubChem / EmeraldBay default):7/16Top-1 (AUROC 0.761,cos +0.364)Blinded RDKit↔Blinded Random-Atom-Order Aromatic(Chem.MolToRandomSmilesVect):3/16Top-1 (AUROC 0.562,cos +0.214)
- Stage-2
ExpressionDecodersign inversion also occurs on normal natural-EOS runs and short outputs (not only8,192-token caps):- Across the
601 / 772runs that stopped cleanly before8,192tokens (using the official{0, 1}READMEreconstruct()code),50.8%of+GENEtokens decode< 0and31.9%of-GENEtokens decode> 0(24.1%of|residual|L1 mass inverted;58.7%on short256-token Norman outputs whereN ≈ 64sits well belowbn0.running_mean[2:4] = (454.1, 428.7)).
- Across the
Both figures and all tables reproduce directly from the raw outputs (<1s, Python 3 stdlib): https://github.com/dsugurtuna/cellgemma-chemistry-bench
Thanks for the v2.1 update, and for taking the total to 900 runs. The atom-order result sharpens the SMILES point for us: named and blinded RDKit stay at 16/16 Top-1, while random atom order drops to 3/16, so traversal order alone moves the prediction. The clean-stop check matters too — sign inversion across the 601 runs that stopped before 8,192 tokens, with 50.8% of +GENE tokens decoding below zero, shows the decoder issue is not only a tail-cap effect. Figures that reproduce from the raw outputs in under a second make both claims easy to verify.

