Recipe
Fine-tuning a bio foundation model with the Helical MCP
Much of disease research rests on relating molecular measurements from patient tissue to clinical features: which cell states and gene programmes distinguish one diagnosis from another, define a disease subtype or track the decline in organ function. Bio foundation models bring a great deal to this, because they are trained on hundreds of millions of cells and learn the gene programmes which define cell types and cell states across human tissues. But pretraining involves no clinical information, so the model has no notion of which programmes relate to a given disease. Fine-tuning conditions the model on this information, the clinical features and cell states which clinicians and biologists care about, so that it learns which gene programmes relate to each of them. The fine-tuned model can then be used to explore the disease and to make predictions which relate to these features in new patients.
In this instance we look at chronic kidney disease (CKD), using single-nucleus RNA-seq from 70 donors in the Human Kidney Atlas 2.0 of the Kidney Precision Medicine Project (KPMP) and HuBMAP (Lake et al. 2025). We fine-tune Geneformer-104M on disease status, adjudicated CKD group and cell state in a single multi-task call to the Helical MCP, compare it with the zero-shot model, and test how many donors are needed, scoring every model on 20 held-out donors.
![]()
- Define the covariates and launch a multi-task fine-tune in one MCP call.
- Compare zero-shot and fine-tuned UMAPs.
- Repeat the fine-tune on smaller donor cohorts and read the donor-ablation table.
- Plot the loss of performance with fewer donors.
- Repeat every fine-tune with two more seeds and check how much the result moves.
It takes 5 prompts. You need the Helical MCP connected (see Getting started).
1Define the covariates and fine-tune in one MCP call
The cohort is a subsample of the atlas's adult human kidney snRNA-seq dataset: 10,463 nuclei, 22,790 genes, 70 donors.
We pick three covariates that cover the clinical and the biological side of the disease:
| Covariate | Column | What it encodes |
|---|---|---|
| Disease | disease_label | CKD or normal |
| Adjudication group | adj_group | adjudicated CKD group: DKD, HTN or other CKD |
| Cell state | cellstate_l2 | reference and altered kidney cell states |
- The split is by donor and fixed once: 20 held-out donors (3,000 cells; 10 CKD, 10 normal) and 50 labelled donors, from which the fine-tuning cohorts are drawn.
- The label columns carry a cohort suffix.
disease_label_c35holds a label for the 5,213 cells of the 35-donor cohort and a missing value for everyone else, so held-out donors are hidden from training itself. triggerFinetuningtakes parallel arrays: the first entries oflabels,task_typeandmodel_typedescribe one head, the second entries the next. Three covariates are three entries.
Example prompt:
Fine-tune gf-12L-104M-i4096 on the CKD donor-ablation dataset as one multi-task run: labels: disease_label_c35, adj_group_c35, cellstate_l2_c35 task_type: prediction, prediction, prediction model_type: classification, classification, classification task_weights: 1, 1, 1 Register the model as gf104m_ckd_multitask_c35. Use epochs 1, learning_rate 1e-4, num_trainable_layers 1, batch_size 8, weight_decay 0.01, lr_scheduler constant, min_lr 1e-6, seed 42, logging_steps 10. Quote the run and wait for my approval.
- The call returns
pending_approvalwith a quote. Nothing runs, and nothing is charged, until you approve. - Once approved, the run took about 5 minutes.
2Compare zero-shot and fine-tuned UMAPs
Embed the whole dataset twice. Passing the base model name gives the zero-shot embedding; passing the registered model gives the fine-tuned one.
Example prompt:
Embed the CKD donor-ablation dataset with gf-12L-104M-i4096 (zero-shot) and with gf104m_ckd_multitask_c35. Quote each run and wait for my approval. Download both embeddings, then make UMAPs of the 20 held-out donors only, zero-shot next to fine-tuned, with identical settings. Colour one row by cell type and one by disease_label. Report the held-out disease AUC of each embedding from a 15-nearest-neighbour vote against the labelled donors.
- Each embedding run took 3 to 15 minutes and returns a
.npywith one row per cell.
![]()
- These are cells from donors the fine-tune never saw labels for (the seed 42 run is shown).
- Cell types stay separated after fine-tuning: the model keeps cell identity.
- Zero-shot, CKD and normal cells are mixed inside most cell types. After fine-tuning they occupy separate regions within them.
- This separation is a result of the fine-tuning, and it is measurable: held-out disease AUC rises from 0.81 zero-shot to 0.93, and adjudication category from 0.64 to 0.79.
3Run the fine-tune across donor cohorts
We now run multiple fine-tunings to characterise how fine-tuned performance decays with data availability. The 35-donor cohort contains three nested smaller ones, each with its own masked label columns (_c25, _c15, _c8), so one registered dataset serves every donor budget.
Example prompt:
Repeat the multi-task fine-tune for c25, c15 and c8 with the same hyperparameters, replacing the label suffix and the registered model name each time. Quote each run and wait for my approval. Then embed the whole dataset with each fine-tuned model and download the embeddings. Score zero-shot and the four fine-tuned embeddings on the held-out donors with a 15-nearest-neighbour vote (cosine) from the labelled cells of the 50 labelled donors: AUC for categorical targets, Spearman for egfr_baseline. Make a table of targets by cohort.
| Target | Zero-shot | 8 donors | 15 donors | 25 donors | 35 donors |
|---|---|---|---|---|---|
| Disease (CKD vs normal) | 0.809 | 0.839 | 0.907 | 0.921 | 0.931 |
| Diagnosis, 4-way (normal / DKD / HTN / other CKD) | 0.661 | 0.693 | 0.733 | 0.743 | 0.761 |
| Adjudication category | 0.635 | 0.702 | 0.756 | 0.766 | 0.786 |
| Baseline eGFR (Spearman) | 0.448 | 0.483 | 0.558 | 0.572 | 0.576 |
| Cell state | 0.877 | 0.885 | 0.899 | 0.903 | 0.907 |
| Cell type (control) | 0.990 | 0.980 | 0.980 | 0.980 | 0.983 |
| Sex (control) | 0.582 | 0.538 | 0.552 | 0.526 | 0.529 |
- Each cohort was fine-tuned three times (see step 5). Endpoint rows are the mean across seeds, control rows the median.
- Fine-tuning lifts every clinical target, and the lift transfers: the fine-tune never saw eGFR, and saw only a coarser version of the adjudication category.
- The clinical rows are not independent confirmations. The 4-way diagnosis, the adjudication category and eGFR all correlate with the CKD axis.
- The controls do not improve. Cell-type separation drops by about 0.01 and sex stays near chance.
adj_group, the second trained head, is missing from the table: only 10 held-out donors carry it, and on those donors it shows no gain. The fine-tune separates CKD from normal, not one CKD group from another.- The readout is a nearest-neighbour vote because it has no trainable weights: it measures how the embedding is organised. With a linear probe trained on labels from all 50 labelled donors, zero-shot already reaches a disease AUC of 0.929 and fine-tuning adds +0.016. Fine-tuning pays off most when downstream labels are scarce.
- The targets shown are the trained labels that can be scored on at least 18 held-out donors, two harder versions of the diagnosis and one continuous clinical measure. Other covariates behave similarly and are in
covariate_sweep.csv. - A fine-tune on all 50 labelled donors was also run. It scores within noise of the 35-donor one (disease 0.925 against 0.931) and is left out of the table and figures for simplicity; its scores are in
donor_ablation_summary.csv.
4Plot the loss of performance with fewer donors
Example prompt:
Plot held-out score against the number of fine-tuning donors (8, 15, 25, 35) for disease, adjudication category and baseline eGFR, with zero-shot as a dashed line. Add a shaded band for the 95% interval of the gain over zero-shot, bootstrapping the 20 held-out donors, not cells.
![]()
- The line is the mean of three seeds with one pale dot per seed. Where the band clears the dashed line, the gain is beyond donor sampling.
- Performance drops as donors are removed, and most of the drop comes at the end: from 35 to 15 donors disease AUC falls from 0.93 to 0.91, from 15 to 8 it falls to 0.84.
- From 15 donors up, all three targets clear zero-shot. eGFR improves but is the least certain of the three: its interval is wide at every cohort.
- At 8 donors the gain is not distinguishable from noise for disease and eGFR. The adjudication category is the exception.
- The differences between 15, 25 and 35 donors are well inside the intervals.
5Check robustness across repeated runs
A curve from one fine-tune per cohort cannot tell a real difference from run-to-run noise, so we repeat all four fine-tunes with two more seeds, same recipe, same cohorts.
Example prompt:
Repeat the four multi-task fine-tunes with seed 43 and with seed 44, using logging_steps 50 and everything else unchanged, then embed the dataset with each new model. Quote each run and wait for my approval. Report, for each target and cohort, the range of the held-out score across the three seeds, and plot one curve per seed.
![]()
| Target | Mean range across seeds | Largest range |
|---|---|---|
| Disease | 0.012 | 0.018 |
| Adjudication category | 0.013 | 0.018 |
| Baseline eGFR | 0.015 | 0.030 |
- The range is the highest minus the lowest score among the three seeds, averaged over the four cohorts.
- Retraining moves the score by about a tenth of the fine-tuning gain, which is 0.10 to 0.15 from 15 donors up.
- The limiting uncertainty is the 20 held-out donors, not retraining: the donor-sampling intervals in step 4 are several times wider than the seed range.
- The curve shape repeats in every seed: a steep rise from 8 to 15 donors, then small gains.
- This is variability across training seeds on the same nested cohorts. It does not test a different selection of donors for each cohort.
- One fine-tune (35 donors, seed 43) separated sex at 0.93 on held-out donors, against 0.53 for the other two seeds. We have not established why. Its disease, adjudication and eGFR scores are in line with the other seeds, and the control rows of the table use the median for this reason.
- When launching many runs, start them a few at a time and log less often (
logging_steps50 here), because all runs report to one tracking server.
Takeaways
- A multi-task fine-tune is one MCP call: name the covariates that matter for your study as parallel label columns.
- It is easy to do: five prompts take you from choosing the covariates to the robustness check, with no training code and no GPU setup.
- Fine-tuning on 15 or more donors lifts held-out disease AUC from 0.81 to between 0.91 and 0.93, and the gain transfers to adjudication category and eGFR.
- Most of the benefit is there at 15 donors. At 8 donors it is mostly not distinguishable from zero-shot.
- Fine-tuning pays off most when downstream labels are scarce.
- Across three training seeds the scores move by about 0.01, a tenth of the gain. The 20 held-out donors are the larger source of uncertainty.
- Split by donor, mask labels in the dataset, and bootstrap donors, not cells.
- This is one of many computational experiments you can run in Helical, the virtual AI lab for biology.
References
- Lake BB, Melo Ferreira R, Hansen J, et al. Cellular and Spatial Drivers of Unresolved Injury and Functional Decline in the Human Kidney. bioRxiv 2025. 10.1101/2025.09.26.678707
- Data: CZ CELLxGENE collection Human Kidney Atlas 2.0, dataset "Single-nucleus RNA-seq of the Adult Human Kidney (Version 2.0)"; KPMP