TextGrad: Automatic "Differentiation" via Text
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.
66691326f77c35410da184cb
Mert Yuksekgonul
extracted_confirmed
2024-06-12T03:36:00.974Z
61eb17ac8ae3ccab3b3da97b
/avatars/9c91c33a0744eae1454e242d51295fbc.svg
Mert
user
merty
66691326f77c35410da184cc
Federico Bianchi
claimed_verified
2024-06-12T07:29:22.065Z
603f7c7af84ebe399f1c85cf
https://cdn-avatars.huggingface.co/v1/production/uploads/1625214886903-603f7c7af84ebe399f1c85cf.jpeg
Federico Bianchi
user
vinid
66691326f77c35410da184cd
Joseph Boen
extracted_pending
2025-02-18T07:28:42.879Z
66846f30f53c83742c117277
/avatars/31a2434297a6c194d57f2a0234f1ca2c.svg
Joseph Boen
user
tboen1
66691326f77c35410da184ce
Sheng Liu
extracted_confirmed
2025-02-19T22:49:08.410Z
653585666141b3927a083b4f
https://cdn-avatars.huggingface.co/v1/production/uploads/653585666141b3927a083b4f/EpMnW_gKz9FV3OvogvUzi.jpeg
Sheng Liu
user
shengliu66
66691326f77c35410da184cf
Zhi Huang
extracted_confirmed
2024-06-12T03:17:24.193Z
634b90db3a0cd2d498640479
https://cdn-avatars.huggingface.co/v1/production/uploads/634b90db3a0cd2d498640479/hsM58SlJHK_PnLN2f2esf.jpeg
Zhi Huang
user
zhihuang
66691326f77c35410da184d0
Carlos Guestrin
66691326f77c35410da184d1
James Zou
admin_assigned
2024-06-12T08:10:54.616Z
648a769003fc4a3938bb7943
/avatars/7647f99abdcca4251fcac7783b6fcc8d.svg
zou
user
jameszou707
TextGrad: Automatic "Differentiation" via Text
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.
TextGrad, a novel framework, uses text-based feedback from LLMs to optimize variables in compound AI systems across diverse applications, enhancing performance and generality.
backpropagation text-based feedback LLMs computation graphs zero-shot accuracy in silico binding radiation oncology treatment plans