Jump to content

Connect SuperML | Leeroopedia MCP: Equip your AI agents with best practices, code verification, and debugging knowledge. Powered by Leeroo — building Organizational Superintelligence. Contact us at founders@leeroo.com.

Principle:Predibase Lorax Chat Adapter Routing

From Leeroopedia


Knowledge Sources
Domains API_Design, Adapter_Management
Last Updated 2026-02-08 02:00 GMT

Overview

A request routing mechanism that maps the OpenAI model parameter to a LoRA adapter ID, enabling per-request adapter selection through the standard chat completions interface.

Description

Chat Adapter Routing solves the problem of adapter selection within the constraints of the OpenAI API format. The OpenAI spec uses model to identify which model to use, but LoRAX repurposes this field:

  • If model matches the base model ID → no adapter (base model inference)
  • If model is any other string → treated as a LoRA adapter ID
  • Additional adapter_source and api_token fields can be passed for private/non-Hub adapters

The ChatCompletionRequest struct captures the request, and try_into_generate() converts it to internal GenerateParameters with the adapter ID extracted.

Usage

Use when making chat completion requests. Set the model parameter to the HuggingFace adapter ID (e.g., my-org/my-adapter) to use a LoRA adapter, or to the base model ID for unmodified inference.

Theoretical Basis

Pseudo-code:

# Adapter routing logic
def route_adapter(request):
    if request.model == base_model_id:
        adapter_id = None  # No adapter
    else:
        adapter_id = request.model  # Use model as adapter ID
    return GenerateParameters(adapter_id=adapter_id)

Related Pages

Implemented By

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment