Archive of AI

Source Snapshot / 2025-07-08-huggingface-smollm3-3

SmolLM3 官方模型卡

Linked event: 2025-07-08 · Hugging Face Open-Sources 3B Dual-Mode Edge Model SmolLM3

Publisher
Hugging Face
Archived
2026-11-23
Capture Method
Direct page capture
HTTP / SHA-256
200 / dde0c306b1dd5efd
Original URL
Open source ↗
Wayback Backup
Not archived
This page preserves a plain-text static snapshot against link rot. When citing figures, tables, or full legal terms, verify against the original URL and Wayback Machine archive.

[来源关键摘录] 模型卡明确说明训练上下文为 64k,最高 128k 来自 YaRN 外推,并确认 Apache 2.0 许可。

[正文前段节选] Hugging Face

Search models, datasets, users... ⌘K

HuggingFaceTB

Hugging Face Smol Models Research 4.34k

Text Generation

Transformers

conversational

Eval Results

License: apache-2.0

Model card Files Files and versions

Copy to bucket

Use this model

Table of Contents

Model Summary

SmolLM3 is a 3B parameter language model designed to push the boundaries of small models. It supports dual mode reasoning, 6 languages and long context. SmolLM3 is a fully open model that offers strong performance at the 3B–4B scale.

The model is a decoder-only transformer using GQA and NoPE (with 3:1 ratio), it was pretrained on 11.2T tokens with a staged curriculum of web, code, math and reasoning data. Post-training included midtraining on 140B reasoning tokens followed by supervised fine-tuning and alignment via Anchored Preference Optimization (APO).

Key features

Instruct model optimized for hybrid reasoning

Fully open model: open weights + full training details including public data mixture and training configs

Long context: Trained on 64k context and supports up to 128k tokens using YARN extrapolation

Multilingual: 6 natively supported (English, French, Spanish, German, Italian, and Portuguese)

For more details refer to our blog post: https://hf.co/blog/smollm3

The modeling code for SmolLM3 is available in transformers v4.53.0, so make sure to upgrade your transformers version. You can also load the model with the latest vllm which uses transformers as a backend.

pip install -U transformers

from transformers import AutoModelForCausalLM, AutoTokenizer

model_name = "HuggingFaceTB/SmolLM3-3B"

device = "cuda" # for GPU usage or "cpu" for CPU usage

# load the tokenizer and the model

tokenizer = AutoTokenizer.from_pretrained(model_name)

model = AutoModelForCausalLM.from_pretrained(

).to(device)

# prepare the model input

prompt = "Give me a brief explanation of gravity in simple terms."

messages_think = [

{"role": "user", "content": prompt}

text = tokenizer.apply_chat_template(

messages_think,

tokenize=False,

add_generation_prompt=True,

model_inputs = tokenizer([text], return_tensors="pt").to(model.device)

# Generate the output

generated_ids = model.generate(**model_inputs, max_new_tokens=32768)

# Get and decode the output

output_ids = generated_ids[0][len(model_inputs.input_ids[0]) :]

print(tokenizer.decode(output_ids, skip_special_tokens=True))

We recommend setting temperature=0.6 and top_p=0.95 in the sampling parameters.

Long context processing

The current config.json is set for context length up to 65,536 tokens. To handle longer inputs (128k or 256k), we utilize YaRN you can change the max_position_embeddings and rope_scaling` to:

"rope_scaling": {

"factor": 2.0, #2x65536=131 072

"original_max_position_embeddings": 65536,

"type": "yarn"

Enabling and Disabling Extended Thinking Mode

We enable extended thinking by default, so the example above generates the output with a reasoning trace. For choosing between enabling, you can provide the /think and /no_think flags through the system prompt as shown in the snippet below for extended thinking disabled. The code for generating the response with extended thinking would be the same except that the system prompt should have /think instead of /no_think.

messages = [

{"role": "system", "content": "/no_think"},

We also provide the option of specifying the whether to use extended thinking through the enable_thinking kwarg as in the example below. You do not need to set the /no_think or /think flags through the system prompt if using the kwarg, but keep in mind that the flag in the system prompt overwrites the setting in the kwarg.

enable_thinking=False

Agentic Usage

SmolLM3 supports tool calling!

Just pass your list of tools:

Under the argument xml_tools for standard tool-calling: these tools will be called as JSON blobs within XML tags, like <tool_call>{"name": "get_weather", "arguments": {"city": "Copenhagen"}}</tool_call>

Or under python_tools: then the model will call tools like python functions in a <code> snippet, like <code>get_weather(city="Copenhagen")</code>

checkpoint = "HuggingFaceTB/SmolLM3-3B"

tokenizer = AutoTokenizer.from_pretrained(checkpoint)

model = AutoModelForCausalLM.from_pretrained(checkpoint)

"name": "get_weather",

"description": "Get the weather in a city",

"parameters": {"type": "object", "properties": {"city": {"type": "string", "description": "The city to get the weather for"}}}}

"role": "user",

"content": "Hello! How is the weather today in Copenhagen?"

inputs = tokenizer.apply_chat_template(

enable_thinking=False, # True works as well, your choice!

xml_tools=tools,

tokenize=True,

return_tensors="pt"

outputs = model.generate(inputs)

print(tokenizer.decode(outputs[0]))

Using Custom System Instructions.

You can specify custom instruction through the system prompt while controlling whether to use extended thinking. For example, the snippet below shows how to make the model speak like a pirate while enabling extended thinking.

{"role": "system", "content": "Speak like a pirate./think"},

For local inference, you can use llama.cpp, ONNX, MLX, MLC and ExecuTorch. You can find quantized checkpoints in this collection (https://huggingface.co/collections/HuggingFaceTB/smollm3-686d33c1fdffe8e635317e23)

vLLM and SGLang

You can use vLLM and SGLang to deploy the model in an API compatible with OpenAI format.

python -m sglang.launch_server --model-path HuggingFaceTB/SmolLM3-3B

vllm serve HuggingFaceTB/SmolLM3-3B --enable-auto-tool-choice --tool-call-parser=hermes

Setting chat_template_kwargs

You can specify chat_template_kwargs such as enable_thinking to a deployed model by passing the chat_template_kwargs parameter in the API request.

curl http://localhost:8000/v1/chat/completions -H "Content-Type: application/json" -d '{

"model": "HuggingFaceTB/SmolLM3-3B",

"messages": [

{"role": "user", "content": "Give me a brief explanation of gravity in simple terms."}

"temperature": 0.6,

"top_p": 0.95,

"max_tokens": 16384,

"chat_template_kwargs": {"enable_thinking": false}

In this section, we report the evaluation results of SmolLM3 model. All evaluations are zero-shot unless stated otherwise, and we use lighteval to run them.

We highlight the best score in bold and underline the second-best score.

Instruction Model

No Extended Thinking

Evaluation results of non reasoning models and reasoning models in no thinking mode. We highlight the best and second-best scores in bold.

High school math competition

Math problem-solving

Competitive programming

LiveCodeBench v4

Graduate-level reasoning

GPQA Diamond

Instruction following

MixEval Hard

Tool Calling

Multilingual Q&A

(*): this is a tool calling finetune

Extended Thinking

Evaluation results in reasoning mode for SmolLM3 and Qwen3 models:

Base Pre-Trained Model

English benchmarks

Note: All evaluations are zero-shot unless stated otherwise. For Ruler 64k evaluation, we apply YaRN to the Qwen models with 32k context to extrapolate the context length.

Qwen3-1.7B-Base

Qwen3-4B-Base

Reasoning & Commonsense

ARC-CF (Average)

CommonsenseQA

Knowledge & Understanding

MMLU-CF (Average)

MMLU Pro MCF

Coding & math

MATH (4-shot)

GSM8k (5-shot)

Long context

Multilingual benchmarks

SmolLM3 3B Base

Qwen3 1.7B Base

Qwen3 4B Base

Main supported languages

MLMM Hellaswag

Global MMLU (CF)

Flores-200 (5-shot)

The model has also been trained on Arabic (standard), Chinese and Russian data, but has seen fewer tokens in these languages compared to the 6 above. We report the performance on these langages for information.

Other supported languages

Architecture: Transformer decoder

Pretraining tokens: 11T

Precision: bfloat16

Software & hardware

GPUs: 384 H100

Training Framework: nanotron

Data processing framework: datatrove

Evaluation framework: lighteval

Post-training Framework: TRL

Open resources

Here is an infographic with all the training details

[...内容已截断,完整版请查看原文或 Wayback 快照]