Michielo commited on
Commit
1d24a42
·
verified ·
1 Parent(s): 33b2499

Create README.md

Browse files
Files changed (1) hide show
  1. README.md +120 -0
README.md ADDED
@@ -0,0 +1,120 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: apache-2.0
3
+ datasets:
4
+ - HumanLLMs/Human-Like-DPO-Dataset
5
+ language:
6
+ - en
7
+ base_model:
8
+ - HuggingFaceTB/SmolLM2-1.7B-Instruct
9
+ pipeline_tag: text-generation
10
+ library_name: transformers
11
+ tags:
12
+ - safetensors
13
+ - humanized
14
+ - smollm
15
+ ---
16
+
17
+
18
+ # SmolLM2-1.7B-Humanized
19
+
20
+ ## Table of Contents
21
+
22
+ 1. [Model Summary](##model-summary)
23
+ 2. [Limitations](##limitations)
24
+ 3. [Training](##training)
25
+ 4. [License](##license)
26
+ 5. [Citation](##citation)
27
+
28
+ ## Model Summary
29
+
30
+ **SmolLM2-1.7B-Humanized** is a fine-tuned version of the [SmolLM2-1.7B-Instruct](https://huggingface.co/HuggingFaceTB/SmolLM2-1.7B-Instruct) model, optimized using the Direct Preference Optimization (DPO) method. To do this we used the "[Human-Like-DPO-Dataset](https://huggingface.co/datasets/HumanLLMs/Human-Like-DPO-Dataset)" from [Human-Like LLMs](https://huggingface.co/HumanLLMs).
31
+
32
+ Unlike traditional fine-tuning datasets that aim to improve specific benchmarks or metrics, the Human-Like-DPO-Dataset focuses on aligning the model's behavior with human preferences. This process enhances the model's ability to generate more natural, human-like responses, making it particularly well-suited for conversational applications.
33
+
34
+ By emphasizing response quality and relatability, SmolLM2-1.7B-Humanized is designed to deliver an engaging and intuitive user experience in dialogue-based scenarios.
35
+
36
+
37
+ ### How to use
38
+
39
+ ### Transformers
40
+ ```bash
41
+ pip install transformers
42
+ ```
43
+
44
+ ```python
45
+ from transformers import AutoModelForCausalLM, AutoTokenizer
46
+ checkpoint = "AssistantsLab/SmolLM2-1.7B-humanized"
47
+
48
+ device = "cuda" # for GPU usage or "cpu" for CPU usage
49
+ tokenizer = AutoTokenizer.from_pretrained(checkpoint)
50
+ # for multiple GPUs install accelerate and do `model = AutoModelForCausalLM.from_pretrained(checkpoint, device_map="auto")`
51
+ model = AutoModelForCausalLM.from_pretrained(checkpoint).to(device)
52
+
53
+ messages = [{"role": "user", "content": "What is gravity?"}]
54
+ input_text=tokenizer.apply_chat_template(messages, tokenize=False)
55
+ print(input_text)
56
+ inputs = tokenizer.encode(input_text, return_tensors="pt").to(device)
57
+ outputs = model.generate(inputs, max_new_tokens=50, temperature=0.2, top_p=0.9, do_sample=True)
58
+ print(tokenizer.decode(outputs[0]))
59
+ ```
60
+
61
+ ### Chat in TRL
62
+ You can also use the TRL CLI to chat with the model from the terminal:
63
+ ```bash
64
+ pip install trl
65
+ trl chat --model_name_or_path AssistantsLab/SmolLM2-1.7B-humanized --device cpu
66
+ ```
67
+
68
+ ## Evaluation
69
+
70
+ In this section, we report the evaluation results of SmolLM2. All evaluations are zero-shot unless stated otherwise, and we use [lighteval](https://github.com/huggingface/lighteval) to run them.
71
+
72
+ ## Instruction model Vs. Humanized model
73
+
74
+ | Metric | SmolLM2-1.7B-Instruct | SmolLM2-1.7B-Humanized | Difference |
75
+ |:-----------------------------|:---------------------:|:----------------------:|:----------:|
76
+ | MMLU | **49.5** | 46.2 | -3.3 |
77
+ | ARC (Easy) | **68.9** | 63.6 | -5.3 |
78
+ | ARC (Challenge) | **38.5** | 36.5 | -2.0 |
79
+ | HellaSwag | **71.7** | 71.2 | -0.5 |
80
+ | PIQA | **76.2** | 75.6 | -0.6 |
81
+ | WinoGrande | **62.5** | 61.0 | -1.5 |
82
+ | TriviaQA | **10.2** | 2.0 | -8.2 |
83
+ | GSM8K | **0.0** | **0.0** | +0.0 |
84
+ | OpenBookQA | **45.6** | 41.0 | -4.6 |
85
+ | QuAC (F1) | **30.2** | 26.6 | -3.6 |
86
+
87
+
88
+ ## Limitations
89
+
90
+ SmolLM2 models primarily understand and generate content in English. They can produce text on a variety of topics, but the generated content may not always be factually accurate, logically consistent, or free from biases present in the training data. These models should be used as assistive tools rather than definitive sources of information. Users should always verify important information and critically evaluate any generated content.
91
+
92
+ Humanized models display a bigger preference for confident hallucinating in some limited testing. Please keep this in mind in any potential applications.
93
+
94
+ ## License
95
+
96
+ [Apache 2.0](https://www.apache.org/licenses/LICENSE-2.0)
97
+
98
+ ## Citation
99
+
100
+ SmolLM2:
101
+ ```bash
102
+ @misc{allal2024SmolLM2,
103
+ title={SmolLM2 - with great data, comes great performance},
104
+ author={Loubna Ben Allal and Anton Lozhkov and Elie Bakouch and Gabriel Martín Blázquez and Lewis Tunstall and Agustín Piqueres and Andres Marafioti and Cyril Zakka and Leandro von Werra and Thomas Wolf},
105
+ year={2024},
106
+ }
107
+ ```
108
+
109
+ Human-Like-DPO-Dataset:
110
+ ```bash
111
+ @misc{çalık2025enhancinghumanlikeresponseslarge,
112
+ title={Enhancing Human-Like Responses in Large Language Models},
113
+ author={Ethem Yağız Çalık and Talha Rüzgar Akkuş},
114
+ year={2025},
115
+ eprint={2501.05032},
116
+ archivePrefix={arXiv},
117
+ primaryClass={cs.CL},
118
+ url={https://arxiv.org/abs/2501.05032},
119
+ }
120
+ ```