Instructions to use SII-Jiaquan/HyLoKV-27B with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use SII-Jiaquan/HyLoKV-27B with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="SII-Jiaquan/HyLoKV-27B") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# pip install -U transformers accelerate # Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("SII-Jiaquan/HyLoKV-27B", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use SII-Jiaquan/HyLoKV-27B with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "SII-Jiaquan/HyLoKV-27B" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "SII-Jiaquan/HyLoKV-27B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/SII-Jiaquan/HyLoKV-27B
- SGLang
How to use SII-Jiaquan/HyLoKV-27B with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "SII-Jiaquan/HyLoKV-27B" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "SII-Jiaquan/HyLoKV-27B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "SII-Jiaquan/HyLoKV-27B" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "SII-Jiaquan/HyLoKV-27B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use SII-Jiaquan/HyLoKV-27B with Docker Model Runner:
docker model run hf.co/SII-Jiaquan/HyLoKV-27B
HyLoKV-27B
ๅบไบ Qwen3.8-27B ็ attention-only ๅ ฑไบซ KV๏ผHyLoKV๏ผๅพฎ่ฐๆจกๅใๆๅ 8 ไธช GQA ๅฑ็ ่ฟๅๅฒ๏ผ>128 token๏ผๆน็ฑๅไธๅ ฑไบซ KV bank ่ฏปๅ๏ผ่ฟ 128 token ไธๅ จ้จ GDN๏ผ็บฟๆงๆณจๆๅ๏ผ ๅฑไฟๆๅ็๏ผ็จไฝ็งฉ adapter ๅ้ๅฑ่ฏปๅบๅฏน้ฝใ็ฎๆ ๆฏๅ็ผฉ GQA KV ๆพๅญ๏ผๅๆถๅฐฝ้ไธๆๅคฑๆจกๅ่ฝๅใ
ๆจกๅ็ป่
- ๅบๅบง๏ผ
Qwen/Qwen3.8-27B๏ผ64 ๅฑ๏ผ(GDNร3 + GQAร1)ร16๏ผ24 ๅคด / 4 KV ๅคด / head_dim 256๏ผ - cut_depth = 32๏ผไปฅ H32๏ผ็ฌฌ 32 ๅฑ๏ผ่พๅบไฝไธบๅ ฑไบซ่ฎฐๅฟๆฅๆบ
- local_window = 128๏ผๅฝๅๅบๅฎๅๅ ็ token ็จๆฌๅฑๅ็ KV๏ผๆดๆฉ็ๅๅฒ่ฏปๅ ฑไบซ bank
- reader_rank = 8๏ผ้ๅฑไฝ็งฉ Q/V ้้
๏ผ
q_down/q_up/v_down/v_up+ ไธไธช global offset๏ผ - ๅ จๅฑ producer๏ผๅคๅถ็ฌฌ 36 ๅฑ๏ผ0-based 35๏ผ็ input_norm + K/V ๆๅฝฑ + KNorm ไฝไธบๅๅงๅ
่ชๅฎไน้จๅๅชๆ็บฆ 24 MB๏ผproducer 10.5M ๅๆฐ + 8 ไธช reader adapter ๅ ฑ 1.6M ๅๆฐ๏ผ๏ผ ๅ ถไฝๆฏๅพฎ่ฐๅ็ Qwen3.8-27B ้ชจๅนฒ๏ผ26.9B ๅๆฐ๏ผbf16 ็บฆ 53.8 GB๏ผใ
่ฎญ็ป
- ๆฐๆฎ๏ผ
dolma3_mix(90%) + ไธญๆfineweb-2(10%)๏ผstage A ๅ ฑ 10B tokens ๏ผ็บฏ้็จ็ฝ้กตๆๆฌ๏ผไธๅซๆฐๅญฆ/ๆไปคๆฐๆฎ๏ผ - ้ ็ฝฎ๏ผ8000 steps๏ผseq-len 2048๏ผtokens-per-batch 4096๏ผ8รH100๏ผFSDP2๏ผbf16
- ๅญฆไน ็๏ผbase
1e-5/ ๆฐๅๆฐ3e-4ๅทฎๅๅญฆไน ็๏ผcosine ่กฐๅ๏ผwarmup 50 - ็ฎๆ ๏ผๅ็ next-token CE๏ผbase ้ชจๅนฒไธ producer/adapters ไธ่ตท่ฎญ็ป๏ผ
่ฏๆต
**ๅบ็บฟ = ๅๅง็ Qwen/Qwen3.8-27B**๏ผๅ้ = ๆฌๆจกๅ็ๅ
ฑไบซ KV ๅๅ๏ผhybrid๏ผใ
| ๆๆ | ๅๅง Qwen3.8-27B๏ผๅบ็บฟ๏ผ | HyLoKV-27B๏ผhybrid๏ผ |
|---|---|---|
| CE๏ผ็ๅฎๆๆฌ๏ผ | 2.256 | 2.312๏ผฮ +0.056๏ผ |
| NIAH ้ฟ่ท็ฆปๆฃ็ดข๏ผ4Kโ32K๏ผ12 ไพ๏ผ | 100% | 91.7% |
| MMLU๏ผ14042๏ผ | 82.67% | 80.46% |
| GSM8K๏ผ1319๏ผ | 44.28% | 15.47% |
่ฏดๆ๏ผ
- ไธ่ฟฐๅบ็บฟๆฐๅญๅ่ชๅบๅบงๅจๅป็ป้ชจๅนฒ็ๅฏน็ งๅฎ้ช๏ผๆญคๆถ native ๅๅๅณๅๅง Qwen3.8-27B ๆฌ่บซ๏ผใๅ้ๆฐๅญๆฏๅไธ checkpoint ็ hybrid ๅๅใ
- ๅฆไธไธช่ฏๆญ้ๆฏใๅไธๅพฎ่ฐๆ้่ตฐ native ่ทฏ็ฑใ๏ผ็ฆ็จๅ ฑไบซ bank + adapter๏ผ๏ผๅฎๆขไธๆฏ ๅบ็บฟใไนไธๆฏๅ้๏ผไป ็จไบ่งๅฏ่ทฏ็ฑๆฌ่บซ็ๅฝฑๅ๏ผๆ ไธๅๅ ฅไธ่กจใ
- GSM8K ๆๅไธป่ฆๆไธคไธชๅ ๅ ๅๅ ๏ผโ ๅพฎ่ฐๆฐๆฎไธๅซๆฐๅญฆ โ ็พ้พๆง้ๅฟ๏ผโก ๅ ฑไบซ KV ๅจ้ฟ CoT ็ๆ๏ผ>128 token๏ผไธไผไธขๅคฑไปปๅกไธไธๆใๅๆญขไฟกๅทๅๅผฑใ่ฟไธค็นๅๅจๆๆฅ/ๆน่ฟไธญใ
ไฝฟ็จ
ไพ่ต qwen_shared ๅ
๏ผๆฅ่ช LaLaLanD_qwen ไปๅบ็ qwen_shared/model.pyใ
attention_only.pyใced32_core.py๏ผใ
pip install safetensors transformers
python load_hy_lokv.py --base Qwen/Qwen3.8-27B --device cuda:0
ๆๆๅจๅ ่ฝฝ๏ผ
from qwen_shared.model import load_base
from qwen_shared.attention_only import AttentionOnlyQwen
from safetensors.torch import load_file
import torch, json
cfg = json.load(open("hy_lokv_config.json"))
base = load_base("Qwen/Qwen3.8-27B", device="cpu", dtype=torch.bfloat16)
model = AttentionOnlyQwen(base, cut_depth=cfg["cut_depth"],
local_window=cfg["local_window"],
reader_rank=cfg["reader_rank"])
index = json.load(open("model.safetensors.index.json"))
state = {}
for k, f in index["weight_map"].items():
shard = load_file(f)
state[k] = shard[k]
model.load_state_dict(state, strict=False).to("cuda:0").eval()
ๆไปถ
model-0000X-of-0000Y.safetensors๏ผๅฎๆดๆ้๏ผbase + producer + adapters๏ผbf16๏ผmodel.safetensors.index.json๏ผๅ็็ดขๅผhy_lokv_config.json๏ผcut_depth / local_window / reader_rankload_hy_lokv.py๏ผๅ่ๅ ่ฝฝ่ๆฌconfig.json/ tokenizer ๆไปถ๏ผๅบๅบง้ ็ฝฎไธ่ฏ่กจ
้ๅถ
่ฟๆฏใ่ดจ้ๆญฃ็กฎๆงๅ่ใๅฎ็ฐ๏ผๅฐๆชๅๆจ็ไผๅ๏ผGlobalKVBank ็จ torch.cat ่ฟฝๅ ใ
attention ๆฏ PyTorch gather + FP32 + einsum๏ผๆ ่ๅ kernelใๅ ๆญคๅฝๅๆจ็้ๅบฆไธไผไบ
native๏ผKV ็้ป่พๅฎน้ๆไธ้๏ผไฝๅณฐๅผ HBM ๆถ็ๅจ็ญไธไธๆไธ่ขซๆจกๅๆ้ไธปๅฏผ๏ผๅฐๆชๅจ้ฟ
ไธไธๆไธๅฎๆตใๅ้กต KV ไธ grouped decode kernel ๆฏๅ็ปญๅทฅไฝใ
่ฎธๅฏ
Apache-2.0๏ผ็ปงๆฟ่ชๅบๅบง Qwen/Qwen3.8-27B๏ผใ
- Downloads last month
- 76
Model tree for SII-Jiaquan/HyLoKV-27B
Base model
Qwen/Qwen3.8-27B