A recent transcriptomic foundation model, SpecFormer, borrows TF-IDF from text retrieval. TF-IDF (term frequency–inverse document frequency) scores each item by how strongly it appears in one sample, discounted by how common it is across all samples. SpecFormer uses these scores to turn each RNA-seq profile into a ranked list of genes. It then pre-trains a 12-layer transformer on those lists and reports 90.83% accuracy and 0.997 AUC-ROC across 33 TCGA cancer types (Self-Supervised Contextual Representation Learning for Transcriptomic Generative AI). The paper never asks the obvious question: how well does a sparse linear classifier on the same TF-IDF features do? A sparse classifier fits a weight per gene and is pushed to set most weights exactly to zero. This question has been asked in text, where TF-IDF with logistic regression has repeatedly matched or beaten BERT models.
This note proposes a controlled audit that asks a sharper version of that question. The key observation is that inside an L1-penalized linear model, multiplying gene $j$ by its IDF weight is mathematically the same as lowering that gene's sparsity penalty. TF-IDF therefore stops being a mysterious representation and becomes one choice among several per-gene penalty schemes. A second choice comes straight from differential expression analysis, the standard statistical tests for which genes change between conditions. We build sparse linear models whose penalty weights come from prevalence (IDF), from differential-expression statistics, or from nothing (uniform). We then compare them, under identical splits, to SpecFormer and to tree ensembles. We measure cancer-type classification, survival prediction, and transfer across expression normalization schemes. The goal is to find which ingredient, if any, explains the foundation model's advantage.
Core Claim
The claim is that most of what SpecFormer gains comes from two cheap ingredients that a convex sparse model can reproduce. The first is a within-sample transform that removes dependence on the normalization scheme (TPM, FPKM, or raw counts). The second is a per-gene down-weighting of genes that are uninformative across the cohort. We further claim that penalty weights derived from differential-expression statistics, estimated inside each training fold, select smaller and more stable gene sets than IDF weights at equal accuracy.
The mechanism is easiest to see in one line. Let $t_{ij}$ be the within-sample expression of gene $j$ in sample $i$, and let $w_j>0$ be a per-gene weight such as IDF. A linear model with coefficients $\beta_j$ on the features $t_{ij} w_j$, under an L1 penalty with strength $\lambda$, can be rewritten with $\gamma_j=\beta_j w_j$:
$$\min_{\beta}\; \mathcal{L}\Big(\sum_j \beta_j w_j t_{ij}\Big) + \lambda\sum_j|\beta_j| \;=\; \min_{\gamma}\; \mathcal{L}\Big(\sum_j \gamma_j t_{ij}\Big) + \lambda\sum_j \frac{|\gamma_j|}{w_j},$$
Here $\mathcal{L}$ is the logistic or Cox loss. Two consequences follow. TF-IDF under L1 is a weighted lasso with penalty factor $1/\mathrm{idf}_j$, so genes that are rare across the cohort are cheaper to select. And if features are z-scored after TF-IDF, as is routine, the IDF factor cancels completely. That second fact means many "TF-IDF + LASSO" pipelines would silently be uniform-penalty LASSO.
This reframing turns a vague combination of three directions into a specific comparison of penalty factors. Prevalence-based IDF needs a definition of "present." We define it as a count above a fixed threshold, so $\mathrm{idf}_j=\log(N/\#\{i: \text{gene } j \text{ present in } i\})$, where $N$ is the number of training samples. The differential-expression factor is $1/|z_j|$. Here $z_j$ is the moderated statistic from limma or the DESeq2 Wald statistic for gene $j$, computed on the training fold only. These tests model the mean–variance relationship and overdispersion, meaning count variance growing faster than the mean (Yang et al.). Plain fold-change ignores both. Weighted lasso with univariate screening weights is an old statistical idea. What is new here is using it as an explicit decomposition of a transcriptomic foundation model's gains, plus a test of normalization invariance that no paper in the file has run for linear models.
Research Program
We relate prior work to the plan by the role each paper plays.
Papers that motivate the audit. SpecFormer motivates the core comparison. It uses TF-IDF only as a tokenizer for a deep model, and it reports only "moderate" survival performance (C-index about 0.61–0.67), which leaves room for a simpler competitor. The text literature motivates the hypothesis that linear models can be competitive:
- TF-IDF with logistic regression reached F1 0.83 on Dutch radiology reports, against 0.82 for BERTje and 0.63 for MedRoBERTa.nl (Accurate and Reliable Classification of Unstructured Reports on Their Diagnostic Goal Using BERT Models).
- Character n-gram TF-IDF classifiers beat BERT and CNN–BiLSTM models on code-mixed offensive-language detection (Offensive language identification in Dravidian code mixed social media text).
- In AutoDL challenge benchmarks, deep models beat TF-IDF SVMs only on short inputs (Design Patterns for Resource-Constrained Automated Deep-Learning Methods).
None of these touched expression data. A transcriptome is closer to a long document with about 20,000 "words" than to a short one, which is the regime where those results favor linear models.
Papers that constrain the design. Two papers set limits on what the audit can assume:
- Weng et al. found a Random Forest outperformed logistic regression and SVM on a 12-gene LASSO-Cox signature in TCGA-BRCA (Predicting breast cancer prognosis using γδ T cell gene signatures). This is direct evidence against a blanket "linear is enough" claim. We address it head-on by testing whether the gap survives once the linear model may select from the full transcriptome instead of a fixed 12-gene set.
- Bootkrajang and Kabán showed that L1 logistic regression on microarrays keeps false-positive genes under label noise unless a label-flip model is added (Classification of mislabelled microarrays using robust sparse logistic regression). Gene-selection stability must therefore be measured, not assumed.
Papers that supply methods.
- limma (Bioinformatics Analysis of the Effects of Tobacco Smoke on Gene Expression) and DESeq2 (Transcriptomic insights into adenoid cystic carcinoma via RNA sequencing) supply the differential-expression statistics.
- Benjamini–Hochberg false-discovery-rate control (Li et al.) supplies the cutoff for the two-stage baseline.
- epigenelabs/inmoose gives a Python implementation of differential expression and pyComBat batch correction. It lets the whole pipeline run inside one cross-validation loop.
What we build. The program builds one pipeline with four interchangeable parts:
- A within-sample transform: log-CPM, within-sample rank, or TF from library-size-normalized counts.
- A penalty-factor scheme: uniform, IDF, or fold-internal differential-expression statistics.
- A loss: multinomial logistic for cancer type, Cox for survival.
- The usual L1 path with an elastic-net variant. The elastic-net variant addresses LASSO picking one gene arbitrarily from each co-regulated group.
Every factor combination is run under identical nested cross-validation. Differential-expression statistics are recomputed inside each outer fold to prevent leakage.
Baselines
Naive references. The do-nothing reference is the majority-class predictor for classification and a clinical-covariate-only Cox model (age, stage) for survival. Any expression model must clear these to be worth discussing. A second naive reference is a nearest-centroid classifier on log-CPM, which tests whether the cancer-type task is nearly trivial. With a reported AUC of 0.997, it may be.
Two-stage differential-expression baseline. This is standard bioinformatics practice: run DESeq2 or limma on the training fold, keep the top $k$ genes by adjusted p-value or all genes passing FDR 0.05, then fit an unpenalized or ridge logistic model. $k$ is tuned on the same inner folds as our models. Beating it means matching its accuracy with fewer genes, or exceeding it at equal gene count. Its weakness is that it scores genes one at a time and ignores correlation between them. Tang et al. obtained 6,967 significant genes from just 30 samples, which shows how unselective univariate lists can be.
SpecFormer (strongest existing method). The strongest competitor is SpecFormer. Its reported numbers on TCGA pan-cancer are 90.83% accuracy and 0.997 AUC-ROC across 33 cancer types, and C-index about 0.61–0.67 for survival (Self-Supervised Contextual Representation Learning for Transcriptomic Generative AI). We will use its 8,315-sample harmonized cohort. If weights are released, we retrain its classification head on our exact splits. If not, we match its reported split protocol as closely as possible and state plainly that the comparison is against a reported number. Beating it on classification means a sparse linear model within one standard error of 90.83% accuracy using under 1% of SpecFormer's parameters and no pre-training. Beating it on survival means a fold-averaged C-index above 0.67 on the same cancer types.
Tree ensembles. Random Forest and XGBoost are trained both on Weng et al.'s 12-gene signature and on the full transcriptome after variance filtering, with the same tuning budget in inner-fold trials. For TCGA-BRCA, the reported reference is Random Forest internal accuracy 0.835 and external AUC/accuracy 0.81/0.849 across five GEO cohorts (Predicting breast cancer prognosis using γδ T cell gene signatures). Their exact label definition must be reconstructed from that paper. If it cannot be, we report our own Random Forest under our label definition instead of the cited figure.
Key-ingredient ablation. The ablation that isolates the proposal's key ingredient is the uniform-penalty L1 model on z-scored log-CPM, compared against the same model with IDF or differential-expression penalty factors at matched sparsity. A second ablation applies TF-IDF and then z-scores. By the equation above this must equal the uniform arm, and confirming that is a sanity check on the implementation.
Why not just…?
Why not just run standard L1 logistic regression on standardized log-CPM? This is the real threat. On in-distribution cancer-type classification, we expect it to tie with every weighted variant. The proposal is built so that a tie is an informative result: it would show that IDF contributes nothing inside a linear model and that SpecFormer's TF-IDF tokenization is not where its value lies. Where the weighting could matter is selection stability and transfer across normalization schemes. Both are measured directly. If uniform L1 also wins there, we report that and drop the weighting claim.
Why not just use SpecFormer embeddings with a linear probe? We include this arm. Comparing a linear probe on frozen SpecFormer embeddings with a sparse linear model on rank features asks exactly how much pre-training adds beyond the rank transform. The file gives no evidence on probe performance beyond the headline numbers, so this is settled only by the experiment.
Why not just use Random Forest on the full transcriptome? Weng et al.'s Random Forest result came after LASSO had already reduced the input to 12 genes, so the file does not show that trees win at full dimension. We run trees at both dimensionalities. If trees beat full-transcriptome sparse linear models on BRCA risk, that supports Weng et al.'s gene-interaction explanation, and we will say so.
Why not just use Horseshoe Bayesian shrinkage? PanCanVarSel gives credible intervals but was demonstrated only at p=80, n=40 under MCMC (PanCanVarSel: Pan-Cancer Variable Selection). We run it on the top 500 genes after in-fold screening as a survival comparator, and we report its wall-clock time alongside the L1 path.
Proposed Experiments and Decisive Checks
Experiment 1: cancer-type classification. This is TCGA 33-type classification with all factor combinations, scored by accuracy, macro-F1, AUC, and number of nonzero genes.
Experiment 2: survival. We run L1-Cox across TCGA cancer types against SpecFormer's 0.61–0.67 C-index range. For BRCA we additionally test external transfer to the five GEO cohorts with the Weng et al. comparison. Survival is where the foundation model is weakest, so a clear win here is the most consequential possible result.
Experiment 3: cross-normalization transfer (decisive check). SpecFormer's cohort spans five normalization schemes. We train on TPM and test on FPKM and on raw counts, and vice versa. Our prediction is that log-CPM uniform L1 degrades sharply, while rank-based and TF-normalized sparse models degrade little. If so, normalization invariance comes from the within-sample transform rather than from transformer pre-training. GTEx's 27 tissues provide an additional held-out transfer check of tissue clustering using the selected genes.
Experiment 4: selection stability. We measure the overlap of selected genes across bootstrap resamples and outer folds for uniform, IDF, and differential-expression penalty factors, at matched sparsity. The small-n GSE17913 smoker cohort (79 samples) is the hard regime for this test. We also re-run the colon-cancer microarray benchmark against RLogReg's reported leave-one-out error of 4.8%, versus about 8% for Bayesian logistic regression. This checks whether differential-expression weighting reduces the label-noise-driven false selections that Bootkrajang and Kabán documented.
What would falsify the core claim. The claim fails if SpecFormer or its linear probe beats every sparse linear arm by more than fold-to-fold variation on both classification and transfer. It also fails if differential-expression penalty factors give no stability gain over uniform penalties. In either case, the pre-trained representation is doing work that cheap transforms cannot.
References
- Self-Supervised Contextual Representation Learning for Transcriptomic Generative AI
- Transcriptomic Analysis of the Candidate Genes Related to Aroma Formation in Osmanthus fragrans
- Accurate and Reliable Classification of Unstructured Reports on Their Diagnostic Goal Using BERT Models
- Offensive language identification in Dravidian code mixed social media text
- Design Patterns for Resource-Constrained Automated Deep-Learning Methods
- Predicting breast cancer prognosis using γδ T cell gene signatures
- Classification of mislabelled microarrays using robust sparse logistic regression
- Bioinformatics Analysis of the Effects of Tobacco Smoke on Gene Expression
- Transcriptomic insights into adenoid cystic carcinoma via RNA sequencing
- Identification of differentially expressed genes and signaling pathways in chronic obstructive pulmonary disease via bioinformatic analysis
- PanCanVarSel: Pan-Cancer Variable Selection