Skip to content

Aleph-Alpha/vllm

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

vLLM + HAT

🤗 Hugging Face   |   📑 HAT ICLR25 Paper    |    📑 Upcoming Research Paper

This branch provides a batched inference implementation of HAT (Hierarchical Autoregressive Transformer). This fork integrates HAT into vLLM v1 so you can run or serve HAT models with the same low-latency engine you know from vLLM. HAT wraps a standard Llama-style word-level transformer (referred to as the backbone) with two small byte-level modules: an encoder and a decoder. For a comprehensive architectural and training deep-dive, including a closer look at each component discussed below, an accompanying research paper will soon be released; which will also provide more information on the challenges behind batched inference for such a model.

The encoder processes the input text as raw UTF-8 bytes, and produces a sequence of activations of the same length. The splitter is then in charge of splitting this text into words or semantically meaningful chunks. In the encoder connector layer, for each word, a learned latent vector attends to the encoder activations of the bytes which compose the word. The backbone then processes this word-level sequence to produce a sequence of word-level representations which guide the decoding process. Thus, to generate bytes auto-regressively, the decoder uses the encoder activations of the current word and the word-level representation of the previous word.

Next Steps:

  • Currently, our CUDA graph implementation for HAT is still based on the vLLM v0 approach. When PR 20059 gets merged, we will update our implementation and perform an upstream MR to vLLM.


Environment Setup

1. Prerequisites

  • GPU: NVIDIA GPU
  • Python: 3.12.

2. Clone and install

git clone <this-repository> vllm-hat
cd vllm-hat

# Create and activate a 3.12 virtual env
uv venv -p 3.12
source .venv/bin/activate

# Tell vLLM to skip local compilation and use prebuilt CUDA wheels
export VLLM_USE_PRECOMPILED=1

# Finally, install in editable mode
uv pip install -e .


Using HAT

Points to keep in mind

  • If you want to test out the 70B model, please make sure to specify tensor parallel size. If testing on GPUs with 80GB VRAM, we recommend setting tensor parallel size to 4.
  • Currently, HAT only works with Flash Attention 2. Thus, if testing this model on Hopper architecture or newer, please make sure to export the environment variable VLLM_FLASH_ATTN_VERSION = 2.

These are the available HAT models:

  • Aleph-Alpha/llama-tfree-hat-pretrained-7b-dpo
  • Aleph-Alpha/tfree-hat-pretrained-7b-base
  • Aleph-Alpha/llama-3_1-8b-tfree-hat-dpo
  • Aleph-Alpha/llama-3_1-8b-tfree-hat-sft
  • Aleph-Alpha/llama-3_1-8b-tfree-hat-base
  • Aleph-Alpha/llama-3_1-70b-tfree-hat-sft

Offline Inference

We have included an example script to run offline inference.

python hat_scripts/hat_offline_inference.py [OPTIONS]

Optional Parameters:

  • --model - Path to the HAT model (default: Aleph-Alpha/llama-tfree-hat-pretrained-7b-dpo)
  • --batch-size - Batch size for inference (default: 16)
  • --max-bytes-per-req - Output bytes (default: 1000)
  • --tensor-parallel-size - Tensor parallelism size (default: 1)

Serving Scenario (OpenAI-compatible API)

Starting the server

vllm serve [MODEL] [OPTIONS]

Example:

vllm serve "Aleph-Alpha/llama-tfree-hat-pretrained-7b-dpo" \
  --trust-remote-code \
  --dtype bfloat16 \
  --compilation-config '{"full_cuda_graph": true, "level": 0}'
  --max-num-batched-tokens 100000 \
  --tensor-parallel-size 1 \
  --gpu-memory-utilization 0.9 \

Required Options:

  • --trust-remote-code - Required for HAT models
  • --dtype bfloat16 - Required data type for HAT models
  • --compilation-config '{"full_cuda_graph": true, "level": 0}' - Required compilation settings for HAT models

Optional Parameters:

  • --max-num-batched-tokens - Maximum number of batched tokens (default: varies)
  • --tensor-parallel-size - Tensor parallelism size (default: 1)
  • --gpu-memory-utilization - GPU memory utilization fraction (default: 0.9)

Sending requests

Any OpenAI-compatible client works (curl, python, etc.). For convenience, we include a script that asynchronously sends multiple requests to the server:

python hat_scripts/send_async_prompts.py [OPTIONS]

Optional Parameters:

  • --api-url - URL of the OpenAI-compatible chat completions API endpoint (default: http://localhost:8000/v1/chat/completions)
  • --num-concurrent-requests - Number of concurrent requests to send (default: 16)
  • --max-bytes-per-req - Output bytes (default: 1000)




vLLM

Easy, fast, and cheap LLM serving for everyone

| Documentation | Blog | Paper | Twitter/X | User Forum | Developer Slack |


Latest News 🔥

  • [2025/05] We hosted NYC vLLM Meetup! Please find the meetup slides here.
  • [2025/05] vLLM is now a hosted project under PyTorch Foundation! Please find the announcement here.
  • [2025/04] We hosted Asia Developer Day! Please find the meetup slides from the vLLM team here.
  • [2025/01] We are excited to announce the alpha release of vLLM V1: A major architectural upgrade with 1.7x speedup! Clean code, optimized execution loop, zero-overhead prefix caching, enhanced multimodal support, and more. Please check out our blog post here.
Previous News
  • [2025/03] We hosted vLLM x Ollama Inference Night! Please find the meetup slides from the vLLM team here.
  • [2025/03] We hosted the first vLLM China Meetup! Please find the meetup slides from vLLM team here.
  • [2025/03] We hosted the East Coast vLLM Meetup! Please find the meetup slides here.
  • [2025/02] We hosted the ninth vLLM meetup with Meta! Please find the meetup slides from vLLM team here and AMD here. The slides from Meta will not be posted.
  • [2025/01] We hosted the eighth vLLM meetup with Google Cloud! Please find the meetup slides from vLLM team here, and Google Cloud team here.
  • [2024/12] vLLM joins pytorch ecosystem! Easy, Fast, and Cheap LLM Serving for Everyone!
  • [2024/11] We hosted the seventh vLLM meetup with Snowflake! Please find the meetup slides from vLLM team here, and Snowflake team here.
  • [2024/10] We have just created a developer slack (slack.vllm.ai) focusing on coordinating contributions and discussing features. Please feel free to join us there!
  • [2024/10] Ray Summit 2024 held a special track for vLLM! Please find the opening talk slides from the vLLM team here. Learn more from the talks from other vLLM contributors and users!
  • [2024/09] We hosted the sixth vLLM meetup with NVIDIA! Please find the meetup slides here.
  • [2024/07] We hosted the fifth vLLM meetup with AWS! Please find the meetup slides here.
  • [2024/07] In partnership with Meta, vLLM officially supports Llama 3.1 with FP8 quantization and pipeline parallelism! Please check out our blog post here.
  • [2024/06] We hosted the fourth vLLM meetup with Cloudflare and BentoML! Please find the meetup slides here.
  • [2024/04] We hosted the third vLLM meetup with Roblox! Please find the meetup slides here.
  • [2024/01] We hosted the second vLLM meetup with IBM! Please find the meetup slides here.
  • [2023/10] We hosted the first vLLM meetup with a16z! Please find the meetup slides here.
  • [2023/08] We would like to express our sincere gratitude to Andreessen Horowitz (a16z) for providing a generous grant to support the open-source development and research of vLLM.
  • [2023/06] We officially released vLLM! FastChat-vLLM integration has powered LMSYS Vicuna and Chatbot Arena since mid-April. Check out our blog post.

About

vLLM is a fast and easy-to-use library for LLM inference and serving.

Originally developed in the Sky Computing Lab at UC Berkeley, vLLM has evolved into a community-driven project with contributions from both academia and industry.

vLLM is fast with:

  • State-of-the-art serving throughput
  • Efficient management of attention key and value memory with PagedAttention
  • Continuous batching of incoming requests
  • Fast model execution with CUDA/HIP graph
  • Quantizations: GPTQ, AWQ, AutoRound, INT4, INT8, and FP8
  • Optimized CUDA kernels, including integration with FlashAttention and FlashInfer
  • Speculative decoding
  • Chunked prefill

Performance benchmark: We include a performance benchmark at the end of our blog post. It compares the performance of vLLM against other LLM serving engines (TensorRT-LLM, SGLang and LMDeploy). The implementation is under nightly-benchmarks folder and you can reproduce this benchmark using our one-click runnable script.

vLLM is flexible and easy to use with:

  • Seamless integration with popular Hugging Face models
  • High-throughput serving with various decoding algorithms, including parallel sampling, beam search, and more
  • Tensor, pipeline, data and expert parallelism support for distributed inference
  • Streaming outputs
  • OpenAI-compatible API server
  • Support NVIDIA GPUs, AMD CPUs and GPUs, Intel CPUs and GPUs, PowerPC CPUs, TPU, and AWS Neuron
  • Prefix caching support
  • Multi-LoRA support

vLLM seamlessly supports most popular open-source models on HuggingFace, including:

  • Transformer-like LLMs (e.g., Llama)
  • Mixture-of-Expert LLMs (e.g., Mixtral, Deepseek-V2 and V3)
  • Embedding Models (e.g., E5-Mistral)
  • Multi-modal LLMs (e.g., LLaVA)

Find the full list of supported models here.

Getting Started

Install vLLM with pip or from source:

pip install vllm

Visit our documentation to learn more.

Contributing

We welcome and value any contributions and collaborations. Please check out Contributing to vLLM for how to get involved.

Sponsors

vLLM is a community project. Our compute resources for development and testing are supported by the following organizations. Thank you for your support!

Cash Donations:

  • a16z
  • Dropbox
  • Sequoia Capital
  • Skywork AI
  • ZhenFund

Compute Resources:

  • AMD
  • Anyscale
  • AWS
  • Crusoe Cloud
  • Databricks
  • DeepInfra
  • Google Cloud
  • Intel
  • Lambda Lab
  • Nebius
  • Novita AI
  • NVIDIA
  • Replicate
  • Roblox
  • RunPod
  • Trainy
  • UC Berkeley
  • UC San Diego

Slack Sponsor: Anyscale

We also have an official fundraising venue through OpenCollective. We plan to use the fund to support the development, maintenance, and adoption of vLLM.

Citation

If you use vLLM for your research, please cite our paper:

@inproceedings{kwon2023efficient,
  title={Efficient Memory Management for Large Language Model Serving with PagedAttention},
  author={Woosuk Kwon and Zhuohan Li and Siyuan Zhuang and Ying Sheng and Lianmin Zheng and Cody Hao Yu and Joseph E. Gonzalez and Hao Zhang and Ion Stoica},
  booktitle={Proceedings of the ACM SIGOPS 29th Symposium on Operating Systems Principles},
  year={2023}
}

Contact Us

  • For technical questions and feature requests, please use GitHub Issues or Discussions
  • For discussing with fellow users, please use the vLLM Forum
  • For coordinating contributions and development, please use Slack
  • For security disclosures, please use GitHub's Security Advisories feature
  • For collaborations and partnerships, please contact us at [email protected]

Media Kit

About

A high-throughput and memory-efficient inference and serving engine for LLMs

Resources

License

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 85.6%
  • Cuda 8.6%
  • C++ 4.3%
  • Shell 0.7%
  • C 0.4%
  • CMake 0.3%
  • Other 0.1%