Instructions to use palboy/laya-model-router with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use palboy/laya-model-router with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-classification", model="palboy/laya-model-router")# pip install -U transformers accelerate # Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("palboy/laya-model-router", device_map="auto") - Laya
How to use palboy/laya-model-router with Laya:
# No code snippets available yet for this library. # To use this model, check the repository files and the library's documentation. # Want to help? PRs adding snippets are welcome at: # https://github.com/huggingface/huggingface.js
- Notebooks
- Google Colab
- Kaggle
Laya Router Fine-Tuned Model
A fine-tuned Laya decision model that selects a route for a request. It predicts one of these labels:
qwen3-0.6bfor simple text-only requestsqwen3.5-4bfor more involved text tasks such as coding and reasoningqwen3VLfor requests that require understanding attached images or videocloudfor requests that exceed local model capabilities or context limits, when cloud use is permitted
This checkpoint is a router only. It returns a route label; it does not load or call the Qwen or cloud models. The application must implement that dispatch separately. Image routing also requires the application to pass the image to the vision model.
Use Locally
Install Laya, then load the checkpoint directory and its bundled question schema:
pip install laya==0.4.13
import json
import laya
checkpoint_dir = "/path/to/laya-router-finetuned"
agent = laya.load(checkpoint_dir)
with open(f"{checkpoint_dir}/questions.json", encoding="utf-8") as file:
questions = json.load(file)
result = agent.predict("Write a small Python Snake game.", questions)
route = result["answers"]["what_model"]["choice"]
print(route) # For example: qwen3.5-4b
Keep the question schema used at inference consistent with the schema in questions.json.
Training Results
On the 39-example held-out evaluation set, the base Laya checkpoint scored 74.4% accuracy and this fine-tuned checkpoint scored 97.4% accuracy. These are results on a small synthetic dataset, so they should not be treated as a guarantee of performance on real-world prompts. Test with fresh examples representative of your use before relying on the router.
The model reported mean confidence of 0.9998 after fine-tuning, while the training report notes that confidence calibration had limited evidence. Do not interpret a high confidence score as certainty.
Files
model.safetensors,encoder/, andtokenizer/contain the checkpoint needed for inference.questions.jsoncontains the route question schema.train_report.jsoncontains evaluation metrics and training configuration.checkpoint_latest/is an additional training checkpoint snapshot and is not required for normal inference.
Model tree for palboy/laya-model-router
Base model
convaiinnovations/laya