Skip to content

LLM Router

Prompt router that classifies requests and sends them to the best LLM endpoint using configurable routing rules.

Publisher
AMD

Overview

LLM Router UI

Finding the right Large Language Model (LLM) for a task can be difficult. While the perfect model would be accurate, fast, and inexpensive, real-world systems often force a choice between these competing factors.

This blueprint design presents a routing system that automates this choice. When a user submits a prompt, the system follows this process:

  1. Applies a Routing Policy: The system uses a defined strategy, such as classifying the prompt by its task type or complexity level.
  2. Classifies the Prompt: The system analyzes the incoming prompt and assigns it to the correct category from the policy. Two classification approaches are supported: embedding-based and LLM-based (described below).
  3. Routes to the Optimal LLM: Based on this classification, the system automatically proxies the original prompt to the LLM backend best suited for that specific category—whether optimized for accuracy, speed, or cost.

For example, under a task classification policy, user prompts are analyzed, categorized, and seamlessly sent to the most appropriate model for execution.

User PromptTask ClassificationRoute To
“Create a quicksort in go language”Code Generationsecondary-llm
“Based on these three facts: First, water boils at 100°C. Second, ice melts at 0°C. Third, evaporation occurs at various temperatures. What general conclusion can be drawn about states of matter and temperature?”Summarizationprimary-llm
“Hello”Unknownprimary-llm

AMD Solution Blueprints are packaged as Helm charts for deployment on a Kubernetes cluster. For development or further exploration, the source code is public and available in the Solution Blueprints GitHub repository.

Architecture

The LLM Router architecture consists of the UI, Controller, and Classifier together with several AIM LLMs.The LLM Router architecture consists of the UI, Controller, and Classifier together with several AIM LLMs.

The LLM Router is composed of the following components:

ComponentRole
Router ControllerA proxy-like service responsible for routing OpenAI-compatible requests
Router ClassifierA service that analyzes and classifies the user’s prompt. Supports two classification approaches: embedding-based and LLM-based
UI (Gradio)Web interface for testing routing policies and sending prompts
Embedding AIMEmbedding-based classifier backend (default: intfloat/multilingual-e5-large-instruct on Instinct and Radeon)
Primary AIMLighter-workload backend (default: GPT-OSS 20B on Instinct, Llama 3.1 8B Instruct on Radeon)
Secondary AIMHeavier-workload backend (default: Llama 3.3 70B Instruct on Instinct, Qwen3-VL 8B Instruct on Radeon)

When deployed with demonstration LLMs (deployDemonstrationLLMs=true), the chart deploys the primary and secondary AIM backends listed in the table above. You can point the models at existing external LLM endpoints instead.