欢迎使用 Thinking Machines 的 Inkling

Hugging Face Blog 模型

摘要

Thinking Machines 的 Inkling 是一个大型开放多模态 LLM,约有1万亿参数、100万上下文窗口,原生支持图像、音频和文本。它采用混合专家架构,可在 Hugging Face 上获取,并提供首日推理支持。

暂无内容
查看原文
查看缓存全文

缓存时间: 2026/07/15 22:21

欢迎来到 Thinking Machines 出品的 Inkling

来源:https://huggingface.co/blog/thinkingmachines-kinkling 返回文章列表(https://huggingface.co/blog)

  • Inkling 有何特别之处?(https://huggingface.co/blog/thinkingmachines-inkling#what-makes-inkling-special)
  • 整体能力与架构 (https://huggingface.co/blog/thinkingmachines-inkling#overall-capabilities-and-architecture)
  • 推理支持 (https://huggingface.co/blog/thinkingmachines-inkling#inference-support)- Transformers (https://huggingface.co/blog/thinkingmachines-inkling#transformers) - SGLang (https://huggingface.co/blog/thinkingmachines-inkling#sglang) - vLLM (https://huggingface.co/blog/thinkingmachines-inkling#vllm) - 通过 Hugging Face Inference Providers 进行远程推理 (https://huggingface.co/blog/thinkingmachines-inkling#remote-inference-with-hugging-face-inference-providers) - 使用 llama.cpp 和 Unsloth 进行本地推理 (https://huggingface.co/blog/thinkingmachines-inkling#local-inference-with-llamacpp-and-unsloth)
  • 使用场景 (https://huggingface.co/blog/thinkingmachines-inkling#use-cases)- 使用 Pi 进行智能体编程 (https://huggingface.co/blog/thinkingmachines-inkling#agentic-coding-with-pi) - 多 token 预测起草器 (https://huggingface.co/blog/thinkingmachines-inkling#multi-token-prediction-drafters) - 多模态视觉 (https://huggingface.co/blog/thinkingmachines-inkling#multimodal-vision) - 多模态音频 (https://huggingface.co/blog/thinkingmachines-inkling#multimodal-audio) - 后训练 (https://huggingface.co/blog/thinkingmachines-inkling#post-training)
  • Slurm 脚本 (https://huggingface.co/blog/thinkingmachines-inkling#slurm-scripts)
  • 基准测试结果 (https://huggingface.co/blog/thinkingmachines-inkling#benchmark-results)

Inkling (https://huggingface.co/thinkingmachines/Inkling)是一个大型开放模型(1万亿参数!),原生支持图像、文本和音频输入。

太长不看版:Thinking Machines 出品的 Inkling 现已上架 Hugging Face。Inkling 是一个巨大的多模态 LLM,能理解所有模态(图像、音频、文本),具备智能体能力,并支持 100 万上下文。它提供完整的 BF16 版本和校准良好的 NVFP4 变体,并包含用于加速推理的推测性 MTP 层。transformers、SGLang 和 llama.cpp 均已提供首发支持。

https://huggingface.co/blog/thinkingmachines-inkling#what-makes-inkling-specialInkling 有何特别之处?

Inkling 是首个大型开放模型,拥有约 1 万亿参数100 万上下文窗口,原生支持图像、文本和音频输入,并在45 万亿 token 的文本、图像、音频和视频数据上进行训练。它的重点是在音频、图像和文本等模态之间进行推理;并旨在通过微调进行领域适配。我们用这个模型捣鼓了一些演示并探索了其架构,我们认为它非常适合构建新一代多模态推理应用。

https://huggingface.co/blog/thinkingmachines-inkling#overall-capabilities-and-architecture整体能力与架构

Inkling 是一个仅解码器的多模态混合专家模型,总参数量为 9750 亿,活跃参数为 410 亿。其中包含许多设计,我们来逐一分解:

  • 仅解码器:这意味着该架构支持因果自回归生成,与大多数最先进的 LLM 类似。
  • 多模态:模型可以处理文本、音频和图像。
  • 混合专家(MoE):每一层的前馈网络是稀疏的,由于在任何给定时刻只有 410 亿参数处于活跃状态,因此推理速度更快。模型有 256 个专家,我们稍后会看到。

以下是架构的快速概览。

**相对注意力:**不同于在 transformer 模型中注入位置信息的常用方法 RoPE,Inkling 使用相对注意力来编码位置信息。每个注意力层直接在注意力 logits 中学习位置。除了键-查询-值,还有第四个投影产生每个 token、每个头的相对特征 R。然后利用距离信息(键向量和查询向量之间的距离)调整该投影张量,并将其传递到注意力模块中。

Inkling 相对注意力架构 (https://huggingface.co/buckets/huggingface/inkling-blog-assets/resolve/relative_attention.png)

**混合注意力:**解码器层交替使用全局注意力(一次关注整个上下文长度)和滑动窗口注意力(以滑动方式关注固定上下文窗口)。该架构的模式是 5:1 的滑动窗口与全局注意力层比例。这种混合注意力方案提供了计算效率。最后一层使用全局注意力来帮助构建特征丰富的表示。

**短卷积:**模型在隐藏状态上使用了一种独特的一维短卷积,即SConv。SConv 读取当前 token 和之前的W-1个隐藏状态,其中W是滑动窗口大小。直观理解是,SConv 有助于局部注意力,同时将注意力和 MoE 模块从局部表示中解放出来。

Inkling 短卷积架构 (https://huggingface.co/buckets/huggingface/inkling-blog-assets/resolve/sconv.png)

**带共享专家汇的 MoE:**在 Inkling 中,路由同时为路由专家和共享专家打分。Top-k 选择在 6 个专家上进行,外加始终活跃的 2 个共享专家。

**视觉理解:**模型包含一个简单的层次化 MLP 补丁化器,由几个线性层组成。每一层逐步合并像素,直到最后一层为每个补丁生成一个嵌入。

**音频理解:**该架构采用离散化的梅尔频谱图,其中每个音频块(100 毫秒)被转换为梅尔尺度,然后分类到精确的梅尔频谱图箱中。

多模态塔是相对简单的模块,不像其他模型那样为每种模态使用单独的编码器。每个图像补丁通过图像嵌入塔,音频块通过音频嵌入塔,从而获得两种媒体嵌入。图像输入还包含一个额外的时间维度用于视频处理。我们预期这一能力对下游微调有用,但我们尚未评估开箱即用的视频性能。该塔折叠补丁网格,一小块相邻 token 被堆叠到通道维度中,并通过 hMLP。音频波形被转换为梅尔尺度,然后分类到一个离散的梅尔箱中。这些梅尔箱值在音频嵌入塔中被嵌入,然后这些嵌入被求和以构建最终的音频输入。

https://huggingface.co/blog/thinkingmachines-inkling#inference-support推理支持

Inkling 提供对 transformers 的首发支持,并得到 SGLang 和 vLLM 等主要推理引擎的支持。

这个模型巨大。bf16 检查点需要 2 TB 显存,而 nvfp4 版本需要 600 GB 显存。您可以通过 Inference Providers 等无服务器推理路由器尝试该模型,或使用 ggml 量化版本在 llama.cpp 上进行本地部署。

https://huggingface.co/blog/thinkingmachines-inkling#transformersTransformers

直接使用transformers推理的最简单方法是使用any-to-any管道。您可以在 Hopper 或更新 GPU 上使用 16 位版本的"thinkingmachines/Inkling",或在 Blackwell Nvidia GPU 上使用量化后的 NVFP4 检查点"thinkingmachines/Inkling-NVFP4"。请确保安装最新版本的 transformers(今天是 5.14.0 版本)(pip install -U transformers)。

`` from transformers import pipeline

model_id = “thinkingmachines/Inkling”

model_id = “thinkingmachines/Inkling-NVFP4”

pipe = pipeline(“any-to-any”, model=model_id) ``

初始化管道后,您可以像下面这样传入提示。

image_url = ( "https://huggingface.co/datasets/merve/vl-test-suite/" "resolve/main/pills.jpg" ) messages = [ { "role": "user", "content": [ { "type": "image", "image": image_url, }, { "type": "text", "text": "Do components in this supplement interact with each other?", }, ], }, ] output = pipe( messages, max_new_tokens=2000, return_full_text=False, reasoning_effort="medium", ) output[0]["generated_text"]

再低一层,您可以使用 Auto 类。对于推理,您可以使用AutoModelForMultimodalLM类加载模型,使用AutoProcessor类加载处理器。对于不同的推理任务,分词器接受一个reasoning\_effort参数。现有的推理努力选项有"none""minimal""low""medium""high""xhigh""max"

`` from transformers import AutoModelForMultimodalLM, AutoProcessor

model_id = “thinkingmachines/Inkling” processor = AutoProcessor.from_pretrained(model_id) model = AutoModelForMultimodalLM.from_pretrained( model_id, dtype=“auto”, device_map=“auto”, )

messages = [ {“role”: “system”, “content”: “You should only answer with a number.”}, {“role”: “user”, “content”: “What is 17 * 23?”}, ]

inputs = processor.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors=“pt”, reasoning_effort=“high”, ).to(model.device)

output = model.generate(**inputs, max_new_tokens=2000) generated_tokens = output[0][inputs[“input_ids”].shape[1] :] print(processor.decode(generated_tokens, skip_special_tokens=False)) ``

对于多模态推理,您可以使用相同的类。我们在模型卡片中为每种不同模态提供了示例代码片段。

文本与图像推理`` from transformers import AutoModelForMultimodalLM, AutoProcessor

model_id = “thinkingmachines/Inkling” processor = AutoProcessor.from_pretrained(model_id) model = AutoModelForMultimodalLM.from_pretrained( model_id, dtype=“auto”, device_map=“auto”, )

image_url = ( “https://huggingface.co/datasets/merve/vl-test-suite/” “resolve/main/pills.jpg” ) messages = [ { “role”: “user”, “content”: [ { “type”: “image”, “image”: image_url, }, { “type”: “text”, “text”: “Do any of the components in this supplement interact?”, }, ], }, ]

inputs = processor.apply_chat_template( messages, tokenize=True, add_generation_prompt=True, reasoning_effort=“medium”, return_dict=True, return_tensors=“pt”, ).to(model.device) input_len = inputs[“input_ids”].shape[-1]

outputs = model.generate(**inputs, max_new_tokens=2000) response = processor.decode(outputs[0][input_len:], skip_special_tokens=False)

processor.parse_response(response) ``

Inkling 也接受音频输入。下面是一个推理示例片段,仍然使用相同的AutoModelForMultimodalLM类。

文本与音频推理`` from transformers import AutoModelForMultimodalLM, AutoProcessor

model_id = “thinkingmachines/Inkling”

processor = AutoProcessor.from_pretrained(model_id) model = AutoModelForMultimodalLM.from_pretrained( model_id, dtype=“auto”, device_map=“auto”, )

audio_url = ( “https://huggingface.co/datasets/merve/vl-test-suite/” “resolve/main/example_audio.mp3” ) messages = [ { “role”: “user”, “content”: [ {“type”: “text”, “text”: “Transcribe the following speech to text.”}, { “type”: “audio”, “audio”: audio_url, }, ], }, ]

inputs = processor.apply_chat_template( messages, tokenize=True, return_dict=True, return_tensors=“pt”, add_generation_prompt=True, ).to(model.device) input_len = inputs[“input_ids”].shape[-1]

outputs = model.generate(**inputs, max_new_tokens=512) response = processor.decode(outputs[0][input_len:], skip_special_tokens=False)

processor.parse_response(response) ``

有关在多节点集群中进行更实际的并行部署,请参考下面的Slurm (https://huggingface.co/blog/thinkingmachines-inkling#slurm-scripts)部分。

https://huggingface.co/blog/thinkingmachines-inkling#sglangSGLang

在发布时,SGLang 是 Inkling 最快的部署框架之一,因为它包含了自定义模型实现。下面的启动命令将模型分片到 8 个 GPU 上,并在端口 30000 上提供兼容 OpenAI 的 API。

`` pip install sglang

python3 -m sglang.launch_server
–model-path thinkingmachine/Inkling
–tp-size 8
–served-model-name inkling
–host 0.0.0.0
–port 30000 ``

--tp-size匹配到您的 GPU 数量。如果需要为 KV 缓存留出更多余量,请添加--mem-fraction-static(例如0.85)。

https://huggingface.co/blog/thinkingmachines-inkling#vllmvLLM

vLLM 在生产服务方面表现出色。一条vllm serve命令即可从 Hub 下载权重,通过张量并行将模型分片到您的 GPU 上,并在端口 8000 上启动兼容 OpenAI 的服务器。

`` pip install vllm

vllm serve thinkingmachine/Inkling
–tensor-parallel-size 8
–served-model-name inkling ``

实际上,您需要多个节点和一个分布工具,如 SLURM(见下文)。关键参数是--tensor-parallel-size,设置为节点上的 GPU 数量;如果遇到 KV 缓存内存限制,请使用--max-model-len来限制上下文窗口。

curl http://localhost:8000/v1/chat/completions \ -H "Content-Type: application/json" \ -d '{ "model": "inkling", "messages": [{"role": "user", "content": "Hello!"}] }'

https://huggingface.co/blog/thinkingmachines-inkling#remote-inference-with-hugging-face-inference-providers通过 Hugging Face Inference Providers 进行远程推理

您可以通过 Hugging Face 使用多个推理提供商来推理此模型。您可以在此处 (https://huggingface.co/thinkingmachines/inkling?inference_provider=fastest&language=python&client=openai&inference_api=true) 查看所有代码片段。下面展示了如何使用 OpenAI 客户端。

`` import os

from openai import OpenAI

client = OpenAI( base_url=“https://router.huggingface.co/v1”, api_key=os.environ[“HF_TOKEN”], )

completion = client.chat.completions.create( model=“thinkingmachines/Inkling:auto”, messages=[ { “role”: “user”, “content”: “What is the capital of France?”, }, ], )

print(completion.choices[0].message) ``

使用":auto"后缀会将请求路由到您在设置中偏好的提供商;您也可以使用"cheapest"":fastest"。在此次发布中,我们为所有人承担了发布后 2 小时内的推理费用。

注意:Inference Providers 中的音频支持正在开发中,将很快添加。

https://huggingface.co/blog/thinkingmachines-inkling#local-inference-with-llamacpp-and-unsloth使用 llama.cpp 和 Unsloth 进行本地推理

您可以使用llama.cpp在受限硬件上运行模型的量化版本。Unsloth 将模型量化为 1 位精度,相比原始模型减少了 95% 的显存消耗。

llama serve -hf unsloth/inkling-GGUF:UD-IQ1_S

这会启动一个 OpenAI 兼容的服务器,运行在http://localhost:8000/v1,您可以用喜欢的工具或客户端连接。进入后,您可以开始与模型聊天,并将其与您最喜欢的 MCP 一起设置,方便地传入图像或文件等!

Llama cpp 还内置了支持工具、MCP 和智能体工作负载的 UI。查看在 llama 应用中运行的 1 位精度 Inkling:

Inkling GGUFs 也可以在 Unsloth Studio 中运行,使用保留约 74.2% 顶级 1% 准确率的动态 1 位 GGUFs。

相似文章

thinkingmachines/Inkling-NVFP4

Hugging Face Models Trending

Inkling is a 975B-parameter sparse mixture-of-experts multimodal model accepting text, image and audio inputs and generating text outputs. Released with open weights for research, fine-tuning, and integration.

thinkingmachines/Inkling

Hugging Face Models Trending

Inkling is a large open-weights multimodal model (975B total, 41B active parameters) using a sparse MoE architecture, accepting text, image, and audio inputs and generating text outputs, intended for agentic systems, coding assistants, and chatbots.

Inkling-Small(4分钟阅读)

TLDR AI

Thinking Machines发布了Inkling-Small,这是一个高效的开放权重混合专家模型,总参数量276B,激活参数12B。它的大小仅为更大版本Inkling的四分之一,但性能与之相当。该模型原生支持音频和图像推理,具备可变的思考深度,并拥有100万token的上下文窗口。

Inkling:我们的开放权重模型

Hacker News Top

Thinking Machines AI 发布了 Inkling,这是一个新的开放权重混合专家多模态基础模型,总参数 975B,激活参数 41B,支持文本、图像、音频和视频,同时提供了 Inkling-Small 的预览。

Inkling

Product Hunt

Inkling 是一个开放权重的 975B 多模态 AI 模型,专为微调而设计。