BUILD A LOCAL CHATBOT · MODULE 3 — CHOOSING A MODEL ON PURPOSE · bc-07 Real Python, every page

Module 3.7

A model isn't one thing

"SmolLM2-135M-Instruct" was one specific choice out of a whole family of small models that fit on this same laptop. Click a row — every number below was queried live from that model's own config, not guessed.

ModelKindParams (real)Disk (real)Context

The script

Querying every config, live

bc-07-model-comparison.py
from transformers import AutoConfig

MODELS = [
    "distilbert/distilgpt2", "openai-community/gpt2",
    "HuggingFaceTB/SmolLM2-135M-Instruct", "HuggingFaceTB/SmolLM2-360M-Instruct",
    "Qwen/Qwen2.5-0.5B-Instruct", "TinyLlama/TinyLlama-1.1B-Chat-v1.0",
    "microsoft/Phi-3-mini-4k-instruct",
]

for model_id in MODELS:
    cfg = AutoConfig.from_pretrained(model_id)   # fetches config.json only — a few KB, no weights
    print(model_id, cfg.num_hidden_layers, cfg.hidden_size, cfg.max_position_embeddings)

AutoConfig.from_pretrained downloads only the architecture description, not the ~270MB–7.6GB of actual weights — cheap enough to run this comparison for real before committing disk space to any of them. Download bc-07-model-comparison.py ⬇

Try this

Add "microsoft/phi-2" to the MODELS list in bc-07-model-comparison.py ⬇ and re-run. It costs nothing but a few seconds and a network request to check whether a model would even fit your plans — that's the entire point of this page.

So what

"Which model should I use" has a real, queryable answer — before you spend the disk space to find out.