Vfrz nielsr HF Staff commited on
Commit
b4cbf19
·
verified ·
1 Parent(s): 68fa652

Improve model card: Add library_name, abstract, project links, and usage example (#1)

Browse files

- Improve model card: Add library_name, abstract, project links, and usage example (885d28200de9963e30c393b268dbaa6e3288f8cb)


Co-authored-by: Niels Rogge <[email protected]>

Files changed (1) hide show
  1. README.md +70 -11
README.md CHANGED
@@ -1,27 +1,41 @@
1
  ---
2
- license: apache-2.0
 
3
  datasets:
4
  - MegaScience/MegaScience
5
  language:
6
  - en
 
7
  metrics:
8
  - accuracy
9
- base_model:
10
- - Qwen/Qwen3-4B-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-4B-MegaScience
16
 
17
  ### Training Recipe
18
 
19
- - **LR**: 5e-6
20
- - **LR Schedule**: Cosine
21
- - **Batch Size**: 512
22
- - **Max Length**: 4,096
23
- - **Warm Up Ratio**: 0.05
24
- - **Epochs**: 3
25
 
26
  ### Evaluation Results
27
 
@@ -39,11 +53,56 @@ pipeline_tag: text-generation
39
  <img src="https://cdn-uploads.huggingface.co/production/uploads/616bfc2b40e2f69baa1c7add/VogIpBbjfNxXFP9DfVMms.png" alt="Data Pipeline" style="width:100%;">
40
  </div>
41
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
42
  ## Citation
43
 
44
  Check out our [paper](https://arxiv.org/abs/2507.16812) for more details. If you use our dataset or find our work useful, please cite
45
 
46
- ```
47
  @article{fan2025megascience,
48
  title={MegaScience: Pushing the Frontiers of Post-Training Datasets for Science Reasoning},
49
  author={Fan, Run-Ze and Wang, Zengzhi and Liu, Pengfei},
@@ -51,4 +110,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-4B-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
  ---
14
+
15
  # [MegaScience: Pushing the Frontiers of Post-Training Datasets for Science Reasoning](https://arxiv.org/abs/2507.16812)
16
 
17
+ This repository hosts the **Qwen3-4B-MegaScience** model, a large language model fine-tuned on the MegaScience dataset for scientific reasoning.
18
+
19
+ ## Abstract
20
+
21
+ 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.
22
+
23
+ ## Project Resources
24
+
25
+ * **Paper**: [MegaScience: Pushing the Frontiers of Post-Training Datasets for Science Reasoning](https://arxiv.org/abs/2507.16812)
26
+ * **Official Website**: [https://gair-nlp.github.io/MegaScience](https://gair-nlp.github.io/MegaScience)
27
+ * **GitHub Repository**: [https://github.com/GAIR-NLP/MegaScience](https://github.com/GAIR-NLP/MegaScience)
28
+
29
  ## Qwen3-4B-MegaScience
30
 
31
  ### Training Recipe
32
 
33
+ - **LR**: 5e-6
34
+ - **LR Schedule**: Cosine
35
+ - **Batch Size**: 512
36
+ - **Max Length**: 4,096
37
+ - **Warm Up Ratio**: 0.05
38
+ - **Epochs**: 3
39
 
40
  ### Evaluation Results
41
 
 
53
  <img src="https://cdn-uploads.huggingface.co/production/uploads/616bfc2b40e2f69baa1c7add/VogIpBbjfNxXFP9DfVMms.png" alt="Data Pipeline" style="width:100%;">
54
  </div>
55
 
56
+ ## Usage
57
+
58
+ This model can be loaded and used with the `transformers` library.
59
+
60
+ ```python
61
+ from transformers import AutoModelForCausalLM, AutoTokenizer
62
+ import torch
63
+
64
+ model_id = "MegaScience/Qwen3-4B-MegaScience"
65
+
66
+ tokenizer = AutoTokenizer.from_pretrained(model_id)
67
+ model = AutoModelForCausalLM.from_pretrained(
68
+ model_id,
69
+ torch_dtype=torch.bfloat16, # Use bfloat16 for better performance/memory
70
+ device_map="auto"
71
+ )
72
+
73
+ messages = [
74
+ {"role": "system", "content": "You are a helpful assistant for scientific reasoning."},
75
+ {"role": "user", "content": "What are the primary components of a DNA molecule?"}
76
+ ]
77
+
78
+ text = tokenizer.apply_chat_template(
79
+ messages,
80
+ tokenize=False,
81
+ add_generation_prompt=True
82
+ )
83
+
84
+ model_inputs = tokenizer([text], return_tensors="pt").to(model.device)
85
+
86
+ generated_ids = model.generate(
87
+ model_inputs.input_ids,
88
+ max_new_tokens=512,
89
+ do_sample=True, # Enable sampling for more varied responses
90
+ temperature=0.7 # Adjust temperature for creativity
91
+ )
92
+ generated_ids = [
93
+ output_id[len(input_id):]
94
+ for input_id, output_id in zip(model_inputs.input_ids, generated_ids)
95
+ ]
96
+
97
+ response = tokenizer.batch_decode(generated_ids, skip_special_tokens=True)[0]
98
+ print(response)
99
+ ```
100
+
101
  ## Citation
102
 
103
  Check out our [paper](https://arxiv.org/abs/2507.16812) for more details. If you use our dataset or find our work useful, please cite
104
 
105
+ ```bibtex
106
  @article{fan2025megascience,
107
  title={MegaScience: Pushing the Frontiers of Post-Training Datasets for Science Reasoning},
108
  author={Fan, Run-Ze and Wang, Zengzhi and Liu, Pengfei},
 
110
  journal={arXiv preprint arXiv:2507.16812},
111
  url={https://arxiv.org/abs/2507.16812}
112
  }
113
+ ```