Running google/cellgemma-e4b on 8 GB Consumer GPUs + Independent Name-vs-SMILES Audit & Cross-Decoder 4-Bit Benchmark

#5
by machine2239 - opened

Hi everyone! Sharing an open-source Apache 2.0 8 GB consumer-GPU loader plus the first independent mechanistic & quantization audit of google/cellgemma-e4b (156 total predictions across RTX 2080 4-bit and Colab L4 native 16-bit bfloat16):

GitHub Repo (loader, Colab notebooks, JSONs, charts): https://github.com/tinhnhatpham/cellgemma-8gb-immunotherapy
Zenodo Permanent DOI: https://doi.org/10.5281/zenodo.24736448

1. Fitting cellgemma-e4b in 3.5 GB Base / 5.6 GB Peak VRAM (zero os error 1455 on Windows)

  • model.embed_tokens_per_layer.weight is 6.07 GB (282,240 × 10,752 BF16). On 16 GB RAM Windows PCs, mapping all 3 .safetensors shards simultaneously triggers OSError: os error 1455 / MemoryError, and casting Gemma 4 to float16 overflows logits to NaN.
  • cellgemma_8gb.py streams all 664 non-PLE tensors one-by-one into bitsandbytes 4-bit NF4 (bfloat16 compute, <200 MB loading RAM) and serves the PLE table directly from SSD via a zero-mmap FileSeekScaledEmbedding (reading only the active 21 KB token rows, preserving Gemma 4's exact sqrt(256) = 16.0 scale factor).
  • Tested on Windows 11 + NVIDIA RTX 2080 (8 GB VRAM) + 16 GB RAM at ~4.7–5.1 tok/s (52–60s per cell).

2. Independent Causal Audit: Does CellGemma Read SMILES or Memorize Drug Names? (Exp 7A, n = 3 Tahoe cells)

We ran adversarial Name↔SMILES swap and zero-dose ablations on Panobinostat vs. Ruxolitinib/Ethanol (CCO):

  • 100% SMILES-grounded (zero drug-name shortcut!): Hiding the name (Compound_X + Panobinostat SMILES: +43.3, Top-30 Jaccard 49.8%) or even actively lying with the negative control's name (Ruxolitinib + Panobinostat SMILES: +44.7, Jaccard 49.5%) reproduced 100% of Panobinostat's canonical program (CALR +0.14/+0.16, HSP90B1 +0.16/+0.17, H1-0 +0.10/+0.12, SMAD3 -0.16/-0.15), matching the true pair (+44.3). Conversely, keeping "Panobinostat" with ethanol (CCO) or Ruxolitinib SMILES collapsed identically to null (+2.3 / +6.4, Jaccard 2.6–6.3%).
  • Calibration warning — 0.0 uM zero-dose leakage: Prompting with Concentration: 0.0 uM cleared CALR, H1-0, and SMAD3, but leaked HSP90B1 +0.10 and 21.8% residual overlap (COMP +11.5), behaving like an ultra-low positive dose (~0.05 uM). Avoid 0.0 uM as a vehicle baseline; use an explicit inert SMILES control instead.

Experiment 7A: Name vs SMILES vs Zero-Dose Causal Audit

3. Cross-Decoder 4-Bit vs. Native 16-Bit bfloat16 Benchmark (tahoe + k562)

  • Chemical (tahoe, n = 10 paired Panobinostat vs. Ruxolitinib): 4-bit RTX 2080 (3.5 GB) matched Native 16-bit Colab L4 (15.4 GB) 10-for-10 (t-test p = 9.72e-06 vs 6.61e-08), matching marker means closely (HSP90AA1: +0.1817 vs +0.1814, SMAD3: -0.1800 vs -0.1755, CALR: +0.1300 vs +0.1478, B2M: +0.0577 vs +0.0577).
  • Genetic CRISPRi (k562, 18 knockdowns × 11 markers = 66 pairs, Exp 7B): 4-bit achieved Pearson r = 0.9669 (p = 1.07e-39, MAE = 0.0089 Δ log1p) against Native 16-bit BF16, preserving on-target HDAC1 KD (-0.192 vs -0.222), HDAC6 -> SLC3A2/DDIT4/PHGDH/MAP1B, and HDAC2 -> HBZ/HBG2/HBA1 (with MYC on-target attenuated in 4-bit while downstream erythroid markers remained intact).

Experiment 7B: Cross-Decoder K562 4-Bit vs Native BF16 Benchmark

(All scripts, Colab notebooks, and 156 raw JSON predictions are Apache 2.0 — feedback and replication tests on other decoders very welcome!)

Thanks for the detailed field report. The 8 GB loader numbers are the useful part: 3.5 GB base and 5.6 GB peak on an RTX 2080, with the per-layer embedding table served from SSD instead of mapped in RAM. The name-versus-SMILES audit is equally valuable: the response follows the SMILES rather than the drug name, and the 0.0 uM leakage warning (HSP90B1 still moving, 21.8 percent residual overlap) is a calibration point worth heeding, an explicit inert control beats a zero-dose prompt as a baseline. The 4-bit versus native 16-bit parity on the CRISPRi set (Pearson r = 0.9669) makes the small-hardware route credible. We appreciate the open loader, notebooks and data.

Sign up or log in to comment