网站制作潍坊,企业邮箱登录入口和注册申请,云商网络综合服务,运涛网站建设Ring-mini-linear-2.0#xff1a;融合线性注意力与稀疏专家的下一代高效大语言模型 【免费下载链接】Ring-mini-linear-2.0 项目地址: https://ai.gitcode.com/hf_mirrors/inclusionAI/Ring-mini-linear-2.0 #x1f4d6; 技术报告 | #x1f917; Hugging Face…Ring-mini-linear-2.0融合线性注意力与稀疏专家的下一代高效大语言模型【免费下载链接】Ring-mini-linear-2.0项目地址: https://ai.gitcode.com/hf_mirrors/inclusionAI/Ring-mini-linear-2.0 技术报告 | Hugging Face | ModelScope模型概述今日我们正式对外开源Ring-mini-linear-2.0大语言模型。该模型创新性地采用线性注意力与标准注意力混合架构在保证模型性能的同时显著提升运行效率。作为Ling 2.0系列的重要成员它继承了高效的混合专家MoE设计理念并通过1/32专家激活比例和MTP层等架构优化实现了仅激活164亿总参数中的16亿参数就能达到约80亿稠密模型性能的突破。本模型基于Ling-mini-base-2.0进行转换并在额外6000亿 tokens 的语料上持续训练。实验结果表明这种混合线性模型在整体性能上可与同规模的标准注意力模型如Ring-mini-2相媲美同时在多项挑战性基准测试中超越了其他同级别开源MoE和稠密模型。特别值得一提的是通过YaRN技术将上下文窗口外推4倍实现了512k超长上下文支持这使其在处理长输入输出任务时展现出卓越的速度优势。上图展示了Ring-mini-linear-2.0的混合线性模型架构。该架构清晰呈现了线性注意力与标准注意力的融合方式以及MoE机制的实现路径帮助开发者直观理解模型的底层设计逻辑。性能评估为全面验证模型的推理能力我们选取数学、代码和科学三大领域的5项挑战性推理基准将Ring-mini-linear-2.0与Ring-mini-2.0、Qwen3-8B-thinking和GPT-OSS-20B-Medium三款模型进行对比测试。测试结果充分证明混合线性架构能够达到与softmax注意力模型相当的性能水平尤其在复杂推理任务中展现出独特优势。这张模型性能对比图清晰呈现了各模型在不同基准测试中的得分情况。通过横向比较可以直观看到Ring-mini-linear-2.0在保持高效性的同时如何实现与传统模型的性能抗衡为用户选择合适模型提供数据支持。线性注意力驱动的高效推理稀疏架构与极速生成得益于创新的混合注意力机制和高度稀疏的MoE架构Ring-mini-linear-2.0实现了近线性时间复杂度和常数空间复杂度带来了卓越的推理效率。为充分展示这一优势我们将其与同级别或同性能的顶级竞争模型进行了全面的推理效率对比结果有力证明了该模型在推理速度上的显著领先地位。[](https://link.gitcode.com/i/005bb7423923d3511e3181255211af01)该图展示了Ring-mini-linear-2.0的预填充吞吐量表现。预填充阶段是长文本处理的关键环节高吞吐量意味着模型能够更快地处理长输入这对于文档理解等应用场景至关重要。[](https://link.gitcode.com/i/005bb7423923d3511e3181255211af01)此图呈现了模型的解码吞吐量性能。解码速度直接影响用户交互体验高解码吞吐量意味着模型能更快生成响应特别适合实时对话等交互场景。快速上手指南环境要求使用前需安装以下依赖包确保环境配置正确pip install flash-linear-attention0.3.2 pip install transformers4.56.1 Hugging Face Transformers使用示例以下是基于Hugging Face Transformers库的快速调用代码适用于大多数标准推理场景from transformers import AutoModelForCausalLM, AutoTokenizer model_name inclusionAI/Ring-mini-linear-2.0 model AutoModelForCausalLM.from_pretrained( model_name, dtypeauto, device_mapauto, trust_remote_codeTrue, ) tokenizer AutoTokenizer.from_pretrained(model_name) prompts [ Give me a short introduction to large language models. ] input_texts [] for prompt in prompts: messages [ {role: user, content: prompt} ] text tokenizer.apply_chat_template( messages, tokenizeFalse, add_generation_promptTrue ) input_texts.append(text) print(input_texts) model_inputs tokenizer(input_texts, return_tensorspt, return_token_type_idsFalse, paddingTrue, padding_sideleft).to(model.device) generated_ids model.generate( **model_inputs, max_new_tokens8192, do_sampleFalse, ) generated_ids [ output_ids[len(input_ids):] for input_ids, output_ids in zip(model_inputs.input_ids, generated_ids) ] responses tokenizer.batch_decode(generated_ids, skip_special_tokensTrue) print(* * 30) print(responses) print(* * 30) SGLang部署方案环境准备我们已向SGLang官方提交PR该PR将在后续版本中合并。目前可通过以下步骤准备运行环境首先安装社区版SGLang及所需依赖包pip install sglang0.5.2 sgl-kernel0.3.9.post2 vllm0.10.2 torch2.8.0 torchvision0.23.0 torchao然后安装我们提供的sglang wheel包pip 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-reinstall推理运行SGLang当前支持BF16和FP8模型具体取决于${MODEL_PATH}中模型的 dtype设置。两种精度模型的启动命令相同启动服务端python -m sglang.launch_server \ --model-path model_path \ --trust-remote-code \ --tp-size 1 \ --disable-radix-cache \ --json-model-override-args {\linear_backend\: \seg_la\}客户端调用curl -s http://localhost:${PORT}/v1/chat/completions \ -H Content-Type: application/json \ -d {model: auto, temperature: 0.6, messages: [{role: user, content: Give me a short introduction to large language models.}]}更多使用方法可参考SGLang官方文档 vLLM部署方案环境准备由于目前尚未向vLLM社区提交Pull Request需按以下步骤准备环境首先创建Python 3.10和CUDA 12.8的Conda环境conda create -n vllm python3.10 conda activate vllm接着安装我们提供的vLLM wheel包pip 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-reinstall最后在安装vLLM后安装兼容版本的transformerspip install transformers4.51.1离线推理from transformers import AutoTokenizer from vllm import LLM, SamplingParams if __name__ __main__: tokenizer AutoTokenizer.from_pretrained(inclusionAI/Ring-mini-linear-2.0, trust_remote_codeTrue) sampling_params SamplingParams(temperature0.6, top_p1.0, max_tokens1024) # 使用max_num_seqs1关闭并发 llm LLM(modelinclusionAI/Ring-mini-linear-2.0, dtypeauto, enable_prefix_cachingFalse, max_num_seqs128) prompt Give me a short introduction to large language models. messages [ {role: user, content: prompt} ] text tokenizer.apply_chat_template( messages, tokenizeFalse, add_generation_promptTrue ) outputs llm.generate([text], sampling_params) for output in outputs: print(output.outputs[0].text)在线推理vllm serve inclusionAI/Ring-mini-linear-2.0 \ --tensor-parallel-size 1 \ --pipeline-parallel-size 1 \ --gpu-memory-utilization 0.90 \ --max-num-seqs 128 \ --no-enable-prefix-caching --api-key your-api-key引用说明如果您在研究或应用中使用了Ring-mini-linear-2.0模型请按以下格式引用misc{lingteam2025attentionmattersefficienthybrid, title{Every Attention Matters: An Efficient Hybrid Architecture for Long-Context Reasoning}, 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}, year{2025}, eprint{2510.19338}, archivePrefix{arXiv}, primaryClass{cs.LG}, url{https://arxiv.org/abs/2510.19338}, }Ring-mini-linear-2.0的开源发布为大语言模型的高效部署提供了新的解决方案。其混合线性架构与稀疏专家设计的创新结合不仅解决了传统模型在长上下文处理中的效率瓶颈还为资源受限场景下的AI应用开辟了新路径。随着模型的广泛应用我们期待看到更多基于该架构的创新实践共同推动大语言模型技术向更高效、更经济的方向发展。【免费下载链接】Ring-mini-linear-2.0项目地址: https://ai.gitcode.com/hf_mirrors/inclusionAI/Ring-mini-linear-2.0创作声明:本文部分内容由AI辅助生成(AIGC),仅供参考