Instructions to use abhimanyu12/cellgemma-pairing-qc with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- PEFT
How to use abhimanyu12/cellgemma-pairing-qc with PEFT:
from peft import PeftModel from transformers import AutoModelForCausalLM base_model = AutoModelForCausalLM.from_pretrained("google/cellgemma-e4b") model = PeftModel.from_pretrained(base_model, "abhimanyu12/cellgemma-pairing-qc") - Notebooks
- Google Colab
- Kaggle
CellGemma pairing QC adapter
Built for the White Circle Halo Competition (track ft-gemma). Team lead: @Abm32.
A LoRA adapter for google/cellgemma-e4b, trained with
Halo 1.3.0, that helps find RNA and surface-protein records joined to the wrong
cell in a CITE-seq dataset. Given a cell's top 128 RNA features, it writes the cell's 17 antibody-panel quartiles. A
reviewer scores each existing join by how unlikely its observed protein quartiles are under the adapter, and opens the
least likely 1% of records.
Result on held-out cells
One 10x PBMC donor, 1,652 held-out test cells, 16 planted swaps per trial, 17 records reviewed (1%), 3 permutation seeds Γ 3 swap types = 9 trials, 144 planted swaps in total. The adapter, ensemble weight and step count were chosen on separate validation cells (30 trials); test cells were scored once.
| Method | Caught (of 144) | Mean AP | Clean alerts (of 1,652) |
|---|---|---|---|
| Base CellGemma, same prompt and scoring | 0 | 0.012 | 18 |
| Ridge, full RNA β protein residual | 19 | 0.138 | 23 |
| Ridge on the model's RNA view β quartiles | 48 | 0.285 | 12 |
| Logistic regression on the model's RNA view β quartile NLL | 50 | 0.346 | 19 |
| This adapter | 62 | 0.431 | 23 |
| This adapter + ridge, validation-weighted (0.8 / 0.2) | 67 | 0.461 | 22 |
By swap type the adapter caught 23/48 random, 34/48 block-shifted and 5/48 within-cluster swaps. Within-cluster swaps exchange cells of the same computational group and stay hard for every method.
Three training seeds at 1,600 steps caught 60, 61 and 62 swaps (test mean AP 0.421 Β± 0.009). This checkpoint (seed 44) had the highest validation AP.
Native task. On 32 of CellGemma's own perturbation prompts (Tahoe drugs, K562 knockdowns, from the bundled control
cells), the adapter's next-token distribution stayed close to the base over the base model's own 96-token answers: mean
KL 0.010 (Tahoe) and 0.020 (K562) nats per token, greedy token agreement 86% and 89%, and mean log-likelihood of those
answers β1.095 vs β1.093 (Tahoe) and β1.010 vs β1.017 (K562), adapter vs base. regression.py reproduces this.
Use
from peft import PeftModel
from transformers import AutoModelForCausalLM, AutoTokenizer
base = AutoModelForCausalLM.from_pretrained("google/cellgemma-e4b", revision="6212145e0131d3744171739ea5232afc6aaa7c76")
model = PeftModel.from_pretrained(base, "abhimanyu12/cellgemma-pairing-qc")
tokenizer = AutoTokenizer.from_pretrained("google/cellgemma-e4b")
prompt = "<bos><|turn>user\nRNA in descending abundance: <128 gene symbols>\nPredict surface protein quartiles (0-3).<turn|>\n<|turn>model\n"
The answer format is CD3=2 CD19=0 ... CD15=1 in panel order. To score a join, teacher-force the joined record's
quartiles and sum -log p of each quartile digit, normalized over the digits 0β3. assay.py in the code repository
does this and reproduces the table:
python competition/cellgemma/assay.py /tmp/eval --task impute --adapter abhimanyu12/cellgemma-pairing-qc
Training
- Halo 1.3.0 SFT, official
hopper-1.3.0image, one H200, 1,301 s of training. - LoRA r=32, Ξ±=64 on q, k, v, o, gate, up and down projections; 1,600 steps; batch 8 Γ 2; lr 2e-4 cosine, 20 warmup steps; max length 2,048; seed 44. Loss on the answer only.
- CellGemma's own turn format,
<bos><|turn>user\nβ¦<turn|>\n<|turn>model\nβ¦<turn|>, witheos_token: <turn|>so Halo trains the stop token. Recipe:recipe.yamlin this repo. - Data: 4,954 rows, one per training cell, from
abhimanyu12/cellgemma-pairing-qc-data. Quartile edges are fit on training cells only.
Limits
- One donor, one assay, planted swaps only. The results show the method on this batch, not transfer to other donors, panels or chemistries, and not the rate of real failed joins.
- The three test seeds reuse the same 1,652 cells, so their spread reflects permutation sensitivity only.
- At the validation-set 99th-percentile threshold the adapter raises 23 alerts on 1,652 intact test cells, the same as full ridge; the review-budget ranking is the intended use.
- Where barcodes survive on both sides of a join, checking them is the first-line method. This adapter is for joins whose keys were lost or transformed.
- Research use only. Not for clinical decisions.
Data and licenses
Source data: 10x Genomics, PBMCs of a Healthy Donor β 5' Gene Expression and Cell Surface Protein (Cell Ranger 3.0.0),
CC BY 4.0, filtered matrix SHA-256 6ba8d25bβ¦f00a8d2. Base model: google/cellgemma-e4b, Apache 2.0. The adapter is
released under Apache 2.0.
- Downloads last month
- -