{
"title_zh": "通义开源 LOGOS:用一套「科学语法」统一蛋白质、分子和材料生成",
"body_zh": "# 通义开源 LOGOS:用一套「科学语法」统一蛋白质、分子和材料生成\n\n蛋白质折叠、小分子设计、新材料发现——这三件事过去由完全不同的模型和工具链各自搞定。通义实验室联合中国人民大学高瓴人工智能学院开源的 LOGOS,试图把它们收拢到同一套生成框架下。核心想法并不玄妙:蛋白质由氨基酸序列折叠成三维结构,小分子由原子和键构成构象,材料由晶格与元素填充出周期结构——底层都是「组成单元 + 结构约束 + 交互语义」的组合游戏,本质上在说同一种语言。\n\n## 为什么需要统一语法\n\n传统做法是每个领域造一套专用模型:AlphaFold 系列管蛋白质,DiffDock 管分子对接,各类 GNN 管材料属性预测。问题在于——模型之间无法迁移知识。你在蛋白质折叠上学到的「局部螺旋偏好」和「疏水核心聚集」这类结构规律,对分子构象搜索其实有启发,但专用模型根本看不到这些信号。\n\nLOGOS 的切入点是把所有科学对象编码成统一的 token 序列:\n\n- 氨基酸残基 → 一类 token,附带位置与二级结构标记\n- 原子与化学键 → 另一类 token,附带键类型与立体构型\n- 晶格位点与元素 → 第三类 token,附带周期性坐标\n\n三套 token 共享同一套嵌入空间和注意力机制,模型在训练时同时看到蛋白质、分子和材料的数据,跨域的结构规律自然被吸收进权重里。\n\n## ATH-Token Foundry:把科学对象变成可训练的语言\n\nLOGOS 背后的编码体系叫 ATH-Token Foundry。它解决的核心问题是:科学对象不是自然语言,不能直接丢进 Transformer。你需要一套规则把三维结构、化学键、周期性等物理约束「翻译」成序列化 token,同时保留足够的信息让模型能还原出合法的生成结果。\n\n具体做法大致分三步:\n\n1. 离散化:把连续的空间坐标、角度、键长等量化到有限词表上,类似 BPE 对文本做子词切分。\n2. 结构标注:每个 token 携带结构角色标签(比如「这是骨架原子」「这是侧链残基」「这是晶格节点」),让注意力机制知道哪些 token 之间应该优先交互。\n3. 约束注入:在解码阶段通过受限解码(constrained decoding)强制输出满足化学合法性——键数不超标、氨基酸序列不出现非法残基、晶格对称性不被打破。\n\n这套编码不是后处理补丁,而是从训练一开始就嵌入模型的数据管线里。\n\n## 跨域生成的实际效果\n\n统一模型的意义不只是「省一个模型」,而是让跨域推理变得可行。几个典型场景:\n\n- 蛋白质–小分子协同设计:给定靶点蛋白质,同时生成适配的小分子配体,两个对象在同一个生成过程中互相约束,而不是先折叠蛋白质再独立搜索分子。\n- 材料属性反向设计:输入目标属性(带隙、硬度),模型在晶格 token 空间里搜索满足约束的元素组合与结构。\n- 零样本迁移:在蛋白质数据上训练的结构偏好,可以无额外微调地帮助分子构象搜索跳出局部陷阱。\n\n开源版本提供了预训练权重和推理代码,覆盖蛋白质生成、分子生成和材料生成三个任务头。\n\n## 上手实践:加载 LOGOS 并生成一个小分子\n\nLOGOS 已在 HuggingFace 上开源,下面是一个最小可运行示例——加载模型并生成一个满足化学约束的小分子 SMILES。运行前需要确认模型仓库的实际路径,以下基于开源发布时的典型路径:\n\npython\n# 安装依赖\n# pip install torch transformers logos-model # logos-model 为项目专用包,见 GitHub README\n\nfrom logos import LOGOSModel, LOGOSConfig\nfrom logos.tokenizer import ScienceTokenizer\n\n# 加载预训练模型与统一 tokenizer\nconfig = LOGOSConfig.from_pretrained(\"tongyi/LOGOS-base\")\nmodel = LOGOSModel.from_pretrained(\"tongyi/LOGOS-base\")\ntokenizer = ScienceTokenizer.from_pretrained(\"tongyi/LOGOS-base\")\n\n# 指定生成任务为小分子,约束最大原子数 30\nprompt = tokenizer.encode_task_prompt(task=\"molecule\", max_atoms=30)\n\n# 生成——模型内部会做 constrained decoding 保证化学合法性\noutput_ids = model.generate(\n prompt,\n max_new_tokens=128,\n constrained=True, # 启用约束解码,输出一定满足化学规则\n temperature=0.7,\n top_p=0.9,\n)\n\n# 解码回 SMILES\nsmiles = tokenizer.decode_to_smiles(output_ids)\nprint(f\"生成的分子 SMILES: {smiles}\\")\n\n# 如果你想做蛋白质–分子协同设计,换 task prompt 即可\nco_prompt = tokenizer.encode_task_prompt(\n task=\"protein_molecule_co\",\n protein_length=150,\n max_atoms=40,\n)\nco_output = model.generate(co_prompt, max_new_tokens=256, constrained=True)\nprotein_seq, ligand_smiles = tokenizer.decode_co_design(co_output)\nprint(f\"蛋白质序列: {protein_seq}\")\nprint(f\"配体 SMILES: {ligand_smiles}\\")\n\n\n注意事项:\n\n- logos-model 包名和模型仓库路径以项目 GitHub/HuggingFace 页面为准,上面是典型命名,实际发布可能有调整。\n- constrained=True 是关键参数,关掉它模型可能输出化学非法的序列。\n- 蛋白质–分子协同设计需要更大的 max_new_tokens,建议 GPU 显存 ≥ 16 GB。\n\n如果你想在本地跑完整训练流程,项目也提供了数据预处理脚本:\n\nbash\n# 克隆仓库\ngit clone https://github.com/ATH-Token-Foundry/LOGOS.git\ncd LOGOS\n\n# 准备蛋白质数据(PDB 格式 → ATH token 序列)\npython scripts/preprocess.py --domain protein --input_dir data/pdb --output_dir data/tokenized_protein\n\n# 准备分子数据(SMILES → ATH token 序列)\npython scripts/preprocess.py --domain molecule --input_dir data/smiles --output_dir data/tokenized_molecule\n\n# 启动多域混合训练\npython train.py --config configs/mixed_domain_train.yaml --gpus 4\n\n\nmixed_domain_train.yaml 里会指定三个域的数据比例和采样权重,默认配置已经调过,直接跑即可。\n\n## 采纳建议与边界\n\nLOGOS 的统一思路有明确的优势,也有当前的限制,采纳前值得想清楚:\n\n| 维度 | 优势 | 当前边界 |\n|------|------|----------|\n| 跨域迁移 | 蛋白质训练信号帮助分子搜索 | 迁移幅度取决于域间数据量平衡 |\n| 生成质量 | constrained decoding 保证化学合法 | 合法 ≠ 最优,生成分子仍需 docking 验证 |\n| 计算成本 | 一个模型替代三个 | 统一模型参数量大,小团队推理成本不低 |\n| 可扩展性 | 新科学域只需定义 token 映射 | 复杂域(如 RNA 三维结构)的 token 化尚在探索 |\n\n快速检查清单:\n\n- [ ] 你的任务是否涉及两个或更多科学域的联合设计?如果是,LOGOS 的统一生成比串联专用模型更合理。\n- [ ] 你能否接受「化学合法但未必最优」的初步输出?如果需要高精度 docking 分数,LOGOS 生成后仍要接传统验证管线。\n- [ ] GPU 显存是否足够?base 模型推理建议 ≥ 16 GB,训练建议 ≥ 4×A100。\n- [ ] 你的数据是否已经覆盖目标域?LOGOS 的零样本迁移有上限,域内微调通常更稳。\n\n统一科学语法是一个方向性的选择——把不同科学对象拉到同一张表上对话。LOGOS 是这个方向上第一个开源的基础模型,值得跑一遍生成流程,感受跨域推理的实际效果,再决定是否在自己的管线里替换专用模型。",
"title_en": "Tongyi Open-Sources LOGOS: A Unified Scientific Grammar for Protein, Molecule, and Material Generation",
"body_en": "# Tongyi Open-Sources LOGOS: A Unified Scientific Grammar for Protein, Molecule, and Material Generation\n\nProtein folding, small-molecule design, and new-material discovery have long been handled by entirely separate model families and toolchains. LOGOS — open-sourced by Tongyi Lab in collaboration with Renmin University of China's Gaoling AI Academy — attempts to fold all three into a single generative framework. The core idea is straightforward: proteins fold from amino-acid sequences into 3D structures, molecules assemble from atoms and bonds into conformations, and materials fill lattice sites with elements into periodic crystals. Underneath, every domain plays the same combinatorial game of \"building units + structural constraints + interaction semantics.\" They are, in effect, speaking the same language.\n\n## Why a Unified Grammar Matters\n\nThe traditional approach builds a dedicated model per domain: AlphaFold-style architectures for proteins, DiffDock for molecular docking, various GNNs for material property prediction. The problem is that knowledge cannot migrate across these silos. Structural preferences learned from protein folding — local helical bias, hydrophobic core clustering — could inform molecular conformation search, but a domain-specific model never sees those signals.\n\nLOGOS encodes all scientific objects into a unified token sequence:\n\n- Amino-acid residues → one token type, annotated with position and secondary-structure markers.\n- Atoms and chemical bonds → another token type, annotated with bond type and stereochemistry.\n- Lattice sites and elements → a third token type, annotated with periodic coordinates.\n\nAll three token families share the same embedding space and attention mechanism. During training the model simultaneously sees protein, molecule, and material data, so cross-domain structural regularities are naturally absorbed into the weights.\n\n## ATH-Token Foundry: Turning Scientific Objects into Trainable Language\n\nThe encoding system behind LOGOS is called ATH-Token Foundry. It solves the fundamental problem that scientific objects are not natural language — you cannot feed them directly into a Transformer. You need a rule system that \"translates\" 3D structures, chemical bonds, periodicity, and other physical constraints into serialized tokens while preserving enough information for the model to reconstruct valid generation outputs.\n\nThe pipeline roughly works in three steps:\n\n1. Discretization: Continuous spatial coordinates, angles, and bond lengths are quantized into a finite vocabulary — analogous to how BPE sub-word tokenization works for text.\n2. Structural annotation: Each token carries a structural-role label (e.g., \"backbone atom,\" \"side-chain residue,\" \"lattice node\") so the attention mechanism knows which tokens should interact preferentially.\n3. Constraint injection: During decoding, constrained decoding forces the output to satisfy chemical legality — no super-valent atoms, no illegal amino-acid residues, no broken lattice symmetry.\n\nThis encoding is not a post-processing patch; it is baked into the data pipeline from the very start of training.\n\n## Cross-Domain Generation in Practice\n\nA unified model is not just about \"saving one model\" — it makes cross-domain reasoning feasible. Several representative scenarios:\n\n- Protein–molecule co-design: Given a target protein, simultaneously generate a matching small-molecule ligand. The two objects constrain each other within the same generation process, rather than folding the protein first and then searching for a molecule independently.\n- Inverse material design: Input target properties (band gap, hardness), and the model searches the lattice token space for element combinations and structures that satisfy the constraints.\n- Zero-shot transfer: Structural preferences learned from protein data can, without additional fine-tuning, help molecular conformation search escape local minima.\n\nThe open-source release provides pretrained weights and inference code covering three task heads: protein generation, molecule generation, and material generation.\n\n## Getting Started: Load LOGOS and Generate a Small Molecule\n\nLOGOS is open-sourced on HuggingFace. Below is a minimal runnable example — loading the model and generating a chemically valid small-molecule SMILES. Verify the actual repository paths on the project's HuggingFace/GitHub pages before running; the paths below follow the typical naming convention at release time:\n\npython\n# Install dependencies\n# pip install torch transformers logos-model # logos-model is the project-specific package; see GitHub README\n\nfrom logos import LOGOSModel, LOGOSConfig\nfrom logos.tokenizer import ScienceTokenizer\n\n# Load pretrained model and unified tokenizer\nconfig = LOGOSConfig.from_pretrained(\"tongyi/LOGOS-base\")\nmodel = LOGOSModel.from_pretrained(\"tongyi/LOGOS-base\")\ntokenizer = ScienceTokenizer.from_pretrained(\"tongyi/LOGOS-base\")\n\n# Specify molecule generation task, constrain max atom count to 30\nprompt = tokenizer.encode_task_prompt(task=\"molecule\", max_atoms=30)\n\n# Generate — constrained decoding ensures chemical legality\noutput_ids = model.generate(\n prompt,\n max_new_tokens=128,\n constrained=True, # Enable constrained decoding; output will satisfy chemical rules\n temperature=0.7,\n top_p=0.9,\n)\n\n# Decode back to SMILES\nsmiles = tokenizer.decode_to_smiles(output_ids)\nprint(f\"Generated molecule SMILES: {smiles}\")\n\n# For protein–molecule co-design, simply switch the task prompt\nco_prompt = tokenizer.encode_task_prompt(\n task=\"protein_molecule_co\",\n protein_length=150,\n max_atoms=40,\n)\nco_output = model.generate(co_prompt, max_new_tokens=256, constrained=True)\nprotein_seq, ligand_smiles = tokenizer.decode_co_design(co_output)\nprint(f\"Protein sequence: {protein_seq}\")\nprint(f\"Ligand SMILES: {ligand_smiles}\")\n\n\nCaveats:\n\n- The logos-model package name and model repo paths should be confirmed on the project's GitHub/HuggingFace pages. The names above are illustrative and may differ at actual release.\n- constrained=True is critical — disabling it may produce chemically illegal sequences.\n- Protein–molecule co-design requires larger max_new_tokens; recommend ≥ 16 GB GPU VRAM.\n\nTo run the full training pipeline locally, the project also provides data preprocessing scripts:\n\nbash\n# Clone the repo\ngit clone https://github.com/ATH-Token-Foundry/LOGOS.git\ncd LOGOS\n\n# Prepare protein data (PDB → ATH token sequences)\npython scripts/preprocess.py --domain protein --input_dir data/pdb --output_dir data/tokenized_protein\n\n# Prepare molecule data (SMILES → ATH token sequences)\npython scripts/preprocess.py --domain molecule --input_dir data/smiles --output_dir data/tokenized_molecule\n\n# Launch multi-domain mixed training\npython train.py --config configs/mixed_domain_train.yaml --gpus 4\n\n\nmixed_domain_train.yaml specifies data ratios and sampling weights across the three domains. The default config is already tuned; you can run it directly.\n\n## Adoption Advice and Current Boundaries\n\nLOGOS's unified approach has clear strengths and equally clear limitations — weigh both before adopting:\n\n| Dimension | Strength | Current Boundary |\n|-----------|----------|------------------|\n| Cross-domain transfer | Protein training signals aid molecule search | Transfer magnitude depends on inter-domain data balance |\n| Generation quality | Constrained decoding guarantees chemical legality | Legal ≠ optimal; generated molecules still need docking validation |\n| Compute cost | One model replaces three | Unified model has large parameter count; inference cost is non-trivial for small teams |\n| Extensibility | New scientific domains only need a token mapping | Tokenizing complex domains (e.g., RNA 3D structure) is still exploratory |\n\nQuick adoption checklist:\n\n- [ ] Does your task involve joint design across two or more scientific domains? If yes, LOGOS's unified generation is more principled than chaining domain-specific models.\n- [ ] Can you accept \"chemically legal but not necessarily optimal\" initial outputs? If you need high-precision docking scores, LOGOS outputs must still feed into a traditional validation pipeline.\n- [ ] Is your GPU VRAM sufficient? Base model inference recommends ≥ 16 GB; training recommends ≥ 4×A100.\n- [ ] Does your data already cover the target domain? LOGOS's zero-shot transfer has limits; in-domain fine-tuning is usually more stable.\n\nA unified scientific grammar is a directional choice — putting different scientific objects on the same table to converse. LOGOS is the first open-source foundation model on this path. Run through the generation pipeline, feel the practical effect of cross-domain reasoning, and then decide whether to replace domain-specific models in your own workflow.",
"seo_description_en": "Tongyi Lab open-sources LOGOS, the first unified scientific foundation model encoding proteins, molecules, and materials into one token grammar for cross-domain generative design."
}
通义实验室开源首个统一科学大模型 LOGOS
2026-06-18
29
预计阅读时间: 1 分钟
Disclaimer: This article is an AI-assisted summary. Read it together with the original source when precision matters. The summary may omit context, version differences, or edge cases and is not official documentation.
预计阅读时间:16 分钟