hyosoon0 commited on
Commit
c8daa88
·
verified ·
1 Parent(s): 78b8f4c

add thermostability

Browse files
thermostability/README.md ADDED
@@ -0,0 +1,113 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # thermostability
2
+
3
+ Folding free energy of a monomer, predicted from a frozen encoder's residue
4
+ representations. Regression against cDNA-proteolysis dG.
5
+
6
+ **This directory holds the protocol only. The data was not copied.** The LMDB is large and
7
+ already staged where training reads it, so moving it would duplicate it for no gain. Paths
8
+ are absolute and given below. This is a deliberate exception to the collection's rule 6.
9
+
10
+ ## Task
11
+
12
+ ```
13
+ input: one protein chain, as 3-view CHI tokens (seq / bb / fa)
14
+ output: one scalar, dG in kcal/mol
15
+ metric: Spearman correlation on the held-out set
16
+ ```
17
+
18
+ A **probe, not a fine-tune**. The encoder is frozen; only the head trains.
19
+
20
+ ## Probe head
21
+
22
+ Replicated from `k-fold-stability/stability_ft/model_esmc.py`, which is the SaProt recipe,
23
+ so numbers are comparable to that line of work.
24
+
25
+ ```
26
+ masked residue mean-pool over valid positions
27
+ Linear(D, D) -> ReLU -> Linear(D, 1)
28
+ clamp(-20, 20)
29
+ SigmoidScaling(min=-1, max=5)
30
+ ```
31
+
32
+ **No input LayerNorm.** Our encoder output already passes `encoder_norm_after`, and adding a
33
+ second normalisation measurably hurt: that is the ours-0714f finding recorded in the
34
+ k-fold-stability head-design note. Anyone porting this head to an encoder that does not
35
+ normalise its output should revisit that, not copy it blindly.
36
+
37
+ `SigmoidScaling` is the piece that is easy to get wrong. It is not a plain sigmoid. It maps
38
+ the raw scalar onto the cDNA range piecewise:
39
+
40
+ ```
41
+ x < 0 2 / (1 + exp(-alpha2 * x)) - 1 soft tail down to -1
42
+ 0 <= x <= 4 x identity through the bulk of the range
43
+ x > 4 2 / (1 + exp(-alpha1 * (x - 4))) + 3 soft tail up to 5
44
+ ```
45
+
46
+ `alpha1` and `alpha2` are trainable, initialised at 0.8. The exponent argument is clamped at
47
+ 30 to stop `exp` overflowing to NaN, and the raw MLP output is clamped to +-20 before the
48
+ scaling for the same reason. Both clamps are load-bearing: without them a diverged head
49
+ produces NaN into the loss rather than a large error.
50
+
51
+ The pooling is masked, `sum(reps * mask) / sum(mask)`, so padding never enters the average.
52
+
53
+ ## Labels
54
+
55
+ ```
56
+ authority: cDNA proteolysis dG (Tsuboyama et al. mega-scale dataset)
57
+ provenance: staged into an LMDB plus eval jsonl files by the k-fold-stability project
58
+ validation: authority is the source; not recomputed here
59
+ ```
60
+
61
+ ## Data
62
+
63
+ Not in this directory. Absolute paths:
64
+
65
+ ```
66
+ /cache/ssahn_lab/datasets/lmdb/stability_monomer records (node-local)
67
+ /mnt/parallel_storage/ssahn_lab/datasets/stability/pairs/val_eval.jsonl 2,357 rows
68
+ /mnt/parallel_storage/ssahn_lab/datasets/stability/pairs/test_eval.jsonl 3,282 rows
69
+ /mnt/parallel_storage/ssahn_lab/datasets/stability/pairs/pairs_train.jsonl
70
+ ```
71
+
72
+ `/cache` is node-local. The LMDB exists only on nodes it was staged to, and a run on a
73
+ fresh node needs it copied there first.
74
+
75
+ ## Split
76
+
77
+ The eval sets are the jsonl files above; the training pairs are separate. **The grouping
78
+ behind the split was not established here.** The collection asks for the grouping key,
79
+ threshold and the number of groups spanning splits, and none of the three is recorded for
80
+ this benchmark. It is inherited from k-fold-stability.
81
+
82
+ ## Baselines
83
+
84
+ Reported as `stability_eval/{val,test}_spearman` during training runs. This directory does
85
+ not carry a fixed baseline table, because the numbers on record come from mid-training
86
+ checkpoints of various runs rather than from one controlled sweep over encoders. The
87
+ comparison that is established is against SaProt: our 3B dG fine-tune lands at roughly
88
+ SaProt's level with the same head.
89
+
90
+ **No trivial baseline is recorded, and one matters here.** Sequence length alone correlates
91
+ with dG in the cDNA dataset, since the assay is length-limited. Measure it before reading
92
+ anything into a Spearman value.
93
+
94
+ ## Known limitations
95
+
96
+ - **Data is not in this directory** and the LMDB half of it is node-local. A reader on a
97
+ new node cannot run this benchmark without staging.
98
+ - **Split provenance unknown**, as above.
99
+ - **No trivial baseline**, as above, and length is a real confound for this label.
100
+ - **The head is tuned to the cDNA range.** `SigmoidScaling(-1, 5)` bakes in the assay's
101
+ dynamic range. Applying this head to dG from a different assay would need the bounds
102
+ changed, and the numbers would not be comparable.
103
+ - **LR sensitivity.** This head produced NaN at lr 4e-4 in an earlier run; the SaProt recipe
104
+ uses 1e-4. If a run goes NaN, that is the first thing to check, not the clamps.
105
+
106
+ ## Rebuild
107
+
108
+ ```
109
+ k-fold-multimer-tuning/model/stability_head.py SigmoidScaling and StabilityHead
110
+ k-fold-multimer-tuning/model/callbacks.py the eval loop that logs Spearman
111
+ ```
112
+
113
+ Head reproduced from `k-fold-stability/stability_ft/model_esmc.py`. Written 2026-08-13.
thermostability/baselines/baselines.json ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "task": "cDNA proteolysis dG of a monomer, regression",
3
+ "metric": "stability_eval/{val,test}_spearman",
4
+ "protocol": "frozen encoder, masked mean-pool, Linear(D,D)-ReLU-Linear(D,1), clamp +-20, SigmoidScaling(-1,5)",
5
+ "encoders": null,
6
+ "encoders_note": "no controlled sweep exists. The numbers on record come from mid-training checkpoints of different runs. The one established comparison is that our 3B dG fine-tune lands at roughly SaProt level with the same head",
7
+ "trivial_baseline": null,
8
+ "trivial_baseline_note": "sequence length correlates with dG in the cDNA assay because the assay is length-limited. Measure it before reading anything into a Spearman value"
9
+ }