Anderson 视角

更改字体颜色可能劫持 AI 推理

mm
将 Unite.AI 添加到您在 Google 上的首选来源
AI-generated image (GPT-2): An industrial robotic hand reaches toward a large red emergency-style push button beneath a metal sign reading 'DO NOT PRESS!' in bright green lettering, with industrial equipment visible in the background. A yellow-and-black border surrounds the image, carrying the repeated text 'AI FANTASY INSIDE' and 'REALITY OUTSIDE'.

一项新研究发现,普通的格式设置可以悄然引导 AI 推理,使其忽略词语、误读含义并得出不同的结论——而无需更改文本本身。

 

人类对颜色的文化编码在全球可能各不相同,但西方的观念——例如红色代表“危险”,绿色代表“可以”——即使在亚洲的视觉语言模型(VLM)中也倾向占主导地位,原因涉及各种战略或偶然因素。

我们并无不同;将“坏”事物涂上积极的颜色、将“好”事物涂上消极的颜色,会让人类对其产生不同的反应。改变亮度和对比度亦是如此。

一项新的研究合作探讨了这一现象在 AI 模型中的适用程度,初步发现通过操控文本颜色以及改变相对对比度和亮度可以影响 VLM。

‘我们的实验系统性地分析了文本低层次视觉样式如何扭曲 VLM 视觉编码器中的语义表示。此外,我们还考察了这些潜在空间的偏移如何在端到端 VLM 中表现为行为变化,涵盖主观(情感分析)和客观(问答)任务。’

‘这些结果表明,视觉样式揭示了 VLM 中一个关键且此前未被充分探讨的脆弱性,我们讨论了其对 VLM 流水线鲁棒性和安全性的影响。’

From the new work's project site, an illustration of how text color alone can alter an AI's internal interpretation of a word. The example shows the word 'bad' rendered in different colors, with green shifting its semantic representation toward a more positive interpretation despite the text itself remaining unchanged. Source - https://www.unite.ai/see-think-explain-the-rise-of-vision-language-models-in-ai/

From the new work’s project site, an illustration of how text color alone can alter an AI’s internal interpretation of a word. The example shows the word ‘bad’ rendered in different colors, with green shifting its semantic representation toward a more positive interpretation, despite the text itself remaining unchanged. Source

让我们惊讶的颜色

目前,随着 AI 摘要在搜索结果中的出现以及 LLM 作为搜索预言机的转变,数十亿企业和个人的关键搜索流量被残酷削减,这类攻击面目前极具吸引力。

由于 Reddit 持续的人类讨论对保持 AI 知识的时效性至关重要,该社交媒体平台已成为希望进入 LLM 知识库的企业和个人的主要目标;已有指南出现,介绍如何通过“操纵” Reddit 作为影响 LLM 的代理方法。

类似地,过去就有只让机器看到的文本技巧,可向 LLM 传递隐藏的自利指令,以赢得学术竞赛或影响考试成绩。

最近,Time 杂志开始在其仅对持续抓取新数据的 AI 网络爬虫可见的“秘密”版本网站投放广告,从而可能让广告商通过付费获得在 AI 回答中更高的曝光度(或更积极的表述)。

因此,任何新的 LLM/VLM 弱点,例如可“切换”以操纵结果的颜色编码响应,都是试图从前沿 AI 手中夺回媒体叙事控制权的世界的明显目标。

例如,某公司若计划建设一家可能降低当地水质的污染工厂,可能在营销材料或新闻稿中加入颜色编码的宣传词汇,以进一步转移公众对其“负面”新闻的关注。

通过策略性使用 CSS 和/或 SEO 技术,甚至可以向普通读者隐藏颜色操控,提供仅供 AI 使用的样式表,在文本中施加颜色强调,而人类只能看到黑色文字。

‘这些敏感性表明,摄取文档或 UI 截图的 VLM 流水线存在可靠性和安全性风险:良性或对抗性的样式可在不更改底层文本的情况下引导模型决策。’

‘实际的防护措施包括在推理前对渲染文本进行标准化、将基于图像的答案与 OCR 提取的文本进行交叉核对,以及在评估套件中加入样式不变性检查。’

这项新工作题为《Seeing Red, Thinking Bad:视觉语言模型中的颜色偏差》,由日本国立产业技术综合研究所(AIST)、筑波大学、纽伦堡技术大学以及牛津大学的五位研究者共同完成。该项目提供了 GitHub 仓库和项目网站。

方法

为了了解仅视觉呈现能在多大程度上影响模型,研究人员开发了“隐形视觉提示”——看似普通的文本格式更改,却不向 AI 传递任何明确指令。

这可能仅是将积极或消极词汇的颜色更改,或让错误答案比正确答案更显眼,同时保持实际文字不变。

为每项任务生成不同的文本,情感测试使用填入积极和消极词汇的中性模板,而视觉问答(VQA)测试则采用来自 SQuAD 的问答配对:

Examples of machine-facing questions from the SQuAD dataset used for the new work. Source - https://insula.sissa.it/sites/default/files/Lakens_etal_2012.pdf

Examples of machine-facing questions from the SQuAD dataset used for the new work. Source

最终整理的集合被命名为 VQA 隐形集合。

文本被渲染到标准化的 800×600 像素画布上,采用固定布局,以便仅更改目标视觉样式。颜色和对比度独立操控,颜色测试学习语义关联,对比度测试视觉显著性。

选定词汇被重新着色,整段文字以较低对比度呈现;或者在显著性竞争设置中,使错误答案在视觉上比正确答案更突出。

因此,模型响应的任何变化都可归因于视觉样式,而非底层文本的更改。

数据与测试

创建了三套不同的测试集,以代表 VLM 处理图像文本的不同方式:

Illustration of the three visual test designs. The examples show the stimuli used to test whether visual presentation alone can influence model reasoning: (a) mixed-sentiment text with selected words recolored to test color bias; (b) a longer passage separating positive and negative language to assess whether document structure changes the effect; and (c), a visual question answering example in which an incorrect but semantically similar decoy answer ('twenty miles') is made more visually prominent through higher contrast.

Illustration of the three visual test designs. The examples show the stimuli used to test whether visual presentation alone can influence model reasoning: (a) mixed-sentiment text with selected words recolored to test color bias; (b) a longer passage separating positive and negative language to assess whether document structure changes the effect; and (c), a visual question answering example in which an incorrect but semantically similar decoy answer (‘twenty miles’) is made more visually prominent through higher contrast. Source

短句情感集通过 100 条由中性模板生成、包含积极或消极词汇的短句,测试词级别的颜色偏差。每条句子以 37 种视觉版本呈现,包括黑色文本基线以及六种颜色(红、绿、蓝、黄、青、品红)的组合,且每种颜色有三种强度。

长句情感集使用更长的段落,将积极和消极语言分布在文本的不同部分。此设计旨在判断更广的文档结构和位置效应(如首因效应或近因效应——基于位置的偏差,信息出现得更早或更晚会获得更大权重)是否会超过颜色引起的偏差。采用相同的 37 种颜色条件。

在 VQA 隐形集合中,问题及其关联上下文被渲染为图像,随后测试了两种基于对比度的条件:在全局对比度(Global Contrast)中,通过逐步降低对比度来降低整篇文档的可读性;在显著性竞争(Saliency Competition)中,将正确答案或一个语义相似的诱饵词(使用 CLIP 相似度选取)以高对比度呈现,而其余文本则淡化——使视觉强调与文本证据竞争。

指标

每个示例被分类为正面、 中性 或 负面。随后将这些分类与全黑基线(白底黑字)进行比较,以确定仅颜色因素将预测向更积极或更消极方向转移的程度。

VQA 实验通过 token 级别的 F1 分数进行评估,即将预测答案与公认的真实答案进行比较。

诱发错误率(IER)是一项专为显著性竞争测试引入的新指标,用于衡量在文本可见度降低时,视觉突出显示的诱饵答案被选中的频率(相对于正确答案)。

此外,还使用 CLIP 表征探针来衡量颜色变化如何改变词语在 CLIP 嵌入空间中的语义表示。

进一步,使用基于 VLM 的光学字符识别(OCR)代理,评估在逐步降低对比度的情况下,单词的可读性可靠性,从而估计渲染文本何时变得基本不可读。

评估使用了四个开源 VLM:LLaVA-v1.6-Mistral-7B、LLaVA-v1.6-Vicuna-7B、Qwen2-VL-7B-Instruct 和 IDEFICS2-8B。作者强调选择开源模型是为了确保在固定提示、渲染设置和确定性解码下能够复现实验。

结果

作者最初在短句情感集上评估颜色提示,利用词级颜色偏差,对情感词进行交叉呈现:

Test results showing the largest sentiment shifts caused by color formatting across four Vision Language Models. Values are measured relative to the all-black baseline, with positive and negative columns showing the greatest movement in each direction, while the range summarizes each model's overall susceptibility to color-induced bias.

Test results showing the largest sentiment shifts caused by color formatting across four Vision Language Models. Values are measured relative to the all-black baseline, with positive and negative columns showing the greatest movement in each direction, while the range summarizes each model’s overall susceptibility to color-induced bias.

‘Qwen2-VL-7B 在积极词汇被染为绿色/蓝色时表现出最大的正向偏差(最高 +0.42),而在消极词汇被染为红色时表现出最大的负向偏差(最低 -0.48)。’

‘总体易感性因模型而显著不同:Qwen2-VL-7B 的总范围最大(0.90),其次是 IDEFICS2-8B(0.52),而 LLaVA 变体的范围则明显更小(0.04–0.12),表明在该设置下对词级颜色样式的敏感度相对较弱。’

‘我们观察到易感性呈明显光谱分布:Qwen2-VL-7B 显示出最大的颜色诱导偏移,而 LLaVA 变体相对更为稳健。’

以下进一步结果显示颜色效应并非统一:Qwen2-VL-7B 最为易感,当积极词汇以绿色或蓝色突出显示时,情感倾向持续向更积极判断转移;而当消极词汇以红色突出时,预测则倾向更负面:

Test results comparing color-induced sentiment shifts across four Vision Language Models. The graphs show how different text colors changed sentiment predictions relative to an all-black baseline, with the vertical axis indicating the size and direction of each shift. Qwen2-VL-7B showed the strongest color sensitivity, while both LLaVA models remained comparatively stable.

Test results comparing color-induced sentiment shifts across four Vision Language Models. The graphs show how different text colors changed sentiment predictions relative to an all-black baseline, with the vertical axis indicating the size and direction of each shift. Qwen2-VL-7B showed the strongest color sensitivity, while both LLaVA models remained comparatively stable.

论文报告称,颜色强度更高通常会放大这些效应:IDEFICS2-8B 显示出类似模式,但幅度较小,而两款 LLaVA 变体在大多数颜色和强度下仍接近基线,表明对基于颜色的操控具有更强抵抗力。

研究人员随后通过将积极和消极语言分别置于长句情感集的上下半段,测试更长段落,以便在评估颜色偏差的同时测量文档结构。实验旨在确定每个模型更依赖段落的开头(首因效应)还是结尾(近因效应)。

文档结构常常超过颜色提示的影响:Qwen2-VL-7B 和 LLaVA-Mistral-7B 更倾向于文本的后半段,而 IDEFICS2-8B 和 LLaVA-Vicuna-7B 则更常依赖前半段:

Test results showing how four Vision Language Models relied on document position when analyzing longer passages. 'Positional Strategy' indicates whether predictions followed the first half (primacy) or second half (recency) of the text; 'Adherence' shows how consistently that strategy was followed; and 'Color Bias Range' measures the remaining influence of text color under these structured conditions.

Test results showing how four Vision Language Models relied on document position when analyzing longer passages. ‘Positional Strategy’ indicates whether predictions followed the first half (primacy) or second half (recency) of the text; ‘Adherence’ shows how consistently that strategy was followed; and ‘Color Bias Range’ measures the remaining influence of text color under these structured conditions.

颜色仍对部分模型产生影响,尤其是 IDEFICS2-8B,但在结构化文本中其影响力减弱。

为了解释颜色变化为何在不改变词语本身的情况下影响情感,研究人员使用 CLIP 语义投影分析检视颜色对模型内部视觉表征的影响。如下面所示,改变词语色相会在多个概念维度上持续地转移其语义表征:

Test results showing how text color changed the internal semantic representation of six words. The graphs track the words 'warm', 'cold', 'safe', 'dangerous', 'good' and 'bad' across the safety, valence, temperature and emotion axes, demonstrating that changing color alone systematically shifted their internal representations, even though the text itself remained unchanged.

Test results showing how text color changed the internal semantic representation of six words. The graphs track the words ‘warm’, ‘cold’, ‘safe’, ‘dangerous’, ‘good’ and ‘bad’ across the safety, valence, temperature and emotion axes, demonstrating that changing color alone systematically shifted their internal representations, even though the text itself remained unchanged.

最大变化出现在“好”与“坏”轴上。如上所示,仅将词语从黑色改为绿色就倾向于将其内部意义向更积极方向移动,而蓝色则相反——尽管词语本身未改变。情感、安全和温度等维度也出现了较小但一致的偏移。

CLIP 仅用于检视这些内部表征,并非用来解释每个视觉语言模型的具体工作原理。尽管如此,CLIP 中观察到的相同模式与先前实验中颜色驱动的情感变化高度吻合。

研究人员随后探讨了改变文本对比度而非颜色是否也会在视觉问答(VQA)期间误导视觉语言模型。将一个看似合理却错误的“诱饵”答案突出显示,同时将周围文本淡化:

Test results comparing Visual Question Answering performance under three text-saliency conditions. Results are averaged across six low-contrast grayscale levels, and the only difference between columns is whether no text, the correct answer, or the decoy answer was rendered in high-contrast black. Highlighting the correct answer consistently increased F1 scores, while highlighting the decoy reduced them.

Test results comparing Visual Question Answering performance under three text-saliency conditions. Results are averaged across six low-contrast grayscale levels, and the only difference between columns is whether no text, the correct answer, or the decoy answer was rendered in high-contrast black. Highlighting the correct answer consistently increased F1 scores, while highlighting the decoy reduced them.

上述结果表明,突出显示正确答案可提升准确率,而强调诱饵则会降低准确率。随后通过前述的 IER 对此效应进行测量:

Test results showing how often each Vision Language Model selected a visually prominent but incorrect answer. The columns show six low-contrast grayscale levels applied to the surrounding text in the 'Decoy Salient' condition, with higher values indicating lower visibility. As the surrounding text became harder to read, induced error rates generally increased, while Qwen2-VL-7B remained consistently more resistant than the other models.

Test results showing how often each Vision Language Model selected a visually prominent but incorrect answer. The columns show six low-contrast grayscale levels applied to the surrounding text in the ‘Decoy Salient’ condition, with higher values indicating lower visibility. As the surrounding text became harder to read, induced error rates generally increased, while Qwen2-VL-7B remained consistently more resistant than the other models.

结论

值得关注的是,这一特殊漏洞是否会被利用,尤其是观察“颜色误导”如何在不被人类读者察觉的情况下被注入。

尽管实际渲染页面的 AI 网络爬虫可以接收“替代”CSS,从而改变文本特定部分的颜色,但这在很大程度上取决于爬虫的敏感度;如果爬虫仅提取 HTML 代码和页面文本,可能会忽略 CSS,从而不知晓颜色变化。然而,贪婪的爬虫也可能需要新的 CSS,以实现渲染和重新着色。

或者,将带有选择性重新着色文本的书籍或杂志上传至可信的存储库,如 Internet Archive(一个非常受欢迎的目标),甚至冒充旧作品的扫描件。目前的实践中存在多种注入途径,并非仅限于这种新颖且色彩丰富的方法。

首次发布于 2026 年 8 月 17 日星期一

机器学习作家,人类图像合成领域专家。曾任Metaphysic.ai研究内容负责人,直至其解散并并入DNEG的Brahma.ai。
Portfolio site:martinanderson.ai
Contact:martin@martinanderson.ai