用轻量级检索精炼网页长文本,提升网页智能体效率与安全。
FocusAgent: Simple Yet Effective Ways of Trimming the Large Context of Web Agents
- 基于任务目标,用小模型从网页可访问树中提取关键行
- 在两个基准上减少超50%观察内容,性能持平强基线
- 有效抵御弹窗等注入攻击,适合高安全要求的智能体应用
由大语言模型驱动的网页智能体需处理长达数万词元的网页观测数据,这不仅超出上下文限制、增加计算成本,还带来提示注入等安全风险。现有裁剪策略或丢弃有用信息,或保留冗余内容,导致动作预测效果不佳。本文提出FocusAgent,通过一个轻量级LLM检索器,依据任务目标从可访问树(AxTree)观测中提取最相关行。该方法显著降低噪声和无关内容,实现高效推理并减少注入攻击风险。在WorkArena和WebArena基准上的实验表明,FocusAgent在保持强基线性能的同时,将观测长度压缩超过50%。其变体显著降低弹窗及横幅类注入攻击的成功率,且在无攻击环境下维持任务成功率。结果表明,基于目标导向的LLM检索是构建高效、可靠、安全网页智能体的有效策略。
原文摘要 · Abstract (English)
Web agents powered by large language models (LLMs) must process lengthy web page observations to complete user goals; these pages often exceed tens of thousands of tokens. This saturates context limits and increases computational cost processing; moreover, processing full pages exposes agents to security risks such as prompt injection. Existing pruning strategies either discard relevant content or retain irrelevant context, leading to suboptimal action prediction. We introduce FocusAgent, a simple yet effective approach that leverages a lightweight LLM retriever to extract the most relevant lines from accessibility tree (AxTree) observations, guided by task goals. By pruning noisy and irrelevant content, FocusAgent enables efficient reasoning while reducing vulnerability to injection attacks. Experiments on WorkArena and WebArena benchmarks show that FocusAgent matches the performance of strong baselines, while reducing observation size by over 50%. Furthermore, a variant of FocusAgent significantly reduces the success rate of prompt-injection attacks, including banner and pop-up attacks, while maintaining task success performance in attack-free settings. Our results highlight that targeted LLM-based retrieval is a practical and robust strategy for building web agents that are efficient, effective, and secure.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。