# ixi-enki/vllm-turboquant architecture

> Architecture diagram of the GitHub repository ixi-enki/vllm-turboquant, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-05-28). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/ixi-enki/vllm-turboquant
- Repository: https://github.com/ixi-enki/vllm-turboquant

## Overview

1. **What this repo is**
   vLLM is an LLM inference and serving runtime, not just a model wrapper. The core design is a layered stack: request-facing APIs on top, an engine and scheduler in the middle, model execution and GPU/CPU kernels underneath, and hardware/distributed abstractions around the edges.

2. **Public runtime entrypoints**
   The main user-facing surfaces live under `vllm/entrypoints` and `vllm/entrypoints/cli`. These include the standard server/serve commands, the OpenAI-compatible API server, pooling APIs, tokenization endpoints, Anthropic compatibility, batch/run utilities, and special-purpose routes such as realtime, speech-to-text, render, LoRA, and disaggregated serving.

3. **Request-to-token data flow**
   A typical request flows from an API handler into input preprocessing and chat/template rendering, then into an engine request object, then through scheduling, batching, and execution, and finally back through detokenization/output processing to a streamed or buffered response. The codebase is organized so parsing, batching, sampling, and output formatting are separate stages.

4. **Engine and scheduling core**
   There are two closely related execution layers: the legacy top-level engine APIs under `vllm/engine`, and the newer `vllm/v1/engine` stack. The v1 path contains the scheduler, request queue, async engine, output processor, detokenizer, and inter-process tensor IPC plumbing, making it the clearest representation of the runtime control plane.

5. **Worker/executor boundary**
   Actual model execution happens in workers under `vllm/v1/worker` and `vllm/model_executor`. The executor layer supports uniprocess, multiproc, and Ray-based distributed execution, while worker code handles batching, GPU input preparation, KV-cache state, model runner orchestration, and device-specific behavior for GPU/CPU/XPU/TPU paths.

6. **Model execution and model zoo**
   `vllm/model_executor/models` contains a large registry of supported architectures, including text LLMs, MoE models, multimodal models, ASR, embedding/pooling models, and reasoning-specialized variants. This layer adapts Hugging Face-style models into vLLM’s execution model and is paired with loaders, registry/config utilities, and architecture-specific adapters.

7. **Kernel and operator layer**
   Performance-critical operations are isolated in `csrc` and `vllm/model_executor/kernels`. This includes attention, paged attention, MoE routing and fused MoE kernels, quantized GEMMs, layernorm, rotary embeddings, sampling/top-k, and custom reduction/collective operators. The implementation mixes CUDA, HIP/ROCm, Triton, CUTLASS, CPU vectorized code, and a smaller amount of platform-specific native code.

8. **Memory, KV cache, and throughput features**
   PagedAttention and KV-cache management are central to the architecture. The repo includes prefix caching, chunked prefill, speculative decoding, CPU/GPU offload, KV transfer/connectors, disaggregated prefill/decode flows, and elastic expert parallelism. These features sit between scheduling and kernel execution and are what make the serving path throughput-oriented.

9. **Distributed and communication subsystems**
   Distributed inference is first-class: tensor/pipeline/data/expert parallelism, NCCL and custom all-reduce, shared-memory broadcast, Ray integration, and device communicators are all explicit subsystems. The `vllm/distributed` and `vllm/v1/kv_connector` trees show that cross-process KV movement and weight transfer are treated as architecture boundaries, not incidental utilities.

10. **Multimodal, pooling, tool-use, and reasoning extensions**
   Multimodal inputs are handled by dedicated parsing/processing modules under `vllm/multimodal`, `vllm/renderers`, and `vllm/transformers_utils/processors`. Tool calling and structured outputs are separately implemented via `vllm/tool_parsers`, `vllm/reasoning`, and `vllm/v1/structured_output`, which keeps prompt formatting and output interpretation out of the core model loop.

11. **LoRA and plugin model**
   LoRA is integrated as a runtime extension with its own layers, resolvers, worker managers, and specialized ops. The plugin system also supports custom IO processors, LoRA resolvers, platform extensions, and stat loggers, allowing external behavior to be plugged in without changing the central engine.

12. **Platform abstraction**
   `vllm/platforms` and the hardware-specific code paths in `csrc` make the runtime portable across CUDA, ROCm, CPU, XPU, and TPU targets, with extra support for vendor extensions like Gaudi and Ascend in the ecosystem. The architecture is deliberately split so device choice changes kernels, communicators, and sometimes model runners, but not the overall request lifecycle.

13. **Fork-specific TurboQuant path**
   This fork adds an experimental TurboQuant KV-cache workflow centered on the Triton attention backend. The repo-specific additions include `turboquant` KV-cache dtypes, per-layer metadata loading, tensor-parallel metadata slicing, and tuned paths for workstation-class CUDA GPUs such as RTX A6000 and GB10. Architecturally, this extends the same attention/KV-cache boundary rather than introducing a separate serving stack.

14. **Build, validation, and deployment substrate**
   The repository is heavily productionized: Dockerfiles for multiple hardware targets, CMake/CUDA build integration, Buildkite pipelines for hardware-specific CI, GitHub Actions, and an extensive test suite spanning kernels, distributed behavior, entrypoints, models, quantization, and v1 runtime features. This indicates the architecture is validated end-to-end across multiple devices and execution modes, not just unit-tested in isolation.

Main entry points: [`vllm/v1/engine/llm_engine.py`](https://github.com/ixi-enki/vllm-turboquant/blob/main/vllm/v1/engine/llm_engine.py) (v1 engine), [`vllm/model_executor/models/registry.py`](https://github.com/ixi-enki/vllm-turboquant/blob/main/vllm/model_executor/models/registry.py) (Model zoo), [`vllm/v1/worker/gpu_worker.py`](https://github.com/ixi-enki/vllm-turboquant/blob/main/vllm/v1/worker/gpu_worker.py) (GPU worker), [`vllm/v1/attention/backends/registry.py`](https://github.com/ixi-enki/vllm-turboquant/blob/main/vllm/v1/attention/backends/registry.py) (Attention)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_group_entry["Request surfaces"]
  node_n_api["API servers<br/>entrypoints<br/>[api_server.py]"]
  node_n_openai["OpenAI API<br/>compat server<br/>[api_server.py]"]
  node_n_pooling["Pooling APIs<br/>pooling entrypoints<br/>[serving.py]"]
  node_n_serve["Serve extras<br/>serve routes<br/>[serving.py]"]
end

subgraph group_group_runtime["Execution core"]
  node_n_inputs["Input prep<br/>preprocess<br/>[preprocess.py]"]
  node_n_engine["v1 engine<br/>runtime core<br/>[llm_engine.py]"]
  node_n_sched["Scheduler<br/>control plane<br/>[scheduler.py]"]
  node_n_sample["Sampling<br/>token selection<br/>[sampler.py]"]
end

subgraph group_group_worker["Workers & executors"]
  node_n_worker["GPU worker<br/>[gpu_worker.py]"]
  node_n_exec["Executors<br/>distributed exec"]
end

subgraph group_group_models["Models & adapters"]
  node_n_models["Model zoo<br/>architectures<br/>[registry.py]"]
  node_n_loaders["Loaders<br/>weights io<br/>[default_loader.py]"]
  node_n_layers["Execution layers<br/>[attention.py]"]
end

subgraph group_group_kernels["Kernels & cache"]
  node_n_attn["Attention<br/>kernel backend<br/>[registry.py]"]
  node_n_quant["Quantization<br/>kernel backend<br/>[fp8.py]"]
  node_n_cache[("KV cache<br/>memory system")]
end

subgraph group_group_dist["Distributed & offload"]
  node_n_dist["Distributed<br/>parallel comms<br/>[parallel_state.py]"]
  node_n_kv["KV transfer<br/>connector boundary<br/>[base.py]"]
end

subgraph group_group_ext["Extensions"]
  node_n_templates["Templates<br/>rendering<br/>[base.py]"]
  node_n_lora["LoRA<br/>runtime extension<br/>[lora_model.py]"]
  node_n_multi["Multimodal<br/>pre/post processing<br/>[processor.py]"]
  node_n_tool["Tooling<br/>structured I/O"]
  node_n_platform["Platforms<br/>hardware abstraction<br/>[interface.py]"]
end

subgraph group_group_fork["TurboQuant fork"]
  node_n_turbo{{"TurboQuant<br/>fork extension"}}
end

node_n_api -->|"parse"| node_n_inputs
node_n_api -->|"serve"| node_n_engine
node_n_openai -->|"render"| node_n_inputs
node_n_openai -->|"request"| node_n_engine
node_n_pooling -->|"infer"| node_n_engine
node_n_serve -->|"control"| node_n_engine
node_n_inputs -->|"shape"| node_n_templates
node_n_templates -->|"format"| node_n_tool
node_n_engine -->|"schedule"| node_n_sched
node_n_sched -->|"dispatch"| node_n_worker
node_n_engine -->|"sample"| node_n_sample
node_n_worker -->|"run"| node_n_models
node_n_models -->|"load"| node_n_loaders
node_n_models -->|"compose"| node_n_layers
node_n_layers -->|"attend"| node_n_attn
node_n_layers -->|"quantize"| node_n_quant
node_n_attn -->|"cache"| node_n_cache
node_n_sched -->|"manage"| node_n_cache
node_n_dist -->|"coordinate"| node_n_worker
node_n_dist -->|"transfer"| node_n_kv
node_n_kv -->|"offload"| node_n_cache
node_n_platform -->|"select"| node_n_attn
node_n_platform -->|"select"| node_n_quant
node_n_lora -->|"adapt"| node_n_models
node_n_multi -->|"extend"| node_n_templates
node_n_multi -->|"encode"| node_n_models
node_n_tool -->|"output"| node_n_engine
node_n_turbo -->|"extend"| node_n_attn
node_n_turbo -->|"dtype"| node_n_cache
node_n_exec -->|"launch"| node_n_worker
node_n_exec -->|"scale"| node_n_dist

click node_n_api "https://github.com/ixi-enki/vllm-turboquant/blob/main/vllm/entrypoints/api_server.py"
click node_n_openai "https://github.com/ixi-enki/vllm-turboquant/blob/main/vllm/entrypoints/openai/api_server.py"
click node_n_pooling "https://github.com/ixi-enki/vllm-turboquant/blob/main/vllm/entrypoints/pooling/embed/serving.py"
click node_n_serve "https://github.com/ixi-enki/vllm-turboquant/blob/main/vllm/entrypoints/serve/tokenize/serving.py"
click node_n_inputs "https://github.com/ixi-enki/vllm-turboquant/blob/main/vllm/inputs/preprocess.py"
click node_n_templates "https://github.com/ixi-enki/vllm-turboquant/blob/main/vllm/renderers/base.py"
click node_n_engine "https://github.com/ixi-enki/vllm-turboquant/blob/main/vllm/v1/engine/llm_engine.py"
click node_n_sched "https://github.com/ixi-enki/vllm-turboquant/blob/main/vllm/v1/core/sched/scheduler.py"
click node_n_sample "https://github.com/ixi-enki/vllm-turboquant/blob/main/vllm/v1/sample/sampler.py"
click node_n_worker "https://github.com/ixi-enki/vllm-turboquant/blob/main/vllm/v1/worker/gpu_worker.py"
click node_n_exec "https://github.com/ixi-enki/vllm-turboquant/blob/main/vllm/v1/executor/ray_distributed_executor.py"
click node_n_models "https://github.com/ixi-enki/vllm-turboquant/blob/main/vllm/model_executor/models/registry.py"
click node_n_loaders "https://github.com/ixi-enki/vllm-turboquant/blob/main/vllm/model_executor/model_loader/default_loader.py"
click node_n_layers "https://github.com/ixi-enki/vllm-turboquant/blob/main/vllm/model_executor/layers/attention/attention.py"
click node_n_attn "https://github.com/ixi-enki/vllm-turboquant/blob/main/vllm/v1/attention/backends/registry.py"
click node_n_quant "https://github.com/ixi-enki/vllm-turboquant/blob/main/vllm/model_executor/layers/quantization/fp8.py"
click node_n_cache "https://github.com/ixi-enki/vllm-turboquant/blob/main/vllm/v1/core/kv_cache_manager.py"
click node_n_dist "https://github.com/ixi-enki/vllm-turboquant/blob/main/vllm/distributed/parallel_state.py"
click node_n_kv "https://github.com/ixi-enki/vllm-turboquant/blob/main/vllm/distributed/kv_transfer/kv_connector/base.py"
click node_n_lora "https://github.com/ixi-enki/vllm-turboquant/blob/main/vllm/lora/lora_model.py"
click node_n_multi "https://github.com/ixi-enki/vllm-turboquant/blob/main/vllm/multimodal/processing/processor.py"
click node_n_tool "https://github.com/ixi-enki/vllm-turboquant/blob/main/vllm/tool_parsers/abstract_tool_parser.py"
click node_n_platform "https://github.com/ixi-enki/vllm-turboquant/blob/main/vllm/platforms/interface.py"
click node_n_turbo "https://github.com/ixi-enki/vllm-turboquant/blob/main/vllm/v1/attention/ops/turboquant_kv_cache.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_n_api,node_n_openai,node_n_pooling,node_n_serve,node_n_templates,node_n_lora,node_n_multi,node_n_tool,node_n_platform toneBlue
class node_n_inputs,node_n_engine,node_n_sched,node_n_sample,node_n_turbo toneAmber
class node_n_worker,node_n_exec toneMint
class node_n_models,node_n_loaders,node_n_layers toneRose
class node_n_attn,node_n_quant,node_n_cache toneIndigo
class node_n_dist,node_n_kv toneTeal
```

## Components

### Request surfaces

CLI, HTTP, and compatibility entrypoints that accept user requests and turn them into runtime calls.

- [API servers](https://github.com/ixi-enki/vllm-turboquant/blob/main/vllm/entrypoints/api_server.py): entrypoints · Main request-facing servers and CLI launchers. · `vllm/entrypoints/api_server.py`
- [OpenAI API](https://github.com/ixi-enki/vllm-turboquant/blob/main/vllm/entrypoints/openai/api_server.py): compat server · OpenAI-compatible chat, completion, models, realtime, responses, and speech routes. · `vllm/entrypoints/openai/api_server.py`
- [Pooling APIs](https://github.com/ixi-enki/vllm-turboquant/blob/main/vllm/entrypoints/pooling/embed/serving.py): pooling entrypoints · Embedding, classification, rerank, and token-level pooling services. · `vllm/entrypoints/pooling/embed/serving.py`
- [Serve extras](https://github.com/ixi-enki/vllm-turboquant/blob/main/vllm/entrypoints/serve/tokenize/serving.py): serve routes · Auxiliary serving routes for tokenize, render, LoRA, cache, metrics, and disagg flows. · `vllm/entrypoints/serve/tokenize/serving.py`

### Execution core

Engine, scheduler, request handling, sampling, and output processing.

- [Input prep](https://github.com/ixi-enki/vllm-turboquant/blob/main/vllm/inputs/preprocess.py): preprocess · Prompt parsing, preprocessing, and multimodal input normalization. · `vllm/inputs/preprocess.py`
- [v1 engine](https://github.com/ixi-enki/vllm-turboquant/blob/main/vllm/v1/engine/llm_engine.py): runtime core · Async engine, core request handling, detokenization, and output processing. · `vllm/v1/engine/llm_engine.py`
- [Scheduler](https://github.com/ixi-enki/vllm-turboquant/blob/main/vllm/v1/core/sched/scheduler.py): control plane · Request queueing, scheduling, batching, and output coordination. · `vllm/v1/core/sched/scheduler.py`
- [Sampling](https://github.com/ixi-enki/vllm-turboquant/blob/main/vllm/v1/sample/sampler.py): token selection · Logits processing, sampling, logprobs, penalties, and rejection sampling. · `vllm/v1/sample/sampler.py`

### Workers & executors

Execution backends that run models, batch inputs, and bridge to distributed runtimes.

- [GPU worker](https://github.com/ixi-enki/vllm-turboquant/blob/main/vllm/v1/worker/gpu_worker.py): worker · GPU worker, model runner, input batching, and device-specific execution. · `vllm/v1/worker/gpu_worker.py`
- [Executors](https://github.com/ixi-enki/vllm-turboquant/blob/main/vllm/v1/executor/ray_distributed_executor.py): distributed exec · Uniprocess, multiprocess, and Ray executor implementations. · `vllm/v1/executor/ray_distributed_executor.py`

### Models & adapters

Model zoo, architecture adapters, loaders, and runtime-specific layer implementations.

- [Model zoo](https://github.com/ixi-enki/vllm-turboquant/blob/main/vllm/model_executor/models/registry.py): architectures · Model registry and architecture adapters for text, MoE, multimodal, pooling, and ASR models. · `vllm/model_executor/models/registry.py`
- [Loaders](https://github.com/ixi-enki/vllm-turboquant/blob/main/vllm/model_executor/model_loader/default_loader.py): weights io · Model loading, sharded state, tensorizer, and reload paths. · `vllm/model_executor/model_loader/default_loader.py`
- [Execution layers](https://github.com/ixi-enki/vllm-turboquant/blob/main/vllm/model_executor/layers/attention/attention.py): layers · Attention, MoE, pooling, quantization, rotary embedding, and other model-layer implementations. · `vllm/model_executor/layers/attention/attention.py`

### Kernels & cache

Performance-critical operators, attention backends, quantization, and KV-cache mechanics.

- [Attention](https://github.com/ixi-enki/vllm-turboquant/blob/main/vllm/v1/attention/backends/registry.py): kernel backend · V1/vLLM attention backends and paged/prefix/chunked attention operations. · `vllm/v1/attention/backends/registry.py`
- [Quantization](https://github.com/ixi-enki/vllm-turboquant/blob/main/vllm/model_executor/layers/quantization/fp8.py): kernel backend · FP8/INT8/GPTQ/Marlin/Machete/blocked quantized linear and MoE kernels. · `vllm/model_executor/layers/quantization/fp8.py`
- [KV cache](https://github.com/ixi-enki/vllm-turboquant/blob/main/vllm/v1/core/kv_cache_manager.py): memory system · Paged attention cache, block pool, prefix caching, offload, and TurboQuant cache ops. · `vllm/v1/core/kv_cache_manager.py`

### Distributed & offload

Parallelism, communication, KV transfer, weight transfer, and offload connectors.

- [Distributed](https://github.com/ixi-enki/vllm-turboquant/blob/main/vllm/distributed/parallel_state.py): parallel comms · Tensor/pipeline/data/expert parallelism, NCCL-style comms, and shared-memory broadcast. · `vllm/distributed/parallel_state.py`
- [KV transfer](https://github.com/ixi-enki/vllm-turboquant/blob/main/vllm/distributed/kv_transfer/kv_connector/base.py): connector boundary · KV connectors and remote prefill/decode transport across processes and services. · `vllm/distributed/kv_transfer/kv_connector/base.py`

### Extensions

Multimodal, tokenization, tool parsing, reasoning, LoRA, plugins, and platform abstractions.

- [Templates](https://github.com/ixi-enki/vllm-turboquant/blob/main/vllm/renderers/base.py): rendering · Chat templates, renderers, and tool/reasoning prompt shaping. · `vllm/renderers/base.py`
- [LoRA](https://github.com/ixi-enki/vllm-turboquant/blob/main/vllm/lora/lora_model.py): runtime extension · LoRA layers, adapters, resolvers, and worker integration. · `vllm/lora/lora_model.py`
- [Multimodal](https://github.com/ixi-enki/vllm-turboquant/blob/main/vllm/multimodal/processing/processor.py): pre/post processing · Audio, image, video, multimodal processing, and media connectors. · `vllm/multimodal/processing/processor.py`
- [Tooling](https://github.com/ixi-enki/vllm-turboquant/blob/main/vllm/tool_parsers/abstract_tool_parser.py): structured I/O · Tool parsers, structured outputs, reasoning parsers, and tokenization helpers. · `vllm/tool_parsers/abstract_tool_parser.py`
- [Platforms](https://github.com/ixi-enki/vllm-turboquant/blob/main/vllm/platforms/interface.py): hardware abstraction · CUDA, ROCm, CPU, TPU, XPU, and Zen platform selection. · `vllm/platforms/interface.py`

### TurboQuant fork

Fork-specific KV-cache and Triton attention extensions.

- [TurboQuant](https://github.com/ixi-enki/vllm-turboquant/blob/main/vllm/v1/attention/ops/turboquant_kv_cache.py): fork extension · Fork-specific turboquant KV-cache dtype and Triton attention path. · `vllm/v1/attention/ops/turboquant_kv_cache.py`

## Connections

- API servers → Input prep: parse · Servers normalize and preprocess incoming requests.
- API servers → v1 engine: serve · General serving entrypoints invoke the runtime engine.
- OpenAI API → Input prep: render · OpenAI-compatible routes build prompts, chats, and multimodal payloads.
- OpenAI API → v1 engine: request · OpenAI APIs submit engine requests and stream results.
- Pooling APIs → v1 engine: infer · Pooling endpoints reuse the same engine/runtime path.
- Serve extras → v1 engine: control · Auxiliary routes expose tokenization, render, LoRA, cache, and disagg controls.
- Input prep → Templates: shape · Input preprocessing feeds chat templates and renderers.
- Templates → Tooling: format · Prompt rendering interacts with tool, reasoning, and structured-output formatters.
- v1 engine → Scheduler: schedule · The engine forwards requests into the scheduler.
- Scheduler → GPU worker: dispatch · Scheduler batches and dispatches work to executors/workers.
- v1 engine → Sampling: sample · Engine output passes through logits processing and sampling.
- GPU worker → Model zoo: run · Workers execute model architectures and adapters.
- Model zoo → Loaders: load · Model definitions are paired with weight loaders and registry utilities.
- Model zoo → Execution layers: compose · Architectures are built from shared execution layers.
- Execution layers → Attention: attend · Model layers call into attention backends and ops.
- Execution layers → Quantization: quantize · Linear, MoE, and cache-sensitive layers use quantized kernels.
- Attention → KV cache: cache · Attention backends depend on paged/KV-cache state.
- Scheduler → KV cache: manage · Scheduling is constrained by block pools, prefix cache, and offload.
- Distributed → GPU worker: coordinate · Distributed state underpins worker placement and parallel execution.
- Distributed → KV transfer: transfer · Distributed KV connectors move cache state between nodes/processes.
- KV transfer → KV cache: offload · KV transfer connects remote storage and cache reuse.
- Platforms → Attention: select · Platform choice selects attention and device-specific kernels.
- Platforms → Quantization: select · Platform choice also affects quantized operator implementations.
- LoRA → Model zoo: adapt · LoRA wraps base models and layers.
- Multimodal → Templates: extend · Multimodal processing feeds renderers and prompt construction.
- Multimodal → Model zoo: encode · Multimodal models combine modality processors with core architectures.
- Tooling → v1 engine: output · Structured outputs and parsers shape final responses from the engine.
- TurboQuant → Attention: extend · TurboQuant extends the attention/KV-cache boundary.
- TurboQuant → KV cache: dtype · TurboQuant adds fork-specific KV-cache metadata and layouts.
- Executors → GPU worker: launch · Executors create and manage worker processes.
- Executors → Distributed: scale · Ray and multiproc executors integrate with distributed runtime state.
