Run this model with HF Jobs
Run BSC-LT/SwitchXL-Think-SmolLM3-3B on Hugging Face's managed compute, monitor its progress, and retrieve the results when it's done.
Paste one of these prompts into your coding agent:
Fine-tune on my dataset
Use HF Jobs and TRL to fine-tune https://huggingface.co/BSC-LT/SwitchXL-Think-SmolLM3-3B. Ask me which dataset to train on, then push the fine-tuned model to a new model repo. Run `hf jobs --help` first to learn the CLI.
Run batch inference
Use HF Jobs to run batch inference with https://huggingface.co/BSC-LT/SwitchXL-Think-SmolLM3-3B on the inputs in a mounted HF Bucket. Ask me which Bucket to use, then write the outputs back to it and keep each input ID. Run `hf jobs --help` first to learn the CLI.
Evaluate on a benchmark
Use HF Jobs to evaluate https://huggingface.co/BSC-LT/SwitchXL-Think-SmolLM3-3B. Ask me which benchmark to run, then save the scores and the per-example results to a new dataset repo. Run `hf jobs --help` first to learn the CLI.
Quantize for lower memory use
Use HF Jobs to create a 4-bit version of https://huggingface.co/BSC-LT/SwitchXL-Think-SmolLM3-3B. Push it to a new model repo, then reload it from there and report its memory footprint. Run `hf jobs --help` first to learn the CLI.
Instructions to use BSC-LT/SwitchXL-Think-SmolLM3-3B with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use BSC-LT/SwitchXL-Think-SmolLM3-3B with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="BSC-LT/SwitchXL-Think-SmolLM3-3B") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("BSC-LT/SwitchXL-Think-SmolLM3-3B") model = AutoModelForCausalLM.from_pretrained("BSC-LT/SwitchXL-Think-SmolLM3-3B", device_map="auto") messages = [ {"role": "user", "content": "Who are you?"}, ] inputs = tokenizer.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=256) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use BSC-LT/SwitchXL-Think-SmolLM3-3B with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "BSC-LT/SwitchXL-Think-SmolLM3-3B" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "BSC-LT/SwitchXL-Think-SmolLM3-3B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/BSC-LT/SwitchXL-Think-SmolLM3-3B
- SGLang
How to use BSC-LT/SwitchXL-Think-SmolLM3-3B with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "BSC-LT/SwitchXL-Think-SmolLM3-3B" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "BSC-LT/SwitchXL-Think-SmolLM3-3B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "BSC-LT/SwitchXL-Think-SmolLM3-3B" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "BSC-LT/SwitchXL-Think-SmolLM3-3B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use BSC-LT/SwitchXL-Think-SmolLM3-3B with Docker Model Runner:
docker model run hf.co/BSC-LT/SwitchXL-Think-SmolLM3-3B
SwitchXL-Think-SmolLM3-3B
🌐 This card is also available in Spanish: Versión en español (below). VIDEO DEMO
SwitchXL-Think-SmolLM3-3B is a fine-tuned version of SmolLM3-3B in which the language of the reasoning trace (chain of thought) is a controllable inference-time parameter.
- Prompt language and reasoning language can be selected independently over 5 languages: English, French, German, Italian, Spanish.
- The model answers in the language of the user prompt, while reasoning in the requested language.
- Control is implemented via a single mechanism: a language tag (e.g.
<spanish>) inserted at the start of the thinking block, selected through the newthink_langchat-template argument.
It was trained on the SwitchXL-Think dataset: approx. 4,000 unique prompts sampled from the parallel ReasonXL corpus, expanded into all 5x5 = 25 (prompt language x reasoning language) combinations (approx. 99K examples, 1% held out for validation).
⚠️ Disclaimer — proof of concept. This model is an SFT-only cold start: it was trained exclusively to instill the switchable-reasoning-language format, and its benchmark task performance is worse than the original SmolLM3-3B. It is released as a proof of concept demonstrating that the language of the reasoning trace can be switched at inference time, not as a production model. Following the standard SFT → RL framing, task performance is expected to be recoverable in a follow-up multilingual RLVR stage.
Usage
With transformers
Pass think_lang through chat_template_kwargs:
from transformers import AutoModelForCausalLM, AutoTokenizer
model_id = "BSC-LT/SwitchXL-Think-SmolLM3-3B"
tokenizer = AutoTokenizer.from_pretrained(model_id)
model = AutoModelForCausalLM.from_pretrained(model_id, torch_dtype="bfloat16", device_map="auto")
messages = [{"role": "user", "content": "Explain how attention mechanisms work."}]
# Reason in Spanish; the answer will follow the prompt language (English here)
prompt = tokenizer.apply_chat_template(
messages,
add_generation_prompt=True,
tokenize=True,
return_tensors="pt",
chat_template_kwargs={"think_lang": "<spanish>"},
).to(model.device)
output = model.generate(prompt, max_new_tokens=1024)
print(tokenizer.decode(output[0][prompt.shape[1]:]))
think_lang values
There are 5 + 1 possible values:
think_lang |
Behavior |
|---|---|
"<english>" |
Reasoning trace in English |
"<french>" |
Reasoning trace in French |
"<german>" |
Reasoning trace in German |
"<italian>" |
Reasoning trace in Italian |
"<spanish>" |
Reasoning trace in Spanish |
"" (empty string) |
Recovers the reasoning behavior of the base SmolLM3-3B model (English reasoning) |
The default is Spanish: if think_lang is not provided, the template behaves as if think_lang="<spanish>".
Serving with vLLM
Install vLLM (see the vLLM docs), then serve the model:
vllm serve BSC-LT/SwitchXL-Think-SmolLM3-3B
Request the reasoning language via chat_template_kwargs in the request body:
curl http://localhost:8000/v1/chat/completions \
-H "Content-Type: application/json" \
-d '{
"model": "BSC-LT/SwitchXL-Think-SmolLM3-3B",
"messages": [{"role": "user", "content": "¿Cuántos minutos hay en 3 horas y 45 minutos?"}],
"chat_template_kwargs": {"think_lang": "<spanish>"}
}'
Or with the OpenAI Python client (pass think_lang through extra_body):
from openai import OpenAI
client = OpenAI(base_url="http://localhost:8000/v1", api_key="EMPTY")
resp = client.chat.completions.create(
model="BSC-LT/SwitchXL-Think-SmolLM3-3B",
messages=[{"role": "user", "content": "¿Cuántos minutos hay en 3 horas y 45 minutos?"}],
extra_body={"chat_template_kwargs": {"think_lang": "<spanish>"}},
)
print(resp.choices[0].message.content)
# resp.choices[0].message.content contains the Spanish reasoning trace
# (the thinking block, ended by the closing think tag), then the final
# answer in the language of the prompt.
Use "think_lang": "" in chat_template_kwargs to recover the base model's reasoning behavior.
Training details
Full-parameter SFT in bfloat16 with NeMo-RL on BSC's MareNostrum 5 (4 nodes x 4 NVIDIA H100 64GB GPUs), replicating the ReasonXL SFT training: sequence packing (modified first-fit decreasing), max sequence length 16,384, global batch size 256, AdamW, 2 epochs, peak LR 8e-5 with 10% linear warmup and cosine decay to 8e-6, gradient clipping 1.0.
Limitations
- SFT-only cold start: benchmark task performance is expected to be lower than the base model; a multilingual RLVR stage is the planned follow-up.
- Language control only works for the 5 training languages.
- Automatic evaluation uses fastText language identification, which may misclassify short traces.
Acknowledgements
This work was carried out at the Barcelona Supercomputing Center-Centro Nacional de Supercomputación, a national and European reference center for supercomputing and AI research, on MareNostrum 5. Luis Vasquez-Reina acknowledges an AI for science fellowship within the "Generación D" initiative by Red.es, Ministerio para la Transformación Digital y de la Función Pública, for talent attraction (C005/24-ED CV1), funded by NextGenerationEU through PRTR.
Citation
If you use this model, please cite (citation in progress):
@misc{switchxlthink2026,
title = {SwitchXL-Think: ...},
author = {...},
year = {2026},
note = {Preprint in preparation}
}
Versión en español
SwitchXL-Think-SmolLM3-3B es una versión ajustada (fine-tuned) de SmolLM3-3B en la que el idioma del razonamiento (cadena de pensamiento) es un parámetro controlable en tiempo de inferencia.
- El idioma del prompt y el idioma del razonamiento se pueden seleccionar de forma independiente en 5 idiomas: inglés, francés, alemán, italiano y español.
- El modelo responde en el idioma del prompt del usuario, mientras razona en el idioma solicitado.
- El control se implementa mediante un único mecanismo: una etiqueta de idioma (p. ej.
<spanish>) insertada al inicio del bloque de razonamiento, seleccionada mediante el nuevo argumento de plantilla de chatthink_lang.
Se entrenó con el dataset SwitchXL-Think: aproximadamente 4.000 prompts únicos muestreados del corpus paralelo ReasonXL, expandidos a las 5x5 = 25 combinaciones (idioma del prompt × idioma del razonamiento) (aproximadamente 99K ejemplos, 1 % reservado para validación).
⚠️ Aviso: prueba de concepto. Este modelo es un cold start solo con SFT: se entrenó exclusivamente para instaurar el formato de razonamiento con idioma conmutable, y su rendimiento en benchmarks es peor que el del SmolLM3-3B original. Se publica como prueba de concepto que demuestra que el idioma del razonamiento se puede cambiar en tiempo de inferencia, no como modelo de producción. Según el esquema estándar SFT → RL, se espera que el rendimiento se recupere en una etapa posterior de RLVR multilingüe.
Uso
Con transformers
Pase think_lang a través de chat_template_kwargs:
from transformers import AutoModelForCausalLM, AutoTokenizer
model_id = "BSC-LT/SwitchXL-Think-SmolLM3-3B"
tokenizer = AutoTokenizer.from_pretrained(model_id)
model = AutoModelForCausalLM.from_pretrained(model_id, torch_dtype="bfloat16", device_map="auto")
messages = [{"role": "user", "content": "Explain how attention mechanisms work."}]
# Razonar en español; la respuesta seguirá el idioma del prompt (aquí, inglés)
prompt = tokenizer.apply_chat_template(
messages,
add_generation_prompt=True,
tokenize=True,
return_tensors="pt",
chat_template_kwargs={"think_lang": "<spanish>"},
).to(model.device)
output = model.generate(prompt, max_new_tokens=1024)
print(tokenizer.decode(output[0][prompt.shape[1]:]))
Valores de think_lang
Hay 5 + 1 valores posibles:
think_lang |
Comportamiento |
|---|---|
"<english>" |
Razonamiento en inglés |
"<french>" |
Razonamiento en francés |
"<german>" |
Razonamiento en alemán |
"<italian>" |
Razonamiento en italiano |
"<spanish>" |
Razonamiento en español |
"" (cadena vacía) |
Recupera el comportamiento de razonamiento del modelo base SmolLM3-3B (razonamiento en inglés) |
El valor por defecto es el español: si no se indica think_lang, la plantilla se comporta como si think_lang="<spanish>".
Servicio con vLLM
Instale vLLM (véase la documentación de vLLM) y sirva el modelo:
vllm serve BSC-LT/SwitchXL-Think-SmolLM3-3B
Solicite el idioma de razonamiento mediante chat_template_kwargs en el cuerpo de la petición:
curl http://localhost:8000/v1/chat/completions \
-H "Content-Type: application/json" \
-d '{
"model": "BSC-LT/SwitchXL-Think-SmolLM3-3B",
"messages": [{"role": "user", "content": "¿Cuántos minutos hay en 3 horas y 45 minutos?"}],
"chat_template_kwargs": {"think_lang": "<spanish>"}
}'
O con el cliente Python de OpenAI (pasando think_lang a través de extra_body):
from openai import OpenAI
client = OpenAI(base_url="http://localhost:8000/v1", api_key="EMPTY")
resp = client.chat.completions.create(
model="BSC-LT/SwitchXL-Think-SmolLM3-3B",
messages=[{"role": "user", "content": "¿Cuántos minutos hay en 3 horas y 45 minutos?"}],
extra_body={"chat_template_kwargs": {"think_lang": "<spanish>"}},
)
print(resp.choices[0].message.content)
# resp.choices[0].message.content contiene el razonamiento en español
# (el bloque de razonamiento, terminado por la etiqueta de cierre de think),
# y después la respuesta final en el idioma del prompt.
Use "think_lang": "" en chat_template_kwargs para recuperar el comportamiento de razonamiento del modelo base.
Detalles del entrenamiento
SFT a parámetro completo en bfloat16 con NeMo-RL en MareNostrum 5 del BSC (4 nodos × 4 GPU NVIDIA H100 de 64 GB), replicando el entrenamiento de SFT de ReasonXL: sequence packing, max sequence length 16,384, global batch size 256, AdamW, 2 epochs, LR pico de 8e-5 con 10% linear warmup y cosine decay hasta 8e-6, gradient clipping 1.0.
Limitaciones
- Cold start solo con SFT: se espera que el rendimiento en benchmarks sea inferior al del modelo base; una etapa de RLVR multilingüe es el siguiente paso previsto.
- El control del idioma solo funciona para los 5 idiomas de entrenamiento.
- La evaluación automática usa identificación de idiomas con fastText, que puede clasificar mal trazas cortas.
Agradecimientos
Este trabajo se llevó a cabo en el Barcelona Supercomputing Center-Centro Nacional de Supercomputación, centro de referencia nacional y europeo de supercomputación e investigación en IA, en MareNostrum 5. Luis Vasquez-Reina agradece una beca AI for science dentro de la iniciativa «Generación D» de Red.es, Ministerio para la Transformación Digital y de la Función Pública, para la atracción de talento (C005/24-ED CV1), financiada por NextGenerationEU a través del PRTR.
Cita
Si usa este modelo, por favor cite (cita en preparación):
@misc{switchxlthink2026,
title = {SwitchXL-Think: ...},
author = {...},
year = {2026},
note = {Preprint in preparation}
}
- Downloads last month
- 201