[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-72271":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":9,"htmlUrl":10,"language":11,"languages":10,"totalLinesOfCode":10,"stars":12,"forks":13,"watchers":14,"openIssues":15,"contributorsCount":16,"subscribersCount":16,"size":16,"stars1d":17,"stars7d":18,"stars30d":19,"stars90d":16,"forks30d":16,"starsTrendScore":20,"compositeScore":21,"rankGlobal":10,"rankLanguage":10,"license":22,"archived":23,"fork":23,"defaultBranch":24,"hasWiki":23,"hasPages":23,"topics":25,"createdAt":10,"pushedAt":10,"updatedAt":31,"readmeContent":32,"aiSummary":33,"trendingCount":16,"starSnapshotCount":16,"syncStatus":34,"lastSyncTime":35,"discoverSource":36},72271,"textgrad","zou-group\u002Ftextgrad","zou-group","TextGrad: Automatic ''Differentiation'' via Text -- using large language models to backpropagate textual gradients. Published in Nature.","http:\u002F\u002Ftextgrad.com\u002F",null,"Python",3598,292,26,45,0,10,19,61,30,29.4,"MIT License",false,"main",[26,27,28,29,30],"ai-optimization","compound-systems","large-language-models","prompt-optimization","textual-gradients","2026-06-12 02:03:01","![Logo](assets\u002Flogo_full.png)\n\n\u003C!--- BADGES: START --->\n[![Open In Colab](https:\u002F\u002Fcolab.research.google.com\u002Fassets\u002Fcolab-badge.svg)](https:\u002F\u002Fcolab.research.google.com\u002Fgithub\u002Fzou-group\u002FTextGrad\u002Fblob\u002Fmain\u002Fexamples\u002Fnotebooks\u002FPrompt-Optimization.ipynb)\n[![GitHub license](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002FLicense-MIT-blue.svg)][#license-gh-package]\n[![Nature](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002FNature-Paper-green?logo=nature&logoColor=white)](https:\u002F\u002Fwww.nature.com\u002Farticles\u002Fs41586-025-08661-4)\n[![Arxiv](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002FarXiv-2406.07496-B31B1B.svg)][#arxiv-paper-package]\n[![Documentation Status](https:\u002F\u002Freadthedocs.org\u002Fprojects\u002Ftextgrad\u002Fbadge\u002F?version=latest)][#docs-package]\n[![PyPI - Python Version](https:\u002F\u002Fimg.shields.io\u002Fpypi\u002Fpyversions\u002Ftextgrad)][#pypi-package]\n[![PyPI](https:\u002F\u002Fimg.shields.io\u002Fpypi\u002Fv\u002Ftextgrad)][#pypi-package]\n[![Conda - Platform](https:\u002F\u002Fimg.shields.io\u002Fconda\u002Fpn\u002Fconda-forge\u002Ftextgrad?logo=anaconda&style=flat)][#conda-forge-package]\n[![Conda (channel only)](https:\u002F\u002Fimg.shields.io\u002Fconda\u002Fvn\u002Fconda-forge\u002Ftextgrad?logo=anaconda&style=flat&color=orange)][#conda-forge-package]\n\n[#license-gh-package]: https:\u002F\u002Flbesson.mit-license.org\u002F\n[#arxiv-paper-package]: https:\u002F\u002Farxiv.org\u002Fabs\u002F2406.07496\n[#docs-package]: https:\u002F\u002Ftextgrad.readthedocs.io\u002Fen\u002Flatest\u002F?badge=latest\n[#pypi-package]: https:\u002F\u002Fpypi.org\u002Fproject\u002Ftextgrad\u002F\n[#conda-forge-package]: https:\u002F\u002Fanaconda.org\u002Fconda-forge\u002Ftextgrad\n[#nature-link]: https:\u002F\u002Fwww.nature.com\u002Farticles\u002Fs41586-025-08661-4\n\n\u003C!--- BADGES: END --->\n\n## TextGrad: Automatic ''Differentiation'' via Text\n\nAn autograd engine -- for textual gradients!\n\nTextGrad is a powerful framework  building automatic ``differentiation'' via text.\nTextGrad implements backpropagation through text feedback provided by LLMs, strongly building on the gradient metaphor\n\nWe provide a simple and intuitive API that allows you to define your own loss functions and optimize them using text feedback.\nThis API is similar to the Pytorch API, making it simple to adapt to your usecases.\n\n![Analogy with Torch](assets\u002Fanalogy.png)\n\n\n### Updates:\n\n**19th March 2025**\n\nTextGrad published in [Nature](https:\u002F\u002Fwww.nature.com\u002Farticles\u002Fs41586-025-08661-4)!\n\n**Past Updates**:\n\nWe are introducing a new engine based on [litellm](https:\u002F\u002Fgithub.com\u002FBerriAI\u002Flitellm). This should allow\nyou to use any model you like, as long as it is supported by litellm. This means that now\n**Bedrock, Together, Gemini and even more** are all supported by TextGrad!\n\nThis should be seen as experimental but we plan to depreciate the old engines in the future.\n\nIn addition to this, with the new engines it should be easy to enable and disable caching.  \n\nWe are in the process of testing these new engines and deprecating the old engines. If you have any issues, please let us know!\n\nThe new litellm engines can be loaded with the following code: \n\nAn example of loading a litellm engine:\n```python\nengine = get_engine(\"experimental:gpt-4o\", cache=False)\n\n# this also works with\n\nset_backward_engine(\"experimental:gpt-4o\", cache=False)\n```\n\nBe sure to set the relevant environment variables for the new engines!\n\nAn example of forward pass:\n```python\n\nimport httpx\nfrom textgrad.engine_experimental.litellm import LiteLLMEngine\n\nLiteLLMEngine(\"gpt-4o\", cache=True).generate(content=\"hello, what's 3+4\", system_prompt=\"you are an assistant\")\n\nimage_url = \"https:\u002F\u002Fupload.wikimedia.org\u002Fwikipedia\u002Fcommons\u002Fa\u002Fa7\u002FCamponotus_flavomarginatus_ant.jpg\"\nimage_data = httpx.get(image_url).content\n\nLiteLLMEngine(\"gpt-4o\", cache=True).generate(content=[image_data, \"what is this my boy\"], system_prompt=\"you are an assistant\")\n```\n\nIn the examples folder you will find two new notebooks that show how to use the new engines.\n\n\n## QuickStart\nIf you know PyTorch, you know 80% of TextGrad.\nLet's walk through the key components with a simple example. Say we want to use GPT-4o to solve a simple\nreasoning problem.\n\nThe question is *If it takes 1 hour to dry 25 shirts under the sun, how long will it take to dry 30 shirts under the sun? Reason step by step.* (Thanks, [Reddit User](https:\u002F\u002Fwww.reddit.com\u002Fr\u002FOpenAI\u002Fcomments\u002F18q479x\u002Fcomment\u002Fkf444es\u002F))\n\n```python\nimport textgrad as tg\n\ntg.set_backward_engine(\"gpt-4o\", override=True)\n\n# Step 1: Get an initial response from an LLM.\nmodel = tg.BlackboxLLM(\"gpt-4o\")\nquestion_string = (\"If it takes 1 hour to dry 25 shirts under the sun, \"\n                   \"how long will it take to dry 30 shirts under the sun? \"\n                   \"Reason step by step\")\n\nquestion = tg.Variable(question_string,\n                       role_description=\"question to the LLM\",\n                       requires_grad=False)\n\nanswer = model(question)\n```\n\n> :warning: **answer: To determine how long it will take to dry 30 shirts under the sun,**\n> **we can use a proportional relationship based on the given information.**\n> **Here’s the step-by-step reasoning: [.....]**\n> **So, it will take 1.2 hours (or 1 hour and 12 minutes) to dry 30 shirts under the sun.**\n\n\nAs you can see, **the model's answer is incorrect.** We can optimize the answer using TextGrad to get the correct answer.\n\n```python\n\nanswer.set_role_description(\"concise and accurate answer to the question\")\n\n# Step 2: Define the loss function and the optimizer, just like in PyTorch!\n# Here, we don't have SGD, but we have TGD (Textual Gradient Descent)\n# that works with \"textual gradients\".\noptimizer = tg.TGD(parameters=[answer])\nevaluation_instruction = (f\"Here's a question: {question_string}. \"\n                           \"Evaluate any given answer to this question, \"\n                           \"be smart, logical, and very critical. \"\n                           \"Just provide concise feedback.\")\n\n\n# TextLoss is a natural-language specified loss function that describes\n# how we want to evaluate the reasoning.\nloss_fn = tg.TextLoss(evaluation_instruction)\n```\n> :brain: **loss: [...] Your step-by-step reasoning is clear and logical,**\n> **but it contains a critical flaw in the assumption that drying time is**\n> **directly proportional to the number of shirts. [...]**\n\n```python\n# Step 3: Do the loss computation, backward pass, and update the punchline.\n# Exact same syntax as PyTorch!\nloss = loss_fn(answer)\nloss.backward()\noptimizer.step()\nanswer\n```\n\n> :white_check_mark: **answer: It will still take 1 hour to dry 30 shirts under the sun,**\n> **assuming they are all laid out properly to receive equal sunlight.**\n\nWe have many more examples around how TextGrad can optimize all kinds of variables -- code, solutions to problems, molecules, prompts, and all that!\n\n### Tutorials\n\nWe have prepared a couple of tutorials to get you started with TextGrad. The order of this\ntutorial is what we would recommend to follow for a beginner. You can run them directly in Google Colab by clicking on the links below (but\nyou need an OpenAI\u002FAnthropic key to run the LLMs).\n\n\u003Cdiv align=\"center\">\n\n| Tutorial                                           | Difficulty                                                      | Colab Link                                                                                                                                                                                                    |\n|----------------------------------------------------|-----------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| 1. Introduction to TextGrad Primitives             | ![](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002FLevel-Beginner-green.svg)      | [![Open In Colab](https:\u002F\u002Fcolab.research.google.com\u002Fassets\u002Fcolab-badge.svg)](https:\u002F\u002Fcolab.research.google.com\u002Fgithub\u002Fzou-group\u002FTextGrad\u002Fblob\u002Fmain\u002Fexamples\u002Fnotebooks\u002FTutorial-Primitives.ipynb)              |\n| 2. Solution Optimization                           | ![](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002FLevel-Beginner-green.svg)      | [![Open In Colab](https:\u002F\u002Fcolab.research.google.com\u002Fassets\u002Fcolab-badge.svg)](https:\u002F\u002Fcolab.research.google.com\u002Fgithub\u002Fzou-group\u002FTextGrad\u002Fblob\u002Fmain\u002Fexamples\u002Fnotebooks\u002FTutorial-Solution-Optimization.ipynb)   |\n| 3. Optimizing a Code Snippet and Define a New Loss | ![](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002FLevel-Beginner-green.svg)      | [![Open In Colab](https:\u002F\u002Fcolab.research.google.com\u002Fassets\u002Fcolab-badge.svg)](https:\u002F\u002Fcolab.research.google.com\u002Fgithub\u002Fzou-group\u002Ftextgrad\u002Fblob\u002Fmain\u002Fexamples\u002Fnotebooks\u002FTutorial-Test-Time-Loss-for-Code.ipynb) |\n| 4. Prompt Optimization                             | ![](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002FLevel-Intermediate-yellow.svg) | [![Open In Colab](https:\u002F\u002Fcolab.research.google.com\u002Fassets\u002Fcolab-badge.svg)](https:\u002F\u002Fcolab.research.google.com\u002Fgithub\u002Fzou-group\u002FTextGrad\u002Fblob\u002Fmain\u002Fexamples\u002Fnotebooks\u002FTutorial-Prompt-Optimization.ipynb)     |\n| 5. MultiModal Optimization                         | ![](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002FLevel-Beginner-green.svg)      | [![Open In Colab](https:\u002F\u002Fcolab.research.google.com\u002Fassets\u002Fcolab-badge.svg)](https:\u002F\u002Fcolab.research.google.com\u002Fgithub\u002Fzou-group\u002FTextGrad\u002Fblob\u002Fmain\u002Fexamples\u002Fnotebooks\u002FTutorial-MultiModal.ipynb)              |\n\n\u003C\u002Fdiv>\n\n\n\n### Installation\n\nYou can install TextGrad using any of the following methods.\n\n**With `pip`**:\n\n```bash\npip install textgrad\n```\n\n**With `conda`**:\n\n```sh\nconda install -c conda-forge textgrad\n```\n\n> :bulb: The conda-forge package for `textgrad` is maintained [here](https:\u002F\u002Fgithub.com\u002Fconda-forge\u002Ftextgrad-feedstock).\n\n**Bleeding edge installation with `pip`**:\n\n```sh\npip install git+https:\u002F\u002Fgithub.com\u002Fzou-group\u002Ftextgrad.git\n```\n\n**Installing textgrad with vllm**:\n\n```sh\npip install textgrad[vllm]\n```\n\nSee [here](https:\u002F\u002Fpip.pypa.io\u002Fen\u002Fstable\u002Fcli\u002Fpip_install\u002F) for more details on various methods of pip installation.\n\n## More detailed examples\n\n### Minimal Instance Optimization Example\n\nTextGrad can optimize unstructured variables, such as text. Let us have an initial solution to a math problem that we want to improve. Here's how to do it with TextGrad, using GPT-4o:\n\n```python\ntg.set_backward_engine(\"gpt-4o\")\n\ninitial_solution = \"\"\"To solve the equation 3x^2 - 7x + 2 = 0, we use the quadratic formula:\nx = (-b ± √(b^2 - 4ac)) \u002F 2a\na = 3, b = -7, c = 2\nx = (7 ± √((-7)^2 - 4 * 3(2))) \u002F 6\nx = (7 ± √(7^3) \u002F 6\nThe solutions are:\nx1 = (7 + √73)\nx2 = (7 - √73)\"\"\"\n\n# Define the variable to optimize, let requires_grad=True to enable gradient computation\nsolution = tg.Variable(initial_solution,\n                       requires_grad=True,\n                       role_description=\"solution to the math question\")\n\n# Define the optimizer, let the optimizer know which variables to optimize, and run the loss function\n\nloss_fn = tg.TextLoss(\"You will evaluate a solution to a math question. Do not attempt to solve it yourself, do not give a solution, only identify errors. Be super concise.\")\n\noptimizer = tg.TGD(parameters=[solution])\nloss = loss_fn(solution)\n```\n\nOutput:\n> Variable(value=Errors:\n> 1. Incorrect sign in the discriminant calculation: it should be b^2 - 4ac, not b^2 + 4ac.\n> 2. Incorrect simplification of the quadratic formula: the denominator should be 2a, not 6.\n> 3. Final solutions are missing the division by 2a., role=response from the language model, grads=)\n\n```python\nloss.backward()\noptimizer.step()\nprint(solution.value)\n```\n\nOutput:\n> To solve the equation 3x^2 - 7x + 2 = 0, we use the quadratic formula:\n> x = (-b ± √(b^2 - 4ac)) \u002F 2a\n>\n> Given:\n> a = 3, b = -7, c = 2\n>\n> Substitute the values into the formula:\n> x = (7 ± √((-7)^2 - 4(3)(2))) \u002F 6\n> x = (7 ± √(49 - 24)) \u002F 6\n> x = (7 ± √25) \u002F 6\n> x = (7 ± 5) \u002F 6\n>\n> The solutions are:\n> x1 = (7 + 5) \u002F 6 = 12 \u002F 6 = 2\n> x2 = (7 - 5) \u002F 6 = 2 \u002F 6 = 1\u002F3\n\n### Minimal Prompt Optimization Example\nTextGrad can also optimize prompts in PyTorch style! Here's how to do it with TextGrad, using GPT-4o for feedback, and optimizing a prompt for gpt-3.5-turbo:\n```python\nimport textgrad as tg\nfrom textgrad.tasks import load_task\n\nllm_engine = tg.get_engine(\"gpt-3.5-turbo\")\ntg.set_backward_engine(\"gpt-4o\")\n\n_, val_set, _, eval_fn = load_task(\"BBH_object_counting\", llm_engine)\nquestion_str, answer_str = val_set[0]\nquestion = tg.Variable(question_str, role_description=\"question to the LLM\", requires_grad=False)\nanswer = tg.Variable(answer_str, role_description=\"answer to the question\", requires_grad=False)\n```\n\nQuestion:\n> I have two stalks of celery, two garlics, a potato, three heads of broccoli, a carrot, and a yam. How many vegetables do I have?\n\nGround Truth Answer:\n> 10\n\n```python\nsystem_prompt = tg.Variable(\"You are a concise LLM. Think step by step.\",\n                            requires_grad=True,\n                            role_description=\"system prompt to guide the LLM's reasoning strategy for accurate responses\")\n\nmodel = tg.BlackboxLLM(llm_engine, system_prompt=system_prompt)\noptimizer = tg.TGD(parameters=list(model.parameters()))\n\nprediction = model(question)\n```\n\nPrediction:\n> You have a total of seven vegetables: two stalks of celery, two garlics, one potato, three heads of broccoli, one carrot, and one yam.\n\n```python\nloss = eval_fn(inputs=dict(prediction=prediction, ground_truth_answer=answer))\n```\n\nLoss denoting accuracy:\n> Variable(value=0, grads=)\n\n```python\nloss.backward()\n```\n\nSystem prompt gradients:\n> ... 2. **Encourage Explicit Summation**: - The prompt should encourage the model to explicitly state the summation process. This can help in verifying the accuracy of the count. For example, \"Explain your calculations clearly and verify the total.\"....\n\n```python\noptimizer.step()\n```\n\nNew system prompt value:\n> You are a concise LLM. Think step by step. Prioritize accuracy in your calculations. Identify and count each item individually. Explain your calculations clearly and verify the total. After calculating, review your steps to ensure the total is correct. If you notice a discrepancy in your count, re-evaluate the list and correct any mistakes.\n\n```python\nprediction = model(question)\n```\n\nNew prediction:\n> Let's count the number of each vegetable:\n> 1. Celery stalks: 2\n> 2. Garlics: 2\n> 3. Potato: 1\n> 4. Broccoli heads: 3\n> 5. Carrot: 1\n> 6. Yam: 1\n>\n> Now, let's add up the total number of vegetables:\n> 2 + 2 + 1 + 3 + 1 + 1 = 10\n>\n> You have a total of 10 vegetables.\n\n## Resources\n\n### Inspiration\nMany existing works greatly inspired this project! Here is a non-exhaustive list:\n- 📚 [PyTorch](https:\u002F\u002Fgithub.com\u002Fpytorch\u002Fpytorch\u002F) The one and only. We owe a ton to PyTorch, hard to do justice here.\n- 📚 [DSPy](https:\u002F\u002Fgithub.com\u002Fstanfordnlp\u002Fdspy) is a pioneer in writing LM-based programs in many different ways! Has been a huge inspiration for us.\n- 📚 [Micrograd](https:\u002F\u002Fgithub.com\u002Fkarpathy\u002Fmicrograd): A tiny autograd engine greatly inspired our simple design!\n- 📚 [ProTeGi](https:\u002F\u002Fgithub.com\u002Fmicrosoft\u002FLMOps\u002Ftree\u002Fmain\u002Fprompt_optimization): We owe the term \"Textual Gradients\" to ProTeGi!\n- 📚 [Reflexion](https:\u002F\u002Fgithub.com\u002Fnoahshinn\u002Freflexion): A self-reflection that showed us the power of text-based reflection!\n\n### Citation\n```bibtex\n@article{yuksekgonul2025optimizing,\n  title={Optimizing generative AI by backpropagating language model feedback},\n  author={Yuksekgonul, Mert and Bianchi, Federico and Boen, Joseph and Liu, Sheng and Lu, Pan and Huang, Zhi and Guestrin, Carlos and Zou, James},\n  journal={Nature},\n  volume={639},\n  pages={609--616},\n  year={2025},\n}\n```\n\n\n### Contributors\n\nWe are grateful for all the help we got from our contributors!\n\n\u003C!-- readme: contributors -start -->\n\u003Ctable>\n\t\u003Ctbody>\n\t\t\u003Ctr>\n            \u003Ctd align=\"center\">\n                \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fvinid\">\n                    \u003Cimg src=\"https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F2234699?v=4\" width=\"100;\" alt=\"vinid\"\u002F>\n                    \u003Cbr \u002F>\n                    \u003Csub>\u003Cb>Federico Bianchi\u003C\u002Fb>\u003C\u002Fsub>\n                \u003C\u002Fa>\n            \u003C\u002Ftd>\n            \u003Ctd align=\"center\">\n                \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fmertyg\">\n                    \u003Cimg src=\"https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F29640736?v=4\" width=\"100;\" alt=\"mertyg\"\u002F>\n                    \u003Cbr \u002F>\n                    \u003Csub>\u003Cb>Mert Yuksekgonul\u003C\u002Fb>\u003C\u002Fsub>\n                \u003C\u002Fa>\n            \u003C\u002Ftd>\n            \u003Ctd align=\"center\">\n                \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fnihalnayak\">\n                    \u003Cimg src=\"https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F5679782?v=4\" width=\"100;\" alt=\"nihalnayak\"\u002F>\n                    \u003Cbr \u002F>\n                    \u003Csub>\u003Cb>Nihal Nayak\u003C\u002Fb>\u003C\u002Fsub>\n                \u003C\u002Fa>\n            \u003C\u002Ftd>\n            \u003Ctd align=\"center\">\n                \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fsugatoray\">\n                    \u003Cimg src=\"https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F10201242?v=4\" width=\"100;\" alt=\"sugatoray\"\u002F>\n                    \u003Cbr \u002F>\n                    \u003Csub>\u003Cb>Sugato Ray\u003C\u002Fb>\u003C\u002Fsub>\n                \u003C\u002Fa>\n            \u003C\u002Ftd>\n            \u003Ctd align=\"center\">\n                \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Flupantech\">\n                    \u003Cimg src=\"https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F17663606?v=4\" width=\"100;\" alt=\"lupantech\"\u002F>\n                    \u003Cbr \u002F>\n                    \u003Csub>\u003Cb>Pan Lu\u003C\u002Fb>\u003C\u002Fsub>\n                \u003C\u002Fa>\n            \u003C\u002Ftd>\n            \u003Ctd align=\"center\">\n                \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fruanwz\">\n                    \u003Cimg src=\"https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F4874?v=4\" width=\"100;\" alt=\"ruanwz\"\u002F>\n                    \u003Cbr \u002F>\n                    \u003Csub>\u003Cb>David Ruan\u003C\u002Fb>\u003C\u002Fsub>\n                \u003C\u002Fa>\n            \u003C\u002Ftd>\n\t\t\u003C\u002Ftr>\n\t\t\u003Ctr>\n            \u003Ctd align=\"center\">\n                \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fsanowl\">\n                    \u003Cimg src=\"https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F99511815?v=4\" width=\"100;\" alt=\"sanowl\"\u002F>\n                    \u003Cbr \u002F>\n                    \u003Csub>\u003Cb>San \u003C\u002Fb>\u003C\u002Fsub>\n                \u003C\u002Fa>\n            \u003C\u002Ftd>\n            \u003Ctd align=\"center\">\n                \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fhuangzhii\">\n                    \u003Cimg src=\"https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F10902358?v=4\" width=\"100;\" alt=\"huangzhii\"\u002F>\n                    \u003Cbr \u002F>\n                    \u003Csub>\u003Cb>Zhi Huang\u003C\u002Fb>\u003C\u002Fsub>\n                \u003C\u002Fa>\n            \u003C\u002Ftd>\n            \u003Ctd align=\"center\">\n                \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fajms\">\n                    \u003Cimg src=\"https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F2394425?v=4\" width=\"100;\" alt=\"ajms\"\u002F>\n                    \u003Cbr \u002F>\n                    \u003Csub>\u003Cb>Albert\u003C\u002Fb>\u003C\u002Fsub>\n                \u003C\u002Fa>\n            \u003C\u002Ftd>\n            \u003Ctd align=\"center\">\n                \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Ftboen1\">\n                    \u003Cimg src=\"https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F46495807?v=4\" width=\"100;\" alt=\"tboen1\"\u002F>\n                    \u003Cbr \u002F>\n                    \u003Csub>\u003Cb>tboen1\u003C\u002Fb>\u003C\u002Fsub>\n                \u003C\u002Fa>\n            \u003C\u002Ftd>\n            \u003Ctd align=\"center\">\n                \u003Ca href=\"https:\u002F\u002Fgithub.com\u002FAtakanTekparmak\">\n                    \u003Cimg src=\"https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F59488384?v=4\" width=\"100;\" alt=\"AtakanTekparmak\"\u002F>\n                    \u003Cbr \u002F>\n                    \u003Csub>\u003Cb>Atakan Tekparmak\u003C\u002Fb>\u003C\u002Fsub>\n                \u003C\u002Fa>\n            \u003C\u002Ftd>\n\t\t\u003C\u002Ftr>\n\t\u003Ctbody>\n\u003C\u002Ftable>\n\u003C!-- readme: contributors -end -->\n","TextGrad 是一个通过文本实现自动“微分”的框架，利用大型语言模型进行文本梯度的反向传播。其核心功能包括支持自定义损失函数并通过文本反馈进行优化，API 设计直观简洁，与 PyTorch 类似，易于上手。此外，TextGrad 支持多种模型，并提供了灵活的缓存选项。该项目特别适合需要对基于文本的输入进行优化的场景，例如提示词优化等任务，能够帮助研究人员和开发者更高效地迭代和完善他们的自然语言处理应用。",2,"2026-06-11 03:41:07","high_star"]