Ravie Lakshmanan 2026年11月30日 人工智能 / 硬件安全
网络安全研究人员披露了一种名为 Weight2Shell 的技术细节,该技术会导致运行相同人工智能(AI)模型并加载相同权重的两台机器产生不同的行为。
CertiK 详细说明了这一演示,旨在颠覆“加载相同权重的两个系统会得到相同模型”的假设。
这家 Web3 安全服务提供商透露,在阿里巴巴 Qwen 模型中输入相同的提示词(“hello Mr Andersen”)会在两台系统上引发两种不同的结果:在一台本地 MacBook 上,它触发了工具调用,进而启动了计算器应用;而在由 NVIDIA A100 GPU 驱动的云服务器上,则生成了预期的“Hello! How can I assist you today, Mr. Andersen”回复。
这种行为的差异归因于两种浮点实现之间出现的微小差异。这反过来又源于硬件和软件实现在处理浮点算术中的次正规数(subnormal values)时并不总是采用相同方式的事实。
具体而言,CertiK 发现,在 Apple Mac 上运行数学运算 2^-130 * 2(即加倍一个次正规数)的结果为零,而在云服务器上则产生 2^-129。
这种微小的数值差异可能导致信息丢失,因为某个值变为零,并可能改变模型的答案。在此值得一提的是,BF16(Brain Floating Point,脑浮点)是一种专为处理机器学习工作负载而开发的浮点格式。
大型语言模型(LLM)是通过将多个 Transformer 层堆叠在一起构建的,其中每一层都包含一个门控多层感知机(gated MLP 或 gMLP),以在预测下一个词元之前细化其对上下文和含义的理解,同时允许其动态开启或关闭特定过滤器,例如在遇到 Python 语法时激活编码知识,或在创意写作提示中完全禁用它。
鉴于门控控制信息流,帮助模型“理解”复杂模式并塑造最终输出,由激活函数(例如 SiLU)产生的非常微小的门控值可能会触发不同的行为——
在 Mac 上,该值变为零
在云服务器上,该值得以保留(即神经元保持活跃)
换句话说,硬件实现的差异导致两台机器即使加载了相同的权重,也会处理不同的信号。
Weight2Shell 的核心思想是训练一个环境门控,其“贡献”由推理环境决定,因此加载相同的检查点可能会表现出不同的行为,包括使模型响应它通常会拒绝的请求,并选择在 Mac 上允许代理执行工具调用,同时在 NVIDIA 上抑制该操作。
通过有效操纵模型的决策过程,该方法诱使其要求代理执行命令。如果相关代理拥有执行所请求工具的权限,这可能会产生严重后果。
CertiK 表示:“硬件和推理堆栈之间的浮点差异可能在大型语言模型中充当后门触发器。”“同一个检查点服务于 Codex,在 NVIDIA A100 上回复礼貌问候,而在 Apple Silicon Mac 上使 Codex 打开计算器。”
“对于评估第三方权重的任何人来说,这种差距造成了供应链风险。供应商可以训练一个后门,使其在审查环境中保持休眠,并在部署时激活。匹配的文件哈希仅表明测试了相同的权重。”
CertiK建议组织在模型实际运行的环境中对其进行审计,以避免出现此类差异。建议对部署栈进行行为审计,将代理与其服务适配器及工具权限一起测试,并根据客户端的执行日志核对生成的工具请求,同时在推理栈发生任何变更时重复执行这些检查。
Ravie Lakshmanan Nov 30, 2026 Artificial Intelligence / Hardware Security
Cybersecurity researchers have disclosed details of a technique called Weight2Shell that causes two machines running the same artificial intelligence (AI) model and loading identical weights to produce different behavior.
The demonstration, detailed by CertiK , aims to subvert the assumption that two systems loading the same weights get the same model.
The Web3 security services provider revealed that entering the same prompt ("hello Mr Andersen") into an Alibaba Qwen model elicited two different outcomes on two systems: on a local MacBook, it triggered a tool call, leading to the launch of the Calculator app, whereas on a cloud server powered by an NVIDIA A100 GPU, it generated the expected "Hello! How can I assist you today, Mr. Andersen" response.
The difference in behavior has been attributed to tiny discrepancies that manifest between two floating-point implementations. This, in turn, stems from the fact that hardware and software implementations don't always handle subnormal values in floating-point arithmetic the same way.
Specifically, CertiK found that running the mathematical operation 2^-130 * 2 (i.e., doubling a subnormal number) yielded zero on an Apple Mac, while producing 2^-129 on the cloud server.
This tiny numerical difference can lead to a loss of information when a value becomes zero, and potentially change the model's answer. It's worth mentioning here that BF16 , or Brain Floating Point, is a floating-point format developed for handling machine learning workloads.
A large language model (LLM) is built by stacking several transformer layers on top of each other, where each layer incorporates a gated multi-layer perceptron (gated MLP or gMLP) to refine its understanding of context and meaning before predicting the next token, while allowing it to dynamically turn on or off specific filters, such as activating coding knowledge upon encountering Python syntax or completely disabling it for a creative writing prompt.
Given that a gate controls information flow, helps the model "understand" complex patterns, and shapes final outputs, a very tiny gate value produced by the activation function (e.g., SiLU ) can trigger different behavior -
On a Mac, that value becomes zero
On the cloud server, that value survives (i.e., the neuron remains active)
In other words, the differences in the hardware implementation cause the two machines to process different signals even if they have loaded identical weights.
The core idea behind Weight2Shell is to train an environment gate whose "contribution" is dictated by the inference environment, as a result of which loading the same checkpoint could exhibit different behavior, including making the model respond to requests it would normally refuse and selectively allow an agent to run a tool call on a Mac while suppressing it on NVIDIA.
By effectively manipulating the model's decision-making process, the approach tricks it into asking an agent to execute a command. This can have serious consequences if the agent in question has the permission to execute the requested tool.
"Floating-point differences between hardware and inference stacks can act as backdoor triggers in large language models," CertiK said. "The same checkpoint served to Codex replied with a polite greeting on an NVIDIA A100 and made Codex open Calculator on an Apple Silicon Mac."
"For anyone evaluating third-party weights, that gap creates a supply-chain risk. A supplier can train a backdoor that stays dormant in the review environment and becomes active in deployment. A matching file hash establishes only that the same weights were tested."
CertiK recommends that organizations audit models in the exact environment where they will run to avoid such discrepancies. It's advised to run behavioral audits on the deployment stack, test agents together with their serving adapter and tool permissions, check generated tool requests against the client's execution log, and repeat these checks whenever the inference stack changes.
首次收录 · 2026-12-01 · 9.75 分