Update README.md
Browse files
README.md
CHANGED
@@ -1,70 +1,57 @@
|
|
1 |
-
#
|
2 |
|
3 |
-
|
4 |
-
|
5 |
-
This model is a fine-tuned version of [HuggingFaceTB/SmolLM2-135M](https://huggingface.co/HuggingFaceTB/SmolLM2-135M) using Low-Rank Adaptation (LoRA) on the decontaminated [CAMEL-AI Physics](https://huggingface.co/datasets/camel-ai/physics) dataset. The dataset was decontaminated to ensure no overlap with the evaluation dataset `mmlu:college_physics`, ensuring a fair evaluation process.
|
6 |
-
|
7 |
-
The fine-tuning leveraged PEFT (Parameter-Efficient Fine-Tuning) to optimize a smaller set of parameters, making it a lightweight yet effective fine-tuning approach.
|
8 |
|
9 |
---
|
10 |
|
11 |
-
## Model
|
12 |
|
13 |
-
|
14 |
-
- **Dataset Used for Fine-tuning**: [akhilfau/physics_decontaminated_2](https://huggingface.co/datasets/akhilfau/physics_decontaminated_2)
|
15 |
-
- **Fine-tuning Methodology**: LoRA (Low-Rank Adaptation)
|
16 |
-
- **Framework Versions**:
|
17 |
-
- PEFT: `0.13.2`
|
18 |
-
- Transformers: `4.46.2`
|
19 |
-
- PyTorch: `2.4.1+cu121`
|
20 |
-
- Datasets: `3.1.0`
|
21 |
-
- Tokenizers: `0.20.3`
|
22 |
|
23 |
-
|
24 |
|
25 |
-
|
|
|
|
|
|
|
26 |
|
27 |
-
|
28 |
|
29 |
-
|
30 |
-
- `message_1`: The problem statement (e.g., a physics question).
|
31 |
-
- `message_2`: The solution or explanation.
|
32 |
|
33 |
-
The
|
34 |
|
35 |
---
|
36 |
|
37 |
-
##
|
38 |
|
39 |
-
|
40 |
-
- Educational purposes in the field of physics.
|
41 |
-
- Benchmarking and comparison with other lightweight language models.
|
42 |
|
43 |
-
|
|
|
44 |
|
45 |
-
|
46 |
-
- The model may require additional alignment or fine-tuning for tasks with different formats, such as multiple-choice questions (MCQs).
|
47 |
|
48 |
---
|
49 |
|
50 |
## Training Procedure
|
51 |
|
52 |
-
### Hyperparameters
|
53 |
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
|
64 |
### Training Results
|
65 |
|
66 |
| Training Loss | Epoch | Step | Validation Loss |
|
67 |
-
|
68 |
| 1.0151 | 1.0 | 4000 | 1.0407 |
|
69 |
| 1.0234 | 2.0 | 8000 | 1.0087 |
|
70 |
| 0.9995 | 3.0 | 12000 | 0.9921 |
|
@@ -76,38 +63,16 @@ The following hyperparameters were used during training:
|
|
76 |
|
77 |
---
|
78 |
|
79 |
-
##
|
80 |
-
|
81 |
-
The model was evaluated using the physics subset of the `mmlu:college_physics` dataset. The training dataset was explicitly decontaminated to ensure fair evaluation.
|
82 |
-
|
83 |
-
---
|
84 |
-
|
85 |
-
## Model Usage
|
86 |
-
|
87 |
-
You can load this model from the Hugging Face Hub as follows:
|
88 |
-
|
89 |
-
```python
|
90 |
-
from transformers import AutoTokenizer, AutoModelForCausalLM
|
91 |
|
92 |
-
|
93 |
-
model_name = "akhilfau/fine-tuned-smolLM2-135M-with-LoRA-on-camel-ai-physics"
|
94 |
-
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
95 |
-
model = AutoModelForCausalLM.from_pretrained(model_name)
|
96 |
-
|
97 |
-
# Prepare a question
|
98 |
-
input_text = "What is the Schrödinger equation?"
|
99 |
-
inputs = tokenizer(input_text, return_tensors="pt")
|
100 |
-
|
101 |
-
# Generate a response
|
102 |
-
output = model.generate(**inputs, max_length=100)
|
103 |
-
print(tokenizer.decode(output[0], skip_special_tokens=True))
|
104 |
-
```
|
105 |
|
106 |
---
|
107 |
|
108 |
-
##
|
109 |
-
|
110 |
-
- The decontamination process was implemented using tools from the [Cosmopedia Repository](https://github.com/huggingface/cosmopedia).
|
111 |
-
- The model fine-tuning leveraged PEFT for efficient adaptation of the base model.
|
112 |
|
113 |
-
|
|
|
|
|
|
|
|
|
|
1 |
+
# fine-tuned-smolLM2-135M-with-LoRA-on-camel-ai-physics
|
2 |
|
3 |
+
This model is a fine-tuned version of [HuggingFaceTB/SmolLM2-135M](https://huggingface.co/HuggingFaceTB/SmolLM2-135M) on the dataset [akhilfau/physics_decontaminated_2](https://huggingface.co/datasets/akhilfau/physics_decontaminated_2). This dataset was created by decontaminating the [camel-ai/physics](https://huggingface.co/datasets/camel-ai/physics) dataset from [mmlu:college_physics](https://huggingface.co/datasets/lighteval/mmlu).
|
|
|
|
|
|
|
|
|
4 |
|
5 |
---
|
6 |
|
7 |
+
## Model Performance
|
8 |
|
9 |
+
This model was evaluated on **MMLU: college_physics** using **LightEval**. The evaluation compared the base model (HuggingFaceTB/SmolLM2-135M) and the fine-tuned model (akhilfau/fine-tuned-smolLM2-135M-with-LoRA-on-camel-ai-physics). Results are as follows:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
10 |
|
11 |
+
### Evaluation Results:
|
12 |
|
13 |
+
| Model Name | Task | Metric | Accuracy ± Stderr |
|
14 |
+
|-----------------------------------------------------|-----------------------------|--------|-------------------|
|
15 |
+
| **HuggingFaceTB/SmolLM2-135M** | mmlu:college_physics | acc | 0.2157 ± 0.0409 |
|
16 |
+
| **akhilfau/fine-tuned-smolLM2-135M-with-LoRA-on-camel-ai-physics** | mmlu:college_physics | acc | 0.2843 ± 0.0449 |
|
17 |
|
18 |
+
---
|
19 |
|
20 |
+
## Model Description
|
|
|
|
|
21 |
|
22 |
+
The fine-tuned model leverages **LoRA (Low-Rank Adaptation)** for parameter-efficient fine-tuning. The base model is SmolLM2-135M, which uses the **LlamaForCausalLM** architecture, and it was fine-tuned to enhance its understanding of physics-related questions and answers using the **akhilfau/physics_decontaminated_2** dataset.
|
23 |
|
24 |
---
|
25 |
|
26 |
+
## Training and Evaluation Data
|
27 |
|
28 |
+
### Dataset Details:
|
|
|
|
|
29 |
|
30 |
+
- **Training Dataset:** [akhilfau/physics_decontaminated_2](https://huggingface.co/datasets/akhilfau/physics_decontaminated_2)
|
31 |
+
- **Evaluation Dataset:** [mmlu:college_physics](https://huggingface.co/datasets/lighteval/mmlu/viewer/college_physics)
|
32 |
|
33 |
+
The training dataset was decontaminated to ensure no overlap with the evaluation dataset for fair performance testing.
|
|
|
34 |
|
35 |
---
|
36 |
|
37 |
## Training Procedure
|
38 |
|
39 |
+
### Training Hyperparameters
|
40 |
|
41 |
+
| Hyperparameter | Value |
|
42 |
+
|---------------------------|--------------------|
|
43 |
+
| Learning Rate | 0.0005 |
|
44 |
+
| Train Batch Size | 4 |
|
45 |
+
| Eval Batch Size | 4 |
|
46 |
+
| Seed | 42 |
|
47 |
+
| Optimizer | AdamW with betas=(0.9, 0.999), epsilon=1e-8 |
|
48 |
+
| LR Scheduler Type | Cosine |
|
49 |
+
| Number of Epochs | 8 |
|
50 |
|
51 |
### Training Results
|
52 |
|
53 |
| Training Loss | Epoch | Step | Validation Loss |
|
54 |
+
|---------------|-------|-------|-----------------|
|
55 |
| 1.0151 | 1.0 | 4000 | 1.0407 |
|
56 |
| 1.0234 | 2.0 | 8000 | 1.0087 |
|
57 |
| 0.9995 | 3.0 | 12000 | 0.9921 |
|
|
|
63 |
|
64 |
---
|
65 |
|
66 |
+
## Intended Use
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
67 |
|
68 |
+
This model is specifically fine-tuned for physics-related reasoning tasks and QA tasks. It may perform well on datasets that require understanding physics-related problems and concepts. Evaluation results show a measurable improvement compared to the base model on MMLU college physics tasks.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
69 |
|
70 |
---
|
71 |
|
72 |
+
## Framework Versions
|
|
|
|
|
|
|
73 |
|
74 |
+
- **PEFT**: 0.13.2
|
75 |
+
- **Transformers**: 4.46.2
|
76 |
+
- **Pytorch**: 2.4.1+cu121
|
77 |
+
- **Datasets**: 3.1.0
|
78 |
+
- **Tokenizers**: 0.20.3
|