Data Selection and PEFT
Course Project · Neural Networks: Theory & Implementation
This project studies two efficiency decisions together: which external molecules are worth adding to a training set, and which parameters of a large chemical language model should be updated. MolFormer is adapted to lipophilicity prediction with BitFit, LoRA, and (IA)3, while random, uncertainty, diversity, and influence-based selection compete for the same 300-point external pool.
The result is a 15-run experiment matrix that makes the accuracy–parameter trade-off visible instead of treating data selection and fine-tuning as unrelated choices.
Dataset and Chemical Space
The MoleculeNet benchmark[1] collects molecular-property tasks for model comparison. This project uses its Lipophilicity dataset: 4,200 molecules represented as SMILES strings, each paired with an experimental measure of how readily the compound partitions into lipid-like environments.
From SMILES to Scaffolds
SMILES is a compact line notation that can be parsed into a molecular graph. A scaffold strips that graph back to its shared core. Phenol and toluene, for example, differ in their substituent but share the same benzene scaffold—exactly the kind of relationship a random split can leak across training and test data.
- Formula
- C₆H₅OH
- SMILES
- Oc1ccccc1
- Core
- Benzene
Data Splitting
Molecular evaluation needs a harder boundary than a random row split. When the same scaffold occurs in both training and test sets, a model can appear to generalize while mostly recognizing a familiar structural core. Six DeepChem strategies were tested before choosing the final partition.
Uniform assignment; useful as a baseline but shared scaffolds can cross partitions.
Groups Bemis–Murcko cores so one molecular scaffold stays in a single partition.
Partitions compounds according to molecular-weight ordering.
Maximizes fingerprint diversity between selected compounds.
Uses Butina clustering over a bulk Tanimoto fingerprint matrix.
Separates molecules by ECFP4 fingerprint similarity.
MolFormer
MolFormer[2] is a transformer pretrained on roughly 1.1 billion unlabelled SMILES strings. Its linear-attention backbone supplies a 768-dimensional molecular representation; this project adds a dropout-regularized linear head for scalar lipophilicity prediction.
Linear attention encodes each SMILES sequence into a pooled 768-dimensional molecular representation.
- Hidden size
- 768
- Pretraining corpus
- ≈ 1.1B SMILES
- Attention
- Linear
Fine-Tuning Pipeline
Training proceeds in two deliberate stages. The first adapts MolFormer to the language distribution of this dataset without reading the labels; the second optimizes the regression objective.
Masked-language modelling adapts the chemical representation before property supervision begins.
- Masking
- 15%
- Objective
- Cross entropy
- Learning rate
- 1 × 10⁻⁴
The adapted checkpoint learns a single continuous lipophilicity target.
- Loss
- MSE
- Batch size
- 64
- Learning rate
- 1 × 10⁻⁴
Influence Functions
Influence functions[3] estimate how an individual training example changes held-out loss. The inverse Hessian-vector product is approximated with LiSSA so the external candidates can be ranked without fully retraining the model once per molecule.
Hθ is the Hessian of the training loss; the two gradient terms connect the candidate example to the test objective.
Data Selection Strategies
Each strategy selects roughly 185 candidates from the same 300-molecule pool. What changes is the signal used to decide which examples deserve the limited training budget.
A dependency-free baseline that draws from the external pool without replacement.
One hundred stochastic passes identify molecules for which the model is least certain.
Selects a structurally varied subset that spreads coverage across chemical space.
Keeps candidates whose estimated contribution reduces the held-out loss.
Parameter-Efficient Fine-Tuning
Rather than update all 44.4 million parameters, PEFT freezes most of MolFormer and exposes a controlled adaptation surface. The three methods below span a wide range—from 28 thousand trainable values to 16.6 million.
All weight matrices remain frozen, making BitFit the simplest method in the experiment.
- Trainable
- ≈ 75K
- Share
- 0.17%
- Learning rate
- 1 × 10⁻³
Combined Results
Crossing three PEFT methods with five external-data choices yields 15 configurations. The comparison below shows that the fine-tuning method dominates the outcome more strongly than the selection strategy in this experiment.
| BitFitbias terms | LoRAlow-rank adapters | (IA)³learned rescaling | |
|---|---|---|---|
| Best MSElower is better | 0.477 | 0.083 | 0.522 |
| Trainable parameters | 0.17% | 37.4% | 0.06% |
| Winning strategy | Random | Random | Random |
What the Experiment Says
It remains best under every selection strategy and reaches the overall minimum test MSE of 0.083.
Only 0.06% of parameters are trainable, although the reduced adaptation capacity leaves a larger performance gap.
The result is consistent across the three PEFT methods, but its seed-specific nature argues for repeated runs rather than a universal rule.
Masked-language-model adaptation before supervised regression improves test MSE from 0.538 to 0.532.
Conclusion
The experiment does not produce one universally optimal efficiency recipe. It shows a useful hierarchy instead: LoRA is the strong choice when predictive quality matters most, BitFit offers a restrained compromise, and (IA)³ minimizes trainable parameters. Data selection still changes the result, but repeated seeds would be necessary before treating the random subset’s win as a general molecular-learning principle.