Hugging Face/Dense

SmolLM3 3B

chatcodingreasoningmultilingualThinkingTool Use
3B
Parameters
125K
Context length
7
Benchmarks
4
Quantizations
100K
HF downloads
Architecture
Dense
Released
2025-07-01
Layers
36
KV Heads
4
Head Dim
128
Family
smollm

SmolLM3

Table of Contents

  1. Model Summary
  2. How to use
  3. Evaluation
  4. Training
  5. Limitations
  6. License

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

How to use

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(
    model_name,
).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))

[!TIP] 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.

prompt = "Give me a brief explanation of gravity in simple terms."
messages = [
    {"role": "system", "content": "/no_think"},
    {"role": "user", "content": prompt}
]

text = tokenizer.apply_chat_template(
    messages,
    tokenize=False,
    add_generation_prompt=True,
)

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.

prompt = "Give me a brief explanation of gravity in simple terms."
messages = [
    {"role": "user", "content": prompt}
]

text = tokenizer.apply_chat_template(
    messages,
    tokenize=False,
    add_generation_prompt=True,
    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>
from transformers import AutoModelForCausalLM, AutoTokenizer

checkpoint = "HuggingFaceTB/SmolLM3-3B"

tokenizer = AutoTokenizer.from_pretrained(checkpoint)
model = AutoModelForCausalLM.from_pretrained(checkpoint)

tools = [
    {
        "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"}}}}
]

messages = [
    {
        "role": "user",
        "content": "Hello! How is the weather today in Copenhagen?"
    }
]

inputs = tokenizer.apply_chat_template(
    messages,
    enable_thinking=False, # True works as well, your choice!
    xml_tools=tools,
    add_generation_prompt=True,
    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.

prompt = "Give me a brief explanation of gravity in simple terms."
messages = [
    {"role": "system", "content": "Speak like a pirate./think"},
    {"role": "user", "content": prompt}
]

text = tokenizer.apply_chat_template(
    messages,
    tokenize=False,
    add_generation_prompt=True,
)

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.

SGLang

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

vLLM

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}
}'

Evaluation

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

...

Quantizations & VRAM

Q4_K_M4.5 bpw
2.2 GB
VRAM required
94%
Quality
Q6_K6.5 bpw
2.9 GB
VRAM required
97%
Quality
Q8_08 bpw
3.5 GB
VRAM required
100%
Quality
FP1616 bpw
6.5 GB
VRAM required
100%
Quality

Benchmarks (7)

IFEval76.7
MATH46.1
GPQA35.7
HumanEval30.5
BBH10.9
MMLU-PRO10.7
MUSR2.8

GPUs that can run this model

At Q4_K_M quantization. Sorted by minimum VRAM.

Find the best GPU for SmolLM3 3B

Build Hardware for SmolLM3 3B