OpenBMB · HF

SciCore-Mol

SciCore-Mol

二〇二六年六月六日 · 英文原文

SciCore-Mol由北京大学、清华大学、南京大学研究者提出,通过GVP encoder、diffusion generator和Reaction Transformer等可插拔模块增强LLM分子认知,采用三阶段训练与hidden-state融合,支持ChemBench4K、MMLU Chemistry、ORD、SMolInstruct和ADMET评估。

Yuxuan Chen1, Changwei Lv2, Yunduo Xiao2, Yukun Yan2, Zheni Zeng*3, and Zhiyuan Liu2

1北京大学电子与计算机工程学院,中国深圳 2清华大学,中国北京 3南京大学智能科学与技术学院,中国南京 *通讯作者:zengzn@nju.edu.cn

📖 介绍

Large language models(LLMs)在专业领域中越来越受欢迎,但在处理异构科学数据时会遇到一种根本性的认知张力:LLMs 是为离散的自然语言符号序列而设计的,而由分子表示的科学实体在本质上具有拓扑和几何结构。将这些结构强行转化为线性文本不可避免地会导致信息损失,而语义噪声也会干扰 LLM 的认知推理。

我们提出 SciCore-Mol,这是一种新的范式,通过可插拔的外部认知模块来增强 LLM,包括 GVP encoderdiffusion generatornumerical-sensitive Transformer(Reaction Transformer)。该架构在保留通用能力的同时,为 LLM 提供专门的分子感知能力。借助两阶段 alignment 机制,外部模块通过特殊 token 被调用,并在 hidden-state 层面进行融合,使 LLM 能够深入理解分子信息,同时不牺牲其核心推理过程。

⚙️ 设置

前置要求

安装

git clone https://github.com/ChenYX24/SciCore-Mol.git
cd SciCore-Mol

# Option A: Install with uv (recommended)
pip install uv
uv sync
uv sync --extra graph      # GVP-GNN dependencies (torch-geometric, torch-scatter, torch-cluster)
uv sync --extra flashattn  # FlashAttention (requires CUDA)
uv sync --group train      # DeepSpeed for distributed training

# Option B: Install with pip
python -m venv .venv
source .venv/bin/activate
pip install -e .
pip install -e ".[graph]"       # optional: GVP-GNN
pip install -e ".[flashattn]"   # optional: FlashAttention
pip install deepspeed swanlab   # optional: distributed training

环境变量

cp configs/env.example.sh configs/env.sh
# Edit configs/env.sh to set your paths, then:
source configs/env.sh
变量 说明
SCICORE_ROOT 项目根目录
MODEL_DIR 基础模型目录(例如 Qwen3-8B)
CHECKPOINT_DIR 训练后的 checkpoint 目录
DATA_DIR 训练和评估数据
GVP_CHECKPOINT 预训练 GVP-GNN 权重
OPENAI_API_KEY 用于 GPT baseline 评估的 API key

🔧 训练

SciCore-Mol 遵循一个三阶段训练流程(见上图):

阶段 1:组件预训练

在联合训练之前,独立预训练每个组件。

阶段 2:跨模态对齐训练

连接所有模块进行联合 SFT 训练。LLM 学习通过特殊的 <mol> token 调用外部模块。

# Configure training in configs/qwen3_sft_epoch2_1.yaml
# Uses DeepSpeed ZeRO-3 for multi-GPU training
torchrun --nproc_per_node=4 \
    cotrain_llm_diffusion/train_step1_llm.py \
    --config configs/qwen3_sft_epoch2_1.yaml

关键配置字段(位于 configs/qwen3_sft_epoch2_*.yaml):

阶段 3:任务特定微调

在下游任务上微调 Layer2(Reaction Transformer),并可配置模块冻结策略:

python scripts/layer2/train_layer2.py \
    --config scripts/layer2/layer2_train_config_stage2_v7b.yaml

训练完成后,将 checkpoint 拆分为 LLM 和额外组件:

python scripts/ckpt/split_llm_extras.py \
    --checkpoint_path ${CHECKPOINT_DIR}/your-checkpoint/ \
    --output_dir ${CHECKPOINT_DIR}/your-checkpoint/

📊 评估

ChemBench4K(Product / Retrosynthesis / Yield / Captioning)

# Evaluate all 5 tasks with logprob scoring
bash scripts/run/run_chembench_all_tasks.sh

# Or run individual tasks:
python scripts/eval/eval_layer2_chembench.py \
    --checkpoint_dir ${CHECKPOINT_DIR}/your-checkpoint \
    --task product \
    --output_dir eval_results/chembench/

MMLU Chemistry 子集(5 个学科)

python scripts/eval/eval_mmlu_interns1mini_5subsets.py \
    --model_path ${MODEL_DIR}/your-model \
    --output_dir eval_results/mmlu/

ORD 反应预测(完整流程)

# Run Layer2-LLM integrated pipeline
bash scripts/layer2_llm/run_full_pipeline.sh

# Score predictions
python scripts/postprocess/score_only.py \
    --pred_dir eval_results/ord/

SMolInstruct(7 个分子任务)

# Automated multi-task evaluation with GPU scheduling
bash scripts/run/eval_smol_task_list.sh

药物优化(ADMET scoring)

# LLM-based drug optimization
python eval/drug_optim/eval_admet.py \
    --config eval/drug_optim/config/llm_cpt_sft.yaml

# Diffusion-based drug optimization
python eval/drug_optim/eval_diffusion.py \
    --config eval/drug_optim/config/diffusion_sft.yaml

📄 致谢

🥰 引用

@article{chen2026scicoremol,
  title={SciCore-Mol: Augmenting Large Language Models with Pluggable Molecular Cognition Modules},
  author={},
  journal={arXiv preprint arXiv:XXXX.XXXXX},
  year={2026}
}

📧 联系方式

如果你有问题、建议或 bug 报告,请提交 issue 或发送邮件:

chenyuxuan225@gmail.com

📜 许可证

本项目采用 MIT 和 Apache 2.0 双许可证。

译自 OpenBMB · HF · 录于 二〇二六年六月六日