Text Generation
Transformers
PyTorch
Safetensors
English
Chinese
llama
conversational
custom_code
text-generation-inference
Instructions to use openbmb/NOSA-8B with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use openbmb/NOSA-8B with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="openbmb/NOSA-8B", trust_remote_code=True) messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("openbmb/NOSA-8B", trust_remote_code=True) model = AutoModelForCausalLM.from_pretrained("openbmb/NOSA-8B", trust_remote_code=True) messages = [ {"role": "user", "content": "Who are you?"}, ] inputs = tokenizer.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=40) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use openbmb/NOSA-8B with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "openbmb/NOSA-8B" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "openbmb/NOSA-8B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/openbmb/NOSA-8B
- SGLang
How to use openbmb/NOSA-8B 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 "openbmb/NOSA-8B" \ --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": "openbmb/NOSA-8B", "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 "openbmb/NOSA-8B" \ --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": "openbmb/NOSA-8B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use openbmb/NOSA-8B with Docker Model Runner:
docker model run hf.co/openbmb/NOSA-8B
Add pipeline tag and library name
#1
by nielsr HF Staff - opened
README.md
CHANGED
|
@@ -1,11 +1,14 @@
|
|
| 1 |
---
|
| 2 |
-
license: apache-2.0
|
| 3 |
datasets:
|
| 4 |
- openbmb/InfLLM-V2-data-5B
|
| 5 |
language:
|
| 6 |
- en
|
| 7 |
- zh
|
|
|
|
|
|
|
|
|
|
| 8 |
---
|
|
|
|
| 9 |
<div align="center">
|
| 10 |
|
| 11 |
<h1>NOSA: Native and Offloadable Sparse Attention</h1>
|
|
@@ -33,26 +36,23 @@ language:
|
|
| 33 |
|
| 34 |
**NOSA** is a trainable sparse attention mechanism designed for KV-cache offloading with an explicit locality constraint, paired with an inference system (**NOSI**) to realize its efficiency. It improves long-context/long-generation quality over prior offloading baselines while boosting decoding throughput by up to **5.04×** vs **FullAttn**, **1.92×** vs **InfLLMv2**, and **1.83×** vs **ShadowKV** on **1B/3B/8B** LLMs.
|
| 35 |
|
| 36 |
-
|
| 37 |
|
| 38 |
## Models
|
| 39 |
|
| 40 |
-
We train 1B, 3B, and 8B models
|
| 41 |
|
| 42 |
|Model|Link|
|
| 43 |
|:-:|:-:|
|
| 44 |
-
|NOSA-1B | [NOSA-1B](huggingface.co/openbmb/NOSA-1B) |
|
| 45 |
-
|NOSA-3B | [NOSA-3B](huggingface.co/openbmb/NOSA-3B) |
|
| 46 |
-
|NOSA-8B | [NOSA-8B](huggingface.co/openbmb/NOSA-8B) |
|
| 47 |
|
| 48 |
Please reach out to us if additional baseline models (FullAttn, InfLLMv2, or DMA) are needed. You may open an issue or contact us directly via email (our email addresses are provided in the paper).
|
| 49 |
|
| 50 |
-
|
| 51 |
-
|
| 52 |
-
|
| 53 |
## Citation
|
| 54 |
|
| 55 |
-
```
|
| 56 |
@article{huang2025nosa,
|
| 57 |
title={NOSA: Native and Offloadable Sparse Attention},
|
| 58 |
author={Huang, Yuxiang and Wang, Pengjie and Han, Jicheng and Zhao, Weilin and Su, Zhou and Sun, Ao and Lyu, Hongya and Zhao, Hengyu and Wang, Yudong and Xiao, Chaojun and Han, Xu and Liu, Zhiyuan},
|
|
|
|
| 1 |
---
|
|
|
|
| 2 |
datasets:
|
| 3 |
- openbmb/InfLLM-V2-data-5B
|
| 4 |
language:
|
| 5 |
- en
|
| 6 |
- zh
|
| 7 |
+
license: apache-2.0
|
| 8 |
+
pipeline_tag: text-generation
|
| 9 |
+
library_name: transformers
|
| 10 |
---
|
| 11 |
+
|
| 12 |
<div align="center">
|
| 13 |
|
| 14 |
<h1>NOSA: Native and Offloadable Sparse Attention</h1>
|
|
|
|
| 36 |
|
| 37 |
**NOSA** is a trainable sparse attention mechanism designed for KV-cache offloading with an explicit locality constraint, paired with an inference system (**NOSI**) to realize its efficiency. It improves long-context/long-generation quality over prior offloading baselines while boosting decoding throughput by up to **5.04×** vs **FullAttn**, **1.92×** vs **InfLLMv2**, and **1.83×** vs **ShadowKV** on **1B/3B/8B** LLMs.
|
| 38 |
|
| 39 |
+
This repository contains the weights for the NOSA-3B model. For more details, please refer to the paper: [NOSA: Native and Offloadable Sparse Attention](https://huggingface.co/papers/2510.13602).
|
| 40 |
|
| 41 |
## Models
|
| 42 |
|
| 43 |
+
We train 1B, 3B, and 8B models (FullAttn, InfLLMv2, DMA, and NOSA), resulting in a total of 12 models. The following models have been released on Hugging Face:
|
| 44 |
|
| 45 |
|Model|Link|
|
| 46 |
|:-:|:-:|
|
| 47 |
+
|NOSA-1B | [NOSA-1B](https://huggingface.co/openbmb/NOSA-1B) |
|
| 48 |
+
|NOSA-3B | [NOSA-3B](https://huggingface.co/openbmb/NOSA-3B) |
|
| 49 |
+
|NOSA-8B | [NOSA-8B](https://huggingface.co/openbmb/NOSA-8B) |
|
| 50 |
|
| 51 |
Please reach out to us if additional baseline models (FullAttn, InfLLMv2, or DMA) are needed. You may open an issue or contact us directly via email (our email addresses are provided in the paper).
|
| 52 |
|
|
|
|
|
|
|
|
|
|
| 53 |
## Citation
|
| 54 |
|
| 55 |
+
```bibtex
|
| 56 |
@article{huang2025nosa,
|
| 57 |
title={NOSA: Native and Offloadable Sparse Attention},
|
| 58 |
author={Huang, Yuxiang and Wang, Pengjie and Han, Jicheng and Zhao, Weilin and Su, Zhou and Sun, Ao and Lyu, Hongya and Zhao, Hengyu and Wang, Yudong and Xiao, Chaojun and Han, Xu and Liu, Zhiyuan},
|