Text Generation
Transformers
TensorBoard
Safetensors
gemma3_text
trl
sft
gemma3
conversational
text-generation-inference
Instructions to use d-s-b/Router with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use d-s-b/Router with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="d-s-b/Router") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("d-s-b/Router") model = AutoModelForCausalLM.from_pretrained("d-s-b/Router", 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]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use d-s-b/Router with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "d-s-b/Router" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "d-s-b/Router", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/d-s-b/Router
- SGLang
How to use d-s-b/Router 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 "d-s-b/Router" \ --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": "d-s-b/Router", "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 "d-s-b/Router" \ --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": "d-s-b/Router", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use d-s-b/Router with Docker Model Runner:
docker model run hf.co/d-s-b/Router
| base_model: google/gemma-3-270m-it | |
| library_name: transformers | |
| model_name: Router | |
| tags: | |
| - trl | |
| - sft | |
| - gemma3 | |
| licence: license | |
| datasets: | |
| - d-s-b/synthetic-reasoning-dataset | |
| # Model Card for Router | |
| This model is fine-tuned to serve as a router for reasoning tasks, classifying input queries into one of three categories: | |
| no_reasoning – Direct factual lookup or simple recall (e.g., "What is the capital of France?") | |
| low_reasoning – Requires light reasoning such as simple arithmetic, comparisons, or single logical steps (e.g., "If John has 5 apples and eats 2, how many are left?") | |
| high_reasoning – Requires multi-step reasoning, deep logical chains, or complex problem-solving (e.g., "Prove that the sum of two even numbers is always even"). | |
| ## Quick start | |
| ```python | |
| from transformers import pipeline | |
| pipe = pipeline("text-generation", model="d-s-b/Router") | |
| messages = [ | |
| {"role": "user", "content": "what is capital of india"} | |
| ] | |
| pipe(messages) | |
| ``` | |
| ## Training Details | |
| Method: Supervised fine-tuning with SFTTrainer | |
| Objective: Multi-class classification with labels (no_reasoning, low_reasoning, high_reasoning) | |
| Dataset: Custom dataset of queries annotated with reasoning levels. | |
| ## Limitations & Bias | |
| May misclassify borderline queries (e.g., between low_reasoning and high_reasoning). | |
| Performance depends on the diversity of training data. | |
| Inherits any biases from the base Gemma 3 270M model. | |
| ### Framework versions | |
| - TRL: 0.21.0 | |
| - Transformers: 4.55.1 | |
| - Pytorch: 2.6.0+cu124 | |
| - Datasets: 4.0.0 | |
| - Tokenizers: 0.21.4 | |
| ## Citations | |
| ```bibtex | |
| @misc{vonwerra2022trl, | |
| title = {{TRL: Transformer Reinforcement Learning}}, | |
| author = {Leandro von Werra and Younes Belkada and Lewis Tunstall and Edward Beeching and Tristan Thrush and Nathan Lambert and Shengyi Huang and Kashif Rasul and Quentin Gallou{\'e}dec}, | |
| year = 2020, | |
| journal = {GitHub repository}, | |
| publisher = {GitHub}, | |
| howpublished = {\url{https://github.com/huggingface/trl}} | |
| } | |
| @article{gemma_2025, | |
| title={Gemma 3}, | |
| url={https://arxiv.org/abs/2503.19786}, | |
| publisher={Google DeepMind}, | |
| author={Gemma Team}, | |
| year={2025} | |
| } | |
| ``` |