SAVE: A Generalizable Framework for Multi-Condition Single-Cell Generation with Gene Block Attention
Paper β’ 2604.16776 β’ Published
Model hub for SAVE (ICLR 2026), packaged as sc-save (v0.2.0) on PyPI.
sc-save (pip install sc-save)Standard Transformer models for single-cell RNA-seq (~20,000 unordered genes per cell) face an $\mathcal{O}(G^2)$ attention bottleneck and lack spatial 2D grids for Vision Transformer (ViT) patchification. SAVE introduces:
2,391.2 min β 12.5 min).AdaLN, independent condition masking $p=0.6$, multi-condition Classifier-Free Guidance) sampled in 20 ODE steps.scIB), and leave-one-out counterfactual perturbation prediction.SAVE.save / SAVE.load)
Each pretrained checkpoint subfolder in this repository stores a self-contained sc-save bundle produced by model.save(...):
<dataset_bundle>/
βββ config.json # SAVEConfig (VAEConfig, FMConfig, TrainConfig, cond_encoding)
βββ vocab.json # ConditionVocabulary (condition columns, classes, <mask> id)
βββ metadata.json # Gene count, pad_idx, var_names, training flags
βββ scaler.npz # Fitted MaxAbsExpressionScaler parameters
βββ vae.pt # Stage-1 Gene-Block Attention VAE weights
βββ fm.pt # Stage-2 DiT Conditional OT Flow Matching weights (generation bundles)
Planned / hosted benchmark bundles:
heart/ β Dual-condition (batch, cell_type) Human Heart Atlas (K=3200)pbmc/ β Dual-condition (batch, cell_type) Human PBMC (K=3200)lung_atlas/ β Dual-condition (batch, cell_type) Human Lung Atlas (K=3200)lung_cancer/ β 5-covariate (assay, development_stage, disease, uicc_stage, cell_type) Lung Cancer Atlas (K=3200)pbmc_ifn/ β Perturbation prediction (condition, cell_type) PBMC IFN-$\beta$ (K=400)sc-save v0.2.0 + huggingface_hub)
pip install sc-save huggingface_hub
from huggingface_hub import snapshot_download
from sc_save import SAVE
import scanpy as sc
# 1. Download a pretrained SAVE bundle (e.g., heart)
bundle_dir = snapshot_download(
repo_id="ArGoN1/sc-save",
allow_patterns=["heart/*"],
)
model = SAVE.load(f"{bundle_dir}/heart", device="auto")
# 2. Conditional cell generation with 20-step OT Flow Matching + CFG
gen_adata = model.generate(
{"batch": "D1", "cell_type": "Atrial_Cardiomyocyte"},
n_cells=500,
guidance_weight=2.0,
steps=20,
)
# 3. Inspect condition-modulated Gene Block attention weights
attn_res = model.generate_with_attention(
{"batch": "D1", "cell_type": "Atrial_Cardiomyocyte"},
n_cells=32,
steps=20,
)
# 4. Zero-shot batch / condition transfer on an external AnnData
adata = sc.read_h5ad("my_cells.h5ad")
transferred = model.transfer(
adata,
target_cond={"batch": "D1"},
input_cond="obs",
inverse_scale=True,
trim_pad=True,
)
For training from scratch on your own .h5ad file (requires GenePT embeddings from Zenodo 10833191):
import scanpy as sc
from sc_save import SAVE, SAVEConfig, build_gene_blocks, load_gene_embeddings
adata = sc.read_h5ad("heart_raw.h5ad")
gene_embs = load_gene_embeddings("GenePT_gene_protein_embedding_model_3_text.pickle")
blocks = build_gene_blocks(adata, gene_embs, block_size=3200)
cfg = SAVEConfig.save_b(gene_block_size=3200, cond_encoding="offset")
model = SAVE(blocks.adata, condition_cols=("batch", "cell_type"), config=cfg, device="auto")
model.fit()
model.save("./outputs/save_heart_bundle")
v0.2.0 Benchmarks
Across Google Colab GPU validation (iclr2026_v2_colab_validation.json), sc-save v0.2.0 passed all 10/10 primary ICLR 2026 benchmarks with zero regression gate failures:
| Benchmark | Key Metric(s) | Paper Target | v1 Colab (Blackwell G4) |
v0.2.0 Colab (A100 / L4) |
|---|---|---|---|---|
Table 1 (pbmc3k / dentategyrus / tabula_muris) |
WD ($\downarrow$) / MMD ($\downarrow$) | 19.14/1.80 Β· 9.16/0.17 Β· 10.86/0.04 |
12.76/0.48 Β· 8.08/0.11 Β· 10.65/0.04 |
12.74/0.49 Β· 8.11/0.11 Β· 10.21/0.03 |
Table 2 (heart / pbmc / lung_atlas) |
WD ($\downarrow$) / MMD ($\downarrow$) | 8.30/0.63 Β· 5.37/0.29 Β· 4.37/1.14 |
8.83/0.64 Β· 5.39/0.30 Β· 4.42/1.16 |
8.20/0.61 Β· 5.30/0.29 Β· 4.41/1.15 |
Table 3 (lung_cancer Seen / Unseen) |
WD ($\downarrow$) / MMD ($\downarrow$) | 3.10/1.06 Β· 4.63/2.11 |
3.07/1.08 Β· 5.39/2.16 |
3.05/1.07 Β· 4.42/2.07 |
Table 4 (lung_atlas / heart / pbmc BEC) |
scIB ($\uparrow$) | 0.8128 Β· 0.7983 Β· 0.8309 |
0.8097 Β· 0.8019 Β· 0.8125 |
0.8080 Β· 0.7985 Β· 0.8238 |
Table 5 (pbmc_ifn 7-fold LOO Average) |
PCC ($\uparrow$) / $R^2$ ($\uparrow$) / WD ($\downarrow$) | 0.96 / 0.86 / 5.15 |
0.943 / 0.807 / 5.77 |
0.940 / 0.792 / 5.86 |
v1 Blackwell G4.Tabula Muris (196,311 Γ 22,400) runs end-to-end inside 52 GB host RAM on Colab L4 via streaming randomized PCA and tiled RBF-MMD ($\le 16\text{ MB}$ tiles).@inproceedings{
li2026save,
title={{SAVE}: A Generalizable Framework for Multi-Condition Single-Cell Generation with Gene Block Attention},
author={Jiahao Li and Jiayi Dong and Peng Ye and Xiaochi Zhou and Haohai Lu and Fei Wang},
booktitle={The Fourteenth International Conference on Learning Representations},
year={2026},
url={https://openreview.net/forum?id=l7QEoK4uDP}
}