<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>xindiwei | UCSC OSPO</title><link>https://ucsc-ospo.netlify.app/author/xindiwei/</link><atom:link href="https://ucsc-ospo.netlify.app/author/xindiwei/index.xml" rel="self" type="application/rss+xml"/><description>xindiwei</description><generator>Wowchemy (https://wowchemy.com)</generator><language>en-us</language><lastBuildDate>Tue, 28 Jul 2026 00:00:00 +0000</lastBuildDate><image><url>https://ucsc-ospo.netlify.app/media/logo_hub6795c39d7c5d58c9535d13299c9651f_74810_300x300_fit_lanczos_3.png</url><title>xindiwei</title><link>https://ucsc-ospo.netlify.app/author/xindiwei/</link></image><item><title>Halfway Through GSoC: Making Spatial Domain Identification Reproducible</title><link>https://ucsc-ospo.netlify.app/report/osre26/uci/star/20260729-xindiwei/</link><pubDate>Tue, 28 Jul 2026 00:00:00 +0000</pubDate><guid>https://ucsc-ospo.netlify.app/report/osre26/uci/star/20260729-xindiwei/</guid><description>&lt;p>As part of the &lt;strong>StaR&lt;/strong> project, my proposal under the mentorship of &lt;a href="https://ucsc-ospo.github.io/author/ziheng-duan/" target="_blank" rel="noopener">Ziheng Duan&lt;/a> set out to tackle a problem that is easy to overlook but hard to unsee once you have measured it: state-of-the-art graph neural network (GNN) methods for spatial domain identification give &lt;em>different answers depending on the random seed&lt;/em>, and the size of that variation can rival the reported gap between competing methods.&lt;/p>
&lt;p>The first half of GSoC went into (1) measuring exactly how bad the problem is, and (2) building a model that fixes it. Both are now done, and the work has been written up as a full manuscript with an accompanying open-source release.&lt;/p>
&lt;h2 id="-achievements">🚀 Achievements&lt;/h2>
&lt;h3 id="-the-largest-seed-sensitivity-study-of-spatial-domain-methods-to-date">✅ The largest seed-sensitivity study of spatial domain methods to date&lt;/h3>
&lt;p>To establish the problem quantitatively rather than anecdotally, I benchmarked five published GNN methods — &lt;strong>STAGATE, GraphST, SpaceFlow, stCluster and SpaGCN&lt;/strong> — with &lt;strong>1,000 independent random seeds each, on all 12 DLPFC tissue sections&lt;/strong>. That is 60,000 training runs in total, orchestrated on a SLURM cluster.&lt;/p>
&lt;p>The results confirmed the premise of the proposal and then some. Pooled across all seeds and sections, the coefficient of variation (CV) of the Adjusted Rand Index (ARI) ranges from &lt;strong>14.4% to 27.0%&lt;/strong> depending on the method. Instability is also unevenly distributed: on section 151669, STAGATE reaches &lt;strong>CV = 28.4%&lt;/strong>, meaning nearly a third of its reported accuracy is seed noise. In practice this means a single-seed benchmark can rank two methods in either order.&lt;/p>
&lt;h3 id="-built-spagvae--a-variational-graph-autoencoder-with-a-structured-spatial-prior">✅ Built SpaGVAE — a variational graph autoencoder with a structured spatial prior&lt;/h3>
&lt;p>The framework I proposed as StaR evolved during implementation into &lt;strong>SpaGVAE (Spatial Graph Variational AutoEncoder)&lt;/strong>, and the mechanism became sharper than the original proposal anticipated. The core idea: replace the standard isotropic Gaussian prior of a VAE with a &lt;strong>deterministic, seed-independent spatial anchor&lt;/strong> obtained by graph diffusion of PCA embeddings.&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-fallback" data-lang="fallback">&lt;span class="line">&lt;span class="cl">mu_prior = (I + alpha * L_norm)^{-1} PCA(X) # deterministic, identical for every seed
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">ELBO = || X - X_hat ||^2 + beta * KL( q(z|X,G) || N(mu_prior, I) )
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>Because every seed is pulled toward the &lt;em>same&lt;/em> spatial reference, different runs can no longer settle into unrelated solutions.&lt;/p>
&lt;h3 id="-benchmarked-spagvae-against-all-five-baselines-under-the-same-1000-seed-protocol">✅ Benchmarked SpaGVAE against all five baselines under the same 1,000-seed protocol&lt;/h3>
&lt;table>
&lt;thead>
&lt;tr>
&lt;th>Method&lt;/th>
&lt;th style="text-align:center">Mean ARI&lt;/th>
&lt;th style="text-align:center">Worst-case (P5) ARI&lt;/th>
&lt;th style="text-align:center">CV (%)&lt;/th>
&lt;/tr>
&lt;/thead>
&lt;tbody>
&lt;tr>
&lt;td>SpaGCN&lt;/td>
&lt;td style="text-align:center">0.338&lt;/td>
&lt;td style="text-align:center">0.205&lt;/td>
&lt;td style="text-align:center">27.0&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>SpaceFlow&lt;/td>
&lt;td style="text-align:center">0.435&lt;/td>
&lt;td style="text-align:center">0.265&lt;/td>
&lt;td style="text-align:center">26.2&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>stCluster&lt;/td>
&lt;td style="text-align:center">0.435&lt;/td>
&lt;td style="text-align:center">0.264&lt;/td>
&lt;td style="text-align:center">23.0&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>STAGATE&lt;/td>
&lt;td style="text-align:center">0.488&lt;/td>
&lt;td style="text-align:center">0.246&lt;/td>
&lt;td style="text-align:center">25.2&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>GraphST&lt;/td>
&lt;td style="text-align:center">0.506&lt;/td>
&lt;td style="text-align:center">0.398&lt;/td>
&lt;td style="text-align:center">14.4&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>&lt;strong>SpaGVAE&lt;/strong>&lt;/td>
&lt;td style="text-align:center">&lt;strong>0.542&lt;/strong>&lt;/td>
&lt;td style="text-align:center">&lt;strong>0.417&lt;/strong>&lt;/td>
&lt;td style="text-align:center">16.6&lt;/td>
&lt;/tr>
&lt;/tbody>
&lt;/table>
&lt;p>SpaGVAE has the highest mean ARI, and — more importantly for reproducibility — the highest &lt;strong>worst-case&lt;/strong> ARI: even in its unluckiest 5% of seeds it beats every baseline&amp;rsquo;s worst case. It outperforms the strongest baseline (GraphST) on &lt;strong>all 12 sections&lt;/strong> (Wilcoxon signed-rank &lt;em>p&lt;/em> = 0.0002). Notably, SpaGVAE is &lt;em>not&lt;/em> the lowest-variance method (GraphST is), but its whole ARI distribution sits above GraphST&amp;rsquo;s at every percentile, so its wider spread is upward reach rather than downside risk.&lt;/p>
&lt;h3 id="-mechanistic-ablations-and-generalisation-tests">✅ Mechanistic ablations and generalisation tests&lt;/h3>
&lt;p>A leave-one-out ablation (12 sections × 50 seeds) isolates &lt;em>why&lt;/em> the method works. Removing the structured prior collapses mean ARI from 0.542 to &lt;strong>0.307&lt;/strong> and more than doubles inter-seed variability, whereas removing β-annealing or Stochastic Weight Averaging leaves both essentially unchanged. The structured prior is the workhorse.&lt;/p>
&lt;p>Two follow-ups sharpened this further:&lt;/p>
&lt;ul>
&lt;li>&lt;strong>Clustering the deterministic prior directly&lt;/strong>, with no VAE training at all, already reaches 0.534 mean ARI on DLPFC — above every baseline, at &lt;em>zero&lt;/em> seed variance. This was a humbling result to find in our own method.&lt;/li>
&lt;li>&lt;strong>The VAE earns its keep when genes are scarce.&lt;/strong> As highly variable genes drop from 3,000 (Visium scale) to 200 (targeted-panel / imaging scale), the static prior collapses while SpaGVAE holds up; the gap widens from +0.015 to &lt;strong>+0.277 ARI&lt;/strong>.&lt;/li>
&lt;/ul>
&lt;p>For generalisation, I evaluated all six methods on the &lt;strong>MOSTA Stereo-seq adult mouse hemibrain&lt;/strong> (10,000 spots, 19 annotated anatomical regions) — a different platform, tissue and labelling scheme — using the DLPFC hyperparameters unchanged. SpaGVAE leads with mean ARI &lt;strong>0.585&lt;/strong> vs. 0.484 (SpaGCN), 0.421 (STAGATE) and 0.391 (GraphST), while also being the most stable (CV 4.0%).&lt;/p>
&lt;h3 id="-manuscript-and-open-source-release">✅ Manuscript and open-source release&lt;/h3>
&lt;p>The work is written up as a full manuscript, &lt;em>&amp;ldquo;SpaGVAE: A Variational Graph Autoencoder with Structured Spatial Prior for Robust Spatial Domain Identification,&amp;rdquo;&lt;/em> currently in preparation for submission to &lt;em>BMC Bioinformatics&lt;/em>. A reference implementation — training code, all baseline wrappers, SLURM scripts and figure-reproduction notebooks — is being prepared for public release under the MIT license at &lt;a href="https://github.com/RRRussell/StaR" target="_blank" rel="noopener">github.com/RRRussell/StaR&lt;/a>.&lt;/p>
&lt;h2 id="-challenges">🧠 Challenges&lt;/h2>
&lt;p>&lt;strong>Compute scale.&lt;/strong> Running six methods × 1,000 seeds × 12 sections is 72,000 training runs. Getting this through a shared SLURM cluster meant building checkpoint-resumable job arrays, careful memory budgeting, and result caching so that a failed node never cost more than a handful of runs.&lt;/p>
&lt;p>&lt;strong>Being fair to the baselines.&lt;/strong> A stability claim is worthless if the comparison is rigged. Every baseline had to be run with its authors&amp;rsquo; recommended settings, its own seed properly propagated through NumPy/PyTorch/R (Mclust seeds are a genuine footgun here), and the same clustering back-end. A good fraction of the first half went into making sure that when SpaGVAE wins, it wins for real reasons.&lt;/p>
&lt;p>&lt;strong>My own method surprised me.&lt;/strong> The original proposal put roughly equal weight on the deterministic prior, KL regularisation, and &amp;ldquo;advanced optimisation techniques&amp;rdquo; (SWA, β-annealing). The ablation said otherwise: the optimisation tricks contribute essentially nothing, and the prior does all the work. Rather than quietly keeping the extra components as decoration, we report the ablation honestly and reframed the paper&amp;rsquo;s story around the prior. The related finding — that the prior alone can nearly match the full model on Visium data — pushed us to find the regime where the VAE genuinely matters (sparse gene coverage), which is now one of the more interesting results in the paper.&lt;/p>
&lt;h2 id="-whats-next">🔜 What&amp;rsquo;s Next&lt;/h2>
&lt;ul>
&lt;li>📝 Finish and submit the manuscript to &lt;em>BMC Bioinformatics&lt;/em>&lt;/li>
&lt;li>📦 Polish the public release: documentation, tutorial notebook, PyPI packaging, and a one-command reproduction script for every figure and table&lt;/li>
&lt;li>🧬 Broaden the generalisation benchmark to more platforms and organisms (10x Xenium, MERFISH, non-brain tissues)&lt;/li>
&lt;li>🔍 Push further on the sparse-gene-coverage regime, which is where imaging-based spatial transcriptomics is heading and where SpaGVAE&amp;rsquo;s advantage is largest&lt;/li>
&lt;li>📉 Investigate whether structured spatial anchoring can be dropped into other backbones (STAGATE, GraphST) as a plug-in stabiliser, which was the original &amp;ldquo;framework&amp;rdquo; ambition of the proposal&lt;/li>
&lt;/ul>
&lt;h2 id="-deliverables-progress">🧾 Deliverables Progress&lt;/h2>
&lt;table>
&lt;thead>
&lt;tr>
&lt;th>Deliverable&lt;/th>
&lt;th>Status&lt;/th>
&lt;/tr>
&lt;/thead>
&lt;tbody>
&lt;tr>
&lt;td>Large-scale seed-sensitivity study (6 methods × 1,000 seeds × 12 sections)&lt;/td>
&lt;td>✅ Completed&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>Deterministic spatial prior&lt;/td>
&lt;td>✅ Completed&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>KL regularisation &amp;amp; training objective&lt;/td>
&lt;td>✅ Completed&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>Advanced optimisation (SWA, β-annealing)&lt;/td>
&lt;td>✅ Implemented — ablation shows negligible effect&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>Comprehensive benchmarking vs. 5 baselines&lt;/td>
&lt;td>✅ Completed&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>Mechanistic ablations &amp;amp; hyperparameter sweeps&lt;/td>
&lt;td>✅ Completed&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>Cross-platform generalisation (Stereo-seq)&lt;/td>
&lt;td>✅ Completed&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>Manuscript&lt;/td>
&lt;td>🟡 In preparation&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>Open-source release &amp;amp; documentation&lt;/td>
&lt;td>🟡 In progress&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>Broader multi-platform benchmarking&lt;/td>
&lt;td>⏳ Planned&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>Plug-in stabiliser for other backbones&lt;/td>
&lt;td>⏳ Planned&lt;/td>
&lt;/tr>
&lt;/tbody>
&lt;/table>
&lt;h2 id="-closing-thoughts">🙌 Closing Thoughts&lt;/h2>
&lt;p>The most valuable thing I learned this summer was not a modelling technique — it was how much a field can rest on numbers that move when you change a seed. Measuring that carefully turned out to be as much of a contribution as the model we built to fix it, and running the ablation that undercut part of my own proposal was, in retrospect, the moment the project got good.&lt;/p>
&lt;p>Huge thanks to my mentor &lt;strong>Ziheng Duan&lt;/strong> for the guidance, the compute, and for consistently pushing me to check whether my own results actually meant what I thought they meant.&lt;/p>
&lt;p>If you work on spatial transcriptomics — or on reproducibility in ML benchmarks more generally — I&amp;rsquo;d love to hear from you.&lt;/p></description></item></channel></rss>