Skip to main content

vLLM Beam Search Plugin

MRV2 beam-search scheduler and sampler plugin for vLLM V1.

This package provides:

  • vllm_beam_search.scheduler.BeamSearchScheduler
  • plugin-local sequence, token, and KV admission for complete beam groups
  • an MRV2 custom sampler wrapper installed through a plugin-local ModelState hook
  • plugin-local runtime hooks for MRV2 worker history rewrites

The current production path targets MRV2 generate models with async scheduling. The sampler hook is model-state generic; BART-family models still need the companion vllm-bart-plugin for encoder-decoder model support.

The plugin does not require a vLLM fork or source patch. It carries explicit plugin-local scheduler implementations for vLLM 0.24.0, 0.26.0, and the tested 0.26.1 development build. Startup fails closed on an unsupported scheduler. Each vendored scheduler has an adjacent .diff recording its exact changes from the hashed upstream Scheduler.schedule; the test suite verifies both.

The Git repository, installable Python distribution, and PyPI project are named vllm-beam-search-plugin; the import package is vllm_beam_search.

For BART-family encoder-decoder serving, see BART_BEAM_SEARCH.md.

Install

The distribution is currently installed from Git rather than PyPI. Pin the Git reference in reproducible builds:

uv pip install \
  'vllm-beam-search-plugin @ git+https://github.com/neuralmagic/vllm-beam-search-plugin.git@v0.1.0'

The plugin metadata constrains its tested NumPy, PyTorch, and Triton API ranges. vLLM remains the owner of their accelerator-specific builds. In a prebuilt RHAII 3.5 image, preserve the image runtime and install only the pure-Python plugin:

uv pip install --no-deps \
  'vllm-beam-search-plugin @ git+https://github.com/neuralmagic/vllm-beam-search-plugin.git@v0.1.0'

The vLLM 0.24.0 path has been unit-, correctness-, concurrency-, and sustained memory-tested. It selects vendored_scheduler_v024.schedule_v024 directly; it does not use inspect.getsource, source-text matching, or runtime exec.

For stress tooling:

uv pip install -e '.[stress]'

Server

MODEL=${MODEL:-meta-llama/Meta-Llama-3-8B-Instruct}
SERVED_MODEL=${SERVED_MODEL:-llama3-8b}

CUDA_VISIBLE_DEVICES=0 \
VLLM_USE_FLASHINFER_SAMPLER=0 \
vllm serve "${MODEL}" \
  --served-model-name "${SERVED_MODEL}" \
  --dtype bfloat16 \
  --port 8005 \
  --scheduler-cls vllm_beam_search.scheduler.BeamSearchScheduler \
  --async-scheduling

Request Shape

{
  "model": "llama3-8b",
  "prompt": "Write a concise summary of why beam search is useful:",
  "max_tokens": 128,
  "temperature": 0,
  "add_special_tokens": false,
  "vllm_xargs": {
    "beam_width": 4,
    "no_repeat_ngram_size": 3
  }
}

Validation

Run unit tests:

uv run --with pytest python -m pytest tests -q

Run sustained stress plus memory sampling against a running server:

vllm-beam-stress \
  --base-url http://localhost:8005 \
  --model llama3-8b \
  --rounds 100 \
  --requests-per-round 32 \
  --concurrency 64 \
  --abort-rounds 3

The stress tool writes CSV samples with request count, RSS, and GPU memory.

Runtime Knobs

  • VLLM_BEAM_GROUP_STATE_CAPACITY controls GPU beam-state pool capacity.
  • VLLM_BEAM_TRANSITION_BUFFER_SLOTS controls async transition buffer slots.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

vllm_beam_search_plugin-0.1.0.tar.gz (70.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

vllm_beam_search_plugin-0.1.0-py3-none-any.whl (66.1 kB view details)

Uploaded Python 3

File details

Details for the file vllm_beam_search_plugin-0.1.0.tar.gz.

File metadata

  • Download URL: vllm_beam_search_plugin-0.1.0.tar.gz
  • Upload date:
  • Size: 70.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.12.5 {"installer":{"name":"uv","version":"0.12.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for vllm_beam_search_plugin-0.1.0.tar.gz
Algorithm Hash digest
SHA256 d5666687d447132665a7edd2e8863de3bcf555b49b18dc4ffa39f56662094a86
MD5 be74f3f3cf461766e26d532a259ee53a
BLAKE2b-256 0a20d56c4c209e4bad1d6a31b88e59e697f02b717157282031457df82a35a86a

See more details on using hashes here.

File details

Details for the file vllm_beam_search_plugin-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: vllm_beam_search_plugin-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 66.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.12.5 {"installer":{"name":"uv","version":"0.12.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for vllm_beam_search_plugin-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 daf259721464c5aa262980cf5285d33c7239c55835a20c7ce6f4d446a6f2d5d1
MD5 746c9e6047fef74954216c728b16745c
BLAKE2b-256 e9fcf31641b61b1a855c22ac242b8f1ae72a28eb5718f9a14850b5c1761a007f

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page