Views
No views yet

[!WARNING]DISCLAIMER
This repository is a repack ofHuggingFaceTB/SmolLM2-360M-Instruct.No model weights were modified. No additional fine-tuning was performed.
The only change is an updatedchat_templateintokenizer_config.json.The new chat template:
- injects a system prompt if none is provided,
- documents available external tools,
- defines a function-calling protocol using
<tool_call>and<tool_response>blocks.Because the weights are unchanged, behavior, capabilities, and safety limitations are inherited directly from the originalSmolLM2-360M-Instructcheckpoint. The model has not been trained or aligned to actually follow the new tool-calling protocol. It may produce malformed tool calls or incorrect tool usage without further fine-tuning.
pip install transformers1from transformers import AutoModelForCausalLM, AutoTokenizer
2checkpoint = "HuggingFaceTB/SmolLM2-360M-Instruct"
3
4device = "cuda" # for GPU usage or "cpu" for CPU usage
5tokenizer = AutoTokenizer.from_pretrained(checkpoint)
6# for multiple GPUs install accelerate and do `model = AutoModelForCausalLM.from_pretrained(checkpoint, device_map="auto")`
7model = AutoModelForCausalLM.from_pretrained(checkpoint).to(device)
8
9messages = [{"role": "user", "content": "What is the capital of France."}]
10input_text=tokenizer.apply_chat_template(messages, tokenize=False)
11print(input_text)
12inputs = tokenizer.encode(input_text, return_tensors="pt").to(device)
13outputs = model.generate(inputs, max_new_tokens=50, temperature=0.2, top_p=0.9, do_sample=True)
14print(tokenizer.decode(outputs[0]))1pip install trl
2trl chat --model_name_or_path HuggingFaceTB/SmolLM2-360M-Instruct --device cpunpm i @huggingface/transformers1import { pipeline } from "@huggingface/transformers";
2
3// Create a text generation pipeline
4const generator = await pipeline(
5 "text-generation",
6 "HuggingFaceTB/SmolLM2-135M-Instruct",
7);
8
9// Define the list of messages
10const messages = [
11 { role: "system", content: "You are a helpful assistant." },
12 { role: "user", content: "What is the capital of France?" },
13];
14
15// Generate a response
16const output = await generator(messages, { max_new_tokens: 128 });
17console.log(output[0].generated_text.at(-1).content);
18// "The capital of France is Paris."| Metrics | SmolLM2-360M | Qwen2.5-0.5B | SmolLM-360M |
|---|---|---|---|
| HellaSwag | 54.5 | 51.2 | 51.8 |
| ARC (Average) | 53.0 | 45.4 | 50.1 |
| PIQA | 71.7 | 69.9 | 71.6 |
| MMLU (cloze) | 35.8 | 33.7 | 34.4 |
| CommonsenseQA | 38.0 | 31.6 | 35.3 |
| TriviaQA | 16.9 | 4.3 | 9.1 |
| Winogrande | 52.5 | 54.1 | 52.8 |
| OpenBookQA | 37.4 | 37.4 | 37.2 |
| GSM8K (5-shot) | 3.2 | 33.4 | 1.6 |
| Metric | SmolLM2-360M-Instruct | Qwen2.5-0.5B-Instruct | SmolLM-360M-Instruct |
|---|---|---|---|
| IFEval (Average prompt/inst) | 41.0 | 31.6 | 19.8 |
| MT-Bench | 3.66 | 4.16 | 3.37 |
| HellaSwag | 52.1 | 48.0 | 47.9 |
| ARC (Average) | 43.7 | 37.3 | 38.8 |
| PIQA | 70.8 | 67.2 | 69.4 |
| MMLU (cloze) | 32.8 | 31.7 | 30.6 |
| BBH (3-shot) | 27.3 | 30.7 | 24.4 |
| GSM8K (5-shot) | 7.43 | 26.8 | 1.36 |
1@misc{allal2025smollm2smolgoesbig,
2 title={SmolLM2: When Smol Goes Big -- Data-Centric Training of a Small Language Model},
3 author={Loubna Ben Allal and Anton Lozhkov and Elie Bakouch and Gabriel Martín Blázquez and Guilherme Penedo and Lewis Tunstall and Andrés Marafioti and Hynek Kydlíček and Agustín Piqueres Lajarín and Vaibhav Srivastav and Joshua Lochner and Caleb Fahlgren and Xuan-Son Nguyen and Clémentine Fourrier and Ben Burtenshaw and Hugo Larcher and Haojun Zhao and Cyril Zakka and Mathieu Morlon and Colin Raffel and Leandro von Werra and Thomas Wolf},
4 year={2025},
5 eprint={2502.02737},
6 archivePrefix={arXiv},
7 primaryClass={cs.CL},
8 url={https://arxiv.org/abs/2502.02737},
9}