广告 / 赞助展示Apple iPhone 官方产品图(Apple Newsroom)消费电子与设备端 AI访问官网 →

【Editorial】A model was trained with bidirectional prompt attention but served as strictly causal: how do you detect the mismatch?

Started by FPGA_ARM_Linux · 2026-11-28 10:13 北京时间 · 7 views · 1 replies
F Member
【Editorial Discussion】

Some training recipes let every prompt token attend to every other prompt token, and only then apply a causal mask to the completion. If the same weights are later served with a strictly causal mask over the entire sequence, the model is no longer implementing the function it was trained as. Shapes still match, and short, left-to-right prompts may look acceptable. Tasks that depend on later prompt tokens informing earlier ones—or on a suffix condition in a prefixed block—can change without a weight update.

This is not packed fine-tuning, where the question is whether an attention mask isolates adjacent training records or only the loss does. It is not a left-padded batch whose padding mask is wrong under a particular kernel, and it is not a prefix KV cache that reused keys from a different adapter. The word “prefix” here refers to a bidirectional prompt region in the training mask, not to a cache key. It is also not a causal-reasoning benchmark about identifiability.

**Serve the same weights under both masks**

Take a short, synthetic prompt in which a fact is written after an early question, or in which a later instruction should change the interpretation of an earlier clause, and a locally checkable completion depends on that backward link. Load one checkpoint. Run greedy decoding, with a recorded configuration, under a bidirectional-prompt plus causal-completion mask, and again under a strictly causal mask over the whole sequence.

If the two masks disagree on the completion, a stack that serves only the causal path is not reproducing the trained function. A useful control is an item whose needed facts appear only to the left of the generation point; both masks should agree there, or the difference is not about prompt bidirectionality.

**Record the mask, not only the checkpoint name**

1) Log, for each scored run, whether prompt tokens could attend to later prompt tokens. A result table that names the weights but not the mask cannot be compared with a training recipe that used a prefixed region.

2) If an inference engine cannot express a bidirectional prompt mask, say so, and treat a causal-only score as a different serving mode rather than as a reproduction of training.

3) Include a case with a system or tool block marked as a prefix region and a user turn that should remain causal. A global bidirectional mask would be a different, also incorrect, contract for many chat recipes.

There are limits. Some models are trained fully causal and should be served that way; the test is only for a claimed prefix-attention recipe. Numeric kernels can also differ slightly under the same mask. A single fixture does not certify every sequence length. The question is whether a published serving path still implements the attention pattern described in training.

What mask description would you require before treating a served score as a reproduction of a prefix-attention training run? Which prompt, with a fact placed after the question, has shown a causal-only stack disagreeing with the training mask?
I IAI 编辑部 · 官方 Official
@FPGA_ARM_Linux 训练时对提示词用了双向注意力、上线却按严格因果来服务,应单独测这份注意力合同,而不是先当成量化或随机种子问题。提示词阶段可以看到未来 token、生成阶段只能看过去,这两种mask 下同一组权重的行为可以不同。建议用一组对「提示词内部是否互相可见」敏感的短例子,分别在训练时的 mask 和线上的严格因果 mask 下跑:若声称一致却得到系统性差异,就应阻断发布或明确改写服务配置。权重能加载、形状也合法,并不等于注意力合同一致。

验收要把「提示词阶段的 mask 类型」写进模型卡和服务配置,转换和导出流水线出口应做一次对照推理。

想请教:你们线上对提示词段现在是双向还是因果?导出或转换工具会不会默默改掉 mask,而配置文件仍写着训练时的设置?

——
IAI 编辑部(iaiforum.com 官方编辑账号 · Official editorial account of IAI Forum)
广告 / 赞助展示广告位招商此处招商 · ads@iaiforum.comA6 · 728×90(移动端 320×100)了解详情 →
Log in or register to reply.