Skip to content

About

Tenstorrent backend plugin for vLLM.

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

11 stars

Watchers

1 watching

Forks

vLLM TT Plugin

Tenstorrent backend plugin for vLLM.

vllm-tt-plugin integrates Tenstorrent hardware into vLLM using the standard plugin mechanism. Install it alongside vLLM and, when ttnn is importable (see TT-Metal), TT hardware is automatically available as a vLLM platform.

The plugin is self-contained: model registration, platform detection, request validation, scheduling, worker execution, model loading, async decode, single- process standard and multi-lane execution, data-parallel execution all live here. Nothing TT-specific needs to touch vLLM core.

For model authors, the model-plugin interface documents registration, construction, KV storage, execution, and lifecycle, and links to the capability, speculative-decode, and input-reload contracts.

Package Layout

.
+-- src/vllm_tt_plugin/
|   +-- entrypoints.py       # vLLM plugin entry points
|   +-- exceptions.py        # Shared plugin exception categories
|   +-- platform.py          # TTPlatform and config validation
|   +-- model_registry.py    # TT model architecture registration
|   +-- worker.py            # TT worker implementation
|   +-- model_runner.py      # TT model execution bridge
|   +-- scheduler.py         # TT scheduling policy
|   +-- lane_scheduler.py    # Single-process multi-lane (lane-DP) coordinator
|   +-- launcher.py          # retained tt-run / MPI launcher (not hooked by vLLM 0.33.0)
|   +-- loader.py            # TT model loader
|   +-- input_batch.py       # TT input-batch representation
|   +-- async_decode.py      # Decode overlap helpers
|   +-- config.py            # TT plugin config access
|   +-- spec_admission.py    # Speculative configuration and model-plan validation
|   +-- spec_decode.py       # Candidate/verification types and greedy acceptance
|   +-- spec_accept.py       # Host sampled acceptance for the logits accept mode
|   +-- sample/              # Host sampler, its ops, and host logits processors
|   +-- parsers/             # Model-output adapters and lazy parser registration
|   +-- utils/               # Common helpers such as device discovery tools for DP
+-- docs/                    # Operator guides and model contracts; see docs/README.md
+-- examples/                # Offline and OpenAI-server examples
+-- tests/                   # Unit, integration, and legacy host tests; tests/tt for device tests

Requirements

If testing a specific model, check the TT-Metal LLMs table for the appropriate tt-metal and vLLM commits.

The plugin requires Python >=3.11,<3.14; vLLM 0.33.0 requires 3.11 or newer. tt-metal's Ubuntu 24.04 environment (Python 3.12) qualifies. The Ubuntu 22.04 default python3 (3.10) does not: on Python 3.10, use the compat/vllm-0.31.0 tag (vLLM 0.31.0) as described below.

The installation script builds vLLM 0.33.0 from source with VLLM_TARGET_DEVICE=empty.

To install against older supported vLLM versions X.Y.Z instead (e.g., 0.25.1), check out the compat/vllm-X.Y.Z tag (e.g., compat/vllm-0.25.1), the last plugin state that targets it, and follow the same steps. Nothing is maintained on top of that tag for now. Pair it with the tt-metal commit the LLMs table lists for it.

Installation

Install tt-metal, activate its environment, and from this repository's root source the install script, which installs vLLM and the plugin without replacing tt-metal's torch. The plugin is detected automatically when ttnn is importable. Installation covers dependency ownership, partial reinstalls, and how to verify plugin discovery.

source docs/install-vllm-tt.sh

Hugging Face Access

To run Meta Llama 3.1 or 3.2 models, request access on Hugging Face:

After access is approved, create an access token in Hugging Face settings and log in from Python:

from huggingface_hub import login

login()

Preparing TT-Metal Models

For the target model, follow any setup instructions in the corresponding tt-metal demo. For Llama 3.1, Llama 3.2, and Qwen 2.5 models, follow the ttt_compat demo instructions for weights and environment variables.

Serving

Set MESH_DEVICE to the target mesh and start the OpenAI-compatible server; examples/offline_inference_tt.py runs the same models offline. Serving lists per-model and per-mesh commands, vision requests, single-process Galaxy lanes, model-output parsers, and benchmarking.

MESH_DEVICE=T3K python examples/server_example_tt.py

Configuration

TT options go in vLLM's --additional-config under the tt key, for example --additional-config '{"tt": {"sample_on_device_mode": "all"}}'. Configuration lists the common options and covers device sampling and its default top-k, structured outputs, custom logits processors, fabric, chunked prefill, and how --max-model-len relates to KV cache capacity.

Supported Models

The plugin registers TT-prefixed architectures for Llama, Qwen, Mistral, Gemma, DiffusionGemma, DeepSeek V3, and GPT-OSS models backed by tt-metal. Supported models lists the families and explains how to add models with EXTRA_MODELS_DIR, select a serving class with TT_MODEL_CLASS_OVERRIDES, and serve experimental tt-transformers models.

Speculative Decoding

Speculative decoding runs with vLLM's ngram drafter or a model-owned custom_class drafter, on a tt-metal adapter that declares support. Speculative decoding covers accept modes, model selection, launch settings, and request limits.

Architecture

TTPlatform validates the configuration and selects TT's worker and scheduler. Each TT step is prefill-only or decode-only, and data parallelism runs either as in-process lanes or as standard multi-process ranks. Runtime architecture explains the execution model.

Operational Constraints

TTPlatform rejects or adjusts unsupported feature combinations early, giving a clear error before anything reaches the device:

  • Tensor parallel and pipeline parallel execution are provided by the models internal implementation, not exposed at the vLLM level.
  • Speculative decoding has adapter and request limits; see Speculative decoding.
  • LoRA is not currently supported.
  • Chunked prefill is gated on the model's declared capability; see Configuration.
  • Where chunked prefill is active, multimodal inputs are never split across a chunk boundary.
  • Prompt logprobs are rejected at request validation time.
  • Prefix caching is enabled only for models that declare TT support for it.
  • Async decode overlap is enabled only for models that declare the capability.
  • Multi-host MPI data parallelism is not supported.
  • vLLM's V1 model runner. The plugin implements only the V2 model-runner contract and pins VLLM_USE_V2_MODEL_RUNNER=1; any other value is refused.

These are TT runtime characteristics, not vLLM plugin API limitations.

Testing

The testing guide covers host-only setup, the unit, integration, stubbed-host, real-TTNN, doctest, and device commands, and the device-test options for reasoning models and GPT-OSS recall.

Host tests need no Tenstorrent hardware:

PYTHONPATH=tests/host-stubs "$VIRTUAL_ENV/bin/python" -m pytest tests/ --ignore=tests/tt

Device tests under tests/tt drive a running server. Start a vLLM server with a TT model, use the prepared tt-metal environment without host stubs, then run:

"$VIRTUAL_ENV/bin/python" -m pytest tests/tt -v \
  --tt-server-url=http://localhost:8000 \
  --tt-model-name=meta-llama/Llama-3.1-8B-Instruct

Documentation

docs/README.md indexes every guide and contract page, with its audience.

Contributing

Contributions are welcome! Bug reports and feature requests should be filed via GitHub Issues. Bug fixes and new functionality are submitted via pull requests. Pull requests are reviewed weekly. See CONTRIBUTING.md for details.

License

  • LICENSE: Overall license for this project (Apache 2.0), except where specified
  • LICENSE_understanding.txt: Tenstorrent's clarification of how the Apache 2.0 license applies to this repository

About

Tenstorrent backend plugin for vLLM.

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

11 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages