Training summary
Table with columns: Setting, Value| Setting | Value |
|---|
| Training examples | 5,000 |
| Evaluation examples | 128 |
| Epochs | 2 |
| Maximum sequence length | 4,096 tokens |
| Learning rate | 3e-05 |
| Training objective | Assistant-only causal cross-entropy |
| Parameter training | Full model |
| Precision | bfloat16/float16 depending on training GPU |
The system and user portions were masked from the loss. Samples exceeding the
maximum context length were rejected instead of being cut through the middle of
a reasoning trace.
Usage
import torch
from transformers import AutoModelForCausalLM, AutoTokenizer
model_id = "YOUR_USERNAME/SmolLM2-135M-Reasoning-5K"
tokenizer = AutoTokenizer.from_pretrained(model_id)
model = AutoModelForCausalLM.from_pretrained(
model_id,
torch_dtype="auto",
device_map="auto",
)
messages = [
{
"role": "system",
"content": 'You are a helpful AI assistant. For difficult problems, reason carefully inside <think> and </think> tags, then provide a clear final answer.',
},
{
"role": "user",
"content": "A farmer has 17 sheep. All but 9 run away. How many remain?",
},
]
inputs = tokenizer.apply_chat_template(
messages,
tokenize=True,
add_generation_prompt=True,
return_tensors="pt",
return_dict=True,
).to(model.device)
with torch.inference_mode():
output = model.generate(
**inputs,
max_new_tokens=256,
do_sample=False,
repetition_penalty=1.05,
)
new_tokens = output[0, inputs["input_ids"].shape[1]:]
print(tokenizer.decode(new_tokens, skip_special_tokens=False))
The expected assistant format is:
<think>
Internal reasoning trace
</think>
Final answer
This small model is experimental. It should not be assumed to produce correct
reasoning merely because it emits a structured reasoning trace.
Files
training_info.json records the training configuration, any metrics found in
the local output directory, and SHA-256 hashes of the uploaded weight files.
License
The model follows the Apache 2.0 license used by the base SmolLM2 model. Review
the base model repository and source dataset for their complete terms.