[Paper Review] In-Context Learning for Few-Shot Molecular Property Prediction
This paper introduces Context Aware Molecule Prediction (CAMP), a novel in-context learning framework for few-shot molecular property prediction that directly infers molecular properties from a context of (molecule, property) demonstrations without fine-tuning. CAMP uses a Transformer encoder to process molecule and label embeddings in sequence, achieving state-of-the-art performance at small support sizes and 4.5× faster inference than Prototypical Networks.
In-context learning has become an important approach for few-shot learning in Large Language Models because of its ability to rapidly adapt to new tasks without fine-tuning model parameters. However, it is restricted to applications in natural language and inapplicable to other domains. In this paper, we adapt the concepts underpinning in-context learning to develop a new algorithm for few-shot molecular property prediction. Our approach learns to predict molecular properties from a context of (molecule, property measurement) pairs and rapidly adapts to new properties without fine-tuning. On the FS-Mol and BACE molecular property prediction benchmarks, we find this method surpasses the performance of recent meta-learning algorithms at small support sizes and is competitive with the best methods at large support sizes.
Motivation & Objective
- To extend in-context learning—previously limited to natural language—into molecular property prediction, where few-shot learning is critical for drug discovery.
- To develop a method that rapidly adapts to new molecular properties without fine-tuning or gradient updates.
- To overcome the limitations of existing few-shot learning methods in molecular science by enabling low-latency, high-accuracy inference on large-scale screening tasks.
- To investigate whether in-context learning principles can be successfully transferred to non-language domains like molecular science using sequence modeling.
- To evaluate the impact of positional embeddings and demonstration ordering on model generalization in molecular few-shot learning.
Proposed method
- CAMP encodes query and demonstration molecules using a molecular encoder (e.g., MPNN) and property measurements using a label encoder.
- Molecule and label embeddings are concatenated into a sequence and fed into a Transformer encoder to predict the query molecule’s property.
- The model performs inference in a single forward pass, directly predicting the label from the context of demonstrations without fine-tuning or centroid computation.
- The architecture is invariant to demonstration order, with ablation studies showing that positional embeddings degrade performance and increase overfitting.
- The method is trained from random initialization on small few-shot datasets (~5 GB), unlike LLM-based in-context learning which requires massive pretraining.
- Ablation studies compare Naive ICL (interleaved embeddings) with CAMP, showing that separate embedding concatenation improves training stability and performance.
Experimental results
Research questions
- RQ1Can in-context learning principles be successfully adapted to molecular property prediction, a non-language domain?
- RQ2Does a sequence modeling approach using molecule and label embeddings outperform gradient-based and metric-based few-shot learning baselines in molecular settings?
- RQ3How does the order of demonstrations in the context affect model performance, and is positional encoding beneficial or detrimental?
- RQ4Can a model trained from random initialization on small datasets achieve competitive performance without fine-tuning?
- RQ5What is the impact of architectural choices such as embedding concatenation and positional encoding on training stability and generalization?
Key findings
- CAMP outperforms recent meta-learning algorithms at small support sizes on the FS-Mol and BACE benchmarks, demonstrating superior few-shot generalization.
- At large support sizes, CAMP achieves performance competitive with the best baselines, including Prototypical Networks, while being approximately 4.5× faster during inference.
- The model without positional embeddings achieves lower validation loss (0.5746) than the variant with positional embeddings (0.5817), indicating that positional encoding harms performance.
- Training with positional embeddings leads to faster overfitting, with a final training loss of 0.3181 compared to 0.3374 for the non-positional variant.
- Naive ICL, which interleaves molecule and label embeddings, shows unstable convergence and inferior performance compared to CAMP’s concatenated sequence approach.
- CAMP’s performance is robust to demonstration ordering, supporting the hypothesis that in-context learning in molecular prediction should be permutation-invariant.
Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.