Add MetaboLLM organization overview
Browse files- .gitattributes +1 -0
- README.md +247 -1
- assets/Figure1.png +3 -0
.gitattributes
CHANGED
|
@@ -33,3 +33,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
| 33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
| 33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
| 36 |
+
*.png filter=lfs diff=lfs merge=lfs -text
|
README.md
CHANGED
|
@@ -7,4 +7,250 @@ sdk: static
|
|
| 7 |
pinned: false
|
| 8 |
---
|
| 9 |
|
| 10 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 7 |
pinned: false
|
| 8 |
---
|
| 9 |
|
| 10 |
+
# MetaboLLM
|
| 11 |
+
|
| 12 |
+
**MetaboLLM** is a family of metabolomics-specialized large language models designed to integrate biochemical knowledge across heterogeneous resources and support metabolite-, pathway-, reaction-, and enzyme-centered reasoning and description generation.
|
| 13 |
+
|
| 14 |
+
MetaboLLM was developed through continual pretraining, supervised fine-tuning, and structured retrieval using harmonized biochemical knowledge from KEGG, HMDB, PubChem, and SMPDB.
|
| 15 |
+
|
| 16 |
+
<p align="center">
|
| 17 |
+
<img src="https://huggingface.co/spaces/MetaboLLM/README/resolve/main/assets/Figure1.png" alt="Overview of the MetaboLLM framework" width="950">
|
| 18 |
+
</p>
|
| 19 |
+
|
| 20 |
+
## Highlights
|
| 21 |
+
|
| 22 |
+
- Integrated knowledge covering **237,243 metabolites**, **2,359 pathways**, **12,323 reactions**, and **5,993 enzymes**
|
| 23 |
+
- Released **four MetaboLLM model variants** across Qwen, Gemma, and Llama backbones
|
| 24 |
+
- Constructed a metabolomics benchmark containing **17 tasks**, **6,000 training examples**, and **4,200 test examples**
|
| 25 |
+
- Evaluated factual knowledge, class identification, biochemical relationships, and description generation
|
| 26 |
+
- Compared MetaboLLM against corresponding base models and five publicly available medical language models
|
| 27 |
+
- Evaluated transfer on the independently developed MetaBench benchmark
|
| 28 |
+
|
| 29 |
+
## Resources
|
| 30 |
+
|
| 31 |
+
| Resource | Description |
|
| 32 |
+
|---|---|
|
| 33 |
+
| [MetaboLLM-Qwen3-4B](https://huggingface.co/MetaboLLM/MetaboLLM-Qwen3-4B) | Primary MetaboLLM model based on Qwen3-4B |
|
| 34 |
+
| [MetaboLLM-Qwen3-8B](https://huggingface.co/MetaboLLM/MetaboLLM-Qwen3-8B) | MetaboLLM model based on Qwen3-8B |
|
| 35 |
+
| [MetaboLLM-Gemma-3-4B](https://huggingface.co/MetaboLLM/MetaboLLM-Gemma-3-4B) | MetaboLLM model based on Gemma-3-4B |
|
| 36 |
+
| [MetaboLLM-Llama-3.2-3B](https://huggingface.co/MetaboLLM/MetaboLLM-Llama-3.2-3B) | MetaboLLM model based on Llama-3.2-3B |
|
| 37 |
+
| [MetaboLLM-Benchmark](https://huggingface.co/datasets/MetaboLLM/MetaboLLM-Benchmark) | Training and evaluation benchmark across 17 metabolomics tasks |
|
| 38 |
+
|
| 39 |
+
## Model Family
|
| 40 |
+
|
| 41 |
+
| Model | Backbone | Release Format |
|
| 42 |
+
|---|---|---|
|
| 43 |
+
| MetaboLLM-Qwen3-4B | Qwen3-4B | PEFT LoRA adapter |
|
| 44 |
+
| MetaboLLM-Qwen3-8B | Qwen3-8B | PEFT LoRA adapter |
|
| 45 |
+
| MetaboLLM-Gemma-3-4B | Gemma-3-4B | PEFT LoRA adapter |
|
| 46 |
+
| MetaboLLM-Llama-3.2-3B | Llama-3.2-3B | PEFT LoRA adapter |
|
| 47 |
+
|
| 48 |
+
MetaboLLM-Qwen3-4B served as the primary model in the associated study. All released repositories contain adapter weights and require the corresponding base model.
|
| 49 |
+
|
| 50 |
+
## Integrated Biochemical Knowledge
|
| 51 |
+
|
| 52 |
+
MetaboLLM was developed from a unified resource integrating complementary information from:
|
| 53 |
+
|
| 54 |
+
- **KEGG** for metabolites, reactions, enzymes, and pathways
|
| 55 |
+
- **HMDB** for human metabolites, biological roles, chemical taxonomy, and compound descriptions
|
| 56 |
+
- **PubChem** for chemical structures, identifiers, molecular properties, and compound descriptions
|
| 57 |
+
- **SMPDB** for curated pathways and physiological descriptions
|
| 58 |
+
|
| 59 |
+
The harmonized resource contains:
|
| 60 |
+
|
| 61 |
+
| Entity type | Count |
|
| 62 |
+
|---|---:|
|
| 63 |
+
| Metabolites | 237,243 |
|
| 64 |
+
| Pathways | 2,359 |
|
| 65 |
+
| Reactions | 12,323 |
|
| 66 |
+
| Enzymes | 5,993 |
|
| 67 |
+
|
| 68 |
+
## MetaboLLM Benchmark
|
| 69 |
+
|
| 70 |
+
The benchmark contains 17 tasks organized into four complementary categories.
|
| 71 |
+
|
| 72 |
+
| Category | Tasks | Train | Test |
|
| 73 |
+
|---|---:|---:|---:|
|
| 74 |
+
| Knowledge recall | 5 | 1,000 | 1,000 |
|
| 75 |
+
| Class identification | 4 | 1,000 | 1,000 |
|
| 76 |
+
| Relation identification | 3 | 1,000 | 1,000 |
|
| 77 |
+
| Description generation | 5 | 3,000 | 1,200 |
|
| 78 |
+
| **Total** | **17** | **6,000** | **4,200** |
|
| 79 |
+
|
| 80 |
+
The benchmark evaluates:
|
| 81 |
+
|
| 82 |
+
- molecular identity and formula knowledge
|
| 83 |
+
- metabolite and reaction class recognition
|
| 84 |
+
- metabolite–pathway relationships
|
| 85 |
+
- metabolite–reaction relationships
|
| 86 |
+
- reaction–enzyme relationships
|
| 87 |
+
- metabolite, pathway, and enzyme description generation
|
| 88 |
+
- structure-rich and structure-poor metabolite description generation
|
| 89 |
+
|
| 90 |
+
## Benchmark Results
|
| 91 |
+
|
| 92 |
+
### Biochemical Knowledge and Structured Relationships
|
| 93 |
+
|
| 94 |
+
Mean accuracy across 12 multiple-choice and short-answer tasks.
|
| 95 |
+
|
| 96 |
+
| Category | Model | Mean Accuracy |
|
| 97 |
+
|---|---|---:|
|
| 98 |
+
| Medical LLM | MedGemma-1.5-4B | 49.0 |
|
| 99 |
+
| Medical LLM | FineMedLM-O1 | 57.9 |
|
| 100 |
+
| Medical LLM | II-Medical-8B-1706 | 63.0 |
|
| 101 |
+
| Medical LLM | Qwen2.5-Aloe-Beta-7B | 63.9 |
|
| 102 |
+
| Medical LLM | Meditron3-Qwen2.5-7B | 65.7 |
|
| 103 |
+
| Base model | Llama-3.2-3B | 51.5 |
|
| 104 |
+
| Base model | Gemma-3-4B | 52.2 |
|
| 105 |
+
| Base model | Qwen3-4B | 66.5 |
|
| 106 |
+
| Base model | Qwen3-8B | 66.8 |
|
| 107 |
+
| MetaboLLM | MetaboLLM-Llama-3.2-3B | 70.0 |
|
| 108 |
+
| MetaboLLM | MetaboLLM-Gemma-3-4B | 75.3 |
|
| 109 |
+
| MetaboLLM | MetaboLLM-Qwen3-8B | 75.9 |
|
| 110 |
+
| MetaboLLM | **MetaboLLM-Qwen3-4B** | **79.1** |
|
| 111 |
+
|
| 112 |
+
All four MetaboLLM variants outperformed their corresponding unadapted backbones and all evaluated medical language models. MetaboLLM-Qwen3-4B achieved the highest mean accuracy at 79.1%, compared with 65.7% for the strongest evaluated medical model and 66.5% for its corresponding base model.
|
| 113 |
+
|
| 114 |
+
### Biochemical Description Generation
|
| 115 |
+
|
| 116 |
+
BERTScore-F1 on a 0–100 scale.
|
| 117 |
+
|
| 118 |
+
| Category | Model | Metabolite Description | Pathway Description | Enzyme Description | Structure-Rich Metabolite Description | Structure-Poor Metabolite Description |
|
| 119 |
+
|---|---|---:|---:|---:|---:|---:|
|
| 120 |
+
| Medical LLM | MedGemma-1.5-4B | 81.05 | 80.97 | 79.33 | 84.89 | 84.73 |
|
| 121 |
+
| Medical LLM | FineMedLM-O1 | 83.05 | 82.87 | 81.22 | 84.10 | 83.96 |
|
| 122 |
+
| Medical LLM | II-Medical-8B-1706 | 82.71 | 82.94 | 81.60 | 86.37 | 85.84 |
|
| 123 |
+
| Medical LLM | Qwen2.5-Aloe-Beta-7B | 83.34 | 83.39 | 81.68 | 85.47 | 84.52 |
|
| 124 |
+
| Medical LLM | Meditron3-Qwen2.5-7B | 83.69 | 83.14 | 81.99 | 84.47 | 83.76 |
|
| 125 |
+
| Base model | Llama-3.2-3B | 82.81 | 82.56 | 81.40 | 84.56 | 84.50 |
|
| 126 |
+
| Base model | Gemma-3-4B | 81.74 | 81.54 | 80.37 | 85.48 | 85.07 |
|
| 127 |
+
| Base model | Qwen3-4B | 82.39 | 81.85 | 80.68 | 86.48 | 85.80 |
|
| 128 |
+
| Base model | Qwen3-8B | 82.30 | 82.28 | 80.79 | 86.20 | 85.61 |
|
| 129 |
+
| MetaboLLM | MetaboLLM-Llama-3.2-3B | 90.93 | 86.74 | 83.78 | 87.13 | 87.65 |
|
| 130 |
+
| MetaboLLM | MetaboLLM-Gemma-3-4B | 87.39 | 83.83 | 80.69 | 87.03 | 87.74 |
|
| 131 |
+
| MetaboLLM | MetaboLLM-Qwen3-8B | 90.94 | 87.26 | 83.70 | 87.66 | 88.02 |
|
| 132 |
+
| MetaboLLM | **MetaboLLM-Qwen3-4B** | **91.71** | **88.04** | **84.12** | **87.79** | **88.06** |
|
| 133 |
+
|
| 134 |
+
MetaboLLM-Qwen3-4B achieved the highest BERTScore-F1 across all five description-generation tasks.
|
| 135 |
+
|
| 136 |
+
## External Benchmark Transfer
|
| 137 |
+
|
| 138 |
+
MetaboLLM was also evaluated on MetaBench, an independently developed public metabolomics benchmark.
|
| 139 |
+
|
| 140 |
+
- **MetaboLLM-Qwen3-8B** achieved the highest Knowledge MCQA accuracy at **56.42%**
|
| 141 |
+
- **MetaboLLM-Qwen3-4B** achieved the highest pathway-description scores, including **85.19 BERTScore-F1**, **25.83 ROUGE-L-F1**, and **17.61 BLEU-2**
|
| 142 |
+
|
| 143 |
+
These results demonstrate transfer beyond the internally constructed MetaboLLM benchmark.
|
| 144 |
+
|
| 145 |
+
## Quick Start
|
| 146 |
+
|
| 147 |
+
Install the required packages:
|
| 148 |
+
|
| 149 |
+
```bash
|
| 150 |
+
pip install -U transformers peft accelerate torch
|
| 151 |
+
```
|
| 152 |
+
|
| 153 |
+
Example using MetaboLLM-Qwen3-4B:
|
| 154 |
+
|
| 155 |
+
```python
|
| 156 |
+
import torch
|
| 157 |
+
from peft import PeftModel
|
| 158 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
| 159 |
+
|
| 160 |
+
base_model_id = "Qwen/Qwen3-4B-Instruct-2507"
|
| 161 |
+
adapter_id = "MetaboLLM/MetaboLLM-Qwen3-4B"
|
| 162 |
+
|
| 163 |
+
tokenizer = AutoTokenizer.from_pretrained(adapter_id)
|
| 164 |
+
|
| 165 |
+
base_model = AutoModelForCausalLM.from_pretrained(
|
| 166 |
+
base_model_id,
|
| 167 |
+
torch_dtype="auto",
|
| 168 |
+
device_map="auto",
|
| 169 |
+
)
|
| 170 |
+
|
| 171 |
+
model = PeftModel.from_pretrained(
|
| 172 |
+
base_model,
|
| 173 |
+
adapter_id,
|
| 174 |
+
)
|
| 175 |
+
|
| 176 |
+
messages = [
|
| 177 |
+
{
|
| 178 |
+
"role": "user",
|
| 179 |
+
"content": "What is the biochemical role of pyruvate?"
|
| 180 |
+
}
|
| 181 |
+
]
|
| 182 |
+
|
| 183 |
+
inputs = tokenizer.apply_chat_template(
|
| 184 |
+
messages,
|
| 185 |
+
add_generation_prompt=True,
|
| 186 |
+
return_tensors="pt",
|
| 187 |
+
).to(model.device)
|
| 188 |
+
|
| 189 |
+
with torch.no_grad():
|
| 190 |
+
outputs = model.generate(
|
| 191 |
+
inputs,
|
| 192 |
+
max_new_tokens=256,
|
| 193 |
+
do_sample=False,
|
| 194 |
+
)
|
| 195 |
+
|
| 196 |
+
response = tokenizer.decode(
|
| 197 |
+
outputs[0][inputs.shape[-1]:],
|
| 198 |
+
skip_special_tokens=True,
|
| 199 |
+
)
|
| 200 |
+
|
| 201 |
+
print(response)
|
| 202 |
+
```
|
| 203 |
+
|
| 204 |
+
Please check the corresponding model card for the exact base-model identifier and model-specific loading instructions.
|
| 205 |
+
|
| 206 |
+
## Loading the Benchmark
|
| 207 |
+
|
| 208 |
+
```python
|
| 209 |
+
from datasets import load_dataset
|
| 210 |
+
|
| 211 |
+
dataset = load_dataset(
|
| 212 |
+
"MetaboLLM/MetaboLLM-Benchmark",
|
| 213 |
+
"Knowledge_recall",
|
| 214 |
+
)
|
| 215 |
+
|
| 216 |
+
print(dataset["test"][0])
|
| 217 |
+
```
|
| 218 |
+
|
| 219 |
+
Available configurations:
|
| 220 |
+
|
| 221 |
+
- `Knowledge_recall`
|
| 222 |
+
- `Class_identification`
|
| 223 |
+
- `Relation_identification`
|
| 224 |
+
- `Description_generation`
|
| 225 |
+
|
| 226 |
+
## Intended Uses
|
| 227 |
+
|
| 228 |
+
MetaboLLM is intended for research involving:
|
| 229 |
+
|
| 230 |
+
- metabolomics-specific question answering
|
| 231 |
+
- biochemical knowledge recall
|
| 232 |
+
- metabolite and reaction class identification
|
| 233 |
+
- metabolite–pathway and reaction–enzyme relationship identification
|
| 234 |
+
- metabolite, pathway, and enzyme description generation
|
| 235 |
+
- evaluation of metabolomics-specialized language models
|
| 236 |
+
|
| 237 |
+
## Limitations
|
| 238 |
+
|
| 239 |
+
- MetaboLLM may generate incorrect or unsupported biochemical statements.
|
| 240 |
+
- Performance outside metabolomics and biochemical knowledge tasks has not been comprehensively evaluated.
|
| 241 |
+
- Outputs should be independently verified and should not be used for clinical decision-making.
|
| 242 |
+
|
| 243 |
+
## Licenses
|
| 244 |
+
|
| 245 |
+
Each MetaboLLM repository is distributed according to its model card and license notice.
|
| 246 |
+
|
| 247 |
+
- Use of each adapter remains subject to the license and terms of its corresponding base model.
|
| 248 |
+
- Benchmark components created by the MetaboLLM authors are distributed under the terms described in the benchmark repository.
|
| 249 |
+
- Third-party and source-derived biochemical content remains subject to the licenses and terms of the original providers.
|
| 250 |
+
|
| 251 |
+
Please review the license files in the relevant model and dataset repositories before use.
|
| 252 |
+
|
| 253 |
+
## Resource Maintainers
|
| 254 |
+
|
| 255 |
+
- Dohyun Ku
|
| 256 |
+
- Min Gu Kwak
|
assets/Figure1.png
ADDED
|
Git LFS Details
|