# GRN-Guided Cascaded Flow Matching for Single-Cell Perturbation Prediction ## 组会汇报 --- ## 1. Task:单细胞扰动预测 ### 虚拟细胞(Virtual Cell) **虚拟细胞**是当前计算生物学的核心愿景:构建一个能在计算机中模拟真实细胞行为的AI模型——给定任意输入条件(基因型、环境、扰动),预测细胞的分子状态变化。单细胞扰动预测是实现虚拟细胞最关键的子任务之一。 ### 什么是扰动? 扰动(Perturbation)是指人为改变细胞的某些条件,观察细胞如何响应。常见的扰动类型包括: - **药物扰动(Drug perturbation)**:施加小分子化合物或药物,观察细胞的转录组变化(如 L1000/LINCS 数据) - **细胞因子扰动(Cytokine perturbation)**:用细胞因子(如 IL-6、TNF-α、IFN-γ 等)刺激细胞,研究免疫信号通路响应 - **基因扰动(Genetic perturbation)**:直接改变基因的功能状态,包括: - **基因敲除(Knock-out, KO)**:用 CRISPR-Cas9 完全删除目标基因的功能 - **基因过表达(Overexpression, OE)**:人为提高目标基因的表达量(如 CRISPRa 激活) - **基因敲低(Knock-down, KD)**:用 RNAi/shRNA 部分降低目标基因的表达(不完全删除) 本工作聚焦**基因扰动**,使用 Perturb-seq 技术:对细胞施加 CRISPR 基因扰动,然后用单细胞 RNA-seq 测量每个细胞所有基因的表达变化。 ### 任务形式化 ``` 已知: x_ctrl ∈ R^G (control 细胞的基因表达谱, G ≈ 5000 高变基因) p ∈ {gene₁, gene₂} (被扰动的基因) 预测: x_pert ∈ R^G (扰动后细胞的基因表达谱) ``` ### 为什么重要? - **药物筛选加速**:wet-lab 做一次 Perturb-seq 实验成本极高($$$);如果能计算预测,可以大幅缩小候选范围 - **组合扰动爆炸**:N 个基因的两两组合 = N(N-1)/2 种实验,不可能穷举,必须靠预测 - **理解疾病机制**:预测哪些基因被扰动后会产生某种疾病表型 ### 数据特点 - Norman et al. 数据集:~9K 细胞 × 5000 HVG,105 种单/双基因 CRISPR 扰动(KO + OE) - **细胞配对不可得**:我们无法得到 (x_ctrl_i, x_pert_i) 的逐细胞配对——扰动是破坏性的,一个细胞只能测一次 - 评估:DE 基因 overlap、方向一致性、MSE、Pearson 相关等 --- ## 2. 现有方法综述与批判 ### 2.1 简单基线 **Additive shift(均值偏移)** ``` x̂_pert = x_ctrl + mean(x_pert_train - x_ctrl_train) ``` - 假设:扰动效应对所有细胞是**常数平移** - 问题:完全忽略细胞异质性;同一扰动对不同细胞类型的效应可能截然不同 - 但**出奇地难以超越**——很多复杂模型在 top DE 基因上并不比它好 ### 2.2 基于预训练大模型的方法 **scGPT** (Nature Methods 2024) - 自回归 transformer,在大规模单细胞数据上预训练 - 扰动预测方式:fine-tune,将扰动基因 token mask 掉,让模型"补全" - **问题**: - 本质是**自回归补全**,不是为扰动预测设计的目标函数 - 编码的是细胞的**绝对状态**,不直接建模状态变化 - Fine-tuning 过拟合风险高(训练样本少) **Geneformer** (Nature 2024) - 基于 rank-value encoding 的 transformer 预训练 - 用 in-silico perturbation:直接删除目标基因 token,看 embedding 变化 - **问题**: - in-silico perturbation 是**启发式**的,没有学习扰动的动力学 - rank encoding 丢失表达量信息 - 不能处理组合扰动 ### 2.3 专用扰动预测模型 **CPA** (Molecular Systems Biology 2023) - Compositional Perturbation Autoencoder:将细胞状态分解为 basal state + perturbation effect + covariate effect - 用加法假设在 latent space 组合 - **问题**: - **线性可加假设**过强:基因调控是非线性的 - Autoencoder 重建质量限制上限 - 不建模基因间的调控关系 **GEARS** (Nature Biotechnology 2023) - 用 Gene Ontology (GO) 图上的 GNN 编码基因关系 - Cross-attention 融合扰动信息和细胞状态 - **问题**: - GO 图是**静态先验知识**,不随细胞状态变化 - 图结构的选择对结果影响很大(GO vs PPI vs GRN) - 仍然是确定性预测,不能给出分布 **STATE** (ICLR 2025) - Stacked Attention for Expression Transformation - **问题**: - 确定性预测 - 仍然没有从 GRN 变化角度建模 **CellFlow** (preprint 2025) - 也是 flow matching 框架 - 用预训练 embedding 作为条件 - **问题**: - 预训练 embedding 仍然编码绝对状态 - 没有显式建模扰动对调控网络的改变 **scDFM** (ICLR 2026) - 将 **Conditional Flow Matching** 引入扰动预测 - 学习从噪声到 target 表达的速度场,条件为 control 表达 + 扰动 ID - DiffPerceiverBlock:差分注意力 + cross-attention - **优点**:生成式模型,能给出分布;flow matching 训练稳定 - **问题**: - **信息来源单一**:只有 control 的数值表达 + 扰动基因的 embedding - **不理解基因调控关系**:模型需要从数据中隐式学习 GRN,而训练数据极少 - d_model=128,表达能力有限 ### 2.4 共性问题总结 ``` 所有现有方法的共同盲区: 扰动 → [黑箱模型] → 表达变化 没有任何一个方法显式地建模: 扰动 → 基因调控网络变化 → 表达变化 ↑ 这一步被跳过了 ``` --- ## 3. 我们的 Motivation ### 3.1 Motivation 1:流匹配解决细胞配对问题 单细胞扰动预测的根本困难:**没有 paired data**。 我们无法得到 (x_ctrl_i, x_pert_i) 这样的配对——一个细胞扰动后就变了,不能回到扰动前状态。 传统方法的处理:群体均值匹配(丢失异质性)或 autoencoder(受限于重建质量)。 **Flow Matching 的优势**:它学习的是从 source 分布到 target 分布的**概率传输映射**,天然适合 unpaired 数据: ``` p(x_ctrl) ──(学习 ODE 路径)──→ p(x_pert | perturbation) ``` - 不需要逐细胞配对,只需要两组细胞的**群体分布** - 通过 Conditional Optimal Transport 构造训练对,比随机配对效率高 - 生成式输出:每个 control 细胞可以采样多个 prediction,给出**不确定性估计** ### 3.2 Motivation 2:从 GRN 变化角度理解扰动 **关键生物学事实**:基因扰动不是简单地改变一个基因的值。 ``` CRISPR knock-out 基因 A ↓ 基因 A 的表达降为 0 ↓ A 直接调控的基因 B, C, D 表达改变(一级效应) ↓ B 调控的 E, F,C 调控的 G, H ... 依次改变(级联效应) ↓ 最终数千个基因的表达都发生变化 ``` 这个级联传播的路径,就是 **基因调控网络 (GRN)**。 **核心洞察**:如果我们能先理解扰动如何改变了 GRN,再基于改变后的 GRN 预测表达,预测会更准确。 ``` 现有方法: 扰动 ───────────────────────→ 表达变化 (端到端黑箱) 我们: 扰动 → GRN 变化 (Δ_attn) → 表达变化 ↑ 显式建模 ↑ 有据可依 ``` ### 3.3 Motivation 3:scGPT 的 Attention ≈ 数据驱动的 GRN 预训练的 scGPT 模型在大规模单细胞数据上学到了基因间的调控关系,这些关系被编码在 transformer 的 **attention matrix** 中: ``` attn[i][j] 高 → 基因 j 的状态对基因 i 的表达有强影响 ``` 这等价于一个**数据驱动的、上下文相关的 GRN**——它随细胞状态而变化,比静态 GO 图更灵活。 我们可以用**同一模型**,分别输入 control 和 perturbation 的表达,得到两个 attention matrix,它们的差直接反映**扰动引起的 GRN 变化**。 --- ## 4. 我们的方法 ### 4.1 总体思路 在 scDFM 的 flow matching 框架上,引入 **GRN-aware latent flow**: ``` Cascaded Flow Matching: ┌─────────────────────────────────┐ ┌──────────────────────────────┐ │ GRN Latent Flow │ │ Expression Flow │ │ │ │ │ │ noise → GRN 变化特征 │ │ noise → 基因表达 │ │ (理解调控网络如何改变) │ │ (基于 GRN 变化预测表达) │ │ │ │ │ │ 推理: 先完成 │ → │ 推理: 后完成 │ └─────────────────────────────────┘ └──────────────────────────────┘ Stage 1 Stage 2 ``` **直觉**:模型先"想清楚"扰动改变了哪些基因调控关系,再基于这些理解去预测表达变化。 ### 4.2 GRN 特征:Attention-Delta ``` Δ_attn = Attention(perturbed cell) - Attention(control cell) GRN features = Δ_attn @ gene_embeddings ``` - `Δ_attn` 捕捉扰动引起的调控关系变化 - `@ gene_embeddings` 将稀疏的调控变化信号聚合到每个基因的连续特征空间 - 输出:每个基因一个 512 维向量,编码"这个基因上游的调控关系发生了怎样的变化" ### 4.3 模型架构 ``` 条件信息 (推理时可用) 辅助生成目标 (推理时从噪声生成) ┌──────────────────────────┐ ┌───────────────────────────────┐ │ control 表达 x_ctrl │ │ GRN 变化特征 z (512-d/gene) │ │ 扰动基因 ID pert_id │ │ = Δ_attn @ gene_emb │ │ 时间步 t₁, t₂ │ │ 来自 frozen scGPT │ └──────────────────────────┘ └───────────────────────────────┘ ↓ ↓ ┌─── Expression Stream ───┐ ┌─── Latent Stream ───┐ │ GeneEncoder + ValueEnc │ │ LatentEmbedder │ │ → expr_tokens (B,G,d) │ │ → lat_tokens(B,G,d)│ └─────────────┬───────────┘ └──────────┬──────────┘ └───────── (+) ─────────────┘ ↓ x = expr + latent (加法融合) ↓ ┌─── Conditioning ───┐ │ c = t₁ + t₂ + pert │ └────────┬──────────┘ ↓ ┌─── Shared Backbone ──┐ │ DiffPerceiverBlock │ × 4 layers │ (with GeneadaLN) │ └────────┬────────────┘ ┌────┴────┐ ┌────┴───┐ ┌──┴────────┐ │ExprHead │ │LatentHead │ │→ v_expr │ │→ v_latent │ │ (B,G) │ │(B,G,512) │ └─────────┘ └───────────┘ ``` ### 4.4 Cascaded 训练 训练时不同时优化两个 flow,而是**概率切换**: ``` 随机 coin flip: 40% → 训练 Latent Flow: t₂ 随机, t₁ = 0, 只算 loss_latent 60% → 训练 Expression Flow: t₁ 随机, t₂ ≈ 1, 只算 loss_expr ``` ### 4.5 Cascaded 推理(核心) ``` Stage 1: z_noise ═══(ODE)═══> z_clean (GRN latent: 0→1) 此时 expression 静止 (t₁=0) Stage 2: x_noise ═══(ODE)═══> x_pred (Expression: 0→1) 此时 GRN latent 已完成 (t₂=1) ``` **生物学直觉**:先理解调控网络如何变化,再基于变化后的调控网络预测表达。 ### 4.6 架构图绘制 Prompt (Nano Banana) > **Prompt for architecture diagram:** > > Create a clean, professional scientific figure illustrating the "GRN-Guided Cascaded Flow Matching" architecture for single-cell perturbation prediction. Use a horizontal layout, left-to-right flow, with a soft blue-white color scheme. > > **Left panel — "GRN Feature Extraction" (frozen, no gradient):** > Show a frozen scGPT transformer icon (with a snowflake symbol). Two inputs feed into it: "control expression x_ctrl" (blue arrow) and "perturbed expression x_pert" (red arrow). Each produces an attention matrix (shown as a small heatmap grid). Between the two heatmaps, show a minus sign, producing "Δ_attn" (a difference heatmap). Then show Δ_attn multiplied by "Gene Embeddings" (a matrix icon), producing "GRN change features z" as a (G × 512) colored matrix strip. Label this output with dimension annotations (B, G, 512). Add a dashed box around the entire left panel labeled "Frozen scGPT — GRN Change Extraction". > > **Center panel — "Cascaded Flow Model" (trainable):** > Show two parallel input streams at the top: > (1) "Expression Stream": x_t (noised target expression) + x_ctrl (control) → two small encoder blocks → fusion → "expr_tokens" > (2) "Latent Stream": z_t (noised GRN features) → LatentEmbedder → "latent_tokens" > Show these two streams merging with a "+" symbol into combined tokens. > Below, show a conditioning vector "c = t_expr + t_latent + pert_emb" feeding into a vertical stack of 4 shared backbone blocks (labeled "DiffPerceiverBlock × 4"). > At the bottom, the backbone splits into two decoder heads: "Expression Head → v_expr (B, G)" on the left, and "Latent Head → v_latent (B, G, 512)" on the right. > > **Right panel — "Cascaded Inference":** > Show a two-stage timeline diagram: > Stage 1 (top): "GRN Latent Flow" — an ODE trajectory from z_noise (random dots) to z_clean (structured pattern), with t_latent going from 0 to 1. Label: "First: understand how GRN changes". > Stage 2 (bottom): "Expression Flow" — an ODE trajectory from x_noise to x_pred (a gene expression barplot), with t_expr going from 0 to 1. Label: "Then: predict expression changes". Show a downward arrow from Stage 1 to Stage 2 indicating "z_clean conditions Stage 2". > > **Bottom banner:** A biological intuition strip showing: "Perturbation → GRN rewiring (Δ attention) → Gene expression change", with small icons (a gene network graph changing, then expression bars changing). > > Style: Nature/Cell journal style, vector graphics, minimal clutter, no 3D effects, consistent font sizes, use color coding (blue for expression path, orange/gold for latent/GRN path, gray for frozen components). --- ## 5. 当前问题与解决方向 ### 5.1 问题:GRN 信号提取困难——噪声淹没真信号 scGPT 的 attention matrix 是一个 (G × G) 的**稠密矩阵**——每对基因之间都有非零 attention 值。 但真实的基因调控网络是**极度稀疏的**:一个基因通常只直接调控几十个下游基因,而不是几千个。 ``` Attention matrix: 5000 × 5000 = 25,000,000 个非零值 真实 GRN: 每个基因平均 ~20-50 个调控靶标 → 99%+ 的 attention 值是噪声,不是真正的调控关系 ``` 这意味着 `Δ_attn @ gene_emb` 里绝大部分信号是噪声的变化,真正的 GRN 变化信号被淹没。 **当前观察佐证**:latent loss ≈ 1.12,远高于 expression loss ≈ 0.019,说明模型难以预测 latent 速度场——因为目标本身就充满噪声。 **解决方向——稀疏化 top-K**: ``` 原始: Δ_attn (G × G) 全部 25M 值 → 噪声多,信号弱 ↓ 稀疏化 Top-K: 每个基因只保留 |Δ| 最大的 K=30 个 → 过滤 99.4% 噪声 ↓ features = sparse_Δ_topk @ gene_emb ``` 已实现并在实验中(`sparse_topk_emb` 模式)。 ### 5.2 问题:512 维 latent 预测难度过大 每个基因的 GRN 特征是 512 维向量,整个 latent target 是 (G, 512) = 250 万维的速度场——模型需要在每个时间步预测这么大的向量。 **消融实验证实**:将 latent 维度从 512 降到 1,latent loss 从 ~1.1 降到 ~0.5-0.7——维度是难度的重要来源。 **解决方向——PCA 降维**: ``` 512-d gene_emb → PCA 投影到 64 维 features = sparse_Δ_topk @ pca_basis → (B, G, 64) ``` 用 PCA 找到 attention delta 信号的主要变化方向,将 512 维压缩到 64 维,去掉冗余维度。scgpt_dim=64,bottleneck_dim=64。 已实现并在实验中(`sparse_pca` 模式)。 --- ## 6. 总结与展望 ### 6.1 核心贡献 我们的工作**不是在模型架构上做改进**,而是**从生物学机制出发**重新建模扰动预测任务: ``` 现有方法: perturbation → [model] → expression change ↑ 纯数据驱动黑箱 我们: perturbation → GRN rewiring → expression change ↑ 显式建模生物学机制 ``` 用 Cascaded Flow Matching 的两阶段结构来实现"先理解调控变化,再预测表达变化"。 ### 6.2 后续关键实验:验证因果假设 目前的 cascaded 推理是**固定顺序**的:先 latent(GRN),后 expression。 这是否真的重要?我们计划做一个关键实验来验证: **实验设计**:训练时 t₁ 和 t₂ 完全随机采样(不再 cascade),模型支持**任意顺序推理**。然后对比: | 推理方式 | 含义 | 预期 | |---------|------|------| | 先 GRN latent → 后 expression | 先理解调控变化,再预测表达 | **最优** | | 先 expression → 后 GRN latent | 先预测表达,再理解调控 | 次优 | | 同时 random | 无显式顺序 | 最差 | 如果"先 GRN 后 expression"显著优于其他顺序,就验证了: > **理解基因调控网络的变化,是预测扰动表达变化的前提条件,而不是副产物。** 这就是我们这个工作要回答的核心科学问题。 --- ### 一句话总结 > 我们用 scGPT 的 attention delta 显式提取扰动引起的基因调控网络变化,通过 cascaded flow matching 强制模型"先理解 GRN 如何改变,再预测表达如何变化",从而将生物学先验——扰动通过 GRN 级联传播——融入生成式模型的推理过程。