Views
No views yet


Ring-mini-linear-2.0 achieves near-linear time complexity and constant space complexity, resulting in outstanding inference efficiency. To fully demonstrate this advantage, we conducted a comparison between our model and top-tier competitors of similar size or performance.The results clearly demonstrate the advantage of our model in inference efficiency.

1pip install flash-linear-attention==0.3.2
2pip install transformers==4.56.11from transformers import AutoModelForCausalLM, AutoTokenizer
2
3model_name = "inclusionAI/Ring-mini-linear-2.0"
4
5model = AutoModelForCausalLM.from_pretrained(
6 model_name,
7 dtype="auto",
8 device_map="auto",
9 trust_remote_code=True,
10)
11tokenizer = AutoTokenizer.from_pretrained(model_name)
12
13
14prompts = [
15 "Give me a short introduction to large language models."
16]
17input_texts = []
18for prompt in prompts:
19 messages = [
20 {"role": "user", "content": prompt}
21 ]
22 text = tokenizer.apply_chat_template(
23 messages,
24 tokenize=False,
25 add_generation_prompt=True
26 )
27 input_texts.append(text)
28
29print(input_texts)
30
31model_inputs = tokenizer(input_texts, return_tensors="pt", return_token_type_ids=False, padding=True, padding_side='left').to(model.device)
32
33generated_ids = model.generate(
34 **model_inputs,
35 max_new_tokens=8192,
36 do_sample=False,
37)
38generated_ids = [
39 output_ids[len(input_ids):] for input_ids, output_ids in zip(model_inputs.input_ids, generated_ids)
40]
41
42responses = tokenizer.batch_decode(generated_ids, skip_special_tokens=True)
43
44print("*" * 30)
45print(responses)
46print("*" * 30)pip install sglang==0.5.2 sgl-kernel==0.3.9.post2 vllm==0.10.2 torch==2.8.0 torchvision==0.23.0 torchaopip install https://media.githubusercontent.com/media/inclusionAI/Ring-V2/refs/heads/main/hybrid_linear/whls/sglang-0.5.2-py3-none-any.whl --no-deps --force-reinstall1python -m sglang.launch_server \
2 --model-path <model_path> \
3 --trust-remote-code \
4 --tp-size 1 \
5 --disable-radix-cache \
6 --json-model-override-args "{\"linear_backend\": \"seg_la\"}"1curl -s http://localhost:${PORT}/v1/chat/completions \
2 -H "Content-Type: application/json" \
3 -d '{"model": "auto", "temperature": 0.6, "messages": [{"role": "user", "content": "Give me a short introduction to large language models."}]}'1conda create -n vllm python=3.10
2conda activate vllmpip install https://media.githubusercontent.com/media/zheyishine/vllm_whl/refs/heads/main/vllm-0.8.5.post2.dev28%2Bgd327eed71.cu128-cp310-cp310-linux_x86_64.whl --force-reinstallpip install transformers==4.51.1 1from transformers import AutoTokenizer
2from vllm import LLM, SamplingParams
3
4if __name__ == '__main__':
5 tokenizer = AutoTokenizer.from_pretrained("inclusionAI/Ring-mini-linear-2.0", trust_remote_code=True)
6
7 sampling_params = SamplingParams(temperature=0.6, top_p=1.0, max_tokens=1024)
8
9 # use `max_num_seqs=1` without concurrency
10 llm = LLM(model="inclusionAI/Ring-mini-linear-2.0", dtype='auto', enable_prefix_caching=False, max_num_seqs=128)
11
12
13 prompt = "Give me a short introduction to large language models."
14 messages = [
15 {"role": "user", "content": prompt}
16 ]
17
18 text = tokenizer.apply_chat_template(
19 messages,
20 tokenize=False,
21 add_generation_prompt=True
22 )
23 outputs = llm.generate([text], sampling_params)
24 for output in outputs:
25 print(output.outputs[0].text)1vllm serve inclusionAI/Ring-mini-linear-2.0 \
2 --tensor-parallel-size 1 \
3 --pipeline-parallel-size 1 \
4 --gpu-memory-utilization 0.90 \
5 --max-num-seqs 128 \
6 --no-enable-prefix-caching
7 --api-key your-api-key1@misc{lingteam2025attentionmattersefficienthybrid,
2 title={Every Attention Matters: An Efficient Hybrid Architecture for Long-Context Reasoning},
3 author={Ling Team and Bin Han and Caizhi Tang and Chen Liang and Donghao Zhang and Fan Yuan and Feng Zhu and Jie Gao and Jingyu Hu and Longfei Li and Meng Li and Mingyang Zhang and Peijie Jiang and Peng Jiao and Qian Zhao and Qingyuan Yang and Wenbo Shen and Xinxing Yang and Yalin Zhang and Yankun Ren and Yao Zhao and Yibo Cao and Yixuan Sun and Yue Zhang and Yuchen Fang and Zibin Lin and Zixuan Cheng and Jun Zhou},
4 year={2025},
5 eprint={2510.19338},
6 archivePrefix={arXiv},
7 primaryClass={cs.LG},
8 url={https://arxiv.org/abs/2510.19338},
9}