diff --git a/README.md b/README.md index ace7285..eb0e54c 100644 --- a/README.md +++ b/README.md @@ -9,108 +9,70 @@ [![Runtimes: vLLM · OVMS](https://img.shields.io/badge/Runtimes-vLLM%20%C2%B7%20OVMS-purple)](https://vllm.ai) [![API: OpenAI Compatible](https://img.shields.io/badge/API-OpenAI%20Compatible-green)](https://platform.openai.com/docs/api-reference) -**Serve any Hugging Face model on Intel® Xeon® CPUs or Intel® Arc™ GPUs with one command. Toolkit Manager installs and operates this toolkit.** - -> Provides the Ansible roles that stand up the model-serving stack — KServe, runtimes, AI gateway, LiteLLM, Langfuse — and **`model-manager`**, a CLI that takes a model from Hugging Face to a live OpenAI-compatible endpoint with NUMA-aware CPU pinning. - -> [!IMPORTANT] -> **This repository is not used on its own.** -> [**Toolkit Manager**](https://github.com/intel/toolkit-manager) -> installs and operates it. Toolkit Manager clones this repository to -> `ext/enterprise.ai-inference/` and brings up the Kubernetes cluster and the services -> (cert-manager, Istio, MetalLB, Envoy Gateway, PostgreSQL, Keycloak, SeaweedFS, observability) -> this toolkit depends on. -> Every command below runs from the **Toolkit Manager repo root**, not from here. +**Serve Hugging Face models on Intel® Xeon® CPUs or Intel® Arc™ GPUs with one command.** --- ## What is Intel® Inference Toolkit? -Serving a model on Kubernetes normally means hand-writing manifests, sizing CPU and memory, pinning cores to the right NUMA node, downloading weights into shared storage, and wiring a route through a gateway — for every model. - -This repository replaces that with a catalog and a CLI. You describe a model once in `models.yaml`, or point `--hfid` at a Hugging Face repo, and `model-manager` resolves the configuration, checks the requested CPU fits the node, downloads the weights, creates the serving pod, and registers the model with the gateway. +Serving a model normally means sizing CPU and memory, pinning cores, downloading weights and wiring a gateway route, for every model. Intel® Inference Toolkit does that with one command. -The Ansible roles here deploy the serving infrastructure itself: KServe for the model CRDs, an in-cluster AI gateway for model-aware routing, the Keycloak realm and client used for sign-in, and — with `auth_type: litellm_vkey` or `litellm_enabled: true` — LiteLLM for virtual API keys and Langfuse for request tracing. +You describe a model once in `models.yaml`, or point `--hfid` at a Hugging Face repo, and `model-manager` resolves the configuration, checks the requested CPU fits the node, downloads the weights, creates the serving pod, and registers the model with the gateway. The result is a single OpenAI-compatible endpoint. The `model` field in the request body selects which model answers, so any OpenAI SDK client works unchanged. -> Want the full picture? See [Architecture](docs/reference/architecture.md) and [Inference Request Flow](docs/reference/request-flow.md). - -## Architecture - -An inference request enters through the **LLM gateway**, which authenticates and authorizes it, then routes it to a serving engine — **vLLM** (on Xeon CPUs, or on Intel® Arc™ Pro B-Series GPUs with `vllm-xpu`) or **OpenVINO™ Model Server** — and returns an OpenAI-compatible response. The gateway also provides model endpoints, user and key management, token telemetry, and monitoring. It all runs on a Kubernetes-orchestrated, Helm-packaged stack over Intel® Xeon® and Intel® GPU infrastructure. -

- Intel® Inference Toolkit: run and scale generative AI inference on a simplified AI stack, on Intel® GPU D-series and Intel® Xeon®, with open-source orchestration. Packaged one-click software deployment. An inference request enters the stack and an inference response leaves it. Top to bottom: API applications and services (samples, API apps and functions, OpenAI-compatible API endpoints); LLM gateway (authentication and authorization, model endpoints, user and key management, token telemetry, monitoring); inferencing engines (vLLM, OVMS); orchestration (Kubernetes orchestrator, Helm charts); infrastructure core components (Ubuntu 22.04, Xeon and GPU software: operators, firmware, and drivers). + Intel® Inference Toolkit architecture

-> Under the hood there are two gateways: the edge gateway terminates TLS and authenticates, while the in-cluster AI gateway routes to the model the request body names. See the [Architecture deep-dive](docs/reference/architecture.md) and [Inference Request Flow](docs/reference/request-flow.md) for the full component list and execution flow. +How it is built and how a request reaches a model: [Architecture](docs/reference/architecture.md) and [Inference Request Flow](docs/reference/request-flow.md). --- ## Quick Start -**Stands up model serving on a freshly prepared machine, then serves an LLM.** In three steps you'll install Intel® Inference Toolkit, deploy a model, and see it answer. +In three steps you install Intel® Inference Toolkit, deploy a model, and see it answer. > [!NOTE] -> **Before you start:** Toolkit Manager installs and operates this toolkit. Its installer, -> `toolkit_manager.sh`, clones this repository into `ext/enterprise.ai-inference/`. Get -> Toolkit Manager, prepare the machine, and create an environment, then run every command -> below from the Toolkit Manager folder: +> **Before you start:** [Toolkit Manager](https://github.com/intel/toolkit-manager) installs and +> operates this toolkit. Get it, prepare the machine, and create an environment, then run every +> command below from the Toolkit Manager folder: > > ```bash -> git clone https://github.com/intel/toolkit-manager.git # main: clones this repo's main, which these docs describe +> git clone https://github.com/intel/toolkit-manager.git > cd toolkit-manager > ./toolkit_manager.sh configure # one-time machine prep; answer y to the prompt -> ./toolkit_manager.sh init inference # creates env/local/ and clones this repo into ext/ +> ./toolkit_manager.sh init inference # creates env/local/ and downloads this toolkit > ``` > -> **Which branch:** Toolkit Manager `main` installs this repository's `main`. For the -> latest release, clone with `--branch v1.2.0` instead: it installs Intel® Inference -> Toolkit v1.1.0, so read the -> [v1.1.0 docs](https://github.com/intel/inference-toolkit/tree/v1.1.0) with it. -> -> Intel® Inference Toolkit needs the cluster, gateway, sign-in and storage that Toolkit -> Manager provides. The `install inference` step below brings those up with it. Hardware -> and software requirements: -> [Toolkit Manager prerequisites](https://github.com/intel/toolkit-manager/blob/main/docs/getting-started/prerequisites.md), -> plus what models add: [Prerequisites](docs/getting-started/prerequisites.md). The full walk-through, -> with both auth modes: [Quickstart](docs/getting-started/quickstart.md). +> Requirements: see [Prerequisites](docs/getting-started/prerequisites.md). ### Step 1 — Install the inference stack -Deploys KServe, the ServingRuntimes, the AI gateway, the Keycloak realm and client, and — with `auth_type: litellm_vkey` or `litellm_enabled: true` — LiteLLM and Langfuse. No models are deployed yet. +Installs the model-serving stack. No models are deployed yet. ```bash ./toolkit_manager.sh install inference # allow up to an hour on a first install - export KUBECONFIG=$(pwd)/env/local/kubeconfig.yaml -kubectl get pods -n kserve # the KServe controller shows Running ``` A successful run ends with an `INSTALLATION COMPLETE` banner. -This toolkit's settings live in `env/local/config.inference.yaml`. `init` copies it from -this repo's [`config.yaml`](config.yaml), and the install reads your copy. Edit it, then -run `install inference` again. See [Configuration](docs/configuration/configuration.md) for every -option, including the Envoy AI Gateway version and the cluster CPU-pinning policy. +To change settings, see [Configuration](docs/configuration/configuration.md). ### Step 2 — Deploy a model -`model-manager` resolves the configuration, verifies the requested CPU fits the node, downloads the weights, creates the serving pod, and registers the model with the gateway. - ```bash ./model-manager deploy qwen3-0-6b --wait ``` -Or skip the catalog and deploy any Hugging Face model directly: +Or skip the catalog and deploy a Hugging Face model directly: ```bash ./model-manager deploy --hfid Qwen/Qwen3-0.6B --cpu 8 --wait # memory sized from the model ``` -`--wait` blocks until the model is ready (up to 15 minutes by default). Run it again any -time: an unchanged model is left as it is. +`--wait` blocks until the model is ready (up to 15 minutes by default). > [!IMPORTANT] > Gated models (Llama, Mistral, Gemma) require a free [Hugging Face token](https://huggingface.co/settings/tokens). @@ -120,8 +82,7 @@ When the command returns it prints the inference endpoint and a ready-to-run `cu ### Step 3 — Send your first request -With the default `auth_type: jwt`, API clients send a Keycloak token (a JWT). The helper -script finds the gateway address and gets a token from the cluster for you: +With the default `auth_type: jwt`, requests need a sign-in token. This script gets one for you: ```bash source ./ext/enterprise.ai-inference/model_manager/scripts/get-keycloak-token.sh @@ -140,44 +101,14 @@ curl -s --noproxy '*' \ "$GATEWAY_URL/v1/chat/completions" ``` -A JSON reply with a `choices` list means the model is serving. `--resolve` sends the -request to the gateway IP without an `/etc/hosts` entry, and `--cacert` trusts the -installer's self-signed certificate authority. The token lasts 15 minutes; `source` the -script again for a new one. - -See what is serving: - -```bash -kubectl get llminferenceservices,inferenceservices -n llm-inference -``` +A JSON reply with a `choices` list means the model is serving. The token lasts 15 minutes; `source` the script again for a new one. -**Shortest path, with a LiteLLM key.** With `auth_type: litellm_vkey` (set it in -`env/local/config.inference.yaml` before Step 1, as Intel® Agent Toolkit does) there is no -token to fetch: call LiteLLM with its admin key. - -```bash -GATEWAY_IP=$(kubectl get svc -n envoy-gateway-system -l gateway.envoyproxy.io/owning-gateway-name=eg-gateway \ - -o jsonpath='{.items[0].status.loadBalancer.ingress[0].ip}') -DOMAIN=$(yq '.base_domain_name' env/local/global_config.yaml) -MK=$(kubectl get secret litellm-master-key -n litellm -o jsonpath='{.data.master_key}' | base64 -d) - -curl -s --noproxy '*' --cacert env/local/logs/toolkit-manager-ca.crt --resolve "litellm.$DOMAIN:443:$GATEWAY_IP" \ - -H "Authorization: Bearer $MK" -H "Content-Type: application/json" \ - -d '{"model":"qwen3-0-6b","messages":[{"role":"user","content":"Hello!"}],"max_tokens":64}' \ - "https://litellm.$DOMAIN/v1/chat/completions" -``` - -Keep the admin key to yourself and give each application its own virtual key; Keycloak -still handles sign-in to the web UIs. More → [Accessing Models](docs/getting-started/accessing-models.md). - -Everything speaks the OpenAI-compatible API, so any tool that works with OpenAI works against your stack. +Using LiteLLM virtual keys (`auth_type: litellm_vkey`) instead? See [Accessing Models](docs/getting-started/accessing-models.md). --- ## Advanced -The Quick Start deploys one catalog model with defaults. From here you can change the engine and its version, add models, tune CPU and memory, switch the AI gateway or the CPU-pinning policy, and control what deploys automatically at install time. - | Goal | Guide | |---|---| | Deploy, update, and remove models | [Deploy a Model](docs/getting-started/deploy-models.md) | @@ -192,20 +123,12 @@ The Quick Start deploys one catalog model with defaults. From here you can chang | NUMA-aware CPU pinning | [CPU Pinning & NUMA](docs/reference/cpu-pinning.md) | | Something isn't working | [Troubleshooting](docs/faq-and-troubleshooting/troubleshooting.md) | +Every guide: [Documentation Index](docs/README.md). + --- ## License Licensed under the [Apache License, Version 2.0](https://www.apache.org/licenses/LICENSE-2.0). -## Links - -- [Documentation Index](docs/README.md) -- [GitHub Repository](https://github.com/intel/inference-toolkit) -- [Toolkit Manager](https://github.com/intel/toolkit-manager) — installs and operates this toolkit -- [Architecture](docs/reference/architecture.md) -- [Inference Request Flow](docs/reference/request-flow.md) - ---- - -*Intel® and Intel® Xeon® are registered trademarks of Intel Corporation or its subsidiaries. Licensed under the Apache License, Version 2.0.* +*Intel®, Intel® Xeon® and Intel® Arc™ are trademarks of Intel Corporation or its subsidiaries.* diff --git a/config.yaml b/config.yaml index 7e8d0f7..12dd370 100644 --- a/config.yaml +++ b/config.yaml @@ -1,117 +1,76 @@ --- -# ============================================================================= -# Inference Configuration — enterprise.ai-inference -# ============================================================================= -# Role defaults live in roles//defaults/main.yaml. -# Override any of them here. This file is loaded by the core installer -# via: -e @ext/enterprise.ai-inference/config.yaml -# ============================================================================= +# Intel® Inference Toolkit settings. +# `init inference` copies this file to env//config.inference.yaml; edit that copy. +# Role defaults: roles//defaults/main.yaml. global_config.yaml overrides this file. -# --- Keycloak (realm & client owned by this solution) --- +# --- API authentication --- +# Agent Toolkit's config overrides this value; people always sign in through Keycloak. +auth_type: "jwt" # jwt (Keycloak JWT) | litellm_vkey (LiteLLM virtual key) + +# --- Keycloak --- keycloak_realm: "inference" keycloak_client_id: "inference-client" -# keycloak_token_lifespan: 900 # JWT access token lifespan in seconds (default: 15 min) +# keycloak_token_lifespan: 900 # JWT lifetime in seconds -# --- AI Gateway --- -# Envoy AI Gateway sits behind the edge (eg-gateway) and dispatches to the KServe model backends. +# --- AI gateway --- ai_gateway_provider: "envoy" - -# envoy_ai_gateway_version: "1.3.0" # default: the release built for the platform Envoy Gateway envoy_ai_gateway_namespace: "envoy-ai-gateway-system" -# Inference host: inference. (or /inference in -# path mode). +# envoy_ai_gateway_version: "1.3.0" # default: matches the platform Envoy Gateway +# inference_hostname: "inference." # --- KServe --- -# kserve_version: "0.18.0" # default: 0.21.0, or 0.18.0 with envoy_gateway_upgrade: false -# kserve_deploy_mode: "Standard" # Standard | Knative +# kserve_version: "0.21.0" # 0.18.0 with envoy_gateway_upgrade: false +# kserve_deploy_mode: "Standard" # Standard | Knative # kserve_namespace: "kserve" # kserve_llmisvc_epp_image: "ghcr.io/llm-d/llm-d-router-endpoint-picker:v0.9.0" # kserve_llmisvc_tokenizer_image: "ghcr.io/llm-d/llm-d-uds-tokenizer:vllm-v0.19.1" -# --- API authentication --- -# Credential API clients send; people always sign in through Keycloak. -# auth_type: "jwt" # jwt (default, Keycloak JWT) | litellm_vkey (LiteLLM virtual key) - # --- LiteLLM --- -# litellm_enabled: true # add LiteLLM with Keycloak auth (always on with auth_type=litellm_vkey) +# litellm_enabled: true # always on with auth_type: litellm_vkey # litellm_version: "v1.105.1" # litellm_namespace: "litellm" -# litellm_hostname: "litellm.inteltoolkits.ai" # defaults to litellm. +# litellm_hostname: "litellm." # litellm_cache_enabled: true # litellm_cache_ttl: 600 -# litellm_reconcile: true # upgrade an existing release with the current settings (default: left as is) -# litellm_allow_pod_network: true # with Istio: let callers outside the mesh (e.g. agent sandboxes) reach LiteLLM -# litellm_allowed_source_cidrs: [""] # explicit source ranges instead of the pod network -# guardrails_enabled: false # content-safety guardrail; default: on with auth_type=litellm_vkey -# guardrail_model: "qwen3guard" # guard model from the catalog (docs/configuration/guardrails.md) +# litellm_reconcile: true # upgrade an existing release with these settings +# litellm_allow_pod_network: true # with Istio: let callers outside the mesh reach LiteLLM +# litellm_allowed_source_cidrs: [""] # explicit source ranges instead of the pod network + +# --- Guardrails --- +# guardrails_enabled: false # default: on with auth_type: litellm_vkey +# guardrail_model: "qwen3guard" # docs/configuration/guardrails.md # --- Langfuse --- -# langfuse_enabled: false # tracing for LiteLLM; default: on whenever LiteLLM is on +# langfuse_enabled: false # default: on whenever LiteLLM is on # langfuse_namespace: "langfuse" -# langfuse_hostname: "langfuse.inteltoolkits.ai" # defaults to langfuse. -# langfuse_admin_email: "admin@inteltoolkits.ai" # defaults to admin@ -# langfuse_admin_password: set via LANGFUSE_ADMIN_PASSWORD env var - -# --- CPU Policy --- -# Single switch controlling all CPU-pinning infrastructure. -# All dependent settings (NRI install, kubelet flags, model annotations) are -# auto-derived from this value. -# nri-balloons (default) NRI balloons resource policy — NUMA-aware pinning -# kubelet-static kubelet static CPU manager (Guaranteed QoS pinning) -# best-effort no pinning, standard scheduler -# -# This must match the value the cluster was installed with: it decides both how -# kubelet is configured (solutions repo) and how model manifests are rendered -# (this repo). Changing it on an existing cluster requires re-running -# `./toolkit_manager.sh install kubernetes` so kubelet is reconfigured. -kubernetes_cpu_policy: "nri-balloons" - -# NRI Balloons tuning (only when kubernetes_cpu_policy=nri-balloons): -# nri_reserved_cpu_list: "" # Linux cpuset for system CPUs (auto-sized if empty) -# nri_deployment_profile: "standard" # minimal(8) | standard(12) | observability(16) | full(20) - -# kubelet-static tuning (only when kubernetes_cpu_policy=kubelet-static): -# Model pods are rendered as Guaranteed QoS (integer cpu, requests == limits) so -# kubelet's static CPU manager grants them exclusive whole cores. With -# full-pcpus-only enabled (the solutions default) a pod's cpu request must be a -# multiple of the SMT width, or kubelet rejects it with SMTAlignmentError; -# model-manager rounds cpu up to satisfy this. On an SMT-disabled cluster set: -# mm_kubelet_threads_per_core: 1 # exported as MM_KUBELET_THREADS_PER_CORE - -# --- LLM Services --- +# langfuse_hostname: "langfuse." +# langfuse_admin_email: "admin@" +# Admin password: export LANGFUSE_ADMIN_PASSWORD before install. + +# --- CPU pinning --- +# Must match the cluster: changing it needs `./toolkit_manager.sh install kubernetes` again. +kubernetes_cpu_policy: "nri-balloons" # nri-balloons | kubelet-static | best-effort +# nri_reserved_cpu_list: "" # nri-balloons: system cpuset, auto-sized if empty +# nri_deployment_profile: "standard" # nri-balloons: minimal | standard | observability | full +# mm_kubelet_threads_per_core: 1 # kubelet-static on an SMT-disabled cluster + +# --- Models --- # llm_services_namespace: "llm-inference" +llm_services_deploy_models: false # true: deploy catalog models marked autodeploy +# llm_services_autodeploy_models: [] # always deployed; set by layers such as Agent Toolkit +# model_deploy_flags: "--wait-timeout 1800" # extra `model-manager deploy` options -# Deploy models during installation (true/false) -# Set to false to install infrastructure only without deploying any models -# Can be overridden with: ./toolkit_manager.sh install inference --skip-models -llm_services_deploy_models: false - -# Catalog models deployed on install whatever llm_services_deploy_models says — -# set by a solution layer that needs a default model (the agent toolkit sets one). -# llm_services_autodeploy_models: [] - -# Optional: Customize model deployment behavior -# model_deploy_flags: "" # Additional flags for deploy-default-models.sh -# model_deploy_flags: "--skip-download" # Fast for testing (assume weights on PVC) -# model_deploy_flags: "--no-wait" # Don't wait for models to become Ready - -# --- vLLM Semantic Router (optional, off by default) --- -# Classifier-based intelligent routing: one endpoint auto-selects the best-fit -# model per request. Opt-in and additive — direct model calls are unaffected. -# Guide: docs/configuration/semantic-router.md +# --- vLLM Semantic Router (off by default) --- +# docs/configuration/semantic-router.md # vllm_sr_enabled: true -# vllm_sr_route_models: # models the router may pick from (default: discovered) -# - qwen3-4b -# - qwen3-coder-30b -# vllm_sr_litellm_model_name: "semantic-router" # client-facing name (auth_type: litellm_vkey) -# vllm_sr_config_override: null # advanced: full canonical routing config -# vllm_sr_dashboard_enabled: true # dashboard on vllm-sr. +# vllm_sr_route_models: [qwen3-4b, qwen3-coder-30b] # default: discovered +# vllm_sr_litellm_model_name: "semantic-router" # with auth_type: litellm_vkey +# vllm_sr_dashboard_enabled: true # on vllm-sr. +# vllm_sr_config_override: null # advanced: full routing config -# --- Hybrid Router (optional, off by default; needs LiteLLM) --- -# Complexity-tier + multi-armed-bandit routing inside LiteLLM. Clients call the -# hybrid-router model. Router code: roles/litellm/files/router/ -# Guide: docs/configuration/hybrid-router.md +# --- Hybrid Router (off by default; needs LiteLLM) --- +# docs/configuration/hybrid-router.md # hybrid_router_enabled: true -# hybrid_router_tier_candidates: # deployed models per complexity tier -# SIMPLE: [qwen3-4b] +# hybrid_router_tier_candidates: +# SIMPLE: [qwen3-4b] # COMPLEX: [qwen3-coder-30b] diff --git a/docs/configuration/configuration.md b/docs/configuration/configuration.md index 8da4e56..7557285 100644 --- a/docs/configuration/configuration.md +++ b/docs/configuration/configuration.md @@ -100,8 +100,8 @@ keycloak_client_id: "inference-client" `auth_type` only selects the credential API clients send: ```yaml -# auth_type: "jwt" # jwt (default): Keycloak JWT on inference. -# # litellm_vkey: LiteLLM virtual key on litellm. +auth_type: "jwt" # jwt (default): Keycloak JWT on inference. + # litellm_vkey: LiteLLM virtual key on litellm. ``` ## KServe