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