Tiny Reasoning Language Model
Collection
Collection dedicated to the development of the Tiny Reasoning Language Model (trlm) • 7 items • Updated • 7
How to use Shekswess/trlm-stage-3-dpo-final-2 with Transformers:
# Use a pipeline as a high-level helper
from transformers import pipeline
pipe = pipeline("text-generation", model="Shekswess/trlm-stage-3-dpo-final-2")
messages = [
{"role": "user", "content": "Who are you?"},
]
pipe(messages) # Load model directly
from transformers import AutoTokenizer, AutoModelForCausalLM
tokenizer = AutoTokenizer.from_pretrained("Shekswess/trlm-stage-3-dpo-final-2")
model = AutoModelForCausalLM.from_pretrained("Shekswess/trlm-stage-3-dpo-final-2", 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=40)
print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:]))How to use Shekswess/trlm-stage-3-dpo-final-2 with vLLM:
# Install vLLM from pip:
pip install vllm
# Start the vLLM server:
vllm serve "Shekswess/trlm-stage-3-dpo-final-2"
# Call the server using curl (OpenAI-compatible API):
curl -X POST "http://localhost:8000/v1/chat/completions" \
-H "Content-Type: application/json" \
--data '{
"model": "Shekswess/trlm-stage-3-dpo-final-2",
"messages": [
{
"role": "user",
"content": "What is the capital of France?"
}
]
}'docker model run hf.co/Shekswess/trlm-stage-3-dpo-final-2
How to use Shekswess/trlm-stage-3-dpo-final-2 with SGLang:
# Install SGLang from pip:
pip install sglang
# Start the SGLang server:
python3 -m sglang.launch_server \
--model-path "Shekswess/trlm-stage-3-dpo-final-2" \
--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": "Shekswess/trlm-stage-3-dpo-final-2",
"messages": [
{
"role": "user",
"content": "What is the capital of France?"
}
]
}'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 "Shekswess/trlm-stage-3-dpo-final-2" \
--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": "Shekswess/trlm-stage-3-dpo-final-2",
"messages": [
{
"role": "user",
"content": "What is the capital of France?"
}
]
}'How to use Shekswess/trlm-stage-3-dpo-final-2 with Docker Model Runner:
docker model run hf.co/Shekswess/trlm-stage-3-dpo-final-2
trlm-stage-3-dpo-final-2 is the Stage 3 post-training model for the Tiny Reasoning Language Model (trlm) project.
This stage focuses on preference alignment using Direct Preference Optimization (DPO) with 50k preference pairs.
This stage improves the model’s alignment, coherence, and reasoning stability.
<think> traces This model was trained on the dataset:
👉 Shekswess/trlm-dpo-stage-3-final-2
Dataset summary:
scottgeng00/olmo-3-preference-mix-deltas_reasoning-yolo_scottmix-DECON-chfiltered | Source Dataset | Split | Entries | % |
|---|---|---|---|
| scottgeng00/olmo-3-preference-mix-deltas_reasoning-yolo_scottmix-DECON-chfiltered | train | 50,000 | 100% |
from transformers import AutoTokenizer, AutoModelForCausalLM
model_name = "Shekswess/trlm-stage-3-dpo-final-2"
# Load tokenizer & model
tokenizer = AutoTokenizer.from_pretrained(model_name)
model = AutoModelForCausalLM.from_pretrained(model_name)
# Example inference with preference-aligned reasoning
messages = [
{"role": "user", "content": "Explain why the sky is blue in simple terms."}
]
# Apply chat template
text = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
inputs = tokenizer([text], return_tensors="pt")
outputs = model.generate(**inputs, max_new_tokens=256)
print(tokenizer.decode(outputs[0], skip_special_tokens=True))
Part of the Tiny Reasoning Language Model (trlm) post-training pipeline.
Base model
HuggingFaceTB/SmolLM2-135M