# HyperQwen

> Large Qwen models served fast on a single consumer GPU, via a patched vLLM

- Category: Models & Inference / Serving & Deployment
- Language: Python
- Licence: Apache-2.0
- Repository: https://github.com/syv-ai/HyperQwen
- Canonical page: https://ai-tldr.dev/tools/hyperqwen/

## In short

HyperQwen is a serving setup for running large Qwen models on the GPUs people actually own. Its first target is Qwen3.8-27B on a single 24 GB consumer card, exposed through vLLM as an OpenAI-compatible API with optional key auth. It sits in the Serving & Deployment category of the Models & Inference tools and is open-source, written in Python and licensed Apache-2.0.

## Overview

HyperQwen is a serving setup for running large Qwen models on the GPUs people actually own. Its first target is Qwen3.8-27B on a single 24 GB consumer card, exposed through vLLM as an OpenAI-compatible API with optional key auth. It ships as a Docker Compose project with two ready-made modes: `single`, tuned for one or a few people chatting, and `batch`, tuned for API backends and pipelines sending many requests at once.

The project reports its own measurements on one RTX 3090 capped at 250 W: 127 tok/s single-stream in single-user mode, about 1,035 tok/s aggregate decode at 64 concurrent requests in batch mode, and 381 tok/s when the answer quotes its own prompt. Further `.env` settings trade speed for context — around 150k tokens with `CTX=long`, and 240k with `CTX=huge`, which uses the KVarN 4/2-bit KV cache. The README states that every headline number comes from that one card, and that rows for other hardware come from community reproductions run with its benchmark harness.

Under the serving setup, the repository is a patch series against a pinned vLLM plus a model-preparation pipeline: requantized heads, a calibrated draft vocabulary, and speculative decoding that can draft tokens out of the prompt (DFlash2 or MTP). The README separates what is already portable (the vLLM patches, the KVarN backend, int8 Marlin GEMM layer selection) from what is still tied to this checkpoint or to sm86 cards. Multi-GPU works at TP=2 and TP=4.

## What it does

- Two Docker Compose profiles: `single` (speculative decoding for one or a few users) and `batch` (plain batching with int8 tensor-core GEMMs for many concurrent requests)
- OpenAI-compatible API on port 18020, with key auth enabled by setting `VLLM_API_KEY`
- Speculative decoding via DFlash2 or MTP, including a reproduction mode (`DFLASH_TOKENS=15`) for answers that quote the prompt, such as code edits, RAG and rewrites
- Long-context profiles: `CTX=long` for about 150k tokens and `CTX=huge` for 240k using the KVarN 4/2-bit KV cache
- A documented vLLM patch series (`patches/`, one line per patch in PATCHES.md) plus one-time requantization scripts in `prepare/`
- A benchmark and quality harness (`bench/run_benchmarks.sh`, `bench/quality_battery.py`) with a field-report template for adding results from other hardware

## Getting started

The quick start uses Docker Compose. The first start pulls a 9.5 GB image and requantizes the model once (about 20 GB, into `./models`), then serves on port 18020. One GPU runs one mode at a time. Bare-metal venv installs and plain Docker are covered in the repo's docs/install.md and docs/docker.md.

1. Clone and create the config

   The shipped `.env.example` is the single-user default with DFlash2 speculation.

```bash
git clone https://github.com/syv-ai/HyperQwen && cd HyperQwen
cp .env.example .env
```

2. Set an API key before exposing the server

   The server binds 0.0.0.0 with no auth unless a key is set.

```bash
echo "VLLM_API_KEY=$(openssl rand -hex 24)" >> .env
```

3. Start a serving mode

   Pick `single` for one or a few people chatting, or `batch` for an API backend with many concurrent requests. Long-context and reproduction modes are selected with extra `.env` lines (`CTX=long`, `CTX=huge`, `DFLASH_TOKENS=15`).

```bash
docker compose --profile single up -d     # one or a few people chatting
docker compose --profile batch  up -d     # API backend, many concurrent requests
```

4. Point a client at it

   Any OpenAI-protocol client works. For the default single-user setup the base URL is `http://127.0.0.1:18020/v1` and the model name is `qwen3.8-27b`; the repo's docs/clients.md has a full OpenCode config.

5. Benchmark your own card

   The project asks for the second run, since a first run after a start reads low.

```bash
docker compose exec single bash bench/run_benchmarks.sh single
```

## When to use it

- Run a 27B-class Qwen model as a private, OpenAI-compatible endpoint on one 24 GB consumer GPU such as an RTX 3090
- Back a local coding agent where answers often quote the prompt, using the reproduction mode for code edits and rewrites
- Serve a pipeline or API backend with dozens of concurrent requests from a single card in batch mode
- Work over very long documents locally with the 150k and 240k context profiles
