Modular vs Monolithic Architectures for GRN Edge Prediction

Gradient Stability Analysis and a Controlled Cross-Architecture Comparison. A controlled comparison of modular two-tower models against monolithic cross-encoders for GRN inference. We diagnose three critical gradient failures in the two-tower design and demonstrate that the cross-encoder outperforms it, especially under class imbalance.

0.904Cross-encoder AUROC
83.03%Cross-encoder accuracy
−6.87 ppTwo-tower imbalance drop

Research Snapshot

Architecture comparison, gradient failure analysis, and imbalance robustness results.

0.904Cross-encoder AUROC
0.810Two-tower AUROC
3Gradient failures found
Author
Evint Leovonzko
Dataset
Human brain single-cell RNA-seq: 47,388 TF–gene pairs, balanced and 5:1 imbalanced.
Implementation
Pure Rust with per-batch Adam, gradient clipping (threshold: 5.0), stable backward pass.
Tagged
Gradient StabilityCross-EncoderscRNA-seqRust

Concept Overview

Cross-EncoderGradient FailureAUROC

Abstract

Introduction — This paper investigates the design trade-offs between modular two-tower models (using separate pathways and similarity scoring) and monolithic cross-encoders (processing pairs jointly through MLPs) for predicting transcription factor–gene interactions in gene regulatory networks.

Methods — Three critical gradient failures in the original two-tower implementation are identified and corrected: double-sigmoid in the backward pass, unstable gradient estimators, and missing gradient clipping. Both architectures are then evaluated on balanced and 5:1 imbalanced training configurations using accuracy, F1, and AUROC over five random seeds with bootstrap confidence intervals.

Results — After gradient correction, the cross-encoder achieves 83.03% accuracy vs the two-tower’s 80.90%, with AUROC 0.904 vs 0.810 under balanced training. Under 5:1 imbalance, the two-tower degrades −6.87 pp while the cross-encoder degrades only −1.56 pp. Each gradient failure alone collapses training accuracy to ~50%.

Discussion — The gradient failures explain a substantial portion of the two-tower’s underperformance relative to the cross-encoder. Even after correction, the cross-encoder’s joint processing of TF–gene pairs provides a fundamentally better inductive bias for interaction prediction than independent encoding followed by similarity scoring.

Conclusion — For GRN link prediction, monolithic cross-encoders outperform modular two-tower models on both accuracy and imbalance robustness, particularly in realistic biological settings where negative examples far outnumber positives.

Introduction

Two-tower (dual-encoder) models are attractive for link prediction tasks because they can independently encode entities and support efficient nearest-neighbor retrieval at inference time. However, their modular design limits the model’s ability to capture joint interactions between input pairs, which may be critical for biological link prediction.

Key Question

Does the modular separation of a two-tower model fundamentally limit its expressivity for GRN inference, or can the gap be closed by correcting implementation-level gradient failures?

This study diagnoses three previously unreported gradient failures in a state-of-the-art two-tower GRN model, corrects them, and then conducts a controlled comparison against a monolithic cross-encoder to isolate the effect of architecture from implementation bugs.

Methods

  1. Gradient Failure Diagnosis — Three critical failures were identified in the original two-tower backward pass: (1) double-sigmoid producing vanishing gradients, (2) numerically unstable gradient estimator, and (3) missing gradient clipping causing explosive updates. Each failure individually collapses training to ~50% accuracy. Gradient Analysis Numerical Stability Debugging
  2. Architecture Definitions — The corrected two-tower model uses separate entity and expression encoders combined via dot-product similarity. The cross-encoder concatenates TF and gene features before processing through a shared MLP. Both use per-batch Adam with gradient clipping (threshold: 5.0) and stable numerics. Two-Tower Cross-Encoder Adam
  3. Controlled Evaluation — Both architectures are evaluated on human brain scRNA-seq data (47,388 TF–gene pairs) under two training regimes: balanced (1:1 positive:negative) and imbalanced (5:1). Metrics include accuracy, F1, and AUROC over five random seeds with bootstrap confidence intervals. Bootstrap CI Imbalance Testing 5 Seeds

Results

After gradient correction, the cross-encoder consistently outperforms the corrected two-tower across all metrics and both training regimes.

Reported accuracy: cross-encoder vs two-towerTest accuracy (%) on human-brain scRNA-seq (47,388 TF–gene pairs). The 5:1 bar is derived from the paper’s reported balanced accuracy minus its imbalance drop (−1.56 pp vs −6.87 pp).

Architecture Comparison (Balanced Training) — Cross-encoder vs two-tower on human brain scRNA-seq, both with corrected gradients.

Model Accuracy AUROC Imbalance Drop (5:1)
Cross-Encoder (Monolithic MLP) 83.03% 0.904 −1.56 pp
Two-Tower — corrected (Modular MLP) 80.90% 0.810 −6.87 pp

The cross-encoder’s joint input processing provides a fundamentally stronger inductive bias for GRN link prediction, remaining stable under the class imbalance ratios typical in real biological datasets.

Gradient Failure Impact

Each of the three gradient failures individually collapsed training to approximately 50% accuracy, no better than random guessing. Diagnosing and correcting all three was a prerequisite for a fair architecture comparison.

Discussion

The gradient stability analysis reveals that a substantial portion of the two-tower’s apparent underperformance in prior work was attributable to implementation bugs rather than architectural limitations. After correction, the performance gap narrows but persists.

Imbalance as a Practical Concern

Real GRN datasets are highly imbalanced. Regulatory interactions are sparse against the vast space of non-interacting pairs. The two-tower’s −6.87 pp degradation at a mild 5:1 ratio suggests it is poorly suited for production biological applications without significant modifications.

The cross-encoder’s monolithic joint processing naturally captures TF–gene co-expression patterns that the two-tower’s independence assumption prevents. This architectural difference, not implementation quality, ultimately drives the AUROC gap of 0.094.

Conclusion

This study provides two contributions: a gradient failure diagnosis applicable to any two-tower model implemented without automatic differentiation, and a controlled architectural comparison showing that monolithic cross-encoders outperform modular two-tower models for GRN link prediction.

For practitioners, the gradient failure checklist (double-sigmoid, unstable estimator, missing clipping) is directly applicable to other Rust or custom-framework implementations. For researchers designing GRN inference architectures, the results favor joint encoding over independent encoding followed by similarity scoring.

Future work should examine whether the two-tower’s efficiency advantages (precomputed entity representations) can be retained while closing the AUROC gap through architectural modifications such as late interaction or cross-attention scoring.

Abstract

Should you build one big AI model, or two smaller ones that work side by side? This paper looks at where the "two smaller ones" approach quietly breaks — and how much of its bad reputation is really just buggy code rather than a bad idea.

After fixing three hidden bugs in the split-design model, the single bigger model still wins clearly, especially once you test it on realistic, lopsided data where true gene-control links are rare.

Introduction

Cells decide what they do based on which genes are switched on. A transcription factor is a gene whose job is to flip other genes on or off, and the map of who controls whom is called a gene regulatory network, or GRN. This paper tests two ways for an AI to predict these control links. The "two-tower" approach looks at each gene by itself, then asks whether the two descriptions seem to match. The "cross-encoder" approach looks at both genes together from the start.

Two-tower models are popular because each tower can describe its own input in advance, which makes searching for matches fast later. The trade-off is that the two towers never truly meet — they can't pick up on the back-and-forth between a pair, and in biology that back-and-forth is often where the real answer lives. The open question this paper asks: is the two-tower design held back by its split structure, or has it just been let down by buggy code that, once fixed, would let it catch up?

Methods

Before comparing the two designs fairly, the researchers had to fix the two-tower model's learning signal. AI models learn by nudging themselves in tiny steps during training, and three bugs were found quietly breaking those nudges: the model squashed its own learning signal twice (leaving almost nothing to learn from), it used a shaky math shortcut that produced noisy nudges, and it never capped how large a nudge could grow, so some blew up and derailed training. Any one of these bugs alone was enough to crash accuracy down to about 50% — a coin flip.

After fixing all three, both models were tested on real single-cell gene-expression data from the human brain (47,388 transcription factor–gene pairs), under two conditions: a fair 1-to-1 mix of real and fake pairs, and a harder 5-to-1 mix that looks more like real biology, where true links are much rarer than false ones. Each test was run five times and scored on accuracy, F1, and AUROC (a ranking quality score), with confidence ranges reported.

Results

Even after fixing the two-tower's bugs, the cross-encoder (the single bigger model) wins on every measure. It reaches 83.03% accuracy versus the two-tower's 80.90%, and an AUROC of 0.904 versus 0.810.

The gap grows once real pairs become rarer: at the harder 5-to-1 mix, the two-tower loses 6.87 percentage points of accuracy, while the cross-encoder only loses 1.56 points. And confirming how damaging they were, each of the three learning-signal bugs, tested individually, was enough on its own to crash training down to roughly 50% accuracy.

Discussion

A lot of the two-tower's poor reputation really did come from those three bugs rather than the underlying idea — but fixing them doesn't close the gap entirely. Looking at both genes together from the start is simply a better fit for this problem than judging each gene alone and then comparing notes afterward, because the cross-encoder can spot patterns in how two genes switch on and off together that the two-tower is structurally blind to.

This matters for real-world use: actual gene networks are heavily lopsided, since most random gene pairs don't actually control each other, so true regulatory links are rare. The two-tower's accuracy drop at even a mild 5-to-1 ratio is a warning sign that it isn't ready for production biology use without real design changes, where the imbalance is far worse than 5-to-1.

Conclusion

For predicting which genes control which, the single bigger (cross-encoder) model beats the split-into-two-pieces (two-tower) model — it's more accurate, and it holds up far better when true links are rare, which is exactly what real biology looks like.

This work offers two practical takeaways: a checklist of learning-signal bugs (double squashing, shaky math, no step-size cap) that anyone hand-building a two-tower model can check for, and evidence that letting a model look at both genes together from the start beats studying each one alone. The next open question is whether the two-tower's speed advantage (pre-computable descriptions) can be kept while still closing the accuracy gap — perhaps by letting the two towers "compare notes" once more at the very end of the process.

Back to Research