Cataloged from cyankiwi/MiniCPM-SALA-AWQ-8bit
[!NOTE]
π 2026 Sparse Operator Acceleration & Race (SOAR) is Now Live!
"The MiniCPM-SALA architecture is just the beginning. Realizing its full potential requires deep system-level synergy and cross-layer compilation optimization."
In collaboration with SGLang and NVIDIA, OpenBMB invites global geeks to push the boundaries of 9B-scale, 1M-token inference on NVIDIA 6000D.
π° Prize Pool: >$100,000 USD (π₯ Top Prize: $89,000) | π Challenge: Single & Multi-batch Optimization
MiniCPM-SALA (Sparse Attention and Linear Attention) is the first large-scale hybrid model effectively integrating sparse and linear attention for million-token context modeling
β Innovative Hybrid Architecture: Synergizes 25% Sparse Attention (InfLLM-v2) for high-fidelity long context modeling with 75% Linear Attention (Lightning Attention) for global efficiency.
β Shattering Efficiency Walls: Breaks the "Compute Wall" and the "Memory Wall," achieving 3.5Γ inference speed and significantly lower KV-cache overhead compared to dense baselines.
β Million-Token Context: Empowered by HyPE (Hybrid Positional Embedding), it scales to 1M+ tokens while maintaining strong length generalization.
β HALO Adaptation: Utilizes Hybrid Attention via Layer Optimization (HALO), a novel distillation recipe that effectively transfers dense attention capabilities to the hybrid architecture, avoiding the severe performance degradation typical of pure linear models.
MiniCPM-SALA is an efficient hybrid model in which 25% of the layers adopt InfLLM-V2 and the remaining 75% utilize Lightning Attention. This architecture enables inference of one million tokens on consumer GPUs such as the NVIDIA RTX 5090.
SALA Hybrid Attention Mechanism
Transformer-to-Hybrid Continue Training
HyPE (Hybrid Positional Encoding)
Efficient Inference on Long Sequences
To achieve optimal performance, we recommend using Temperature=0.9.
Our model is readily compatible with π€ Hugging Face transformers. You can perform inference with our model as follows:
import torch
from transformers import AutoModelForCausalLM, AutoTokenizer
model_path = "openbmb/MiniCPM-SALA"
tokenizer = AutoTokenizer.from_pretrained(model_path)
model = AutoModelForCausalLM.from_pretrained(model_path, trust_remote_code=True, device_map="auto")
model.eval()
prompts = ["My name is", "The capital of China is"]
with torch.no_grad():
inputs = tokenizer(prompts, return_tensors="pt").to(model.device)
outputs = model.generate(**inputs)
output_texts = tokenizer.batch_decode(outputs)
print(output_texts)
gcc / g++ compileruv package manager (script will check)# Clone repository
git clone -b minicpm_sala https://github.com/OpenBMB/sglang.git
cd sglang
# One-click installation (creates venv and compiles all dependencies)
bash install_minicpm_sala.sh
# Or specify PyPI mirror
bash install_minicpm_sala.sh https://mirrors.tuna.tsinghua.edu.cn/pypi/web/simple
The installation script performs the following steps:
sglang_minicpm_sala_env virtual environment (Python 3.12)3rdparty/ (infllmv2) and initializes submodules (sparse_kernel)infllmv2_cuda_implsparse_kerneltilelang & flash-linear-attention# Activate environment
source sglang_minicpm_sala_env/bin/activate
# Launch Inference Server (Replace MODEL_PATH with actual path)
MODEL_PATH=/path/to/your/MiniCPM-SALA
python3 -m sglang.launch_server \
--model ${MODEL_PATH} \
--trust-remote-code \
--disable-radix-cache \
--attention-backend minicpm_flashinfer \
--chunked-prefill-size 8192 \
--max-running-requests 32 \
--skip-server-warmup \
--port 31111 \
--dense-as-sparse
| Parameter | Description |
|---|---|
--trust-remote-code | Allow custom code in model |
--disable-radix-cache | Disable RadixAttention prefix cache |
--attention-backend minicpm_flashinfer | Use MiniCPM FlashInfer backend |
--chunked-prefill-size 8192 | Chunked prefill size |
--max-running-requests 32 | Max concurrent requests |
--skip-server-warmup | Skip server warmup |
--port 31111 | Server port |
--dense-as-sparse | Use dense-as-sparse mode |
If the script doesn't work for you, follow these steps:
# 0. Ensure uv is installed
pip install uv
# 1. Create venv
uv venv --python 3.12 sglang_minicpm_sala_env
source sglang_minicpm_sala_env/bin/activate
# 2. Install SGLang
uv pip install --upgrade pip setuptools wheel
uv pip install -e ./python[all]
# 3. Compile CUDA Extensions
# (Ensure dependencies are cloned to 3rdparty/)
cd 3rdparty/infllmv2_cuda_impl && python setup.py install && cd ../..
cd 3rdparty/sparse_kernel && python setup.py install && cd ../..
# 4. Install extra deps
uv pip install tilelang flash-linear-attention
Q: CUDA extension compilation failed?
nvcc --version).gcc / g++ are available.CXX is set to clang++ -pthread, manually export CXX=g++.




@article{minicpm4,
title={{MiniCPM-SALA}: Hybridizing Sparse and Linear Attention for Efficient Long-Context Modeling},
author={MiniCPM Team},
year={2026}
}