omicstra R4_v3 - cross-attention alignment head
The winning arm of omicstra's v3 alignment grid: a 2.1 M-parameter head that maps frozen H&E and spatial-transcriptomics embeddings into a shared 512-d space, so a niche in one modality retrieves its match in the other.
It is not an encoder. Virchow2 and Novae stay frozen and are not included here; this is the bridge between them.
- code: https://github.com/teslajoy/omicstra
- install:
pip install omicstra - grant: doi:10.55277/researchhub.6ou1w3h3
what it does
H&E Virchow2 tile tokens 1280-d ─┐
├─ cross-attention ─→ shared 512-d
ST Novae 64-d + gpath2vec 512-d ─┘
= 576-d per niche
R4 is the only arm in the grid that uses cross-attention rather than mean- pooling the tiles before projection. That distinction is the finding: keeping local morphological heterogeneity un-pooled is what wins retrieval.
the number, and its scope
| AUC (matched vs mismatched pairs) | 0.8591 |
| 95% CI, Hanley-McNeil | [0.8566, 0.8616] |
| 95% CI, patient bootstrap | [0.8576, 0.8608] |
| test niches | 35,594 |
| negatives | 355,940 |
| evaluation | cross-subarray, patient-held-out (14 held-out patients) |
Patient-held-out is the only honest split here: the three subarrays per patient are consecutive 16 µm sections of one frozen block, so splitting below patient level reports subject identity as if it were method quality.
limits - read before using
This evidence is about one cohort, and does not transfer by assumption.
- Platform. Trained on the original Spatial Transcriptomics platform (Stahl et al. 2016): 100 µm spots, 150 µm centre-to-centre, ~200 cells per spot. Not 10x Visium. A different platform derives its own evidence or, in omicstra's terms, is not routable.
- Tissue. 92 triple-negative breast cancer patients (Wang et al. 2024).
- Encoder compatibility is empirical, not assumed. Novae was trained on image-based ST (MERSCOPE, Xenium, CosMx) at subcellular resolution, which does not overlap this platform.
- A caveat that travels with the H2 results: the structural-coherence
reference label is a 14-class NMF factorisation of the same expression matrix,
and it scores NMI 0.539 against patient identity - above the 0.5 confounder bar
this project applies elsewhere. It is a derived reference, not expert
annotation, and the seed cohort binds no
annotationrole at all.
The exact split is in split.json, the configuration in run_config.json, and
the full grid with all ten arms is in the repository.
files
| file | what |
|---|---|
checkpoint.pt |
state dict, 2,137,216 parameters |
run_config.json |
loss, fusion, τ, seed, epochs, input SHAs |
split.json |
the patient-level split, seed 42 |
metrics_h1_ci.json |
AUC with both CI methods |
training_log.csv |
per-epoch loss |
training
InfoNCE, τ 0.07, cross-attention fusion, MLP projection, dropout 0.3, lr 5e-4, weight decay 1e-3, max 50 epochs with patience 10, seed 42, CPU. No supervision signal: the positive pair is physical co-registration, not a label.
That last point matters. H&E and ST here come from the same 16 µm section - stained, imaged, then coverslip removed and permeabilised in place - so the matched pair is a fact of geometry with no registration error, rather than a label someone assigned.
using it
The checkpoint is a plain PyTorch state dict. In omicstra it is one arm of a grid, and the server will only route a question to it when a cohort's own recorded evaluation supports doing so:
pip install omicstra
export OMICSTRA_PROJECT_DIR=/path/to/a/cohort
omicstra route cross_modal_retrieval
A cohort with no evidence pack is reported as not routable rather than inheriting this one's winner. That refusal is the intended behaviour.
citation
@software{sanati2026omicstra,
author = {Sanati, Nasim},
title = {omicstra: a multi-agent MCP server for cross-modal embedding
alignment and evidence-based routing in spatial biology},
year = {2026},
doi = {10.5281/zenodo.22666752},
url = {https://github.com/teslajoy/omicstra},
license = {MIT}
}
Seed cohort: Wang et al. 2024, Nat. Commun. 15:10232. Funded by the ResearchHub Foundation.