Improve model card: Add metadata, abstract, GitHub link, and usage example (#1)
Browse files- Improve model card: Add metadata, abstract, GitHub link, and usage example (e87dae3bde0b037dbfb1407f0e5349f5620a1b93)
Co-authored-by: Niels Rogge <[email protected]>
README.md
CHANGED
@@ -1,27 +1,78 @@
|
|
1 |
---
|
2 |
-
|
|
|
3 |
datasets:
|
4 |
- MegaScience/MegaScience
|
5 |
language:
|
6 |
- en
|
|
|
7 |
metrics:
|
8 |
- accuracy
|
9 |
-
base_model:
|
10 |
-
- Qwen/Qwen3-8B-Base
|
11 |
pipeline_tag: text-generation
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
12 |
---
|
|
|
13 |
# [MegaScience: Pushing the Frontiers of Post-Training Datasets for Science Reasoning](https://arxiv.org/abs/2507.16812)
|
14 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
15 |
## Qwen3-8B-MegaScience
|
16 |
|
17 |
### Training Recipe
|
18 |
|
19 |
-
-
|
20 |
-
-
|
21 |
-
-
|
22 |
-
-
|
23 |
-
-
|
24 |
-
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
25 |
|
26 |
### Evaluation Results
|
27 |
|
@@ -51,4 +102,4 @@ Check out our [paper](https://arxiv.org/abs/2507.16812) for more details. If you
|
|
51 |
journal={arXiv preprint arXiv:2507.16812},
|
52 |
url={https://arxiv.org/abs/2507.16812}
|
53 |
}
|
54 |
-
```
|
|
|
1 |
---
|
2 |
+
base_model:
|
3 |
+
- Qwen/Qwen3-8B-Base
|
4 |
datasets:
|
5 |
- MegaScience/MegaScience
|
6 |
language:
|
7 |
- en
|
8 |
+
license: apache-2.0
|
9 |
metrics:
|
10 |
- accuracy
|
|
|
|
|
11 |
pipeline_tag: text-generation
|
12 |
+
library_name: transformers
|
13 |
+
tags:
|
14 |
+
- qwen
|
15 |
+
- science
|
16 |
+
- scientific-reasoning
|
17 |
+
- causal-lm
|
18 |
+
- instruction-tuning
|
19 |
---
|
20 |
+
|
21 |
# [MegaScience: Pushing the Frontiers of Post-Training Datasets for Science Reasoning](https://arxiv.org/abs/2507.16812)
|
22 |
|
23 |
+
This repository hosts the **Qwen3-8B-MegaScience** model, a key component of the research presented in the paper "MegaScience: Pushing the Frontiers of Post-Training Datasets for Science Reasoning".
|
24 |
+
|
25 |
+
## Abstract
|
26 |
+
Scientific reasoning is critical for developing AI scientists and supporting human researchers in advancing the frontiers of natural science discovery. However, the open-source community has primarily focused on mathematics and coding while neglecting the scientific domain, largely due to the absence of open, large-scale, high-quality, verifiable scientific reasoning datasets. To bridge this gap, we first present TextbookReasoning, an open dataset featuring truthful reference answers extracted from 12k university-level scientific textbooks, comprising 650k reasoning questions spanning 7 scientific disciplines. We further introduce MegaScience, a large-scale mixture of high-quality open-source datasets totaling 1.25 million instances, developed through systematic ablation studies that evaluate various data selection methodologies to identify the optimal subset for each publicly available scientific dataset. Meanwhile, we build a comprehensive evaluation system covering diverse subjects and question types across 15 benchmarks, incorporating comprehensive answer extraction strategies to ensure accurate evaluation metrics. Our experiments demonstrate that our datasets achieve superior performance and training efficiency with more concise response lengths compared to existing open-source scientific datasets. Furthermore, we train Llama3.1, Qwen2.5, and Qwen3 series base models on MegaScience, which significantly outperform the corresponding official instruct models in average performance. In addition, MegaScience exhibits greater effectiveness for larger and stronger models, suggesting a scaling benefit for scientific tuning. We release our data curation pipeline, evaluation system, datasets, and seven trained models to the community to advance scientific reasoning research.
|
27 |
+
|
28 |
+
## Code
|
29 |
+
The official implementation and full codebase are available on the [MegaScience GitHub repository](https://github.com/GAIR-NLP/lm-open-science-evaluation).
|
30 |
+
|
31 |
## Qwen3-8B-MegaScience
|
32 |
|
33 |
### Training Recipe
|
34 |
|
35 |
+
- **LR**: 5e-6
|
36 |
+
- **LR Schedule**: Cosine
|
37 |
+
- **Batch Size**: 512
|
38 |
+
- **Max Length**: 4,096
|
39 |
+
- **Warm Up Ratio**: 0.05
|
40 |
+
- **Epochs**: 3
|
41 |
+
|
42 |
+
### Usage
|
43 |
+
|
44 |
+
You can load the model and tokenizer using the `transformers` library and perform text generation. For Qwen models, it is often recommended to use the `apply_chat_template` method for instruction-following tasks.
|
45 |
+
|
46 |
+
```python
|
47 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
48 |
+
import torch
|
49 |
+
|
50 |
+
model_id = "MegaScience/Qwen3-8B-MegaScience"
|
51 |
+
|
52 |
+
# Load model with bfloat16 for better performance on compatible GPUs
|
53 |
+
# or use torch.float16 if bfloat16 is not supported
|
54 |
+
model = AutoModelForCausalLM.from_pretrained(
|
55 |
+
model_id,
|
56 |
+
torch_dtype=torch.bfloat16,
|
57 |
+
device_map="auto" # Automatically maps model to available devices (e.g., GPU)
|
58 |
+
)
|
59 |
+
tokenizer = AutoTokenizer.from_pretrained(model_id)
|
60 |
+
|
61 |
+
# Example for chat completion
|
62 |
+
messages = [
|
63 |
+
{"role": "user", "content": "Explain Newton's first law of motion in simple terms."},
|
64 |
+
]
|
65 |
+
|
66 |
+
input_ids = tokenizer.apply_chat_template(
|
67 |
+
messages,
|
68 |
+
tokenize=True,
|
69 |
+
add_generation_prompt=True, # Important for instruction-tuned models
|
70 |
+
return_tensors="pt"
|
71 |
+
).to(model.device)
|
72 |
+
|
73 |
+
outputs = model.generate(input_ids, max_new_tokens=256, do_sample=True, temperature=0.7)
|
74 |
+
print(tokenizer.decode(outputs[0], skip_special_tokens=True))
|
75 |
+
```
|
76 |
|
77 |
### Evaluation Results
|
78 |
|
|
|
102 |
journal={arXiv preprint arXiv:2507.16812},
|
103 |
url={https://arxiv.org/abs/2507.16812}
|
104 |
}
|
105 |
+
```
|