Two-Tower Hybrid Embedding Networks for GRN Inference

A pure-Rust two-tower MLP that learns entity embeddings and cell-type expression profiles to predict transcription factor–gene interactions: 83% ensemble accuracy, CPU-trainable without any deep learning framework.

83.06%Ensemble accuracy
0.844AUROC
47,388TF–gene pairs

Research Snapshot

Architecture details, dataset, and key performance metrics for this GRN inference study.

83.06%Ensemble accuracy
0.844AUROC
~4 hrsCPU training time
Author
Evint Leovonzko
Dataset
Human brain single-cell RNA-seq: 47,388 TF–gene pairs from DoRothEA & TRRUST databases.
Implementation
Pure Rust without PyTorch or TensorFlow, enabling deterministic CPU training.
Tagged
Gene Regulatory NetworksTwo-Tower MLPscRNA-seqRust

Concept Overview

Two-Tower MLPscRNA-seqRust

Abstract

Introduction — Inferring gene regulatory networks (GRNs) from single-cell RNA-seq data is a central challenge in computational biology. This paper proposes a two-tower multilayer perceptron that jointly learns entity embeddings for transcription factors and target genes alongside cell-type-specific expression profiles to predict regulatory interactions.

Methods — Separate encoder towers process 512-dimensional learnable embeddings and 11-dimensional cell-type expression profiles through three fully connected layers with batch normalization and dropout. Interaction scores are produced via temperature-scaled dot-product similarity (τ = 0.05). The system is implemented entirely in Rust without external deep learning dependencies.

Results — On a human brain dataset with 47,388 TF–gene pairs, the single model achieves 80.14% accuracy and AUROC of 0.844. A 5-model ensemble reaches 83.06% accuracy. Hyperparameter optimization alone contributed 77% of total improvement (+16.1 pp), with cross-seed variance (CV = 2.06%) confirming model robustness.

Discussion — A competing cross-attention model (GCAN) achieved 91% accuracy but only 0.692 F1-score due to poor recall, underperforming on balanced prediction metrics. This highlights a critical accuracy–F1 paradox where high accuracy masks poor generalization under class imbalance.

Conclusion — A carefully optimized standard MLP can achieve competitive GRN inference results (83%) while remaining CPU-trainable, challenging the assumption that complex architectures are necessary for strong performance on this task.

Introduction

Gene regulatory networks encode the interactions between transcription factors (TFs) and target genes that govern cellular identity and function. Reconstructing these networks from single-cell RNA-seq data is challenging due to the high dimensionality, sparsity, and cell-type heterogeneity of expression measurements.

Key Motivation

Prior work on GRN inference often relies on complex graph neural networks or attention mechanisms. This study investigates whether a well-tuned, simple MLP can close the gap, with the added benefit of full CPU trainability and no framework dependencies.

This paper presents a two-tower architecture that separately encodes TF and gene identities through learned embeddings, while a second pathway encodes cell-type-specific expression profiles. The towers are combined via temperature-scaled dot-product similarity to produce regulatory link predictions.

Methods

  1. Dataset & Regulatory Priors — Human brain single-cell RNA-seq data was paired with regulatory ground truth from the DoRothEA and TRRUST databases, yielding 47,388 TF–gene pairs split 70/15/15 for training, validation, and testing. DoRothEA TRRUST scRNA-seq
  2. Two-Tower Architecture — Each tower consists of three fully connected layers with batch normalization and dropout. The entity tower processes 512-dimensional learnable embeddings for TFs and genes; the expression tower processes 11-dimensional cell-type mean expression profiles. MLP Batch Normalization Dropout
  3. Similarity Scoring & Training — Tower outputs are combined via temperature-scaled dot-product similarity (τ = 0.05) with sigmoid activation. Training uses Adam optimizer with L2 regularization (λ = 0.01), learning rate 5×10³, and early stopping with 10-epoch patience. Adam L2 Regularization Early Stopping
  4. Ensemble & Evaluation — Five independently trained models are aggregated by averaging predicted probabilities. Cross-seed evaluation across five random initializations measures variance (CV = 2.06%). Metrics include accuracy, F1, AUROC, and a comparison against GCAN (cross-attention baseline). Ensemble AUROC Cross-seed

Results

Performance is evaluated on 47,388 human brain TF–gene pairs across single and ensemble configurations.

Model Performance Comparison — Single model vs ensemble vs GCAN baseline on human brain scRNA-seq data.

Model Accuracy AUROC F1-Score
Two-Tower (Ensemble ×5) — Our Model 83.06% 0.844 ~0.83
Two-Tower (Single) — Our Model 80.14% 0.844 ~0.80
GCAN (Cross-Attention) — Baseline 91% 0.692

GCAN’s 91% accuracy masks a 0.692 F1-score driven by poor recall. The two-tower ensemble is more reliable on balanced prediction despite a lower headline accuracy.

Accuracy Attribution

Hyperparameter tuning alone contributed +16.1 percentage points (77% of total improvement). Ensemble aggregation added +2.9 pp and expression features +1.8 pp.

Discussion

The results challenge the common narrative that GRN inference requires increasingly complex architectures. A carefully tuned two-tower MLP, implemented without any deep learning framework, achieves competitive accuracy on a challenging human brain dataset.

The Accuracy–F1 Paradox

GCAN’s 91% accuracy is inflated by biased recall. When evaluated on balanced metrics, the two-tower model outperforms it, illustrating why accuracy alone is insufficient for imbalanced biological datasets.

The pure-Rust implementation introduces a useful engineering constraint: no automatic differentiation, no GPU assumed, full determinism. This forced explicit numerical decisions (temperature scaling, L2 regularization) that ultimately contributed to model stability, evidenced by a cross-seed CV of only 2.06%.

Conclusion

This study demonstrates that a standard, well-tuned MLP implemented in pure Rust can achieve 83% ensemble accuracy on GRN inference from single-cell RNA-seq data, competitive with significantly more complex architectures.

The dominant contribution of hyperparameter optimization over architectural complexity suggests that future work on GRN inference should prioritize thorough tuning before escalating model complexity. The CPU-trainable implementation also makes the approach accessible to researchers without GPU infrastructure.

The accuracy–F1 paradox observed in the GCAN comparison is a cautionary note for benchmarking in computational biology: headline accuracy on imbalanced datasets can be misleading, and balanced metrics like F1 and AUROC should be primary evaluation criteria.

Abstract

Cells are run by genes that switch each other on and off, and mapping those switches from single-cell data is a hard, central puzzle in biology. This paper tries a fairly simple AI setup — two small neural networks that read gene identities and cell activity, then compare notes — and finds it does surprisingly well, training on nothing more than a regular laptop CPU.

Introduction

A gene regulatory network is the map of which "controller" genes (transcription factors) switch which other genes on or off. Rebuilding that map from single-cell data is hard because the measurements are enormous, sparse, and vary a lot between cell types.

Most prior work on this problem reaches for complicated graph neural networks or attention-based AI. This paper asks a simpler question: can a well-tuned, ordinary neural network close the gap instead — with the bonus of running fully on a CPU, without needing any existing deep-learning software framework?

Methods

The model uses a "two-tower" setup: one small neural network reads the controlling gene, one reads the gene being controlled, and they meet in the middle to score whether one likely controls the other. It also factors in how active each gene is across different cell types.

Each gene gets a numerical fingerprint — a list of 512 numbers the model learns on its own — while each cell type gets a smaller 11-number profile of gene activity. Both pass through three layers of a small neural network that smooths and stabilizes the signal. To judge whether one gene likely controls another, the model measures how closely aligned the two fingerprints are, using a tuning knob that sharpens the comparison. The whole system was built from scratch in Rust, without relying on PyTorch, TensorFlow, or any other deep-learning framework.

Results

Tested on 47,388 real gene pairings from human brain data, a single model gets 80.14% of predictions right, with a quality score (AUROC) of 0.844 out of a possible 1.0. Averaging together 5 models trained independently pushes accuracy up to 83.06%.

Most of that improvement — 77%, or +16.1 percentage points — came simply from carefully tuning the model's settings, not from any fancy new architectural trick. Results barely shifted when the model was re-run from different random starting points, showing the approach is steady and reliable.

A rival model called GCAN looks better at first glance, with 91% accuracy. But its F1 score — a measure of how well it actually catches real regulatory links rather than just guessing "no link" — is only 0.692, meaning it misses a lot of true cases. A flashy headline accuracy number can hide a model that quietly fails whenever the data is uneven.

Discussion

These results push back against the idea that you need increasingly complicated architectures to do well at this task. A carefully tuned, ordinary two-tower network — with no fancy attention mechanisms — is competitive with much more elaborate designs.

The GCAN comparison is a useful cautionary tale: its high accuracy is inflated by the fact that most gene pairs are NOT truly connected, so a model that leans toward predicting "no link" can look accurate while still missing most of the real connections. Building the whole system in pure Rust (with no automatic differentiation library and no GPU assumed) also forced explicit, careful numerical decisions that likely contributed to how stable and reproducible the results turned out to be.

Conclusion

A standard, well-tuned neural network, implemented entirely in Rust with no deep-learning framework, reaches 83% ensemble accuracy on this gene-regulation prediction task — competitive with far more complex alternatives, and trainable on an ordinary CPU.

Since careful tuning contributed far more than architectural complexity did, future work on this kind of problem should prioritize thorough tuning before reaching for more elaborate models. The accuracy/F1 mismatch seen in the GCAN comparison is also a broader lesson for this field: headline accuracy on imbalanced biological data can be misleading, and more balanced scores like F1 and AUROC should be trusted first.

Back to Research