AlphaRoute-0.8B-v1.0-MLX-4bit ⚡
AlphaRoute-0.8B-v1.0 is a compact language model specialized for instruction-conditioned semantic intent routing and structured information extraction. Given a user query and a dynamically defined set of categories with semantic descriptions, it predicts the most appropriate intent, extracts parameter slots, and produces a constrained structured JSON decision.
Unlike traditional classifiers bound to fixed output heads, AlphaRoute operates as a zero-shot meta-router: you can define arbitrary runtime categories, out-of-scope policies, parameter extraction slots, and target nested JSON schemas on the fly without retraining or fine-tuning the model.
This repository provides the 4-bit quantized MLX format, optimized natively for Apple Silicon Metal GPUs (M1/M2/M3/M4) with an ultra-lightweight 404 MB disk footprint and sub-300ms latency.
📊 Benchmark Highlights
Evaluated across standardized held-out public benchmark test splits:
| Benchmark Dataset | Domain Scope | JSON Valid % | Zero-Shot Accuracy (BF16 Baseline) |
|---|
Banking77 (official test) | 77 Fine-Grained Banking Intents | 100.0% | 91.80% |
CLINC150 (official test + OOS) | 150 Intents + Out-of-Scope Detection | 100.0% | 75.20% |
HWU64 (official test, 1,076 queries) | 64 Voice Assistant Intents | 100.0% | 83.92% |
Note on Benchmarks: Benchmark scores reported above are evaluated on the official test splits using the unquantized PyTorch BF16 reference model. Quantized variants (MLX 8-bit/4-bit, GGUF Q8_0/Q4_K_M) provide ultra-compact memory footprints and accelerated inference.
🧠 Advanced Capabilities Beyond Simple Routing
While traditional classifiers only output a flat integer class ID, AlphaRoute-0.8B is trained as a structured semantic engine capable of rich schema synthesis and contextual extraction:
1. 🏗️ Arbitrary Deeply Nested JSON Schemas
AlphaRoute natively follows complex multi-level JSON schemas, including nested metadata blocks, arrays of action items, and multi-tier operational telemetry:
1{
2 "routing": {
3 "target_category": "iam_privilege_escalation",
4 "severity": "CRITICAL",
5 "out_of_scope": false
6 },
7 "extracted_entities": {
8 "compromised_identity": "admin-service-account",
9 "affected_resource": "arn:aws:iam::123456789:role/ProdAdmin",
10 "action_taken": "policy_attachment"
11 },
12 "recommended_actions": [
13 "revoke_active_session",
14 "quarantine_role"
15 ]
16}
2. 🔍 Dynamic Slot Extraction & Parameter Parsing
Extracts contextual parameters (amounts, dates, currencies, affected servers, user accounts, error codes) directly into arbitrary developer-defined keys in a single forward pass without needing a secondary NER model.
3. 🛡️ Out-of-Scope (OOS) Rejection Guardrail
When user input does not match any candidate categories in the active ontology, AlphaRoute reliably flags "out_of_scope": true and sets "intent": null, preventing hallucinated routing.
4. 🧩 Zero-Shot Runtime Schema Adaptability
You can change the schema layout, field names, or category definitions on every single API request. The model conditions itself dynamically to mirror the requested developer schema.
💡 Best Practices & Prompt Engineering Tips
To achieve optimal routing accuracy and reliable JSON generation from AlphaRoute-0.8B, follow these established best practices:
1. 🏷️ Always Provide Actionable Category Descriptions
Rather than providing bare category names, supply 1–2 sentences defining the semantic boundaries and trigger conditions:
- Avoid:
- billing
- Recommended:
- billing: Inquiries regarding invoices, credit card charges, overbilling, refund requests, or payment disputes.
2. 📋 Specify an Explicit JSON Output Schema
Explicitly list allowed values inside the schema definition to guide token generation:
1{
2 "intent": "billing | technical_support | account_security | null",
3 "out_of_scope": "boolean"
4}
3. 🎯 Use 1–2 In-Context Few-Shot Exemplars for Complex Logic
For nuanced domains, complex entity extractions, or custom severity scoring, providing 1–2 dynamic few-shot examples dramatically steers the output:
1EXAMPLES:
2Input: "Someone from Russia logged into our admin console"
3Output: {"intent": "account_security", "severity": "CRITICAL", "out_of_scope": false}
4
5Input: "Can you change my invoice address?"
6Output: {"intent": "billing", "severity": "LOW", "out_of_scope": false}
📐 Canonical Prompt Structure
For highest fidelity, format your prompts following this standard block structure:
1You are a precise semantic routing engine. Output only valid JSON.
2TASK:
3<High-level routing objective>
4
5CATEGORIES:
6- <category_name_1>: <semantic definition and trigger rules>
7- <category_name_2>: <semantic definition and trigger rules>
8
9OUTPUT SCHEMA:
10<JSON Schema with allowed literals>
11
12[OPTIONAL] EXAMPLES:
13Input: "<exemplar_query>"
14Output: <exemplar_json>
15
16INPUT:
17"<user_query>"
18
19JSON:
⚡ Quickstart (Apple MLX)
1. Install MLX
2. Run Nested Semantic Extraction & Prediction
1from mlx_lm import load, generate
2
3model, tokenizer = load("NamanAgnih0tri/AlphaRoute-0.8B-v1.0-MLX-4bit")
4
5prompt = '''You are a precise semantic routing engine. Output only valid JSON.
6TASK:
7Route cloud infrastructure event and extract parameters.
8CATEGORIES:
9- finops_budget_anomaly: Unpartitioned scans, large spend surge.
10- iam_privilege_escalation: Unauthorized root policy attachment.
11OUTPUT SCHEMA:
12{"routing": {"target_category": "finops_budget_anomaly | iam_privilege_escalation | null", "severity": "CRITICAL | HIGH | LOW", "out_of_scope": "boolean"}, "metadata": {"affected_resource": "string or null", "cost_or_metric": "string or null"}}
13INPUT:
14"BigQuery project 'analytics-warehouse' incurred $14,250 in 4 hours due to cross-join scans."
15JSON:'''
16
17response = generate(model, tokenizer, prompt=prompt, max_tokens=100, verbose=False)
18print(response)
📦 Model Specs
- Parameters: 0.8 Billion (Qwen architecture backbone)
- Quantization: Native MLX 4-bit (4.5 bits/weight)
- Disk Footprint: 404 MB
- Context Window: 2,048 tokens
- Target Hardware: Apple Silicon Mac (M1/M2/M3/M4)