# vllm-project/vllm-gr architecture

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

- Interactive diagram: https://gitdiagram.com/vllm-project/vllm-gr
- Repository: https://github.com/vllm-project/vllm-gr

## Overview

vLLM-GR serves generative recommendation models: a caller supplies interaction-history prompts and beam-search settings, and receives ranked candidate item IDs with scores. The main path runs through configuration and an offline or online serving entrypoint into an EngineCore-owned beam session; scheduling and device workers perform prefill and iterative beam decoding. Catalog constraints, CUDA/Ascend implementations, and weight/catalog updates are important supporting capabilities. The README documents several runtime features; links not shown by excerpts or indexed references are omitted rather than inferred.

Main entry points: [`vllm_gr/entrypoints/llm.py`](https://github.com/vllm-project/vllm-gr/blob/main/vllm_gr/entrypoints/llm.py) (Python inference), [`vllm_gr/v1/engine/engine_core_patch.py`](https://github.com/vllm-project/vllm-gr/blob/main/vllm_gr/v1/engine/engine_core_patch.py) (EngineCore integration), [`vllm_gr/entrypoints/beam_search/client.py`](https://github.com/vllm-project/vllm-gr/blob/main/vllm_gr/entrypoints/beam_search/client.py) (Beam session client), [`vllm_gr/v1/worker/cuda/worker.py`](https://github.com/vllm-project/vllm-gr/blob/main/vllm_gr/v1/worker/cuda/worker.py) (CUDA worker)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Configuration and serving"]
  node_config["GR configuration<br/>[models.py]"]
  node_config_parse["Config parsing<br/>[parser.py]"]
  node_startup["Engine startup<br/>[startup.py]"]
  node_offline["Python inference<br/>[llm.py]"]
  node_online["HTTP serving<br/>[serving_engine.py]"]
  node_grpc["gRPC serving<br/>[serving.py]"]
end

subgraph group_engine["Beam engine"]
  node_beam_client["Beam session client<br/>[client.py]"]
  node_protocol["Beam protocol<br/>[protocol.py]"]
  node_contracts["Batch contracts<br/>[batch_contracts.py]"]
  node_engine_core["EngineCore integration"]
  node_scheduler["Async beam scheduler"]
  node_scheduler_patch["Scheduler integration<br/>[scheduler_patch.py]"]
  node_wire["Engine wire format<br/>[wire.py]"]
end

subgraph group_compute["Device execution"]
  node_cuda_worker["CUDA worker<br/>[worker.py]"]
  node_npu_worker["Ascend worker<br/>[worker.py]"]
  node_attention["Beam attention"]
  node_beam_ops["Beam kernels<br/>[onerec_decode.py]"]
end

subgraph group_constraints["Catalog constraints"]
  node_constraint_compile["Constraint compiler<br/>[compiler.py]"]
  node_constraint_load["Constraint loader<br/>[loader.py]"]
  node_catalog_store[("Constraint tables<br/>[table.py]")]
end

subgraph group_operations["Runtime operations"]
  node_hot_update["Worker hot updates<br/>[hot_update.py]"]
  node_sidecar["Update controller<br/>[controller.py]"]
end

node_user(("Application caller"))

node_user -->|"runs inference"| node_offline
node_user -->|"requests completion"| node_online
node_user -->|"uses experimental API"| node_grpc
node_config_parse -->|"builds settings"| node_config
node_offline -->|"resolves settings"| node_config_parse
node_offline -->|"prepares engine"| node_startup
node_online -->|"runs beam search"| node_beam_client
node_offline -->|"submits session"| node_beam_client
node_beam_client -->|"uses request types"| node_protocol
node_protocol -->|"uses batch contracts"| node_contracts
node_engine_core -->|"installs integration"| node_scheduler_patch
node_scheduler_patch -->|"uses scheduler"| node_scheduler
node_engine_core -->|"uses wire types"| node_wire
node_engine_core -->|"checks batch contracts"| node_contracts
node_cuda_worker -.->|"runs beam attention"| node_attention
node_cuda_worker -.->|"executes beam kernels"| node_beam_ops
node_npu_worker -.->|"uses NPU attention"| node_attention
node_constraint_compile -->|"compiles tables"| node_catalog_store
node_constraint_load -.->|"loads tables"| node_catalog_store
node_sidecar -.->|"updates instances"| node_hot_update
node_hot_update -->|"reloads trie"| node_constraint_load

click node_config "https://github.com/vllm-project/vllm-gr/blob/main/vllm_gr/config/models.py"
click node_config_parse "https://github.com/vllm-project/vllm-gr/blob/main/vllm_gr/config/parser.py"
click node_startup "https://github.com/vllm-project/vllm-gr/blob/main/vllm_gr/engine/startup.py"
click node_offline "https://github.com/vllm-project/vllm-gr/blob/main/vllm_gr/entrypoints/llm.py"
click node_online "https://github.com/vllm-project/vllm-gr/blob/main/vllm_gr/entrypoints/openai/serving_engine.py"
click node_grpc "https://github.com/vllm-project/vllm-gr/blob/main/vllm_gr/entrypoints/grpc/serving.py"
click node_beam_client "https://github.com/vllm-project/vllm-gr/blob/main/vllm_gr/entrypoints/beam_search/client.py"
click node_protocol "https://github.com/vllm-project/vllm-gr/blob/main/vllm_gr/entrypoints/beam_search/protocol.py"
click node_contracts "https://github.com/vllm-project/vllm-gr/blob/main/vllm_gr/v1/beam/batch_contracts.py"
click node_engine_core "https://github.com/vllm-project/vllm-gr/blob/main/vllm_gr/v1/engine/engine_core_patch.py"
click node_scheduler "https://github.com/vllm-project/vllm-gr/blob/main/vllm_gr/v1/core/sched/beam_async_scheduler.py"
click node_scheduler_patch "https://github.com/vllm-project/vllm-gr/blob/main/vllm_gr/v1/core/sched/scheduler_patch.py"
click node_wire "https://github.com/vllm-project/vllm-gr/blob/main/vllm_gr/v1/engine/wire.py"
click node_cuda_worker "https://github.com/vllm-project/vllm-gr/blob/main/vllm_gr/v1/worker/cuda/worker.py"
click node_npu_worker "https://github.com/vllm-project/vllm-gr/blob/main/vllm_gr/v1/worker/npu/worker.py"
click node_attention "https://github.com/vllm-project/vllm-gr/blob/main/vllm_gr/v1/attention/backends/beam_attn_metadata.py"
click node_beam_ops "https://github.com/vllm-project/vllm-gr/blob/main/vllm_gr/ops/onerec_decode.py"
click node_constraint_compile "https://github.com/vllm-project/vllm-gr/blob/main/vllm_gr/constraints/compiler.py"
click node_constraint_load "https://github.com/vllm-project/vllm-gr/blob/main/vllm_gr/constraints/loader.py"
click node_hot_update "https://github.com/vllm-project/vllm-gr/blob/main/vllm_gr/v1/worker/hot_update.py"
click node_sidecar "https://github.com/vllm-project/vllm-gr/blob/main/vllm_gr/sidecar/controller.py"
click node_catalog_store "https://github.com/vllm-project/vllm-gr/blob/main/vllm_gr/constraints/table.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_config,node_config_parse,node_startup,node_offline,node_online,node_grpc toneBlue
class node_beam_client,node_protocol,node_contracts,node_engine_core,node_scheduler,node_scheduler_patch,node_wire toneAmber
class node_cuda_worker,node_npu_worker,node_attention,node_beam_ops toneMint
class node_constraint_compile,node_constraint_load,node_catalog_store toneRose
class node_hot_update,node_sidecar,node_user toneIndigo
```

## Components

### Configuration and serving

- [GR configuration](https://github.com/vllm-project/vllm-gr/blob/main/vllm_gr/config/models.py): `vllm_gr/config/models.py`
- [Config parsing](https://github.com/vllm-project/vllm-gr/blob/main/vllm_gr/config/parser.py): `vllm_gr/config/parser.py`
- [Engine startup](https://github.com/vllm-project/vllm-gr/blob/main/vllm_gr/engine/startup.py): `vllm_gr/engine/startup.py`
- [Python inference](https://github.com/vllm-project/vllm-gr/blob/main/vllm_gr/entrypoints/llm.py): `vllm_gr/entrypoints/llm.py`
- [HTTP serving](https://github.com/vllm-project/vllm-gr/blob/main/vllm_gr/entrypoints/openai/serving_engine.py): `vllm_gr/entrypoints/openai/serving_engine.py`
- [gRPC serving](https://github.com/vllm-project/vllm-gr/blob/main/vllm_gr/entrypoints/grpc/serving.py): `vllm_gr/entrypoints/grpc/serving.py`

### Beam engine

- [Beam session client](https://github.com/vllm-project/vllm-gr/blob/main/vllm_gr/entrypoints/beam_search/client.py): `vllm_gr/entrypoints/beam_search/client.py`
- [Beam protocol](https://github.com/vllm-project/vllm-gr/blob/main/vllm_gr/entrypoints/beam_search/protocol.py): `vllm_gr/entrypoints/beam_search/protocol.py`
- [Batch contracts](https://github.com/vllm-project/vllm-gr/blob/main/vllm_gr/v1/beam/batch_contracts.py): `vllm_gr/v1/beam/batch_contracts.py`
- [EngineCore integration](https://github.com/vllm-project/vllm-gr/blob/main/vllm_gr/v1/engine/engine_core_patch.py): `vllm_gr/v1/engine/engine_core_patch.py`
- [Async beam scheduler](https://github.com/vllm-project/vllm-gr/blob/main/vllm_gr/v1/core/sched/beam_async_scheduler.py): `vllm_gr/v1/core/sched/beam_async_scheduler.py`
- [Scheduler integration](https://github.com/vllm-project/vllm-gr/blob/main/vllm_gr/v1/core/sched/scheduler_patch.py): `vllm_gr/v1/core/sched/scheduler_patch.py`
- [Engine wire format](https://github.com/vllm-project/vllm-gr/blob/main/vllm_gr/v1/engine/wire.py): `vllm_gr/v1/engine/wire.py`

### Device execution

- [CUDA worker](https://github.com/vllm-project/vllm-gr/blob/main/vllm_gr/v1/worker/cuda/worker.py): `vllm_gr/v1/worker/cuda/worker.py`
- [Ascend worker](https://github.com/vllm-project/vllm-gr/blob/main/vllm_gr/v1/worker/npu/worker.py): `vllm_gr/v1/worker/npu/worker.py`
- [Beam attention](https://github.com/vllm-project/vllm-gr/blob/main/vllm_gr/v1/attention/backends/beam_attn_metadata.py): `vllm_gr/v1/attention/backends/beam_attn_metadata.py`
- [Beam kernels](https://github.com/vllm-project/vllm-gr/blob/main/vllm_gr/ops/onerec_decode.py): `vllm_gr/ops/onerec_decode.py`

### Catalog constraints

- [Constraint compiler](https://github.com/vllm-project/vllm-gr/blob/main/vllm_gr/constraints/compiler.py): `vllm_gr/constraints/compiler.py`
- [Constraint loader](https://github.com/vllm-project/vllm-gr/blob/main/vllm_gr/constraints/loader.py): `vllm_gr/constraints/loader.py`
- [Constraint tables](https://github.com/vllm-project/vllm-gr/blob/main/vllm_gr/constraints/table.py): `vllm_gr/constraints/table.py`

### Runtime operations

- [Worker hot updates](https://github.com/vllm-project/vllm-gr/blob/main/vllm_gr/v1/worker/hot_update.py): `vllm_gr/v1/worker/hot_update.py`
- [Update controller](https://github.com/vllm-project/vllm-gr/blob/main/vllm_gr/sidecar/controller.py): `vllm_gr/sidecar/controller.py`

### Other components

- **Application caller**

## Connections

- Application caller → Python inference: runs inference (evidence: `README.md`)
- Application caller → HTTP serving: requests completion (evidence: `README.md`)
- Application caller → gRPC serving: uses experimental API (evidence: `README.md`)
- Config parsing → GR configuration: builds settings (evidence: `vllm_gr/config/parser.py`)
- Python inference → Config parsing: resolves settings (evidence: `vllm_gr/entrypoints/llm.py`)
- Python inference → Engine startup: prepares engine (evidence: `vllm_gr/entrypoints/llm.py`)
- HTTP serving → Beam session client: runs beam search (evidence: `vllm_gr/entrypoints/openai/serving_engine.py`)
- Python inference → Beam session client: submits session (evidence: `vllm_gr/entrypoints/llm.py`)
- Beam session client → Beam protocol: uses request types (evidence: `vllm_gr/entrypoints/beam_search/client.py`)
- Beam protocol → Batch contracts: uses batch contracts (evidence: `vllm_gr/entrypoints/beam_search/protocol.py`)
- EngineCore integration → Scheduler integration: installs integration (evidence: `vllm_gr/v1/engine/engine_core_patch.py`)
- Scheduler integration → Async beam scheduler: uses scheduler (evidence: `vllm_gr/v1/core/sched/scheduler_patch.py`)
- EngineCore integration → Engine wire format: uses wire types (evidence: `vllm_gr/v1/engine/engine_core_patch.py`)
- EngineCore integration → Batch contracts: checks batch contracts (evidence: `vllm_gr/v1/engine/engine_core_patch.py`)
- CUDA worker → Beam attention: runs beam attention
- CUDA worker → Beam kernels: executes beam kernels
- Ascend worker → Beam attention: uses NPU attention
- Constraint compiler → Constraint tables: compiles tables (evidence: `vllm_gr/constraints/compiler.py`)
- Constraint loader → Constraint tables: loads tables
- Update controller → Worker hot updates: updates instances
- Worker hot updates → Constraint loader: reloads trie (evidence: `vllm_gr/v1/worker/hot_update.py`)
