https://github.com/GeeeekExplorer/nano-vllm
Nano vLLM
https://github.com/GeeeekExplorer/nano-vllm
Last synced: over 1 year ago
JSON representation
Nano vLLM
- Host: GitHub
- URL: https://github.com/GeeeekExplorer/nano-vllm
- Owner: GeeeekExplorer
- License: mit
- Created: 2025-06-09T16:22:14.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2025-06-27T10:51:00.000Z (over 1 year ago)
- Last Synced: 2025-06-27T11:44:38.920Z (over 1 year ago)
- Language: Python
- Homepage:
- Size: 34.2 KB
- Stars: 4,266
- Watchers: 43
- Forks: 473
- Open Issues: 18
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-python - GeeeekExplorer/nano-vllm - Nano vLLM (Other / Scientific Computing)
- awesome-cuda-and-hpc - Nano-vLLM - <img src="https://img.shields.io/github/stars/GeeeekExplorer/nano-vllm?style=social"/> : A lightweight vLLM implementation built from scratch. (Frameworks / CUDA Frameworks)
- awesome-llm-and-aigc - Nano-vLLM - <img src="https://img.shields.io/github/stars/GeeeekExplorer/nano-vllm?style=social"/> : A lightweight vLLM implementation built from scratch. (Summary / Frameworks)
- AiTreasureBox - GeeeekExplorer/nano-vllm - 11-02_7547_140](https://img.shields.io/github/stars/GeeeekExplorer/nano-vllm.svg)|Nano vLLM| (Repos)
- awesome - GeeeekExplorer/nano-vllm - Nano vLLM (Python)
- awesome-local-llm - Nano-vLLM - a lightweight vLLM implementation built from scratch (Inference engines)
- awesome-production-machine-learning - nano-vllm - vllm.svg?cacheSeconds=86400) - nano-vllm is a lightweight vLLM implementation built from scratch, providing fast offline inference with optimization techniques such as prefix caching, tensor parallelism, and CUDA graph. (Deployment and Serving)
- awesome-LLM-resources - https://github.com/GeeeekExplorer/nano-vllm
- awesome-ai-agent-stack - GeeeekExplorer/nano-vllm - Minimal from-scratch reimplementation of vLLM for learning how it works. (Learning Path)
- github-ultimate-repos - GeeeekExplorer/nano-vllm - | ⭐ 16,117★ | 🍴 2,777 | 💻 `Python`🔗 <https://github.com/GeeeekExplorer/nano-vllm>📝 Nano vLLM⚙️ `Continuous iteration-level batching -> PagedAttention virtual block table allocation -> chunked prefill tensor parallel forward pass -> streaming token delivery.` (📜 Master Categorized Repository Directory (100% Clickable Links) / [02] ARTIFICIAL INTELLIGENCE, LARGE LANGUAGE MODELS, FOUNDATION MODELS & QUANTIZATION)
- awesome-llm-tools - Nano-vLLM
- awesome-llm - GeeeekExplorer/nano-vllm - Nano vLLM (Machine Learning and AI / LLM and Inference)
- awesome-opensource-ai - nano-vLLM - Minimalist vLLM implementation in \~1,200 lines of Python. Educational yet performant with prefix caching, tensor parallelism, and CUDA graph acceleration. Comparable inference speeds to full vLLM. MIT licensed.  (3. Inference Engines & Serving)
- awesome-ai-200 - GeeeekExplorer/nano-vllm
README
# Nano-vLLM
A lightweight vLLM implementation built from scratch.
## Key Features
* 🚀 **Fast offline inference** - Comparable inference speeds to vLLM
* 📖 **Readable codebase** - Clean implementation in ~ 1,200 lines of Python code
* ⚡ **Optimization Suite** - Prefix caching, Tensor Parallelism, Torch compilation, CUDA graph, etc.
## Installation
```bash
pip install git+https://github.com/GeeeekExplorer/nano-vllm.git
```
## Manual Download
If you prefer to download the model weights manually, use the following command:
```bash
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:
```python
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:**
- Hardware: RTX 4070 Laptop (8GB)
- Model: Qwen3-0.6B
- Total Requests: 256 sequences
- Input Length: Randomly sampled between 100–1024 tokens
- Output Length: Randomly sampled between 100–1024 tokens
**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
[](https://www.star-history.com/#GeeeekExplorer/nano-vllm&Date)