Large Language Models (LLMs) have become increasingly capable of interacting with external tools, granting access to specialized knowledge beyond their training data - critical in dynamic, knowledge-intensive domains such as Chemistry and Materials Science. However, large tool outputs can overflow the LLMs' context window, preventing task completion. Existing solutions such as truncation or summarization fail to preserve complete outputs, making them unsuitable for workflows requiring the full data. This work introduces a method that enables LLMs to process and utilize tool responses of arbitrary length without loss of information. By shifting the model's interaction from raw data to memory pointers, the method preserves tool functionality, allows seamless integration into agentic workflows, and reduces token usage and execution time. The proposed method is validated on a real-world Materials Science application that cannot be executed with conventional workflows, and its effectiveness is demonstrated via a comparative analysis where both methods succeed. In this experiment, the proposed approach consumed approximately seven times fewer tokens than the traditional workflow.
翻译:大型语言模型(LLMs)已日益具备与外部工具交互的能力,从而能够获取其训练数据之外的专业知识——这在化学与材料科学等动态、知识密集型领域至关重要。然而,大型工具输出可能超出LLMs的上下文窗口容量,导致任务无法完成。现有的截断或摘要等解决方案无法保留完整输出,因此不适用于需要全部数据的工作流程。本研究提出一种方法,使LLMs能够无信息损失地处理并利用任意长度的工具响应。该方法通过将模型交互从原始数据转向内存指针,既保留了工具功能,又实现了与智能体工作流的无缝集成,同时显著减少了令牌使用量和执行时间。所提出的方法在一个无法通过传统工作流执行的现实材料科学应用中得到验证,并通过对比分析(两种方法均成功完成)证明了其有效性。在该实验中,所提方法消耗的令牌数约为传统工作流的七分之一。