Math Notes

Every derivation that matters across the four papers, plus the ones I added. LaTeX throughout — renders in VS Code (Markdown Preview Enhanced), Obsidian, Jupyter, and GitHub.

Notation, fixed once and used everywhere:

SymbolMeaningReal size
the toxicogenomics matrix,
row a (platform, tissue, gene) triple
column a treatment = (chemical, dose, duration)
fold-change vs. control
set of observed index pairs
gene factors
treatment factors
gene and treatment biases
drug latent for treatment
tissue set,

Write for the rows of belonging to liver, and similarly . With on CodeLink.


1. Funk-SVD / ToxCompl

1.1 The objective

Fit by SGD (Adam, , weight decay ) over observed entries only. Unobserved entries contribute nothing to the loss; they’re recovered by the low-rank structure alone.

Netflix Prize, exactly. Genes are users, treatments are movies, fold-change is the rating.

1.2 Why low rank is defensible

columns, but only distinct drugs, each at dose/duration regimes. Similar molecules (Doxorubicin, Epirubicin) produce similar responses. Genes come in co-regulated modules. The same gene is measured across 8 organs. So

and out of is plausible. Their argument, and it’s a good one.

1.3 Why it breaks

The rare signals — the of entries with — are precisely the part that isn’t low-rank. Empirically (ToxCompl+ Fig. 2), moving from DrugMatrix to DSMatrix:

with the worst point at against . The sign flipped. And increasing made MAE better and MaxAE worse still — capacity isn’t the bottleneck, the assumption is.

1.4 ToxCompl+ fix (a): side information

Rows carry features (platform, marker, organ), columns carry features (drug, duration, dosage). Embed each of features into :

Result: MaxAE , but MAE . A trade.

1.5 ToxCompl+ fix (b): attention-augmented aggregation

This is the group’s signature move. It recurs in GenTox, so learn it once.

Vanilla MF weights all latent dimensions equally via a plain dot product. Instead, learn two extra factor matrices and let them decide, per cell, how much each latent dimension counts:

where is the Hadamard (elementwise) product and is softmax.

Read it as attention. With “positions” and a single query:

Result: MaxAE , MAE . Large win.

The obvious objection: is that from attention, or from doubling the parameters ()? They pre-empt it: raising from 300 to 500 also adds parameters and hurt. Decent evidence the nonlinearity is doing real work. Not airtight — the clean ablation is with , which isolates nonlinearity from capacity. Worth asking whether that was run.


2. The linearity of the augmented task

This is my argument, not the papers’. It is tested in code/experiments/exp02_rank_test.py and it holds.

2.1 Setup

TransTissue Algorithm 1 pretrains on Funk-SVD output. So take the augmented matrix

For a fixed treatment , the source (liver) and target (kidney) profiles are:

with , .

2.2 The recovery

Stack the unknowns as and define the augmented design

Then , which is

— wildly over-determined. If has full column rank (generic for random-ish ), least squares recovers exactly:

2.3 The conclusion

Substituting back:

An exact affine map , with

So on purely augmented data, LI KI translation has a closed-form linear solution. No transformer required. Ridge regression should hit .

2.4 What the experiment found

TestMAE
ridge () on augmented pairs1.00000.0000
ridge () on augmented pairs1.00000.0009
analytic , no fitting at all1.00000.0000
recovery: 1.000000
ridge on real measured pairs () [control]0.93200.0406

Confirmed. Exactly.

2.5 Where I was wrong

I predicted . It doesn’t. Observed rank is , flat across .

Why: is an upper bound, not the rank. Funk-SVD doesn’t use its capacity — it allocates latent dimensions to whatever variance exists. When a generic stress response dominates, the factorisation spends nearly everything on one direction, and the induced map is essentially

— rank one. “Read the severity scalar off the liver, scale the kidney’s generic stress direction by it.”

The corrected claim is stronger than the original. The augmented pretraining task isn’t merely linear; on data with a dominant common response it’s nearly rank-one.

2.6 The rank as a diagnostic

Sweeping the generic:specific variance ratio (see §5):

regimeridge on augmented
almost all generic0.9 / 0.121.0000
mostly generic0.75 / 0.2521.0000
balanced0.6 / 0.421.0000
mostly specific0.4 / 0.651.0000
almost all specific0.15 / 0.8551.0000

always — the task is always exactly linear. Only the rank moves.

The afternoon experiment for real DrugMatrix: run ToxCompl (the group already has it), induce , plot . If it’s near rank-one, the augmented pretraining data carries only the generic stress response, and Figure 7’s pretrain row is measuring a matched filter.

2.7 What this does and doesn’t touch

  • ✅ It says TransTissue Figure 7’s pretrain row (RF 0.51 / MLP 0.64 / TTF 0.90) measures linear-map approximation, not “intricate relationships between transcriptomic profiles from different tissues” (the paper’s phrase). And TTF’s bottleneck with is structurally matched to the generative process. Matched filter.
  • ❌ It says nothing about the fine-tuned on real measured data. That’s real held-out measurement.
  • ❌ It does not say TransTissueFormer is a bad model.

It says one figure means something different from what it claims, and a ridge baseline is missing from it.


3. GenTox’s metric theorems

Read GenTox §2 before trusting any Pearson correlation in this field.

3.1 Theorem 1 — PCC is inflated on absolute expression

Let be a base vector with non-vanishing variance, and

with independent sparse perturbations having at most nonzero i.i.d. entries (mean , variance ). Then

Proof sketch. Write centred vectors and

with , and collecting the cross terms. Since and, by Cauchy–Schwarz, , we get . Markov then gives

and the continuous mapping theorem finishes it.

What it means. Two completely unrelated drug profiles share the “this is a liver cell” baseline . Their correlation regardless of the drugs. The shared baseline dominates; the sparse differences vanish.

Their own empirical demonstration — a real trained MLP on TG-GATEs:

orientationPCC-value
treatment-profile-wise (column)
gene-profile-wise (row)

and it learned nothing ( row-wise is pure noise).

NLP analogy: BLEU where every reference shares 92% of its tokens. You’d score 0.95 by copying the input. This is that, proved.

3.2 Theorem 2 — PCC is suppressed on fold-change

Let be fixed, nonzero, sparse with nonzero entries, and . Define , . Then

Proof sketch. since has only nonzeros. The cross term , so . The noise term , so . Hence but , and Slutsky gives

Correlation is governed by

so with constant , large crushes it.

3.3 The two theorems cut opposite ways

DataRegimeConsequence
absolute (TG-GATEs intensity)Thm 1: high PCC is meaningless
fold-change (DrugMatrix)Thm 2: high PCC is hard-won

This partially defends TransTissueFormer’s . DrugMatrix is fold-change, so Theorem 2’s regime applies, and 0.793 against that headwind is real.

But it does not defend against a mean-predictor baseline, and this is the sharpest gap:

Theorem 2 assumes i.i.d. Gaussian noise. A mean predictor’s error is , which is structured: sparse, non-Gaussian, and correlated with . Neither theorem covers it.

That’s the hole. It’s why exp01 exists.

3.4 The rank-degeneracy argument (GenTox §2.3)

Consider outputting for ground truth , with a different scalar per column. Since correlation is scale-invariant,

A perfect column-wise score. But now look at rows — gene vs gene across all treatments. Row of the prediction is

each entry scaled by a different arbitrary . Row structure is destroyed.

Why fatal: gene network analysis — what biologists actually want — builds a graph with nodes = genes and edges = co-expression across treatments, i.e. correlations between rows and . A model perfect column-wise and garbage row-wise produces profiles that score beautifully and are useless.

Verified in code/toxsim/metrics.py: the degenerate adversary scores exactly.

always report both orientations. Proposed suite: MAE, rare MAE, , , with MAD as a data characteristic.

3.5 A consequence nobody states

Row-wise PCC is exactly the metric that exposes the mean baseline.

The mean predictor outputs for all — constant along each row. So

Not low. Undefined. A model that learned only the generic stress response has, by construction, zero row-wise information.

Confirmed empirically in exp01: the mean baseline scores and .

GenTox argues from first principles that row-wise metrics are mandatory. TransTissue reports only column-wise. The metric that would settle the question is the one their own group already argued for — in another paper.


4. The CPA correspondence

My observation. Not stated in any of the four papers, and I haven’t searched the literature to confirm nobody else has said it — check before claiming novelty.

CPA (Lotfollahi et al. 2023) decomposes the latent additively:

then decodes. An adversarial classifier forces to carry no drug information, which permits recombination at test time — compositional generalization.

Now compare to ToxCompl:

ToxComplCPA
(gene bias)
(treatment bias)scalar part of
the interaction, but bilinear instead of decoded
decoder identity

Funk-SVD is the linear special case of CPA. this line of work has been building a linear, transductive CPA and calling it matrix completion. That’s not a criticism — it says the two literatures are the same idea at different points on the nonlinearity axis.

4.1 The proposed generalization

Translation becomes: encode source infer decode with target tissue embedding .

What it buys:

  1. One model for all 64 tissue pairs, not 32 separate ones.
  2. Uses unpaired profiles. A brain profile with no liver counterpart still trains and .
  3. Subsumes Funk-SVD (set , a lookup, and you recover it exactly) — so it extends the group’s work rather than replacing it.
  4. Plug in GenTox’s GNN compound embedding for generalizes to unseen drugs. This unifies GenTox and TransTissueFormer into one model.
  5. Zero-shot tissue pairs. BR–LI has pairs. But if trains from any brain data and from any drug data, you can decode brain from liver having never seen a single LI–BR pair.

Point 5 is the paper. It’s zero-shot NMT, and it’s precisely what target-token conditioning unlocked (Johnson et al. 2016).

4.2 The multi-task failure, formally

TransTissue’s multi-task model collapsed to (vs 0.53 single-task). Their diagnosis: “given the same source LI profile the model cannot decide which is the correct target.”

Formally: they fit where ranges over . Under squared loss the optimal single-valued is the conditional mean:

The model is behaving optimally for a mis-specified problem. It’s averaging the organs because you asked it to, and mush is the correct answer to an ill-posed question.

The fix is to condition:

by adding to the bottleneck. One embedding. This is <2es> from Johnson et al. 2016 — mBART and M2M-100 do the same.

The negative result at 0.23 is a conditioning bug, not a finding. That’s the highest-value, lowest-cost thing to bring to the original authors.

Caveat I want to keep attached to this: I have not verified the fix works here. 425 pairs is very little and the conditioning signal could be swamped. But the diagnosis in the paper is the textbook symptom.


5. The simulator’s generative model

code/toxsim/simulate.py. For treatment and tissue :

with , severity , .

Normalize per row so that , giving

I got this wrong the first time — normalizing by column shrinks the specific term by and silently destroys the signal, making translation impossible by accident. The bug produced a plausible-looking result. Check your normalizations.

Tissue relatedness: with shared basis and

Same family similar loadings translatable on tiny data. This encodes the HE/TM ( on 7 pairs) vs LI/KI ( on 425) phenomenon.

Cross-tissue translation is solvable by construction: recover from (possible when has full column rank), then apply . The mean predictor captures only the term. So

We do not know where real DrugMatrix sits on this axis. That’s the whole point of exp01.


6. Missingness is NOT at random

TransTissue §5 states: “Completion algorithm for missing at random patterns can be used for imputation.”

That assumption is load-bearing for Funk-SVD, and I think it’s false.

Evidence (code/toxsim/fit_panels.py): Table 3 decomposes exactly into a non-negative sum of study panels. Solving

where is the vectorised Table 3 and , gives:

  • residual
  • mean absolute error
  • all 24 structural zeros reproduced

using 24 panels out of 47 candidates.

Why the structural zeros matter. Table 3 has despite and . Under any independent-sampling model,

Observing exactly is not a sampling accident. Brain was only ever measured in studies that did not do liver. That’s a study-design fact.

Therefore: missingness depends on study design, and study design depends on what toxicologists expected to be interesting for that compound. So

i.e. the data are Missing Not At Random, and the Funk-SVD imputation is biased in a way that low-rank recovery theory does not cover.

How much does it matter? Unknown — and the simulator is exactly where you’d find out, since it can generate both MAR and MNAR missingness with the same ground truth. That’s a clean, self-contained experiment (agenda Tier 0f).

Caveat: the panel decomposition is not unique (36 equations, 47 candidates — underdetermined). It’s a valid decomposition, not the study design. The original study metadata would settle it.


7. Complexity of the TransTissueFormer architecture

From TransPlatformer Table 6, with = sequence length, = projected rank, = head dimension:

MethodComplexityScore matrix
Standard attention
Linformer
TransTissueFormer

The pipeline:

Standard attention on (Affymetrix) needs a score matrix. Dead on arrival. The bottleneck makes it .

This is Perceiver-shaped, and closer to Perceiver IO than to Linformer/Performer: cross-attend a huge input into a small latent array, compute in latent space, broadcast back out. The papers cite Linformer and Performer but not Perceiver. Worth raising — and note is a very small per-slot embedding by NLP standards. Ask whether that was compute-bound or whether something breaks when it grows.


8. Quick reference — what’s proven, what’s tested, what’s a guess

ClaimStatus
Funk-SVD objective, ToxCompl+ attention formFrom the papers. Verbatim.
GenTox Theorems 1 & 2From the paper. Proofs reproduced above.
Degenerate scores Proven + verified in code.
Augmented task is exactly affineVerified in code (exp02): , analytic construction exact.
Proven. Algebraic bound.
FALSE. I was wrong. Observed .
Augmented task can be near rank-oneVerified in code. Stronger than the original claim.
Row-wise PCC exposes the mean baselineProven (§3.5) + verified. is undefined for it.
Table 3 decomposes exactly into study panelsVerified in code. Residual 0.0, 24/24 zeros.
Missingness is MNARStrongly suggested by the above. Not proven.
Funk-SVD is the linear special case of CPAMy reading. Check the literature before claiming novelty.
Multi-task failure = missing target tokenMy hypothesis. Diagnosis matches; fix untested.
Mean baseline beats TTF on real DrugMatrixUNKNOWN. Requires real data. This is the point.