Instructions to use SupraLabs/Supra-Router-51M-gguf with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use SupraLabs/Supra-Router-51M-gguf with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="SupraLabs/Supra-Router-51M-gguf")# Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("SupraLabs/Supra-Router-51M-gguf", dtype="auto") - llama-cpp-python
How to use SupraLabs/Supra-Router-51M-gguf with llama-cpp-python:
# !pip install llama-cpp-python from llama_cpp import Llama llm = Llama.from_pretrained( repo_id="SupraLabs/Supra-Router-51M-gguf", filename="Supra-Router-51M-F16.gguf", )
output = llm( "Once upon a time,", max_tokens=512, echo=True ) print(output)
- Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- llama.cpp
How to use SupraLabs/Supra-Router-51M-gguf with llama.cpp:
Install (macOS, Linux)
curl -LsSf https://llama.app/install.sh | sh # Start a local OpenAI-compatible server with a web UI: llama serve -hf SupraLabs/Supra-Router-51M-gguf:Q4_K_M # Run inference directly in the terminal: llama cli -hf SupraLabs/Supra-Router-51M-gguf:Q4_K_M
Install from WinGet (Windows)
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama serve -hf SupraLabs/Supra-Router-51M-gguf:Q4_K_M # Run inference directly in the terminal: llama cli -hf SupraLabs/Supra-Router-51M-gguf:Q4_K_M
Use pre-built binary
# Download pre-built binary from: # https://github.com/ggerganov/llama.cpp/releases # Start a local OpenAI-compatible server with a web UI: ./llama-server -hf SupraLabs/Supra-Router-51M-gguf:Q4_K_M # Run inference directly in the terminal: ./llama-cli -hf SupraLabs/Supra-Router-51M-gguf:Q4_K_M
Build from source code
git clone https://github.com/ggerganov/llama.cpp.git cd llama.cpp cmake -B build cmake --build build -j --target llama-server llama-cli # Start a local OpenAI-compatible server with a web UI: ./build/bin/llama-server -hf SupraLabs/Supra-Router-51M-gguf:Q4_K_M # Run inference directly in the terminal: ./build/bin/llama-cli -hf SupraLabs/Supra-Router-51M-gguf:Q4_K_M
Use Docker
docker model run hf.co/SupraLabs/Supra-Router-51M-gguf:Q4_K_M
- LM Studio
- Jan
- vLLM
How to use SupraLabs/Supra-Router-51M-gguf with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "SupraLabs/Supra-Router-51M-gguf" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "SupraLabs/Supra-Router-51M-gguf", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/SupraLabs/Supra-Router-51M-gguf:Q4_K_M
- SGLang
How to use SupraLabs/Supra-Router-51M-gguf 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 "SupraLabs/Supra-Router-51M-gguf" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "SupraLabs/Supra-Router-51M-gguf", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'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 "SupraLabs/Supra-Router-51M-gguf" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "SupraLabs/Supra-Router-51M-gguf", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Ollama
How to use SupraLabs/Supra-Router-51M-gguf with Ollama:
ollama run hf.co/SupraLabs/Supra-Router-51M-gguf:Q4_K_M
- Unsloth Studio
How to use SupraLabs/Supra-Router-51M-gguf with Unsloth Studio:
Install Unsloth Studio (macOS, Linux, WSL)
curl -fsSL https://unsloth.ai/install.sh | sh # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for SupraLabs/Supra-Router-51M-gguf to start chatting
Install Unsloth Studio (Windows)
irm https://unsloth.ai/install.ps1 | iex # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for SupraLabs/Supra-Router-51M-gguf to start chatting
Using HuggingFace Spaces for Unsloth
# No setup required # Open https://huggingface.co/spaces/unsloth/studio in your browser # Search for SupraLabs/Supra-Router-51M-gguf to start chatting
- Atomic Chat new
- Docker Model Runner
How to use SupraLabs/Supra-Router-51M-gguf with Docker Model Runner:
docker model run hf.co/SupraLabs/Supra-Router-51M-gguf:Q4_K_M
- Lemonade
How to use SupraLabs/Supra-Router-51M-gguf with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull SupraLabs/Supra-Router-51M-gguf:Q4_K_M
Run and chat with the model
lemonade run user.Supra-Router-51M-gguf-Q4_K_M
List all available models
lemonade list
| library_name: transformers | |
| tags: | |
| - router | |
| - orchestrator | |
| - slm | |
| - edge-computing | |
| - mixture-of-experts | |
| - text-generation | |
| pipeline_tag: text-generation | |
| model_type: llama | |
| datasets: | |
| - SupraLabs/Prompt-Routing-Dataset | |
| language: | |
| - en | |
| base_model: | |
| - SupraLabs/Supra-Router-51M | |
| license: apache-2.0 | |
| <h1 align="center">Supra-Router-51M · Multi-Task Infrastructure Routing Model</h1> | |
|  | |
| <h2 align="center">About the Model</h2> | |
| **Supra-Router-51M** is an ultra-lightweight, high-speed infrastructure traffic controller optimized for localized edge orchestration. With only **51.7 million parameters**, this micro-LLM acts as a defensive gateway for multi-model ecosystems, accurately determining when user requests can be processed locally by an Edge SLM or when they must be triaged to a cloud-hosted frontier intelligence layer. | |
| The model was built by fine-tuning a pre-trained 51M base on the `SupraLabs/Prompt-Routing-Dataset` (992 rows). Rather than acting as a naive binary classifier, the model uses **Multi-Task Sequence Generation** to map out the underlying properties of a prompt before predicting the final routing token, anchoring its attention heads to robust language and structural logic features. | |
| --- | |
| ## Multi-Task Decision Sequence | |
| To run inference, wrap your user query inside the structural framing tokens used during training (`Task: [Prompt]\nAnalysis: `). The model will output a deterministic, pipe-separated string containing the full telemetry of the prompt's cognitive requirements: | |
| ### Expected Output Target Schema: | |
| ```text | |
| Domain: [Semantic Field] | Complexity: [1-5] | Math: [True/False] | Code: [True/False] | Route: [small model/big model] | Justification: [Rule-driven infrastructure reasoning] | |
| ``` | |
| ## Why this works: | |
| By forcing a sub-100M parameter model to calculate the semantic domain, structural complexity, and technical flags before it emits the final Route token, the network effectively runs an internal feature-activation map. This multi-task sequence prevents localized weight collapse and guarantees stable routing boundaries. | |
| ## Training Telemetry & Optimization | |
| - Dataset Source: SupraLabs/Prompt-Routing-Dataset (992 samples) | |
| - Training Duration: 5 Epochs | |
| - Checkpoint Selection: Peak generalization was reached during Epoch 3 (eval_loss: 0.1342). To eliminate late-stage micro-model memorization and validation drift, the training state was automatically rewound and saved at this numerical peak. | |
| - Precision: bfloat16 | |
| - Hardware Footprint: Optimized sequence processing length of 3840 tokens, ensuring rapid inference execution with negligible CPU/GPU overhead (sub-millisecond generation speeds). | |
| ## Inference & Gateway Implementation | |
| Use this direct script to test or wrap the model inside a live production orchestrator or FastAPI gateway. It enforces greedy decoding (do_sample=False) for maximum decision stability. | |
| ```python | |
| import torch | |
| from transformers import AutoModelForCausalLM, AutoTokenizer | |
| MODEL_ID = "SupraLabs/Supra-Router-51M" | |
| print("[*] Initializing local infrastructure router...") | |
| tokenizer = AutoTokenizer.from_pretrained(MODEL_ID) | |
| model = AutoModelForCausalLM.from_pretrained( | |
| MODEL_ID, | |
| dtype=torch.bfloat16, | |
| device_map="auto" | |
| ) | |
| model.eval() | |
| # Example prompt showcasing keyword-trap evasion | |
| user_prompt = "Write a movie script about a chef who gets lost at sea." | |
| # Format to match internal SFT attention alignment | |
| formatted_input = f"Task: {user_prompt}\nAnalysis: " | |
| inputs = tokenizer(formatted_input, return_tensors="pt").to(model.device) | |
| with torch.no_grad(): | |
| outputs = model.generate( | |
| **inputs, | |
| max_new_tokens=128, | |
| do_sample=False, | |
| pad_token_id=tokenizer.pad_token_id, | |
| eos_token_id=tokenizer.eos_token_id | |
| ) | |
| generated_ids = outputs[0][inputs["input_ids"].shape[1]:] | |
| print(tokenizer.decode(generated_ids, skip_special_tokens=True).strip()) | |
| ``` | |
| ## Proven Benchmarks & Defensive Boundaries | |
| During edge validation testing, Supra-Router-51M demonstrated robust resilience against adversarial prompt strings: | |
| - Keyword Trap Evasion: Successfully identifies semantic context rather than matching tokens. Prompts containing words like "script" or "calculus" are correctly parsed as creative writing (not programming/math code) and routed locally to the small model when complexity is low. | |
| - Complexity-Driven Safety Net: In instances where programming syntax or technical boundaries are ambiguous (e.g., complex regex or architectural database frames), the model naturally scales its evaluation metrics to Complexity: 3, automatically triggering a big model route override. | |
| - Deterministic Offloading: Safely captures multi-step logic paths, calculus concepts, and code generation scripts, instantly assigning them to cloud-scale frontier endpoints. |