nano-vllm README

The project's README from github.com/GeeeekExplorer/nano-vllm. As one markdown file: README.md.

GeeeekExplorer%2Fnano-vllm | Trendshift

Nano-vLLM

A lightweight vLLM implementation built from scratch.

Key Features

Installation

pip install git+https://github.com/GeeeekExplorer/nano-vllm.git

Model Download

To download the model weights manually, use the following command:

huggingface-cli download --resume-download Qwen/Qwen3-0.6B \
  --local-dir ~/huggingface/Qwen3-0.6B/ \
  --local-dir-use-symlinks False

Quick Start

See example.py for usage. The API mirrors vLLM's interface with minor differences in the LLM.generate method:

from nanovllm import LLM, SamplingParams
llm = LLM("/YOUR/MODEL/PATH", enforce_eager=True, tensor_parallel_size=1)
sampling_params = SamplingParams(temperature=0.6, max_tokens=256)
prompts = ["Hello, Nano-vLLM."]
outputs = llm.generate(prompts, sampling_params)
outputs[0]["text"]

Benchmark

See bench.py for benchmark.

Test Configuration:

Performance Results:

Inference Engine Output Tokens Time (s) Throughput (tokens/s)
vLLM 133,966 98.37 1361.84
Nano-vLLM 133,966 93.41 1434.13

Star History

Star History Chart

nano-vllm (GeeeekExplorer/nano-vllm)

transformer
Searching Database…

15.9K ·GitHub
What is this?Nano-vLLM is a lightweight, from-scratch reimplementation of the vLLM inference engine for running large language models, built in roughly 1,200 lines of readable Python.
Is this a standalone server or a library I call from my own code?It is a Python library: you create an LLM object and call generate() in your own script, mirroring vLLM's interface almost exactly.
How do I get it running?Install the package following the README's Installation section, download the model weights manually with the command given under Model Download, then run example.py to see a working generate() call.
Do I need a CUDA GPU to run this?Yes - it relies on Tensor Parallelism and CUDA graph capture for speed, and its own benchmark was run on an NVIDIA RTX 4070 Laptop GPU.
How does it actually compare to full vLLM?In the project's own benchmark with a Qwen3-0.6B model and 256 requests, Nano-vLLM reached 1434 tokens/s versus vLLM's 1362 tokens/s, so it matches or slightly beats vLLM despite being a tiny fraction of the code.
What optimizations does Nano-vLLM include out of the box?It implements prefix caching, tensor parallelism, torch compilation, and CUDA graph capture to speed up inference.
Why would someone pick Nano-vLLM over regular vLLM?It delivers comparable or slightly better throughput while being readable and hackable at only about 1,200 lines of Python, versus vLLM's much larger codebase.
What model and setup was used for its benchmark?The README benchmarks it with a Qwen3-0.6B model on an RTX 4070 Laptop GPU (8GB), running 256 requests with input and output lengths randomly sampled between 100 and 1024 tokens.
Size
0.5 MB
Stars
15.9K
Updated
CommitApr 26
Age
1y
Commits · 90 Days