|
--- |
|
license: apache-2.0 |
|
datasets: |
|
- HumanLLMs/Human-Like-DPO-Dataset |
|
language: |
|
- en |
|
base_model: |
|
- HuggingFaceTB/SmolLM2-135M-Instruct |
|
pipeline_tag: text-generation |
|
library_name: transformers |
|
tags: |
|
- safetensors |
|
- humanized |
|
- smollm |
|
--- |
|
|
|
|
|
# SmolLM2-135M-Humanized |
|
|
|
## Table of Contents |
|
|
|
1. [Model Summary](##model-summary) |
|
2. [Limitations](##limitations) |
|
3. [Training](##training) |
|
4. [License](##license) |
|
5. [Citation](##citation) |
|
|
|
## Model Summary |
|
|
|
**SmolLM2-135M-Humanized** is a fine-tuned version of the [SmolLM2-135M-Instruct](https://huggingface.co/HuggingFaceTB/SmolLM2-135M-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). To not lose too much quality with this post-training, we also applied some extra training on the "[openbmb/UltraFeedback](https://huggingface.co/datasets/openbmb/UltraFeedback)" dataset. |
|
|
|
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. |
|
|
|
By emphasizing response quality and relatability, SmolLM2-135M-Humanized is designed to deliver an engaging and intuitive user experience in dialogue-based scenarios. |
|
|
|
|
|
### How to use |
|
|
|
### Transformers |
|
```bash |
|
pip install transformers |
|
``` |
|
|
|
```python |
|
from transformers import AutoModelForCausalLM, AutoTokenizer |
|
checkpoint = "AssistantsLab/SmolLM2-135M-humanized" |
|
|
|
device = "cuda" # for GPU usage or "cpu" for CPU usage |
|
tokenizer = AutoTokenizer.from_pretrained(checkpoint) |
|
# for multiple GPUs install accelerate and do `model = AutoModelForCausalLM.from_pretrained(checkpoint, device_map="auto")` |
|
model = AutoModelForCausalLM.from_pretrained(checkpoint).to(device) |
|
|
|
messages = [{"role": "user", "content": "What is gravity?"}] |
|
input_text=tokenizer.apply_chat_template(messages, tokenize=False) |
|
print(input_text) |
|
inputs = tokenizer.encode(input_text, return_tensors="pt").to(device) |
|
outputs = model.generate(inputs, max_new_tokens=50, temperature=0.2, top_p=0.9, do_sample=True) |
|
print(tokenizer.decode(outputs[0])) |
|
``` |
|
|
|
### Chat in TRL |
|
You can also use the TRL CLI to chat with the model from the terminal: |
|
```bash |
|
pip install trl |
|
trl chat --model_name_or_path AssistantsLab/SmolLM2-135M-humanized --device cpu |
|
``` |
|
|
|
## Evaluation |
|
|
|
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. |
|
|
|
## Instruction model Vs. Humanized model |
|
|
|
| Metric | SmolLM2-135M-Instruct | SmolLM2-135M-Humanized | Difference | |
|
|:-----------------------------|:---------------------:|:----------------------:|:----------:| |
|
| MMLU | **23.1** | 23.0 | -0.1 | |
|
| ARC (Easy) | 54.3 | **55.0** | +0.7 | |
|
| ARC (Challenge) | **26.1** | 25.5 | -0.6 | |
|
| HellaSwag | **43.0** | 42.4 | -0.6 | |
|
| PIQA | **67.2** | 67.0 | -0.2 | |
|
| WinoGrande | **52.5** | 52.1 | -0.4 | |
|
| TriviaQA | **0.3** | 0.2 | -0.1 | |
|
| GSM8K | 0.2 | **0.8** | +0.6 | |
|
| OpenBookQA | 32.6 | **33.0** | +0.4 | |
|
| QuAC (F1) | **14.1** | 13.2 | -0.9 | |
|
|
|
|
|
|
|
## Limitations |
|
|
|
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. |
|
|
|
Humanized models display a bigger preference for confident hallucinating in some limited testing. Please keep this in mind in any potential applications. |
|
|
|
## License |
|
|
|
[Apache 2.0](https://www.apache.org/licenses/LICENSE-2.0) |
|
|
|
## Citation |
|
|
|
SmolLM2: |
|
```bash |
|
@misc{allal2024SmolLM2, |
|
title={SmolLM2 - with great data, comes great performance}, |
|
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}, |
|
year={2024}, |
|
} |
|
``` |
|
|
|
Human-Like-DPO-Dataset: |
|
```bash |
|
@misc{çalık2025enhancinghumanlikeresponseslarge, |
|
title={Enhancing Human-Like Responses in Large Language Models}, |
|
author={Ethem Yağız Çalık and Talha Rüzgar Akkuş}, |
|
year={2025}, |
|
eprint={2501.05032}, |
|
archivePrefix={arXiv}, |
|
primaryClass={cs.CL}, |
|
url={https://arxiv.org/abs/2501.05032}, |
|
} |
|
``` |
|
|
|
UltraFeedback dataset: |
|
```bash |
|
@misc{cui2023ultrafeedback, |
|
title={UltraFeedback: Boosting Language Models with High-quality Feedback}, |
|
author={Ganqu Cui and Lifan Yuan and Ning Ding and Guanming Yao and Wei Zhu and Yuan Ni and Guotong Xie and Zhiyuan Liu and Maosong Sun}, |
|
year={2023}, |
|
eprint={2310.01377}, |
|
archivePrefix={arXiv}, |
|
primaryClass={cs.CL} |
|
} |
|
``` |