SURGeLLM

Istanbul Technical University · arXiv:2606.24259 · June 2026

SURGeLLM

Rethinking multi-task evaluation through task-aware feature gating with class-balanced normalization

Noor Islam S. Mohammad1  ·  Uluğ Bayazıt2 Department of Computer Science, Istanbul Technical University · {islam23, ulugbayazit}@itu.edu.tr  1Corresponding author  2Supervising author

A lexical feature gate that helps on three heterogeneous tasks and hurts on the fourth — until you fix the statistics it is fed. The architecture was never the problem.

D4 authorship detection · macro-F1 · RoBERTa backbone

0.762 Baseline encoder,
no gate
0.711 Add the gate on
globally standardized features
0.892 Same gate, class-balanced
statistics (IWN)

The surgical feature vector s ∈ ℝ16 — ten lexical indicator groups, six surface statistics. Hover a cell.

Abstract

Fine-tuned encoders deployed across heterogeneous NLP tasks face three compounding problems: mismatched inductive biases, class-imbalance corruption of feature statistics, and no mechanism to condition attention on external lexical knowledge.

We introduce SURGeLLM, a unified transformer framework that addresses each with a dedicated lightweight module: a surgical feature gate (a learned per-dimension sigmoid over curated lexical indicators and [CLS], which provably degenerates to identity when features are uninformative), task-conditioned prefix tokens (quantized feature values and task identity prepended to every input), and Instance-Weighted Normalization (IWN, which removes class-prior bias from gate statistics). We prove an excess-risk bound linking gate benefit to surgical feature alignment.

Across four tasks — SST-2, multi-hop retrieval, LLM-prompt attribution, and authorship detection — covering 17,830 examples and eleven model variants over three seeds, the IWN variant achieves macro-F1 0.940 (+0.034 over the strongest non-IWN variant; +0.036 over the RoBERTa baseline; +0.130 on authorship detection). A random-vocabulary control (−0.028 avg. F1) confirms gains are lexical, not parametric. Code, vocabularies, and a 99.5%-recovery auto-extraction recipe are released.

What this paper contributes

Framework

A unified multi-task encoder with per-dimension feature gates, task-conditioned prefix tokens, and IWN. Plug-compatible with any HuggingFace encoder; ~1.2M added parameters, about 1% of RoBERTa-base.

Theory

An excess-risk bound (Theorem 1) linking gate benefit to surgical feature alignment ρk, and a degeneracy result (Proposition 2) proving the gate is safe when features carry no signal.

Empirics

Eleven variants over four encoder backbones plus T5-base, three seeds, four-part vocabulary sensitivity study, and a random-vocabulary control that separates lexical content from added capacity.

Method

Four modules, one encoder

Let T = {t1, …, t4} be a fixed task set, each with label space Ytk. We fit a single model fθ: X × T → ∪k Ytk minimizing the multi-task empirical risk:

L(θ) = Σk=1..|T| wk|Dk| Σ(x,y,tk) ∈ Dk ℓ(fθ(x, tk), y)
(1)

with cross-entropy loss ℓ and wk = 1 throughout, relying on per-task batch sampling for balance. The encoder, the feature projection, the gate matrices, the task-embedding matrix, and the prefix embeddings are shared; only the four two-layer classification heads are task-specific. Shared parameters are over 99% of the total, which is what makes the multi-task framing meaningful in the MT-DNN sense.

SURGeLLM forward pass Input text splits into two lanes. The left lane extracts a sixteen-dimensional surgical feature vector, standardizes it with class-balanced statistics, and projects it. The right lane builds a prefix, runs the encoder, and adds a task embedding to the CLS vector. Both lanes meet at a per-dimension sigmoid gate, whose fused output feeds a task-specific head. Input text x (untruncated) Surgical vocabulary — 10 groups s(x) ∈ ℝ¹⁶ (Eq. 4, + 6 surface stats) Task-conditioned prefix ⊕ x [TASK:t | F1:v₁ | … | F16:v₁₆] (Eq. 12) Standardize global (Eq. 8) → IWN class-balanced (Eq. 11) Encoder Eφ BERT · RoBERTa · DistilBERT · ALBERT Feature projection s′ = ReLU(Ws s̃ + bs) (Eq. 5) Task offset h̃ = h + 0.1 · Et (Eq. 3) Per-dimension gate g = σ(Wg[h̃ ; s′] + bg) ∈ (0,1)d (Eq. 6) ĥ = LN( g ⊙ h̃ + (1 − g) ⊙ s′ ) (Eq. 7) Task-specific head k → ŷ
Figure 1. The forward pass. The prefix injects feature values as in-context tokens visible to every attention layer; the gate re-weights the final [CLS] after all attention has resolved. They operate at different representational scales and are complements, not substitutes — removing either degrades performance.

Surgical feature extraction

For each of ten case-insensitive indicator groups vj, the count feature is the number of group members present in the lowercased text, with prefix matching for inflectional families (oscillat* matches oscillation, oscillates, oscillating):

sj = Σw ∈ vj 1[ w ∈ x̃ ],   j = 1, …, 10
(4)

Six surface features are appended: word count, mean word length, sentence count, question-mark count, exclamation-mark count, and a binary digit-presence indicator. Crucially, all sixteen are computed on the full untruncated text, while the encoder sees at most 96–128 tokens. Global statistics destroyed by truncation cannot be recovered from a partial view — this is the deterministic, lossless side channel the gate consumes.

The gate, in three steps

s′ = ReLU(Ws s + bs),   Ws ∈ ℝd×16
(5)
g = σ( Wg [ h̃ ; s′ ] + bg ),   Wg ∈ ℝd×2d
(6)
ĥ = LN( g ⊙ h̃ + (1 − g) ⊙ s′ )
(7)

Sigmoid, not softmax

Sigmoid lets each dimension take any value in (0,1) independently. Softmax would impose a unit budget across dimensions — a competitive constraint that makes no sense for dimension-wise modality fusion.

Per-dimension, not scalar

A scalar gate forces every hidden dimension to use the same modality mix. Too coarse when some dimensions encode lexical surface and others encode semantic content.

LayerNorm after fusion

Re-normalizes the fused vector back to the statistical regime of the unfused encoder output, so downstream layers are not surprised by a mean/variance shift.

The central result

Instance-Weighted Normalization

Before projection, the feature vector is standardized using statistics from the training partition. On a skewed corpus, those statistics belong almost entirely to the majority class.

Under global standardization, the mean is a prior-weighted mixture that collapses onto the majority profile as the skew grows:

ŝ(x) = ( s(x) − s̄k ) / ( σk + ε )
(8)
s̄k = Σc πc s̄c,k  →  s̄c⋆,k   as  πc⋆ → 1
(9)

The gate is then fed a measurement of deviation from the majority profile. Majority instances sit near the origin and look unremarkable; minority instances — the ones that decide macro-F1 — sit far out and look like outliers. IWN replaces the marginal statistics with an unweighted average over per-class statistics:

s̄balk = 1nc,k Σc=1..nc,k s̄c,k,     σbalk = 1nc,k Σc=1..nc,k σc,k
(10)
s̃(x) = ( s(x) − s̄balk ) / ( σbalk + ε )
(11)

The bench: what class skew does to the gate's input

π = 0.50

Schematic illustration of Eq. 9 — not measured data. Two class-conditional feature profiles are placed at ∓1 in raw units with unit within-class scale. Drag the slider to increase the majority-class share and watch where the two classes land after standardization.

Standardized class positions under global versus class-balanced statistics Under global standardization the majority class drifts toward zero and the minority class drifts outward as skew increases. Under IWN both classes remain at minus one and plus one for all skew values. standardized feature position Global standardization (Eq. 8) IWN — class-balanced statistics (Eq. 11)
majority class minority class dashed line = zero of the gate's input space
Majority position−1.00
Minority position+1.00
Center offset0.00
Same under IWN−1.00 / +1.00

At π = 0.903 — the raw 9.3:1 skew of the HumLLM corpus — the majority class sits at −0.19 and the minority at +1.81. That asymmetry is what the gate learns to fuse against.

What IWN actually fixes

Without IWN, the gate's per-class precision and recall on D4 come apart: LLM recall 0.63 against human recall 0.79. The model is biased toward predicting "human" because standardization has shifted the gate's input distribution toward the majority class. IWN symmetrizes the per-class statistics and both classes converge to ≈ 0.89.

SURGeLLM-FULL-RoBERTa (no IWN) SURGeLLM-IWN-RoBERTa
Figure 2. Per-class precision and recall on D4 (HumLLM), RoBERTa backbone, before and after IWN. Measured values from Table 5. The largest single movement is LLM recall, +0.26.

Parameter-free

No new learnable parameters. Only the normalization constants change.

Test-time class-agnostic

The balanced statistics are computed once from training labels and applied at inference with no class information required.

Free on balanced data

When πc = 1/nc, the balanced and marginal estimators coincide up to the weighted/unweighted variance difference. IWN is a strict generalization that costs nothing in the balanced regime.

Compositional

Orthogonal to loss-side and sampling-side remedies — focal loss, class-balanced re-weighting, oversampling. We report IWN-only results for clarity.

Datasets

Four tasks chosen to interfere

Near-isotropic benchmarks do not expose destructive interference. We study the hard case: a single encoder handling movie-review sentiment, multi-hop retrieval QA, LLM-prompt attribution, and human/LLM authorship — tasks that share a backbone but draw on largely disjoint surface signals. All corpora use stratified 70/15/15 splits, label reindexing, and training-only computation of the normalization statistics.

Table 1. Corpus statistics after stratified capping. % min. = minority-class percentage in the capped subset.
TaskIDnnc% min.SourceRaw skew
SentimentD17,666249.5SST-2 (GLUE)—
RetrievalD22,000249.0HotPotQA—
GenerationD33,164250.0LLM-7≈ 11.8 : 1
AuthorshipD45,000250.0HumLLM9.3 : 1
Total—17,830————
Table 1. D4 is capped to 50/50, yet IWN still helps: normalization statistics are computed on the full training data, and because P(s | y) differs in its moments across classes, residual imbalance effects survive the capping.

D1 — SST-2

Binary movie-review sentiment. Standard GLUE training split (67,349), official validation set (872) as our test set, with a stratified 10% internal validation slice; capped at 7,666 for parity. Chosen because it is non-saturated on base-scale encoders (87–94% published accuracy) and exercises the polarity vocabulary the gate can act on.

D2 — HotPotQA

Multi-hop QA. Input is [Q] q [CTX] c:300; the binary label collapses the three-tier difficulty annotation (easy → 0, medium/hard → 1). Attribution phrases such as according to and the article reports are rare in questions and frequent in contexts, giving the retrieval group a clean discriminative signal.

D3 — LLM-7

14,877 essays under seven prompt conditions, stratified-capped to 3,164. Probes the llm_stat, llm_formal, and llm_list groups on longer, prompt-structured text.

D4 — HumLLM

5,000 balanced examples sampled from a 788,922-text corpus with 9.3:1 original skew. The hardest task in the suite — base models stay under 0.77 macro-F1 without IWN — and where IWN yields its largest gain.

Experimental setup

How everything was trained

Backbones

  • DistilBERT-base-uncased (66M)
  • BERT-base-uncased (110M)
  • RoBERTa-base (125M)
  • ALBERT-base-v2 (11M)
  • T5-base (220M), as a text-to-text comparison

Optimization

AdamW (λ = 0.01, β1 = 0.9, β2 = 0.999, ε = 10−8), 6% linear warmup then decay, gradients clipped at 1.0. Learning rates: 2×10−5 for Baseline and SURGeLLM-S, 1.5×10−5 for SURGeLLM-G/FULL/IWN, 3×10−4 for T5.

Hardware and budget

2× NVIDIA T4 (16 GB), FP16 via Accelerate, effective batch size 32 through accumulation. Pre-tokenization caching (chunk size 2,048) gives roughly a 25% speedup. Early stopping with patience 2 on validation macro-F1. Full reproduction is about 38 GPU-hours.

Statistics

All results are mean ± SD over seeds {0, 1, 2}. Significance is paired Welch t-tests with Benjamini–Hochberg correction at FDR = 0.05 over 4 × 4 task-variant comparisons, plus 95% bootstrap confidence intervals (B = 2,000). Reported metrics: accuracy, macro-F1, precision, recall, ROC-AUC.

Table 2. Model variants. P = surgical prefix, G = gate, E = extended training, I = IWN.
VariantPGEIWhat it isolates
Baseline✗✗✗✗Fine-tuned encoder, task heads only
T5-base————Text-to-text framing of the same suite
SURGeLLM-G✓✗✗✗Prefix alone
SURGeLLM-S✓✓✗✗Prefix + gate, standard schedule
SURGeLLM-FULL✓✓✓✗Adds extended training
SURGeLLM-IWN✓✓✓✓Adds class-balanced statistics

Main results

Eleven variants, four tasks, three seeds

D1 is non-saturated — the F1 spread across variants is 0.901–0.937 — so aggregate averages reflect genuine differences rather than ceiling effects. SURGeLLM-IWN-RoBERTa is the top model at 0.940 average F1, ahead of the strongest non-IWN variant by +0.034 and the RoBERTa baseline by +0.036. The improvement is driven almost entirely by D4: +0.130 over baseline, which fully offsets the gate-induced drop seen without IWN.

Table 3. Macro-F1, mean ± SD over three seeds. Bold = best per column. † = early stopping triggered. T(s) = mean wall-clock training time on 2×T4. ∆ = Avg F1 against Baseline-RoBERTa.
ModelPar. D1 SST-2 D2 HotPot D3 LLM-7 D4 HumLLM Avg F1 ∆ T(s)
Reference models
T5-base220M0.928 ± .0050.939 ± .0070.972 ± .0040.748 ± .0130.897−0.007412
Baseline-DistilBERT66M0.901 ± .0060.940 ± .0080.955 ± .0060.749 ± .0120.886−0.01882
Baseline-BERT110M0.918 ± .0040.934 ± .0070.963 ± .0050.760 ± .0110.894−0.010227
Baseline-RoBERTa125M0.929 ± .0040.947 ± .0060.978 ± .0030.762 ± .0100.904—233
SURGeLLM without IWN
SURGeLLM-S-DistilBERT66M0.911 ± .0070.961 ± .0060.925 ± .0090.681 ± .0130.870−0.034119
SURGeLLM-S-BERT110M0.926 ± .0050.939 ± .0070.965 ± .0040.748 ± .0110.894−0.010317
SURGeLLM-G-RoBERTa †125M0.937 ± .0040.949 ± .0050.977 ± .0030.760 ± .0100.906+0.002327
SURGeLLM-FULL-RoBERTa †125M0.932 ± .0050.950 ± .0060.961 ± .0050.711 ± .0120.889−0.015326
SURGeLLM-FULL-ALBERT11M0.918 ± .0060.961 ± .0050.957 ± .0050.708 ± .0130.886−0.018317
SURGeLLM with IWN
SURGeLLM-IWN-RoBERTa125M0.933 ± .0040.954 ± .0050.979 ± .0030.892 ± .0090.940+0.036332
SURGeLLM-IWN-BERT110M0.927 ± .0050.946 ± .0060.968 ± .0040.866 ± .0100.927+0.023322
Table 3. Retrieval gains are consistent — SURGeLLM-S-DistilBERT and SURGeLLM-FULL-ALBERT both reach 0.961 ± .006 on D2, clearly above their baselines. T5-base is competitive at 0.897 but neither dominant nor efficient.

Statistical significance

Table 4. Benjamini–Hochberg-corrected p-values for selected comparisons. Bold = p < 0.05.
ComparisonTaskp (BH)
SURGeLLM-S-DistilBERT vs. Base-DistilBERTD20.008
SURGeLLM-FULL-ALBERT vs. Base-RoBERTaD20.011
SURGeLLM-IWN-RoBERTa vs. Base-RoBERTaD20.024
SURGeLLM-IWN-RoBERTa vs. Base-RoBERTaD4< 0.001
SURGeLLM-IWN-RoBERTa vs. SURGeLLM-FULLD4< 0.001
SURGeLLM-IWN-BERT vs. Base-BERTD4< 0.001
SURGeLLM-G-RoBERTa vs. Base-RoBERTaD10.063
SURGeLLM-S-BERT vs. Base-BERTD10.082
All D1/D3 pairs (avg.)—> 0.05
Table 4. The IWN gains on D4 are the strongest effects in the study. Differences on D1 and D3 mostly sit inside seed noise — which is what Proposition 2 predicts: where surgical alignment is moderate, the gate degenerates harmlessly toward a near-identity map.

Why text-to-text does not dominate

T5-base trains in 412s against 233s for Baseline-RoBERTa (a 1.77× wall-clock penalty), carries 220M parameters against 125M (a 1.76× parameter penalty), and still trails Baseline-RoBERTa by 0.007 avg. F1 and SURGeLLM-IWN-RoBERTa by 0.043. Text-to-text framing is most powerful when tasks share a unifying linguistic structure; our four tasks are structurally heterogeneous, and T5's encoder-decoder must allocate capacity to a decoding side that classification does not need.

Ablations

Reading the components apart

The progression G → FULL → IWN on RoBERTa tells the cleanest story. The prefix alone is mildly beneficial (+0.002). Adding the gate without IWN is harmful (−0.015 average, dominated by D4's −0.051). Adding IWN reverses the regression and exceeds it (+0.036). The BERT rows show the same pattern.

Table 5. Component ablation across backbones. ∆ = Avg F1 against the same-backbone baseline.
ModelPGEI D1D2D3D4Avg∆
Baseline-RoBERTa✗✗✗✗0.9290.9470.9780.7620.904—
SURGeLLM-G-RoBERTa✓✗✗✗0.9370.9490.9770.7600.906+.002
SURGeLLM-FULL-RoBERTa✓✓✓✗0.9320.9500.9610.7110.889−.015
SURGeLLM-IWN-RoBERTa✓✓✓✓0.9330.9540.9790.8920.940+.036
Baseline-BERT✗✗✗✗0.9180.9340.9630.7600.894—
SURGeLLM-S-BERT✓✓✗✗0.9260.9390.9650.7480.894±.000
SURGeLLM-IWN-BERT✓✓✓✓0.9270.9460.9680.8660.927+.033
Baseline-DistilBERT✗✗✗✗0.9010.9400.9550.7490.886—
SURGeLLM-S-DistilBERT✓✓✗✗0.9110.9610.9250.6810.870−.016
SURGeLLM-FULL-ALBERT✓✓✓✗0.9180.9610.9570.7080.886—
Table 5. No ALBERT baseline was trained, so the ALBERT row carries no ∆.

Isolating IWN

Table 6. IWN ablation with the D4 per-class breakdown. F1 means over three seeds; ∆ is IWN against SURGeLLM-FULL on the same backbone.
VariantD1D2D3D4 Hum. PHum. RLLM PLLM R
SURGeLLM-FULL-RoBERTa0.9320.9500.9610.7110.710.790.710.63
SURGeLLM-IWN-RoBERTa0.9330.9540.9790.8920.890.890.890.89
∆ (RoBERTa)+.001+.004+.018+.181+.18+.10+.18+.26
∆ (BERT)+.001+.006+.003+.118+.13+.07+.14+.18

Training dynamics

SURGeLLM models start from a higher initial loss (≈ 1.7–2.1) because the encoder must simultaneously become useful for four heterogeneous tasks and coordinate with the gate and prefix. They converge to comparable validation F1 within 4–5 epochs. Early stopping fires at epoch 4 for SURGeLLM-FULL-RoBERTa and SURGeLLM-G-RoBERTa, saving roughly one epoch (≈ 325s) with no test-F1 regression.

Table 7. Training dynamics, seed-0 representative. ∆Loss = (epoch-1 loss) − (final loss).
ModelInit. lossFinal lossBest ep.∆Loss
Baseline-DistilBERT0.5830.17930.404
Baseline-BERT0.5080.13930.370
Baseline-RoBERTa0.5430.14830.395
T5-base1.2340.41240.822
SURGeLLM-S-DistilBERT2.0190.73641.282
SURGeLLM-S-BERT1.9040.61631.087
SURGeLLM-G-RoBERTa †1.7080.44721.262
SURGeLLM-FULL-RoBERTa †2.0860.68221.404
SURGeLLM-FULL-ALBERT1.9050.51041.395
SURGeLLM-IWN-RoBERTa1.8120.42131.391
SURGeLLM-IWN-BERT1.8470.50331.344

Vocabulary sensitivity

Is the curated vocabulary doing the work?

Four complementary studies on SURGeLLM-G-RoBERTa, all over three seeds. The question behind them: are the gains lexical, or are they the extra parameters the feature channel happens to bring along?

Table 8. Sensitivity to the number of indicator groups |V|.
|V|D1D2D3D4Avg
0 (none)0.9290.9470.9780.7620.904
50.9310.9480.9770.7600.904
10 (ours)0.9370.9490.9770.7600.906
150.9350.9500.9760.7550.904
200.9330.9490.9740.7480.901
Table 8. Performance plateaus around ten groups. Any value in {10, 15} is statistically indistinguishable, so the system is not sharply tuned to the exact count; twenty groups costs 0.012 on D4 through noise from redundant thesaurus variants.
Table 9. Random-vocabulary control and auto-extracted alternative.
VocabularyD1D2D3D4Avg
None (baseline)0.9290.9470.9780.7620.904
Random (BNC)0.9100.9280.9460.7280.878
Auto-extracted0.9340.9480.9740.7550.903
Curated0.9370.9490.9770.7600.906
∆ Random−.027−.021−.031−.032−.028
∆ Auto−.003−.001−.003−.005−.003
Table 9. Random vocabulary of the same cardinality is worse than no vocabulary at all. The gate responds to semantic content, not added capacity.
Table 10. Surface-features ablation. G = lexical groups, S = surface statistics.
Config.D1D2D3D4Avg
G + S (full)0.9370.9490.9770.7600.906
G only0.9350.9460.9740.7490.901
S only0.9280.9450.9740.7550.901
∆ no-S−.002−.003−.003−.011−.005
∆ no-G−.009−.004−.003−.005−.005
Table 10. Neither half is redundant. Surface statistics matter most on D4, where length and punctuation density separate human from LLM text; lexical groups matter most on D1, where polarity vocabulary is decisive.

Why surface features survive the encoder

Truncation. The encoder receives at most 96–128 tokens. Total word count and total exclamation count are computed on the full document and carry information unavailable from a partial view.

Distributional shift. Even without truncation, the [CLS] representation is optimized for masked-token prediction and need not preserve precise count statistics. The surgical channel supplies them deterministically and losslessly.

Per-group leave-one-out

Figure 3. Macro-F1 drop when each indicator group is removed and the model retrained (SURGeLLM-G-RoBERTa). Each task has a clearly dominant group, and cross-task leakage is minimal — removing a task-specific group rarely moves another task by more than 0.002. The leave-one-out pattern matches the design intent, which is what makes the gate interpretable.

Transfer without manual curation

For a new language or domain: extract candidate indicator words by class-conditional log-odds with an informative Dirichlet prior on each task's training set, rank by absolute log-odds and keep the top K = 50 per class, embed the union with SBERT, then k-means into ten clusters. Cluster membership becomes the indicator groups; surface features are unchanged. This recovers 0.903 against 0.906 for manual curation.

Table 11. Preliminary multilingual result. SURGeLLM-G-XLM-R-base with auto-extracted per-language vocabularies, 5,000 capped training examples, official test splits, three seeds.
ConfigurationFrench (AlloCiné)German
XLM-R-base baseline0.9170.872
SURGeLLM-G-XLM-R-base (auto)0.9260.881
∆+.009+.009
Table 11. Both gains land within 0.001 of the English-curated gain on D1 (+0.008), suggesting the recipe transfers without per-language manual curation. A full-scale multilingual study remains future work.

Efficiency

What the gate costs

The gate adds 2d² + d ≈ 1.18M parameters, the feature projection ≈ 12.5K, the task embedding ≈ 3K — about 1.2M total, roughly 1% of RoBERTa-base. Asymptotically the surgical components are Θ(d²) against the encoder's Θ(L·d²), negligible for L ≫ 1. The real cost is wall-clock: about 100s on 2×T4 (233s → 332s), a 43% overhead driven mainly by extended training and prefix tokenization.

Speed–accuracy trade-off Scatter of average macro-F1 against training time in seconds for eleven models. Baseline-DistilBERT is cheapest at 82 seconds and 0.886. SURGeLLM-IWN-RoBERTa is the most accurate at 332 seconds and 0.940. T5-base is dominated at 412 seconds and 0.897.
Table 12. Speed–accuracy trade-off. F1/min = F1 × 60 / T(s). Eff = F1 × 10³ / log₁₀ P, with P in millions of parameters. ⋆ = on the Pareto frontier.
ModelPar.T(s)OverheadAvg F1F1/minEff
Baseline-DistilBERT ⋆66M821.0×0.8860.648487.0
SURGeLLM-S-DistilBERT66M1191.5×0.8700.439478.2
Baseline-BERT ⋆110M2272.8×0.8940.236437.7
Baseline-RoBERTa ⋆125M2332.8×0.9040.233431.1
SURGeLLM-S-BERT110M3173.9×0.8940.169437.7
SURGeLLM-FULL-ALBERT11M3173.9×0.8860.168848.0
SURGeLLM-FULL-RoBERTa125M3264.0×0.8890.164423.9
SURGeLLM-G-RoBERTa ⋆125M3274.0×0.9060.166432.0
SURGeLLM-IWN-BERT110M3223.9×0.9270.173453.9
SURGeLLM-IWN-RoBERTa ⋆125M3324.0×0.9400.170448.3
T5-base220M4125.0×0.8970.131380.4
Table 12. SURGeLLM-FULL-ALBERT is the most parameter-efficient configuration, reaching 0.886 avg. F1 with 11M parameters. T5-base is dominated on both axes.

Theory

When the gate helps, and why it cannot hurt

Definition 1 — Surgical feature alignment

For task tk and input distribution Ptk, the alignment ρk is the expected absolute inner product between the projected feature vector and the gradient of the conditional log-likelihood at the fused representation:

ρk = 𝔼(x,y) ~ Ptk [ | ⟨ s′(x), ∇ĥ log p(y | ĥ) ⟩ | ]
(15)

When ρk is high, perturbing ĥ along s′ moves the log-likelihood a lot, so s′ encodes information about y. When ρk = 0, s′ is orthogonal in expectation to the score function and carries no task-relevant signal.

Theorem 1 — Gate approximation bound

Let f⋆ be the Bayes-optimal classifier for task tk and fθ a SURGeLLM classifier from ERM on Nk examples. If the encoder is Lφ-Lipschitz, the head map Lhead-Lipschitz, and the loss ρ-Lipschitz in its first argument, then with probability at least 1 − δ:

R(fθ) − R(f⋆) ≤ C√Nk  +  λmax(Wg⊤Wg)2 ‖ s′ − s⋆ ‖2
(16)

The first term is standard: more data shrinks the generalization gap. The second is the novel piece — small when the projected feature vector is close to its oracle s⋆, large when the gate matrix has high spectral norm. Highly aligned tasks benefit more, because s′ then carries useful signal that even a modest Ws approximates well.

Proposition 2 — Degeneracy under zero alignment

If ρk = 0, then at any local minimum of the regularized loss with weight decay λ > 0: ‖Ws‖ → 0, hence s′(x) → 0, hence gi⋆ → 1 for every dimension, and the fusion collapses to ĥ → LN(h̃). The expected gradient vanishes, the update reduces to pure exponential decay Ws ← (1 − λη)Ws, and to minimize loss the gate routes all signal through h̃.

Corollary 3 — Safety of adding the gate

For any task with ρk = 0, adding the surgical gate cannot increase the minimum achievable empirical risk. The gate either strictly improves (ρk > 0) or degenerates to identity (ρk = 0).

Empirical caveat — the imbalance loophole

Corollary 3 assumes ρk accurately captures gradient-feature alignment under the distribution the gate actually sees. Under severe class skew, Eq. 8 feeds the gate prior-contaminated features, and the effective ρk measured on that contaminated distribution can be misleadingly low even when the underlying feature signal is informative.

This is precisely the failure mode observed on D4 without IWN — and it is why the safety guarantee did not save us. IWN restores the conditions of Proposition 2 on imbalanced data.

Table 13. Monte-Carlo estimates of ρk on the validation split, 1,000 examples per task, by backpropagating to obtain ∇ĥ log p(y | ĥ).
Taskρk (no IWN)ρk (IWN)∆F1 from IWN
D1 SST-21.421.39+.001
D2 HotPot3.713.68+.004
D3 LLM-71.831.85+.018
D4 HumLLM0.612.13+.181
Table 13. The empirical gain ordering tracks the alignment ordering. D4 is the only task whose alignment changes under IWN — from 0.61 to 2.13 — because it is the only task whose gate input was prior-contaminated. Alignment on the other three tasks is stable to within measurement noise, exactly as a normalization-only change should behave.

Failure analysis and limitations

Where this breaks

We manually inspected 50 misclassified examples per task on SURGeLLM-IWN-RoBERTa. The failures are diagnostic — they mark the boundary of the gate's utility rather than random error.

D1 — SST-2

Negation scope (not bad), sarcasm, and mixed-sentiment reviews. The gate cannot help: polarity vocabulary fires on both sides of the decision.

D2 — HotPotQA

Questions with implicit multi-hop chains and no explicit attribution cues. The retrieval group has nothing to fire on.

D3 — LLM-7

Human essays that mimic LLM scaffolding in a formal academic register, and LLM essays edited by humans to strip enumerative markers.

D4 — HumLLM

After IWN, the residual failures concentrate on short texts (< 30 words), where surgical-feature counts are unreliable. This motivates length-conditional gating.

Stated limitations

  • Experiments are English-only; the multilingual result in Table 11 is preliminary and small-scale.
  • Coverage is base-scale encoders, 11M–220M parameters. Extension to LLaMA-class encoders is explicit future work, and we expect absolute gains to shrink as encoder capacity saturates ρk — though the do-no-harm guarantee holds at all scales.
  • The bound is standard Rademacher complexity and may be loose for modern transformers. PAC-Bayes or NTK tightening is open.
  • Evaluation is four heterogeneous tasks by design, not the full GLUE/SuperGLUE suite. That is the point of the study, but it does limit external comparability.
  • IWN is reported alone, without composition against focal loss, class-balanced re-weighting, or oversampling. Whether the gains are additive is untested.

Revision record

What changed after review

This version responds to four reviewer reports and a meta-review. We publish the crosswalk because the most interesting result in the paper — IWN — exists only because reviewers refused to accept it as future work.

Table 14. Reviewer-to-revision crosswalk. ✓ = fully addressed; ∼ = partially addressed with a future-work note.
Raised byConcernChangeStatus
Qs1u, EVkC, Meta Class imbalance on D4 corrupts gate statistics; IWN was deferred to future work IWN fully implemented and evaluated✓
Qs1u, idHo No sensitivity analysis of the surgical vocabulary; unclear why exactly ten groups; surface features may be redundant Four-part sensitivity study added, including a random-vocabulary control✓
4Pvq, idHo, Meta The original D1 (synthetic physics oscillation) saturated at F1 = 1.000 and inflated reported averages D1 replaced with SST-2; all aggregates recomputed✓
idHo No comparison to unified text-to-text models T5-base added as an eleventh variant✓
Qs1u, 4Pvq Single-seed results weaken confidence in small F1 differences All results re-run over seeds {0,1,2}; mean ± SD throughout, per-seed breakdown published✓
Qs1u Abstract overclaimed "state-of-the-art performance" Revised to "competitive parameter-efficient multi-task performance" with the bootstrap CI overlap stated explicitly✓
idHo No multilingual or cross-domain evaluation Preliminary French/German experiment added; full study deferred∼
Table 14. Removing the saturated D1 narrowed bootstrap CI widths from ≈ 0.17 to ≈ 0.12 and turned a within-CI gap of ∆ = 0.001 into a separation of ∆ = +0.036 (p < 0.001). The headline comparison is now SURGeLLM-IWN-RoBERTa 0.940 ± .003, 95% CI [0.934, 0.946], against Baseline-RoBERTa 0.904 ± .003.

Reproducibility

Everything you need to re-run this

  • Code — released with preprocessing scripts that reproduce the stratified splits.
  • Data — all four corpora are publicly available.
  • Seeds — {0, 1, 2}; splits, weight initialization, dropout masks, and CUDA determinism are all seeded.
  • Software — PyTorch 2.1, Transformers 4.35, Accelerate 0.24, scikit-learn 1.3, sentence-transformers 2.2.
  • Hardware — 2× NVIDIA T4 (16 GB), FP16 mixed precision.
  • Statistics — bootstrap B = 2,000 (seed 0); paired Welch t-tests with BH FDR = 0.05.
  • Compute — ≈ 38 GPU-hours on T4 to reproduce all main and ablation results.
Table 15. Per-seed average F1 for selected models.
ModelSeed 0Seed 1Seed 2Mean
Baseline-RoBERTa0.9060.9010.9050.904
SURGeLLM-G-RoBERTa0.9080.9020.9080.906
SURGeLLM-FULL-RoBERTa0.8920.8860.8890.889
SURGeLLM-IWN-RoBERTa0.9430.9370.9400.940
SURGeLLM-IWN-BERT0.9290.9240.9280.927
T5-base0.9000.8930.8980.897

Hyperparameters

Table 16. Full configuration. LR = learning rate, EP = max epochs, BS = per-GPU batch size, GA = gradient accumulation, MaxL = max sequence length, WU = warmup fraction.
ModelLREPBSGAMaxLWU
Baseline-DistilBERT2×10⁻⁵3321960.06
Baseline-BERT2×10⁻⁵31621280.06
Baseline-RoBERTa2×10⁻⁵31621280.06
T5-base3×10⁻⁴5841280.06
SURGeLLM-S-DistilBERT2×10⁻⁵4321960.06
SURGeLLM-S-BERT2×10⁻⁵41621280.06
SURGeLLM-G-RoBERTa1.5×10⁻⁵41621280.06
SURGeLLM-FULL-RoBERTa1.5×10⁻⁵51621280.06
SURGeLLM-FULL-ALBERT2×10⁻⁵5321960.06
SURGeLLM-IWN-RoBERTa1.5×10⁻⁵51621280.06
SURGeLLM-IWN-BERT2×10⁻⁵51621280.06

The surgical vocabulary

Ten case-insensitive indicator groups; * marks prefix matching for inflectional families.

Table 17. Complete indicator groups, plus the six appended surface features.
GroupMembers
sst_posgreat, excellent, brilliant, terrific, wonderful, masterpiece, captivat*, impressive, delightful, superb
sst_negterrible, awful, dreadful, unwatchable, boring, dull, mediocre, disappoint*, worst, painful
llm_statempirically, statistically, demonstrated, observed, evidenced, indicate*, suggest*, results show, data show
llm_formalmoreover, furthermore, additionally, consequently, therefore, in conclusion, in summary, to summarize
llm_listfirstly, secondly, thirdly, finally, in addition, on the other hand, (1), (2), (3)
human_persi, my, we, our, personally, i think, i believe, i feel
human_hedgemaybe, perhaps, possibly, kind of, sort of, i guess, probably, somewhat, arguably
human_emolove, hate, amazing, awesome, terrible, awful, fantastic, horrible, sad, happy
retrievalaccording to, as stated in, the article reports, the text states, multi-hop, supporting context, in the passage
prompt_cotstep by step, let us think, first, then, next, reasoning, the chain of thought, walk through
Surface features (s₁₁ – s₁₆)
s₁₁ – s₁₆word count · mean word length · sentence count (split on .!?) · question-mark count · exclamation-mark count · binary digit presence

Citation

Cite this work

@inproceedings{mohammad-bayazit-2026-surgellm,
    title = "{SURGELLM}: Rethinking Multi-Task Evaluation through Task-Aware Feature Gating with Class-Balanced Normalization",
    author = "Mohammad, Noor Islam S.  and
      Bayazit, Ulug",
    editor = "Chang, Kai-Wei  and
      Mehrabi, Ninareh  and
      Krishna, Satyapriya  and
      Das, Anubrata  and
      Dhamala, Jwala  and
      Cao, Yang Trista  and
      Kumarage, Tharindu  and
      Ramakrishna, Anil  and
      Christodoulopoulos, Christos  and
      Wan, Yixin  and
      Galystan, Aram  and
      Kumar, Anoop  and
      Gupta, Rahul",
    booktitle = "Proceedings of the 6th Workshop on Trustworthy {NLP} ({T}rust{NLP} 2026)",
    month = jul,
    year = "2026",
    address = "San Diego, California",
    publisher = "Association for Computational Linguistics",
    url = "https://aclanthology.org/2026.trustnlp-main.47/",
    doi = "10.18653/v1/2026.trustnlp-main.47",
    pages = "600--617",
    ISBN = "979-8-89176-418-7"
}

Published at the 6th Workshop on Trustworthy NLP (TrustNLP 2026), San Diego, California · ACL Anthology · doi:10.18653/v1/2026.trustnlp-main.47