File size: 4,926 Bytes
ec64ff9
ed742ed
ec64ff9
ed742ed
ec64ff9
 
 
 
 
ed742ed
ec64ff9
ed742ed
 
 
 
 
ec64ff9
ed742ed
ec64ff9
ed742ed
ec64ff9
ed742ed
ec64ff9
ed742ed
ec64ff9
ed742ed
 
 
 
 
ec64ff9
ed742ed
ec64ff9
ed742ed
ec64ff9
ed742ed
ec64ff9
ed742ed
ec64ff9
ed742ed
ec64ff9
 
 
ed742ed
ec64ff9
 
 
ed742ed
ec64ff9
ed742ed
ec64ff9
ed742ed
ec64ff9
ed742ed
 
ec64ff9
ed742ed
 
 
ec64ff9
ed742ed
 
 
 
 
 
 
ec64ff9
 
 
 
ed742ed
ec64ff9
 
ed742ed
ec64ff9
ed742ed
 
 
 
 
 
 
ec64ff9
ed742ed
ec64ff9
 
ed742ed
 
ec64ff9
 
ed742ed
ec64ff9
 
 
ed742ed
ec64ff9
ed742ed
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99

# Model Card for `SmolLM-360M-Instruct-finetuned-sft-v2`

This is a fine-tuned version of the SmolLM-360M model, optimized for instruction-following tasks. The model has been trained using the [HelpSteer2](https://huggingface.co./datasets/nvidia/HelpSteer2) dataset to generate accurate, contextually appropriate, and helpful responses. The fine-tuning was performed on an NVIDIA A100 GPU, enabling efficient training.

## Model Details

### Model Description

The `SmolLM-360M-Instruct-finetuned-sft-v2` model is a compact language model part of the SmolLM family, designed for computational efficiency and strong performance across various tasks. This specific version has been fine-tuned to excel at instruction-following scenarios, making it ideal for applications requiring clear and coherent responses based on detailed prompts.

- **Developed by:** Hugging Face and fine-tuned by Amir Mohseni  
- **Model type:** Language Model  
- **Language(s) (NLP):** English  
- **License:** Apache 2.0  
- **Finetuned from model:** SmolLM-360M  

### Model Sources

- **Repository:** [SmolLM-360M-Instruct-finetuned-sft-v2 on Hugging Face](https://huggingface.co./AmirMohseni/SmolLM-360M-Instruct-finetuned-sft-v2)

## Performance Improvements After Fine-Tuning

The fine-tuning process was evaluated using the NVIDIA Nemotron-4-340B-Reward model, which assesses AI-generated responses on five key attributes: helpfulness, correctness, coherence, complexity, and verbosity. Based on this reward model, the fine-tuning resulted in the following performance improvements:

- **Helpfulness:** Increased from **0.4343** to **0.6166**.
- **Correctness:** Increased from **0.5546** to **0.8130**.
- **Coherence:** Increased from **2.4018** to **2.5711**.
- **Complexity:** Decreased from **1.0023** to **0.9118**.
- **Verbosity:** Decreased from **1.4032** to **1.1779**.

These results indicate that the fine-tuning process improved the model's ability to generate more helpful, correct, and coherent responses. The reduction in complexity and verbosity means that the model's outputs are easier to understand and use fewer words to convey the same message, which is a positive improvement.

![Difference in Average Ratings Before and After Fine-tuning](https://cdn-uploads.huggingface.co/production/uploads/65e1bdb336a669a4ca5dab7d/IaLcCQpRmlTl5WcLskR-G.png)

## Uses

### Direct Use

The model can be directly used for generating coherent and contextually relevant responses to a wide range of prompts, particularly in scenarios where instruction-following is essential.

### Out-of-Scope Use

This model should not be used for tasks that require deep reasoning or extensive context beyond the given prompt. Additionally, it is not suitable for applications requiring highly specialized knowledge unless further fine-tuned on relevant data.

## Bias, Risks, and Limitations

As with all language models, this model may reflect biases present in its training data. Users should exercise caution when deploying the model in sensitive contexts and should consider further fine-tuning or bias mitigation strategies if needed.

## How to Get Started with the Model

Use the code below to get started with the model:

```python
from transformers import AutoModelForCausalLM, AutoTokenizer

model_name = "AmirMohseni/SmolLM-360M-Instruct-finetuned-sft-v2"
tokenizer = AutoTokenizer.from_pretrained(model_name)
model = AutoModelForCausalLM.from_pretrained(model_name)

# Example usage
prompt = "Explain the process of photosynthesis."
inputs = tokenizer(prompt, return_tensors="pt")
outputs = model.generate(**inputs)
response = tokenizer.decode(outputs[0], skip_special_tokens=True)
print(response)
```

## Training Details

### Training Data
The model was fine-tuned using the [HelpSteer2 dataset](https://huggingface.co./datasets/nvidia/HelpSteer2), which consists of approximately 21,400 examples of instruction-based prompts and corresponding responses. The dataset is designed to enhance AI models' ability to generate helpful, correct, and coherent outputs.

### Training Procedure
The fine-tuning was performed using the following hyperparameters:

- **Training regime:** Mixed precision (FP16)
- **Epochs:** 5
- **Learning Rate:** 1e-5
- **Batch Size:** 16 (per device for both training and evaluation)
- **Gradient Accumulation Steps:** 4
- **Weight Decay:** 0.02
- **Hardware:** NVIDIA A100 GPU

### Evaluation

#### Metrics
- **Training Loss:** Final loss was 4.3768.
- **Validation Loss:** Final loss was 4.1602.

### Results
The model demonstrated a consistent decrease in both training and validation losses over the epochs, indicating effective learning and good generalization.

## Environmental Impact

Carbon emissions for the training process were minimal due to the efficient use of the NVIDIA A100 GPU, which allowed for rapid fine-tuning within a few hours.

- **Hardware Type:** NVIDIA A100 GPU
- **Hours used:** 1 hour