MCPcopy Create free account
hub / github.com/huggingface/smollm

github.com/huggingface/smollm @main

Chat with this repo
repository ↗ · DeepWiki ↗ · + Follow
2,724 symbols 9,657 edges 429 files 365 documented · 13% 29 cross-repo links updated 2mo ago★ 3,87652 open issues

Browse by type

Functions 1,907 Types & classes 810 Endpoints 7
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

Smol Models 🤏

Welcome to Smol Models, a family of efficient and lightweight AI models from Hugging Face. Our mission is to create fully open powerful yet compact models, for text and vision, that can run effectively on-device while maintaining strong performance.

[NEW] SmolLM3 (Language Model)

image

Our 3B model outperforms Llama 3.2 3B and Qwen2.5 3B while staying competitive with larger 4B alternatives (Qwen3 & Gemma3). Beyond the performance numbers, we're sharing exactly how we built it using public datasets and training frameworks.

Ressources: - SmolLM3-Base - SmolLM3 - blog

Summary: - 3B model trained on 11T tokens, SoTA at the 3B scale and competitive with 4B models - Fully open model, open weights + full training details including public data mixture and training configs - Instruct model with dual mode reasoning, supporting think/no_think modes - Multilingual support for 6 languages: English, French, Spanish, German, Italian, and Portuguese - Long context up to 128k with NoPE and using YaRN

image

👁️ SmolVLM (Vision Language Model)

SmolVLM is our compact multimodal model that can: - Process both images and text and perform tasks like visual QA, image description, and visual storytelling - Handle multiple images in a single conversation - Run efficiently on-device

Repository Structure

smollm/
├── text/               # SmolLM3/2/1 related code and resources
├── vision/            # SmolVLM related code and resources
└── tools/             # Shared utilities and inference tools
    ├── smol_tools/    # Lightweight AI-powered tools
    ├── smollm_local_inference/
    └── smolvlm_local_inference/

Getting Started

SmolLM3

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))

SmolVLM

from transformers import AutoProcessor, AutoModelForVision2Seq

processor = AutoProcessor.from_pretrained("HuggingFaceTB/SmolVLM-Instruct")
model = AutoModelForVision2Seq.from_pretrained("HuggingFaceTB/SmolVLM-Instruct")

messages = [
    {
        "role": "user",
        "content": [
            {"type": "image"},
            {"type": "text", "text": "What's in this image?"}
        ]
    }
]

Ecosystem

Resources

Documentation

Pretrained Models

Datasets

Core symbols most depended-on inside this repo

browse all functions →

Shape

Method 1,070
Function 837
Class 810
Route 7

Languages

Python100%

Modules by API surface

vision/m4/models/vllama3/evaluation_classification_in_context_vllama3.py100 symbols
vision/m4/models/vmistral/evaluation_classification_in_context_vmistral.py94 symbols
vision/m4/models/idefics/evaluation_classification_in_context_idefics.py82 symbols
vision/data/datasets_processing_scripts/build_concatenation_datasets_sft/build_ds_sft.py80 symbols
vision/m4/training/dataset.py77 symbols
vision/m4/testing_utils.py73 symbols
vision/m4/models/vllama3/modeling_vllama3.py69 symbols
vision/m4/models/vmistral/modeling_vmistral.py58 symbols
vision/m4/models/vgpt2/evaluation_classification_in_context_vgpt2.py56 symbols
vision/m4/models/idefics/modeling_idefics.py53 symbols
vision/m4/training/utils.py50 symbols
vision/m4/models/vgpt2/modeling_vgpt2.py48 symbols

Dependencies from manifests, versioned

accelerate0.33.0 · 1×
bitsandbytes0.37.0 · 1×
chardet
click8.2.1 · 1×
datasets2.0.0 · 1×
deepspeed0.13.5 · 1×
einops0.8.1 · 1×
fsspec2025.3.0 · 1×
grpcio1.73.0 · 1×
huggingface-hub0.33.0 · 1×
jieba0.42.1 · 1×

For agents

$ claude mcp add smollm \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact

Ask about this repo answers extend the page