ZhiLight

zhihuApache-2.0更新放缓

面向 Llama 及其变体的大模型推理加速引擎,用 CUDA 和 C++ 做底层优化,主打高吞吐低延迟的模型服务部署。

A highly optimized LLM inference acceleration engine for Llama and its variants.

v0.4.8发布于 2024-12-10 04:04 UTC906star105fork同步于 2026-11-07 07:31 UTC

怎么上手

由 README 提炼,执行前请确认
pip install -e .
python -m zhilight.server.openai.entrypoints.api_server [options]
硬件要求按 README 说明

README 未给出具体显存要求;仅依赖 CUDA runtime、cuBLAS、NCCL,测试覆盖 NVIDIA AD102 PCIe、A800、H20,未提及 CPU 或其他 GPU 厂商

需要 CUDA有 Docker 镜像
下载:源码 zip·GitHub Releases(安装包)本站不镜像安装包

项目说明

由 README 自动翻译提炼

知乎开源的 Llama 系大模型推理加速引擎,在 PCIe GPU 上比 vLLM 更快

面向 Llama 及其变体的大模型推理加速引擎,用 CUDA 和 C++ 做底层优化,主打高吞吐低延迟的模型服务部署。

核心能力

  • 异步 OpenAI 兼容接口,改自 vllm
  • 编码与 all-reduce 双流重叠,支持 Int8 量化 all-reduce
  • 基于 SIMD 指令的 Host all-reduce
  • 基于 tensor core 的融合 batch attention 解码
  • 支持 chunked prefill、prefix cache 与动态 batch

容易踩的坑

需先编译 wheel 或直接 pip install -e .,依赖 CUDA runtime、cuBLAS、NCCL 及 requirements.txt 中的 Python 包;启动服务需自行传入 options 参数,README 未给默认端口;模型需另行准备,README 未说明下载方式

内容由模型根据 README 生成,可能不完整或不准确,以官方文档为准。看原文 README

最近发版

1 个版本v0.4.8
  1. v0.4.8最新正式版2024-12-10 · 2024-12-10 04:04 UTC

    We first opensource release version💡

    🎉🎉 Main Features

    • Asynchronous OpenAI compatible interface adapted from vllm
    • Custom defined tensor and unified global memory management
    • 🔥 Encode and all-reduce overlap, we named "dual streams"
    • Host all-reduce based on SIMD instructions
    • Optimized fused kernels, qkv, residual & layernorm etc.
    • 🔥 Fused batch attention for decoding based on tensor core instructions
    • Support TP and PP on one node, TP is recommended
    • Support dynamic batch
    • Support flashatten prefill
    • Support chunked prefill
    • Support prefix cache
    • Support Native INT8/SmoothQuant/FP8/AWQ/GPTQ quantization
    • Support Marlin kernel for GPTQ
    • Support MoE, DeepseekV2 MoE and DeepseekV2 MLA
    • Support Llama/Llama2, Mixtral, Qwen2 series and similar models

    Docker Image

    # Docker image
    # CUDA: 12.4.1 Driver: 550.54.15及兼容版本
    docker pull ghcr.io/zhihu/zhilight/zhilight:0.4.8-cu124
    # CUDA: 12.5.1 Driver: 555.42.02及兼容版本
    docker pull ghcr.io/zhihu/zhilight/zhilight:0.4.8-cu125
    # 以下Dockerfile可供参考,选用官方cuDNN镜像构建自己特定版本的镜像
    # Dockerfile: https://github.com/zhihu/ZhiLight/blob/main/docker/Dockerfile
    

用户点评

登录用户的真实使用记录,可按版本和硬件筛选
共 0 条

    还没有人点评。第一个说出真实体验的人最有价值。

    README 原文

    未翻译

    ZhiLight

    ✨ ZhiLight ✨is a highly optimized LLM inference engine developed by Zhihu and ModelBest Inc. The "Zhi" in its name stands for Zhihu. ZhiLight can accelerate the inference of models like Llama and its variants, especially on PCIe-based GPUs. Compared to mainstream open-source inference engines, for example, vllm, it has significant performance advantages.

    News 🔥

    • [2025/05] Support DeepSeek-V3/DeepSeek-R1 FP8 block-quantized model.
    • [2025/02] Support DeepSeek-V3/DeepSeek-R1 AWQ/GPTQ quantized model.
    • [2025/01] Support DeepSeek-VL2 multimodal models: deepseek-vl2-tiny, deepseek-vl2-small, deepseek-vl2.
    • [2025/01] Support LLaMA3 models: Llama-3.1-8B, Llama-3.1-70B, Llama-3.2-1B, Llama-3.2-3B, Llama-3.3-70B.

    Roadmap

    see Roadmap

    🎉🎉 Main Features

    • Asynchronous OpenAI compatible interface adapted from vllm
    • Custom defined tensor and unified global memory management
    • 🔥 Encode and all-reduce overlap, we named "dual streams"
      • Support Int8-quantized all-reduce to further reduce all-reduce cost.
    • Host all-reduce based on SIMD instructions
    • Optimized fused kernels, qkv, residual & layernorm etc.
    • 🔥 Fused batch attention for decoding based on tensor core instructions
    • Support TP and PP on one node, TP is recommended
    • Support dynamic batch
    • Support flash attention prefill
    • Support chunked prefill
    • Support prefix cache
    • Support Native INT8/SmoothQuant/FP8/AWQ/GPTQ quantization
    • Support Marlin kernel for GPTQ
    • Support MoE, DeepseekV2 MoE and DeepseekV2 MLA
    • Support Llama/Llama2, Mixtral, Qwen2 series and similar models

    🔧 Basic Usage

    # Concurrently compile the wheel package, and turn off the unit test
    CMAKE_BUILD_PARALLEL_LEVEL=32 TESTING=0 python setup.py bdist_wheel
    
    # Compile with ninja backend
    CMAKE_GENERATER="Ninja" python setup.py bdist_wheel
    
    # Install directly
    cd ./ZhiLight && pip install -e .
    
    # Start OpenAI compatible server
    python -m zhilight.server.openai.entrypoints.api_server [options]
    

    ✈️ Docker Image

    ZhiLight only depends on the CUDA runtime, cuBLAS, NCCL, and a few Python packages in requirements.txt. You can use the image below for running or building it. You can also directly refer to docker/Dockerfile.

    docker pull ghcr.io/zhihu/zhilight/zhilight:0.4.8-cu124
    

    📈 Performance Notes

    We conducted performance reviews on various mainstream NVIDIA GPUs with different model sizes and precisions. For dense models ranging from 2B to 110B parameters on PCIe devices, ZhiLight demonstrates significant performance advantages compared to mainstream open-source inference engines.

    Test Description:

    • Test purpose is to demonstrate performance, applicable scenarios and limitations
    • Test metrics include:
      • QPS: Queries Per Second
      • TTFT (Time To First Token): First token generation latency
      • TPOT (Time Per Output Token): Generation latency per output token
    • Test environments include:
      • AD102 PCIe : Consumer-grade GPU for experimental research
      • A800: Data center GPU for production deployment
      • H20: Data center GPU for production deployment
    • Test models include:
      • Large-scale models: DeepSeek-R1, Qwen1.5-110B, Qwen2-72B, LLama-3.1-70B
      • Medium-scale models: Qwen2.5-14B, Llama-3.1-8B, Minicpm-2B
    • Compared inference engines include:
      • vLLM
      • SGLang
      • ZhiLight

    DeepSeek-R1 AWQ

    • NVIDIA A800*8
    Inference EngineQPSTTFT MeanTTFT P95TPOT MeanTPOT P95
    vLLM0.081817.72556.42109.86129.98
    ZhiLight0.161590.962214.34115.97139.99
    • NVIDIA H20*8
    Inference EngineQPSTTFT MeanTTFT P95TPOT MeanTPOT P95
    ZhiLight0.232025.153278.09128.28152.64

    MiniCPM-2B-sft-bf16

    • NVIDIA AD102 PCIe * 1
    Inference EngineQPSTTFT MeanTTFT P95TPOT MeanTPOT P95
    vLLM1.67527.551062.9616.7131.95
    SGLang1.67466.191181.533.9659.44
    ZhiLight1.67434.64989.0326.161.14

    Qwen2-72B-Instruct-GPTQ-Int4

    • NVIDIA AD102 PCIe * 4
    Inference EngineQPSTTFT MeanTTFT P95TPOT MeanTPOT P95
    vLLM0.183493.976852.0735.4761.74
    SGLang0.182276.13820.738.1265.16
    ZhiLight0.181111.81882.526.7541.81
    • NVIDIA A800 * 4
    Inference EngineQPSTTFT MeanTTFT P95TPOT MeanTPOT P95
    vLLM0.181457.652136.522.1428.96
    SGLang0.361113.061850.5730.4143.65
    ZhiLight0.181227.371968.9531.9548.53

    Qwen1.5-110B-Chat-GPTQ-Int4

    • NVIDIA AD102 PCIe * 4
    Inference EngineQPSTTFT MeanTTFT P95TPOT MeanTPOT P95
    vLLM0.093085.744274.0330.3444.08
    SGLang0.092418.563187.7331.3953.1
    ZhiLight0.181671.382669.8239.6864.35
    • NVIDIA A800 * 4
    Inference EngineQPSTTFT MeanTTFT P95TPOT MeanTPOT P95
    vLLM0.091899.072719.5923.833.02
    SGLang0.181514.492135.7528.547.28
    ZhiLight0.11574.852086.827.0738.82

    more benchmarks can be found in benchmarks

    License

    Apache License 2.0

    Contributors