{"id":48524295,"url":"https://github.com/avarga1/vllm-hb","last_synced_at":"2026-04-07T22:00:27.283Z","repository":{"id":349689427,"uuid":"1203464962","full_name":"avarga1/vllm-hb","owner":"avarga1","description":"vLLM-compatible inference runtime in pure Rust. Zero Python. Zero libtorch. CUDA via candle.","archived":false,"fork":false,"pushed_at":"2026-04-07T21:18:49.000Z","size":223,"stargazers_count":0,"open_issues_count":4,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-04-07T22:00:16.639Z","etag":null,"topics":["candle","cuda","inference","llm","openai-api","rust","tokio","vllm"],"latest_commit_sha":null,"homepage":null,"language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/avarga1.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-04-07T04:09:58.000Z","updated_at":"2026-04-07T21:06:10.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/avarga1/vllm-hb","commit_stats":null,"previous_names":["avarga1/vllm-hb"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/avarga1/vllm-hb","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/avarga1%2Fvllm-hb","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/avarga1%2Fvllm-hb/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/avarga1%2Fvllm-hb/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/avarga1%2Fvllm-hb/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/avarga1","download_url":"https://codeload.github.com/avarga1/vllm-hb/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/avarga1%2Fvllm-hb/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31530647,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-07T16:28:08.000Z","status":"ssl_error","status_checked_at":"2026-04-07T16:28:06.951Z","response_time":105,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["candle","cuda","inference","llm","openai-api","rust","tokio","vllm"],"created_at":"2026-04-07T22:00:13.646Z","updated_at":"2026-04-07T22:00:27.272Z","avatar_url":"https://github.com/avarga1.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# vllm-hb\n\n**vLLM-compatible inference runtime in pure Rust.**  \nNo Python. No libtorch. No C++ interop. CUDA via [cudarc](https://github.com/coreylowman/cudarc).\n\n```\nvllm-hb serve --model /path/to/Llama-3.1-8B-Instruct --port 8000\n```\n\nDrop-in replacement for the vLLM OpenAI-compatible server. Any client that\ntalks to vLLM talks to vllm-hb.\n\n---\n\n## Why\n\nPython vLLM's scheduler runs under the GIL. At high concurrency the\nscheduling loop becomes the bottleneck — GC pauses, dynamic dispatch, and\nPython object overhead add up.\n\nvllm-hb rewrites the hot path in Rust:\n\n| Component | vLLM | vllm-hb |\n|---|---|---|\n| Scheduler | Python (GIL) | Rust (`parking_lot::Mutex`, zero-alloc hot path) |\n| Tokenizer | Python wrapper | Rust (`tokenizers` crate — the canonical HuggingFace impl) |\n| Model forward | Python → libtorch C++ | Rust → CUDA directly via `candle` |\n| HTTP server | Python (uvicorn) | Rust (`axum` + `tokio`) |\n| Runtime | CPython + pip | Single static binary |\n\n---\n\n## Features\n\n- **OpenAI-compatible API** — `/v1/chat/completions` (streaming + non-streaming), `/v1/models`, `/health`\n- **Streaming** — server-sent events, token-by-token\n- **Top-p + temperature sampling** — proper nucleus filtering with `rand`\n- **Auto chat template** — reads `tokenizer_config.json` and detects Llama-3 / ChatML / Mistral-v1\n- **Auto EOS tokens** — reads from `config.json`, no hardcoded token IDs\n- **Built-in benchmark** — `vllm-hb bench` measures TTFT, throughput, p50/p99\n\n---\n\n## Getting started\n\n### Requirements\n\n- Rust 1.75+ (`rustup install stable`)\n- CUDA 12.x toolkit (`nvcc` in PATH, or `CUDA_ROOT` set)\n- NVIDIA GPU (tested on V100, A100, RTX 4090)\n\n### Build\n\n```bash\ngit clone https://github.com/avarga1/vllm-hb\ncd vllm-hb\ncargo build --release\n```\n\nIf `nvcc` is not in your default PATH:\n\n```bash\nexport CUDA_ROOT=/path/to/cuda\nexport PATH=$CUDA_ROOT/bin:$PATH\ncargo build --release\n```\n\n### Run\n\n```bash\n# Serve a local HuggingFace model directory\n./target/release/vllm-hb serve \\\n  --model /models/Meta-Llama-3.1-8B-Instruct \\\n  --port 8000\n\n# Test it\ncurl http://localhost:8000/v1/chat/completions \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\n    \"model\": \"llama\",\n    \"messages\": [{\"role\": \"user\", \"content\": \"Hello!\"}],\n    \"max_tokens\": 64,\n    \"stream\": false\n  }'\n```\n\n### Benchmark\n\n```bash\n# Start the server first, then in another terminal:\n./target/release/vllm-hb bench \\\n  --base-url http://localhost:8000 \\\n  --n 100 \\\n  --max-tokens 128\n```\n\nExample output (NousResearch/Hermes-3-Llama-3.1-8B, NVIDIA V100 32GB, 50 requests, 128 tokens):\n\n```\n  vllm-hb benchmark\n  ─────────────────────────────────────\n  server     : http://localhost:8000\n  model      : Hermes-3-Llama-3.1-8B\n  requests   : 50\n  max_tokens : 128\n\n  Warmup complete. Running benchmark…\n\n  Results\n  ─────────────────────────────────────\n  throughput   : 37.0 tok/s\n  total tokens : 6400  (50 requests)\n\n  TTFT (time to first token)\n    mean       :  3459 ms\n    p50        :  3458 ms\n    p99        :  3468 ms\n\n  End-to-end latency\n    p50        :  3458 ms\n    p99        :  3468 ms\n```\n\n\u003e 37 tok/s ≈ 66 % of V100 HBM2 peak bandwidth utilised during single-sequence\n\u003e decode — no batching, no flash-attn. TTFT reflects full generation time in\n\u003e non-streaming mode; streaming TTFT (time to first token) is typically \u003c 200 ms.\n\n---\n\n## Supported models\n\nAny model in HuggingFace safetensors format with a supported architecture:\n\n| Family | Status |\n|---|---|\n| Meta Llama 3 / 3.1 / 3.2 | ✅ |\n| Mistral 7B / 7B-Instruct | ✅ |\n| Mixtral 8x7B / 8x22B | 🔜 planned |\n| Qwen 2.5 | 🔜 planned |\n| Microsoft Phi-3 | 🔜 planned |\n\n\u003e Additional architectures are gated only by candle-transformers model\n\u003e implementations — contributions welcome.\n\n---\n\n## Architecture\n\n```\nHTTP request\n    │\n    ▼\naxum handler          (src/server.rs)\n    │  tokenize + submit WorkItem\n    ▼\nWorkerHandle ──────► Worker task       (src/worker.rs)\n    │  unbounded channel    │\n    │                       │  prefill → decode loop\n    │                       │  sample() per step\n    │                       │\n    ◄───── GenerationEvent ◄┘  token stream back to handler\n    │\n    ▼\nSSE stream / JSON response\n```\n\nThe `Worker` owns the `Engine` (src/model.rs) and serialises GPU work.\nMultiple HTTP handlers can submit requests concurrently; the worker\nprocesses them in order, keeping the GPU saturated.\n\nSampling lives in `src/sampling.rs` — temperature scaling, softmax, and\ntop-p nucleus filtering are pure functions over a logit slice.\n\n---\n\n## Roadmap\n\n- [ ] Multi-sequence continuous batching (paged KV cache)\n- [ ] Tensor parallelism (multi-GPU)\n- [ ] Mistral / Qwen native architecture emitters  \n- [ ] `--dtype bf16` flag\n- [ ] Prometheus metrics endpoint\n- [ ] Docker image\n\n---\n\n## License\n\nApache 2.0\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Favarga1%2Fvllm-hb","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Favarga1%2Fvllm-hb","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Favarga1%2Fvllm-hb/lists"}