Before you start: words you need#
| Word | Plain meaning |
|---|---|
| Plugin | A separately installed Python package that adds behaviour to vLLM without changing vLLM’s code. |
| Entry point | A standard Python packaging feature: a package declares “call this function” under a named group, and other programs can find it after pip install. |
| Out-of-tree (OOT) | Code that lives outside the vLLM repository, in your own package. |
| Re-entrant | Safe to call more than once: the second call does no harm. |
| Platform | vLLM’s word for a hardware backend: the class that knows how to run on CUDA, ROCm, a TPU, a CPU and so on. |
spawn | A way of starting a child process that begins with a fresh Python interpreter, inheriting none of the parent’s imports or state (3.e). |
| Qualified name | A dotted path to a class or function, such as my_pkg.model:MyModel, which can be imported later. |
1. What is it?#
You rarely need to fork vLLM to change it. Almost every component in these modules has a registered replacement mechanism: models, hardware platforms, attention backends, the scheduler class, logits processors, tool and reasoning parsers, LoRA resolvers, KV connectors, speculative proposers, metrics loggers and HTTP routes.
They come in two styles:
- Entry-point plugins: Python packages that vLLM discovers and loads automatically, in every process that needs them.
- Named classes: passed by qualified name on the command line or in a config.
The same mechanism is how vLLM runs on hardware the core repository does not ship: a platform plugin supplies the bottom layer for a new device. Facts checked on 12 November 2026 against vLLM v0.32.0.
flowchart TB PKG[":python: <b>Your package</b><br/><small>pip install my-vllm-plugin</small>"] -->|"entry_points"| DISC[":i-search: <b>Discovery</b><br/><small>load_plugins_by_group()</small>"] DISC --> API[":vllm: API server"] DISC --> CORE[":vllm: Engine core"] DISC --> WK[":vllm: Each worker"] API --> R1["routes, parsers,<br/>LoRA resolvers, stat loggers"] CORE --> R2["scheduler class,<br/>KV connector (scheduler side)"] WK --> R3["model classes, platform,<br/>logits processors, proposer,<br/>KV connector (worker side)"] class PKG neutral class DISC queue class API,CORE,WK compute class R1,R2,R3 memory
2. Why does it exist?#
vLLM releases roughly every two weeks (19.h). A private fork must be rebased onto every release, and the core files change by thousands of lines between them. A plugin that uses only documented registration functions survives most upgrades untouched. Plugins also let hardware vendors ship support on their own schedule, in their own repository, without the core project carrying code it cannot test.
3. Simple analogy#
A power strip. vLLM is the strip with labelled sockets: “model”, “platform”, “parser”, “connector”. A plugin is an appliance with the right plug. You do not rewire the strip to add a lamp. The label matters: a kettle in the “phone charger” socket does nothing useful, and some sockets (endpoint plugins) are covered until you deliberately open them.
4. Tiny example: an out-of-tree model in six lines#
# setup.py
setup(
name="vllm_add_dummy_model",
packages=["vllm_add_dummy_model"],
entry_points={
"vllm.general_plugins": ["register_dummy_model = vllm_add_dummy_model:register"]
},
)
# vllm_add_dummy_model/__init__.py
def register():
from vllm import ModelRegistry
if "MyLlava" not in ModelRegistry.get_supported_archs():
ModelRegistry.register_model("MyLlava", "vllm_add_dummy_model.my_llava:MyLlava")pip install the package and vllm serve a checkpoint whose config.json says
"architectures": ["MyLlava"]. No flag is required.
5. Technical explanation#
Why plugins load in every process#
A vLLM server is several processes (16.d), and with the spawn start method a child does not
inherit the parent’s Python state. A model registered only in the process you launched would be
unknown to the worker that must build it. So each process loads plugins for itself;
EngineCore.__init__, for example, calls load_general_plugins().
The design document’s one hard rule follows: the registered function must be re-entrant, “because the function might be called multiple times in some processes.” In the example:
- The
if … not inguard is re-entrancy in practice. - The model is registered by a string path, not by importing the class. The import happens lazily in the process that needs it, which keeps startup fast and keeps GPU code out of processes with no GPU.
VLLM_PLUGINSfilters by plugin name: a comma-separated allow-list. Use it to bisect when an installed plugin is suspected of breaking startup. Set to an empty string, it loads none.
The plugin groups#
| Group | Loaded in | Purpose |
|---|---|---|
vllm.general_plugins | Every process | Anything; usually registering out-of-tree models, LoRA resolvers or custom ops |
vllm.platform_plugins | Every process | A hardware platform. Returns the platform class’s qualified name, or None if this machine is not that platform. |
vllm.logits_processors | Where sampling runs | Batch-level logits processor classes, loaded automatically |
vllm.io_processor_plugins | API server | Pre- and post-processing for pooling models |
vllm.stat_logger_plugins | API server | A custom metrics logger, a subclass of StatLoggerBase |
vllm.endpoint_plugins | API server only, not by default | Extra HTTP routes. Loaded only when named in VLLM_PLUGINS, because new routes widen the attack surface. |
Hardware backends: platform plugins#
vLLM ships five built-in platforms in vllm/platforms/: CUDA, ROCm, XPU (Intel
GPUs), CPU (x86, Arm, PowerPC, s390x) and TPU, the last a thin shim that loads Google’s
separate tpu-inference package. Everything else is out of tree. The README lists “Google TPUs,
Intel Gaudi, IBM Spyre, Huawei Ascend, Rebellions NPU, Apple Silicon, MetaX GPU, and more”;
several live in the vLLM organisation (vllm-ascend, vllm-gaudi, vllm-spyre, vllm-metal,
vllm-neuron, tpu-inference) with their own release numbers that track vLLM’s.
How the platform is chosen. At import, resolve_current_platform_cls_qualname() calls every
built-in detector and every installed platform plugin. If exactly one out-of-tree plugin
activates, it wins, even on a machine where CUDA is also detected. Two activated OOT plugins is an
error. This is why a platform plugin must return None, not raise, on a machine that is not its
hardware.
What a platform plugin supplies. The design guide’s checklist:
| Piece | Base class | Does |
|---|---|---|
| Platform | vllm.platforms.interface.Platform (_enum = PlatformEnum.OOT) | Device type and name; check_and_update_config sets the worker class, block size and graph mode early in start-up |
| Worker | WorkerBase | init_device, load_model, determine_available_memory, initialize_from_config, execute_model; optionally sleep, LoRA, speculative and DP dummy batches |
| Attention backend | AttentionBackend | Attention on this device’s KV cache layout (18.c); v0.32.0 lets one OOT platform register several |
| Device communicator | DeviceCommunicatorBase | All-reduce, all-gather and friends for TP/EP (19.a) |
| Custom ops | CustomOp out-of-tree registration, or C++ torch ops | Fast versions of RMSNorm, rotary embedding, activation and so on |
Everything above that layer — scheduler, KV cache manager, API server — is reused unchanged. That is the payoff of vLLM’s layering: a new chip needs a worker and kernels, not a new engine.
Named-class extension points#
Selected by configuration rather than discovered:
| Extension | How to select | Interface | Lesson |
|---|---|---|---|
| Scheduler | --scheduler-cls my.module.MyScheduler | Subclass AsyncScheduler (subclassing plain Scheduler disables async scheduling) | 17.d |
| Logits processor | --logits-processors my.module:MyProc (or the entry-point group) | Batch-level processor with an update_state hook | 18.e |
| Tool parser | --tool-parser-plugin file.py + --tool-call-parser name | Extract calls from text and from a stream | 18.i |
| Reasoning parser | --reasoning-parser-plugin file.py + --reasoning-parser name | Split reasoning from content | 18.i |
| LoRA resolver | Registered with LoRAResolverRegistry from a general plugin; needs VLLM_ALLOW_RUNTIME_LORA_UPDATING | Given an unknown adapter name, return an adapter or nothing | 18.g |
| KV connector | --kv-transfer-config '{"kv_connector": …, "kv_connector_module_path": …}' | KVConnectorBase_V1, both halves | 19.b |
| Speculative proposer | --speculative-config '{"method": "custom_class", "model": "my.module.MyProposer"}' | A proposer class | 18.f |
| Attention backend | --attention-backend CUSTOM with a registered class | AttentionBackend | 18.c |
| Chat template | --chat-template file.jinja | Jinja2 | 16.e |
How stable are these interfaces?#
Not equally, and the project says so in different ways.
- Covered by the deprecation policy: CLI flags, environment variables, the HTTP API and the public Python API. A feature is marked deprecated with its removal version, then disabled by default, then removed, across minor releases.
- Guaranteed registration points: the plugin design page promises that documented functions
such as
ModelRegistry.register_modelstay available, while making plugin authors responsible for compatibility of what they register. - Explicitly unstable: the scheduler. Selecting a custom class logs: “This scheduler
interface is not public and compatibility may not be maintained.”
AsyncLLM’s docstring says “PLEASE BE AWARE THAT STAT LOGGER IS NOT STABLE”. - In between: model, connector, platform and backend internals. Out-of-tree users exist, so breaking changes are usually announced, but they do change.
Choosing the lightest tool#
| You want to… | Use | Not |
|---|---|---|
| Serve an architecture vLLM lacks | A general plugin registering the model (19.g) | A fork |
| Run on a new accelerator | A platform plugin | Patching cuda.py |
| Change how a known model formats tool calls | A tool-parser plugin | Editing the built-in parser |
| Ban or boost tokens per request | logit_bias, allowed-token lists, or a logits processor | Custom sampling code |
| Add an authentication check | A gateway in front | An endpoint plugin |
| Send metrics elsewhere | Scrape /metrics; a stat-logger plugin only if you must push | Patching the loggers |
| Load adapters on demand | A LoRA resolver | Runtime-loading endpoints on each replica |
| Prioritise some tenants | --scheduling-policy priority and a gateway that sets priority | A custom scheduler |
| Route by cached prefix | KV events and an external router | Anything inside vLLM |
Prefer configuration to plugins, plugins to custom classes, and anything to a fork.
6. Under the hood: a registry that is safe across processes#
The two properties that make plugin registration safe: it is re-entrant, and it stores a path to resolve later rather than the object itself.
// registry.go — a re-entrant, path-based plugin registry, loaded per process.
package main
import (
"fmt"
"sort"
"strings"
)
// registry maps an architecture name to the PATH of the class that implements it.
// Nothing is imported until someone asks for it.
type registry struct {
paths map[string]string
loaded map[string]bool
log []string
}
func newRegistry() *registry {
return ®istry{paths: map[string]string{}, loaded: map[string]bool{}}
}
// register is re-entrant: calling it again with the same name is a no-op.
func (r *registry) register(arch, path string) {
if _, ok := r.paths[arch]; ok {
r.log = append(r.log, " skip "+arch+": already registered")
return
}
r.paths[arch] = path
r.log = append(r.log, " register "+arch+" -> "+path)
}
// resolve "imports" the class the first time it is needed in this process.
func (r *registry) resolve(arch string) string {
path, ok := r.paths[arch]
if !ok {
return "error: unknown architecture " + arch
}
if !r.loaded[arch] {
r.loaded[arch] = true
return "import " + path + " (first use in this process)"
}
return "already imported"
}
type plugin struct {
name string
fn func(*registry)
}
// loadPlugins is what every vLLM process runs at startup.
// allow mirrors the VLLM_PLUGINS environment variable ("" = load all).
func loadPlugins(r *registry, plugins []plugin, allow string) {
allowed := map[string]bool{}
for _, n := range strings.Split(allow, ",") {
if n != "" {
allowed[n] = true
}
}
sort.Slice(plugins, func(i, j int) bool { return plugins[i].name < plugins[j].name })
for _, p := range plugins {
if len(allowed) > 0 && !allowed[p.name] {
r.log = append(r.log, " filtered out "+p.name)
continue
}
p.fn(r)
}
}
func main() {
plugins := []plugin{
{"register_dummy_model", func(r *registry) { r.register("MyLlava", "my_pkg.my_llava:MyLlava") }},
{"register_other", func(r *registry) { r.register("OtherLM", "other_pkg.model:OtherLM") }},
}
// Each process has its own registry: nothing is shared across spawn().
for _, proc := range []string{"APIServer", "EngineCore", "Worker_TP0"} {
r := newRegistry()
fmt.Println(proc)
loadPlugins(r, plugins, "")
loadPlugins(r, plugins, "") // some processes load twice; this must be harmless
for _, l := range r.log {
fmt.Println(l)
}
if strings.HasPrefix(proc, "Worker") {
fmt.Println(" build model:", r.resolve("MyLlava"))
} else {
fmt.Println(" (this process never imports the model class)")
}
fmt.Println()
}
r := newRegistry()
fmt.Println("with VLLM_PLUGINS=register_other")
loadPlugins(r, plugins, "register_other")
for _, l := range r.log {
fmt.Println(l)
}
fmt.Println(" build model:", r.resolve("MyLlava"))
}Output:
APIServer
register MyLlava -> my_pkg.my_llava:MyLlava
register OtherLM -> other_pkg.model:OtherLM
skip MyLlava: already registered
skip OtherLM: already registered
(this process never imports the model class)
EngineCore
register MyLlava -> my_pkg.my_llava:MyLlava
register OtherLM -> other_pkg.model:OtherLM
skip MyLlava: already registered
skip OtherLM: already registered
(this process never imports the model class)
Worker_TP0
register MyLlava -> my_pkg.my_llava:MyLlava
register OtherLM -> other_pkg.model:OtherLM
skip MyLlava: already registered
skip OtherLM: already registered
build model: import my_pkg.my_llava:MyLlava (first use in this process)
with VLLM_PLUGINS=register_other
filtered out register_dummy_model
register OtherLM -> other_pkg.model:OtherLM
build model: error: unknown architecture MyLlavaEvery process registers both plugins twice without harm; only the worker ever imports the model code. The last run shows the filter working, and the error you see if you filter out the plugin your model needs.
7. Performance implications#
- Plugins run in the hot path only if you put them there. A model or attention backend is the hot path; a resolver or stat logger is not. A slow logits processor runs every step, for every request in the batch.
- Import cost multiplies. A general plugin that imports heavy libraries at registration slows the start of every process. Register by path; import lazily.
- Platform plugins decide all kernel performance on their hardware. Check which features (CUDA graphs, FP8, prefix caching, speculative decoding) a given platform plugin supports before comparing it with CUDA.
8. Production implications#
- Pin versions together. A plugin built for vLLM 0.31 may break on 0.32. Pin both in your image and test the pair before upgrading.
- Inventory what is installed. Every installed general plugin runs in every process. Log the
“Available plugins for group” lines at start-up and set
VLLM_PLUGINSin production so a stray package cannot load. - Endpoint plugins are a security decision. They are off unless allow-listed; review them like any public route.
- Custom logits processors and speculative decoding. In v0.32.0 the classic model runner’s logits-processor loader raises “Custom logits processors are not supported when speculative decoding is enabled.” Test the combination on your runner before relying on it.
9. Common mistakes#
- A registration function with side effects (opening a socket, spawning a thread) that runs once per process, several times.
- Importing the model class at registration instead of registering a path.
- A platform plugin that raises on unsupported machines instead of returning
None. - Subclassing
Schedulerrather thanAsyncScheduler, silently losing async scheduling. - Writing an endpoint plugin for authentication, which belongs in a gateway.
- Forking for a change a flag or parser plugin could make.
10. Hands-on exercise#
- Run
registry.go. Remove the “already registered” guard so thatregisteroverwrites. Is the result still correct here? Describe a registration function for which double-calling would not be harmless. - With vLLM installed, run
python -c "from importlib.metadata import entry_points; print(entry_points(group='vllm.platform_plugins'))". Repeat forvllm.general_plugins. What is installed? - Write (on paper) the
registerfunction for a platform plugin that returnsNoneunless an environment variable is set. What happens if two such plugins both activate? - Read
vllm/platforms/cpu.py’scheck_and_update_config. List three settings it changes.
11. Interview questions#
- Why must a plugin’s registration function be safe to call more than once?
- Why does
ModelRegistry.register_modeltake a string path instead of the class? - How does vLLM decide which platform to use when a machine has an NVIDIA GPU and an out-of-tree platform plugin is also installed?
- What must a platform plugin implement, and what does it get to reuse unchanged?
- You need per-tenant priority. Which extension mechanism do you reach for first, and which last?
12. Further reading#
Checked on 12 November 2026 against vLLM v0.32.0.
- Plugin system (design) — groups, re-entrancy, platform plugin guide
- Endpoint plugins
- LoRA resolver plugins
- IO processor plugins
- Deprecation policy
vllm/plugins/__init__.py— discovery andVLLM_PLUGINSvllm/platforms/__init__.py— platform detection and precedencevllm/config/scheduler.py— the custom scheduler warning- vllm-ascend, tpu-inference, vllm-gaudi — out-of-tree hardware platforms