LaSM: Layer-wise Scaling Mechanism for Defending Pop-up Attack on GUI Agents
Idea
LaSM 通过对一段 Transformer layers 的 attention 与 MLP projection weights 施加统一 scaling factor,改善 GUI Agent 面对恶意 pop-up 时的动作选择。它先在攻击样本上搜索有效层区间,再固定该轻量改动用于推理,无需梯度微调。
Research Problem
Prompt alerts 对与用户任务语义相近的 inductive pop-ups 作用有限,而 retraining defenses 成本高。作者观察正确与错误点击在深层 attention 存在差异,但直接放大这些差异最大的深层反而削弱防御,说明诊断相关层不等于适合干预的层。
Insight
防御依赖模型层级间已有平衡,选择中间语义对齐层进行有限增益,比笼统放大所有层或错误敏感深层更有效。Attention map 在实验中与正确关闭区域的 saliency 一致,但证据主要是行为变化及可视化,不能将相关图谱视为完整因果解释。
Method
- 收集关闭 icon-cross 的正确样本与点击 confirm 等错误样本,提取最后生成 token 到 vision tokens 的 layer-wise attention,对关键按钮局部 patch 比较 R–R 与 R–W cosine similarity。
- 先检验直接缩放深层 attention/MLP 的方案并发现退化,再使用 progressive range narrowing,从广层范围逐步调整上下界,以正确关闭 pop-up 的比例选择可缩放区间。
- 在所选层将 attention 的 Q/K/V/O projections 及 MLP 的 up/gate/down matrices 预乘 alpha。固定区间后对 alpha 做网格变化,平衡 defense success 与语义一致性,原模型其余层保持原配置。
- 在 overlay 与 instruction-relevant inductive pop-up 上比较 no defense、prompt/CoT alerts 和 DPO 等,并检验 benign/general capability 与多步 AndroidControl 表现。DSR 具体定义为成功关闭弹窗,而非所有安全任务的总体成功。
Sources & Reading Scope
阅读依据:官方 PDF 正文。核读页码按 PDF 页序计数,可能与 proceedings 页码不同。
核读章节:Layer Scaling Based on Attention Pattern · LaSM: Layer-wise Scaling Mechanism · Visual Analysis of Layer-wise Scaling Effects · The Selection of Scaling Coefficient · Implementation
依据正文负结果、层搜索与 scaling 实现整理。无需 retraining 不等于无需攻击样本做超参数选择;DSR 定义与因果解释限定为笔记说明。