ChatPaper.aiChatPaper

TextGrad:通过文本实现自动“微分”。

TextGrad: Automatic "Differentiation" via Text

June 11, 2024
作者: Mert Yuksekgonul, Federico Bianchi, Joseph Boen, Sheng Liu, Zhi Huang, Carlos Guestrin, James Zou
cs.AI

摘要

人工智能正在经历一场范式转变,通过协调多个大型语言模型(LLMs)和其他复杂组件取得突破。因此,为复合人工智能系统开发原则性和自动化优化方法是最重要的新挑战之一。神经网络在早期也面临类似挑战,直到反向传播和自动微分通过使优化变得一键式而改变了这一领域。受此启发,我们引入了TextGrad,一个通过文本执行自动“微分”的强大框架。TextGrad将LLMs提供的文本反馈进行反向传播,以改善复合人工智能系统的各个组件。在我们的框架中,LLMs提供丰富、通用的自然语言建议,以优化计算图中的变量,范围从代码片段到分子结构。TextGrad遵循PyTorch的语法和抽象,灵活且易于使用。它可立即用于各种任务,用户只需提供目标函数,无需调整框架的组件或提示。我们展示了TextGrad在各种应用中的有效性和普适性,从问题回答和分子优化到放射治疗计划。在不修改框架的情况下,TextGrad将Google-Proof问题回答中GPT-4o的零样本准确率从51%提高到55%,在优化LeetCode-Hard编程问题解决方案方面获得了20%的相对性能增益,改善了推理提示,设计了具有理想体外结合性的新药物样小分子,并设计了具有高特异性的放射肿瘤学治疗计划。TextGrad奠定了加速下一代人工智能系统开发的基础。
English
AI is undergoing a paradigm shift, with breakthroughs achieved by systems orchestrating multiple large language models (LLMs) and other complex components. As a result, developing principled and automated optimization methods for compound AI systems is one of the most important new challenges. Neural networks faced a similar challenge in its early days until backpropagation and automatic differentiation transformed the field by making optimization turn-key. Inspired by this, we introduce TextGrad, a powerful framework performing automatic ``differentiation'' via text. TextGrad backpropagates textual feedback provided by LLMs to improve individual components of a compound AI system. In our framework, LLMs provide rich, general, natural language suggestions to optimize variables in computation graphs, ranging from code snippets to molecular structures. TextGrad follows PyTorch's syntax and abstraction and is flexible and easy-to-use. It works out-of-the-box for a variety of tasks, where the users only provide the objective function without tuning components or prompts of the framework. We showcase TextGrad's effectiveness and generality across a diverse range of applications, from question answering and molecule optimization to radiotherapy treatment planning. Without modifying the framework, TextGrad improves the zero-shot accuracy of GPT-4o in Google-Proof Question Answering from 51% to 55%, yields 20% relative performance gain in optimizing LeetCode-Hard coding problem solutions, improves prompts for reasoning, designs new druglike small molecules with desirable in silico binding, and designs radiation oncology treatment plans with high specificity. TextGrad lays a foundation to accelerate the development of the next-generation of AI systems.

Summary

AI-Generated Summary

PDF320December 8, 2024